Beispiel #1
0
 /**
  * Registers older plugins that did not use this class
  *
  * @TODO Consider removing this in 5.0
  */
 private function add_legacy_plugins()
 {
     // Version 4.2 and under of the plugins do not register themselves here, so we'll register them
     $tribe_plugins = new Tribe__Plugins();
     foreach ($tribe_plugins->get_list() as $plugin) {
         if (!class_exists($plugin['class'])) {
             continue;
         }
         $ver_const = $plugin['class'] . '::VERSION';
         $version = defined($ver_const) ? constant($ver_const) : null;
         $this->add_active_plugin($plugin['class'], $version);
     }
 }
Beispiel #2
0
 /**
  * Checks if this plugin has permission to run, if not it notifies the admin
  *
  * @param string $file_path   Full file path to the base plugin file
  * @param string $main_class  The Main/base class for this plugin
  * @param string $version     The version
  * @param array  $classes_req Any Main class files/tribe plugins required for this to run
  *
  * @return bool Indicates if plugin should continue initialization
  */
 function tribe_register_plugin($file_path, $main_class, $version, $classes_req = array())
 {
     $tribe_plugins = Tribe__Dependency::instance();
     if ($tribe_plugins->has_requisite_plugins($classes_req)) {
         $tribe_plugins->add_active_plugin($main_class, $version, $file_path);
         return true;
     } elseif (is_admin()) {
         $tribe_plugins = new Tribe__Plugins();
         $admin_notice = new Tribe__Plugin_Download_Notice($file_path);
         foreach ($classes_req as $class => $version) {
             $plugin = $tribe_plugins->get_plugin_by_class($class);
             $admin_notice->add_required_plugin($plugin['short_name'], $plugin['thickbox_url']);
         }
     }
     return false;
 }
 /**
  * Checks if this plugin has permission to run, if not it notifies the admin
  *
  * @param string $file_path   Full file path to the base plugin file
  * @param string $main_class  The Main/base class for this plugin
  * @param string $version     The version
  * @param array  $classes_req Any Main class files/tribe plugins required for this to run
  *
  * @return bool Indicates if plugin should continue initialization
  */
 function tribe_register_plugin($file_path, $main_class, $version, $classes_req = array())
 {
     $tribe_dependency = Tribe__Dependency::instance();
     $should_plugin_run = true;
     // Checks to see if the plugins are active
     if (!empty($classes_req) && !$tribe_dependency->has_requisite_plugins($classes_req)) {
         $should_plugin_run = false;
         $tribe_plugins = new Tribe__Plugins();
         $admin_notice = new Tribe__Admin__Notice__Plugin_Download($file_path);
         foreach ($classes_req as $class => $version) {
             $plugin = $tribe_plugins->get_plugin_by_class($class);
             $is_active = $tribe_dependency->is_plugin_version($class, $version);
             $admin_notice->add_required_plugin($plugin['short_name'], $plugin['thickbox_url'], $is_active);
         }
     }
     if ($should_plugin_run) {
         $tribe_dependency->add_active_plugin($main_class, $version, $file_path);
     }
     return $should_plugin_run;
 }
 /**
  * Registers older plugins that did not implement this class
  *
  * @TODO Consider removing this in 5.0
  */
 public function add_legacy_plugins()
 {
     $tribe_plugins = new Tribe__Plugins();
     foreach ($tribe_plugins->get_list() as $plugin) {
         // Only add plugin if it's present and not already added
         if (!class_exists($plugin['class']) || array_key_exists($plugin['class'], $this->active_plugins)) {
             continue;
         }
         $ver_const = $plugin['class'] . '::VERSION';
         $version = defined($ver_const) ? constant($ver_const) : null;
         $this->add_active_plugin($plugin['class'], $version);
     }
 }