Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
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();
     }
 }
Ejemplo n.º 3
0
 /**
  * @return mixed|void
  */
 protected function _getLicenseCode()
 {
     return IfwPsn_Wp_Proxy_Filter::apply('envato_license_code', $this->_pm->getOptionsManager()->getOption('license_code'));
 }