コード例 #1
0
 /**
  * Initialize the plugin
  */
 public function init()
 {
     // Load plugin textdomain
     load_plugin_textdomain('post-connector', false, dirname(plugin_basename(Post_Connector::get_plugin_file())) . '/languages/');
     // Setup autoloader
     require_once self::get_core_dir() . '/classes/class-autoloader.php';
     $autoloader = new SP_Autoloader(self::get_core_dir());
     spl_autoload_register(array($autoloader, 'load'));
     // Filters
     $manager_filter = new SP_Manager_Filter(plugin_dir_path(__FILE__) . 'filters/');
     $manager_filter->load_filters();
     // Hooks
     $manager_hook = new SP_Manager_Hook(plugin_dir_path(__FILE__) . 'hooks/');
     $manager_hook->load_hooks();
     // Shortcodes
     $manager_shortcode = new SP_Manager_Shortcode();
     $manager_shortcode->load_shortcodes();
     // Widgets
     $manager_widget = new SP_Manager_Widget(plugin_dir_path(__FILE__) . 'widgets/');
     $manager_widget->load();
     // Menu init
     SP_Admin_Menu::get();
     // Plugin upgrader
     if (is_admin()) {
         $plugin_updater = new SP_Upgrade_Manager();
         $plugin_updater->check_update();
     }
 }
コード例 #2
0
 /**
  * Post Connector constructor
  */
 public function __construct()
 {
     // Load autoloader
     require_once self::get_core_dir() . '/classes/class-autoloader.php';
     // Setup premium autoloader
     $autoloader = new SP_Autoloader(self::get_premium_dir());
     $autoloader = new SP_Autoloader(self::get_premium_dir());
     if (version_compare(PHP_VERSION, '5.3', '>=')) {
         spl_autoload_register(array($autoloader, 'load'), true, true);
     } else {
         spl_autoload_register(array($autoloader, 'load'), true);
     }
     // Do the parent int
     parent::init();
     // Load deprecated file
     require_once self::get_premium_dir() . 'deprecated.php';
     // Setup premium manager hooks
     $premium_manager_hook = new SP_Manager_Hook(self::get_premium_dir() . 'classes/hooks/');
     $premium_manager_hook->load_hooks();
     // Setup premium manager filters
     $manager_filter = new SP_Manager_Filter(self::get_premium_dir() . 'classes/filters/');
     $manager_filter->load_filters();
     // Widgets
     $manager_widget = new SP_Manager_Widget(self::get_premium_dir() . 'classes/widgets/');
     $manager_widget->load();
     // Setup the license hooks
     $license_manager = new Yoast_Plugin_License_Manager(new SP_Product_Post_Connector());
     $license_manager->setup_hooks();
     // Plugin upgrader
     if (is_admin()) {
         $premium_upgrade_manager = new SP_Premium_Upgrade_Manager();
         $premium_upgrade_manager->check_update();
     }
 }