Beispiel #1
0
 protected function _registerLiteNav()
 {
     if (!$this->_pm->isPremium()) {
         IfwPsn_Wp_Proxy_Action::addPlugin($this->_pm, 'after_admin_navigation_rules', array($this, 'addMailTplNav'));
         IfwPsn_Wp_Proxy_Action::addPlugin($this->_pm, 'after_admin_navigation_htmlmails', array($this, 'addRecipientsListsNav'));
     }
 }
Beispiel #2
0
 /**
  * @param IfwPsn_Wp_Plugin_Manager $pm
  */
 protected static function _dropTable($pm)
 {
     global $wpdb;
     if ($pm->isPremium() || !$pm->isPremium() && !IfwPsn_Wp_Proxy_Blog::isPluginActive('post-status-notifier/post-status-notifier.php')) {
         // only delete rules table if it's the Premium version
         // or it's the Lite version and the Premium version is not activated
         $wpdb->query('DROP TABLE IF EXISTS `' . $wpdb->prefix . 'psn_rules`');
     }
 }
Beispiel #3
0
 /**
  * @param $body
  * @param Psn_Notification_Service_Email $email
  * @return string
  */
 public function filterEmailBody($body, Psn_Notification_Service_Email $email)
 {
     $body = $this->_handleSpecialChars($body);
     if (!$this->_pm->isPremium()) {
         // please respect my work and buy the premium version if you want this plugin to stay alive!
         $body .= PHP_EOL . PHP_EOL . sprintf(__('This email was sent by WordPress plugin "%s". Visit the plugin homepage: %s'), $this->_pm->getEnv()->getName(), $this->_pm->getEnv()->getHomepage());
     }
     return $body;
 }
Beispiel #4
0
 /**
  * @return IfwPsn_Wp_Ajax_Response_Abstract
  */
 public function getResponse()
 {
     if ($this->_pm->hasPremium() && $this->_pm->isPremium()) {
         $this->_addPremiumBlock();
     }
     $this->_addConnectBlock();
     $this->_addHelpBlock();
     $tpl = IfwPsn_Wp_Tpl::getInstance($this->_pm);
     $html = '';
     foreach ($this->_infoBlocks as $block) {
         $params = array('label' => $block['label'], 'content' => $block['content'], 'iconClass' => $block['iconClass']);
         $html .= $tpl->render('metabox_plugininfo_block.html.twig', $params);
     }
     $html .= '<p class="ifw-made-with-heart">This plugin was made with <img src="' . $this->_pm->getEnv()->getSkinUrl() . 'icons/heart.png" /> by <a href="http://www.ifeelweb.de/" target="_blank">ifeelweb.de</a></p>';
     $success = true;
     $response = new IfwPsn_Wp_Ajax_Response_Json($success);
     $response->addData('html', $html);
     return $response;
 }
Beispiel #5
0
 protected function _addOptions()
 {
     $this->_pm->getOptionsManager()->addGeneralOption(new IfwPsn_Wp_Options_Field_Checkbox('psn_ignore_status_inherit', __('Ignore post status "inherit"', 'psn'), __('Status "inherit" is used when post revisions get created by WordPress automatically', 'psn')));
     $this->_pm->getOptionsManager()->addGeneralOption(new IfwPsn_Wp_Options_Field_Checkbox('psn_hide_nonpublic_posttypes', __('Hide non-public post types', 'psn'), __('When selected, non-public post types will be excluded from rule settings form', 'psn')));
     if (!$this->_pm->isPremium()) {
         $smtpOptions = new IfwPsn_Wp_Options_Section('smtp', __('SMTP', 'psn_smtp'));
         $smtpOptions->addField(new IfwPsn_Wp_Options_Field_Checkbox('smtp_teaser', __('Activate SMTP', 'psn'), __('SMTP is a premium feature. You will get all configuration options to connect to your SMTP server.', 'psn')));
         $this->_pm->getBootstrap()->getOptions()->addSection($smtpOptions, 12);
     }
     $placeholderFilterOptions = new IfwPsn_Wp_Options_Section('placeholders', __('Placeholders', 'psn'));
     $placeholderFilterOptions->addField(new IfwPsn_Wp_Options_Field_Textarea('placeholders_filters', __('Placeholders filters', 'psn'), sprintf(__('Here you can define filters which will apply to the placeholders contents (One filter per line). You can use the <a href="%s" target="_blank">Twig filters</a>. Refer to the <a href="%s" target="_blank">documentation</a> for details.<br>Example: [post_date]|date("m/d/Y")', 'psn_smtp'), 'http://twig.sensiolabs.org/doc/filters/index.html', 'http://docs.ifeelweb.de/post-status-notifier/options.html#placeholders')));
     $this->_pm->getBootstrap()->getOptions()->addSection($placeholderFilterOptions, 300);
     // Advanced
     $advancedOptions = new IfwPsn_Wp_Options_Section('advanced', __('Advanced', 'psn'));
     do_action('psn_options_advanced', $advancedOptions);
     if (function_exists('apc_clear_cache')) {
         // APC 502 bad gateway workaround
         $advancedOptions->addField(new IfwPsn_Wp_Options_Field_Checkbox('apc_clear_cache', __('APC clear cache', 'psn'), __('In case you are facing issues when updating rules or email templates (blank page, 502 Bad Gateway on nginx), please activate this option and try again. Or ask your webhost to deactivate APC. This option will deactivate the APC cache on PSN admin pages.', 'psn')));
     }
     $this->_pm->getBootstrap()->getOptions()->addSection($advancedOptions, 400);
 }
Beispiel #6
0
 /**
  * Fires at the end of the update message container in each row of the plugins list table.
  *
  * @param array $plugin_data An array of plugin data.
  * @param $meta_data
  */
 public function getUpdateInlineMessage($plugin_data, $meta_data)
 {
     // slug
     $pluginSlug = $this->_pm->getSlugFilenamePath();
     if ($this->_pm->isPremium()) {
         if (!apply_filters('ifw_woocommerce_is_slug_activated-' . $pluginSlug, false)) {
             if ($this->_pm->getAccess()->isNetworkAdmin()) {
                 $licensePage = network_admin_url($this->_pm->getConfig()->plugin->licensePageNetwork);
             } else {
                 $licensePage = admin_url($this->_pm->getConfig()->plugin->licensePage);
             }
             printf('<div style="padding: 5px 10px; border: 1px dashed red; margin-top: 10px;"><span class="dashicons dashicons-info"></span> %s</div>', sprintf(__('<b>License issue:</b> You have to <a href="%s">active your license</a> to be able to receive updates.', 'ifw'), $licensePage));
         }
     }
 }
Beispiel #7
0
 /**
  * Fires at the end of the update message container in each row of the plugins list table.
  *
  * @param array $plugin_data An array of plugin data.
  * @param $meta_data
  */
 public function onPluginUpdateMessage($plugin_data, $meta_data)
 {
     $plugin_slug = $this->_pm->getPathinfo()->getDirname();
     $request = new IfwPsn_Wp_Plugin_Update_Request($this->_pm);
     $request->setAction('plugin_update_message')->addData('slug', $plugin_slug)->addData('version', $plugin_data['Version'])->addData('lang', IfwPsn_Wp_Proxy_Blog::getLanguage());
     if ($this->_pm->isPremium()) {
         $license = $this->_pm->getOptionsManager()->getOption('license_code');
         $request->addData('license', $license);
     }
     $response = $request->send();
     if ($response->isSuccess()) {
         if ($this->_pm->isPremium() && empty($license)) {
             printf('<div style="padding: 5px 10px; border: 1px dashed red; margin-top: 10px;">%s</div>', sprintf(__('You have to enter your plugin <b>license code</b> in the <a href="%s">plugin options</a> to be able to download this update!', 'ifw'), $this->_pm->getConfig()->plugin->optionsPage));
         }
         echo $response->getBody();
     }
 }
Beispiel #8
0
 /**
  * (non-PHPdoc)
  * @see IfwPsn_Wp_Plugin_Installer_ActivationInterface::execute()
  */
 public function execute(IfwPsn_Wp_Plugin_Manager $pm, $networkwide = false)
 {
     if ($pm->isPremium() && IfwPsn_Wp_Proxy_Blog::isPluginActive('post-status-notifier-lite/post-status-notifier-lite.php')) {
         trigger_error(sprintf(__('The Lite version of this plugin is still activated. Please deactivate it! Refer to the <a href=\\"%s\\">Upgrade Howto</a>.', 'psn'), 'http://docs.ifeelweb.de/post-status-notifier/upgrade_howto.html'));
     }
     $this->_dbPatcher = new Psn_Patch_Database();
     if (IfwPsn_Wp_Proxy_Blog::isMultisite() && $networkwide == true) {
         // multisite installation
         $currentBlogId = IfwPsn_Wp_Proxy_Blog::getBlogId();
         foreach (IfwPsn_Wp_Proxy_Blog::getMultisiteBlogIds() as $blogId) {
             // give every site in the network the default time limit of 30 seconds
             set_time_limit(30);
             IfwPsn_Wp_Proxy_Blog::switchToBlog($blogId);
             $this->_createTable();
             $this->_presetOptions($pm);
         }
         IfwPsn_Wp_Proxy_Blog::switchToBlog($currentBlogId);
     } else {
         // single blog installation
         $this->_createTable();
         $this->_presetOptions($pm);
     }
 }