示例#1
0
 function __construct()
 {
     $this->plugin_url = self::get_plugin_url();
     //plugins_url() . '/' . $this->plugin_name;
     $this->plugin_path = self::get_plugin_path();
     //plugin_dir_path($rootfile);
     $this->plugin_name = trim(basename($this->plugin_path), '/');
     $this->installed_version = get_option('MAXBUTTONS_VERSION_KEY');
     maxInstall::check_database();
     // sigh
     add_action('init', array($this, 'load_textdomain'));
     add_action('admin_init', array($this, 'addthick'));
     add_filter('widget_text', 'do_shortcode');
     add_shortcode('maxbutton', array($this, 'shortcode'));
     add_action("mb-footer", array($this, 'do_footer'), 10, 3);
     add_action("wp_footer", array($this, "footer"));
     add_action('media_buttons_context', array($this, 'maxbuttons_media_button'));
     add_filter('plugin_action_links', array($this, "plugin_action_links"), 10, 2);
     add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
     add_filter("admin_footer_text", array($this, "admin_footer_text"));
     if (is_admin()) {
         add_action('admin_enqueue_scripts', array($this, 'add_admin_styles'));
         add_action('admin_enqueue_scripts', array($this, 'add_admin_scripts'));
         add_action('admin_init', array($this, 'register_settings'));
         add_action('admin_menu', array($this, 'admin_menu'));
         add_action('admin_footer', array($this, 'media_button_admin_footer'));
         add_action('admin_footer', array($this, "footer"));
         // errors in user space. No internal error but user output friendly issues
         add_action("mb_display_notices", array($this, "display_notices"));
         add_action("wp_ajax_getAjaxButtons", array('maxButtonsAdmin', 'getAjaxButtons'));
     }
     $this->setMainClasses();
     // struct for override functionality
     // The second the blocks are being loaded, check dbase integrity
     add_action("mb_blockclassesloaded", array($this, "check_database"));
     self::$instance = $this;
 }
 function __construct()
 {
     maxUtils::timeInit();
     // benchmark timer init.
     $this->plugin_url = self::get_plugin_url();
     //plugins_url() . '/' . $this->plugin_name;
     $this->plugin_path = self::get_plugin_path();
     //plugin_dir_path($rootfile);
     $this->plugin_name = trim(basename($this->plugin_path), '/');
     $this->installed_version = get_option('MAXBUTTONS_VERSION_KEY');
     maxInstall::check_database();
     // sigh
     add_action('plugins_loaded', array($this, 'load_textdomain'));
     add_action('init', array($this, 'do_review_notice'));
     add_action('admin_init', array($this, 'addthick'));
     add_filter('widget_text', 'do_shortcode');
     add_shortcode('maxbutton', array($this, 'shortcode'));
     add_action("mb-footer", array($this, 'do_footer'), 10, 3);
     add_action("wp_footer", array($this, "footer"));
     add_action('media_buttons_context', array($this, 'maxbuttons_media_button'));
     add_filter('plugin_action_links', array($this, "plugin_action_links"), 10, 2);
     add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
     add_filter("admin_footer_text", array($this, "admin_footer_text"));
     if (is_admin()) {
         add_action('admin_enqueue_scripts', array($this, 'add_admin_styles'));
         add_action('admin_enqueue_scripts', array($this, 'add_admin_scripts'));
         add_action('admin_init', array($this, 'register_settings'));
         add_action('admin_menu', array($this, 'admin_menu'));
         add_action('admin_footer', array($this, 'media_button_admin_footer'));
         add_action('admin_footer', array($this, "footer"));
         // errors in user space. No internal error but user output friendly issues
         add_action("mb_display_notices", array($this, "display_notices"));
         add_action("wp_ajax_getAjaxButtons", array('maxButtonsAdmin', 'getAjaxButtons'));
         add_action("wp_ajax_set_review_notice_status", array($this, "setReviewNoticeStatus"));
         // Collection AJAX
         add_action("wp_ajax_collection-edit", array("maxCollections", "ajax_save"));
         add_action('wp_ajax_mbpro_collection_block', array("maxCollections", "ajax_action"));
         // all block level ajax stuff - for logged in users - backend
         add_action('wp_ajax_mb_button_action', array('maxButtons', "ajax_action"));
     }
     // FRONT AJAX
     add_action('wp_ajax_mbpro_collection_block_front', array("maxCollections", "ajax_action_front"));
     // front end for all users
     add_action('wp_ajax_nopriv_mbpro_collection_block_front', array("maxCollections", "ajax_action_front"));
     // front scripts
     add_action('wp_enqueue_scripts', array($this, 'front_scripts'));
     $this->setMainClasses();
     // struct for override functionality
     // The second the blocks are being loaded, check dbase integrity
     add_action("mb_blockclassesloaded", array($this, "check_database"));
     // setup page hooks and shortcode
     add_shortcode('maxcollection', array($this, 'collection_shortcode'));
     if (!is_admin()) {
         $hook_bool = maxCollections::setupHooks();
     }
     // setup the hooks to insert collections
     //if ($hook_bool)
     //	add_filter("the_content", array('maxCollections', "doHooks"));
     self::$instance = $this;
     maxIntegrations::init();
     // fire the integrations.
 }