RCCWP_WritePostPage::ApplyCustomWritePanelHeader PHP Method

ApplyCustomWritePanelHeader() public static method

public static ApplyCustomWritePanelHeader ( )
    public static function ApplyCustomWritePanelHeader()
    {
        global $CUSTOM_WRITE_PANEL;
        global $mf_domain;
        // Validate	 capability
        require_once 'RCCWP_Options.php';
        $assignToRole = RCCWP_Options::Get('assign-to-role');
        $requiredPostsCap = 'edit_posts';
        $requiredPagesCap = 'edit_pages';
        if ($assignToRole == 1) {
            $requiredPostsCap = $CUSTOM_WRITE_PANEL->capability_name;
            $requiredPagesCap = $CUSTOM_WRITE_PANEL->capability_name;
        }
        if ($CUSTOM_WRITE_PANEL->type == "post") {
            $requiredCap = $requiredPostsCap;
        } else {
            $requiredCap = $requiredPagesCap;
        }
        if (!current_user_can($requiredCap)) {
            wp_die(__('You do not have sufficient permissions to access this custom write panel.', $mf_domain));
        }
        ?>
		
		<script type="text/javascript">
			var mf_path = "<?php 
        echo MF_URI;
        ?>
" ;
			var JS_MF_FILES_PATH = '<?php 
        echo MF_FILES_URI;
        ?>
';
			var swf_authentication = "<?php 
        if (function_exists('is_ssl') && is_ssl()) {
            echo $_COOKIE[SECURE_AUTH_COOKIE];
        } else {
            echo $_COOKIE[AUTH_COOKIE];
        }
        ?>
" ;
			var swf_nonce = "<?php 
        echo wp_create_nonce('media-form');
        ?>
" ;
			var lan_editor = "<?php 
        echo '' == get_locale() ? 'en' : strtolower(substr(get_locale(), 0, 2));
        ?>
";
		</script>
 		<script type="text/javascript" src="<?php 
        echo MF_URI;
        ?>
js/groups.js"></script>
		
		<script type="text/javascript">
			var JS_MF_FILES_PATH   = '<?php 
        echo MF_FILES_URI;
        ?>
';
			var wp_root            = "<?php 
        echo get_bloginfo('wpurl');
        ?>
";
			var mf_path            = "<?php 
        echo MF_URI;
        ?>
";
			var mf_relative        = "<?php 
        echo MF_URI_RELATIVE;
        ?>
";
			var phpthumb           = "<?php 
        echo PHPTHUMB;
        ?>
";
			var swf_authentication = "<?php 
        if (function_exists('is_ssl') && is_ssl()) {
            echo $_COOKIE[SECURE_AUTH_COOKIE];
        } else {
            echo $_COOKIE[AUTH_COOKIE];
        }
        ?>
" ;
			var swf_nonce          = "<?php 
        echo wp_create_nonce('media-form');
        ?>
" ;
			var lan_editor = "<?php 
        echo '' == get_locale() ? 'en' : strtolower(substr(get_locale(), 0, 2));
        ?>
";
		</script>

		<?php 
        //change title
        global $post, $title;
        if ($post->ID == 0) {
            $blu = RCCWP_CustomWritePanel::Get($CUSTOM_WRITE_PANEL->id);
            if ($post->post_type == "post") {
                $name_title = "Post";
            } else {
                $name_title = "Page";
            }
            $title = "Write " . $name_title . " >> " . $blu->name;
        } else {
            $blu = RCCWP_CustomWritePanel::Get($CUSTOM_WRITE_PANEL->id);
            if ($post->post_type == "post") {
                $name_title = "Post";
            } else {
                $name_title = "Page";
            }
            $title = "Edit " . Inflect::singularize($blu->name);
        }
        // Show/Hide Panel fields
        global $STANDARD_FIELDS;
        $standardFields = RCCWP_CustomWritePanel::GetStandardFields($CUSTOM_WRITE_PANEL->id);
        $hideCssIds = array();
        foreach ($STANDARD_FIELDS as $standardField) {
            if (!in_array($standardField->id, $standardFields)) {
                foreach ($standardField->cssId as $cssID) {
                    array_push($hideCssIds, $cssID);
                }
            }
        }
        if (empty($hideCssIds)) {
            return;
        }
        array_walk($hideCssIds, create_function('&$item1, $key', '$item1 = "#" . $item1;'));
        $hideCssIdString = implode(', ', $hideCssIds);
        ?>
		
		<style type="text/css">
			<?php 
        echo $hideCssIdString;
        ?>
 {display: none !important;}
		</style>
		
		<?php 
    }