GetAssignedCategoryIds() публичный статический Метод

Get a list of the ids of the categories assigned to a write panel
public static GetAssignedCategoryIds ( integer $customWritePanelId ) : array
$customWritePanelId integer write panel id
Результат array of ids
Пример #1
0
 function ApplyCustomWritePanelAssignedCategories($content)
 {
     global $CUSTOM_WRITE_PANEL;
     global $post, $title;
     if ($post->post_type == "post") {
         $assignedCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($CUSTOM_WRITE_PANEL->id);
         if ($post->ID == 0) {
             foreach ($assignedCategoryIds as $categoryId) {
                 $toReplace = 'id="in-category-' . $categoryId . '"';
                 $replacement = $toReplace . ' checked="checked"';
                 $content = str_replace($toReplace, $replacement, $content);
             }
         }
     }
     if ($post->post_type == "page") {
         $customParentPage = RCCWP_CustomWritePanel::GetParentPage($CUSTOM_WRITE_PANEL->name);
         if ($customParentPage && $post->ID == 0) {
             $toReplace = 'value="' . $customParentPage . '"';
             $replacement = 'value="' . $customParentPage . '"' . ' SELECTED';
             $content = str_replace($toReplace, $replacement, $content);
         }
         $customThemePage = RCCWP_CustomWritePanel::GetThemePage($CUSTOM_WRITE_PANEL->name);
         //set default theme page
         if ($post->ID == 0) {
             $toReplace = "value='" . $customThemePage . "'";
             $replacement = "value='" . $customThemePage . "'" . ' SELECTED';
             $content = str_replace($toReplace, $replacement, $content);
         }
     }
     return $content;
 }
Пример #2
0
    public static function ApplyWritePanelAssignedCategoriesOrTemplate()
    {
        global $CUSTOM_WRITE_PANEL, $post, $wp_version;
        if (substr($wp_version, 0, 3) < 3.0) {
            $check = "draft";
        } else {
            $check = "auto-draft";
        }
        if ($post->post_status == $check) {
            if ($post->post_type == "post") {
                $assignedCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($CUSTOM_WRITE_PANEL->id);
                foreach ($assignedCategoryIds as $key => $cat) {
                    if ((int) $cat == 0) {
                        $tc = get_category_by_slug($cat);
                        $assignedCategoryIds[$key] = $tc->cat_ID;
                    }
                }
                $assignedCategoryIds = apply_filters('mf_extra_categories', $assignedCategoryIds);
                ?>
				<script type="text/javascript">
					var mf_categories = new Array(<?php 
                echo '"' . implode('","', $assignedCategoryIds) . '"';
                ?>
); 
				</script>
				<?php 
                wp_enqueue_script('magic_set_categories', MF_URI . 'js/custom_fields/categories.js', array('jquery'));
            } else {
                $customParentPage = RCCWP_CustomWritePanel::GetParentPage($CUSTOM_WRITE_PANEL->name);
                $customThemePage = RCCWP_CustomWritePanel::GetThemePage($CUSTOM_WRITE_PANEL->name);
                ?>
				<script type="text/javascript">
					var mf_parent = <?php 
                printf("'%s'", $customParentPage);
                ?>
;
					var mf_theme = <?php 
                printf("'%s'", $customThemePage);
                ?>
; 
				</script>
				<?php 
                wp_enqueue_script('magic_set_categories', MF_URI . 'js/custom_fields/template.js', array('jquery'));
            }
        }
    }
Пример #3
0
 function ApplyCustomWritePanelAssignedCategories($content)
 {
     global $CUSTOM_WRITE_PANEL;
     global $post, $title;
     $assignedCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($CUSTOM_WRITE_PANEL->id);
     $customThemePage = RCCWP_CustomWritePanel::GetThemePage($CUSTOM_WRITE_PANEL->name);
     //hide all categories
     $all = get_categories("get=all");
     foreach ($all as $al) {
         $toReplace = 'class="selectit"><input value="' . $al->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $al->term_id . '"/>';
         $replacement = 'class="selectit" style="display:none;"><input value="' . $al->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $al->term_id . '"/>';
         $content = str_replace($toReplace, $replacement, $content);
     }
     //display ony categories and child
     $dos = $assignedCategoryIds;
     foreach ($assignedCategoryIds as $id) {
         $childs = get_categories("child_of=" . $id . "&hierarchical=0&hide_empty=0");
         foreach ($childs as $child) {
             array_unshift($dos, $child->term_id);
         }
     }
     $dos = array_unique($dos);
     foreach ($dos as $do) {
         $toReplace = 'class="selectit" style="display:none;"><input value="' . $do . '" type="checkbox" name="post_category[]" id="in-category-' . $do . '"';
         $replacement = 'class="selectit"><input value="' . $do . '" type="checkbox" name="post_category[]" id="in-category-' . $do . '"';
         $content = str_replace($toReplace, $replacement, $content);
     }
     if ($_GET['custom-write-panel-id']) {
         foreach ($assignedCategoryIds as $categoryId) {
             $toReplace = 'id="in-category-' . $categoryId . '"';
             $replacement = $toReplace . ' checked="checked"';
             $content = str_replace($toReplace, $replacement, $content);
         }
     }
     //set default theme page
     if ($post->ID == 0) {
         $toReplace = "value='" . $customThemePage . "'";
         $replacement = "value='" . $customThemePage . "'" . ' SELECTED"';
         $content = str_replace($toReplace, $replacement, $content);
     }
     return $content;
 }
Пример #4
0
 function ApplyCustomWritePanelAssignedCategories($content)
 {
     global $CUSTOM_WRITE_PANEL;
     global $post, $title;
     $assignedCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($CUSTOM_WRITE_PANEL->id);
     $customThemePage = RCCWP_CustomWritePanel::GetThemePage($CUSTOM_WRITE_PANEL->name);
     if ($_GET['custom-write-panel-id']) {
         foreach ($assignedCategoryIds as $categoryId) {
             $toReplace = 'id="in-category-' . $categoryId . '"';
             $replacement = $toReplace . ' checked="checked"';
             $content = str_replace($toReplace, $replacement, $content);
         }
     }
     //set default theme page
     if ($post->ID == 0) {
         $toReplace = "value='" . $customThemePage . "'";
         $replacement = "value='" . $customThemePage . "'" . ' SELECTED"';
         $content = str_replace($toReplace, $replacement, $content);
     }
     return $content;
 }
    function Content($customWritePanel = null)
    {
        global $mf_domain, $wpdb;
        $customWritePanelName = "";
        $customWritePanelDescription = "";
        $write_panel_category_ids = array();
        $defaultTagChecked = 'checked="checked"';
        $customWritePanelAllFieldIds = NULL;
        $customThemePage = NULL;
        $showPost = true;
        $customParentPage = NULL;
        if ($customWritePanel != null) {
            $customWritePanelName = $customWritePanel->name;
            $customWritePanelDescription = $customWritePanel->description;
            $customWritePanelDisplayOrder = $customWritePanel->display_order;
            $customWritePanelType = $customWritePanel->type;
            if ($customWritePanelType == 'page') {
                $showPost = false;
            }
            $customWritePanelCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($customWritePanel->id);
            $customWritePanelStandardFieldIds = RCCWP_CustomWritePanel::GetStandardFields($customWritePanel->id);
            $customWritePanelAllFieldIds = RCCWP_CustomWritePanel::Get($customWritePanel->id);
            if ($customWritePanelType == 'page') {
                $customThemePage = RCCWP_CustomWritePanel::GetThemePage($customWritePanel->name);
                $customParentPage = RCCWP_CustomWritePanel::GetParentPage($customWritePanel->name);
            }
            $defaultTagChecked = '';
            ?>
			<input type="hidden" name="custom-write-panel-id" value="<?php 
            echo $customWritePanel->id;
            ?>
" />
			<?php 
        }
        ?>


		<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
		<tbody>
		<tr valign="top">
			<th scope="row"><?php 
        _e('Placement', $mf_domain);
        ?>
</th>
				<td>
				<!-- START :: Javascript for Image/Photo' Css Class -->
				<script type="text/javascript" language="javascript">
					jQuery(document).ready( function() {
							<?php 
        if ($showPost) {
            ?>
								showHide("mf_forpost", "mf_forpage");
							<?php 
        } else {
            ?>
								showHide("mf_forpage", "mf_forpost");
							<?php 
        }
        ?>
						});
						
					function showHide(showClassID, hideClassID)
					{
						jQuery( function($) {
							$("."+showClassID).css("display","");
							$("."+hideClassID).css("display","none");
							});
					}
				</script>
				<!-- END :: Javascript for Image/Photo' Css Class -->
				<input type="radio" name="radPostPage" id="radPostPage" value="post" <?php 
        if (empty($custoWritePanelType) || $customWritePanelType == 'post') {
            ?>
 checked="checked" <?php 
        }
        ?>
 onclick='showHide("mf_forpost", "mf_forpage");' /> <strong><?php 
        _e('Post', $mf_domain);
        ?>
 </strong> &nbsp; &nbsp; &nbsp; 
				<input type="radio" name="radPostPage" id="radPostPage" value="page" <?php 
        if (!empty($customWritePanelType) && $customWritePanelType == 'page') {
            ?>
 checked="checked" <?php 
        }
        ?>
 onclick='showHide("mf_forpage", "mf_forpost");' /> <strong><?php 
        _e('Page', $mf_domain);
        ?>
</strong>
			</td>
		</tr>


		<tr valign="top">
			<th scope="row"  align="right"><?php 
        _e('Name', $mf_domain);
        ?>
:</th>
			<td>
				<input name="custom-write-panel-name" id="custom-write-panel-name" size="40" type="text" value="<?php 
        echo $customWritePanelName;
        ?>
" />
			</td>
		</tr>

	
		<tr valign="top"  id="catText" class="mf_forpost">
			<th scope="row"  align="right"><div id="catLabel" style="display:inline;"><?php 
        _e('Assigned Categories', $mf_domain);
        ?>
:</div></th>
			<td>
				
				<?php 
        $cats = get_categories("get=all");
        foreach ($cats as $cat) {
            $checked = "";
            if (isset($customWritePanel->id) && !empty($customWritePanel->id)) {
                if (in_array($cat->cat_ID, $customWritePanelCategoryIds)) {
                    $checked = "checked=\"checked\"";
                }
            }
            ?>
					<input type="checkbox" name="custom-write-panel-categories[]" value="<?php 
            echo $cat->cat_ID;
            ?>
" <?php 
            echo $checked;
            ?>
 /> <?php 
            echo $cat->cat_name;
            ?>
 <br/>
				<?php 
        }
        ?>
				
			</td>
		</tr>
		
		<tr valign="top"  id="catText" class="mf_forpage">
			<th scope="row"  align="right"><div id="catLabel" style="display:inline;"><?php 
        _e('Assigned Theme', $mf_domain);
        ?>
:</div></th>
			<td>
				
				<select name="page_template" id="page_template">
					<option value='default'><?php 
        _e('Default Template');
        ?>
</option>
					<?php 
        $themes_defaults = get_page_templates();
        foreach ($themes_defaults as $v => $k) {
            if ($customWritePanelType == 'page') {
                $theme_select = NULL;
                if ($customThemePage == $k) {
                    $theme_select = 'SELECTED';
                }
            }
            ?>
					<option value='<?php 
            echo $k;
            ?>
' <?php 
            echo $theme_select;
            ?>
 ><?php 
            echo $v;
            ?>
</option>
					<?php 
        }
        ?>
					<?php 
        ?>
				</select>
		
			</td>
		</tr>
		
		<tr valign="top"  id="catText" class="mf_forpage">
			<th scope="row"  align="right"><div id="catLabel" style="display:inline;"><?php 
        _e('Page Parent', $mf_domain);
        ?>
:</div></th>
			<td>
			<?php 
        wp_dropdown_pages(array('selected' => $customParentPage, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column' => 'menu_order, post_title', 'option_none_value' => -1));
        ?>
			</td>
		</tr>
		
		<tr>
			<th><?php 
        _e('Quantity', $mf_domain);
        ?>
</th>
			<td>
				<?php 
        if (isset($customWritePanel->id) && !empty($customWritePanel->id)) {
            if ($customWritePanelAllFieldIds->single == 0) {
                $multiple_checked = 'checked="checked"';
                $single_checked = '';
            } else {
                $single_checked = 'checked="checked"';
                $multiple_checked = '';
            }
        } else {
            $multiple_checked = 'checked="checked"';
            $single_checked = '';
        }
        ?>
				<input type="radio" name="single" id="radPostPage" value="1" <?php 
        echo $single_checked;
        ?>
  /> <strong><?php 
        _e('Single', $mf_domain);
        ?>
 </strong> &nbsp; &nbsp; &nbsp; 
				<input type="radio" name="single" id="radPostPage" value="0" <?php 
        echo $multiple_checked;
        ?>
  /> <strong><?php 
        _e('Multiple', $mf_domain);
        ?>
</strong>
			</td>
		</tr>

		<tr valign="top">
			<th scope="row" align="right"><?php 
        _e('Standard Fields', $mf_domain);
        ?>
:</th>
			<td>
				<?php 
        global $STANDARD_FIELDS, $wp_version;
        foreach ($STANDARD_FIELDS as $field) {
            if ($field->excludeVersion <= substr($wp_version, 0, 3)) {
                continue;
            }
            if ($field->isAdvancedField) {
                continue;
            }
            $checked = "";
            $classes = "";
            if ($customWritePanel != null) {
                if (in_array($field->id, $customWritePanelStandardFieldIds)) {
                    $checked = "checked=\"checked\"";
                }
            } else {
                if ($field->defaultChecked) {
                    $checked = "checked=\"checked\"";
                }
            }
            if ($field->forPost && !$field->forPage) {
                $classes = $classes . " mf_forpost";
            }
            if ($field->forPage && !$field->forPost) {
                $classes = $classes . " mf_forpage";
            }
            ?>
					<div class="<?php 
            echo $classes;
            ?>
"> 
						<input type="checkbox" name="custom-write-panel-standard-fields[]" value="<?php 
            echo $field->id;
            ?>
" <?php 
            echo $checked;
            ?>
 /> 
						<?php 
            echo $field->displayName;
            ?>
 
						<br />
					</div>
				<?php 
        }
        ?>
			</td>
		</tr>

		<tr valign="top">
			<th scope="row" align="right"><?php 
        _e('Advanced Fields', $mf_domain);
        ?>
:</th>
			<td>
				<?php 
        global $STANDARD_FIELDS, $wp_version;
        foreach ($STANDARD_FIELDS as $field) {
            if ($field->excludeVersion <= substr($wp_version, 0, 3)) {
                continue;
            }
            if (!$field->isAdvancedField) {
                continue;
            }
            $checked = "";
            $classes = "";
            if ($customWritePanel != null) {
                if (in_array($field->id, $customWritePanelStandardFieldIds)) {
                    $checked = "checked=\"checked\"";
                }
            } else {
                if ($field->defaultChecked) {
                    $checked = "checked=\"checked\"";
                }
            }
            if ($field->forPost && !$field->forPage) {
                $classes = $classes . " mf_forpost";
            }
            if ($field->forPage && !$field->forPost) {
                $classes = $classes . " mf_forpage";
            }
            ?>
					<div class="<?php 
            echo $classes;
            ?>
"> 
						<input type="checkbox" name="custom-write-panel-standard-fields[]" value="<?php 
            echo $field->id;
            ?>
" <?php 
            echo $checked;
            ?>
 /> 
						<?php 
            echo $field->displayName;
            ?>
 
						<br />
					</div>
				<?php 
        }
        ?>
			</td>
		</tr>

		<tr valign="top">
			<th scope="row" align="right"><?php 
        _e('Order', $mf_domain);
        ?>
:</th>
			<?php 
        if (empty($customWritePanelDisplayOrder)) {
            $customWritePanelDisplayOrder = "";
        }
        ?>
			<td><input name="custom-write-panel-order" id="custom-write-panel-order" size="2" type="text" value="<?php 
        echo $customWritePanelDisplayOrder;
        ?>
" /></td>
		</tr>
		</tbody>
		</table>
		
		<?php 
    }
 /**
  * Updates the properties of a write panel
  *
  * @param integer $customWritePanelId panel id
  * @param string $name write panel name
  * @param string $description write panel description
  * @param array $standardFields a list of standard fields ids that are to be displayed in 
  * 							in the panel. Use $STANDARD_FIELDS defined in RCCWP_Constant.php
  * @param array $categories array of category ids that are checked by default when the user
  * 							opens Write tab for that panel.
  * @param integer $display_order the order of the panel in Magic Fields > Write Panels tab
  * @param string $type 'post' or 'page'
  */
 function Update($customWritePanelId, $name, $description = '', $standardFields = array(), $categories = array(), $display_order = 1, $type = FALSE, $createDefaultGroup = true, $single_post = 0, $default_theme_page = NULL, $default_parent_page = NULL)
 {
     include_once 'RC_Format.php';
     global $wpdb;
     $capabilityName = RCCWP_CustomWritePanel::GetCapabilityName($name);
     $sql = sprintf("UPDATE " . MF_TABLE_PANELS . " SET name = %s" . " , description = %s" . " , display_order = %d" . " , capability_name = %s" . " , type = %s" . " , single = %s" . " where id = %d", RC_Format::TextToSql($name), RC_Format::TextToSql($description), $display_order, RC_Format::TextToSql($capabilityName), RC_Format::TextToSql($_POST['radPostPage']), $single_post, $customWritePanelId);
     $wpdb->query($sql);
     if (!isset($categories) || empty($categories)) {
         $sql = sprintf("DELETE FROM " . MF_TABLE_PANEL_CATEGORY . " WHERE panel_id = %d", $customWritePanelId);
         $wpdb->query($sql);
     } else {
         $currentCategoryIds = array();
         $currentCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($customWritePanelId);
         $keepCategoryIds = array_intersect($currentCategoryIds, $categories);
         $deleteCategoryIds = array_diff($currentCategoryIds, $keepCategoryIds);
         $insertCategoryIds = array_diff($categories, $keepCategoryIds);
         foreach ($insertCategoryIds as $cat_id) {
             $sql = sprintf("INSERT INTO " . MF_TABLE_PANEL_CATEGORY . " (panel_id, cat_id)" . " values (%d, %d)", $customWritePanelId, $cat_id);
             $wpdb->query($sql);
         }
         if (!empty($deleteCategoryIds)) {
             $sql = sprintf("DELETE FROM " . MF_TABLE_PANEL_CATEGORY . " WHERE panel_id = %d" . " AND cat_id IN (%s)", $customWritePanelId, implode(',', $deleteCategoryIds));
             $wpdb->query($sql);
         }
     }
     if (!isset($standardFields) || empty($standardFields)) {
         $sql = sprintf("DELETE FROM " . MF_TABLE_PANEL_STANDARD_FIELD . " WHERE panel_id = %d", $customWritePanelId);
         $wpdb->query($sql);
     } else {
         $currentStandardFieldIds = array();
         $currentStandardFieldIds = RCCWP_CustomWritePanel::GetStandardFields($customWritePanelId);
         $keepStandardFieldIds = array_intersect($currentStandardFieldIds, $standardFields);
         $deleteStandardFieldIds = array_diff($currentStandardFieldIds, $keepStandardFieldIds);
         $insertStandardFieldIds = array_diff($standardFields, $keepStandardFieldIds);
         foreach ($insertStandardFieldIds as $standard_field_id) {
             $sql = sprintf("INSERT INTO " . MF_TABLE_PANEL_STANDARD_FIELD . " (panel_id, standard_field_id)" . " values (%d, %d)", $customWritePanelId, $standard_field_id);
             $wpdb->query($sql);
         }
         if (!empty($deleteStandardFieldIds)) {
             $sql = sprintf("DELETE FROM " . MF_TABLE_PANEL_STANDARD_FIELD . " WHERE panel_id = %d" . " AND standard_field_id IN (%s)", $customWritePanelId, implode(',', $deleteStandardFieldIds));
             $wpdb->query($sql);
         }
     }
     if ($default_theme_page) {
         $theme_key = "t_" . $name;
         //check if exist template in postmeta
         $check_template = "SELECT meta_id FROM " . $wpdb->postmeta . " WHERE meta_key='" . $theme_key . "' ";
         $query_template = $wpdb->query($check_template);
         if ($query_template) {
             $sql = "UPDATE " . $wpdb->postmeta . " SET meta_value = '" . $default_theme_page . "' " . " WHERE meta_key = '" . $theme_key . "' AND post_id = '0' ";
         } else {
             $sql = "INSERT INTO " . $wpdb->postmeta . " (meta_key, meta_value) " . " VALUES ('" . $theme_key . "', '" . $default_theme_page . "')";
         }
         $wpdb->query($sql);
     }
     if ($default_parent_page && $default_parent_page >= 0) {
         $parent_key = "p_" . $name;
         //check if exist parent in postmeta
         $check_parent = "SELECT meta_id FROM " . $wpdb->postmeta . " WHERE meta_key='" . $parent_key . "' ";
         $query_parent = $wpdb->query($check_parent);
         if ($query_parent) {
             $sql = "UPDATE " . $wpdb->postmeta . " SET meta_value = '" . $default_parent_page . "' " . " WHERE meta_key = '" . $parent_key . "' AND post_id = '0' ";
         } else {
             $sql = "INSERT INTO " . $wpdb->postmeta . " (meta_key, meta_value) " . " VALUES ('" . $parent_key . "', '" . $default_parent_page . "')";
         }
         $wpdb->query($sql);
     } elseif ($default_parent_page == -1) {
         delete_post_meta(0, "p_" . $name, $value);
     }
 }
    function Content($customWritePanel = null)
    {
        // add the new expanded column, if it's not there already (Traversal)
        RCCWP_Application::AddColumnIfNotExist(MF_TABLE_PANELS, "expanded", $column_attr = "tinyint NOT NULL DEFAULT 1 after type");
        global $mf_domain, $wpdb;
        $customWritePanelName = "";
        $customWritePanelDescription = "";
        $customWritePanelExpanded = 1;
        $write_panel_category_ids = array();
        $defaultTagChecked = 'checked="checked"';
        $customWritePanelAllFieldIds = NULL;
        $customThemePage = NULL;
        $showPost = true;
        $customParentPage = NULL;
        $customWritePanelCategoryIds = NULL;
        if ($customWritePanel != null) {
            $customWritePanelName = $customWritePanel->name;
            $customWritePanelDescription = $customWritePanel->description;
            $customWritePanelExpanded = $customWritePanel->expanded;
            $customWritePanelDisplayOrder = $customWritePanel->display_order;
            $customWritePanelType = $customWritePanel->type;
            if ($customWritePanelType == 'page') {
                $showPost = false;
            }
            $customWritePanelCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($customWritePanel->id);
            foreach ($customWritePanelCategoryIds as $key => $c) {
                if ((int) $c != 0) {
                    $tc = get_category($c);
                    $customWritePanelCategoryIds[$key] = $tc->slug;
                }
            }
            $customWritePanelStandardFieldIds = RCCWP_CustomWritePanel::GetStandardFields($customWritePanel->id);
            $customWritePanelAllFieldIds = RCCWP_CustomWritePanel::Get($customWritePanel->id);
            if ($customWritePanelType == 'page') {
                $customThemePage = RCCWP_CustomWritePanel::GetThemePage($customWritePanel->name);
                $customParentPage = RCCWP_CustomWritePanel::GetParentPage($customWritePanel->name);
            }
            $defaultTagChecked = '';
            ?>
			<input type="hidden" name="custom-write-panel-id" value="<?php 
            echo $customWritePanel->id;
            ?>
" />
			<?php 
        }
        ?>


		<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
		<tbody>
		<tr valign="top">
			<th scope="row"><?php 
        _e('Placement', $mf_domain);
        ?>
</th>
				<td>
				<!-- START :: Javascript for Image/Photo' Css Class -->
				<script type="text/javascript" language="javascript">
					jQuery(document).ready( function() {
							<?php 
        if ($showPost) {
            ?>
								showHide("mf_forpost", "mf_forpage");
							<?php 
        } else {
            ?>
								showHide("mf_forpage", "mf_forpost");
							<?php 
        }
        ?>
						});
						
					function showHide(showClassID, hideClassID)
					{
						jQuery( function($) {
							$("."+showClassID).css("display","");
							$("."+hideClassID).css("display","none");
							});
					}
				</script>
				<!-- END :: Javascript for Image/Photo' Css Class -->
				<input type="radio" name="radPostPage" id="radPostPage" value="post" <?php 
        if (empty($custoWritePanelType) || $customWritePanelType == 'post') {
            ?>
 checked="checked" <?php 
        }
        ?>
 onclick='showHide("mf_forpost", "mf_forpage");' /> <strong><?php 
        _e('Post', $mf_domain);
        ?>
 </strong> &nbsp; &nbsp; &nbsp; 
				<input type="radio" name="radPostPage" id="radPostPage" value="page" <?php 
        if (!empty($customWritePanelType) && $customWritePanelType == 'page') {
            ?>
 checked="checked" <?php 
        }
        ?>
 onclick='showHide("mf_forpage", "mf_forpost");' /> <strong><?php 
        _e('Page', $mf_domain);
        ?>
</strong>
			</td>
		</tr>


		<tr valign="top">
			<th scope="row"  align="right"><?php 
        _e('Name', $mf_domain);
        ?>
:</th>
			<td>
				<input name="custom-write-panel-name" id="custom-write-panel-name" size="40" type="text" value="<?php 
        echo $customWritePanelName;
        ?>
" />
			</td>
		</tr>

	
		<tr valign="top"  id="catText" class="mf_forpost">
			<th scope="row"  align="right"><div id="catLabel" style="display:inline;"><?php 
        _e('Assigned Categories', $mf_domain);
        ?>
:</div></th>
			<td>
				
				<?php 
        $cats = get_categories("get=all");
        RCCWP_CustomWritePanelPage::PrintNestedCats($cats, 0, 0, $customWritePanelCategoryIds);
        ?>
				
			</td>
		</tr>
		
		<tr valign="top"  id="catText" class="mf_forpage">
			<th scope="row"  align="right"><div id="catLabel" style="display:inline;"><?php 
        _e('Assigned Theme', $mf_domain);
        ?>
:</div></th>
			<td>
				
				<select name="page_template" id="page_template">
					<option value='default'><?php 
        _e('Default Template');
        ?>
</option>
					<?php 
        $themes_defaults = get_page_templates();
        $theme_select = NULL;
        foreach ($themes_defaults as $v => $k) {
            $theme_select = NULL;
            if ($customWritePanelType == 'page') {
                if ($customThemePage == $k) {
                    $theme_select = 'SELECTED';
                }
            }
            ?>
					<option value='<?php 
            echo $k;
            ?>
' <?php 
            echo $theme_select;
            ?>
 ><?php 
            echo $v;
            ?>
</option>
					<?php 
        }
        ?>
					<?php 
        ?>
				</select>
		
			</td>
		</tr>
		
		<tr valign="top"  id="catText" class="mf_forpage">
			<th scope="row"  align="right"><div id="catLabel" style="display:inline;"><?php 
        _e('Page Parent', $mf_domain);
        ?>
:</div></th>
			<td>
			<?php 
        wp_dropdown_pages(array('selected' => $customParentPage, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column' => 'menu_order, post_title', 'option_none_value' => -1));
        ?>
			</td>
		</tr>
		
		<tr>
			<th><?php 
        _e('Quantity', $mf_domain);
        ?>
</th>
			<td>
				<?php 
        if (isset($customWritePanel->id) && !empty($customWritePanel->id)) {
            if ($customWritePanelAllFieldIds->single == 0) {
                $multiple_checked = 'checked="checked"';
                $single_checked = '';
            } else {
                $single_checked = 'checked="checked"';
                $multiple_checked = '';
            }
        } else {
            $multiple_checked = 'checked="checked"';
            $single_checked = '';
        }
        ?>
				<input type="radio" name="single" id="radPostPage" value="1" <?php 
        echo $single_checked;
        ?>
  /> <strong><?php 
        _e('Single', $mf_domain);
        ?>
 </strong> &nbsp; &nbsp; &nbsp; 
				<input type="radio" name="single" id="radPostPage" value="0" <?php 
        echo $multiple_checked;
        ?>
  /> <strong><?php 
        _e('Multiple', $mf_domain);
        ?>
</strong>
			</td>
		</tr>

		<tr valign="top">
			<th scope="row" align="right"><?php 
        _e('Standard Fields', $mf_domain);
        ?>
:</th>
			<td>
				<?php 
        global $STANDARD_FIELDS, $wp_version;
        foreach ($STANDARD_FIELDS as $field) {
            if ($field->excludeVersion <= substr($wp_version, 0, 3)) {
                continue;
            }
            if ($field->isAdvancedField) {
                continue;
            }
            $checked = "";
            $classes = "";
            if ($customWritePanel != null) {
                if (in_array($field->id, $customWritePanelStandardFieldIds)) {
                    $checked = "checked=\"checked\"";
                }
            } else {
                if ($field->defaultChecked) {
                    $checked = "checked=\"checked\"";
                }
            }
            if ($field->forPost && !$field->forPage) {
                $classes = $classes . " mf_forpost";
            }
            if ($field->forPage && !$field->forPost) {
                $classes = $classes . " mf_forpage";
            }
            ?>
					<div class="<?php 
            echo $classes;
            ?>
"> 
						<input type="checkbox" name="custom-write-panel-standard-fields[]" value="<?php 
            echo $field->id;
            ?>
" <?php 
            echo $checked;
            ?>
 /> 
						<?php 
            echo $field->displayName;
            ?>
 
						<br />
					</div>
				<?php 
        }
        ?>
			</td>
		</tr>

		<tr valign="top">
			<th scope="row" align="right"><?php 
        _e('Advanced Fields', $mf_domain);
        ?>
:</th>
			<td>
				<?php 
        global $STANDARD_FIELDS, $wp_version;
        foreach ($STANDARD_FIELDS as $field) {
            if ($field->excludeVersion <= substr($wp_version, 0, 3)) {
                continue;
            }
            if (!$field->isAdvancedField) {
                continue;
            }
            $checked = "";
            $classes = "";
            if ($customWritePanel != null) {
                if (in_array($field->id, $customWritePanelStandardFieldIds)) {
                    $checked = "checked=\"checked\"";
                }
            } else {
                if ($field->defaultChecked) {
                    $checked = "checked=\"checked\"";
                }
            }
            if ($field->forPost && !$field->forPage) {
                $classes = $classes . " mf_forpost";
            }
            if ($field->forPage && !$field->forPost) {
                $classes = $classes . " mf_forpage";
            }
            ?>
					<div class="<?php 
            echo $classes;
            ?>
"> 
						<input type="checkbox" name="custom-write-panel-standard-fields[]" value="<?php 
            echo $field->id;
            ?>
" <?php 
            echo $checked;
            ?>
 /> 
						<?php 
            echo $field->displayName;
            ?>
 
						<br />
					</div>
				<?php 
        }
        ?>
			</td>
		</tr>

		<tr valign="top">
			<th scope="row" align="right"><?php 
        _e('Order', $mf_domain);
        ?>
:</th>
			<?php 
        if (empty($customWritePanelDisplayOrder)) {
            $customWritePanelDisplayOrder = "";
        }
        ?>
			<td><input name="custom-write-panel-order" id="custom-write-panel-order" size="2" type="text" value="<?php 
        echo $customWritePanelDisplayOrder;
        ?>
" /></td>
		</tr>
		
		<tr>
			<th scope="row" align="right"><?php 
        _e('Top Level Fields Expanded', $mf_domain);
        ?>
:</th>
			<td><input name="custom-write-panel-expanded" id="custom-write-panel-expanded" type="checkbox" value="1" <?php 
        echo $customWritePanelExpanded == 0 ? '' : ' checked="checked" ';
        ?>
 />&nbsp;<?php 
        _e('Display the full expanded group editing interface instead of the summary for fields created at the top level (fields not inside a group)', $mf_domain);
        ?>
			  <br /><small><?php 
        _e('Note: the group can still be collapsed by the user, this just determines the default state on load');
        ?>
</td>
		</tr>


		</tbody>
		</table>
		
		<?php 
    }