public static function Content($customGroup = null) { // add the new expanded column, if it's not there already (Traversal) RCCWP_Application::AddColumnIfNotExist(MF_TABLE_PANEL_GROUPS, "expanded", $column_attr = "tinyint after duplicate"); global $mf_domain; $customGroupName = $customGroupDuplicate = $customGroupExpanded = ""; if (isset($_GET['custom-write-panel-id'])) { $customWritePanelId = $_GET['custom-write-panel-id']; } if (isset($_POST['custom-write-panel-id'])) { $customWritePanelId = $_POST['custom-write-panel-id']; } if ($customGroup != null) { $customGroupName = $customGroup->name; $customGroupDuplicate = $customGroup->duplicate; $customGroupExpanded = $customGroup->expanded; } ?> <?php if ($customWritePanelId) { ?> <input type="hidden" name="custom-write-panel-id" value="<?php echo $customWritePanelId; ?> "> <?php } ?> <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> <tbody> <tr valign="top"> <th scope="row" align="right"><?php _e('Name', $mf_domain); ?> :</th> <td><input name="custom-group-name" id="custom-group-name" size="40" type="text" value="<?php echo $customGroupName; ?> " /></td> </tr> <tr> <th scope="row" align="right"><?php _e('Duplication', $mf_domain); ?> :</th> <td><input name="custom-group-duplicate" id="custom-group-duplicate" type="checkbox" value="1" <?php echo $customGroupDuplicate == 0 ? "" : "checked"; ?> /> <?php _e('The group can be duplicated', $mf_domain); ?> </td> </tr> <tr> <th scope="row" align="right"><?php _e('Show as Expanded', $mf_domain); ?> :</th> <td><input name="custom-group-expanded" id="custom-group-expanded" type="checkbox" value="1" <?php echo $customGroupExpanded == 0 ? '' : ' checked="checked" '; ?> /> <?php _e('Display the full expanded group editing interface instead of the group summary', $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> <br /> <?php }
/** * Upgrade Blog * * If the Plugin was upgrade from a older version * this function is executed for check any possible change in the database * * @return void */ function UpgradeBlog() { global $wpdb; if (RC_CWP_DB_VERSION <= 2) { $wpdb->query('ALTER TABLE ' . MF_TABLE_GROUP_FIELDS . ' MODIFY display_order INTEGER'); $wpdb->query('ALTER TABLE ' . MF_TABLE_GROUP_FIELDS . ' ADD COLUMN help_text text after duplicate'); $wpdb->query('ALTER TABLE ' . MF_TABLE_PANELS . ' MODIFY display_order INTEGER'); } if (RC_CWP_DB_VERSION >= 6) { if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "mf_custom_field_types'") == $wpdb->prefix . "mf_custom_field_types") { $wpdb->query("DROP TABLE " . $wpdb->prefix . "mf_custom_field_types"); } } if (RC_CWP_DB_VERSION >= 7) { RCCWP_Application::AddColumnIfNotExist(MF_TABLE_PANEL_GROUPS, "expanded", $column_attr = "tinyint after duplicate"); RCCWP_Application::AddColumnIfNotExist(MF_TABLE_PANELS, "expanded", $column_attr = "tinyint NOT NULL DEFAULT 1 after type"); } if (RC_CWP_DB_VERSION >= 8) { $wpdb->query('ALTER TABLE ' . MF_TABLE_PANEL_CATEGORY . ' MODIFY cat_id VARCHAR(100)'); } }
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> <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> <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" '; ?> /> <?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 }