diff --git a/cpt-editor.php b/cpt-editor.php index 0111ae0..9f71304 100755 --- a/cpt-editor.php +++ b/cpt-editor.php @@ -1,658 +1,658 @@ - array() - ); - - /** - * Constructor - * - */ - function __construct() { - - // Store the name of the directory that this plugin is installed in - $this->dirname = str_replace( '/cpt-editor.php', '', plugin_basename( __FILE__ ) ); - - $this->url = trailingslashit( plugins_url( '', __FILE__ ) ); - - register_activation_hook( __FILE__, array( $this, 'Activate' ) ); - - add_action( 'plugins_loaded', array( $this, 'LoadDomain' ) ); - - add_action( 'init', array( $this, 'CheckVersion' ) ); - - add_action( 'admin_menu', array( $this, 'AdminMenu') ); - - $this->installed_version = intval( get_option( $this->option_name ) ); - - $data = get_option($this->option_name); - if (is_array($data)) { - $this->installed_version = intval($data['version']); - $this->settings = $data['settings']; - } - - add_action( 'registered_post_type', array( $this, 'PostTypeRegistered' ), 10, 2 ); - - } - - /** - * Initialise I18n/Localisation - */ - function LoadDomain() { - load_plugin_textdomain( 'cpt-editor' ); - } - - /** - * Plugin Activation Tasks - */ - function Activate() { - // There aren't really any installation tasks (for now) - if ( ! $this->installed_version ) { - $this->installed_version = $this->db_version; - $this->SaveSettings(); - } - } - - /** - * Performs any database upgrade tasks if required - */ - function CheckVersion() { - if ( $this->installed_version != $this->db_version ) { - // Upgrade tasks - if ( $this->installed_version == 0 ) { - $this->installed_version ++; - } - $this->SaveSettings(); - } - } - - /** - * Executed whenever a Post Type is registered (by core, a plugin or a theme). - * - * Override any labels that have been customized, and if we're in the backend save a backup of the original CPT so that we can detect that its been modified. - * - * @param string $post_type - * @param array $args - */ - function PostTypeRegistered( $post_type, $args ) { - global $wp_post_types; - - if ( $this->NeedToBackupCustomPostTypes() && !isset($this->cpt_originals[$post_type]) ) { - // Save a copy of the original (unmodified) version of this post type - $this->cpt_originals[$post_type] = unserialize(serialize( $wp_post_types[$post_type] )); - } - - if ( isset($this->settings['types'][$post_type]['labels']) && is_array($this->settings['types'][$post_type]['labels']) ) { - - foreach ( $this->settings['types'][$post_type]['labels'] as $label_name => $label_text ) { - - if ( $label_text != $wp_post_types[$post_type]->labels->$label_name ) { - // This label text is customized, so override the default - $wp_post_types[$post_type]->labels->$label_name = $label_text; - } - } - // Set the CPT's label in case it was changed. See register_post_type() (where $args->label = $args->labels->name) - $wp_post_types[$post_type]->label = $wp_post_types[$post_type]->labels->name; - } - if ( isset( $this->settings['types'][$post_type]['description'] ) ) { - if ( $this->settings['types'][$post_type]['description'] != $wp_post_types[$post_type]->description ) { - // The CPT description is customized, so override the default - $wp_post_types[$post_type]->description = $this->settings['types'][$post_type]['description']; - } - } - } - - /** - * Whether we're on the Dashboard, Settings, Custom Post Types screen. - * @return bool - */ - private function IsSettingsPage() { - return is_admin() && isset($_GET['page']) && $_GET['page'] == basename(__FILE__); - } - - /** - * Whether or not we should save a backup of the original CPT definition before we override it. - * We don't want to do this on every page load - * @return bool - */ - private function NeedToBackupCustomPostTypes() { - return $this->IsSettingsPage(); - } - - /** - * Set up the Admin Settings menu - */ - public function AdminMenu() { - add_options_page( __( 'Custom Post Types', 'cpt-editor' ), __( 'Custom Post Types', 'cpt-editor' ), 'manage_options', basename( __FILE__ ), array( $this, 'AdminPage' ) ); - - $this->OverrideBuiltInCustomPostTypeMenuLabels(); - } - - /** - * Unfortunately WordPress' built-in Custom Post Types (post, page, attachment) don't automatically use their defined labels in the Dashboard menu. - * Instead, they are hard-coded in wp-admin/menu.php. - * - * This function checks to see if the user has modified the labels for any of these built-in custom post types, - * and if so it manually overrides the dashboard menu so that it uses these defined labels. - */ - private function OverrideBuiltInCustomPostTypeMenuLabels() { - global $menu, $submenu; - - $builtins_that_need_overrides = array( - 'post' - ,'page' - ,'attachment' - ); - - if ( is_array( $this->settings['types'] ) ) { - foreach ( $builtins_that_need_overrides as $post_type ) { - - if ( !isset($this->settings['types'][$post_type]['labels']) || !is_array($this->settings['types'][$post_type]['labels']) ) { - // The user hasn't customized the labels for this built-in CPT - continue; - } - - // Override built-in CPT labels - $admin_labels_that_need_overrides = array( - 'menu_name' - , 'all_items' - ,'add_new' - ); - foreach ( $admin_labels_that_need_overrides as $label_name_to_override ) { - - if ( isset($this->settings['types'][$post_type]['labels'][$label_name_to_override]) ) { - // The user has customized this label - - $id = null; - $file = null; - // These $id and $file values are taken from wp-admin/menu.php (where they are hard-coded) - switch ( $post_type ) { - case 'post': // Posts - $id = 5; - $file = 'edit.php'; - break; - case 'attachment': // Media - $id = 10; - $file = 'upload.php'; - break; - case 'page'; // Pages - $id = 20; - $file = 'edit.php?post_type=page'; - break; - } - - if ( !is_null($id) ) { - switch ( $label_name_to_override ) { - case 'menu_name': // Top level menu item label - if ( isset($menu[$id][0]) ) - $menu[$id][0] = $this->settings['types'][$post_type]['labels'][$label_name_to_override]; - break; - case 'all_items': // 'All Items' sub menu label - if ( isset($submenu[$file][5][0]) ) - $submenu[$file][5][0] = $this->settings['types'][$post_type]['labels'][$label_name_to_override]; - break; - case 'add_new': // 'Add New' sub menu label - if ( isset($submenu[$file][10][0]) ) - $submenu[$file][10][0] = $this->settings['types'][$post_type]['labels'][$label_name_to_override]; - break; - } - } - } - } - } - } - } - - /** - * Admin Page Controller/Handler - */ - public function AdminPage() { - - $this->base_url = admin_url( 'options-general.php?page=' . basename(__FILE__) ); - - if ( !isset($_GET['action']) ) - $_GET['action'] = ''; - - switch ( $_GET['action'] ) { - case 'edit': - $this->AdminPageEdit(); - break; - default: - $this->AdminPageList(); - break; - } - } - - - /** - * The Dashboard screen that lists all registered Custom Post Types - */ - private function AdminPageList() { - $this->AdminPageHeader(); - ?> -

-

-

- list = new OM4_CPT_List_Table($this); - - $this->list->display(); - - $this->AdminPageFooter(); - } - - /** - * The Dashboard screen that lets the user edit/modify a Custom Post Type - */ - function AdminPageEdit() { - - $this->AdminPageHeader(); - - $custom_post_type = get_post_type_object( sanitize_key($_GET['name'] ) ); - $custom_post_type_name = isset($custom_post_type->name) ? $custom_post_type->name : null; - - if ( is_null($custom_post_type) ) { - echo '

' . __( 'Invalid Custom Post Type', 'cpt-editor' ) . '

'; - $this->BackLink(); - $this->AdminPageFooter(); - return; - } - - $nonce = "{$this->option_name}_edit_custom_post_type_{$custom_post_type_name}"; - - ?> -

- settings['types'][$custom_post_type_name]['labels'] ) ) { - unset($this->settings['types'][$custom_post_type_name]['labels']); - } - // Reset description to its default value - if (isset($this->settings['types'][$custom_post_type_name]['description']) ) { - unset($this->settings['types'][$custom_post_type_name]['description']); - } - $needs_save = true; - } else { - // Process the labels - - foreach ( (array) $custom_post_type->labels as $label_name => $label_text ) { - - if ( isset($_POST[$label_name] ) ) { - - $_POST[$label_name] = wp_strip_all_tags( stripslashes($_POST[$label_name]) ); - - if ( strlen($_POST[$label_name]) > 0 ) { - // Some label text has been entered in the form - - if ( $_POST[$label_name] != $this->cpt_originals[$custom_post_type_name]->labels->{$label_name} ) { - // Label text is customized from the default - $this->settings['types'][$custom_post_type_name]['labels'][$label_name] = $_POST[$label_name]; - $needs_save = true; - } else { - // Label text is the same as the default - unset($this->settings['types'][$custom_post_type_name]['labels'][$label_name]); - $needs_save = true; - } - - } else { - // No label text specified -> reset to default - unset($this->settings['types'][$custom_post_type_name]['labels'][$label_name]); - $needs_save = true; - } - - } - } - - // Process the description - - if ( isset($_POST['description'] ) ) { - - $_POST['description'] = wp_strip_all_tags( stripslashes($_POST['description']) ); - - if ( strlen($_POST['description']) > 0 ) { - // Some description has been entered in the form - - if ( $_POST['description'] != $this->cpt_originals[$custom_post_type_name]->description ) { - // Description is customized from the default - $this->settings['types'][$custom_post_type_name]['description'] = $_POST['description']; - $needs_save = true; - } else { - // Description is the same as the default - unset($this->settings['types'][$custom_post_type_name]['description']); - $needs_save = true; - } - - } else { - // No description text specified -> reset to default - unset($this->settings['types'][$custom_post_type_name]['description']); - $needs_save = true; - } - - } - } - - if ( $needs_save ) { - $this->SaveSettings(); - echo '

' . __('Custom Post Type updated. Your changes will be visible on your next page load. Reload page', 'cpt-editor') . '

'; - $this->BackLink(); - $this->AdminPageFooter(); - return; - } - } - - ?> -
-

-

-

- - - - - $label_info ) { - if ( isset($label_info['condition']) ) { - // This label needs to satisfy a condition before it is displayed - if ( !$custom_post_type->{$label_info['condition']} ) { - // Don't display this label - continue; - } - } - ?> - - - - - -
 
- - settings['types'][$custom_post_type_name]['description']) ? 'customized' : 'default' ); - } else { - $class = esc_attr( isset($this->settings['types'][$custom_post_type_name]['labels'][$label_name]) ? 'customized' : 'default' ); - } - - $value = ''; - if ( 'description' == $label_name ) { - $value = $custom_post_type->description; - } else { - $value = $custom_post_type->labels->$label_name; - } - ?> - - cpt_originals[$custom_post_type_name]->description) ? '' . esc_html($this->cpt_originals[$custom_post_type_name]->description) . '' : esc_html__('[Empty]', 'cpt-editor'); - } else { - $default = ($this->cpt_originals[$custom_post_type_name]->labels->$label_name) ? '' . esc_html($this->cpt_originals[$custom_post_type_name]->labels->$label_name) . '' : esc_html__('[Empty]', 'cpt-editor'); - } - ?> - -
- - -

-
- BackLink(); - $this->AdminPageFooter(); - } - - /** - * The header for the Dashboard screens - */ - private function AdminPageHeader() { - ?> -
- - - -

- -
- settings['types'][$post_type]['labels']) && is_array($this->settings['types'][$post_type]['labels']) && count($this->settings['types'][$post_type]['labels']) ); - } - - /** - * The number of customizations for the specified Custom Post Type - * @param string $post_type The Custom Post Type name/identifier - * @return int - */ - public function NumberOfCustomizations( $post_type ) { - $num = ( isset($this->settings['types'][$post_type]['labels']) && is_array($this->settings['types'][$post_type]['labels']) ) ? count($this->settings['types'][$post_type]['labels']) : 0; - if ( isset( $this->settings['types'][$post_type]['description'] ) ) { - $num++; - } - return $num; - } - - /** - * Saves the plugin's settings to the database - */ - function SaveSettings() { - $data = array_merge( array( 'version' => $this->installed_version ), array( 'settings' => $this->settings ) ); - update_option( $this->option_name, $data ); - } -} - -if ( defined( 'ABSPATH' ) && defined( 'WPINC' ) ) { - if ( ! isset($GLOBALS["om4_CPT_Editor"]) ) { - $GLOBALS["om4_CPT_Editor"] = new OM4_CPT_Editor(); - } -} + array() + ); + + /** + * Constructor + * + */ + function __construct() { + + // Store the name of the directory that this plugin is installed in + $this->dirname = str_replace( '/cpt-editor.php', '', plugin_basename( __FILE__ ) ); + + $this->url = trailingslashit( plugins_url( '', __FILE__ ) ); + + register_activation_hook( __FILE__, array( $this, 'Activate' ) ); + + add_action( 'plugins_loaded', array( $this, 'LoadDomain' ) ); + + add_action( 'init', array( $this, 'CheckVersion' ) ); + + add_action( 'admin_menu', array( $this, 'AdminMenu') ); + + $this->installed_version = intval( get_option( $this->option_name ) ); + + $data = get_option($this->option_name); + if (is_array($data)) { + $this->installed_version = intval($data['version']); + $this->settings = $data['settings']; + } + + add_action( 'registered_post_type', array( $this, 'PostTypeRegistered' ), 10, 2 ); + + } + + /** + * Initialise I18n/Localisation + */ + function LoadDomain() { + load_plugin_textdomain( 'cpt-editor' ); + } + + /** + * Plugin Activation Tasks + */ + function Activate() { + // There aren't really any installation tasks (for now) + if ( ! $this->installed_version ) { + $this->installed_version = $this->db_version; + $this->SaveSettings(); + } + } + + /** + * Performs any database upgrade tasks if required + */ + function CheckVersion() { + if ( $this->installed_version != $this->db_version ) { + // Upgrade tasks + if ( $this->installed_version == 0 ) { + $this->installed_version ++; + } + $this->SaveSettings(); + } + } + + /** + * Executed whenever a Post Type is registered (by core, a plugin or a theme). + * + * Override any labels that have been customized, and if we're in the backend save a backup of the original CPT so that we can detect that its been modified. + * + * @param string $post_type + * @param array $args + */ + function PostTypeRegistered( $post_type, $args ) { + global $wp_post_types; + + if ( $this->NeedToBackupCustomPostTypes() && !isset($this->cpt_originals[$post_type]) ) { + // Save a copy of the original (unmodified) version of this post type + $this->cpt_originals[$post_type] = unserialize(serialize( $wp_post_types[$post_type] )); + } + + if ( isset($this->settings['types'][$post_type]['labels']) && is_array($this->settings['types'][$post_type]['labels']) ) { + + foreach ( $this->settings['types'][$post_type]['labels'] as $label_name => $label_text ) { + + if ( $label_text != $wp_post_types[$post_type]->labels->$label_name ) { + // This label text is customized, so override the default + $wp_post_types[$post_type]->labels->$label_name = $label_text; + } + } + // Set the CPT's label in case it was changed. See register_post_type() (where $args->label = $args->labels->name) + $wp_post_types[$post_type]->label = $wp_post_types[$post_type]->labels->name; + } + if ( isset( $this->settings['types'][$post_type]['description'] ) ) { + if ( $this->settings['types'][$post_type]['description'] != $wp_post_types[$post_type]->description ) { + // The CPT description is customized, so override the default + $wp_post_types[$post_type]->description = $this->settings['types'][$post_type]['description']; + } + } + } + + /** + * Whether we're on the Dashboard, Settings, Custom Post Types screen. + * @return bool + */ + private function IsSettingsPage() { + return is_admin() && isset($_GET['page']) && $_GET['page'] == basename(__FILE__); + } + + /** + * Whether or not we should save a backup of the original CPT definition before we override it. + * We don't want to do this on every page load + * @return bool + */ + private function NeedToBackupCustomPostTypes() { + return $this->IsSettingsPage(); + } + + /** + * Set up the Admin Settings menu + */ + public function AdminMenu() { + add_options_page( __( 'Custom Post Types', 'cpt-editor' ), __( 'Custom Post Types', 'cpt-editor' ), 'manage_options', basename( __FILE__ ), array( $this, 'AdminPage' ) ); + + $this->OverrideBuiltInCustomPostTypeMenuLabels(); + } + + /** + * Unfortunately WordPress' built-in Custom Post Types (post, page, attachment) don't automatically use their defined labels in the Dashboard menu. + * Instead, they are hard-coded in wp-admin/menu.php. + * + * This function checks to see if the user has modified the labels for any of these built-in custom post types, + * and if so it manually overrides the dashboard menu so that it uses these defined labels. + */ + private function OverrideBuiltInCustomPostTypeMenuLabels() { + global $menu, $submenu; + + $builtins_that_need_overrides = array( + 'post' + ,'page' + ,'attachment' + ); + + if ( is_array( $this->settings['types'] ) ) { + foreach ( $builtins_that_need_overrides as $post_type ) { + + if ( !isset($this->settings['types'][$post_type]['labels']) || !is_array($this->settings['types'][$post_type]['labels']) ) { + // The user hasn't customized the labels for this built-in CPT + continue; + } + + // Override built-in CPT labels + $admin_labels_that_need_overrides = array( + 'menu_name' + , 'all_items' + ,'add_new' + ); + foreach ( $admin_labels_that_need_overrides as $label_name_to_override ) { + + if ( isset($this->settings['types'][$post_type]['labels'][$label_name_to_override]) ) { + // The user has customized this label + + $id = null; + $file = null; + // These $id and $file values are taken from wp-admin/menu.php (where they are hard-coded) + switch ( $post_type ) { + case 'post': // Posts + $id = 5; + $file = 'edit.php'; + break; + case 'attachment': // Media + $id = 10; + $file = 'upload.php'; + break; + case 'page'; // Pages + $id = 20; + $file = 'edit.php?post_type=page'; + break; + } + + if ( !is_null($id) ) { + switch ( $label_name_to_override ) { + case 'menu_name': // Top level menu item label + if ( isset($menu[$id][0]) ) + $menu[$id][0] = $this->settings['types'][$post_type]['labels'][$label_name_to_override]; + break; + case 'all_items': // 'All Items' sub menu label + if ( isset($submenu[$file][5][0]) ) + $submenu[$file][5][0] = $this->settings['types'][$post_type]['labels'][$label_name_to_override]; + break; + case 'add_new': // 'Add New' sub menu label + if ( isset($submenu[$file][10][0]) ) + $submenu[$file][10][0] = $this->settings['types'][$post_type]['labels'][$label_name_to_override]; + break; + } + } + } + } + } + } + } + + /** + * Admin Page Controller/Handler + */ + public function AdminPage() { + + $this->base_url = admin_url( 'options-general.php?page=' . basename(__FILE__) ); + + if ( !isset($_GET['action']) ) + $_GET['action'] = ''; + + switch ( $_GET['action'] ) { + case 'edit': + $this->AdminPageEdit(); + break; + default: + $this->AdminPageList(); + break; + } + } + + + /** + * The Dashboard screen that lists all registered Custom Post Types + */ + private function AdminPageList() { + $this->AdminPageHeader(); + ?> +

+

+

+ list = new OM4_CPT_List_Table($this); + + $this->list->display(); + + $this->AdminPageFooter(); + } + + /** + * The Dashboard screen that lets the user edit/modify a Custom Post Type + */ + function AdminPageEdit() { + + $this->AdminPageHeader(); + + $custom_post_type = get_post_type_object( sanitize_key($_GET['name'] ) ); + $custom_post_type_name = isset($custom_post_type->name) ? $custom_post_type->name : null; + + if ( is_null($custom_post_type) ) { + echo '

' . __( 'Invalid Custom Post Type', 'cpt-editor' ) . '

'; + $this->BackLink(); + $this->AdminPageFooter(); + return; + } + + $nonce = "{$this->option_name}_edit_custom_post_type_{$custom_post_type_name}"; + + ?> +

+ settings['types'][$custom_post_type_name]['labels'] ) ) { + unset($this->settings['types'][$custom_post_type_name]['labels']); + } + // Reset description to its default value + if (isset($this->settings['types'][$custom_post_type_name]['description']) ) { + unset($this->settings['types'][$custom_post_type_name]['description']); + } + $needs_save = true; + } else { + // Process the labels + + foreach ( (array) $custom_post_type->labels as $label_name => $label_text ) { + + if ( isset($_POST[$label_name] ) ) { + + $_POST[$label_name] = wp_strip_all_tags( stripslashes($_POST[$label_name]) ); + + if ( strlen($_POST[$label_name]) > 0 ) { + // Some label text has been entered in the form + + if ( $_POST[$label_name] != $this->cpt_originals[$custom_post_type_name]->labels->{$label_name} ) { + // Label text is customized from the default + $this->settings['types'][$custom_post_type_name]['labels'][$label_name] = $_POST[$label_name]; + $needs_save = true; + } else { + // Label text is the same as the default + unset($this->settings['types'][$custom_post_type_name]['labels'][$label_name]); + $needs_save = true; + } + + } else { + // No label text specified -> reset to default + unset($this->settings['types'][$custom_post_type_name]['labels'][$label_name]); + $needs_save = true; + } + + } + } + + // Process the description + + if ( isset($_POST['description'] ) ) { + + $_POST['description'] = wp_strip_all_tags( stripslashes($_POST['description']) ); + + if ( strlen($_POST['description']) > 0 ) { + // Some description has been entered in the form + + if ( $_POST['description'] != $this->cpt_originals[$custom_post_type_name]->description ) { + // Description is customized from the default + $this->settings['types'][$custom_post_type_name]['description'] = $_POST['description']; + $needs_save = true; + } else { + // Description is the same as the default + unset($this->settings['types'][$custom_post_type_name]['description']); + $needs_save = true; + } + + } else { + // No description text specified -> reset to default + unset($this->settings['types'][$custom_post_type_name]['description']); + $needs_save = true; + } + + } + } + + if ( $needs_save ) { + $this->SaveSettings(); + echo '

' . __('Custom Post Type updated. Your changes will be visible on your next page load. Reload page', 'cpt-editor') . '

'; + $this->BackLink(); + $this->AdminPageFooter(); + return; + } + } + + ?> +
+

+

+

+ + + + + $label_info ) { + if ( isset($label_info['condition']) ) { + // This label needs to satisfy a condition before it is displayed + if ( !$custom_post_type->{$label_info['condition']} ) { + // Don't display this label + continue; + } + } + ?> + + + + + +
 
+ + settings['types'][$custom_post_type_name]['description']) ? 'customized' : 'default' ); + } else { + $class = esc_attr( isset($this->settings['types'][$custom_post_type_name]['labels'][$label_name]) ? 'customized' : 'default' ); + } + + $value = ''; + if ( 'description' == $label_name ) { + $value = $custom_post_type->description; + } else { + $value = $custom_post_type->labels->$label_name; + } + ?> + + cpt_originals[$custom_post_type_name]->description) ? '' . esc_html($this->cpt_originals[$custom_post_type_name]->description) . '' : esc_html__('[Empty]', 'cpt-editor'); + } else { + $default = ($this->cpt_originals[$custom_post_type_name]->labels->$label_name) ? '' . esc_html($this->cpt_originals[$custom_post_type_name]->labels->$label_name) . '' : esc_html__('[Empty]', 'cpt-editor'); + } + ?> + +
+ + +

+
+ BackLink(); + $this->AdminPageFooter(); + } + + /** + * The header for the Dashboard screens + */ + private function AdminPageHeader() { + ?> +
+ + + +

+ +
+ settings['types'][$post_type]['labels']) && is_array($this->settings['types'][$post_type]['labels']) && count($this->settings['types'][$post_type]['labels']) ); + } + + /** + * The number of customizations for the specified Custom Post Type + * @param string $post_type The Custom Post Type name/identifier + * @return int + */ + public function NumberOfCustomizations( $post_type ) { + $num = ( isset($this->settings['types'][$post_type]['labels']) && is_array($this->settings['types'][$post_type]['labels']) ) ? count($this->settings['types'][$post_type]['labels']) : 0; + if ( isset( $this->settings['types'][$post_type]['description'] ) ) { + $num++; + } + return $num; + } + + /** + * Saves the plugin's settings to the database + */ + function SaveSettings() { + $data = array_merge( array( 'version' => $this->installed_version ), array( 'settings' => $this->settings ) ); + update_option( $this->option_name, $data ); + } +} + +if ( defined( 'ABSPATH' ) && defined( 'WPINC' ) ) { + if ( ! isset($GLOBALS["om4_CPT_Editor"]) ) { + $GLOBALS["om4_CPT_Editor"] = new OM4_CPT_Editor(); + } +} diff --git a/languages/cpt-editor.pot b/languages/cpt-editor.pot index 9967267..c70b87a 100644 --- a/languages/cpt-editor.pot +++ b/languages/cpt-editor.pot @@ -1,16 +1,38 @@ -# Copyright (C) 2016 Custom Post Type Editor -# This file is distributed under the same license as the Custom Post Type Editor package. +# Copyright (C) 2020 OM4 +# This file is distributed under the GPLv2 or later. msgid "" msgstr "" -"Project-Id-Version: Custom Post Type Editor 1.4\n" +"Project-Id-Version: Custom Post Type Editor 1.4.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cpt-editor\n" -"POT-Creation-Date: 2016-12-06 03:16:44+00:00\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2020-09-04T04:01:08+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.4.0\n" +"X-Domain: cpt-editor\n" + +#. Plugin Name of the plugin +msgid "Custom Post Type Editor" +msgstr "" + +#. Plugin URI of the plugin +msgid "https://om4.io/plugins/custom-post-type-editor/" +msgstr "" + +#. Description of the plugin +msgid "Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface." +msgstr "" + +#. Author of the plugin +msgid "OM4" +msgstr "" + +#. Author URI of the plugin +msgid "https://om4.io/" +msgstr "" #: cpt-editor.php:178 msgid "Custom Post Types" @@ -280,7 +302,8 @@ msgstr "" msgid "%1s
(%2s)" msgstr "" -#: cpt-editor.php:548 cpt-editor.php:550 +#: cpt-editor.php:548 +#: cpt-editor.php:550 msgid "[Empty]" msgstr "" @@ -315,22 +338,3 @@ msgstr "" #: inc/OM4_CPT_List_Table.php:103 msgid "Default" msgstr "" -#. Plugin Name of the plugin/theme -msgid "Custom Post Type Editor" -msgstr "" - -#. Plugin URI of the plugin/theme -msgid "https://om4.com.au/plugins/custom-post-type-editor/" -msgstr "" - -#. Description of the plugin/theme -msgid "Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface." -msgstr "" - -#. Author of the plugin/theme -msgid "OM4" -msgstr "" - -#. Author URI of the plugin/theme -msgid "https://om4.com.au/plugins/" -msgstr "" diff --git a/readme.txt b/readme.txt index fe67221..6b0c388 100644 --- a/readme.txt +++ b/readme.txt @@ -1,145 +1,147 @@ -=== Custom Post Type Editor === -Contributors: jamescollins, glenn-om4 -Donate link: https://om4.com.au/plugins/#donate -Tags: custom post type, cpt, post type, label, description, editor -Requires at least: 3.6 -Tested up to: 5.2 -Stable tag: 1.4.1 -License: GPLv2 or later -License URI: http://www.gnu.org/licenses/gpl-2.0.html - -Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface. - -== Description == - -Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface. No PHP file editing is necessary! - -* Want to rename `Posts` to `News`? -* Want to rename `Media` to `Files`? -* Want to rename the WooThemes’ `Features` post type to `Tours`? - -You can do all of this (and more) using this plugin. - -For example, you could customize the following Custom Post Types: - -* The `Posts` Custom Post Type (created by WordPress Core) -* The `Pages` Custom Post Type (created by WordPress Core) -* The `Media` Custom Post Type (created by WordPress Core) -* Any Custom Post Type that is created by a WordPress plugin -* Any Custom Post Type that is created by a WordPress theme - -This means that you no longer have to modify PHP files in order to rename a Custom Post Type! - -See the [screenshots](https://wordpress.org/plugins/cpt-editor/screenshots/) and [Custom Post Type Editor Plugin home page](https://om4.com.au/plugins/custom-post-type-editor/) for further information. - -== Installation == - -Installation of this plugin is simple: - -1. Download the plugin files and copy to your Plugins directory. -1. Activate the plugin through the 'Plugins' menu in WordPress. -1. Navigate to Dashboard, Settings, Custom Post Types. - -== Frequently Asked Questions == - -= What does this plugin do? = - -It provides an easy way for you to modify/customise the *labels* and/or *description* of any registered Custom Post Type. This includes WordPress' built-in post types, as well as any Custom Post Types created by a plugin or theme. - -= What doesn't this plugin do? = - -It doesn't allow you do other things such as changing a Custom Post Type's rewrite slug or body class. Changing those can cause styling or display issues with themes. - -If you look at [this WordPress Codex page](http://codex.wordpress.org/Function_Reference/register_post_type#Arguments), the `labels` values can be changed by this plugin. The `description` can also be changed by this plugin. All other parameters (such as `public`, `exclude_from_search`, etc.) ***cannot*** be customised using this plugin. - -= Does this plugin modify any core WordPress, plugin or theme files? = - -No. It uses WordPress' hook/filter to override Custom Post Type definitions on-the-fly. No files are modified by this plugin. - -= Does this plugin permanently change anything? = - -No. If you deactivate this plugin, your Custom Post Type definitions will revert to their defaults. - -= Does this plugin work with WordPress Multisite? = - -Yes - this plugin works with WordPress Multisite. - -= I found a bug. How can I contribute a patch or bug fix? = - -We'd love you to fork our [Github Repository](https://github.com/OM4/cpt-editor) and send us a pull request. - -Alternatively, you can report a bug on our [Issue Tracker](https://github.com/OM4/cpt-editor/issues). - -== Screenshots == -1. The list of registered Custom Post Types -1. The interface for editing a Custom Post Type - -== Changelog == - -= 1.4.1 = -* Mark WordPress 5.2 compatible. - -= 1.4 = -* Add support for the 2 new post type labels that were added in WordPress 4.7 (view_items and attributes). - -= 1.3 = -* Add support for customizing a Custom Post Type's description. Thanks to LeodanEvolution for the suggestion. -* Add support for the 4 new post type labels that were added in WordPress 4.3. -* Add support for the 6 new post type labels that were added in WordPress 4.4. - -= 1.2.6 = -* WordPress 4.5 compatibility. -* PHP 7 compatibility (a PHP notice no longer occurs) - -= 1.2.5 = -* WordPress 4.3 compatibility. -* Change plugin's textdomain to match the plugin's folder name in preparation for translate.wordpress.org translations. -* Readme updates. - -= 1.2.4 = -* More secure edit links. - -= 1.2.3 = -* WordPress 4.1 compatibility. - -= 1.2.2 = -* WordPress 4.0 compatibility. -* Screenshot updates. - -= 1.2.1 = -* PHP notice fixes. Props klihelp. - -= 1.2 = -* WordPress 3.8 compatibility - -= 1.1 = -* WordPress 3.5 compatibility -* Documentation/FAQ updates - -= 1.0.2 = -* Documentation updates -* US spelling -* Screenshot updates - -= 1.0.1 = -* Add support for customising WordPress' built-in Posts, Pages and Media dashboard menu labels. Thanks to Aaron Rutley for testing this. - -= 1.0 = -* Initial release. - -== Upgrade Notice == - -= 1.3 = -* Adds support for customizing a Custom Post Type's description, and adds support for 10 new custom post type labels - -= 1.2 = -* WordPress 3.8 compatibility - -= 1.1 = -* WordPress 3.5 compatibility, documentation/FAQ updates - -= 1.0.2 = -* Documentation, spelling and screenshot updates. - -= 1.0.1 = -* Adds support for customising WordPress' built-in Posts, Pages and Media dashboard menu labels. +=== Custom Post Type Editor === +Contributors: jamescollins, glenn-om4 +Tags: custom post type, cpt, post type, label, description, editor +Requires at least: 3.6 +Tested up to: 5.5 +Stable tag: 1.4.2 +License: GPLv2 or later +License URI: http://www.gnu.org/licenses/gpl-2.0.html + +Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface. + +== Description == + +Customize the text labels, menu names or description for any registered custom post type using a simple Dashboard user interface. No PHP file editing is necessary! + +* Want to rename `Posts` to `News`? +* Want to rename `Media` to `Files`? +* Want to rename the WooThemes’ `Features` post type to `Tours`? + +You can do all of this (and more) using this plugin. + +For example, you could customize the following Custom Post Types: + +* The `Posts` Custom Post Type (created by WordPress Core) +* The `Pages` Custom Post Type (created by WordPress Core) +* The `Media` Custom Post Type (created by WordPress Core) +* Any Custom Post Type that is created by a WordPress plugin +* Any Custom Post Type that is created by a WordPress theme + +This means that you no longer have to modify PHP files in order to rename a Custom Post Type! + +See the [screenshots](https://wordpress.org/plugins/cpt-editor/screenshots/) and [Custom Post Type Editor Plugin home page](https://om4.io/plugins/custom-post-type-editor/) for further information. + +== Installation == + +Installation of this plugin is simple: + +1. Download the plugin files and copy to your Plugins directory. +1. Activate the plugin through the 'Plugins' menu in WordPress. +1. Navigate to Dashboard, Settings, Custom Post Types. + +== Frequently Asked Questions == + += What does this plugin do? = + +It provides an easy way for you to modify/customise the *labels* and/or *description* of any registered Custom Post Type. This includes WordPress' built-in post types, as well as any Custom Post Types created by a plugin or theme. + += What doesn't this plugin do? = + +It doesn't allow you do other things such as changing a Custom Post Type's rewrite slug or body class. Changing those can cause styling or display issues with themes. + +If you look at [this WordPress Codex page](http://codex.wordpress.org/Function_Reference/register_post_type#Arguments), the `labels` values can be changed by this plugin. The `description` can also be changed by this plugin. All other parameters (such as `public`, `exclude_from_search`, etc.) ***cannot*** be customised using this plugin. + += Does this plugin modify any core WordPress, plugin or theme files? = + +No. It uses WordPress' hook/filter to override Custom Post Type definitions on-the-fly. No files are modified by this plugin. + += Does this plugin permanently change anything? = + +No. If you deactivate this plugin, your Custom Post Type definitions will revert to their defaults. + += Does this plugin work with WordPress Multisite? = + +Yes - this plugin works with WordPress Multisite. + += I found a bug. How can I contribute a patch or bug fix? = + +We'd love you to fork our [Github Repository](https://github.com/OM4/cpt-editor) and send us a pull request. + +Alternatively, you can report a bug on our [Issue Tracker](https://github.com/OM4/cpt-editor/issues). + +== Screenshots == +1. The list of registered Custom Post Types +1. The interface for editing a Custom Post Type + +== Changelog == + += 1.4.2 = +* Mark WordPress 5.5 compatible. + += 1.4.1 = +* Mark WordPress 5.2 compatible. + += 1.4 = +* Add support for the 2 new post type labels that were added in WordPress 4.7 (view_items and attributes). + += 1.3 = +* Add support for customizing a Custom Post Type's description. Thanks to LeodanEvolution for the suggestion. +* Add support for the 4 new post type labels that were added in WordPress 4.3. +* Add support for the 6 new post type labels that were added in WordPress 4.4. + += 1.2.6 = +* WordPress 4.5 compatibility. +* PHP 7 compatibility (a PHP notice no longer occurs) + += 1.2.5 = +* WordPress 4.3 compatibility. +* Change plugin's textdomain to match the plugin's folder name in preparation for translate.wordpress.org translations. +* Readme updates. + += 1.2.4 = +* More secure edit links. + += 1.2.3 = +* WordPress 4.1 compatibility. + += 1.2.2 = +* WordPress 4.0 compatibility. +* Screenshot updates. + += 1.2.1 = +* PHP notice fixes. Props klihelp. + += 1.2 = +* WordPress 3.8 compatibility + += 1.1 = +* WordPress 3.5 compatibility +* Documentation/FAQ updates + += 1.0.2 = +* Documentation updates +* US spelling +* Screenshot updates + += 1.0.1 = +* Add support for customising WordPress' built-in Posts, Pages and Media dashboard menu labels. Thanks to Aaron Rutley for testing this. + += 1.0 = +* Initial release. + +== Upgrade Notice == + += 1.3 = +* Adds support for customizing a Custom Post Type's description, and adds support for 10 new custom post type labels + += 1.2 = +* WordPress 3.8 compatibility + += 1.1 = +* WordPress 3.5 compatibility, documentation/FAQ updates + += 1.0.2 = +* Documentation, spelling and screenshot updates. + += 1.0.1 = +* Adds support for customising WordPress' built-in Posts, Pages and Media dashboard menu labels.