public function __construct() { // Addon information $this->set_provider(array('name' => __('Standard Elements', WR_PBL), 'file' => __FILE__, 'shortcode_dir' => dirname(__FILE__), 'js_shortcode_dir' => 'assets/js/shortcodes')); //$this->custom_assets(); // call parent construct parent::__construct(); add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2); }
/** * Check compatibility of Addons vs Core * * @global type $Wr_Sc_Providers */ public static function compatibility_check() { global $Wr_Sc_Providers; $providers = $Wr_Sc_Providers; // get current version of core $core_version = WR_Pb_Helper_Functions::get_plugin_info(WR_PB_FILE, 'Version'); foreach ($providers as $dir => $provider) { if (!empty($provider['file']) && !empty($provider['path'])) { $addon_file = $provider['file']; // get value of core version required $core_required = WR_Pb_Addon::core_version_requied_value($provider, $addon_file); if ($core_required) { // addon plugin name $addon_name = WR_Pb_Helper_Functions::get_plugin_info($provider['file_path'], 'Name'); $compatibility = WR_Pb_Addon::compatibility_handle($core_required, $core_version, $addon_file); if (!$compatibility) { // remove provider from list unset($Wr_Sc_Providers[$dir]); // show notice self::$notice[] = WR_Pb_Addon::show_notice(array('addon_name' => $addon_name, 'core_required' => $core_required), 'core_required'); } } } } }
/** * Get Constant value of Constant defines core version required * * @param array $provider * @param string $addon_file * * @return string */ static function core_version_requied_value($provider, $addon_file) { // include defines.php from provider plugin folder, where defines core version required by addon if (file_exists($provider['path'] . 'defines.php')) { include_once $provider['path'] . 'defines.php'; } // get constant name defines core version required $constant = WR_Pb_Addon::core_version_constant($addon_file); // get value of core version required return defined($constant) ? constant($constant) : NULL; }