@@ -54,9 +54,9 @@ |
||
54 | 54 | * @param string $sTextDomain (optional) The text domain applied to the displayed text messages. Default: `admin-page-framework`. |
55 | 55 | * @return void |
56 | 56 | */ |
57 | - function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID=array( 'post' ), $sContext='normal', $sPriority='default', $sCapability='edit_posts', $sTextDomain='admin-page-framework' ) { |
|
57 | + function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID = array( 'post' ), $sContext = 'normal', $sPriority = 'default', $sCapability = 'edit_posts', $sTextDomain = 'admin-page-framework' ) { |
|
58 | 58 | |
59 | - if ( ! $this->_isInstantiatable() ) { return; } |
|
59 | + if ( !$this->_isInstantiatable() ) { return; } |
|
60 | 60 | |
61 | 61 | /* The property object needs to be done first */ |
62 | 62 | $this->oProp = new AdminPageFramework_Property_MetaBox( $this, get_class( $this ), $sCapability, $sTextDomain, self::$_sStructureType ); |
@@ -18,32 +18,32 @@ |
||
18 | 18 | abstract class AdminPageFramework_MetaBox_Controller extends AdminPageFramework_MetaBox_View { |
19 | 19 | |
20 | 20 | /** |
21 | - * The method for all necessary set-ups. |
|
22 | - * |
|
23 | - * <h4>Example</h4> |
|
24 | - * <code> public function setUp() { |
|
25 | - * $this->addSettingFields( |
|
26 | - * array( |
|
27 | - * 'field_id' => 'sample_metabox_text_field', |
|
28 | - * 'title' => 'Text Input', |
|
29 | - * 'description' => 'The description for the field.', |
|
30 | - * 'type' => 'text', |
|
31 | - * ), |
|
32 | - * array( |
|
33 | - * 'field_id' => 'sample_metabox_textarea_field', |
|
34 | - * 'title' => 'Textarea', |
|
35 | - * 'description' => 'The description for the field.', |
|
36 | - * 'type' => 'textarea', |
|
37 | - * 'default' => 'This is a default text value.', |
|
38 | - * ) |
|
39 | - * ); |
|
40 | - * }</code> |
|
41 | - * |
|
42 | - * @abstract |
|
43 | - * @since 2.0.0 |
|
44 | - * @remark The user should override this method. |
|
45 | - * @return void |
|
46 | - */ |
|
21 | + * The method for all necessary set-ups. |
|
22 | + * |
|
23 | + * <h4>Example</h4> |
|
24 | + * <code> public function setUp() { |
|
25 | + * $this->addSettingFields( |
|
26 | + * array( |
|
27 | + * 'field_id' => 'sample_metabox_text_field', |
|
28 | + * 'title' => 'Text Input', |
|
29 | + * 'description' => 'The description for the field.', |
|
30 | + * 'type' => 'text', |
|
31 | + * ), |
|
32 | + * array( |
|
33 | + * 'field_id' => 'sample_metabox_textarea_field', |
|
34 | + * 'title' => 'Textarea', |
|
35 | + * 'description' => 'The description for the field.', |
|
36 | + * 'type' => 'textarea', |
|
37 | + * 'default' => 'This is a default text value.', |
|
38 | + * ) |
|
39 | + * ); |
|
40 | + * }</code> |
|
41 | + * |
|
42 | + * @abstract |
|
43 | + * @since 2.0.0 |
|
44 | + * @remark The user should override this method. |
|
45 | + * @return void |
|
46 | + */ |
|
47 | 47 | public function setUp() {} |
48 | 48 | |
49 | 49 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @since 3.5.0 |
68 | 68 | */ |
69 | - public function enqueueStyles( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
69 | + public function enqueueStyles( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
70 | 70 | return $this->oResource->_enqueueStyles( $aSRCs, $aPostTypes, $aCustomArgs ); |
71 | 71 | } |
72 | 72 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @param array (optional) The argument array for more advanced parameters. |
90 | 90 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
91 | 91 | */ |
92 | - public function enqueueStyle( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
92 | + public function enqueueStyle( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
93 | 93 | return $this->oResource->_enqueueStyle( $sSRC, $aPostTypes, $aCustomArgs ); |
94 | 94 | } |
95 | 95 | /** |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @since 3.5.0 |
99 | 99 | */ |
100 | - public function enqueueScripts( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
100 | + public function enqueueScripts( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
101 | 101 | return $this->oResource->_enqueueScripts( $aSRCs, $aPostTypes, $aCustomArgs ); |
102 | 102 | } |
103 | 103 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param array (optional) The argument array for more advanced parameters. |
133 | 133 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
134 | 134 | */ |
135 | - public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
135 | + public function enqueueScript( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
136 | 136 | return $this->oResource->_enqueueScript( $sSRC, $aPostTypes, $aCustomArgs ); |
137 | 137 | } |
138 | 138 |
@@ -132,7 +132,7 @@ |
||
132 | 132 | * @param array (optional) The argument array for more advanced parameters. |
133 | 133 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
134 | 134 | */ |
135 | - public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
135 | + public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
136 | 136 | return $this->oResource->_enqueueScript( $sSRC, $aPostTypes, $aCustomArgs ); |
137 | 137 | } |
138 | 138 |
@@ -136,11 +136,11 @@ |
||
136 | 136 | * |
137 | 137 | * Triggered when a post has not been created so no post id is assigned. |
138 | 138 | * |
139 | - * @internal |
|
139 | + * @internal |
|
140 | 140 | * @since 3.3.0 |
141 | 141 | * @callback filter wp_insert_attachment_data |
142 | 142 | * @callback filter wp_insert_post_data |
143 | - * @param array $aPostData An array of slashed post data. |
|
143 | + * @param array $aPostData An array of slashed post data. |
|
144 | 144 | * @param array $aUnmodified An array of sanitized, but otherwise unmodified post data. |
145 | 145 | */ |
146 | 146 | public function _replyToFilterSavingData( $aPostData, $aUnmodified ) { |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function _replyToAddMetaBox() { |
68 | 68 | |
69 | - foreach( $this->oProp->aPostTypes as $sPostType ) { |
|
69 | + foreach ( $this->oProp->aPostTypes as $sPostType ) { |
|
70 | 70 | add_meta_box( |
71 | - $this->oProp->sMetaBoxID, // id |
|
72 | - $this->oProp->sTitle, // title |
|
71 | + $this->oProp->sMetaBoxID, // id |
|
72 | + $this->oProp->sTitle, // title |
|
73 | 73 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
74 | - $sPostType, // post type |
|
75 | - $this->oProp->sContext, // context |
|
76 | - $this->oProp->sPriority, // priority |
|
74 | + $sPostType, // post type |
|
75 | + $this->oProp->sContext, // context |
|
76 | + $this->oProp->sPriority, // priority |
|
77 | 77 | null // argument - deprecated $this->oForm->aFields |
78 | 78 | ); |
79 | 79 | } |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function _registerFormElements( $oScreen ) { |
92 | 92 | |
93 | - if ( ! $this->oUtil->isPostDefinitionPage( $this->oProp->aPostTypes ) ) { |
|
93 | + if ( !$this->oUtil->isPostDefinitionPage( $this->oProp->aPostTypes ) ) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | - $this->_loadFieldTypeDefinitions(); // defined in the factory class. |
|
97 | + $this->_loadFieldTypeDefinitions(); // defined in the factory class. |
|
98 | 98 | |
99 | 99 | // Format the fields array. |
100 | 100 | $this->oForm->format(); |
@@ -119,18 +119,18 @@ discard block |
||
119 | 119 | * @since 3.4.1 |
120 | 120 | * @internal |
121 | 121 | */ |
122 | - private function _getPostID() { |
|
122 | + private function _getPostID() { |
|
123 | 123 | |
124 | 124 | // for an editing post page. |
125 | - if ( isset( $GLOBALS['post']->ID ) ) { |
|
126 | - return $GLOBALS['post']->ID; |
|
125 | + if ( isset( $GLOBALS[ 'post' ]->ID ) ) { |
|
126 | + return $GLOBALS[ 'post' ]->ID; |
|
127 | 127 | } |
128 | - if ( isset( $_GET['post'] ) ) { |
|
129 | - return $_GET['post']; |
|
128 | + if ( isset( $_GET[ 'post' ] ) ) { |
|
129 | + return $_GET[ 'post' ]; |
|
130 | 130 | } |
131 | 131 | // for post.php without any query key-values. |
132 | - if ( isset( $_POST['post_ID'] ) ) { |
|
133 | - return $_POST['post_ID']; |
|
132 | + if ( isset( $_POST[ 'post_ID' ] ) ) { |
|
133 | + return $_POST[ 'post_ID' ]; |
|
134 | 134 | } |
135 | 135 | return null; |
136 | 136 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | protected function _setOptionArray( $iPostID, array $aFields ) { |
167 | 167 | |
168 | - if ( ! $this->oUtil->isNumericInteger( $iPostID ) ) { |
|
168 | + if ( !$this->oUtil->isNumericInteger( $iPostID ) ) { |
|
169 | 169 | return; |
170 | 170 | } |
171 | 171 | |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | // Apply the filter to let third party scripts to set own options array. |
180 | 180 | $this->oProp->aOptions = $this->oUtil->addAndApplyFilter( |
181 | 181 | $this, // the caller object |
182 | - 'options_' . $this->oProp->sClassName, |
|
182 | + 'options_'.$this->oProp->sClassName, |
|
183 | 183 | $this->oProp->aOptions |
184 | 184 | ); |
185 | 185 | |
186 | - $_aLastInput = isset( $_GET['field_errors'] ) && $_GET['field_errors'] |
|
186 | + $_aLastInput = isset( $_GET[ 'field_errors' ] ) && $_GET[ 'field_errors' ] |
|
187 | 187 | ? $this->oProp->aLastInput |
188 | 188 | : array(); |
189 | 189 | $this->oProp->aOptions = $_aLastInput + $this->oUtil->getAsArray( $this->oProp->aOptions ); |
@@ -203,21 +203,21 @@ discard block |
||
203 | 203 | $_aMetaKeys = $this->oUtil->getAsArray( |
204 | 204 | get_post_custom_keys( $iPostID ) // returns array or null |
205 | 205 | ); |
206 | - foreach( $aFields as $_sSectionID => $_aFields ) { |
|
206 | + foreach ( $aFields as $_sSectionID => $_aFields ) { |
|
207 | 207 | |
208 | - if ( '_default' == $_sSectionID ) { |
|
209 | - foreach( $_aFields as $_aField ) { |
|
210 | - if ( ! in_array( $_aField[ 'field_id' ], $_aMetaKeys ) ) { |
|
208 | + if ( '_default' == $_sSectionID ) { |
|
209 | + foreach ( $_aFields as $_aField ) { |
|
210 | + if ( !in_array( $_aField[ 'field_id' ], $_aMetaKeys ) ) { |
|
211 | 211 | continue; |
212 | 212 | } |
213 | - $aOptions[ $_aField['field_id'] ] = get_post_meta( |
|
213 | + $aOptions[ $_aField[ 'field_id' ] ] = get_post_meta( |
|
214 | 214 | $iPostID, |
215 | 215 | $_aField[ 'field_id' ], |
216 | 216 | true |
217 | 217 | ); |
218 | 218 | } |
219 | 219 | } |
220 | - if ( ! in_array( $_sSectionID, $_aMetaKeys ) ) { |
|
220 | + if ( !in_array( $_sSectionID, $_aMetaKeys ) ) { |
|
221 | 221 | continue; |
222 | 222 | } |
223 | 223 | $aOptions[ $_sSectionID ] = get_post_meta( |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | return $this->oUtil->addAndApplyFilters( |
242 | 242 | $this, |
243 | - array( 'section_head_' . $this->oProp->sClassName . '_' . $aSection['section_id'] ), // section_ + {extended class name} + _ {section id} |
|
243 | + array( 'section_head_'.$this->oProp->sClassName.'_'.$aSection[ 'section_id' ] ), // section_ + {extended class name} + _ {section id} |
|
244 | 244 | $sSectionDescription |
245 | 245 | ); |
246 | 246 | |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | public function _replyToFilterSavingData( $aPostData, $aUnmodified ) { |
262 | 262 | |
263 | 263 | // Perform initial checks. |
264 | - if ( ! $this->_validateCall( $aUnmodified ) ) { |
|
264 | + if ( !$this->_validateCall( $aUnmodified ) ) { |
|
265 | 265 | return $aPostData; |
266 | 266 | } |
267 | 267 | |
268 | 268 | // Retrieve the submitted data. |
269 | 269 | $_aInput = $this->oForm->getUserSubmitDataFromPOST( $this->oForm->aConditionedFields, $this->oForm->aConditionedSections ); |
270 | - $_aInput = $this->_getSortedInputs( $_aInput ); // 3.6.0+ |
|
270 | + $_aInput = $this->_getSortedInputs( $_aInput ); // 3.6.0+ |
|
271 | 271 | $_aInputRaw = $_aInput; // store one for the last input array. |
272 | 272 | |
273 | 273 | // Prepare the saved data. For a new post, the id is set to 0. |
@@ -291,13 +291,13 @@ discard block |
||
291 | 291 | // If there are validation errors. Change the post status to 'pending'. |
292 | 292 | if ( $this->hasFieldError() ) { |
293 | 293 | $this->_setLastInput( $_aInputRaw ); |
294 | - $aPostData['post_status'] = 'pending'; |
|
294 | + $aPostData[ 'post_status' ] = 'pending'; |
|
295 | 295 | add_filter( 'redirect_post_location', array( $this, '_replyToModifyRedirectPostLocation' ) ); |
296 | 296 | } |
297 | 297 | |
298 | 298 | $this->oForm->updateMetaDataByType( |
299 | - $_iPostID, // object id |
|
300 | - $_aInput, // user submit form data |
|
299 | + $_iPostID, // object id |
|
300 | + $_aInput, // user submit form data |
|
301 | 301 | $this->oForm->dropRepeatableElements( $_aSavedMeta ), // Drop repeatable section elements from the saved meta array. |
302 | 302 | $this->oForm->sFieldsType // fields type |
303 | 303 | ); |
@@ -344,14 +344,14 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | // If our nonce isn't there, or we can't verify it, bail |
347 | - if ( ! isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { |
|
347 | + if ( !isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { |
|
348 | 348 | return false; |
349 | 349 | } |
350 | - if ( ! wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { |
|
350 | + if ( !wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { |
|
351 | 351 | return false; |
352 | 352 | } |
353 | 353 | |
354 | - if ( ! in_array( $aUnmodified[ 'post_type' ], $this->oProp->aPostTypes ) ) { |
|
354 | + if ( !in_array( $aUnmodified[ 'post_type' ], $this->oProp->aPostTypes ) ) { |
|
355 | 355 | return false; |
356 | 356 | } |
357 | 357 |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function _registerFormElements( $oScreen ) { |
92 | 92 | |
93 | - if ( ! $this->oUtil->isPostDefinitionPage( $this->oProp->aPostTypes ) ) { |
|
93 | + if ( ! $this->oUtil->isPostDefinitionPage( $this->oProp->aPostTypes ) ) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @since 3.4.1 |
120 | 120 | * @internal |
121 | 121 | */ |
122 | - private function _getPostID() { |
|
122 | + private function _getPostID() { |
|
123 | 123 | |
124 | 124 | // for an editing post page. |
125 | 125 | if ( isset( $GLOBALS['post']->ID ) ) { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | public function _replyToFilterSavingData( $aPostData, $aUnmodified ) { |
262 | 262 | |
263 | 263 | // Perform initial checks. |
264 | - if ( ! $this->_validateCall( $aUnmodified ) ) { |
|
264 | + if ( ! $this->_validateCall( $aUnmodified ) ) { |
|
265 | 265 | return $aPostData; |
266 | 266 | } |
267 | 267 | |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | */ |
335 | 335 | private function _validateCall( array $aUnmodified ) { |
336 | 336 | |
337 | - if ( 'auto-draft' === $aUnmodified[ 'post_status' ] ) { |
|
337 | + if ( 'auto-draft' === $aUnmodified[ 'post_status' ] ) { |
|
338 | 338 | return false; |
339 | 339 | } |
340 | 340 | |
341 | 341 | // Bail if we're doing an auto save |
342 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
342 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
343 | 343 | return false; |
344 | 344 | } |
345 | 345 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | * @return void |
28 | 28 | * @internal |
29 | 29 | */ |
30 | - public function _replyToPrintMetaBoxContents( $oPost, $vArgs ) { |
|
30 | + public function _replyToPrintMetaBoxContents( $oPost, $vArgs ) { |
|
31 | 31 | |
32 | 32 | // Use nonce for verification |
33 | 33 | $_aOutput = array(); |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | |
32 | 32 | // Use nonce for verification |
33 | 33 | $_aOutput = array(); |
34 | - $_aOutput[] = wp_nonce_field( $this->oProp->sMetaBoxID, $this->oProp->sMetaBoxID, true, false ); |
|
34 | + $_aOutput[ ] = wp_nonce_field( $this->oProp->sMetaBoxID, $this->oProp->sMetaBoxID, true, false ); |
|
35 | 35 | |
36 | 36 | // Get the fields output. |
37 | - $_oFieldsTable = new AdminPageFramework_FormPart_Table( |
|
37 | + $_oFieldsTable = new AdminPageFramework_FormPart_Table( |
|
38 | 38 | $this->oProp->aFieldTypeDefinitions, |
39 | 39 | $this->_getFieldErrors(), |
40 | 40 | $this->oMsg |
41 | 41 | ); |
42 | 42 | |
43 | - $_aOutput[] = $_oFieldsTable->getFormTables( |
|
43 | + $_aOutput[ ] = $_oFieldsTable->getFormTables( |
|
44 | 44 | $this->oForm->aConditionedSections, |
45 | 45 | $this->oForm->aConditionedFields, |
46 | 46 | array( $this, '_replyToGetSectionHeaderOutput' ), |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | ); |
49 | 49 | |
50 | 50 | // Do actions |
51 | - $this->oUtil->addAndDoActions( $this, 'do_' . $this->oProp->sClassName, $this ); |
|
51 | + $this->oUtil->addAndDoActions( $this, 'do_'.$this->oProp->sClassName, $this ); |
|
52 | 52 | |
53 | 53 | // Render the filtered output. |
54 | 54 | echo $this->oUtil->addAndApplyFilters( |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | protected $_aBuiltInRootMenuSlugs = array( |
31 | 31 | // All keys must be lower case to support case insensitive look-ups. |
32 | 32 | 'dashboard' => 'index.php', |
33 | - 'sites' => 'sites.php', // not work |
|
34 | - 'themes' => 'themes.php', // not work |
|
33 | + 'sites' => 'sites.php', // not work |
|
34 | + 'themes' => 'themes.php', // not work |
|
35 | 35 | 'plugins' => 'plugins.php', |
36 | 36 | 'users' => 'users.php', |
37 | 37 | 'settings' => 'settings.php', |
38 | - 'updates' => 'update-core.php', // does not work |
|
38 | + 'updates' => 'update-core.php', // does not work |
|
39 | 39 | ); |
40 | 40 | |
41 | 41 | /** |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @param string $sTextDomain (optional) the <a href="http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains" target="_blank">text domain</a> used for the framework's system messages. Default: `admin-page-framework`. |
56 | 56 | * @return void returns nothing. |
57 | 57 | */ |
58 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_network', $sTextDomain='admin-page-framework' ){ |
|
58 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_network', $sTextDomain = 'admin-page-framework' ) { |
|
59 | 59 | |
60 | - if ( ! $this->_isInstantiatable() ) { |
|
60 | + if ( !$this->_isInstantiatable() ) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | $sCallerPath = $sCallerPath |
67 | 67 | ? $sCallerPath |
68 | - : AdminPageFramework_Utility::getCallerScriptPath( __FILE__ ); // this is important to attempt to find the caller script path here when separating the library into multiple files. |
|
68 | + : AdminPageFramework_Utility::getCallerScriptPath( __FILE__ ); // this is important to attempt to find the caller script path here when separating the library into multiple files. |
|
69 | 69 | |
70 | 70 | $this->oProp = new AdminPageFramework_Property_NetworkAdmin( $this, $sCallerPath, get_class( $this ), $sOptionKey, $sCapability, $sTextDomain ); |
71 | 71 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | protected function _isInstantiatable() { |
83 | 83 | |
84 | - if ( isset( $GLOBALS['pagenow'] ) && 'admin-ajax.php' === $GLOBALS['pagenow'] ) { |
|
84 | + if ( isset( $GLOBALS[ 'pagenow' ] ) && 'admin-ajax.php' === $GLOBALS[ 'pagenow' ] ) { |
|
85 | 85 | return false; |
86 | 86 | } |
87 | 87 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
126 | 126 | * @return mixed If the field ID is not specified. |
127 | 127 | */ |
128 | - static public function getOption( $sOptionKey, $asKey=null , $vDefault=null ) { |
|
128 | + static public function getOption( $sOptionKey, $asKey = null, $vDefault = null ) { |
|
129 | 129 | return AdminPageFramework_WPUtility::getSiteOption( $sOptionKey, $asKey, $vDefault ); |
130 | 130 | } |
131 | 131 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | * @param string $sTextDomain (optional) the <a href="http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains" target="_blank">text domain</a> used for the framework's system messages. Default: `admin-page-framework`. |
56 | 56 | * @return void returns nothing. |
57 | 57 | */ |
58 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_network', $sTextDomain='admin-page-framework' ){ |
|
58 | + public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_network', $sTextDomain='admin-page-framework' ) { |
|
59 | 59 | |
60 | 60 | if ( ! $this->_isInstantiatable() ) { |
61 | 61 | return; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @package AdminPageFramework |
16 | 16 | * @subpackage PostType |
17 | 17 | */ |
18 | -abstract class AdminPageFramework_PostType extends AdminPageFramework_PostType_Controller { |
|
18 | +abstract class AdminPageFramework_PostType extends AdminPageFramework_PostType_Controller { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * The constructor of the class object. |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function __construct( $sPostType, $aArguments=array(), $sCallerPath=null, $sTextDomain='admin-page-framework' ) { |
93 | 93 | |
94 | - if ( empty( $sPostType ) ) { |
|
94 | + if ( empty( $sPostType ) ) { |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | - * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
7 | - * |
|
8 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | + * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Provides methods for registering custom post types. |
@@ -18,77 +18,75 @@ discard block |
||
18 | 18 | abstract class AdminPageFramework_PostType extends AdminPageFramework_PostType_Controller { |
19 | 19 | |
20 | 20 | /** |
21 | - * The constructor of the class object. |
|
22 | - * |
|
23 | - * Registers necessary hooks and sets up internal properties. |
|
24 | - * |
|
25 | - * <h4>Example</h4> |
|
26 | - * <code>new APF_PostType( |
|
27 | - * 'apf_posts', // post type slug |
|
28 | - * array( |
|
29 | - * 'labels' => array( |
|
30 | - * 'name' => 'Demo', |
|
31 | - * 'all_items' => __( 'Sample Posts', 'admin-page-framework-demo' ), |
|
32 | - * 'singular_name' => 'Demo', |
|
33 | - * 'add_new' => __( 'Add New', 'admin-page-framework-demo' ), |
|
34 | - * 'add_new_item' => __( 'Add New APF Post', 'admin-page-framework-demo' ), |
|
35 | - * 'edit' => __( 'Edit', 'admin-page-framework-demo' ), |
|
36 | - * 'edit_item' => __( 'Edit APF Post', 'admin-page-framework-demo' ), |
|
37 | - * 'new_item' => __( 'New APF Post', 'admin-page-framework-demo' ), |
|
38 | - * 'view' => __( 'View', 'admin-page-framework-demo' ), |
|
39 | - * 'view_item' => __( 'View APF Post', 'admin-page-framework-demo' ), |
|
40 | - * 'search_items' => __( 'Search APF Post', 'admin-page-framework-demo' ), |
|
41 | - * 'not_found' => __( 'No APF Post found', 'admin-page-framework-demo' ), |
|
42 | - * 'not_found_in_trash' => __( 'No APF Post found in Trash', 'admin-page-framework-demo' ), |
|
43 | - * 'parent' => __( 'Parent APF Post', 'admin-page-framework-demo' ), |
|
44 | - * |
|
45 | - * // (framework specific) |
|
46 | - * 'plugin_listing_table_title_cell_link' => __( 'APF Posts', 'admin-page-framework-demo' ), // framework specific key. [3.0.6+] |
|
47 | - * ), |
|
48 | - * 'public' => true, |
|
49 | - * 'menu_position' => 110, |
|
50 | - * 'supports' => array( 'title' ), // e.g. array( 'title', 'editor', 'comments', 'thumbnail', 'excerpt' ), |
|
51 | - * 'taxonomies' => array( '' ), |
|
52 | - * 'has_archive' => true, |
|
53 | - * 'show_admin_column' => true, // [3.5+ core] this is for custom taxonomies to automatically add the column in the listing table. |
|
54 | - * 'menu_icon' => $this->oProp->bIsAdmin |
|
55 | - * ? ( |
|
56 | - * version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) |
|
57 | - * ? 'dashicons-wordpress' |
|
58 | - * : plugins_url( 'asset/image/wp-logo_16x16.png', APFDEMO_FILE ) |
|
59 | - * ) |
|
60 | - * : null, // do not call the function in the front-end. |
|
61 | - * |
|
62 | - * // (framework specific) this sets the screen icon for the post type for WordPress v3.7.1 or below. |
|
63 | - * // a file path can be passed instead of a url, plugins_url( 'asset/image/wp-logo_32x32.png', APFDEMO_FILE ) |
|
64 | - * 'screen_icon' => dirname( APFDEMO_FILE ) . '/asset/image/wp-logo_32x32.png', |
|
65 | - * |
|
66 | - * // [3.5.10+] (framework specific) default: true |
|
67 | - * 'show_submenu_add_new' => true, |
|
68 | - * |
|
69 | - * ) |
|
70 | - * );</code> |
|
71 | - * |
|
72 | - * <h4>Framework Specific Post Type Arguments</h4> |
|
73 | - * In addition to the post type argument structure defined by the WordPress core, there are arguments defined by the framework. |
|
74 | - * |
|
75 | - * - 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. |
|
76 | - * - show_submenu_add_new [3.5.10+] |
|
77 | - |
|
78 | - * <h4>Framework Specific Post Type Label Arguments</h4> |
|
79 | - * - plugin_listing_table_title_cell_link' - If the caller script is a plugin, this determines the label of the action link embedded in the plugin listing page (plugins.php). |
|
80 | - * To disable the action link, set an empty string `''`. |
|
81 | - |
|
82 | - * |
|
83 | - * @since 2.0.0 |
|
84 | - * @since 2.1.6 Added the $sTextDomain parameter. |
|
85 | - * @see http://codex.wordpress.org/Function_Reference/register_post_type#Arguments |
|
86 | - * @param string The post type slug. |
|
87 | - * @param array The <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Arguments">argument array</a> passed to register_post_type(). |
|
88 | - * @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. |
|
89 | - * @param string The text domain of the caller script. |
|
90 | - * @return void |
|
91 | - */ |
|
21 | + * The constructor of the class object. |
|
22 | + * |
|
23 | + * Registers necessary hooks and sets up internal properties. |
|
24 | + * |
|
25 | + * <h4>Example</h4> |
|
26 | + * <code>new APF_PostType( |
|
27 | + * 'apf_posts', // post type slug |
|
28 | + * array( |
|
29 | + * 'labels' => array( |
|
30 | + * 'name' => 'Demo', |
|
31 | + * 'all_items' => __( 'Sample Posts', 'admin-page-framework-demo' ), |
|
32 | + * 'singular_name' => 'Demo', |
|
33 | + * 'add_new' => __( 'Add New', 'admin-page-framework-demo' ), |
|
34 | + * 'add_new_item' => __( 'Add New APF Post', 'admin-page-framework-demo' ), |
|
35 | + * 'edit' => __( 'Edit', 'admin-page-framework-demo' ), |
|
36 | + * 'edit_item' => __( 'Edit APF Post', 'admin-page-framework-demo' ), |
|
37 | + * 'new_item' => __( 'New APF Post', 'admin-page-framework-demo' ), |
|
38 | + * 'view' => __( 'View', 'admin-page-framework-demo' ), |
|
39 | + * 'view_item' => __( 'View APF Post', 'admin-page-framework-demo' ), |
|
40 | + * 'search_items' => __( 'Search APF Post', 'admin-page-framework-demo' ), |
|
41 | + * 'not_found' => __( 'No APF Post found', 'admin-page-framework-demo' ), |
|
42 | + * 'not_found_in_trash' => __( 'No APF Post found in Trash', 'admin-page-framework-demo' ), |
|
43 | + * 'parent' => __( 'Parent APF Post', 'admin-page-framework-demo' ), |
|
44 | + * |
|
45 | + * // (framework specific) |
|
46 | + * 'plugin_listing_table_title_cell_link' => __( 'APF Posts', 'admin-page-framework-demo' ), // framework specific key. [3.0.6+] |
|
47 | + * ), |
|
48 | + * 'public' => true, |
|
49 | + * 'menu_position' => 110, |
|
50 | + * 'supports' => array( 'title' ), // e.g. array( 'title', 'editor', 'comments', 'thumbnail', 'excerpt' ), |
|
51 | + * 'taxonomies' => array( '' ), |
|
52 | + * 'has_archive' => true, |
|
53 | + * 'show_admin_column' => true, // [3.5+ core] this is for custom taxonomies to automatically add the column in the listing table. |
|
54 | + * 'menu_icon' => $this->oProp->bIsAdmin |
|
55 | + * ? ( |
|
56 | + * version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) |
|
57 | + * ? 'dashicons-wordpress' |
|
58 | + * : plugins_url( 'asset/image/wp-logo_16x16.png', APFDEMO_FILE ) |
|
59 | + * ) |
|
60 | + * : null, // do not call the function in the front-end. |
|
61 | + * |
|
62 | + * // (framework specific) this sets the screen icon for the post type for WordPress v3.7.1 or below. |
|
63 | + * // a file path can be passed instead of a url, plugins_url( 'asset/image/wp-logo_32x32.png', APFDEMO_FILE ) |
|
64 | + * 'screen_icon' => dirname( APFDEMO_FILE ) . '/asset/image/wp-logo_32x32.png', |
|
65 | + * |
|
66 | + * // [3.5.10+] (framework specific) default: true |
|
67 | + * 'show_submenu_add_new' => true, |
|
68 | + * |
|
69 | + * ) |
|
70 | + * );</code> |
|
71 | + * |
|
72 | + * <h4>Framework Specific Post Type Arguments</h4> |
|
73 | + * In addition to the post type argument structure defined by the WordPress core, there are arguments defined by the framework. |
|
74 | + * |
|
75 | + * - 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. |
|
76 | + * - show_submenu_add_new [3.5.10+] |
|
77 | + * <h4>Framework Specific Post Type Label Arguments</h4> |
|
78 | + * - plugin_listing_table_title_cell_link' - If the caller script is a plugin, this determines the label of the action link embedded in the plugin listing page (plugins.php). |
|
79 | + * To disable the action link, set an empty string `''`. |
|
80 | + * |
|
81 | + * @since 2.0.0 |
|
82 | + * @since 2.1.6 Added the $sTextDomain parameter. |
|
83 | + * @see http://codex.wordpress.org/Function_Reference/register_post_type#Arguments |
|
84 | + * @param string The post type slug. |
|
85 | + * @param array The <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Arguments">argument array</a> passed to register_post_type(). |
|
86 | + * @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. |
|
87 | + * @param string The text domain of the caller script. |
|
88 | + * @return void |
|
89 | + */ |
|
92 | 90 | public function __construct( $sPostType, $aArguments=array(), $sCallerPath=null, $sTextDomain='admin-page-framework' ) { |
93 | 91 | |
94 | 92 | if ( empty( $sPostType ) ) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @param string The text domain of the caller script. |
90 | 90 | * @return void |
91 | 91 | */ |
92 | - public function __construct( $sPostType, $aArguments=array(), $sCallerPath=null, $sTextDomain='admin-page-framework' ) { |
|
92 | + public function __construct( $sPostType, $aArguments = array(), $sCallerPath = null, $sTextDomain = 'admin-page-framework' ) { |
|
93 | 93 | |
94 | 94 | if ( empty( $sPostType ) ) { |
95 | 95 | return; |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | $sCallerPath |
102 | 102 | ? trim( $sCallerPath ) |
103 | 103 | : ( |
104 | - ( is_admin() && isset( $GLOBALS['pagenow'] ) && in_array( $GLOBALS['pagenow'], array( 'edit.php', 'post.php', 'post-new.php', 'plugins.php', 'tags.php', 'edit-tags.php', ) ) ) |
|
104 | + ( is_admin() && isset( $GLOBALS[ 'pagenow' ] ) && in_array( $GLOBALS[ 'pagenow' ], array( 'edit.php', 'post.php', 'post-new.php', 'plugins.php', 'tags.php', 'edit-tags.php',) ) ) |
|
105 | 105 | ? AdminPageFramework_Utility::getCallerScriptPath( __FILE__ ) |
106 | 106 | : null |
107 | - ), // this is important to attempt to find the caller script path here when separating the library into multiple files. |
|
107 | + ), // this is important to attempt to find the caller script path here when separating the library into multiple files. |
|
108 | 108 | get_class( $this ), // class name |
109 | - 'publish_posts', // capability |
|
110 | - $sTextDomain, // text domain |
|
109 | + 'publish_posts', // capability |
|
110 | + $sTextDomain, // text domain |
|
111 | 111 | 'post_type' // fields type |
112 | 112 | ); |
113 | 113 | $this->oProp->sPostType = AdminPageFramework_WPUtility::sanitizeSlug( $sPostType ); |
@@ -36,36 +36,36 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | - * The method for necessary set-ups. |
|
40 | - * |
|
41 | - * <h4>Example</h4> |
|
42 | - * <code>public function setUp() { |
|
43 | - * $this->setAutoSave( false ); |
|
44 | - * $this->setAuthorTableFilter( true ); |
|
45 | - * $this->addTaxonomy( |
|
46 | - * 'sample_taxonomy', // taxonomy slug |
|
47 | - * array( // argument - for the argument array keys, refer to : http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
48 | - * 'labels' => array( |
|
49 | - * 'name' => 'Genre', |
|
50 | - * 'add_new_item' => 'Add New Genre', |
|
51 | - * 'new_item_name' => "New Genre" |
|
52 | - * ), |
|
53 | - * 'show_ui' => true, |
|
54 | - * 'show_tagcloud' => false, |
|
55 | - * 'hierarchical' => true, |
|
56 | - * 'show_admin_column' => true, |
|
57 | - * 'show_in_nav_menus' => true, |
|
58 | - * 'show_table_filter' => true, // framework specific key |
|
59 | - * 'show_in_sidebar_menus' => false, // framework specific key |
|
60 | - * ) |
|
61 | - * ); |
|
62 | - * }</code> |
|
63 | - * |
|
64 | - * @abstract |
|
65 | - * @since 2.0.0 |
|
66 | - * @remark The user should override this method in their class definition. |
|
67 | - * @remark A callback for the `wp_loaded` hook. |
|
68 | - */ |
|
39 | + * The method for necessary set-ups. |
|
40 | + * |
|
41 | + * <h4>Example</h4> |
|
42 | + * <code>public function setUp() { |
|
43 | + * $this->setAutoSave( false ); |
|
44 | + * $this->setAuthorTableFilter( true ); |
|
45 | + * $this->addTaxonomy( |
|
46 | + * 'sample_taxonomy', // taxonomy slug |
|
47 | + * array( // argument - for the argument array keys, refer to : http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
48 | + * 'labels' => array( |
|
49 | + * 'name' => 'Genre', |
|
50 | + * 'add_new_item' => 'Add New Genre', |
|
51 | + * 'new_item_name' => "New Genre" |
|
52 | + * ), |
|
53 | + * 'show_ui' => true, |
|
54 | + * 'show_tagcloud' => false, |
|
55 | + * 'hierarchical' => true, |
|
56 | + * 'show_admin_column' => true, |
|
57 | + * 'show_in_nav_menus' => true, |
|
58 | + * 'show_table_filter' => true, // framework specific key |
|
59 | + * 'show_in_sidebar_menus' => false, // framework specific key |
|
60 | + * ) |
|
61 | + * ); |
|
62 | + * }</code> |
|
63 | + * |
|
64 | + * @abstract |
|
65 | + * @since 2.0.0 |
|
66 | + * @remark The user should override this method in their class definition. |
|
67 | + * @remark A callback for the `wp_loaded` hook. |
|
68 | + */ |
|
69 | 69 | public function setUp() {} |
70 | 70 | |
71 | 71 | /* |
@@ -124,49 +124,49 @@ discard block |
||
124 | 124 | * Front-end methods |
125 | 125 | */ |
126 | 126 | /** |
127 | - * Enables or disables the auto-save feature in the custom post type's post submission page. |
|
128 | - * |
|
129 | - * <h4>Example</h4> |
|
130 | - * <code>$this->setAutoSave( false ); |
|
131 | - * </code> |
|
132 | - * |
|
133 | - * @since 2.0.0 |
|
134 | - * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
|
135 | - * return void |
|
136 | - */ |
|
127 | + * Enables or disables the auto-save feature in the custom post type's post submission page. |
|
128 | + * |
|
129 | + * <h4>Example</h4> |
|
130 | + * <code>$this->setAutoSave( false ); |
|
131 | + * </code> |
|
132 | + * |
|
133 | + * @since 2.0.0 |
|
134 | + * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
|
135 | + * return void |
|
136 | + */ |
|
137 | 137 | protected function setAutoSave( $bEnableAutoSave=True ) { |
138 | 138 | $this->oProp->bEnableAutoSave = $bEnableAutoSave; |
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
142 | - * Adds a custom taxonomy to the class post type. |
|
143 | - * <h4>Example</h4> |
|
144 | - * <code>$this->addTaxonomy( |
|
145 | - * 'sample_taxonomy', // taxonomy slug |
|
146 | - * array( // argument |
|
147 | - * 'labels' => array( |
|
148 | - * 'name' => 'Genre', |
|
149 | - * 'add_new_item' => 'Add New Genre', |
|
150 | - * 'new_item_name' => "New Genre" |
|
151 | - * ), |
|
152 | - * 'show_ui' => true, |
|
153 | - * 'show_tagcloud' => false, |
|
154 | - * 'hierarchical' => true, |
|
155 | - * 'show_admin_column' => true, |
|
156 | - * 'show_in_nav_menus' => true, |
|
157 | - * 'show_table_filter' => true, // framework specific key |
|
158 | - * 'show_in_sidebar_menus' => false, // framework specific key |
|
159 | - * ) |
|
160 | - * );</code> |
|
161 | - * |
|
162 | - * @see http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
163 | - * @since 2.0.0 |
|
164 | - * @since 3.1.1 Added the third parameter. |
|
165 | - * @param string $sTaxonomySlug The taxonomy slug. |
|
166 | - * @param array $aArgs 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. |
|
167 | - * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
|
168 | - * @return void |
|
169 | - */ |
|
142 | + * Adds a custom taxonomy to the class post type. |
|
143 | + * <h4>Example</h4> |
|
144 | + * <code>$this->addTaxonomy( |
|
145 | + * 'sample_taxonomy', // taxonomy slug |
|
146 | + * array( // argument |
|
147 | + * 'labels' => array( |
|
148 | + * 'name' => 'Genre', |
|
149 | + * 'add_new_item' => 'Add New Genre', |
|
150 | + * 'new_item_name' => "New Genre" |
|
151 | + * ), |
|
152 | + * 'show_ui' => true, |
|
153 | + * 'show_tagcloud' => false, |
|
154 | + * 'hierarchical' => true, |
|
155 | + * 'show_admin_column' => true, |
|
156 | + * 'show_in_nav_menus' => true, |
|
157 | + * 'show_table_filter' => true, // framework specific key |
|
158 | + * 'show_in_sidebar_menus' => false, // framework specific key |
|
159 | + * ) |
|
160 | + * );</code> |
|
161 | + * |
|
162 | + * @see http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
163 | + * @since 2.0.0 |
|
164 | + * @since 3.1.1 Added the third parameter. |
|
165 | + * @param string $sTaxonomySlug The taxonomy slug. |
|
166 | + * @param array $aArgs 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. |
|
167 | + * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
|
168 | + * @return void |
|
169 | + */ |
|
170 | 170 | protected function addTaxonomy( $sTaxonomySlug, array $aArgs, array $aAdditionalObjectTypes=array() ) { |
171 | 171 | |
172 | 172 | $sTaxonomySlug = $this->oUtil->sanitizeSlug( $sTaxonomySlug ); |
@@ -229,16 +229,16 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
232 | - * Sets whether the author drop-down filter is enabled/disabled in the post type post list table. |
|
233 | - * |
|
234 | - * <h4>Example</h4> |
|
235 | - * <code>$this->setAuthorTableFilter( true ); |
|
236 | - * </code> |
|
237 | - * |
|
238 | - * @since 2.0.0 |
|
239 | - * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
|
240 | - * @return void |
|
241 | - */ |
|
232 | + * Sets whether the author drop-down filter is enabled/disabled in the post type post list table. |
|
233 | + * |
|
234 | + * <h4>Example</h4> |
|
235 | + * <code>$this->setAuthorTableFilter( true ); |
|
236 | + * </code> |
|
237 | + * |
|
238 | + * @since 2.0.0 |
|
239 | + * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
|
240 | + * @return void |
|
241 | + */ |
|
242 | 242 | protected function setAuthorTableFilter( $bEnableAuthorTableFileter=false ) { |
243 | 243 | $this->oProp->bEnableAuthorTableFileter = $bEnableAuthorTableFileter; |
244 | 244 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @since 3.0.0 |
80 | 80 | * @return array An array holding the handle IDs of queued items. |
81 | 81 | */ |
82 | - public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
82 | + public function enqueueStyles( $aSRCs, $aCustomArgs = array() ) { |
|
83 | 83 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
84 | 84 | return $this->oResource->_enqueueStyles( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
85 | 85 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * {@inheritdoc} |
91 | 91 | * |
92 | 92 | */ |
93 | - public function enqueueStyle( $sSRC, $aCustomArgs=array() ) { |
|
93 | + public function enqueueStyle( $sSRC, $aCustomArgs = array() ) { |
|
94 | 94 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
95 | 95 | return $this->oResource->_enqueueStyle( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array An array holding the handle IDs of queued items. |
104 | 104 | */ |
105 | - public function enqueueScripts( $aSRCs, $aCustomArgs=array() ) { |
|
105 | + public function enqueueScripts( $aSRCs, $aCustomArgs = array() ) { |
|
106 | 106 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
107 | 107 | return $this->oResource->_enqueueScripts( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
108 | 108 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @since 3.0.0 |
116 | 116 | */ |
117 | - public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
117 | + public function enqueueScript( $sSRC, $aCustomArgs = array() ) { |
|
118 | 118 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
119 | 119 | return $this->oResource->_enqueueScript( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
120 | 120 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
135 | 135 | * return void |
136 | 136 | */ |
137 | - protected function setAutoSave( $bEnableAutoSave=True ) { |
|
137 | + protected function setAutoSave( $bEnableAutoSave = True ) { |
|
138 | 138 | $this->oProp->bEnableAutoSave = $bEnableAutoSave; |
139 | 139 | } |
140 | 140 | |
@@ -167,19 +167,19 @@ discard block |
||
167 | 167 | * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
168 | 168 | * @return void |
169 | 169 | */ |
170 | - protected function addTaxonomy( $sTaxonomySlug, array $aArgs, array $aAdditionalObjectTypes=array() ) { |
|
170 | + protected function addTaxonomy( $sTaxonomySlug, array $aArgs, array $aAdditionalObjectTypes = array() ) { |
|
171 | 171 | |
172 | 172 | $sTaxonomySlug = $this->oUtil->sanitizeSlug( $sTaxonomySlug ); |
173 | 173 | $aArgs = $aArgs + array( |
174 | 174 | 'show_table_filter' => null, |
175 | 175 | 'show_in_sidebar_menus' => null, |
176 | - ) ; |
|
176 | + ); |
|
177 | 177 | $this->oProp->aTaxonomies[ $sTaxonomySlug ] = $aArgs; |
178 | 178 | |
179 | - if ( $aArgs['show_table_filter'] ) { |
|
180 | - $this->oProp->aTaxonomyTableFilters[] = $sTaxonomySlug; |
|
179 | + if ( $aArgs[ 'show_table_filter' ] ) { |
|
180 | + $this->oProp->aTaxonomyTableFilters[ ] = $sTaxonomySlug; |
|
181 | 181 | } |
182 | - if ( ! $aArgs['show_in_sidebar_menus'] ) { |
|
182 | + if ( !$aArgs[ 'show_in_sidebar_menus' ] ) { |
|
183 | 183 | $this->oProp->aTaxonomyRemoveSubmenuPages[ "edit-tags.php?taxonomy={$sTaxonomySlug}&post_type={$this->oProp->sPostType}" ] = "edit.php?post_type={$this->oProp->sPostType}"; |
184 | 184 | } |
185 | 185 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
240 | 240 | * @return void |
241 | 241 | */ |
242 | - protected function setAuthorTableFilter( $bEnableAuthorTableFileter=false ) { |
|
242 | + protected function setAuthorTableFilter( $bEnableAuthorTableFileter = false ) { |
|
243 | 243 | $this->oProp->bEnableAuthorTableFileter = $bEnableAuthorTableFileter; |
244 | 244 | } |
245 | 245 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @param array $aArguments The <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Arguments">array of arguments</a> to be passed to the second parameter of the `register_post_type()` function. |
265 | 265 | * @since 3.2.0 |
266 | 266 | */ |
267 | - protected function setArguments( array $aArguments=array() ) { |
|
267 | + protected function setArguments( array $aArguments = array() ) { |
|
268 | 268 | $this->oProp->aPostTypeArgs = $aArguments; |
269 | 269 | } |
270 | 270 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @package AdminPageFramework |
18 | 18 | * @subpackage PostType |
19 | 19 | */ |
20 | -abstract class AdminPageFramework_PostType_Controller extends AdminPageFramework_PostType_View { |
|
20 | +abstract class AdminPageFramework_PostType_Controller extends AdminPageFramework_PostType_View { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Sets up hooks and properties. |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @since 3.0.0 |
80 | 80 | * @return array An array holding the handle IDs of queued items. |
81 | 81 | */ |
82 | - public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
82 | + public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
83 | 83 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
84 | 84 | return $this->oResource->_enqueueStyles( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
85 | 85 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @since 3.0.0 |
116 | 116 | */ |
117 | - public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
117 | + public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
118 | 118 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
119 | 119 | return $this->oResource->_enqueueScript( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
120 | 120 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function _isInThePage() { |
30 | 30 | |
31 | 31 | // If it's not in one of the post type's pages |
32 | - if ( ! $this->oProp->bIsAdmin ) { |
|
32 | + if ( !$this->oProp->bIsAdmin ) { |
|
33 | 33 | return false; |
34 | 34 | } |
35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | return true; |
39 | 39 | } |
40 | 40 | |
41 | - if ( ! in_array( $this->oProp->sPageNow, array( 'edit.php', 'edit-tags.php', 'post.php', 'post-new.php' ) ) ) { |
|
41 | + if ( !in_array( $this->oProp->sPageNow, array( 'edit.php', 'edit-tags.php', 'post.php', 'post-new.php' ) ) ) { |
|
42 | 42 | return false; |
43 | 43 | } |
44 | 44 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * @subpackage PostType |
17 | 17 | * @internal |
18 | 18 | */ |
19 | -abstract class AdminPageFramework_PostType_Router extends AdminPageFramework_Factory { |
|
19 | +abstract class AdminPageFramework_PostType_Router extends AdminPageFramework_Factory { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Determines whether the currently loaded page is of the post type page. |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param string The text domain. Default: `admin-page-framework`. |
47 | 47 | * @return void |
48 | 48 | */ |
49 | - function __construct( $asTaxonomySlug, $sOptionKey='', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
49 | + function __construct( $asTaxonomySlug, $sOptionKey = '', $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
50 | 50 | |
51 | 51 | if ( empty( $asTaxonomySlug ) ) { |
52 | 52 | // @todo trigger a PHP warning |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | // Properties |
57 | - $this->oProp = new AdminPageFramework_Property_TaxonomyField( |
|
57 | + $this->oProp = new AdminPageFramework_Property_TaxonomyField( |
|
58 | 58 | $this, |
59 | 59 | get_class( $this ), |
60 | 60 | $sCapability, |
@@ -48,7 +48,7 @@ |
||
48 | 48 | */ |
49 | 49 | function __construct( $asTaxonomySlug, $sOptionKey='', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
50 | 50 | |
51 | - if ( empty( $asTaxonomySlug ) ) { |
|
51 | + if ( empty( $asTaxonomySlug ) ) { |
|
52 | 52 | // @todo trigger a PHP warning |
53 | 53 | return; |
54 | 54 | } |