public static function admin()
    {
        $DW =& $GLOBALS['DW'];
        parent::admin();
        self::$opt = $DW->getDWOpt($GLOBALS['widget_id'], 'page');
        self::$opt_page = self::$opt;
        if (self::$opt->count > 0) {
            self::$opt_page_childs = $DW->getDWOpt($GLOBALS['widget_id'], 'page-childs');
        }
        $pages = get_pages(array('post_status' => 'publish,private'));
        $num_pages = count($pages);
        unset($pages);
        if ($num_pages < DW_PAGE_LIMIT) {
            $hierarchy = TRUE;
        } else {
            $hierarchy = FALSE;
        }
        // For childs we double the number of pages because of addition of 'All childs' option
        if ($hierarchy && $num_pages * 2 > DW_LIST_LIMIT || $num_pages > DW_LIST_LIMIT) {
            $page_condition_select_style = DW_LIST_STYLE;
        }
        self::$static_page = array();
        if (get_option('show_on_front') == 'page') {
            $id = get_option('page_on_front');
            self::$static_page[$id] = __('Front page', DW_L10N_DOMAIN);
            if (get_option('page_on_front') == get_option('page_for_posts')) {
                self::$static_page[$id] .= ', ' . __('Posts page', DW_L10N_DOMAIN);
            }
        }
        if ($num_pages < DW_PAGE_LIMIT) {
            $childs_infotext = self::infoText();
        } else {
            $childs_infotext = __('Unfortunately the childs-function has been disabled
						because you have more than the limit of pages.', DW_L10N_DOMAIN) . '(' . DW_PAGE_LIMIT . ')';
        }
        self::$info = $childs_infotext;
        self::GUIHeader(self::$option[self::$name], self::$question, self::$info);
        self::GUIOption();
        if ($num_pages > 0) {
            $DW->dumpOpt(self::$opt_page_childs);
            echo '<br />';
            _e('Except the page(s)', DW_L10N_DOMAIN);
            echo '<br />';
            echo '<div id="page-select" class="condition-select" ' . (isset($page_condition_select_style) ? $page_condition_select_style : '') . ' />';
            if ($num_pages < DW_PAGE_LIMIT) {
                wp_list_pages(array('title_li' => '', 'post_status' => 'publish,private', 'walker' => new DW_Page_Walker()));
            } else {
                wp_list_pages(array('title_li' => '', 'post_status' => 'publish,private', 'depth' => -1, 'walker' => new DW_Page_Walker()));
            }
            echo '</div>';
        }
        $tax_list = get_object_taxonomies('page', 'objects');
        foreach ($tax_list as $tax_type) {
            // Prepare
            $opt_tax = $DW->getDWOpt($_GET['id'], 'page-tax_' . $tax_type->name);
            if ($tax_type->hierarchical) {
                $opt_tax_childs = $DW->getDWOpt($_GET['id'], 'page-tax_' . $tax_type->name . '-childs');
            } else {
                unset($opt_tax_childs);
            }
            $tax = get_terms($tax_type->name, array('get' => 'all'));
            if (count($tax) > 0) {
                if (count($tax) > DW_LIST_LIMIT) {
                    $tax_condition_select_style = DW_LIST_STYLE;
                }
                $tree = DW_CustomPost::getTaxChilds($tax_type->name, array(), 0, array());
                echo '<br />';
                $DW->dumpOpt($opt_tax);
                if (isset($opt_tax_childs)) {
                    $DW->dumpOpt($opt_tax_childs);
                }
                echo '<input type="hidden" name="page_tax_list[]" value="page-tax_' . $tax_type->name . '" />';
                echo __('Except for', DW_L10N_DOMAIN) . ' ' . $tax_type->label . ':<br />';
                echo '<div id="page-tax_' . $tax_type->name . '-select" class="condition-select" ' . (isset($tax_condition_select_style) ? $tax_condition_select_style : '') . '>';
                echo '<div style="position:relative;left:-15px">';
                if (!isset($opt_tax_childs)) {
                    $childs = FALSE;
                } else {
                    $childs = $opt_tax_childs->act;
                }
                echo '<input type="hidden" id="page-tax_' . $tax_type->name . '_act" name="page-tax_' . $tax_type->name . '_act" value="' . implode(',', $opt_tax->act) . '" />';
                if (isset($opt_tax_childs)) {
                    echo '<input type="hidden" id="page-tax_' . $tax_type->name . '_childs_act" name="page-tax_' . $tax_type->name . '_childs_act" value="' . implode(',', $opt_tax_childs->act) . '" />';
                }
                // DW_CustomPost::prtTax($tax_type->name, $tree, $opt_tax->act, $childs, 'page-tax_' . $tax_type->name);
                DW_CustomPost::prtTax($widget_id, $tax_type->name, $tree, $opt_tax->act, $childs, 'page-tax_' . $tax_type->name);
                echo '</div>';
                echo '</div>';
            }
        }
        self::GUIFooter();
    }
Пример #2
0
 public static function customTax()
 {
     $DW = $GLOBALS['DW'];
     $widget_id = $GLOBALS['widget_id'];
     $args = array('public' => TRUE, '_builtin' => FALSE);
     if (function_exists('is_tax')) {
         $taxlist = get_taxonomies($args, 'objects', 'and');
         $taxlist = apply_filters('dynwid_taxonomies', $taxlist);
         if (count($taxlist) > 0) {
             foreach ($taxlist as $tax_id => $tax) {
                 if (!array_key_exists('tax_' . $tax_id, $GLOBALS['DW']->dwoptions)) {
                     continue;
                 }
                 // Getting the linked post type : Only Pages and CPT supported
                 $cpt_label = array();
                 foreach ($tax->object_type as $obj) {
                     switch ($obj) {
                         case 'page':
                             $cpt_label[] = _('Pages');
                             break;
                         case 'post':
                             $cpt_label[] = _('Posts');
                             break;
                         default:
                             $cpt_label[] = self::$post_types[$obj]->label;
                     }
                 }
                 if (count($cpt_label) > 0) {
                     $ct = 'tax_' . $tax_id;
                     $ct_archive_yes_selected = 'checked="checked"';
                     $opt_ct_archive = $DW->getDWOpt($widget_id, $ct);
                     if ($tax->hierarchical) {
                         $opt_ct_archive_childs = $DW->getDWOpt($widget_id, $ct . '-childs');
                     }
                     $t = get_terms($tax->name, array('get' => 'all'));
                     if (count($t) > DW_LIST_LIMIT) {
                         $ct_archive_condition_select_style = DW_LIST_STYLE;
                     }
                     $tree = self::getTaxChilds($tax->name, array(), 0, array());
                     echo '<h4 id="' . $ct . '" title=" Click to toggle " class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"><b>' . $tax->label . ' ' . _('archive') . '</b> (<em>' . implode(', ', $cpt_label) . '</em>)' . ($opt_ct_archive->count > 0 ? ' <img src="' . $DW->plugin_url . 'img/checkmark.gif" alt="Checkmark" />' : '') . '</h4>';
                     echo '<div id="' . $ct . '_conf" class="dynwid_conf ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom">';
                     echo __('Show widget on', DW_L10N_DOMAIN) . ' ' . $tax->label . ' ' . _('archive') . '?' . ($tax->hierarchical || count($t) > 0 ? ' <img src="' . $DW->plugin_url . 'img/info.gif" alt="info" onclick="divToggle(\'custom_' . $ct . '\');" />' : '') . '<br />';
                     echo '<input type="hidden" name="dw_taxonomy[]" value="' . $tax_id . '" />';
                     $DW->dumpOpt($opt_ct_archive);
                     if (isset($opt_ct_archive_childs)) {
                         $DW->dumpOpt($opt_ct_archive_childs);
                     }
                     echo '<div>';
                     echo '<div id="custom_' . $ct . '" class="infotext">';
                     echo $tax->hierarchical ? '<p>' . DW_Page::infoText() . '</p>' : '';
                     echo count($t) > 0 ? '<p>' . __('All exceptions work in a logical OR condition. That means when one of the exceptions is met, the exception rule is applied.', DW_L10N_DOMAIN) . '</p>' : '';
                     echo '</div>';
                     echo '</div>';
                     echo '<input type="radio" name="' . $ct . '" value="yes" id="' . $ct . '-yes" ' . ($opt_ct_archive->selectYes() ? $opt_ct_archive->checked : '') . ' /> <label for="' . $ct . '-yes">' . __('Yes') . '</label> ';
                     echo '<input type="radio" name="' . $ct . '" value="no" id="' . $ct . '-no" ' . ($opt_ct_archive->selectNo() ? $opt_ct_archive->checked : '') . ' /> <label for="' . $ct . '-no">' . __('No') . '</label><br />';
                     if (count($t) > 0) {
                         echo __('Except for', DW_L10N_DOMAIN) . ':<br />';
                         echo '<div id="' . $ct . '-select" class="condition-select" ' . (isset($ct_archive_condition_select_style) ? $ct_archive_condition_select_style : '') . '>';
                         echo '<div style="position:relative;left:-15px">';
                         if (!isset($opt_ct_archive_childs)) {
                             $childs = FALSE;
                         } else {
                             $childs = $opt_ct_archive_childs->act;
                         }
                         echo '<input type="hidden" id="' . $ct . '_act" name="' . $ct . '_act" value="' . (is_array($opt_ct_archive->act) ? implode(',', $opt_ct_archive->act) : '') . '" />';
                         if (isset($opt_ct_archive_childs)) {
                             echo '<input type="hidden" id="' . $ct . '_childs_act" name="' . $ct . '_childs_act" value="' . (is_array($opt_tax_childs->act) ? implode(',', $opt_tax_childs->act) : '') . '" />';
                         }
                         self::prtTax($widget_id, $tax->name, $tree, $opt_ct_archive->act, $childs, $ct);
                         echo '</div>';
                         echo '</div>';
                     }
                     // echo '</div><!-- end dynwid_conf -->';
                     self::GUIFooter();
                 }
             }
         }
     }
 }
$DW_Date->admin();
$DW_WPML = new DW_WPML();
$DW_WPML->admin();
$DW_QT = new DW_QT();
$DW_QT->admin();
$DW_Browser = new DW_Browser();
$DW_Browser->admin();
$DW_Tpl = new DW_Tpl();
$DW_Tpl->admin();
$DW_Front_page = new DW_Front_page();
$DW_Front_page->admin();
$DW_Single = new DW_Single();
$DW_Single->admin();
$DW_Attachment = new DW_Attachment();
$DW_Attachment->admin();
$DW_Page = new DW_Page();
$DW_Page->admin();
$DW_Author = new DW_Author();
$DW_Author->admin();
$DW_Category = new DW_Category();
$DW_Category->admin();
$DW_Tag = new DW_Tag();
$DW_Tag->admin();
$DW_Archive = new DW_Archive();
$DW_Archive->admin();
$DW_E404 = new DW_E404();
$DW_E404->admin();
$DW_Search = new DW_Search();
$DW_Search->admin();
$DW_CustomPost = new DW_CustomPost();
$DW_CustomPost->admin();