RCCWP_WritePostPage::ApplyWritePanelAssignedCategoriesOrTemplate PHP Method

ApplyWritePanelAssignedCategoriesOrTemplate() public static method

    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'));
            }
        }
    }