예제 #1
0
 public static function customPosts()
 {
     $DW = $GLOBALS['DW'];
     $widget_id = $GLOBALS['widget_id'];
     $args = array('public' => TRUE, '_builtin' => FALSE);
     // Custom Post Type
     self::$post_types = get_post_types($args, 'objects', 'and');
     foreach (self::$post_types as $type => $ctid) {
         if (!array_key_exists($type, $GLOBALS['DW']->dwoptions)) {
             continue;
         }
         // Prepare
         self::$opt = $DW->getDWOpt($widget_id, $type);
         $tax_list = get_object_taxonomies($type, 'objects');
         $tax_list = apply_filters('dynwid_taxonomies', $tax_list);
         // Output
         echo '<input type="hidden" name="post_types[]" value="' . $type . '" />';
         echo '<h4 id="cpt_' . $type . '" title=" Click to toggle " class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"><b>' . $ctid->label . '</b> ' . (self::$opt->count > 0 ? ' <img src="' . $DW->plugin_url . 'img/checkmark.gif" alt="Checkmark" />' : '') . ($DW->wpml ? DW_WPML::$icon : '') . '</h4>';
         echo '<div id="cpt_' . $type . '_conf" class="dynwid_conf ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom">';
         echo __('Show widget on', DW_L10N_DOMAIN) . ' ' . $ctid->label . '? ' . ($ctid->hierarchical || count($tax_list) > 0 ? '<img src="' . $DW->plugin_url . 'img/info.gif" alt="info" onclick="divToggle(\'custom_' . $type . '\');" />' : '') . '<br />';
         echo '<div>';
         echo '<div id="custom_' . $type . '" class="infotext">';
         echo $ctid->hierarchical ? '<p>' . DW_Page::infoText() . '</p>' : '';
         echo count($tax_list) > 0 ? '<p>' . __('All exceptions (Titles and Taxonomies) 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>';
         self::GUIOption($type);
         echo '<br />';
         $opt_single = $DW->getDWOpt($widget_id, $type);
         // Taxonomy in Custom Post Type
         foreach ($tax_list as $tax_type) {
             // Prepare
             $opt_tax = $DW->getDWOpt($widget_id, $type . '-tax_' . $tax_type->name);
             if ($tax_type->hierarchical) {
                 $opt_tax_childs = $DW->getDWOpt($widget_id, $type . '-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 = self::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="tax_list[]" value="' . $type . '-tax_' . $tax_type->name . '" />';
                 echo __('Except for', DW_L10N_DOMAIN) . ' ' . $tax_type->label . ':<br />';
                 echo '<div id="' . $type . '-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="' . $type . '-tax_' . $tax_type->name . '_act" name="' . $type . '-tax_' . $tax_type->name . '_act" value="' . implode(',', $opt_tax->act) . '" />';
                 if (isset($opt_tax_childs)) {
                     echo '<input type="hidden" id="' . $type . '-tax_' . $tax_type->name . '_childs_act" name="' . $type . '-tax_' . $tax_type->name . '_childs_act" value="' . implode(',', $opt_tax_childs->act) . '" />';
                 }
                 // self::prtTax($tax_type->name, $tree, $opt_tax->act, $childs, $type . '-tax_' . $tax_type->name);
                 self::prtTax($widget_id, $tax_type->name, $tree, $opt_tax->act, $childs, $type . '-tax_' . $tax_type->name);
                 echo '</div>';
                 echo '</div>';
             }
         }
         self::GUIFooter();
     }
 }
 public static function customPosts()
 {
     $DW = $GLOBALS['DW'];
     $args = array('public' => TRUE, '_builtin' => FALSE);
     // Custom Post Type
     self::$post_types = get_post_types($args, 'objects', 'and');
     foreach (self::$post_types as $type => $ctid) {
         // Prepare
         self::$opt = $DW->getDWOpt($_GET['id'], $type);
         // -- Childs
         /* if ( $ctid->hierarchical ) {
         					$opt_custom_childs = $DW->getDWOpt($_GET['id'], $type . '-childs');
         				} else {
         					unset($opt_custom_childs);
         				}
         
         				$loop = new WP_Query( array('post_type' => $type, 'posts_per_page' => -1) );
         				if ( $loop->post_count > DW_LIST_LIMIT ) {
         					$custom_condition_select_style = DW_LIST_STYLE;
         				}
         
         				$cpmap = self::getCPostChilds($type, array(), 0, array()); */
         $tax_list = get_object_taxonomies($type, 'objects');
         // Output
         echo '<input type="hidden" name="post_types[]" value="' . $type . '" />';
         echo '<h4><b>' . $ctid->label . '</b> ' . (self::$opt->count > 0 ? ' <img src="' . $DW->plugin_url . 'img/checkmark.gif" alt="Checkmark" />' : '') . ($DW->wpml ? DW_WPML::$icon : '') . '</h4>';
         echo '<div class="dynwid_conf">';
         echo __('Show widget on', DW_L10N_DOMAIN) . ' ' . $ctid->label . '? ' . ($ctid->hierarchical || count($tax_list) > 0 ? '<img src="' . $DW->plugin_url . 'img/info.gif" alt="info" onclick="divToggle(\'custom_' . $type . '\');" />' : '') . '<br />';
         echo '<div>';
         echo '<div id="custom_' . $type . '" class="infotext">';
         echo $ctid->hierarchical ? '<p>' . DW_Page::infoText() . '</p>' : '';
         echo count($tax_list) > 0 ? '<p>' . __('All exceptions (Titles and Taxonomies) 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>';
         self::GUIOption($type);
         echo '<br />';
         /* if ( isset($opt_custom_childs) ) {
         					$DW->dumpOpt($opt_custom_childs);
         				}
         
         				if ( $loop->post_count > 0 ) {
         					echo __('Except for', DW_L10N_DOMAIN) . ':<br />';
         					echo '<div id="' . $type . '-select" class="condition-select" ' . ( (isset($custom_condition_select_style)) ? $custom_condition_select_style : '' ) . '>';
         
         					echo '<div style="position:relative;left:-15px">';
         
         					if ( isset($opt_custom_childs) ) {
         						$childs = $opt_custom_childs->act;
         					} else {
         						$childs = array();
         					}
         					self::prtCPost($type, $ctid, $cpmap, self::$opt->act, $childs);
         
         					echo '</div>'; 
         					echo '</div>'; 
         				} */
         // Taxonomy in Custom Post Type
         foreach ($tax_list as $tax_type) {
             // Prepare
             $opt_tax = $DW->getDWOpt($_GET['id'], $type . '-tax_' . $tax_type->name);
             if ($tax_type->hierarchical) {
                 $opt_tax_childs = $DW->getDWOpt($_GET['id'], $type . '-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 = self::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="tax_list[]" value="' . $type . '-tax_' . $tax_type->name . '" />';
                 echo __('Except for', DW_L10N_DOMAIN) . ' ' . $tax_type->label . ':<br />';
                 echo '<div id="' . $type . '-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;
                 }
                 self::prtTax($tax_type->name, $tree, $opt_tax->act, $childs, $type . '-tax_' . $tax_type->name);
                 echo '</div>';
                 echo '</div>';
             }
         }
         self::GUIFooter();
     }
 }