Ejemplo n.º 1
0
 function adbarx_admin()
 {
     if ($_POST['nonce']) {
         if (!wp_verify_nonce($_POST['nonce'], 'adbarx_admin')) {
             die('Invalid Security Token');
         }
         $this->options['remember'] = $_POST['showOnce'] == 'on' ? 1 : 0;
         $this->options['content'] = $_POST['content'];
         $this->options['title'] = $_POST['title'];
         if ($_POST['resetViews'] == 'on') {
             $this->options['cookie'] = 'adx_' . substr(md5(microtime()), 5, 20);
         }
         update_option('adbarx_options', $this->options);
     }
     add_filter('admin_head', array($this, 'adbarx_showEditor'));
     require_once PHPX_DIR . 'phpx_form.php';
     $form = new phpx_form();
     $form->instantReturn = true;
     $text = '<div class="wrap"><h2>Ad Bar X</h2>';
     $text .= $form->startForm('themes.php?page=adbarx/includes/adbarx_functions.php', 'adbarxForm');
     $text .= $form->hidden('nonce', wp_create_nonce('adbarx_admin'));
     print $text;
     the_editor(stripslashes($this->options['content']), 'content');
     $text = '<br /><br />';
     $text .= $form->textField('Bar Title', 'title', $this->options['title']);
     $text .= $form->checkBox('Show Adbar Once', 'showOnce', 1);
     $text .= $form->checkBox('Reset All Views', 'resetViews', 0);
     $text .= $form->endForm();
     $text .= '</div>';
     print $text;
 }