diff --git a/admin-settings.php b/admin-settings.php index 19a32a7..ee20a8d 100644 --- a/admin-settings.php +++ b/admin-settings.php @@ -77,7 +77,7 @@ protected function __construct() { } // Will show thickbox of network site information - $this->thickbox_network_sites = $this->is_network_admin ? ( ' ' . __( 'View Network Site Information', 'cpt-onomies' ) . '' ) : NULL; + $this->thickbox_network_sites = $this->is_network_admin ? ( ' ' . __( 'View Network Site Information', 'cpt-onomies' ) . '' ) : null; // Adds a settings link to the plugins page add_filter( 'network_admin_plugin_action_links_' . CPT_ONOMIES_PLUGIN_FILE, array( $this, 'add_plugin_action_links' ), 10, 4 ); @@ -213,7 +213,7 @@ private function delete_conflicting_taxonomy_terms( $post_type ) { // First, we need terms info for this particular taxonomy if ( $terms_info = $wpdb->get_results( "SELECT term_id, term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE taxonomy = '{$post_type}'" ) ) { - foreach( $terms_info as $term ) { + foreach ( $terms_info as $term ) { // Delete the term $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ), array( '%d' ) ); @@ -266,7 +266,7 @@ private function detect_settings_page_variables() { if ( $edit = ( ! $new && isset( $_REQUEST[ 'edit' ] ) ) ? strtolower( $_REQUEST[ 'edit' ] ) : false ) { // Check to see if CPT exists in settings - foreach( array( 'edit' ) as $cpt_key_to_check ) { + foreach ( array( 'edit' ) as $cpt_key_to_check ) { if ( ${$cpt_key_to_check} ) { // For network settings @@ -380,9 +380,9 @@ private function detect_custom_post_type_message_variables( $post_type, $CPT, $o */ public function get_network_sites() { global $wpdb; - $network_blogs = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $wpdb->blogs . " WHERE archived IN ( 0, '0' ) ORDER BY blog_id", NULL ) ); + $network_blogs = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $wpdb->blogs . " WHERE archived IN ( 0, '0' ) ORDER BY blog_id", null ) ); $network_blogs_details = array(); - foreach( $network_blogs as $this_blog_id ) { + foreach ( $network_blogs as $this_blog_id ) { $network_blogs_details[ $this_blog_id ] = get_blog_details( $this_blog_id ); } return $network_blogs_details; @@ -397,7 +397,7 @@ public function ajax_print_network_sites() { $network_blogs = $this->get_network_sites(); if ( ! is_multisite() ) { ?>
- +', '' ); ?>
blog_id; ?> | blogname; ?> | @@ -441,8 +441,8 @@ public function ajax_validate_plugin_options_if_post_type_exists() { // Get post type info $custom_post_type_onomies_is_network_admin = ( isset( $_POST[ 'custom_post_type_onomies_is_network_admin' ] ) && $_POST[ 'custom_post_type_onomies_is_network_admin' ] ) ? true : false; - $original_custom_post_type_name = ( isset( $_POST[ 'original_custom_post_type_onomies_cpt_name' ] ) && ! empty( $_POST[ 'original_custom_post_type_onomies_cpt_name' ] ) ) ? $_POST[ 'original_custom_post_type_onomies_cpt_name' ] : NULL; - $custom_post_type_name = ( isset( $_POST[ 'custom_post_type_onomies_cpt_name' ] ) && ! empty( $_POST[ 'custom_post_type_onomies_cpt_name' ] ) ) ? $_POST[ 'custom_post_type_onomies_cpt_name' ] : NULL; + $original_custom_post_type_name = ( isset( $_POST[ 'original_custom_post_type_onomies_cpt_name' ] ) && ! empty( $_POST[ 'original_custom_post_type_onomies_cpt_name' ] ) ) ? $_POST[ 'original_custom_post_type_onomies_cpt_name' ] : null; + $custom_post_type_name = ( isset( $_POST[ 'custom_post_type_onomies_cpt_name' ] ) && ! empty( $_POST[ 'custom_post_type_onomies_cpt_name' ] ) ) ? $_POST[ 'custom_post_type_onomies_cpt_name' ] : null; if ( ( ( ! empty( $original_custom_post_type_name ) && ! empty( $custom_post_type_name ) && $custom_post_type_name != $original_custom_post_type_name ) || ( empty( $original_custom_post_type_name ) && ! empty( $custom_post_type_name ) ) ) && ( ( $custom_post_type_onomies_is_network_admin && array_key_exists( $custom_post_type_name, $cpt_onomies_manager->user_settings[ 'network_custom_post_types' ] ) ) || ( ! $custom_post_type_onomies_is_network_admin && ( ( post_type_exists( $custom_post_type_name ) && ( ! $cpt_onomies_manager->is_registered_network_cpt( $custom_post_type_name ) ) ) || array_key_exists( $custom_post_type_name, $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) ) ) ) ) { echo false; @@ -467,7 +467,7 @@ public function ajax_update_plugin_options_edit_custom_post_type_closed_edit_tab global $user_ID; // Get the table we're editing - $edit_table = ( isset( $_POST[ 'custom_post_type_onomies_edit_table' ] ) && ! empty( $_POST[ 'custom_post_type_onomies_edit_table' ] ) ) ? $_POST[ 'custom_post_type_onomies_edit_table' ] : NULL; + $edit_table = ( isset( $_POST[ 'custom_post_type_onomies_edit_table' ] ) && ! empty( $_POST[ 'custom_post_type_onomies_edit_table' ] ) ) ? $_POST[ 'custom_post_type_onomies_edit_table' ] : null; if ( $edit_table ) { $show = $_POST[ 'custom_post_type_onomies_edit_table_show' ]; @@ -491,9 +491,9 @@ public function ajax_update_plugin_options_edit_custom_post_type_closed_edit_tab } // We need to make sure its removed from the array - else if ( ! empty( $saved_option ) && in_array( $edit_table, $saved_option ) ) { + elseif ( ! empty( $saved_option ) && in_array( $edit_table, $saved_option ) ) { - foreach( $saved_option as $key => $value ) { + foreach ( $saved_option as $key => $value ) { if ( $value == $edit_table ) { unset( $saved_option[ $key ] ); } @@ -517,7 +517,7 @@ public function ajax_update_plugin_options_edit_custom_post_type_closed_edit_tab */ public function ajax_update_plugin_options_edit_custom_post_type_closed_dismiss() { global $user_ID; - $dismiss_id = ( isset( $_POST[ 'custom_post_type_onomies_dismiss_id' ] ) && ! empty( $_POST[ 'custom_post_type_onomies_dismiss_id' ] ) ) ? $_POST[ 'custom_post_type_onomies_dismiss_id' ] : NULL; + $dismiss_id = ( isset( $_POST[ 'custom_post_type_onomies_dismiss_id' ] ) && ! empty( $_POST[ 'custom_post_type_onomies_dismiss_id' ] ) ) ? $_POST[ 'custom_post_type_onomies_dismiss_id' ] : null; if ( $dismiss_id ) { // Get set option @@ -648,12 +648,12 @@ public function validate_plugin_options_custom_post_types( $custom_post_types, $ if ( current_user_can( $this->manage_options_capability ) && ! empty( $custom_post_types ) ) { // If set, will redirect settings page to show specified custom post type - $redirect_cpt = NULL; + $redirect_cpt = null; - foreach( $custom_post_types as $cpt_key => $cpt ) { + foreach ( $custom_post_types as $cpt_key => $cpt ) { // Sanitize the data - foreach( $cpt as $key => $data ) { + foreach ( $cpt as $key => $data ) { if ( ! is_array( $data ) ) { $cpt[ $key ] = strip_tags( $data ); } @@ -662,9 +662,9 @@ public function validate_plugin_options_custom_post_types( $custom_post_types, $ // Maximum is 20 characters. Can only contain lowercase, alphanumeric characters and underscores $valid_name_preg_test = '/([^a-z0-9\_])/i'; - $original_name = ( isset( $cpt[ 'original_name' ] ) && ! empty( $cpt[ 'original_name' ] ) && strlen( $cpt[ 'original_name' ] ) <= 20 && ! preg_match( $valid_name_preg_test, $cpt[ 'original_name' ] ) ) ? strtolower( $cpt[ 'original_name' ] ) : NULL; - $new_name = ( isset( $cpt[ 'name' ] ) && ! empty( $cpt[ 'name' ] ) && strlen( $cpt[ 'name' ] ) <= 20 && ! preg_match( $valid_name_preg_test, $cpt[ 'name' ] ) ) ? strtolower( $cpt[ 'name' ] ) : NULL; - $label = ( isset( $cpt[ 'label' ] ) && ! empty( $cpt[ 'label' ] ) ) ? $cpt[ 'label' ] : NULL; + $original_name = ( isset( $cpt[ 'original_name' ] ) && ! empty( $cpt[ 'original_name' ] ) && strlen( $cpt[ 'original_name' ] ) <= 20 && ! preg_match( $valid_name_preg_test, $cpt[ 'original_name' ] ) ) ? strtolower( $cpt[ 'original_name' ] ) : null; + $new_name = ( isset( $cpt[ 'name' ] ) && ! empty( $cpt[ 'name' ] ) && strlen( $cpt[ 'name' ] ) <= 20 && ! preg_match( $valid_name_preg_test, $cpt[ 'name' ] ) ) ? strtolower( $cpt[ 'name' ] ) : null; + $label = ( isset( $cpt[ 'label' ] ) && ! empty( $cpt[ 'label' ] ) ) ? $cpt[ 'label' ] : null; // If no valid name or label, why bother so remove the data if ( empty( $original_name ) && empty( $new_name ) && empty( $label ) ) { @@ -690,7 +690,7 @@ public function validate_plugin_options_custom_post_types( $custom_post_types, $ } // Will be the name and key for storing data - $store_name = NULL; + $store_name = null; /** * If no original name (new) and new name is empty @@ -716,7 +716,7 @@ public function validate_plugin_options_custom_post_types( $custom_post_types, $ } // The name was empty so we made one up - else if ( empty( $new_name ) ) { + elseif ( empty( $new_name ) ) { add_settings_error( CPT_ONOMIES_OPTIONS_PAGE . '-custom-post-types', 'custom-post-type-onomies-custom-post-types-error', sprintf( __( 'You did not provide a "name" for your custom post type so %1$s just made one up. If "%2$s" doesn\'t work for you, then make sure you edit the name property below.', 'cpt-onomies' ), 'CPT-onomies', $store_name ), 'error' ); } @@ -734,13 +734,13 @@ public function validate_plugin_options_custom_post_types( $custom_post_types, $ } // If no new name and original name exists then save under original name - else if ( empty( $new_name ) && ! empty( $original_name ) ) { + elseif ( empty( $new_name ) && ! empty( $original_name ) ) { $store_name = $original_name; } // If both original and new name exist and new is different from original // BUT new name already exists elsewhere - else if ( ! empty( $original_name ) && ! empty( $new_name ) && $new_name != $original_name && array_key_exists( $new_name, $saved_custom_post_types ) ) { + elseif ( ! empty( $original_name ) && ! empty( $new_name ) && $new_name != $original_name && array_key_exists( $new_name, $saved_custom_post_types ) ) { // Store under original name $store_name = $original_name; @@ -755,7 +755,7 @@ public function validate_plugin_options_custom_post_types( $custom_post_types, $ * different from original then remove info with * original name and save under new name. */ - else if ( ! empty( $original_name ) && ! empty( $new_name ) && $new_name != $original_name ) { + elseif ( ! empty( $original_name ) && ! empty( $new_name ) && $new_name != $original_name ) { // Remove original name if ( array_key_exists( $original_name, $saved_custom_post_types ) ) { @@ -802,7 +802,7 @@ public function validate_plugin_options_custom_post_types( $custom_post_types, $ // Must be numeric if ( isset( $cpt[ 'menu_position' ] ) && ! empty( $cpt[ 'menu_position' ] ) && is_numeric( $cpt[ 'menu_position' ] ) ) { $cpt['menu_position'] = intval( $cpt['menu_position'] ); - } else if ( isset( $cpt[ 'menu_position' ] ) && ! empty( $cpt[ 'menu_position' ] ) ) { + } elseif ( isset( $cpt[ 'menu_position' ] ) && ! empty( $cpt[ 'menu_position' ] ) ) { unset( $cpt['menu_position'] ); } @@ -856,13 +856,13 @@ public function update_validate_plugin_options_other_custom_post_types( $other_c // Save information if ( ! empty( $other_custom_post_types ) ) { - foreach( $other_custom_post_types as $cpt_key => $cpt ) { + foreach ( $other_custom_post_types as $cpt_key => $cpt ) { $saved_other_post_types[ $cpt_key ] = $cpt; } } // Post types that no longer exist are removed from the settings - foreach( $saved_other_post_types as $cpt_key => $cpt ) { + foreach ( $saved_other_post_types as $cpt_key => $cpt ) { $post_type_exists = post_type_exists( $cpt_key ); if ( ! $post_type_exists || ( $post_type_exists && ( $cpt_onomies_manager->is_registered_cpt( $cpt_key ) ) ) ) { unset( $saved_other_post_types[ $cpt_key ] ); @@ -899,14 +899,14 @@ public function update_validate_plugin_options_other_custom_post_types( $other_c * * @since 1.0 * @uses $cpt_onomies_manager - * @param string $post_type_being_edited - the custom post type that's being edited. NULL if creating a new custom post type. + * @param string $post_type_being_edited - the custom post type that's being edited. null if creating a new custom post type. * @return object - the custom post type properties * @filters 'custom_post_type_onomies_attach_to_post_type_property_include_post_type' - $post_type_to_include, $post_type_being_edited * 'custom_post_type_onomies_taxonomies_property_include_taxonomy' - $taxonomy, $post_type_being_edited * 'custom_post_type_onomies_restrict_user_capabilities_property_include_user_role' - $user_role, $post_type_being_edited * 'custom_post_type_onomies_supports_property_include_support' - $support, $post_type_being_edited */ - public function get_plugin_options_page_cpt_properties( $post_type_being_edited = NULL ) { + public function get_plugin_options_page_cpt_properties( $post_type_being_edited = null ) { global $cpt_onomies_manager; if ( current_user_can( $this->manage_options_capability ) ) { @@ -919,7 +919,7 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited $saved_custom_post_type_data = $cpt_onomies_manager->user_settings['network_custom_post_types']; } - } else if ( isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) ) { + } elseif ( isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) ) { $saved_custom_post_type_data = $cpt_onomies_manager->user_settings['custom_post_types']; } @@ -936,7 +936,7 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited if ( $this->is_network_admin ) { // Combine saved custom post type data with remaining builtin post types (posts and pages) - foreach( array_merge( get_post_types( array( '_builtin' => true ), 'objects' ), $saved_custom_post_type_data ) as $cpt_key => $cpt ) { + foreach ( array_merge( get_post_types( array( '_builtin' => true ), 'objects' ), $saved_custom_post_type_data ) as $cpt_key => $cpt ) { $cpt = (object) $cpt; if ( ! empty( $cpt_key ) && ! in_array( $cpt_key, $do_not_add_to_post_type_data ) ) { @@ -946,10 +946,10 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited } // Make sure label exists - $label = NULL; + $label = null; if ( isset( $cpt->labels ) && isset( $cpt->labels->name ) && ! empty( $cpt->labels->name ) ) { $label = $cpt->labels->name; - } else if ( isset( $cpt->label ) && ! empty( $cpt->label ) ) { + } elseif ( isset( $cpt->label ) && ! empty( $cpt->label ) ) { $label = $cpt->label; } @@ -966,7 +966,7 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited } else { - foreach( get_post_types( array(), 'objects' ) as $cpt_key => $cpt ) { + foreach ( get_post_types( array(), 'objects' ) as $cpt_key => $cpt ) { if ( ! empty( $cpt_key ) && ! in_array( $cpt_key, $do_not_add_to_post_type_data ) && ! empty( $cpt->labels->name ) ) { $attach_to_post_type_data[ $cpt_key ] = (object) array( @@ -980,7 +980,7 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited } // Get deactivated post types created by plugin - foreach( $saved_custom_post_type_data as $cpt_key => $cpt ) { + foreach ( $saved_custom_post_type_data as $cpt_key => $cpt ) { if ( isset( $cpt[ 'deactivate' ] ) && $cpt[ 'deactivate' ] ) { if ( ! array_key_exists( $cpt_key, $attach_to_post_type_data ) ) { $attach_to_post_type_data[ $cpt_key ] = (object) array( @@ -996,12 +996,12 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited $stored_attach_to_post_type = array(); if ( isset( $saved_custom_post_type_data ) && array_key_exists( $post_type_being_edited, $saved_custom_post_type_data ) && isset( $saved_custom_post_type_data[ $post_type_being_edited ][ 'attach_to_post_type' ] ) ) { $stored_attach_to_post_type = $saved_custom_post_type_data[ $post_type_being_edited ]['attach_to_post_type']; - } else if ( ! $this->is_network_admin && isset( $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ] ) && array_key_exists( $post_type_being_edited, $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ] ) && isset( $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ][ $post_type_being_edited ][ 'attach_to_post_type' ] ) ) { + } elseif ( ! $this->is_network_admin && isset( $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ] ) && array_key_exists( $post_type_being_edited, $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ] ) && isset( $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ][ $post_type_being_edited ][ 'attach_to_post_type' ] ) ) { $stored_attach_to_post_type = $cpt_onomies_manager->user_settings['other_custom_post_types'][ $post_type_being_edited ]['attach_to_post_type']; } if ( ! empty( $stored_attach_to_post_type ) ) { - foreach( $stored_attach_to_post_type as $cpt_key ) { + foreach ( $stored_attach_to_post_type as $cpt_key ) { if ( ! array_key_exists( $cpt_key, $attach_to_post_type_data ) ) { $attach_to_post_type_data[ $cpt_key ] = (object) array( 'label' => sprintf( __( '%1$s %2$snot registered%3$s', 'cpt-onomies' ), "'" . $cpt_key . "'", '(', ')' ), @@ -1013,8 +1013,8 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited } // This filter allows you to remove particular post types from the list - foreach( $attach_to_post_type_data as $cpt_key => $cpt ) { - if ( ! apply_filters( 'custom_post_type_onomies_' . ( $this->is_network_admin ? 'network_admin_' : NULL ) . 'attach_to_post_type_property_include_post_type', true, $cpt_key, $post_type_being_edited ) ) { + foreach ( $attach_to_post_type_data as $cpt_key => $cpt ) { + if ( ! apply_filters( 'custom_post_type_onomies_' . ( $this->is_network_admin ? 'network_admin_' : null ) . 'attach_to_post_type_property_include_post_type', true, $cpt_key, $post_type_being_edited ) ) { unset( $attach_to_post_type_data[ $cpt_key ] ); } } @@ -1024,7 +1024,7 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited // Gather taxonomy data to use in properties $taxonomy_data = array(); - foreach( get_taxonomies( array(), 'objects' ) as $value => $tax ) { + foreach ( get_taxonomies( array(), 'objects' ) as $value => $tax ) { // Do not include link categories or nav menu stuff if ( ! empty( $value ) && apply_filters( 'custom_post_type_onomies_taxonomies_property_include_taxonomy', true, $value, $post_type_being_edited ) && ! in_array( $value, array( 'link_category', 'nav_menu' ) ) && ! $cpt_onomies_manager->is_registered_cpt_onomy( $value ) && ! empty( $tax->labels->name ) ) { @@ -1087,8 +1087,8 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited ), ); - foreach( $cpt_supports_data as $support => $support_info ) { - if ( ! apply_filters( 'custom_post_type_onomies_' . ( $this->is_network_admin ? 'network_admin_' : NULL ) . 'supports_property_include_support', true, $support, $post_type_being_edited ) ) { + foreach ( $cpt_supports_data as $support => $support_info ) { + if ( ! apply_filters( 'custom_post_type_onomies_' . ( $this->is_network_admin ? 'network_admin_' : null ) . 'supports_property_include_support', true, $support, $post_type_being_edited ) ) { unset( $cpt_supports_data[ $support ] ); } } @@ -1135,7 +1135,7 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited 'attach_to_post_type' => (object) array( 'label' => __( 'Attach to Post Types', 'cpt-onomies' ), 'type' => 'checkbox', - 'description' => sprintf( __( 'This setting allows you to use your custom post type in the same manner as a taxonomy, using your post titles as the terms. This is what we call a "%1$s". You can attach this %2$s to to any post type and assign posts just as you would assign taxonomy terms.', 'cpt-onomies' ), 'CPT-onomy', 'CPT-onomy' ) . ( $this->is_network_admin ? ' This will register the CPT-onomy on each individual site and not across the network.' : NULL ) . ' ' . sprintf( __( 'A post type must be checked in order to register this custom post type as a %s.', 'cpt-onomies' ), 'CPT-onomy' ) . '', + 'description' => sprintf( __( 'This setting allows you to use your custom post type in the same manner as a taxonomy, using your post titles as the terms. This is what we call a "%1$s". You can attach this %2$s to to any post type and assign posts just as you would assign taxonomy terms.', 'cpt-onomies' ), 'CPT-onomy', 'CPT-onomy' ) . ( $this->is_network_admin ? ' This will register the CPT-onomy on each individual site and not across the network.' : null ) . ' ' . sprintf( __( 'A post type must be checked in order to register this custom post type as a %s.', 'cpt-onomies' ), 'CPT-onomy' ) . '', 'data' => $attach_to_post_type_data ), 'meta_box_title' => (object) array( @@ -1189,10 +1189,10 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited 'message' => $this->is_network_admin ? array( 'dismiss' => 'restrict_user_capabilities_network_message', 'text' => '' . __( 'This setting is a little trickier in the network admin to allow for maximum customization.', 'cpt-onomies' ) . ' ' . sprintf( __( 'If you want to define user roles network wide, just enter the user roles separated by a comma: %1$s. If you want to define user roles for a specific site, prefix the user roles with the blog ID: %2$s. For multiple sites, separate each site definition with a semicolon: %3$s. To combine network and site definitions, simply separate with a semicolon: %4$s. In this scenario, the site definitions will not overwrite, but merge with, the network definition. If you would like the site definition to overwrite the network definition, add %5$s to the end of your site definition: %6$s.', 'cpt-onomies' ), 'administrator, editor', '2: administrator, editor', '2: administrator, editor; 3: administrator', 'administrator; 2: author, editor; 3: contributor', '":overwrite"', 'administrator; 2: author, editor: overwrite; 3: contributor' ) . $this->thickbox_network_sites - ) : NULL, - 'description' => sprintf( __( 'This setting allows you to grant specific user roles the capability, or permission, to assign term relationships for this %s.', 'cpt-onomies' ), 'CPT-onomy' ) . ( ( $this->is_network_admin ) ? ' ' . __( 'Visit the "Help" tab for instructions.', 'cpt-onomies' ) . '' : NULL ) . ' ' . __( 'If no user roles are defined, then all user roles will have permission.', 'cpt-onomies' ) . '', + ) : null, + 'description' => sprintf( __( 'This setting allows you to grant specific user roles the capability, or permission, to assign term relationships for this %s.', 'cpt-onomies' ), 'CPT-onomy' ) . ( ( $this->is_network_admin ) ? ' ' . __( 'Visit the "Help" tab for instructions.', 'cpt-onomies' ) . '' : null ) . ' ' . __( 'If no user roles are defined, then all user roles will have permission.', 'cpt-onomies' ) . '', 'default' => $this->is_network_admin ? 'administrator, editor, author' : array( 'administrator', 'editor', 'author' ), - 'data' => $this->is_network_admin ? NULL : $user_data + 'data' => $this->is_network_admin ? null : $user_data ), ), ), @@ -1305,9 +1305,9 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited 'message' => $this->is_network_admin ? array( 'dismiss' => 'taxonomies_network_message', 'text' => '' . __( 'This setting is a little trickier in the network admin to allow for maximum customization.', 'cpt-onomies' ) . ' ' . sprintf( __( 'If you want to define taxonomies network wide, just enter the taxonomy names separated by a comma: %1$s. If you want to define taxonomies for a specific site, prefix the taxonomy names with the blog ID: %2$s. For multiple sites, separate each site definition with a semicolon: %3$s. To combine network and site definitions, simply separate with a semicolon: %4$s. In this scenario, the site definitions will not overwrite, but merge with, the network definition. If you would like the site definition to overwrite the network definition, add %5$s to the end of your site definition: %6$s.', 'cpt-onomies' ), 'category, post_tag', '2: category, post_tag', '2: category, post_tag; 3: category', 'category; 2: post_tag; 3: post_format', '":overwrite"', 'category; 2: post_tag: overwrite; 3: post_tag, post_format' ) . $this->thickbox_network_sites - ) : NULL, - 'description' => sprintf( __( 'This setting allows you to add support for pre-existing, registered %s taxonomies.', 'cpt-onomies' ), 'non-CPT-onomy' ) . ( ( $this->is_network_admin ) ? ' ' . __( 'Visit the "Help" tab for instructions.', 'cpt-onomies' ) . '' : NULL ), - 'data' => $this->is_network_admin ? NULL : $taxonomy_data + ) : null, + 'description' => sprintf( __( 'This setting allows you to add support for pre-existing, registered %s taxonomies.', 'cpt-onomies' ), 'non-CPT-onomy' ) . ( ( $this->is_network_admin ) ? ' ' . __( 'Visit the "Help" tab for instructions.', 'cpt-onomies' ) . '' : null ), + 'data' => $this->is_network_admin ? null : $taxonomy_data ), 'show_ui' => (object) array( 'label' => __( 'Show UI', 'cpt-onomies' ), @@ -1536,7 +1536,7 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited $network_blogs = $this->get_network_sites(); $network_blogs_data = array(); - foreach( $network_blogs as $this_blog_id => $this_blog ) { + foreach ( $network_blogs as $this_blog_id => $this_blog ) { $network_blogs_data[ $this_blog_id ] = (object) array( 'label' => $this_blog->blogname, ); @@ -1568,7 +1568,7 @@ public function get_plugin_options_page_cpt_properties( $post_type_being_edited * @since 1.0 */ public function add_plugin_options_styles() { - wp_enqueue_style( 'custom-post-type-onomies-admin-options', plugins_url( 'assets/css/admin-options.min.css', __FILE__ ), array( 'thickbox' ), NULL ); + wp_enqueue_style( 'custom-post-type-onomies-admin-options', plugins_url( 'assets/css/admin-options.min.css', __FILE__ ), array( 'thickbox' ), null ); } /** @@ -1581,8 +1581,8 @@ public function add_plugin_options_styles() { public function add_plugin_options_scripts() { // Plugin scripts - wp_enqueue_script( 'custom-post-type-onomies-admin-options', plugins_url( 'assets/js/admin-options.min.js', __FILE__ ), array( 'jquery', 'thickbox' ), NULL, true ); - wp_enqueue_script( 'custom-post-type-onomies-admin-options-validate', plugins_url( 'assets/js/admin-options-validate.min.js', __FILE__ ), array( 'jquery', 'jquery-form-validation' ), NULL, true ); + wp_enqueue_script( 'custom-post-type-onomies-admin-options', plugins_url( 'assets/js/admin-options.min.js', __FILE__ ), array( 'jquery', 'thickbox' ), null, true ); + wp_enqueue_script( 'custom-post-type-onomies-admin-options-validate', plugins_url( 'assets/js/admin-options-validate.min.js', __FILE__ ), array( 'jquery', 'jquery-form-validation' ), null, true ); // Need this script for the metaboxes to work correctly wp_enqueue_script( 'post' ); @@ -1645,7 +1645,7 @@ public function add_plugin_options_help_tab() { return; } - } else if ( $screen->id != $this->options_page ) { + } elseif ( $screen->id != $this->options_page ) { return; } @@ -1911,7 +1911,7 @@ public function manage_plugin_options_actions() { } - } else if ( isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) && array_key_exists( $CPT, $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) ) { + } elseif ( isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) && array_key_exists( $CPT, $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) ) { // Remove the setting unset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ][ $CPT ][ 'deactivate' ] ); @@ -1933,7 +1933,7 @@ public function manage_plugin_options_actions() { } // Delete the CPT - } else if ( isset( $_REQUEST[ 'delete' ] ) ) { + } elseif ( isset( $_REQUEST[ 'delete' ] ) ) { $CPT = $_REQUEST[ 'delete' ]; @@ -1957,7 +1957,7 @@ public function manage_plugin_options_actions() { } - } else if ( isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) && array_key_exists( $CPT, $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) ) { + } elseif ( isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) && array_key_exists( $CPT, $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) ) { // Remove from settings unset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ][ $CPT ] ); @@ -1981,7 +1981,7 @@ public function manage_plugin_options_actions() { } // Delete "conflicting" taxonomy terms - else if ( isset( $_REQUEST[ 'delete_conflicting_terms' ] ) ) { + elseif ( isset( $_REQUEST[ 'delete_conflicting_terms' ] ) ) { // Which taxonomy's terms are we deleting? $taxonomy = $_REQUEST[ 'delete_conflicting_terms' ]; @@ -1998,7 +1998,7 @@ public function manage_plugin_options_actions() { } // Build the redirect URL - $redirect_url = add_query_arg( array( 'page' => CPT_ONOMIES_OPTIONS_PAGE, 'edit' => $taxonomy, 'other' => ( isset( $_REQUEST[ 'other' ] ) && $_REQUEST[ 'other' ] ? '1' : NULL ) ), $this->admin_url ); + $redirect_url = add_query_arg( array( 'page' => CPT_ONOMIES_OPTIONS_PAGE, 'edit' => $taxonomy, 'other' => ( isset( $_REQUEST[ 'other' ] ) && $_REQUEST[ 'other' ] ? '1' : null ) ), $this->admin_url ); if ( $delete_success ) { $redirect_url = add_query_arg( array( 'deleted_conflicting_terms' => '1' ), $redirect_url ); @@ -2145,7 +2145,7 @@ public function print_plugin_options_page() { // Create the properties tab $tabs[ 'properties' ] = (object) array( 'title' => __( 'Custom Post Type Properties', 'cpt-onomies' ), - 'link' => esc_url( add_query_arg( array( 'page' => CPT_ONOMIES_OPTIONS_PAGE, 'edit' => ( $new ? 'new' : $edit ), 'other' => ( $other ? '1' : NULL ) ), $this->admin_url ) ), + 'link' => esc_url( add_query_arg( array( 'page' => CPT_ONOMIES_OPTIONS_PAGE, 'edit' => ( $new ? 'new' : $edit ), 'other' => ( $other ? '1' : null ) ), $this->admin_url ) ), 'active' => true ); @@ -2176,7 +2176,7 @@ public function print_plugin_options_page() { if ( $new || $edit ) { // Define the label - $label = NULL; + $label = null; if ( $new ) { $label = __( 'Creating a New Custom Post Type', 'cpt-onomies' ); @@ -2194,7 +2194,7 @@ public function print_plugin_options_page() { if ( $other && ( $post_type_object_label = get_post_type_object( $cpt_key_to_check )->label ) ) { $label = $post_type_object_label; - } else if ( isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) && isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ][ $cpt_key_to_check ] ) && isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ][ $cpt_key_to_check ][ 'label' ] ) ) { + } elseif ( isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ] ) && isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ][ $cpt_key_to_check ] ) && isset( $cpt_onomies_manager->user_settings[ 'custom_post_types' ][ $cpt_key_to_check ][ 'label' ] ) ) { $label = $cpt_onomies_manager->user_settings['custom_post_types'][ $cpt_key_to_check ]['label']; } @@ -2213,7 +2213,7 @@ public function print_plugin_options_page() { } // Don't include tab name in URL, for now, considering there's only one tab - foreach( $tabs as $tab_key => $this_tab ) { + foreach ( $tabs as $tab_key => $this_tab ) { ?>title; ?>is_network_admin ) { if ( isset( $cpt_onomies_manager->user_settings[ 'network_custom_post_types' ] ) && array_key_exists( $activated_cpt, $cpt_onomies_manager->user_settings[ 'network_custom_post_types' ] ) && isset( $cpt_onomies_manager->user_settings[ 'network_custom_post_types' ][ $activated_cpt ][ 'label' ] ) ) { @@ -2265,10 +2265,10 @@ public function print_plugin_options_page() { } // Add "delete conflicting terms" error message - else if ( isset( $_REQUEST[ 'delete_conflicting_terms_error' ] ) ) { + elseif ( isset( $_REQUEST[ 'delete_conflicting_terms_error' ] ) ) { // Build the refresh URL - $refresh_url = add_query_arg( array( 'page' => CPT_ONOMIES_OPTIONS_PAGE, 'edit' => $edit, 'other' => ( $other ? '1' : NULL ) ), $this->admin_url ); + $refresh_url = add_query_arg( array( 'page' => CPT_ONOMIES_OPTIONS_PAGE, 'edit' => $edit, 'other' => ( $other ? '1' : null ) ), $this->admin_url ); // Build the message $message = sprintf( __( 'There seems to have been an error deleting the conflicting taxonomy terms. Please %1$srefresh the page%2$s and try again. If the problem persists, %3$sthe %4$s documentation%5$s might help.', 'cpt-onomies' ), '', '', '', 'CPT-onomies', '' ); @@ -2279,7 +2279,7 @@ public function print_plugin_options_page() { } // Add "deleted conflicting terms" message - else if ( isset( $_REQUEST[ 'deleted_conflicting_terms' ] ) ) { + elseif ( isset( $_REQUEST[ 'deleted_conflicting_terms' ] ) ) { $message = __( 'The conflicting taxonomy terms have been deleted!', 'cpt-onomies' ); } @@ -2395,7 +2395,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) { if ( current_user_can( $this->manage_options_capability ) ) { - switch( $metabox[ 'args' ] ) { + switch ( $metabox[ 'args' ] ) { // Add New CPT Meta Box case 'add_new_custom_post_type': @@ -2489,14 +2489,14 @@ public function print_plugin_options_meta_box( $post, $metabox ) { // Get the post type information $post_type_objects = get_post_types( array( '_builtin' => false ), 'objects' ); - foreach( $post_type_objects as $post_type => $CPT ) { + foreach ( $post_type_objects as $post_type => $CPT ) { if ( $cpt_onomies_manager->is_registered_cpt( $post_type ) ) { unset( $post_type_objects[ $post_type ] ); } // Gather the plugin settings - else if ( is_array( $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ] ) && array_key_exists( $post_type, $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ] ) ) { + elseif ( is_array( $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ] ) && array_key_exists( $post_type, $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ] ) ) { if ( isset( $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ][ $post_type ][ 'attach_to_post_type' ] ) && ! empty( $cpt_onomies_manager->user_settings[ 'other_custom_post_types' ][ $post_type ][ 'attach_to_post_type' ] ) ) { $post_type_objects[ $post_type ]->attach_to_post_type = $cpt_onomies_manager->user_settings['other_custom_post_types'][ $post_type ]['attach_to_post_type']; @@ -2558,7 +2558,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) { CPT_ONOMIES_OPTIONS_PAGE, 'edit' => $post_type, 'other' => ( $other ? '1' : NULL ) ), $this->admin_url ) );
+ $edit_url = esc_url( add_query_arg( array( 'page' => CPT_ONOMIES_OPTIONS_PAGE, 'edit' => $post_type, 'other' => ( $other ? '1' : null ) ), $this->admin_url ) );
// Activate url
$activate_url = esc_url( add_query_arg( array( 'page' => CPT_ONOMIES_OPTIONS_PAGE, 'activate' => $post_type, '_wpnonce' => wp_create_nonce( 'activate-cpt-' . $post_type ) ), $this->admin_url ), 'activate-cpt-' . $post_type );
@@ -2664,7 +2664,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) {
$delete_url = esc_url( add_query_arg( array( 'page' => CPT_ONOMIES_OPTIONS_PAGE, 'delete' => $post_type, '_wpnonce' => wp_create_nonce( 'delete-cpt-' . $post_type ) ), $this->admin_url ), 'delete-cpt-' . $post_type );
// View url
- $view_url = ! $this->is_network_admin ? esc_url( add_query_arg( array( 'post_type' => $post_type ), admin_url( 'edit.php' ) ) ) : NULL;
+ $view_url = ! $this->is_network_admin ? esc_url( add_query_arg( array( 'post_type' => $post_type ), admin_url( 'edit.php' ) ) ) : null;
?>label; ?>
@@ -2687,7 +2687,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) {
echo ' ';
}
- else if ( $overwrote_network_cpt ) {
+ elseif ( $overwrote_network_cpt ) {
echo ' ';
}
@@ -2704,9 +2704,9 @@ public function print_plugin_options_meta_box( $post, $metabox ) {
if ( $attention_cpt && $attention_cpt_onomy ) {
$td_registered_classes[] = 'attention';
- } else if ( $attention_cpt_onomy ) {
+ } elseif ( $attention_cpt_onomy ) {
$td_registered_classes[] = 'error';
- } else if ( $is_registered_cpt_onomy ) {
+ } elseif ( $is_registered_cpt_onomy ) {
$td_registered_classes[] = 'working';
}
@@ -2716,7 +2716,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) {
if ( $inactive_cpt ) {
echo sprintf( __( 'No, because this %s is inactive.', 'cpt-onomies' ), 'CPT' ) . '' . __( 'Activate this CPT', 'cpt-onomies' ) . ''; - } else if ( $attention_cpt ) { + } elseif ( $attention_cpt ) { echo sprintf( __( 'No, because this %s is not registered.', 'cpt-onomies' ), 'CPT' ) . ' '; } else { @@ -2731,14 +2731,14 @@ public function print_plugin_options_meta_box( $post, $metabox ) { } // This means this CPT-onomy is registered but not for ALL of its assigned custom post types - else if ( $is_registered_cpt_onomy && $attach_to_post_type_not_exist && count( $attach_to_post_type_not_exist ) != count( $CPT->attach_to_post_type ) ) { + elseif ( $is_registered_cpt_onomy && $attach_to_post_type_not_exist && count( $attach_to_post_type_not_exist ) != count( $CPT->attach_to_post_type ) ) { echo sprintf( __( 'Yes, but there is a post type conflict.', 'cpt-onomies' ), 'CPT-onomy' ) . ' '; } // If the CPT-onomy is registered... - else if ( $is_registered_cpt_onomy ) { + elseif ( $is_registered_cpt_onomy ) { // This means there might be a conflict with conflicting taxonomy terms if ( ! $this->is_network_admin @@ -2750,7 +2750,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) { } // This means the CPT-onomy was registered outside the plugin - else if ( $programmatic_cpt_onomy ) { + elseif ( $programmatic_cpt_onomy ) { _e( 'Yes', 'cpt-onomies' ); echo ' ' . sprintf( __( 'This %1$s is %2$sprogrammatically registered%3$s.', 'cpt-onomies' ), 'CPT-onomy', '', '' ) . ''; @@ -2771,12 +2771,12 @@ public function print_plugin_options_meta_box( $post, $metabox ) { } ?> is_network_admin ) {
if ( isset( $CPT->attach_to_post_type ) ) {
- foreach( $CPT->attach_to_post_type as $attached ) {
+ foreach ( $CPT->attach_to_post_type as $attached ) {
- $label = NULL;
+ $label = null;
if ( array_key_exists( $attached, $post_type_objects ) ) {
// Don't show deactivated post types
@@ -2788,7 +2788,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) {
$label = $post_type_objects[ $attached ]['label'];
}
- } else if ( array_key_exists( $attached, $builtin ) ) {
+ } elseif ( array_key_exists( $attached, $builtin ) ) {
if ( isset( $builtin[ $attached ]->label ) ) {
$label = $builtin[ $attached ]->label;
@@ -2809,7 +2809,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) {
if ( ( $tax = get_taxonomy( $post_type ) ) && isset( $tax->object_type ) ) {
- foreach( $tax->object_type as $attached ) {
+ foreach ( $tax->object_type as $attached ) {
if ( post_type_exists( $attached ) ) {
$text .= '' . get_post_type_object( $attached )->label . ' | '; @@ -2835,7 +2835,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) { ?> attach_to_post_type ) ) {
- foreach( $CPT->attach_to_post_type as $attached ) {
+ foreach ( $CPT->attach_to_post_type as $attached ) {
if ( ! post_type_exists( $attached ) ) {
$attach_to_post_type_not_exist[] = $attached;
}
@@ -2987,7 +2987,7 @@ public function print_plugin_options_meta_box( $post, $metabox ) {
?> | is_network_admin ) {
if ( $overwrote_network_cpt ) {
$information = __( 'This site-wide custom post type is overwriting a custom post type registered by your network admin.', 'cpt-onomies' );
- } else if ( $other ) {
+ } elseif ( $other ) {
$information = sprintf( __( 'This custom post type is probably setup in your theme, or another plugin, but you can still register it for use as a %s. You cannot, however, manage the actual custom post type. Sorry, but that\'s up to the plugin and/or theme.', 'cpt-onomies' ), 'CPT-onomy' );
}
}
// Print the header
- ?> >
+ ?> >
@@ -3029,19 +3029,19 @@ public function print_plugin_options_meta_box( $post, $metabox ) {
}
// Or if it needs attention...
- else if ( $attention_cpt || $attention_cpt_onomy || ( $is_registered_cpt_onomy && $attach_to_post_type_not_exist && count( $attach_to_post_type_not_exist ) != count( $CPT->attach_to_post_type ) ) || ( $is_registered_cpt_onomy && $programmatic_cpt_onomy ) ) {
+ elseif ( $attention_cpt || $attention_cpt_onomy || ( $is_registered_cpt_onomy && $attach_to_post_type_not_exist && count( $attach_to_post_type_not_exist ) != count( $CPT->attach_to_post_type ) ) || ( $is_registered_cpt_onomy && $programmatic_cpt_onomy ) ) {
$edit_message_class[] = ' attention';
}
- ?> |