Example #1
0
 /**
  * Class constructor
  *
  * @since   0.1.0
  * @change  1.4.0
  */
 public function __construct()
 {
     /* Skip me! */
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE or defined('DOING_AJAX') && DOING_AJAX) {
         return;
     }
     /* Table init */
     Statify_Table::init();
     /* Plugin options */
     self::$_options = wp_parse_args(get_option('statify'), array('days' => 14, 'limit' => 3, 'today' => 0, 'snippet' => 0));
     /* XMLRPC */
     if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) {
         add_filter('xmlrpc_methods', array('Statify_XMLRPC', 'xmlrpc_methods'));
         /* Cron */
     } else {
         if (defined('DOING_CRON') && DOING_CRON) {
             add_action('statify_cleanup', array('Statify_Cron', 'cleanup_data'));
             /* Backend */
         } else {
             if (is_admin()) {
                 add_action('wpmu_new_blog', array('Statify_Install', 'init'));
                 add_action('delete_blog', array('Statify_Uninstall', 'init'));
                 add_action('wp_dashboard_setup', array('Statify_Dashboard', 'init'));
                 add_filter('plugin_row_meta', array('Statify_Backend', 'add_meta_link'), 10, 2);
                 add_filter('plugin_action_links_' . STATIFY_BASE, array('Statify_Backend', 'add_action_link'));
                 /* Frontend */
             } else {
                 add_action('template_redirect', array('Statify_Frontend', 'track_visit'));
                 add_filter('query_vars', array('Statify_Frontend', 'query_vars'));
                 add_action('wp_footer', array('Statify_Frontend', 'wp_footer'));
             }
         }
     }
 }
 /**
  * Löschung der Daten
  *
  * @since   0.1.0
  * @change  1.4.0
  */
 private static function _apply()
 {
     /* Delete options */
     delete_option('statify');
     /* Init table */
     Statify_Table::init();
     /* Delete table */
     Statify_Table::drop();
 }
 /**
  * Anlegen der Daten
  *
  * @since   0.1.0
  * @change  1.4.0
  */
 private static function _apply()
 {
     /* Options */
     add_option('statify', array());
     /* Transients */
     delete_transient('statify_data');
     /* Cron */
     if (!wp_next_scheduled('statify_cleanup')) {
         wp_schedule_event(time(), 'daily', 'statify_cleanup');
     }
     /* Tabelle setzen */
     Statify_Table::init();
     /* Tabelle anlegen */
     Statify_Table::create();
 }