示例#1
0
 /**
  * Activate plugin.
  *
  * The plugin will register its core if the requirements are full filled , otherwise
  * it will show an admin error message
  *
  * @return bool false if plugin can not be activated
  */
 public function activate()
 {
     if (!static::canActivate()) {
         FlashMessages::remove(MessagesInterface::MSG_SUPPORT);
         FlashMessages::add(MessagesInterface::MSG_ACTIVATE_ERROR, static::getView('Messages/activateError'), array('error'), true);
         return false;
     }
     FlashMessages::remove(MessagesInterface::MSG_ACTIVATE_ERROR);
     FlashMessages::add(MessagesInterface::MSG_SUPPORT, static::getView('Messages/support'));
     $this->registerCore();
 }
示例#2
0
 /**
  * Show flash messages
  *
  * Show endpoints flash messages in defined screens only
  */
 public function showFlashMessages()
 {
     $screen = get_current_screen();
     $allowedPages = array('edit-shop_order', 'woocommerce_page_wc-settings', 'settings_page_mlang', 'woopoly');
     if (in_array($screen->id, $allowedPages)) {
         FlashMessages::add(MessagesInterface::MSG_ENDPOINTS_TRANSLATION, Plugin::getView('Messages/endpointsTranslations'));
     }
 }