/** * Check some thinks on plugin activation * * @since 0.0.1 * @access public * @static * @return void */ public static function on_activate() { // check WordPress version if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) { deactivate_plugins(RW_Sticky_Activity::$plugin_filename); die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_Sticky_Activity::get_textdomain()), RW_Sticky_Activity::get_plugin_data('Name'))); } // check php version if (version_compare(PHP_VERSION, '5.3.0', '<')) { deactivate_plugins(RW_Sticky_Activity::$plugin_filename); die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_Sticky_Activity::get_textdomain()), RW_Sticky_Activity::get_plugin_data('Name'), PHP_VERSION)); } // check buddypress if (!function_exists('bp_activities')) { deactivate_plugins(RW_Sticky_Activity::$plugin_filename); die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires BuddyPress to work.', RW_Sticky_Activity::get_textdomain()), RW_Sticky_Activity::get_plugin_data('Name'), PHP_VERSION)); } }
/** * Check some thinks on plugin activation * * @since 0.0.1 * @access public * @static * @return void */ public static function on_activate() { // check WordPress version if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) { deactivate_plugins(RW_Demo_Plugin::$plugin_filename); //@TODO Klassename die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_Demo_Plugin::get_textdomain()), RW_Demo_Plugin::get_plugin_data('Name'))); } // check php version if (version_compare(PHP_VERSION, '5.3.0', '<')) { deactivate_plugins(RW_Demo_Plugin::$plugin_filename); // @TODO Klassenanme die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_Demo_Plugin::get_textdomain()), RW_Demo_Plugin::get_plugin_data('Name'), PHP_VERSION)); } // check buddypress @TODO Nur wenn BuddyPress activity für das Plugin nötig ist if (!function_exists('bp_activities')) { deactivate_plugins(RW_Demo_Plugin::$plugin_filename); //@TODO Klassenname die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires BuddyPress to work.', RW_Sticky_Activity::get_textdomain()), RW_Sticky_Activity::get_plugin_data('Name'), PHP_VERSION)); } // @TODO Hier weitere Checks einbaun die das Plugin ggf als Abhängigkeiten hat. MU, bbPress usw }
/** * get the textdomain * * @since 0.0.1 * @static * @access public * @return string textdomain */ public static function get_textdomain() { if (is_null(self::$textdomain)) { self::$textdomain = self::get_plugin_data('TextDomain'); } return self::$textdomain; }