public static function plugin_options()
 {
     if (!current_user_can('manage_options')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     self::activateDoubleClick();
     Options::init(self::$wpdb);
     self::$options['dfpSizes'] = Options::getSizes();
     switch (filter_input(INPUT_GET, 'action')) {
         case 'slot':
             Options::addSlots();
             $id = filter_input(INPUT_GET, 'id');
             if ($id) {
                 self::$options['slot'] = Options::getSlot($id);
                 self::$options['categories'] = Options::getTaxonomy($id, 'category');
                 self::$options['pages'] = Options::getTaxonomy($id, 'page');
                 self::$options['special'] = Options::getTaxonomy($id, 'special');
             }
             echo self::getPage('slot', self::$options);
             break;
         case 'dfpSizes':
             Options::addSizes();
             self::$options['dfpSizes'] = Options::getSizes();
             echo self::getPage('dfpSizes', self::$options);
             break;
         default:
             self::$options['AdBlockCount'] = AdBlock::getBlocksByDate(date('Y-m-d'));
             self::$options['slots'] = Options::getSlots();
             echo self::getPage('options', self::$options);
             break;
     }
 }
Beispiel #2
0
 /**
  * Formulário para os dados do widget (exibido no painel de controle)
  *
  * @param array $instance Instância do widget
  */
 public function form($instance)
 {
     $instance['fields']['title'] = $this->get_field_name('title');
     $instance['fields']['id'] = $this->get_field_id('title');
     $instance['fields']['size'] = $this->get_field_name('size');
     $instance['fields']['min_width'] = $this->get_field_name('min_width');
     $instance['fields']['max_width'] = $this->get_field_name('max_width');
     $instance['fields']['sizes'] = Options::getSizes();
     $viewModel = new ViewModel($instance);
     $viewModel->setTerminal(true);
     echo self::$render->partial('widget/options.phtml', $viewModel);
 }