Advertisement
verygoodplugins

Untitled

Mar 6th, 2020
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.29 KB | None | 0 0
  1. <?php
  2.  
  3. class FEN_Groundhogg extends FEN_Integration {
  4.  
  5.     public $slug = 'groundhogg';
  6.  
  7.     public $title = 'Groundhogg';
  8.  
  9.     /**
  10.      * Get registered error types
  11.      *
  12.      * @return array Types
  13.      */
  14.  
  15.     public function get_error_types() {
  16.  
  17.         $types = array(
  18.             'email_api_error' => 'Email sending error',
  19.             'cron_error'      => 'Cron error',
  20.         );
  21.  
  22.         return $types;
  23.  
  24.     }
  25.  
  26.     /**
  27.      * Get things started
  28.      *
  29.      * @return void
  30.      */
  31.  
  32.     public function init() {
  33.  
  34.         add_action( 'groundhogg/email_result', array( $this, 'handle_email_result' ), 10, 2 );
  35.         add_action( 'groundhogg/cron_action_happened', array( $this, 'handle_cron_action' ), 10, 2 );
  36.  
  37.     }
  38.  
  39.     /**
  40.      * Report error
  41.      *
  42.      * @return void
  43.      */
  44.  
  45.     public function handle_email_result( $some_stuff, $status ) {
  46.  
  47.         if ( 'error' !== $status ) {
  48.             return;
  49.         }
  50.  
  51.         $error = array(
  52.             'type'    => 'email_api_error',
  53.             'message' => 'Error doing x y z :'
  54.         );
  55.  
  56.         $this->handle_error( $error );
  57.  
  58.     }
  59.  
  60.     /**
  61.      * Report error
  62.      *
  63.      * @return void
  64.      */
  65.  
  66.     public function handle_cron_action( $some_stuff, $status ) {
  67.  
  68.         if ( 'error' !== $status ) {
  69.             return;
  70.         }
  71.  
  72.         $error = array(
  73.             'type'    => 'cron_error',
  74.             'message' => 'Error doing x y z :'
  75.         );
  76.  
  77.         $this->handle_error( $error );
  78.  
  79.     }
  80.  
  81. }
  82.  
  83. new FEN_Groundhogg;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement