Example #1
0
 /**
  * @return IfwPsn_Wp_Ajax_Response_Abstract
  */
 public function getResponse()
 {
     $tpl = IfwPsn_Wp_Tpl::getInstance($this->_pm);
     if ($this->_iframeSrc !== null) {
         $iframeSrc = $this->_iframeSrc;
     } elseif (strpos($this->_pm->getConfig()->plugin->optionsPage, 'options-general.php') !== false) {
         $iframeSrc = IfwPsn_Wp_Proxy_Admin::getUrl() . IfwPsn_Wp_Proxy_Admin::getMenuUrl($this->_pm, 'selftest');
         $iframeSrc = str_replace('wp-admin//', 'wp-admin/', $iframeSrc);
     } else {
         $iframeSrc = IfwPsn_Wp_Proxy_Admin::getAdminPageUrl($this->_pm, $this->_pm->getAbbrLower() . '_selftest', $this->_pm->getAbbrLower() . '_selftest');
     }
     $context = array('ajax' => $this, 'iframe_src' => $iframeSrc, 'img_path' => $this->_pm->getEnv()->getUrlAdminImg());
     $timestamp = $this->_pm->getBootstrap()->getSelftester()->getTimestamp();
     if (!empty($timestamp)) {
         require_once $this->_pm->getPathinfo()->getRootLib() . 'IfwPsn/Wp/Date.php';
         $timestamp = IfwPsn_Wp_Date::format($timestamp);
     }
     $context['timestamp'] = $timestamp;
     $status = $this->_pm->getBootstrap()->getSelftester()->getStatus();
     if ($status === true || $status === 'true' || $status == '1') {
         $context['status'] = 'true';
     } elseif ($status === false || $status === 'false' || $status == '0') {
         $context['status'] = 'false';
     } else {
         $context['status'] = 'null';
     }
     $html = $tpl->render('metabox_pluginstatus.html.twig', $context);
     $success = true;
     $response = new IfwPsn_Wp_Ajax_Response_Json($success);
     $response->addData('html', $html);
     return $response;
 }
Example #2
0
 /**
  * Handles the error
  */
 public function handleAction()
 {
     $key = $this->_request->get('id');
     $test = $this->_pm->getBootstrap()->getSelftester()->getTest($key);
     $this->view->message = $test->handleError($this->_pm);
     $this->view->langPerformSelftestAgain = __('Perform selftest again', 'ifw');
     $this->view->urlIndex = IfwPsn_Wp_Proxy_Admin::getMenuUrl($this->_pm, 'selftest');
     echo $this->view->render('psn-selftest/handle.phtml');
     exit;
 }
Example #3
0
 /**
  * @return IfwPsn_Wp_Ajax_Response_Abstract
  */
 public function getResponse()
 {
     $listTable = new Psn_Admin_ListTable_Rules(IfwPsn_Wp_Plugin_Manager::getInstance('Psn'), array('metabox_embedded' => true, 'ajax' => true));
     if (isset($_POST['refresh_rows'])) {
         $html = $listTable->ajax_response();
     } else {
         $html = '<p><a href="' . IfwPsn_Wp_Proxy_Admin::getUrl() . IfwPsn_Wp_Proxy_Admin::getMenuUrl(IfwPsn_Wp_Plugin_Manager::getInstance('Psn'), 'rules', 'create') . '" class="ifw-wp-icon-plus" id="link_create_rule">' . __('Create new rule', 'psn') . '</a></p>';
         $html .= $listTable->fetch();
     }
     return new IfwPsn_Wp_Ajax_Response_Json(true, array('html' => $html));
 }
Example #4
0
 public function onCurrentScreen()
 {
     if ($this->_request->getActionName() == 'index') {
         $pointer = new IfwPsn_Wp_Plugin_Menu_Pointer('psn_link_create_rule');
         $pointer->setHeader(__('Manage rules', 'psn'))->setContent(sprintf(__('In the "Rules" section you can manage your post status notification rules.<br>Just try it and <a href="%s">create a new rule</a>.', 'psn'), IfwPsn_Wp_Proxy_Admin::getMenuUrl($this->_pm, 'rules', 'create')))->setEdge('top')->setAlign('left')->renderTo('#nav-rules');
         if ($this->_pm->isPremium()) {
             // license input notice
             $license = $this->_pm->getOptionsManager()->getOption('license_code');
             if (empty($license)) {
                 $pointer = new IfwPsn_Wp_Plugin_Menu_Pointer('psn_license_notice');
                 $pointer->setHeader(__('Enter license code', 'ifw'))->setContent(sprintf(__('Please enter the plugin license code in the <a href="%s">options panel</a> to be able to receive <b>auto-updates</b> via the WordPress backend.', 'ifw'), IfwPsn_Wp_Proxy_Admin::getMenuUrl($this->_pm, 'options')))->setEdge('top')->setAlign('left')->renderTo('#nav-options');
             }
         }
     }
 }
Example #5
0
    /**
     * @see IfwPsn_Wp_Plugin_Admin_Menu_Metabox_Abstract::render()
     */
    public function render()
    {
        require_once IFW_PSN_LIB_ROOT . '/IfwPsn/Vendor/Zend/View.php';
        $testMailForm = new Psn_Admin_Form_TestMail(array('action' => IfwPsn_Wp_Proxy_Admin::getUrl() . IfwPsn_Wp_Proxy_Admin::getMenuUrl($this->_pm, 'service', 'send-test-mail')));
        IfwPsn_Wp_Proxy_Action::doPlugin($this->_pm, 'testmail_form', $testMailForm);
        $testMailForm->setView(new IfwPsn_Vendor_Zend_View());
        ?>

        <p><?php 
        _e('Send a test email to check the general email functionality of your WordPress installation. Settings in the options section will be considered (e.g. SMTP).', 'psn');
        ?>
</p>
        <?php 
        echo $testMailForm;
        ?>
        <?php 
    }
Example #6
0
 public function proceedAction()
 {
     $this->_pm->getBootstrap()->getUpdateManager()->refreshPresentVersion();
     $this->view->continueUrl = IfwPsn_Wp_Proxy_Admin::getMenuUrl($this->_pm, 'index');
 }
Example #7
0
 /**
  * Assembles a URL path defined by this route
  *
  * @param array $data An array of variable and value pairs used as parameters
  * @param bool $reset
  * @param bool $encode
  * @return string Route path with user submitted parameters
  */
 public function assemble($data = array(), $reset = false, $encode = false)
 {
     $frontController = IfwPsn_Vendor_Zend_Controller_Front::getInstance();
     if (!array_key_exists('mod', $data) && !$reset && array_key_exists('mod', $this->_current) && $this->_current['mod'] != $frontController->getDefaultModule()) {
         $data = array_merge(array('mod' => $this->_current['mod']), $data);
     }
     if (!array_key_exists('controller', $data) && !$reset && array_key_exists('controller', $this->_current) && $this->_current['controller'] != $frontController->getDefaultControllerName()) {
         $data = array_merge(array('controller' => $this->_current['controller']), $data);
     }
     if (!array_key_exists('action', $data) && !$reset && array_key_exists('action', $this->_current) && $this->_current['action'] != $frontController->getDefaultAction()) {
         $data = array_merge(array('action' => $this->_current['action']), $data);
     }
     if (!empty($data)) {
         $querydata = array();
         if (isset($data['page'])) {
             $url = IfwPsn_Wp_Proxy_Admin::getOptionsBaseUrl();
             $querydata['page'] = $data['page'];
             unset($data['page']);
         } elseif (isset($data['adminpage'])) {
             $url = IfwPsn_Wp_Proxy_Admin::getAdminPageBaseUrl();
             $querydata['page'] = $data['adminpage'];
             unset($data['adminpage']);
         } elseif (isset($data['editpage'])) {
             $url = 'edit.php';
             if (isset($data['posttype'])) {
                 $querydata['post_type'] = $data['posttype'];
                 unset($data['posttype']);
             }
             $querydata['page'] = $data['editpage'];
             unset($data['editpage']);
         }
         if (isset($data['module'])) {
             $querydata['mod'] = $data['module'];
             unset($data['module']);
         }
         if (isset($data['action'])) {
             $querydata[$this->_pm->getConfig()->getActionKey()] = $data['action'];
             unset($data['action']);
         }
         $querydata = array_merge($querydata, $data);
         $url .= '?' . http_build_query($querydata, '', '&');
     }
     return $url;
 }
Example #8
0
 /**
  * 
  */
 public function addPluginActionLinks($links, $file)
 {
     $links[] = '<a href="' . substr(IfwPsn_Wp_Proxy_Admin::getMenuUrl($this->_pm, 'index'), 1) . '">' . __('Settings', 'psn') . '</a>';
     return $links;
 }
Example #9
0
 /**
  * @return array
  */
 public function getPagesWithHrefAndLabel()
 {
     $result = array();
     $nav = $this->getNavigation();
     /**
      * @var IfwPsn_Zend_Navigation_Page_WpMvc $page
      */
     foreach ($nav->getPages() as $page) {
         $result[] = array('href' => IfwPsn_Wp_Proxy_Admin::getMenuUrl($this->_pm, $page->getController(), $page->getAction(), null, array('module' => $page->getModule())), 'label' => $page->getLabel());
     }
     return $result;
 }