Example #1
0
/**
 * dynwid_term_tree() AJAX lazy loader for Taxonomy terms tree
 * @since 1.5.4.2
 *
 * @return void
 */
function dynwid_term_tree()
{
    include_once DW_MODULES . 'custompost_module.php';
    $DW =& $GLOBALS['DW'];
    $id = isset($_POST['id']) && !empty($_POST['id']) ? sanitize_text_field($_POST['id']) : 0;
    $name = isset($_POST['name']) && !empty($_POST['name']) ? sanitize_text_field($_POST['name']) : '';
    $prefix = isset($_POST['prefix']) && !empty($_POST['prefix']) ? sanitize_text_field($_POST['prefix']) : '';
    $widget_id = isset($_POST['widget_id']) && !empty($_POST['widget_id']) ? sanitize_text_field($_POST['widget_id']) : '';
    if (intval($id) > 0 && !empty($name) && !empty($widget_id)) {
        $opt_tax = $DW->getDWOpt($widget_id, $prefix);
        $opt_tax_childs = $DW->getDWOpt($widget_id, $prefix . '-childs');
        $tree = DW_CustomPost::getTaxChilds($name, array(), $id, array());
        if (count($tree) > 0) {
            DW_CustomPost::prtTax($widget_id, $name, $tree, $opt_tax->act, $opt_tax_childs->act, $prefix);
        }
    }
    die;
}
    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();
    }
 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();
     }
 }
 /**
  * dynWid::getModuleName() Full registration of the modules
  *
  */
 public function getModuleName()
 {
     $dwoptions = array();
     // I NEED PHP > 5.3!!
     DWModule::registerOption(DW_Archive::$option);
     DWModule::registerOption(DW_Attachment::$option);
     DWModule::registerOption(DW_Author::$option);
     DWModule::registerOption(DW_bbPress::$option);
     DWModule::registerOption(DW_BP::$option);
     DWModule::registerOption(DW_Browser::$option);
     DWModule::registerOption(DW_IP::$option);
     DWModule::registerOption(DW_Fimage::$option);
     DWModule::registerOption(DW_Category::$option);
     DW_CustomPost::registerOption(NULL);
     DWModule::registerOption(DW_Date::$option);
     DWModule::registerOption(DW_Day::$option);
     DWModule::registerOption(DW_E404::$option);
     DWModule::registerOption(DW_Front_page::$option);
     DWModule::registerOption(DW_Device::$option);
     DWModule::registerOption(DW_Page::$option);
     DWModule::registerOption(DW_Pods::$option);
     // DWModule::registerOption(DW_QT::$option);
     DWModule::registerOption(DW_Role::$option);
     DWModule::registerOption(DW_Search::$option);
     DWModule::registerOption(DW_Shortcode::$option);
     DWModule::registerOption(DW_Single::$option);
     DWModule::registerOption(DW_Tag::$option);
     DWModule::registerOption(DW_Tpl::$option);
     DWModule::registerOption(DW_URL::$option);
     DWModule::registerOption(DW_Week::$option);
     DWModule::registerOption(DW_WPSC::$option);
     DWModule::registerOption(DW_WPML::$option);
 }
$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();
$DW_WPSC = new DW_WPSC();
$DW_WPSC->admin();
$DW_BP = new DW_BP();
$DW_BP->admin();
$DW_bbPress = new DW_bbPress();
$DW_bbPress->admin();
$DW_Pods = new DW_Pods();
$DW_Pods->admin();
// For JS exclOff
$excl = array();
foreach ($DW->overrule_maintype as $m) {
    $excl[] = "'" . $m . "'";
}
?>
Example #6
0
    public static function admin()
    {
        $DW =& $GLOBALS['DW'];
        $widget_id = $GLOBALS['widget_id'];
        parent::admin();
        self::$opt = $DW->getDWOpt($widget_id, 'single');
        $authors = DW_Author::getAuthors();
        if (count($authors) > DW_LIST_LIMIT) {
            $author_condition_select_style = DW_LIST_STYLE;
        }
        $js_count = 0;
        $opt_single_author = $DW->getDWOpt($widget_id, 'single-author');
        $js_author_array = array();
        if ($opt_single_author->count > 0) {
            $js_count = $js_count + $opt_single_author->count - 1;
        }
        // -- Category
        $category = get_categories(array('hide_empty' => FALSE));
        if (count($category) > DW_LIST_LIMIT) {
            $category_condition_select_style = DW_LIST_STYLE;
        }
        // For JS
        $js_category_array = array();
        foreach ($category as $cat) {
            $js_category_array[] = '\'single_category_act_' . $cat->cat_ID . '\'';
            $js_category_array[] = '\'single_category_childs_act_' . $cat->cat_ID . '\'';
        }
        $catmap = DW_Category::getCatChilds(array(), 0, array());
        $opt_single_category = $DW->getDWOpt($widget_id, 'single-category');
        if ($opt_single_category->count > 0) {
            $js_count = $js_count + $opt_single_category->count - 1;
        }
        $opt_single_post = $DW->getDWOpt($widget_id, 'single-post');
        $opt_single_tag = $DW->getDWOpt($widget_id, 'single-tag');
        self::GUIHeader(self::$option[self::$name], self::$question, self::$info);
        self::GUIOption();
        // -- Individual / Posts / Tags
        /*			$opt_individual = $DW->getDWOpt($_GET['id'], 'individual');
        			if ( $opt_individual->count > 0 ) {
        				$individual = TRUE;
        				$count_individual = '(' . __('Posts: ', DW_L10N_DOMAIN) . $opt_single_post->count . ', ' . __('Tags: ', DW_L10N_DOMAIN) . $opt_single_tag->count . ')';
        			}
        
        			// Individual
        			$DW->dumpOpt($opt_individual);
        			echo '<br />';
        			echo '<input type="checkbox" id="individual" name="individual" value="1" ' . ( (isset($individual) && $individual)  ? 'checked="checked"' : '' ) . ' onclick="chkInPosts()" />';
        			echo '<label for="individual">' . __('Make exception rule available to individual posts and tags.', DW_L10N_DOMAIN) . ' ' . ( ($opt_individual->count > 0)  ? $count_individual : '' ) . '</label>';
        			echo '<img src="' . $DW->plugin_url . 'img/info.gif" alt="info" title="' . __('Click to toggle info', DW_L10N_DOMAIN) . '" onclick="divToggle(\'individual_post_tag\')" />';
        */
        /*			echo '<div>';
        			echo '<div id="individual_post_tag" class="infotext">';
        			_e('When you enable this option, you have the ability to apply the exception rule for <em>Single Posts</em> to tags and individual posts.
        								You can set the exception rule for tags in the single Edit Tag Panel (go to <a href="edit-tags.php?taxonomy=post_tag">Post Tags</a>,
        								click a tag), For individual posts in the <a href="post-new.php">New</a> or <a href="edit.php">Edit</a> Posts panel.
        								Exception rules for tags and individual posts in any combination work independantly, but will always be counted as one exception.<br />
        		  					Please note when exception rules are set for Author and/or Category, these will be removed.
        		  				', DW_L10N_DOMAIN);
        		  echo '<br /><br />';
        		  _e('When you have other individual Custom Post Types rules set, this option will be enabled automatically', DW_L10N_DOMAIN);
        
        			echo '</div></div>'; */
        // Individual posts and tags
        foreach ($opt_single_post->act as $singlepost) {
            echo '<input type="hidden" name="single_post_act[]" value="' . $singlepost . '" />';
        }
        foreach ($opt_single_tag->act as $tag) {
            echo '<input type="hidden" name="single_tag_act[]" value="' . $tag . '" />';
        }
        // JS array authors
        foreach (array_keys($authors) as $id) {
            $js_author_array[] = '\'single_author_act_' . $id . '\'';
        }
        ?>

<table border="0" cellspacing="0" cellpadding="0">
<tr>
  <td valign="top">
  	<?php 
        DW_Author::mkGUI(TRUE);
        ?>
  </td>
  <td style="width:10px"></td>
  <td valign="top">
  	<?php 
        $opt = $DW->getDWOpt($widget_id, 'single-category');
        ?>
  	<?php 
        $DW->dumpOpt($opt);
        ?>
		<?php 
        DW_Category::GUIComplex(TRUE, $opt);
        ?>
    </div>
  </td>
</tr>
</table>
<?php 
        $type = 'post';
        $tax_list = get_object_taxonomies($type, 'objects');
        foreach ($tax_list as $tax_type) {
            if ($tax_type->name != 'post_tag' && $tax_type->name != 'category') {
                // Prepare
                $opt_tax = $DW->getDWOpt($widget_id, 'single-tax_' . $tax_type->name);
                if ($tax_type->hierarchical) {
                    $opt_tax_childs = $DW->getDWOpt($widget_id, 'single-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="single_tax_list[]" value="single-tax_' . $tax_type->name . '" />';
                    echo __('Except for', DW_L10N_DOMAIN) . ' ' . $tax_type->label . ':<br />';
                    echo '<div id="single-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;
                    }
                    DW_CustomPost::prtTax($tax_type->name, $tree, $opt_tax->act, $childs, 'single-tax_' . $tax_type->name);
                    echo '</div>';
                    echo '</div>';
                }
            }
        }
        self::GUIFooter();
        ?>
<script type="text/javascript">
/* <![CDATA[ */
  function chkInPosts() {
    var posts = <?php 
        echo $opt_single_post->count;
        ?>
;
    var tags = <?php 
        echo $opt_single_tag->count;
        ?>
;

    if ( (posts > 0 || tags > 0) && jQuery('#individual').is(':checked') == false ) {
      if ( confirm('Are you sure you want to disable the exception rule for individual posts and tags?\nThis will remove the options set to individual posts and/or tags for this widget.\nOk = Yes; No = Cancel') ) {
        swChb(cAuthors, false);
        swChb(cCat, false);
      } else {
        jQuery('#individual').attr('checked', true);
      }
    } else if ( icount > 0 && jQuery('#individual').is(':checked') ) {
      if ( confirm('Are you sure you want to enable the exception rule for individual posts and tags?\nThis will remove the exceptions set for Author and/or Category on single posts for this widget.\nOk = Yes; No = Cancel') ) {
        swChb(cAuthors, true);
        swChb(cCat, true);
        icount = 0;
      } else {
        jQuery('#individual').attr('checked', false);
      }
    } else if ( jQuery('#individual').is(':checked') ) {
        swChb(cAuthors, true);
        swChb(cCat, true);
    } else {
        swChb(cAuthors, false);
        swChb(cCat, false);
    }
  }

 	function ci(id) {
    if ( jQuery('#'+id).is(':checked') ) {
      icount++;
    } else {
      icount--;
    }
  }

  var icount = <?php 
        echo $js_count;
        ?>
;
  var cAuthors = new Array(<?php 
        echo implode(', ', $js_author_array);
        ?>
);
  var cCat = new Array(<?php 
        echo implode(', ', $js_category_array);
        ?>
);

  if ( jQuery('#individual').is(':checked') ) {
    swChb(cAuthors, true);
    swChb(cCat, true);
  }

  if ( jQuery('#single-yes').is(':checked') && jQuery('#single_conf :checkbox').is(':checked')  ) {
  	jQuery('#single').append( ' <img src="<?php 
        echo $DW->plugin_url;
        ?>
img/checkmark.gif" alt="Checkmark" />' );
  }
/* ]]> */
</script>
<?php 
    }
    public static function admin()
    {
        $DW =& $GLOBALS['DW'];
        $widget_id = $GLOBALS['widget_id'];
        parent::admin();
        self::$opt = $DW->getDWOpt($widget_id, 'single');
        $authors = DW_Author::getAuthors();
        if (count($authors) > DW_LIST_LIMIT) {
            $author_condition_select_style = DW_LIST_STYLE;
        }
        $js_count = 0;
        $opt_single_author = $DW->getDWOpt($widget_id, 'single-author');
        $js_author_array = array();
        if ($opt_single_author->count > 0) {
            $js_count = $js_count + $opt_single_author->count - 1;
        }
        // -- Category
        $category = get_categories(array('hide_empty' => FALSE));
        if (count($category) > DW_LIST_LIMIT) {
            $category_condition_select_style = DW_LIST_STYLE;
        }
        // For JS
        $js_category_array = array();
        foreach ($category as $cat) {
            $js_category_array[] = '\'single_category_act_' . $cat->cat_ID . '\'';
            $js_category_array[] = '\'single_category_childs_act_' . $cat->cat_ID . '\'';
        }
        $catmap = DW_Category::getCatChilds(array(), 0, array());
        $opt_single_category = $DW->getDWOpt($widget_id, 'single-category');
        if ($opt_single_category->count > 0) {
            $js_count = $js_count + $opt_single_category->count - 1;
        }
        $opt_single_post = $DW->getDWOpt($widget_id, 'single-post');
        $opt_single_tag = $DW->getDWOpt($widget_id, 'single-tag');
        self::GUIHeader(self::$option[self::$name], self::$question, self::$info);
        self::GUIOption();
        // Individual posts and tags
        foreach ($opt_single_post->act as $singlepost) {
            echo '<input type="hidden" name="single_post_act[]" value="' . $singlepost . '" />';
        }
        foreach ($opt_single_tag->act as $tag) {
            echo '<input type="hidden" name="single_tag_act[]" value="' . $tag . '" />';
        }
        // JS array authors
        foreach (array_keys($authors) as $id) {
            $js_author_array[] = '\'single_author_act_' . $id . '\'';
        }
        ?>

<table border="0" cellspacing="0" cellpadding="0">
<tr>
  <td valign="top">
  	<?php 
        DW_Author::mkGUI(self::$type, self::$option[self::$name], self::$question, TRUE);
        ?>
  </td>
  <td style="width:10px"></td>
  <td valign="top">
  	<?php 
        $opt = $DW->getDWOpt($widget_id, 'single-category');
        ?>
  	<?php 
        $DW->dumpOpt($opt);
        ?>
		<?php 
        DW_Category::GUIComplex(NULL, NULL, TRUE, $opt);
        ?>
    </div>
  </td>
</tr>
</table>
<?php 
        $type = 'post';
        $tax_list = get_object_taxonomies($type, 'objects');
        $tax_list = apply_filters('dynwid_taxonomies', $tax_list);
        foreach ($tax_list as $tax_type) {
            if ($tax_type->name != 'post_tag' && $tax_type->name != 'category') {
                // Prepare
                $opt_tax = $DW->getDWOpt($widget_id, 'single-tax_' . $tax_type->name);
                if ($tax_type->hierarchical) {
                    $opt_tax_childs = $DW->getDWOpt($widget_id, 'single-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="single_tax_list[]" value="single-tax_' . $tax_type->name . '" />';
                    echo __('Except for', DW_L10N_DOMAIN) . ' ' . $tax_type->label . ':<br />';
                    echo '<div id="single-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="single-tax_' . $tax_type->name . '_act" name="single-tax_' . $tax_type->name . '_act" value="' . implode(',', $opt_tax->act) . '" />';
                    if (isset($opt_tax_childs)) {
                        echo '<input type="hidden" id="single-tax_' . $tax_type->name . '_childs_act" name="single-tax_' . $tax_type->name . '_childs_act" value="' . implode(',', $opt_tax_childs->act) . '" />';
                    }
                    DW_CustomPost::prtTax($widget_id, $tax_type->name, $tree, $opt_tax->act, $childs, 'single-tax_' . $tax_type->name);
                    echo '</div>';
                    echo '</div>';
                }
            }
        }
        // foreach
        self::GUIFooter();
        ?>
<script type="text/javascript">
/* <![CDATA[ */
  function chkInPosts() {
    var posts = <?php 
        echo $opt_single_post->count;
        ?>
;
    var tags = <?php 
        echo $opt_single_tag->count;
        ?>
;

    if ( (posts > 0 || tags > 0) && jQuery('#individual').is(':checked') == false ) {
      if ( confirm('Are you sure you want to disable the exception rule for individual posts and tags?\nThis will remove the options set to individual posts and/or tags for this widget.\nOk = Yes; No = Cancel') ) {
        swChb(cAuthors, false);
        swChb(cCat, false);
      } else {
        jQuery('#individual').attr('checked', true);
      }
    } else if ( icount > 0 && jQuery('#individual').is(':checked') ) {
      if ( confirm('Are you sure you want to enable the exception rule for individual posts and tags?\nThis will remove the exceptions set for Author and/or Category on single posts for this widget.\nOk = Yes; No = Cancel') ) {
        swChb(cAuthors, true);
        swChb(cCat, true);
        icount = 0;
      } else {
        jQuery('#individual').attr('checked', false);
      }
    } else if ( jQuery('#individual').is(':checked') ) {
        swChb(cAuthors, true);
        swChb(cCat, true);
    } else {
        swChb(cAuthors, false);
        swChb(cCat, false);
    }
  }

 	function ci(id) {
    if ( jQuery('#'+id).is(':checked') ) {
      icount++;
    } else {
      icount--;
    }
  }

  var icount = <?php 
        echo $js_count;
        ?>
;
  var cAuthors = new Array(<?php 
        echo implode(', ', $js_author_array);
        ?>
);
  var cCat = new Array(<?php 
        echo implode(', ', $js_category_array);
        ?>
);

  if ( jQuery('#individual').is(':checked') ) {
    swChb(cAuthors, true);
    swChb(cCat, true);
  }

  if ( jQuery('#single-yes').is(':checked') && jQuery('#single_conf :checkbox').is(':checked')  ) {
  	jQuery('#single').append( ' <img src="<?php 
        echo $DW->plugin_url;
        ?>
img/checkmark.gif" alt="Checkmark" />' );
  }
/* ]]> */
</script>
<?php 
    }
 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();
     }
 }