Ejemplo n.º 1
0
 public function gui($url)
 {
     $blog =& $this->core->blog;
     $ak_key = $blog->settings->ak_key;
     $ak_verified = null;
     if (isset($_POST['ak_key'])) {
         try {
             $ak_key = $_POST['ak_key'];
             $blog->settings->setNameSpace('akismet');
             $blog->settings->put('ak_key', $ak_key, 'string');
             http::redirect($url . '&up=1');
         } catch (Exception $e) {
             $this->core->error->add($e->getMessage());
         }
     }
     if ($blog->settings->ak_key) {
         try {
             $ak = new akismet($blog->url, $blog->settings->ak_key);
             $ak_verified = $ak->verify();
         } catch (Exception $e) {
             $this->core->error->add($e->getMessage());
         }
     }
     $res = '<form action="' . html::escapeURL($url) . '" method="post">' . '<p><label class="classic">' . __('Akismet API key:') . ' ' . form::field('ak_key', 12, 128, $ak_key) . '</label>';
     if ($ak_verified !== null) {
         if ($ak_verified) {
             $res .= ' <img src="images/check-on.png" alt="" /> ' . __('API key verified');
         } else {
             $res .= ' <img src="images/check-off.png" alt="" /> ' . __('API key not verified');
         }
     }
     $res .= '</p>';
     $res .= '<p><a href="http://wordpress.com/api-keys/">' . __('Get your own API key') . '</a></p>' . '<p><input type="submit" value="' . __('save') . '" />' . $this->core->formNonce() . '</p>' . '</form>';
     return $res;
 }
Ejemplo n.º 2
0
 public function gui($url)
 {
     $blog =& $this->core->blog;
     $blog->settings->addNamespace('akismet');
     $ak_key = $blog->settings->akismet->ak_key;
     $ak_verified = null;
     if (isset($_POST['ak_key'])) {
         try {
             $ak_key = $_POST['ak_key'];
             $blog->settings->akismet->put('ak_key', $ak_key, 'string');
             dcPage::addSuccessNotice(__('Filter configuration have been successfully saved.'));
             http::redirect($url);
         } catch (Exception $e) {
             $this->core->error->add($e->getMessage());
         }
     }
     if ($blog->settings->akismet->ak_key) {
         try {
             $ak = new akismet($blog->url, $blog->settings->akismet->ak_key);
             $ak_verified = $ak->verify();
         } catch (Exception $e) {
             $this->core->error->add($e->getMessage());
         }
     }
     $res = dcPage::notices();
     $res .= '<form action="' . html::escapeURL($url) . '" method="post" class="fieldset">' . '<p><label for="ak_key" class="classic">' . __('Akismet API key:') . '</label> ' . form::field('ak_key', 12, 128, $ak_key);
     if ($ak_verified !== null) {
         if ($ak_verified) {
             $res .= ' <img src="images/check-on.png" alt="" /> ' . __('API key verified');
         } else {
             $res .= ' <img src="images/check-off.png" alt="" /> ' . __('API key not verified');
         }
     }
     $res .= '</p>';
     $res .= '<p><a href="http://akismet.com/">' . __('Get your own API key') . '</a></p>' . '<p><input type="submit" value="' . __('Save') . '" />' . $this->core->formNonce() . '</p>' . '</form>';
     return $res;
 }