echo $wp_item_type; ?> [<?php echo otw_wp_item_attribute($wp_item_type, 'ID', $wpItem); ?> ]" /><label for="otw_sbi_<?php echo $wp_item_type; ?> _sbi_<?php echo otw_wp_item_attribute($wp_item_type, 'ID', $wpItem); ?> "<?php otw_sidebar_item_attributes('l', $wp_item_type, otw_wp_item_attribute($wp_item_type, 'ID', $wpItem), $otw_sidebar_values, $wpItem); ?> ><a href="javascript:;"><?php echo otw_wp_item_attribute($wp_item_type, 'TITLE', $wpItem); ?> </a></label> </p> <?php } ?> <?php } else { echo ' '; } ?> </div> <?php $exclude_type = $wp_item_type; if (preg_match("/^post_in_ctx_(.*)\$/", $exclude_type)) {
} unset($otw_widget_settings[$sidebar][$_POST['item_type']]['_otw_wc'][$widget]); } elseif ($otw_widget_settings[$sidebar][$_POST['item_type']]['_otw_wc'][$widget] == 'vis') { if (is_array($otw_sidebars) && array_key_exists($sidebar, $otw_sidebars)) { if (isset($wp_registered_sidebars[$sidebar]['validfor'][$_POST['item_type']])) { foreach ($wp_registered_sidebars[$sidebar]['validfor'][$_POST['item_type']] as $wp_sb_item_id => $wp_sb_item_data) { if (isset($otw_widget_settings[$sidebar][$_POST['item_type']][$wp_sb_item_id]['exclude_widgets'][$widget])) { unset($otw_widget_settings[$sidebar][$_POST['item_type']][$wp_sb_item_id]['exclude_widgets'][$widget]); } } } } else { $wp_all_items = otw_get_wp_items($_POST['item_type']); if (is_array($wp_all_items) && count($wp_all_items)) { foreach ($wp_all_items as $wp_all_item) { $wp_sb_item_id = otw_wp_item_attribute($_POST['item_type'], 'ID', $wp_all_item); if (isset($otw_widget_settings[$sidebar][$_POST['item_type']][$wp_sb_item_id]['exclude_widgets'][$widget])) { unset($otw_widget_settings[$sidebar][$_POST['item_type']][$wp_sb_item_id]['exclude_widgets'][$widget]); } } } } if (!isset($otw_widget_settings[$sidebar][$_POST['item_type']][$_POST['item_id']]['exclude_widgets'][$widget])) { $otw_widget_settings[$sidebar][$_POST['item_type']][$_POST['item_id']]['exclude_widgets'][$widget] = $widget; echo 'sitem_selected_from_vis'; } else { echo 'sitem_selected_from_vis'; } unset($otw_widget_settings[$sidebar][$_POST['item_type']]['_otw_wc'][$widget]); } } elseif (isset($otw_widget_settings[$sidebar][$_POST['item_type']][$_POST['item_id']])) {
function otw_sbm_get_total_not_excluded($otw_sidebar_id, $widget, $wp_item_type) { global $wp_registered_sidebars; $total_selected = 0; $total_valid = 0; $items = otw_sbm_get_filtered_items($wp_item_type, '', $otw_sidebar_id, 0); $valid_items = array(); if (count($items[1])) { foreach ($items[1] as $wpItem) { $valid_items[otw_wp_item_attribute($wp_item_type, 'ID', $wpItem)] = otw_wp_item_attribute($wp_item_type, 'ID', $wpItem); } } if (isset($wp_registered_sidebars[$otw_sidebar_id]['validfor'][$wp_item_type]) && !isset($wp_registered_sidebars[$otw_sidebar_id]['validfor'][$wp_item_type]['all'])) { $tmp_valid_items = $valid_items; foreach ($tmp_valid_items as $item_id) { if (!array_key_exists($item_id, $wp_registered_sidebars[$otw_sidebar_id]['validfor'][$wp_item_type])) { unset($valid_items[$item_id]); } } } $total_valid = count($valid_items); if ($total_valid) { $otw_widget_settings = get_option('otw_widget_settings'); if (isset($otw_widget_settings[$otw_sidebar_id][$wp_item_type]['_otw_wc']) && isset($otw_widget_settings[$otw_sidebar_id][$wp_item_type]['_otw_wc'][$widget])) { if ($otw_widget_settings[$otw_sidebar_id][$wp_item_type]['_otw_wc'][$widget] == 'vis') { $total_selected = count($valid_items); } elseif ($otw_widget_settings[$otw_sidebar_id][$wp_item_type]['_otw_wc'][$widget] == 'invis') { $total_selected = 0; } } else { if (isset($otw_widget_settings[$otw_sidebar_id][$wp_item_type])) { foreach ($otw_widget_settings[$otw_sidebar_id][$wp_item_type] as $item_type_id => $item_widget_data) { if ($item_type_id == '_otw_wc') { continue; } if (!in_array($item_type_id, $valid_items)) { continue; } if (isset($item_widget_data['exclude_widgets']) && isset($item_widget_data['exclude_widgets'][$widget])) { unset($valid_items[$item_type_id]); } } } $total_selected = count($valid_items); } } return array($total_valid, $total_selected); }
function otw_sidebar_item_row_attributes($node_tag, $wp_item_type, $sidebar, $widget, $wpItem) { global $wp_registered_sidebars; $attributes = array(); switch ($node_tag) { case 'p': $attributes['class'] = array(); if (isset($wp_registered_sidebars[$sidebar]['widgets_settings'][$wp_item_type]['_otw_wc'][$widget]) && in_array($wp_registered_sidebars[$sidebar]['widgets_settings'][$wp_item_type]['_otw_wc'][$widget], array('vis', 'invis'))) { if ($wp_registered_sidebars[$sidebar]['widgets_settings'][$wp_item_type]['_otw_wc'][$widget] == 'invis') { $attributes['class'][] = 'sitem_notselected'; } else { $attributes['class'][] = 'sitem_selected'; } } elseif (isset($wp_registered_sidebars[$sidebar]['widgets_settings'][$wp_item_type][otw_wp_item_attribute($wp_item_type, 'ID', $wpItem)]['exclude_widgets'][$widget])) { $attributes['class'][] = 'sitem_notselected'; } else { $attributes['class'][] = 'sitem_selected'; } break; case 'a': $attributes['class'] = array(); $attributes['class'][] = $sidebar . '|' . $widget . '|' . $wp_item_type . '|' . otw_wp_item_attribute($wp_item_type, 'ID', $wpItem); switch ($wp_item_type) { case 'page': case 'category': case 'postsincategory': if (isset($wpItem->_sub_level) && $wpItem->_sub_level) { $attributes['style'][] = 'margin-left: ' . $wpItem->_sub_level * 20 . 'px'; } break; } break; } $html = ''; foreach ($attributes as $attribute => $att_values) { $html .= ' ' . $attribute . '="' . implode(' ', $att_values) . '"'; } echo $html; }