@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public static function instantiate( $oProp, $oMsg ) { |
43 | 43 | |
44 | - if ( ! is_network_admin() ) { |
|
44 | + if ( !is_network_admin() ) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return self::$_oInstance; |
50 | 50 | } |
51 | 51 | |
52 | - self::$aClassNames[] = $oProp->sClassName; |
|
52 | + self::$aClassNames[ ] = $oProp->sClassName; |
|
53 | 53 | self::$_oInstance = new AdminPageFramework_PageLoadInfo_network_admin_page( $oProp, $oMsg ); |
54 | 54 | |
55 | 55 | return self::$_oInstance; |
@@ -32,7 +32,7 @@ |
||
32 | 32 | array( $this, '_replyToAddPostTypeQueryInEditPostLink' ), |
33 | 33 | 10, |
34 | 34 | 3 |
35 | - ); |
|
35 | + ); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * Sets up hooks and properties. |
22 | 22 | * |
23 | 23 | */ |
24 | - public function __construct( $oProp, $oMsg=null ) { |
|
24 | + public function __construct( $oProp, $oMsg = null ) { |
|
25 | 25 | |
26 | 26 | parent::__construct( $oProp, $oMsg ); |
27 | 27 | |
28 | 28 | // For post type posts listing table page ( edit.php ) |
29 | - if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == $this->oProp->sPostType ) { |
|
29 | + if ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] == $this->oProp->sPostType ) { |
|
30 | 30 | add_action( |
31 | 31 | 'get_edit_post_link', |
32 | 32 | array( $this, '_replyToAddPostTypeQueryInEditPostLink' ), |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ); |
60 | 60 | |
61 | 61 | // If the user explicitly sets an empty string to the label key, do not insert a link. |
62 | - if ( ! $_sLinkLabel ) { |
|
62 | + if ( !$_sLinkLabel ) { |
|
63 | 63 | return $aLinks; |
64 | 64 | } |
65 | 65 | |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | array_unshift( |
68 | 68 | $aLinks, |
69 | 69 | // "<a href='" . esc_url( "edit.php?post_type={$this->oProp->sPostType}" ) . "'>" |
70 | - '<a ' . $this->getAttributes( |
|
70 | + '<a '.$this->getAttributes( |
|
71 | 71 | array( |
72 | 72 | 'href' => esc_url( "edit.php?post_type={$this->oProp->sPostType}" ), |
73 | 73 | // 3.5.7+ Added for acceptance testing |
74 | 74 | 'class' => 'apf-plugin-title-action-link apf-admin-page', |
75 | 75 | ) |
76 | - ) . '>' |
|
76 | + ).'>' |
|
77 | 77 | . $_sLinkLabel |
78 | 78 | . "</a>" |
79 | 79 | ); |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | public function _replyToSetFooterInfo() { |
90 | 90 | |
91 | 91 | if ( |
92 | - ! $this->isPostDefinitionPage( $this->oProp->sPostType ) |
|
93 | - && ! $this->isPostListingPage( $this->oProp->sPostType ) |
|
94 | - && ! $this->isCustomTaxonomyPage( $this->oProp->sPostType ) |
|
92 | + !$this->isPostDefinitionPage( $this->oProp->sPostType ) |
|
93 | + && !$this->isPostListingPage( $this->oProp->sPostType ) |
|
94 | + && !$this->isCustomTaxonomyPage( $this->oProp->sPostType ) |
|
95 | 95 | ) { |
96 | 96 | return; |
97 | 97 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @remark e.g. `http://.../wp-admin/post.php?post=180&action=edit` -> `http://.../wp-admin/post.php?post=180&action=edit&post_type=[...]` |
110 | 110 | * @callback filter get_edit_post_link |
111 | 111 | */ |
112 | - public function _replyToAddPostTypeQueryInEditPostLink( $sURL, $iPostID=null, $sContext=null ) { |
|
112 | + public function _replyToAddPostTypeQueryInEditPostLink( $sURL, $iPostID = null, $sContext = null ) { |
|
113 | 113 | return add_query_arg( |
114 | 114 | array( |
115 | 115 | 'post' => $iPostID, |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function _replyToDetermineToLoadAdmin( /* $oScreen */ ) { |
45 | 45 | |
46 | - if ( ! $this->_isInThePage() ) { |
|
46 | + if ( !$this->_isInThePage() ) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | 50 | $this->_load( |
51 | 51 | array( |
52 | 52 | "load_{$this->oProp->sPostType}", |
53 | - "load_{$this->oProp->sClassName}", // 3.8.14+ |
|
53 | + "load_{$this->oProp->sClassName}", // 3.8.14+ |
|
54 | 54 | ) |
55 | 55 | ); |
56 | 56 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | protected function _isInThePage() { |
109 | 109 | |
110 | 110 | // If it's not in one of the post type's pages |
111 | - if ( ! $this->oProp->bIsAdmin ) { |
|
111 | + if ( !$this->oProp->bIsAdmin ) { |
|
112 | 112 | return false; |
113 | 113 | } |
114 | 114 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | return true; |
118 | 118 | } |
119 | 119 | |
120 | - if ( ! in_array( $this->oProp->sPageNow, array( 'edit.php', 'edit-tags.php', 'term.php', 'post.php', 'post-new.php' ) ) ) { |
|
120 | + if ( !in_array( $this->oProp->sPageNow, array( 'edit.php', 'edit-tags.php', 'term.php', 'post.php', 'post-new.php' ) ) ) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function _isValidAjaxReferrer() { |
140 | 140 | |
141 | - if ( ! $this->oProp->bIsAdminAjax ) { |
|
141 | + if ( !$this->oProp->bIsAdminAjax ) { |
|
142 | 142 | return false; |
143 | 143 | } |
144 | - if ( ! $this->oUtil->getElement( $this->oProp->aPostTypeArgs, 'public', true ) ) { |
|
144 | + if ( !$this->oUtil->getElement( $this->oProp->aPostTypeArgs, 'public', true ) ) { |
|
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | parse_str( $_aReferrer[ 'query' ], $_aQuery ); |
150 | 150 | |
151 | 151 | $_sBaseName = basename( $_aReferrer[ 'path' ] ); |
152 | - if ( ! in_array( $_sBaseName, array( 'edit.php', ) ) ) { |
|
152 | + if ( !in_array( $_sBaseName, array( 'edit.php',) ) ) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | return $this->oUtil->getElement( $_aQuery, array( 'post_type' ), '' ) === $this->oProp->sPostType; |
@@ -25,84 +25,83 @@ |
||
25 | 25 | protected $_sStructureType = 'post_type'; |
26 | 26 | |
27 | 27 | /** |
28 | - * The constructor of the class object. |
|
29 | - * |
|
30 | - * Registers necessary hooks and sets up internal properties. |
|
31 | - * |
|
32 | - * <h4>Example</h4> |
|
33 | - * <code>new APF_PostType( |
|
34 | - * 'apf_posts', // post type slug |
|
35 | - * array( |
|
36 | - * 'labels' => array( |
|
37 | - * 'name' => 'Demo', |
|
38 | - * 'all_items' => __( 'Sample Posts', 'admin-page-framework-demo' ), |
|
39 | - * 'singular_name' => 'Demo', |
|
40 | - * 'add_new' => __( 'Add New', 'admin-page-framework-demo' ), |
|
41 | - * 'add_new_item' => __( 'Add New APF Post', 'admin-page-framework-demo' ), |
|
42 | - * 'edit' => __( 'Edit', 'admin-page-framework-demo' ), |
|
43 | - * 'edit_item' => __( 'Edit APF Post', 'admin-page-framework-demo' ), |
|
44 | - * 'new_item' => __( 'New APF Post', 'admin-page-framework-demo' ), |
|
45 | - * 'view' => __( 'View', 'admin-page-framework-demo' ), |
|
46 | - * 'view_item' => __( 'View APF Post', 'admin-page-framework-demo' ), |
|
47 | - * 'search_items' => __( 'Search APF Post', 'admin-page-framework-demo' ), |
|
48 | - * 'not_found' => __( 'No APF Post found', 'admin-page-framework-demo' ), |
|
49 | - * 'not_found_in_trash' => __( 'No APF Post found in Trash', 'admin-page-framework-demo' ), |
|
50 | - * 'parent' => __( 'Parent APF Post', 'admin-page-framework-demo' ), |
|
51 | - * |
|
52 | - * // (framework specific) |
|
53 | - * 'plugin_action_link' => __( 'APF Posts', 'admin-page-framework-demo' ), // framework specific key. [3.7.3+] |
|
54 | - * ), |
|
55 | - * 'public' => true, |
|
56 | - * 'menu_position' => 110, |
|
57 | - * 'supports' => array( 'title' ), // e.g. array( 'title', 'editor', 'comments', 'thumbnail', 'excerpt' ), |
|
58 | - * 'taxonomies' => array( '' ), |
|
59 | - * 'has_archive' => true, |
|
60 | - * 'show_admin_column' => true, // [3.5+ core] this is for custom taxonomies to automatically add the column in the listing table. |
|
61 | - * 'menu_icon' => $this->oProp->bIsAdmin |
|
62 | - * ? ( |
|
63 | - * version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) |
|
64 | - * ? 'dashicons-wordpress' |
|
65 | - * : plugins_url( 'asset/image/wp-logo_16x16.png', APFDEMO_FILE ) |
|
66 | - * ) |
|
67 | - * : null, // do not call the function in the front-end. |
|
68 | - * |
|
69 | - * // (framework specific) this sets the screen icon for the post type for WordPress v3.7.1 or below. |
|
70 | - * // a file path can be passed instead of a url, plugins_url( 'asset/image/wp-logo_32x32.png', APFDEMO_FILE ) |
|
71 | - * 'screen_icon' => dirname( APFDEMO_FILE ) . '/asset/image/wp-logo_32x32.png', |
|
72 | - * |
|
73 | - * // [3.5.10+] (framework specific) default: true |
|
74 | - * 'show_submenu_add_new' => true, |
|
75 | - * |
|
76 | - * // [3.7.4+] (framework specific) default: 10 |
|
77 | - * 'submenu_order_manage' => 20, |
|
78 | - * 'submenu_order_addnew' => 21, |
|
79 | - * |
|
80 | - * ) |
|
81 | - * );</code> |
|
82 | - * |
|
83 | - * <h4>Framework Specific Post Type Arguments</h4> |
|
84 | - * In addition to the post type argument structure defined by the WordPress core, there are arguments defined by the framework. |
|
85 | - * |
|
86 | - * - screen_icon - For WordPress 3.7.x or below, set an icon url or path for the 32x32 screen icon displayed in the post listing page. |
|
87 | - * - show_submenu_add_new - [3.5.10+] (boolean) Whether the sub-menu item of `Add New` should be displayed. |
|
88 | - * - submenu_order_manage - [3.7.4+] (numeric) The menu position of the `Manage` sub-menu item which gets automatically crated by the system when the admin ui is enabled. Default: `5` |
|
89 | - * - submenu_order_addnew - [3.7.4+] (numeric) The menu position of the `Manage` sub-menu item which gets automatically crated by the system when the admin ui is enabled. Default: `10` |
|
90 | - * |
|
91 | - * <h4>Framework Specific Post Type Label Arguments</h4> |
|
92 | - * - plugin_listing_table_title_cell_link' - [3.0.6+] Deprecated [3.7.3] use the `plugin_action_link` argument instead. |
|
93 | - * - plugin_action_link' - [3.7.3+] If the caller script is a plugin, this determines the label of the action link embedded in the plugin listing page (plugins.php). |
|
94 | - * To disable the action link, set an empty string `''`. |
|
95 | - |
|
96 | - * |
|
97 | - * @since 2.0.0 |
|
98 | - * @since 2.1.6 Added the $sTextDomain parameter. |
|
99 | - * @see http://codex.wordpress.org/Function_Reference/register_post_type#Arguments |
|
100 | - * @param string The post type slug. |
|
101 | - * @param array The <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Arguments">argument array</a> passed to register_post_type(). |
|
102 | - * @param string The path of the caller script. This is used to retrieve the script information to insert it into the footer. If not set, the framework tries to detect it. |
|
103 | - * @param string The text domain of the caller script. |
|
104 | - * @return void |
|
105 | - */ |
|
28 | + * The constructor of the class object. |
|
29 | + * |
|
30 | + * Registers necessary hooks and sets up internal properties. |
|
31 | + * |
|
32 | + * <h4>Example</h4> |
|
33 | + * <code>new APF_PostType( |
|
34 | + * 'apf_posts', // post type slug |
|
35 | + * array( |
|
36 | + * 'labels' => array( |
|
37 | + * 'name' => 'Demo', |
|
38 | + * 'all_items' => __( 'Sample Posts', 'admin-page-framework-demo' ), |
|
39 | + * 'singular_name' => 'Demo', |
|
40 | + * 'add_new' => __( 'Add New', 'admin-page-framework-demo' ), |
|
41 | + * 'add_new_item' => __( 'Add New APF Post', 'admin-page-framework-demo' ), |
|
42 | + * 'edit' => __( 'Edit', 'admin-page-framework-demo' ), |
|
43 | + * 'edit_item' => __( 'Edit APF Post', 'admin-page-framework-demo' ), |
|
44 | + * 'new_item' => __( 'New APF Post', 'admin-page-framework-demo' ), |
|
45 | + * 'view' => __( 'View', 'admin-page-framework-demo' ), |
|
46 | + * 'view_item' => __( 'View APF Post', 'admin-page-framework-demo' ), |
|
47 | + * 'search_items' => __( 'Search APF Post', 'admin-page-framework-demo' ), |
|
48 | + * 'not_found' => __( 'No APF Post found', 'admin-page-framework-demo' ), |
|
49 | + * 'not_found_in_trash' => __( 'No APF Post found in Trash', 'admin-page-framework-demo' ), |
|
50 | + * 'parent' => __( 'Parent APF Post', 'admin-page-framework-demo' ), |
|
51 | + * |
|
52 | + * // (framework specific) |
|
53 | + * 'plugin_action_link' => __( 'APF Posts', 'admin-page-framework-demo' ), // framework specific key. [3.7.3+] |
|
54 | + * ), |
|
55 | + * 'public' => true, |
|
56 | + * 'menu_position' => 110, |
|
57 | + * 'supports' => array( 'title' ), // e.g. array( 'title', 'editor', 'comments', 'thumbnail', 'excerpt' ), |
|
58 | + * 'taxonomies' => array( '' ), |
|
59 | + * 'has_archive' => true, |
|
60 | + * 'show_admin_column' => true, // [3.5+ core] this is for custom taxonomies to automatically add the column in the listing table. |
|
61 | + * 'menu_icon' => $this->oProp->bIsAdmin |
|
62 | + * ? ( |
|
63 | + * version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) |
|
64 | + * ? 'dashicons-wordpress' |
|
65 | + * : plugins_url( 'asset/image/wp-logo_16x16.png', APFDEMO_FILE ) |
|
66 | + * ) |
|
67 | + * : null, // do not call the function in the front-end. |
|
68 | + * |
|
69 | + * // (framework specific) this sets the screen icon for the post type for WordPress v3.7.1 or below. |
|
70 | + * // a file path can be passed instead of a url, plugins_url( 'asset/image/wp-logo_32x32.png', APFDEMO_FILE ) |
|
71 | + * 'screen_icon' => dirname( APFDEMO_FILE ) . '/asset/image/wp-logo_32x32.png', |
|
72 | + * |
|
73 | + * // [3.5.10+] (framework specific) default: true |
|
74 | + * 'show_submenu_add_new' => true, |
|
75 | + * |
|
76 | + * // [3.7.4+] (framework specific) default: 10 |
|
77 | + * 'submenu_order_manage' => 20, |
|
78 | + * 'submenu_order_addnew' => 21, |
|
79 | + * |
|
80 | + * ) |
|
81 | + * );</code> |
|
82 | + * |
|
83 | + * <h4>Framework Specific Post Type Arguments</h4> |
|
84 | + * In addition to the post type argument structure defined by the WordPress core, there are arguments defined by the framework. |
|
85 | + * |
|
86 | + * - screen_icon - For WordPress 3.7.x or below, set an icon url or path for the 32x32 screen icon displayed in the post listing page. |
|
87 | + * - show_submenu_add_new - [3.5.10+] (boolean) Whether the sub-menu item of `Add New` should be displayed. |
|
88 | + * - submenu_order_manage - [3.7.4+] (numeric) The menu position of the `Manage` sub-menu item which gets automatically crated by the system when the admin ui is enabled. Default: `5` |
|
89 | + * - submenu_order_addnew - [3.7.4+] (numeric) The menu position of the `Manage` sub-menu item which gets automatically crated by the system when the admin ui is enabled. Default: `10` |
|
90 | + * |
|
91 | + * <h4>Framework Specific Post Type Label Arguments</h4> |
|
92 | + * - plugin_listing_table_title_cell_link' - [3.0.6+] Deprecated [3.7.3] use the `plugin_action_link` argument instead. |
|
93 | + * - plugin_action_link' - [3.7.3+] If the caller script is a plugin, this determines the label of the action link embedded in the plugin listing page (plugins.php). |
|
94 | + * To disable the action link, set an empty string `''`. |
|
95 | + * |
|
96 | + * @since 2.0.0 |
|
97 | + * @since 2.1.6 Added the $sTextDomain parameter. |
|
98 | + * @see http://codex.wordpress.org/Function_Reference/register_post_type#Arguments |
|
99 | + * @param string The post type slug. |
|
100 | + * @param array The <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Arguments">argument array</a> passed to register_post_type(). |
|
101 | + * @param string The path of the caller script. This is used to retrieve the script information to insert it into the footer. If not set, the framework tries to detect it. |
|
102 | + * @param string The text domain of the caller script. |
|
103 | + * @return void |
|
104 | + */ |
|
106 | 105 | public function __construct( $sPostType, $aArguments=array(), $sCallerPath=null, $sTextDomain='admin-page-framework' ) { |
107 | 106 | |
108 | 107 | if ( empty( $sPostType ) ) { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param string The text domain of the caller script. |
104 | 104 | * @return void |
105 | 105 | */ |
106 | - public function __construct( $sPostType, $aArguments=array(), $sCallerPath=null, $sTextDomain='admin-page-framework' ) { |
|
106 | + public function __construct( $sPostType, $aArguments = array(), $sCallerPath = null, $sTextDomain = 'admin-page-framework' ) { |
|
107 | 107 | |
108 | 108 | if ( empty( $sPostType ) ) { |
109 | 109 | return; |
@@ -111,16 +111,16 @@ discard block |
||
111 | 111 | |
112 | 112 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
113 | 113 | ? $this->aSubClassNames[ 'oProp' ] |
114 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
114 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
115 | 115 | $this->oProp = new $_sPropertyClassName( |
116 | 116 | $this, |
117 | 117 | $this->_getCallerScriptPath( $sCallerPath ), |
118 | - get_class( $this ), // class name |
|
119 | - 'publish_posts', // capability |
|
120 | - $sTextDomain, // text domain |
|
118 | + get_class( $this ), // class name |
|
119 | + 'publish_posts', // capability |
|
120 | + $sTextDomain, // text domain |
|
121 | 121 | $this->_sStructureType // structure type |
122 | 122 | ); |
123 | - $this->oProp->sPostType = AdminPageFramework_WPUtility::sanitizeSlug( $sPostType ); |
|
123 | + $this->oProp->sPostType = AdminPageFramework_WPUtility::sanitizeSlug( $sPostType ); |
|
124 | 124 | |
125 | 125 | // Post type argument array structure |
126 | 126 | // @see http://codex.wordpress.org/Function_Reference/register_post_type#Arguments |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | return $sCallerPath; |
144 | 144 | } |
145 | 145 | |
146 | - if ( ! is_admin() ) { |
|
146 | + if ( !is_admin() ) { |
|
147 | 147 | return null; |
148 | 148 | } |
149 | 149 | $_sPageNow = AdminPageFramework_Utility::getElement( $GLOBALS, 'pagenow' ); |
@@ -19,37 +19,37 @@ discard block |
||
19 | 19 | abstract class AdminPageFramework_PostType_Controller extends AdminPageFramework_PostType_View { |
20 | 20 | |
21 | 21 | /** |
22 | - * The method for necessary set-ups. |
|
23 | - * |
|
24 | - * <h4>Example</h4> |
|
25 | - * <code>public function setUp() { |
|
26 | - * $this->setAutoSave( false ); |
|
27 | - * $this->setAuthorTableFilter( true ); |
|
28 | - * $this->addTaxonomy( |
|
29 | - * 'sample_taxonomy', // taxonomy slug |
|
30 | - * array( // argument - for the argument array keys, refer to : http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
31 | - * 'labels' => array( |
|
32 | - * 'name' => 'Genre', |
|
33 | - * 'add_new_item' => 'Add New Genre', |
|
34 | - * 'new_item_name' => "New Genre" |
|
35 | - * ), |
|
36 | - * 'show_ui' => true, |
|
37 | - * 'show_tagcloud' => false, |
|
38 | - * 'hierarchical' => true, |
|
39 | - * 'show_admin_column' => true, |
|
40 | - * 'show_in_nav_menus' => true, |
|
41 | - * 'show_table_filter' => true, // framework specific key |
|
42 | - * 'show_in_sidebar_menus' => false, // framework specific key |
|
43 | - * ) |
|
44 | - * ); |
|
45 | - * }</code> |
|
46 | - * |
|
47 | - * @abstract |
|
48 | - * @since 2.0.0 |
|
49 | - * @remark The user should override this method in their class definition. |
|
50 | - * @remark A callback for the `wp_loaded` hook. |
|
51 | - * @callback action init |
|
52 | - */ |
|
22 | + * The method for necessary set-ups. |
|
23 | + * |
|
24 | + * <h4>Example</h4> |
|
25 | + * <code>public function setUp() { |
|
26 | + * $this->setAutoSave( false ); |
|
27 | + * $this->setAuthorTableFilter( true ); |
|
28 | + * $this->addTaxonomy( |
|
29 | + * 'sample_taxonomy', // taxonomy slug |
|
30 | + * array( // argument - for the argument array keys, refer to : http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
31 | + * 'labels' => array( |
|
32 | + * 'name' => 'Genre', |
|
33 | + * 'add_new_item' => 'Add New Genre', |
|
34 | + * 'new_item_name' => "New Genre" |
|
35 | + * ), |
|
36 | + * 'show_ui' => true, |
|
37 | + * 'show_tagcloud' => false, |
|
38 | + * 'hierarchical' => true, |
|
39 | + * 'show_admin_column' => true, |
|
40 | + * 'show_in_nav_menus' => true, |
|
41 | + * 'show_table_filter' => true, // framework specific key |
|
42 | + * 'show_in_sidebar_menus' => false, // framework specific key |
|
43 | + * ) |
|
44 | + * ); |
|
45 | + * }</code> |
|
46 | + * |
|
47 | + * @abstract |
|
48 | + * @since 2.0.0 |
|
49 | + * @remark The user should override this method in their class definition. |
|
50 | + * @remark A callback for the `wp_loaded` hook. |
|
51 | + * @callback action init |
|
52 | + */ |
|
53 | 53 | public function setUp() {} |
54 | 54 | |
55 | 55 | /** |
@@ -115,49 +115,49 @@ discard block |
||
115 | 115 | * Front-end methods |
116 | 116 | */ |
117 | 117 | /** |
118 | - * Enables or disables the auto-save feature in the custom post type's post submission page. |
|
119 | - * |
|
120 | - * <h4>Example</h4> |
|
121 | - * <code>$this->setAutoSave( false ); |
|
122 | - * </code> |
|
123 | - * |
|
124 | - * @since 2.0.0 |
|
125 | - * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
|
126 | - * return void |
|
127 | - */ |
|
118 | + * Enables or disables the auto-save feature in the custom post type's post submission page. |
|
119 | + * |
|
120 | + * <h4>Example</h4> |
|
121 | + * <code>$this->setAutoSave( false ); |
|
122 | + * </code> |
|
123 | + * |
|
124 | + * @since 2.0.0 |
|
125 | + * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
|
126 | + * return void |
|
127 | + */ |
|
128 | 128 | protected function setAutoSave( $bEnableAutoSave=True ) { |
129 | 129 | $this->oProp->bEnableAutoSave = $bEnableAutoSave; |
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
133 | - * Adds a custom taxonomy to the class post type. |
|
134 | - * <h4>Example</h4> |
|
135 | - * <code>$this->addTaxonomy( |
|
136 | - * 'sample_taxonomy', // taxonomy slug |
|
137 | - * array( // argument |
|
138 | - * 'labels' => array( |
|
139 | - * 'name' => 'Genre', |
|
140 | - * 'add_new_item' => 'Add New Genre', |
|
141 | - * 'new_item_name' => "New Genre" |
|
142 | - * ), |
|
143 | - * 'show_ui' => true, |
|
144 | - * 'show_tagcloud' => false, |
|
145 | - * 'hierarchical' => true, |
|
146 | - * 'show_admin_column' => true, |
|
147 | - * 'show_in_nav_menus' => true, |
|
148 | - * 'show_table_filter' => true, // framework specific key |
|
149 | - * 'show_in_sidebar_menus' => false, // framework specific key |
|
150 | - * ) |
|
151 | - * );</code> |
|
152 | - * |
|
153 | - * @see http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
154 | - * @since 2.0.0 |
|
155 | - * @since 3.1.1 Added the third parameter. |
|
156 | - * @param string $sTaxonomySlug The taxonomy slug. |
|
157 | - * @param array $aArguments The taxonomy argument array passed to the second parameter of the <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments">register_taxonomy()</a> function. |
|
158 | - * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
|
159 | - * @return void |
|
160 | - */ |
|
133 | + * Adds a custom taxonomy to the class post type. |
|
134 | + * <h4>Example</h4> |
|
135 | + * <code>$this->addTaxonomy( |
|
136 | + * 'sample_taxonomy', // taxonomy slug |
|
137 | + * array( // argument |
|
138 | + * 'labels' => array( |
|
139 | + * 'name' => 'Genre', |
|
140 | + * 'add_new_item' => 'Add New Genre', |
|
141 | + * 'new_item_name' => "New Genre" |
|
142 | + * ), |
|
143 | + * 'show_ui' => true, |
|
144 | + * 'show_tagcloud' => false, |
|
145 | + * 'hierarchical' => true, |
|
146 | + * 'show_admin_column' => true, |
|
147 | + * 'show_in_nav_menus' => true, |
|
148 | + * 'show_table_filter' => true, // framework specific key |
|
149 | + * 'show_in_sidebar_menus' => false, // framework specific key |
|
150 | + * ) |
|
151 | + * );</code> |
|
152 | + * |
|
153 | + * @see http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
154 | + * @since 2.0.0 |
|
155 | + * @since 3.1.1 Added the third parameter. |
|
156 | + * @param string $sTaxonomySlug The taxonomy slug. |
|
157 | + * @param array $aArguments The taxonomy argument array passed to the second parameter of the <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments">register_taxonomy()</a> function. |
|
158 | + * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
|
159 | + * @return void |
|
160 | + */ |
|
161 | 161 | protected function addTaxonomy( $sTaxonomySlug, array $aArguments, array $aAdditionalObjectTypes=array() ) { |
162 | 162 | |
163 | 163 | $sTaxonomySlug = $this->oUtil->sanitizeSlug( $sTaxonomySlug ); |
@@ -219,16 +219,16 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
222 | - * Sets whether the author drop-down filter is enabled/disabled in the post type post list table. |
|
223 | - * |
|
224 | - * <h4>Example</h4> |
|
225 | - * <code>$this->setAuthorTableFilter( true ); |
|
226 | - * </code> |
|
227 | - * |
|
228 | - * @since 2.0.0 |
|
229 | - * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
|
230 | - * @return void |
|
231 | - */ |
|
222 | + * Sets whether the author drop-down filter is enabled/disabled in the post type post list table. |
|
223 | + * |
|
224 | + * <h4>Example</h4> |
|
225 | + * <code>$this->setAuthorTableFilter( true ); |
|
226 | + * </code> |
|
227 | + * |
|
228 | + * @since 2.0.0 |
|
229 | + * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
|
230 | + * @return void |
|
231 | + */ |
|
232 | 232 | protected function setAuthorTableFilter( $bEnableAuthorTableFileter=false ) { |
233 | 233 | $this->oProp->bEnableAuthorTableFileter = $bEnableAuthorTableFileter; |
234 | 234 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @since 3.0.0 |
71 | 71 | * @return array An array holding the handle IDs of queued items. |
72 | 72 | */ |
73 | - public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
73 | + public function enqueueStyles( $aSRCs, $aCustomArgs = array() ) { |
|
74 | 74 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
75 | 75 | return $this->oResource->_enqueueStyles( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
76 | 76 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * {@inheritdoc} |
82 | 82 | * |
83 | 83 | */ |
84 | - public function enqueueStyle( $sSRC, $aCustomArgs=array() ) { |
|
84 | + public function enqueueStyle( $sSRC, $aCustomArgs = array() ) { |
|
85 | 85 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
86 | 86 | return $this->oResource->_enqueueStyle( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
87 | 87 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return array An array holding the handle IDs of queued items. |
95 | 95 | */ |
96 | - public function enqueueScripts( $aSRCs, $aCustomArgs=array() ) { |
|
96 | + public function enqueueScripts( $aSRCs, $aCustomArgs = array() ) { |
|
97 | 97 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
98 | 98 | return $this->oResource->_enqueueScripts( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
99 | 99 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 3.0.0 |
107 | 107 | */ |
108 | - public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
108 | + public function enqueueScript( $sSRC, $aCustomArgs = array() ) { |
|
109 | 109 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
110 | 110 | return $this->oResource->_enqueueScript( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
111 | 111 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
126 | 126 | * return void |
127 | 127 | */ |
128 | - protected function setAutoSave( $bEnableAutoSave=True ) { |
|
128 | + protected function setAutoSave( $bEnableAutoSave = True ) { |
|
129 | 129 | $this->oProp->bEnableAutoSave = $bEnableAutoSave; |
130 | 130 | } |
131 | 131 | |
@@ -158,20 +158,20 @@ discard block |
||
158 | 158 | * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
159 | 159 | * @return void |
160 | 160 | */ |
161 | - protected function addTaxonomy( $sTaxonomySlug, array $aArguments, array $aAdditionalObjectTypes=array() ) { |
|
161 | + protected function addTaxonomy( $sTaxonomySlug, array $aArguments, array $aAdditionalObjectTypes = array() ) { |
|
162 | 162 | |
163 | 163 | $sTaxonomySlug = $this->oUtil->sanitizeSlug( $sTaxonomySlug ); |
164 | 164 | $aArguments = $aArguments + array( |
165 | 165 | 'show_table_filter' => null, |
166 | 166 | 'show_in_sidebar_menus' => null, |
167 | - 'submenu_order' => 15, // 3.7.4 |
|
168 | - ) ; |
|
167 | + 'submenu_order' => 15, // 3.7.4 |
|
168 | + ); |
|
169 | 169 | $this->oProp->aTaxonomies[ $sTaxonomySlug ] = $aArguments; |
170 | 170 | |
171 | 171 | if ( $aArguments[ 'show_table_filter' ] ) { |
172 | - $this->oProp->aTaxonomyTableFilters[] = $sTaxonomySlug; |
|
172 | + $this->oProp->aTaxonomyTableFilters[ ] = $sTaxonomySlug; |
|
173 | 173 | } |
174 | - if ( ! $aArguments[ 'show_in_sidebar_menus' ] ) { |
|
174 | + if ( !$aArguments[ 'show_in_sidebar_menus' ] ) { |
|
175 | 175 | // @todo investigate the best handling method of taxonomy sub-menu items of a custom post type added to another custom post type menu with the `show_in_menu` argument. |
176 | 176 | $this->oProp->aTaxonomyRemoveSubmenuPages[ "edit-tags.php?taxonomy={$sTaxonomySlug}&post_type={$this->oProp->sPostType}" ] = "edit.php?post_type={$this->oProp->sPostType}"; |
177 | 177 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
230 | 230 | * @return void |
231 | 231 | */ |
232 | - protected function setAuthorTableFilter( $bEnableAuthorTableFileter=false ) { |
|
232 | + protected function setAuthorTableFilter( $bEnableAuthorTableFileter = false ) { |
|
233 | 233 | $this->oProp->bEnableAuthorTableFileter = $bEnableAuthorTableFileter; |
234 | 234 | } |
235 | 235 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @since 3.2.0 |
256 | 256 | * @return void |
257 | 257 | */ |
258 | - protected function setArguments( array $aArguments=array() ) { |
|
258 | + protected function setArguments( array $aArguments = array() ) { |
|
259 | 259 | $this->oProp->aPostTypeArgs = $aArguments; |
260 | 260 | } |
261 | 261 |
@@ -73,7 +73,7 @@ |
||
73 | 73 | 'title' => 'Title', // Post title. Includes "edit", "quick edit", "trash" and "view" links. If $mode (set from $_REQUEST['mode']) is 'excerpt', a post excerpt is included between the title and links. |
74 | 74 | 'author' => 'Author', // Post author. |
75 | 75 | 'comments' => '<div class="comment-grey-bubble"></div>', // Number of pending comments. |
76 | - 'date' => 'Date', // The date and publish status of the post. |
|
76 | + 'date' => 'Date', // The date and publish status of the post. |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | if ( $this->oProp->bIsAdmin ) { |
39 | 39 | |
40 | - add_action( 'load_' . $this->oProp->sPostType, array( $this, '_replyToSetUpHooksForModel' ) ); |
|
40 | + add_action( 'load_'.$this->oProp->sPostType, array( $this, '_replyToSetUpHooksForModel' ) ); |
|
41 | 41 | |
42 | 42 | if ( $this->oProp->sCallerPath ) { |
43 | 43 | new AdminPageFramework_PostType_Model__FlushRewriteRules( $this ); |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | |
65 | 65 | // Properties - sets translatable labels. |
66 | 66 | $this->oProp->aColumnHeaders = array( |
67 | - 'cb' => '<input type="checkbox" />', // Checkbox for bulk actions. |
|
68 | - 'title' => $this->oMsg->get( 'title' ), // Post title. Includes "edit", "quick edit", "trash" and "view" links. If $mode (set from $_REQUEST['mode']) is 'excerpt', a post excerpt is included between the title and links. |
|
69 | - 'author' => $this->oMsg->get( 'author' ), // Post author. |
|
67 | + 'cb' => '<input type="checkbox" />', // Checkbox for bulk actions. |
|
68 | + 'title' => $this->oMsg->get( 'title' ), // Post title. Includes "edit", "quick edit", "trash" and "view" links. If $mode (set from $_REQUEST['mode']) is 'excerpt', a post excerpt is included between the title and links. |
|
69 | + 'author' => $this->oMsg->get( 'author' ), // Post author. |
|
70 | 70 | 'comments' => '<div class="comment-grey-bubble"></div>', // Number of pending comments. |
71 | - 'date' => $this->oMsg->get( 'date' ), // The date and publish status of the post. |
|
71 | + 'date' => $this->oMsg->get( 'date' ), // The date and publish status of the post. |
|
72 | 72 | ); |
73 | 73 | |
74 | 74 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | echo $this->oUtil->addAndApplyFilter( |
131 | 131 | $this, |
132 | 132 | "cell_{$this->oProp->sPostType}_{$sColumnKey}", |
133 | - '', // value to be filtered - cell output |
|
133 | + '', // value to be filtered - cell output |
|
134 | 134 | $iPostID |
135 | 135 | ); |
136 | 136 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @internal |
180 | 180 | */ |
181 | 181 | public function _replyToRegisterTaxonomies() { |
182 | - foreach( $this->oProp->aTaxonomies as $_sTaxonomySlug => $_aArguments ) { |
|
182 | + foreach ( $this->oProp->aTaxonomies as $_sTaxonomySlug => $_aArguments ) { |
|
183 | 183 | $this->_registerTaxonomy( |
184 | 184 | $_sTaxonomySlug, |
185 | 185 | $this->oUtil->getAsArray( $this->oProp->aTaxonomyObjectTypes[ $_sTaxonomySlug ] ), // object types |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function _registerTaxonomy( $sTaxonomySlug, array $aObjectTypes, array $aArguments ) { |
197 | 197 | |
198 | - if ( ! in_array( $this->oProp->sPostType, $aObjectTypes ) ) { |
|
199 | - $aObjectTypes[] = $this->oProp->sPostType; |
|
198 | + if ( !in_array( $this->oProp->sPostType, $aObjectTypes ) ) { |
|
199 | + $aObjectTypes[ ] = $this->oProp->sPostType; |
|
200 | 200 | } |
201 | 201 | register_taxonomy( |
202 | 202 | $sTaxonomySlug, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function _replyToRemoveTexonomySubmenuPages() { |
236 | 236 | |
237 | - foreach( $this->oProp->aTaxonomyRemoveSubmenuPages as $sSubmenuPageSlug => $sTopLevelPageSlug ) { |
|
237 | + foreach ( $this->oProp->aTaxonomyRemoveSubmenuPages as $sSubmenuPageSlug => $sTopLevelPageSlug ) { |
|
238 | 238 | |
239 | 239 | remove_submenu_page( $sTopLevelPageSlug, $sSubmenuPageSlug ); |
240 | 240 |
@@ -63,21 +63,21 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function _replyToSaveFieldValues( $iUserID ) { |
65 | 65 | |
66 | - if ( ! current_user_can( 'edit_user', $iUserID ) ) { |
|
66 | + if ( !current_user_can( 'edit_user', $iUserID ) ) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Extract the fields data from $_POST |
71 | 71 | // Retrieve the submitted data. |
72 | - $_aInputs = $this->oForm->getSubmittedData( |
|
73 | - $_POST, // subject data to be parsed |
|
74 | - true, // extract data with the fieldset structure |
|
72 | + $_aInputs = $this->oForm->getSubmittedData( |
|
73 | + $_POST, // subject data to be parsed |
|
74 | + true, // extract data with the fieldset structure |
|
75 | 75 | false // strip slashes |
76 | 76 | ); |
77 | - $_aInputsRaw = $_aInputs; // store one for the last input array. |
|
77 | + $_aInputsRaw = $_aInputs; // store one for the last input array. |
|
78 | 78 | |
79 | 79 | // Prepare the saved data. For a new post, the id is set to 0. |
80 | - $_aSavedMeta = $this->oUtil->getSavedUserMetaArray( $iUserID, array_keys( $_aInputs ) ); |
|
80 | + $_aSavedMeta = $this->oUtil->getSavedUserMetaArray( $iUserID, array_keys( $_aInputs ) ); |
|
81 | 81 | |
82 | 82 | // Apply filters to the array of the submitted values. |
83 | 83 | $_aInputs = $this->oUtil->addAndApplyFilters( |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | $this->oForm->updateMetaDataByType( |
100 | - $iUserID, // object id |
|
101 | - $_aInputs, // user submit form data |
|
100 | + $iUserID, // object id |
|
101 | + $_aInputs, // user submit form data |
|
102 | 102 | $this->oForm->dropRepeatableElements( $_aSavedMeta ), // Drop repeatable section elements from the saved meta array. |
103 | 103 | $this->oForm->sStructureType // fields type |
104 | 104 | ); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @since 3.5.0 |
67 | 67 | */ |
68 | - public function enqueueStyles( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
68 | + public function enqueueStyles( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
69 | 69 | return $this->oResource->_enqueueStyles( $aSRCs, $aPostTypes, $aCustomArgs ); |
70 | 70 | } |
71 | 71 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param array (optional) The argument array for more advanced parameters. |
89 | 89 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
90 | 90 | */ |
91 | - public function enqueueStyle( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
91 | + public function enqueueStyle( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
92 | 92 | return $this->oResource->_enqueueStyle( $sSRC, $aPostTypes, $aCustomArgs ); |
93 | 93 | } |
94 | 94 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @since 3.5.0 |
98 | 98 | */ |
99 | - public function enqueueScripts( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
99 | + public function enqueueScripts( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
100 | 100 | return $this->oResource->_enqueueScripts( $aSRCs, $aPostTypes, $aCustomArgs ); |
101 | 101 | } |
102 | 102 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param array (optional) The argument array for more advanced parameters. |
132 | 132 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
133 | 133 | */ |
134 | - public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
134 | + public function enqueueScript( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
135 | 135 | return $this->oResource->_enqueueScript( $sSRC, $aPostTypes, $aCustomArgs ); |
136 | 136 | } |
137 | 137 |