} // Page variables $data = array(); $data['page_title'] = sprintf(__('Edit Custom Field: %s', CCTM_TXTDOMAIN), $field_name); $data['help'] = 'http://code.google.com/p/wordpress-custom-content-type-manager/wiki/CustomFieldDefinitions'; $data['msg'] = ''; $data['menu'] = sprintf('<a href="' . get_admin_url(false, 'admin.php') . '?page=cctm_fields&a=list_custom_fields" title="%s" class="button">%s</a>', __('Cancel'), __('Cancel')); $data['submit'] = __('Save', CCTM_TXTDOMAIN); $data['action_name'] = 'custom_content_type_mgr_edit_custom_field'; $data['nonce_name'] = 'custom_content_type_mgr_edit_custom_field_nonce'; $nonce = CCTM::get_value($_GET, '_wpnonce'); if (!wp_verify_nonce($nonce, 'cctm_edit_field')) { die(__('Invalid request.', CCTM_TXTDOMAIN)); } // Get the post-types for listing associations. $displayable_types = CCTM::get_post_types(); $field_type = self::$data['custom_field_defs'][$field_name]['type']; $field_data = self::$data['custom_field_defs'][$field_name]; // Data object we will save if (!($FieldObj = CCTM::load_object($field_type, 'fields'))) { die('Field not found.'); } $field_data['original_name'] = $field_name; $FieldObj->set_props($field_data); $data['change_field_type'] = '<br/><a href="?page=cctm_fields&a=change_field_type&field=' . $field_name . '&_wpnonce=' . wp_create_nonce('cctm_change_field_type') . '" class="button">' . __('Change Field Type', CCTM_TXTDOMAIN) . '</a></p>'; // Save if submitted... if (!empty($_POST) && check_admin_referer($data['action_name'], $data['nonce_name'])) { // A little cleanup before we handoff to save_definition_filter unset($_POST[$data['nonce_name']]); unset($_POST['_wp_http_referer']); // Handle editing of the associations
} /*------------------------------------------------------------------------------ Lists all defined post types: Post-types come in 3 flavors w 3 formatting variations: 1. Built-in post-types whose custom fields may be managed: posts, pages 2. Post-Types for which the CCTM can have full control over (this includes both active post-types and post-types which have full definitions for) 3. "Foreign" post-types registered by some other plugin whose custom fields the CCTM may standardize upon request. ------------------------------------------------------------------------------*/ $data = array(); $data['page_title'] = __('List Content Types', CCTM_TXTDOMAIN); $data['menu'] = sprintf('<a href="' . get_admin_url(false, 'admin.php') . '?page=cctm&a=create_post_type" class="button">%s</a>', __('Create Content Type', CCTM_TXTDOMAIN)); $data['msg'] = CCTM::get_flash(); $data['row_data'] = ''; $all_types = CCTM::get_post_types(); foreach ($all_types as $post_type) { $hash = array(); // populated for the tpl $hash['post_type'] = $post_type; $hash['icon'] = ''; // Get our default links $deactivate = sprintf('<a href="?page=cctm&a=deactivate_post_type&pt=%s" title="%s">%s</a>', $post_type, __('Deactivate this content type', CCTM_TXTDOMAIN), __('Deactivate', CCTM_TXTDOMAIN)); $edit_link = sprintf('<a href="?page=cctm&a=edit_post_type&pt=%s" title="%s">%s</a>', $post_type, __('Edit this content type', CCTM_TXTDOMAIN), __('Edit', CCTM_TXTDOMAIN)); $duplicate_link = sprintf('<a href="?page=cctm&a=duplicate_post_type&pt=%s" title="%s">%s</a>', $post_type, __('Duplicate this content type', CCTM_TXTDOMAIN), __('Duplicate', CCTM_TXTDOMAIN)); $manage_custom_fields = sprintf('<a href="?page=cctm&a=list_pt_associations&pt=%s" title="%s">%s</a>', $post_type, __('Manage Custom Fields for this content type', CCTM_TXTDOMAIN), __('Manage Custom Fields', CCTM_TXTDOMAIN)); $view_templates = sprintf('<a href="?page=cctm&a=template_single&pt=%s" title="%s">%s</a>', $post_type, __('View Sample Templates for this content type', CCTM_TXTDOMAIN), __('View Sample Templates', CCTM_TXTDOMAIN)); //------------------------------------------------------------------------------ // post,page: Built-in post types //------------------------------------------------------------------------------ if (in_array($post_type, CCTM::$built_in_post_types)) {