GetStandardFields() public static method

Get a list of the standard fields of a the write panel
public static GetStandardFields ( integer $customWritePanelId ) : array
$customWritePanelId integer panel id
return array of ids of the standard fields (see $STANDARD_FIELDS defined in MF_Constant.php)
 function GetStandardFieldsString($customWritePanel)
 {
     $results = RCCWP_CustomWritePanel::GetStandardFields($customWritePanel);
     foreach ($results as $r) {
         $str .= $r->name . ', ';
     }
     $str = substr($str, 0, strlen($str) - 2);
     // deletes last comma and whitespace
     return $str;
 }
 /**
  * Export a write panel to file
  *
  * @param integer $panelID
  * @param string $exportedFilename the full path of the file to which the panel will be exported
  */
 function Export($panelID)
 {
     include_once 'RCCWP_CustomGroup.php';
     include_once 'RCCWP_CustomField.php';
     $exported_data = array();
     $writePanel = RCCWP_CustomWritePanel::Get($panelID);
     $writePanel->standardFieldsIDs = RCCWP_CustomWritePanel::GetStandardFields($panelID);
     $writePanel->assignedCategories = array();
     $writePanel->theme = RCCWP_CustomWritePanel::GetThemePage($writePanel->name);
     $writePanel->parent_page = RCCWP_CustomWritePanel::GetParentPage($writePanel->name);
     $assignedCategories = RCCWP_CustomWritePanel::GetAssignedCategories($panelID);
     foreach ($assignedCategories as $assignedCategory) {
         $writePanel->assignedCategories[] = $assignedCategory->cat_id;
     }
     $moduleGroups = RCCWP_CustomWritePanel::GetCustomGroups($panelID);
     foreach ($moduleGroups as $moduleGroup) {
         $fields = RCCWP_CustomGroup::GetCustomFields($moduleGroup->id);
         foreach ($fields as $field) {
             if ($field->type == "Related Type") {
                 $tmp = RCCWP_CustomWritePanel::Get($field->properties["panel_id"]);
                 $field->properties["panel_name"] = $tmp->name;
                 unset($field->properties["panel_id"]);
             }
         }
         $groupFields[$moduleGroup->name]->fields = $fields;
         $groupFields[$moduleGroup->name]->duplicate = $moduleGroup->duplicate;
         $groupFields[$moduleGroup->name]->at_right = $moduleGroup->at_right;
     }
     $exported_data['panel'] = $writePanel;
     $exported_data['fields'] = $groupFields;
     return serialize($exported_data);
 }
 /**
  * Export a write panel to file
  *
  * @param integer $panelID
  * @param string $exportedFilename the full path of the file to which the panel will be exported
  */
 function Export($panelID, $exportedFilename)
 {
     include_once 'RCCWP_CustomGroup.php';
     include_once 'RCCWP_CustomField.php';
     $exported_data = array();
     $writePanel = RCCWP_CustomWritePanel::Get($panelID);
     $writePanel->standardFieldsIDs = RCCWP_CustomWritePanel::GetStandardFields($panelID);
     $writePanel->assignedCategories = array();
     $writePanel->theme = RCCWP_CustomWritePanel::GetThemePage($writePanel->name);
     $writePanel->parent_page = RCCWP_CustomWritePanel::GetParentPage($writePanel->name);
     $assignedCategories = RCCWP_CustomWritePanel::GetAssignedCategories($panelID);
     foreach ($assignedCategories as $assignedCategory) {
         $writePanel->assignedCategories[] = $assignedCategory->cat_name;
     }
     $moduleGroups = RCCWP_CustomWritePanel::GetCustomGroups($panelID);
     foreach ($moduleGroups as $moduleGroup) {
         $groupFields[$moduleGroup->name]->fields = RCCWP_CustomGroup::GetCustomFields($moduleGroup->id);
         $groupFields[$moduleGroup->name]->duplicate = $moduleGroup->duplicate;
         $groupFields[$moduleGroup->name]->at_right = $moduleGroup->at_right;
     }
     $exported_data['panel'] = $writePanel;
     $exported_data['fields'] = $groupFields;
     $handle = fopen($exportedFilename, "w");
     $result = fwrite($handle, serialize($exported_data));
     @fclose($handle);
 }
    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');
        ?>
" ;
		</script>
 		<script type="text/javascript" src="<?php 
        echo MF_URI;
        ?>
js/groups.js"></script>
		
		<script type="text/javascript">
				function isset(  ) {
					var a=arguments; var l=a.length; var i=0;
					
					while ( i!=l ) {
						if (typeof(a[i])=='undefined') { 
						return false; 
						} else { 
						i++; 
						}
					}
					
					return true;
				}
			
			// -------------
			// Edit Photo functions
			function prepareUpdatePhoto(inputName){	
				jQuery('#'+inputName+'_dorename').val(1);
				return true;
			}
		</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');
        ?>
" ;
		</script>

		<script type="text/javascript">
				function isset(  ) {
					var a=arguments; var l=a.length; var i=0;
					
					while ( i!=l ) {
						if (typeof(a[i])=='undefined') { 
						return false; 
						} else { 
						i++; 
						}
					}
					
					return true;
				}
		</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 " . $name_title . " >> " . $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 
    }
    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 
    }
Example #6
0
    function ApplyCustomWritePanelHeader()
    {
        global $CUSTOM_WRITE_PANEL;
        global $flutter_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.', $flutter_domain));
        }
        // --- Apply Flutter CSS and javascript
        ?>

		<link rel='stylesheet' href='<?php 
        echo FLUTTER_URI;
        ?>
css/epoch_styles.css' type='text/css' />
		<link href="<?php 
        echo FLUTTER_URI;
        ?>
js/greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
		<style type="text/css">
			
			.tr_inside{
				background-color:transparent !important;
			}
			
			.freshout{
				display: block;
    			margin-left: auto;
    			margin-right: auto ;
			}
				
			.photo_edit_link{
				clear:both;
				margin: 0px 0px 0px 0px;
				width:150px;
				text-align:center;
			}
			
			.error_msg_txt{
				font-weight: bold;
				overflow: auto;
			}
			
			.duplicate_button{
				text-decoration:none; 
				font-weight:bold;
				float:right
			}
			
			.duplicate_image{
				vertical-align:middle;
				padding-right:3px;
			}
					
		</style>
		<script language="JavaScript" type="text/javascript" src="<?php 
        echo FLUTTER_URI;
        ?>
js/prototype.js"></script>

		
		<script type="text/javascript">
            var wp_root         = "<?php 
        echo get_bloginfo('wpurl');
        ?>
";
			var GB_ROOT_DIR     = "<?php 
        echo FLUTTER_URI;
        ?>
js/greybox/";
			var flutter_path    = "<?php 
        echo FLUTTER_URI;
        ?>
";
            var flutter_relative = "<?php 
        echo FLUTTER_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');
        ?>
" ;
		</script>
		<script type="text/javascript" src="<?php 
        echo FLUTTER_URI;
        ?>
js/greybox/AJS.js"></script>
		<script type="text/javascript" src="<?php 
        echo FLUTTER_URI;
        ?>
js/greybox/AJS_fx.js"></script>
		<script type="text/javascript" src="<?php 
        echo FLUTTER_URI;
        ?>
js/greybox/gb_scripts.js"></script>
		<script type="text/javascript" src="<?php 
        echo FLUTTER_URI;
        ?>
js/swfcallbacks.js" ></script>
		<script type="text/javascript" src="<?php 
        echo get_bloginfo('wpurl');
        ?>
/wp-includes/js/swfupload/swfupload.js"></script>

		<script type="text/javascript">
				function isset(  ) {
					// http://kevin.vanzonneveld.net
					// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
					// +   improved by: FremyCompany
					// *     example 1: isset( undefined, true);
					// *     returns 1: false
					// *     example 2: isset( 'Kevin van Zonneveld' );
					// *     returns 2: true
					
					var a=arguments; var l=a.length; var i=0;
					
					while ( i!=l ) {
						if (typeof(a[i])=='undefined') { 
						return false; 
						} else { 
						i++; 
						}
					}
					
					return true;
				}
				
			function checkForm(event){
				var stopPublish = false;
				$$('input.field_required','textarea.field_required').each(
						function(inputField){
                            <?php 
        $hide_visual_editor = RCCWP_Options::Get('hide-visual-editor');
        if ($hide_visual_editor == '' || $hide_visual_editor == 0) {
            ?>
                                re = new RegExp(".*_multiline");
                                if(re.match(inputField.id)){
                                    inputField.value = tinyMCE.get(inputField.id).getContent();
                                }

                            <?php 
        }
        ?>

							if ($F(inputField) == "" &&
								!(Object.isElement($(inputField.id+"_last")) && $F(inputField.id+"_last") != "")	){
								stopPublish = true;

								// Update row color
								if (isset($("row_"+inputField.id).style))
									$("row_"+inputField.id).style.backgroundColor = "#FFEBE8";

								// Update iframe color if it exists
								if (Object.isElement($("upload_internal_iframe_"+inputField.id))){
								  	if ($("upload_internal_iframe_"+inputField.id).contentDocument) {
								    	// For FF
								    	$("upload_internal_iframe_"+inputField.id).contentDocument.body.style.backgroundColor = "#FFEBE8"; 
								  	} else if ($("upload_internal_iframe_"+inputField.id).contentWindow) {
									    // For IE5.5 and IE6
									    $("upload_internal_iframe_"+inputField.id).contentWindow.document.body.style.backgroundColor = "#FFEBE8";
								    }
								}
									
								$("fieldcellerror_"+inputField.id).style.display = "";
								$("fieldcellerror_"+inputField.id).innerHTML = "ERROR: Field can not be empty";
							}
							else{
								$("fieldcellerror_"+inputField.id).style.display = "none";
								if (isset($("row_"+inputField.id).style))
									$("row_"+inputField.id).style.backgroundColor = "";
									
								// Update iframe color if it exists
								if (Object.isElement($("upload_internal_iframe_"+inputField.id))){
								  	if ($("upload_internal_iframe_"+inputField.id).contentDocument) {
								    	// For FF
								    	$("upload_internal_iframe_"+inputField.id).contentDocument.body.style.backgroundColor = "#EAF3FA"; 
								  	} else if ($("upload_internal_iframe_"+inputField.id).contentWindow) {
									    // For IE5.5 and IE6
									    $("upload_internal_iframe_"+inputField.id).contentWindow.document.body.style.backgroundColor = "#EAF3FA";
								    }
								}
									
							}
						}
					);
				if (stopPublish){
					$("flutter-publish-error-message").style.display = "";
					Event.stop(event);
					return false;
				}
				
				return true;
			}

			Event.observe(window, 'load', function() {
				Event.observe('post', 'submit', checkForm);
			});
			
			// -------------
			// Edit Photo functions
			
			function setCookie(c_name,value,expiredays)
			{
				var exdate=new Date();
				exdate.setDate(exdate.getDate()+expiredays);
				document.cookie=c_name+ "=" +escape(value)+
				((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
			}
			function prepareUpdatePhoto(inputName){	
				document.getElementById(inputName+'_dorename').value = '1';
				return true;
			}	
			function exchangeValues(e, id)
			{
				//document.getElementById(document.getElementById('parent_text_'+id.substring(10)).value).value = e;
				//document.getElementById(document.getElementById('hidImgValue'+id.substring(10)).value).value = e;
			}
			
			// -------------
			// Date RCCPW_WritePostPage::Functions

			var dp_cal = new Array(); // declare the calendars as global variables
			
			function pickDate(inputName){
				if (dp_cal[inputName] && dp_cal[inputName].selectedDates[0]) document.getElementById('date_field_'+inputName).value = dp_cal[inputName].selectedDates[0].dateFormat('Y-m-d');
			}
			
			function InitializeDateObject(inputName, dateFormat, currentValue){
				if (!Object.isElement($('display_date_field_' + inputName))) return;
				
				dp_cal[inputName]  = new Epoch('dp_cal_'+inputName,'popup',document.getElementById('display_date_field_'+inputName), false, 'pickDate', inputName, dateFormat);
				
				var d = new Date();
				
				if (currentValue.length > 0){
					d.setYear(parseInt(currentValue.substr(0,4),10));
					d.setMonth(parseInt(currentValue.substr(5,2),10)-1);
					d.setDate(parseInt(currentValue.substr(8,2),10));
				}
				d.selected = true;
				d.canSelect = true;
				var tmpDatesArray = new Array(d);
				dp_cal[inputName].selectDates(tmpDatesArray, true, true, true);
				if (dp_cal[inputName] && dp_cal[inputName].selectedDates[0]) 
					document.getElementById('display_date_field_'+inputName).value = dp_cal[inputName].selectedDates[0].dateFormat(dateFormat);
			}	

			function today_date(inputName, dateFormat){
				var d = new Date();
				var tmpDatesArray = new Array(d);
				dp_cal[inputName].selectDates(tmpDatesArray, true, true, true);
				if (dp_cal[inputName] && dp_cal[inputName].selectedDates[0]){ 
					document.getElementById('display_date_field_'+inputName).value = dp_cal[inputName].selectedDates[0].dateFormat(dateFormat);
					document.getElementById('date_field_' + inputName).value = dp_cal[inputName].selectedDates[0].dateFormat('Y-m-d');
				}
			}
			

		</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 " . $name_title . " >> " . $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 
    }