@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | // Use nonce for verification |
32 | 32 | $_aOutput = array(); |
33 | - $_aOutput[] = wp_nonce_field( |
|
33 | + $_aOutput[ ] = wp_nonce_field( |
|
34 | 34 | $this->oProp->sMetaBoxID, |
35 | 35 | $this->oProp->sMetaBoxID, |
36 | 36 | true, |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | |
40 | 40 | // Get the fields output. If no field is added, the form object is not instantiated. |
41 | 41 | if ( isset( $this->oForm ) ) { |
42 | - $_aOutput[] = $this->oForm->get(); |
|
42 | + $_aOutput[ ] = $this->oForm->get(); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Do actions |
46 | - $this->oUtil->addAndDoActions( $this, 'do_' . $this->oProp->sClassName, $this ); |
|
46 | + $this->oUtil->addAndDoActions( $this, 'do_'.$this->oProp->sClassName, $this ); |
|
47 | 47 | |
48 | 48 | // Render the filtered output. |
49 | 49 | echo $this->oUtil->addAndApplyFilters( |
@@ -17,32 +17,32 @@ |
||
17 | 17 | abstract class AdminPageFramework_MetaBox_Controller extends AdminPageFramework_MetaBox_View { |
18 | 18 | |
19 | 19 | /** |
20 | - * The method for all necessary set-ups. |
|
21 | - * |
|
22 | - * <h4>Example</h4> |
|
23 | - * <code> public function setUp() { |
|
24 | - * $this->addSettingFields( |
|
25 | - * array( |
|
26 | - * 'field_id' => 'sample_metabox_text_field', |
|
27 | - * 'title' => 'Text Input', |
|
28 | - * 'description' => 'The description for the field.', |
|
29 | - * 'type' => 'text', |
|
30 | - * ), |
|
31 | - * array( |
|
32 | - * 'field_id' => 'sample_metabox_textarea_field', |
|
33 | - * 'title' => 'Textarea', |
|
34 | - * 'description' => 'The description for the field.', |
|
35 | - * 'type' => 'textarea', |
|
36 | - * 'default' => 'This is a default text value.', |
|
37 | - * ) |
|
38 | - * ); |
|
39 | - * }</code> |
|
40 | - * |
|
41 | - * @abstract |
|
42 | - * @since 2.0.0 |
|
43 | - * @remark The user should override this method. |
|
44 | - * @return void |
|
45 | - */ |
|
20 | + * The method for all necessary set-ups. |
|
21 | + * |
|
22 | + * <h4>Example</h4> |
|
23 | + * <code> public function setUp() { |
|
24 | + * $this->addSettingFields( |
|
25 | + * array( |
|
26 | + * 'field_id' => 'sample_metabox_text_field', |
|
27 | + * 'title' => 'Text Input', |
|
28 | + * 'description' => 'The description for the field.', |
|
29 | + * 'type' => 'text', |
|
30 | + * ), |
|
31 | + * array( |
|
32 | + * 'field_id' => 'sample_metabox_textarea_field', |
|
33 | + * 'title' => 'Textarea', |
|
34 | + * 'description' => 'The description for the field.', |
|
35 | + * 'type' => 'textarea', |
|
36 | + * 'default' => 'This is a default text value.', |
|
37 | + * ) |
|
38 | + * ); |
|
39 | + * }</code> |
|
40 | + * |
|
41 | + * @abstract |
|
42 | + * @since 2.0.0 |
|
43 | + * @remark The user should override this method. |
|
44 | + * @return void |
|
45 | + */ |
|
46 | 46 | public function setUp() {} |
47 | 47 | |
48 | 48 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @since 3.0.0 |
54 | 54 | */ |
55 | - public function enqueueStyles( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
55 | + public function enqueueStyles( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
56 | 56 | return $this->oResource->_enqueueStyles( $aSRCs, $aPostTypes, $aCustomArgs ); |
57 | 57 | } |
58 | 58 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param array (optional) The argument array for more advanced parameters. |
76 | 76 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
77 | 77 | */ |
78 | - public function enqueueStyle( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
78 | + public function enqueueStyle( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
79 | 79 | return $this->oResource->_enqueueStyle( $sSRC, $aPostTypes, $aCustomArgs ); |
80 | 80 | } |
81 | 81 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @since 3.0.0 |
85 | 85 | */ |
86 | - public function enqueueScripts( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
86 | + public function enqueueScripts( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
87 | 87 | return $this->oResource->_enqueueScripts( $aSRCs, $aPostTypes, $aCustomArgs ); |
88 | 88 | } |
89 | 89 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param array (optional) The argument array for more advanced parameters. |
119 | 119 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
120 | 120 | */ |
121 | - public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
121 | + public function enqueueScript( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
122 | 122 | return $this->oResource->_enqueueScript( $sSRC, $aPostTypes, $aCustomArgs ); |
123 | 123 | } |
124 | 124 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param string $sTextDomain (optional) The text domain applied to the displayed text messages. Default: `admin-page-framework`. |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID=array( 'post' ), $sContext='normal', $sPriority='default', $sCapability='edit_posts', $sTextDomain='admin-page-framework' ) { |
|
36 | + public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID = array( 'post' ), $sContext = 'normal', $sPriority = 'default', $sCapability = 'edit_posts', $sTextDomain = 'admin-page-framework' ) { |
|
37 | 37 | |
38 | 38 | parent::__construct( $this->oProp ); |
39 | 39 | |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | ? $this->oUtil->sanitizeSlug( $sMetaBoxID ) |
42 | 42 | : strtolower( $this->oProp->sClassName ); |
43 | 43 | $this->oProp->sTitle = $sTitle; |
44 | - $this->oProp->sContext = $sContext; // 'normal', 'advanced', or 'side' |
|
45 | - $this->oProp->sPriority = $sPriority; // 'high', 'core', 'default' or 'low' |
|
44 | + $this->oProp->sContext = $sContext; // 'normal', 'advanced', or 'side' |
|
45 | + $this->oProp->sPriority = $sPriority; // 'high', 'core', 'default' or 'low' |
|
46 | 46 | |
47 | - if ( ! $this->oProp->bIsAdmin ) { |
|
47 | + if ( !$this->oProp->bIsAdmin ) { |
|
48 | 48 | return; |
49 | 49 | } |
50 | 50 | |
51 | 51 | // 3.8.14 |
52 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToCallLoadMethods' ), 100 ); |
|
52 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToCallLoadMethods' ), 100 ); |
|
53 | 53 | |
54 | 54 | $this->oUtil->registerAction( |
55 | 55 | $this->oProp->bIsAdminAjax |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | return true; |
87 | 87 | } |
88 | 88 | |
89 | - if ( ! in_array( $this->oProp->sPageNow, array( 'post.php', 'post-new.php' ) ) ) { |
|
89 | + if ( !in_array( $this->oProp->sPageNow, array( 'post.php', 'post-new.php' ) ) ) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
93 | - if ( ! in_array( $this->oUtil->getCurrentPostType(), $this->oProp->aPostTypes ) ) { |
|
93 | + if ( !in_array( $this->oUtil->getCurrentPostType(), $this->oProp->aPostTypes ) ) { |
|
94 | 94 | return false; |
95 | 95 | } |
96 | 96 | return true; |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function _isValidAjaxReferrer() { |
107 | 107 | |
108 | - if ( ! $this->oProp->bIsAdminAjax ) { |
|
108 | + if ( !$this->oProp->bIsAdminAjax ) { |
|
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | $_aReferrer = parse_url( $this->oProp->sAjaxReferrer ) + array( 'query' => '', 'path' => '' ); |
112 | 112 | parse_str( $_aReferrer[ 'query' ], $_aQuery ); |
113 | 113 | |
114 | 114 | $_sBaseName = basename( $_aReferrer[ 'path' ] ); |
115 | - if ( ! in_array( $_sBaseName, array( 'post.php', 'post-new.php' ) ) ) { |
|
115 | + if ( !in_array( $_sBaseName, array( 'post.php', 'post-new.php' ) ) ) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | // post-new.php?post_type={...} or post.php?post={n}&action=edit |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @since 2.1.0 Moved from the meta box class. |
35 | 35 | * @var string |
36 | 36 | */ |
37 | - public $sMetaBoxID =''; |
|
37 | + public $sMetaBoxID = ''; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Stores the post type slugs associated with the meta box. |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * Calls the parent constructor by formatting the parameter values. |
139 | 139 | */ |
140 | - public function __construct( $oCaller, $sClassName, $sCapability='edit_posts', $sTextDomain='admin-page-framework', $sStructureType='post_meta_box' ) { |
|
140 | + public function __construct( $oCaller, $sClassName, $sCapability = 'edit_posts', $sTextDomain = 'admin-page-framework', $sStructureType = 'post_meta_box' ) { |
|
141 | 141 | |
142 | 142 | parent::__construct( |
143 | - $oCaller, // caller object |
|
144 | - null, // caller script path - meta boxes don't need the caller script path. |
|
145 | - $sClassName, // class name |
|
146 | - $sCapability, // capability |
|
147 | - $sTextDomain, // text domain |
|
143 | + $oCaller, // caller object |
|
144 | + null, // caller script path - meta boxes don't need the caller script path. |
|
145 | + $sClassName, // class name |
|
146 | + $sCapability, // capability |
|
147 | + $sTextDomain, // text domain |
|
148 | 148 | $sStructureType // structure type |
149 | 149 | ); |
150 | 150 |
@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function _replyToRegisterHelpTabs() { |
67 | 67 | |
68 | - if ( ! $this->oProp->oCaller->isInThePage() ) { |
|
68 | + if ( !$this->oProp->oCaller->isInThePage() ) { |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | |
72 | 72 | $_sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
73 | 73 | $_sCurrentTabSlug = $this->oProp->getCurrentTabSlug( $_sCurrentPageSlug ); |
74 | 74 | |
75 | - if ( ! $this->oProp->isPageAdded( $_sCurrentPageSlug ) ) { |
|
75 | + if ( !$this->oProp->isPageAdded( $_sCurrentPageSlug ) ) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
79 | - foreach( $this->oProp->aHelpTabs as $aHelpTab ) { |
|
79 | + foreach ( $this->oProp->aHelpTabs as $aHelpTab ) { |
|
80 | 80 | $this->_registerHelpTab( $aHelpTab, $_sCurrentPageSlug, $_sCurrentTabSlug ); |
81 | 81 | } |
82 | 82 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | */ |
90 | 90 | private function _registerHelpTab( array $aHelpTab, $sCurrentPageSlug, $sCurrentTabSlug ) { |
91 | 91 | |
92 | - if ( $sCurrentPageSlug != $aHelpTab['sPageSlug'] ) { |
|
92 | + if ( $sCurrentPageSlug != $aHelpTab[ 'sPageSlug' ] ) { |
|
93 | 93 | return; |
94 | 94 | } |
95 | - if ( isset( $aHelpTab['sPageTabSlug'] ) && ! empty( $aHelpTab['sPageTabSlug'] ) && $sCurrentTabSlug != $aHelpTab['sPageTabSlug'] ) { |
|
95 | + if ( isset( $aHelpTab[ 'sPageTabSlug' ] ) && !empty( $aHelpTab[ 'sPageTabSlug' ] ) && $sCurrentTabSlug != $aHelpTab[ 'sPageTabSlug' ] ) { |
|
96 | 96 | return; |
97 | 97 | } |
98 | 98 | |
@@ -131,24 +131,24 @@ discard block |
||
131 | 131 | $aHelpTab = ( array ) $aHelpTab + self::$_aStructure_HelpTabUserArray; |
132 | 132 | |
133 | 133 | // If the key is not set, that means the help tab array is not created yet. So create it and go back. |
134 | - if ( ! isset( $this->oProp->aHelpTabs[ $aHelpTab['help_tab_id'] ] ) ) { |
|
135 | - $this->oProp->aHelpTabs[ $aHelpTab['help_tab_id'] ] = array( |
|
136 | - 'sID' => $aHelpTab['help_tab_id'], |
|
137 | - 'sTitle' => $aHelpTab['help_tab_title'], |
|
138 | - 'aContent' => ! empty( $aHelpTab['help_tab_content'] ) ? array( $this->_formatHelpDescription( $aHelpTab['help_tab_content'] ) ) : array(), |
|
139 | - 'aSidebar' => ! empty( $aHelpTab['help_tab_sidebar_content'] ) ? array( $this->_formatHelpDescription( $aHelpTab['help_tab_sidebar_content'] ) ) : array(), |
|
140 | - 'sPageSlug' => $aHelpTab['page_slug'], |
|
141 | - 'sPageTabSlug' => $aHelpTab['page_tab_slug'], |
|
134 | + if ( !isset( $this->oProp->aHelpTabs[ $aHelpTab[ 'help_tab_id' ] ] ) ) { |
|
135 | + $this->oProp->aHelpTabs[ $aHelpTab[ 'help_tab_id' ] ] = array( |
|
136 | + 'sID' => $aHelpTab[ 'help_tab_id' ], |
|
137 | + 'sTitle' => $aHelpTab[ 'help_tab_title' ], |
|
138 | + 'aContent' => !empty( $aHelpTab[ 'help_tab_content' ] ) ? array( $this->_formatHelpDescription( $aHelpTab[ 'help_tab_content' ] ) ) : array(), |
|
139 | + 'aSidebar' => !empty( $aHelpTab[ 'help_tab_sidebar_content' ] ) ? array( $this->_formatHelpDescription( $aHelpTab[ 'help_tab_sidebar_content' ] ) ) : array(), |
|
140 | + 'sPageSlug' => $aHelpTab[ 'page_slug' ], |
|
141 | + 'sPageTabSlug' => $aHelpTab[ 'page_tab_slug' ], |
|
142 | 142 | ); |
143 | 143 | return; |
144 | 144 | } |
145 | 145 | |
146 | 146 | // This line will be reached if the help tab array is already set. In this case, just append an array element into the keys. |
147 | - if ( ! empty( $aHelpTab['help_tab_content'] ) ) { |
|
148 | - $this->oProp->aHelpTabs[ $aHelpTab['help_tab_id'] ]['aContent'][] = $this->_formatHelpDescription( $aHelpTab['help_tab_content'] ); |
|
147 | + if ( !empty( $aHelpTab[ 'help_tab_content' ] ) ) { |
|
148 | + $this->oProp->aHelpTabs[ $aHelpTab[ 'help_tab_id' ] ][ 'aContent' ][ ] = $this->_formatHelpDescription( $aHelpTab[ 'help_tab_content' ] ); |
|
149 | 149 | } |
150 | - if ( ! empty( $aHelpTab['help_tab_sidebar_content'] ) ) { |
|
151 | - $this->oProp->aHelpTabs[ $aHelpTab['help_tab_id'] ]['aSidebar'][] = $this->_formatHelpDescription( $aHelpTab['help_tab_sidebar_content'] ); |
|
150 | + if ( !empty( $aHelpTab[ 'help_tab_sidebar_content' ] ) ) { |
|
151 | + $this->oProp->aHelpTabs[ $aHelpTab[ 'help_tab_id' ] ][ 'aSidebar' ][ ] = $this->_formatHelpDescription( $aHelpTab[ 'help_tab_sidebar_content' ] ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | } |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | * @since 2.0.0 |
94 | 94 | * @since 3.5.4 Added the `$aHeader` parameter. Deprecated the `$sFileName` parameter as it is included in the $aHeader definition. |
95 | 95 | */ |
96 | - public function doExport( $vData, $sFormatType=null, array $aHeader=array() ) { |
|
96 | + public function doExport( $vData, $sFormatType = null, array $aHeader = array() ) { |
|
97 | 97 | |
98 | - $sFormatType = isset( $sFormatType ) |
|
98 | + $sFormatType = isset( $sFormatType ) |
|
99 | 99 | ? $sFormatType |
100 | 100 | : $this->sFormatType; |
101 | 101 | |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | * @since 3.5.4 |
122 | 122 | * @return void |
123 | 123 | */ |
124 | - private function _outputHTTPHeader( array $aHeader, $sKey='' ) { |
|
124 | + private function _outputHTTPHeader( array $aHeader, $sKey = '' ) { |
|
125 | 125 | |
126 | - foreach( $aHeader as $_sKey => $_asValue ) { |
|
126 | + foreach ( $aHeader as $_sKey => $_asValue ) { |
|
127 | 127 | |
128 | 128 | // Nested items. Set the key to overrider array keys. |
129 | 129 | if ( is_array( $_asValue ) ) { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return; |
164 | 164 | case 'json': // for json. |
165 | 165 | echo json_encode( ( array ) $vData ); |
166 | - return ; |
|
166 | + return; |
|
167 | 167 | case 'array': // for serialized PHP array. |
168 | 168 | default: // for anything else, |
169 | 169 | echo serialize( ( array ) $vData ); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $this->oFactory = $oFactory; |
30 | 30 | |
31 | 31 | add_filter( |
32 | - "validation_pre_" . $this->oFactory->oProp->sClassName, |
|
32 | + "validation_pre_".$this->oFactory->oProp->sClassName, |
|
33 | 33 | array( $this, '_replyToValidateUserFormInputs' ), |
34 | 34 | 10, |
35 | 35 | 4 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $_sSubmitSectionID = $this->_getPressedSubmitButtonData( $_aSubmits, 'section_id' ); |
61 | 61 | |
62 | 62 | // Submit Information - [3.5.0+] this will be passed to validation callback methods. |
63 | - $_aSubmitsInformation = array( |
|
63 | + $_aSubmitsInformation = array( |
|
64 | 64 | 'page_slug' => $_sPageSlug, |
65 | 65 | 'tab_slug' => $_sTabSlug, |
66 | 66 | 'input_id' => $this->_getPressedSubmitButtonData( $_aSubmits, 'input_id' ), |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | 'AdminPageFramework_Model__FormSubmission__Validator__Export', |
81 | 81 | 'AdminPageFramework_Model__FormSubmission__Validator__Reset', |
82 | 82 | 'AdminPageFramework_Model__FormSubmission__Validator__ResetConfirm', // 3.7.6+ Moved to after validation from before validation |
83 | - 'AdminPageFramework_Model__FormSubmission__Validator__ContactForm', // 3.7.6+ Moved to after validation from before validation |
|
83 | + 'AdminPageFramework_Model__FormSubmission__Validator__ContactForm', // 3.7.6+ Moved to after validation from before validation |
|
84 | 84 | 'AdminPageFramework_Model__FormSubmission__Validator__ContactFormConfirm', |
85 | 85 | |
86 | 86 | ); |
87 | - foreach( $_aClassNames as $_sClassName ) { |
|
87 | + foreach ( $_aClassNames as $_sClassName ) { |
|
88 | 88 | new $_sClassName( $this->oFactory ); |
89 | 89 | } |
90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $this->addAndDoActions( |
95 | 95 | $this->oFactory, |
96 | - 'try_validation_before_' . $this->oFactory->oProp->sClassName, |
|
96 | + 'try_validation_before_'.$this->oFactory->oProp->sClassName, |
|
97 | 97 | $aInputs, |
98 | 98 | $aRawInputs, |
99 | 99 | $_aSubmits, |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $this->addAndDoActions( |
114 | 114 | $this->oFactory, |
115 | - 'try_validation_after_' . $this->oFactory->oProp->sClassName, |
|
115 | + 'try_validation_after_'.$this->oFactory->oProp->sClassName, |
|
116 | 116 | $aInputs, |
117 | 117 | $aRawInputs, |
118 | 118 | $_aSubmits, |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
36 | 36 | $_sLinkURL = $this->_getPressedSubmitButtonData( $aSubmits, 'href' ); |
37 | - if ( ! $_sLinkURL ) { |
|
37 | + if ( !$_sLinkURL ) { |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | $this->goToURL( $_sLinkURL ); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
33 | 33 | |
34 | 34 | // if the 'reset' key in the field definition array is set, this value will be set. |
35 | - if ( ! $this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
35 | + if ( !$this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ); |
43 | 43 | |
44 | 44 | // Go to the catch clause. |
45 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
45 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
46 | 46 | $_oException->aReturn = $this->_confirmSubmitButtonAction( |
47 | 47 | $this->getElement( $aSubmitInformation, 'input_name' ), |
48 | 48 | $this->getElement( $aSubmitInformation, 'section_id' ), |