@@ -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 | /** |
@@ -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 | |
@@ -167,11 +167,11 @@ |
||
| 167 | 167 | * |
| 168 | 168 | * Triggered when a post has not been created so no post id is assigned. |
| 169 | 169 | * |
| 170 | - * @internal |
|
| 170 | + * @internal |
|
| 171 | 171 | * @since 3.3.0 |
| 172 | 172 | * @callback filter wp_insert_attachment_data |
| 173 | 173 | * @callback filter wp_insert_post_data |
| 174 | - * @param array $aPostData An array of slashed post data. |
|
| 174 | + * @param array $aPostData An array of slashed post data. |
|
| 175 | 175 | * @param array $aUnmodified An array of sanitized, but otherwise unmodified post data. |
| 176 | 176 | */ |
| 177 | 177 | public function _replyToFilterSavingData( $aPostData, $aUnmodified ) { |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | * @param string $sTextDomain |
| 29 | 29 | * @since 3.7.9 |
| 30 | 30 | */ |
| 31 | - public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID=array( 'post' ), $sContext='normal', $sPriority='default', $sCapability='edit_posts', $sTextDomain='admin-page-framework' ) { |
|
| 31 | + public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID = array( 'post' ), $sContext = 'normal', $sPriority = 'default', $sCapability = 'edit_posts', $sTextDomain = 'admin-page-framework' ) { |
|
| 32 | 32 | |
| 33 | 33 | // This is important to set the hooks before the parent constructor |
| 34 | 34 | // as the setUp wil be called in there if the default action hook (current_screen) is already triggered. |
| 35 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
| 36 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToSetUpValidationHooks' ) ); |
|
| 35 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
| 36 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToSetUpValidationHooks' ) ); |
|
| 37 | 37 | |
| 38 | 38 | parent::__construct( |
| 39 | 39 | $sMetaBoxID, |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | * @callback add_meta_boxes |
| 116 | 116 | */ |
| 117 | 117 | public function _replyToRegisterMetaBoxes() { |
| 118 | - foreach( $this->oProp->aPostTypes as $_sPostType ) { |
|
| 118 | + foreach ( $this->oProp->aPostTypes as $_sPostType ) { |
|
| 119 | 119 | add_meta_box( |
| 120 | - $this->oProp->sMetaBoxID, // id |
|
| 121 | - $this->oProp->sTitle, // title |
|
| 120 | + $this->oProp->sMetaBoxID, // id |
|
| 121 | + $this->oProp->sTitle, // title |
|
| 122 | 122 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
| 123 | - $_sPostType, // post type |
|
| 124 | - $this->oProp->sContext, // context |
|
| 125 | - $this->oProp->sPriority, // priority |
|
| 123 | + $_sPostType, // post type |
|
| 124 | + $this->oProp->sContext, // context |
|
| 125 | + $this->oProp->sPriority, // priority |
|
| 126 | 126 | null // argument - deprecated $this->oForm->aFields |
| 127 | 127 | ); |
| 128 | 128 | } |
@@ -154,18 +154,18 @@ discard block |
||
| 154 | 154 | * @internal |
| 155 | 155 | * @return integer The found post ID. `0` if not found. |
| 156 | 156 | */ |
| 157 | - private function ___getPostID() { |
|
| 157 | + private function ___getPostID() { |
|
| 158 | 158 | |
| 159 | 159 | // for an editing post page. |
| 160 | 160 | if ( isset( $GLOBALS[ 'post' ]->ID ) ) { |
| 161 | 161 | return $GLOBALS[ 'post' ]->ID; |
| 162 | 162 | } |
| 163 | 163 | if ( isset( $_GET[ 'post' ] ) ) { // sanitization unnecessary |
| 164 | - return absint( $_GET[ 'post' ] ); // sanitization done |
|
| 164 | + return absint( $_GET[ 'post' ] ); // sanitization done |
|
| 165 | 165 | } |
| 166 | 166 | // for post.php without any query key-values. |
| 167 | 167 | if ( isset( $_POST[ 'post_ID' ] ) ) { // sanitization unnecessary |
| 168 | - return absint( $_POST[ 'post_ID' ] ); // sanitization done |
|
| 168 | + return absint( $_POST[ 'post_ID' ] ); // sanitization done |
|
| 169 | 169 | } |
| 170 | 170 | return 0; |
| 171 | 171 | |
@@ -186,14 +186,14 @@ discard block |
||
| 186 | 186 | public function _replyToFilterSavingData( $aPostData, $aUnmodified ) { |
| 187 | 187 | |
| 188 | 188 | // Perform initial checks. |
| 189 | - if ( ! $this->_shouldProceedValidation( $aUnmodified ) ) { |
|
| 189 | + if ( !$this->_shouldProceedValidation( $aUnmodified ) ) { |
|
| 190 | 190 | return $aPostData; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // Retrieve the submitted data. |
| 194 | - $_aInputs = $this->oForm->getSubmittedData( |
|
| 195 | - $this->oForm->getHTTPRequestSanitized( $_POST, false ), // subject data to be parsed. Will be sanitized in the method // sanitization done |
|
| 196 | - true, // extract data with the fieldset structure |
|
| 194 | + $_aInputs = $this->oForm->getSubmittedData( |
|
| 195 | + $this->oForm->getHTTPRequestSanitized( $_POST, false ), // subject data to be parsed. Will be sanitized in the method // sanitization done |
|
| 196 | + true, // extract data with the fieldset structure |
|
| 197 | 197 | false // strip slashes |
| 198 | 198 | ); |
| 199 | 199 | $_aInputsRaw = $_aInputs; // store one for the last input array. |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | $this->oForm->updateMetaDataByType( |
| 231 | - $_iPostID, // object id |
|
| 232 | - $_aInputs, // user submit form data |
|
| 231 | + $_iPostID, // object id |
|
| 232 | + $_aInputs, // user submit form data |
|
| 233 | 233 | $this->oForm->dropRepeatableElements( $_aSavedMeta ), // Drop repeatable section elements from the saved meta array. |
| 234 | 234 | $this->oForm->sStructureType // fields type |
| 235 | 235 | ); |
@@ -288,14 +288,14 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // If our nonce isn't there, or we can't verify it, bail |
| 291 | - if ( ! isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { // sanitization unnecessary |
|
| 291 | + if ( !isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { // sanitization unnecessary |
|
| 292 | 292 | return false; |
| 293 | 293 | } |
| 294 | - if ( ! wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { // sanitization unnecessary |
|
| 294 | + if ( !wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { // sanitization unnecessary |
|
| 295 | 295 | return false; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - if ( ! in_array( $aUnmodified[ 'post_type' ], $this->oProp->aPostTypes, true ) ) { |
|
| 298 | + if ( !in_array( $aUnmodified[ 'post_type' ], $this->oProp->aPostTypes, true ) ) { |
|
| 299 | 299 | return false; |
| 300 | 300 | } |
| 301 | 301 | |
@@ -154,17 +154,19 @@ discard block |
||
| 154 | 154 | * @internal |
| 155 | 155 | * @return integer The found post ID. `0` if not found. |
| 156 | 156 | */ |
| 157 | - private function ___getPostID() { |
|
| 157 | + private function ___getPostID() { |
|
| 158 | 158 | |
| 159 | 159 | // for an editing post page. |
| 160 | 160 | if ( isset( $GLOBALS[ 'post' ]->ID ) ) { |
| 161 | 161 | return $GLOBALS[ 'post' ]->ID; |
| 162 | 162 | } |
| 163 | - if ( isset( $_GET[ 'post' ] ) ) { // sanitization unnecessary |
|
| 163 | + if ( isset( $_GET[ 'post' ] ) ) { |
|
| 164 | +// sanitization unnecessary |
|
| 164 | 165 | return absint( $_GET[ 'post' ] ); // sanitization done |
| 165 | 166 | } |
| 166 | 167 | // for post.php without any query key-values. |
| 167 | - if ( isset( $_POST[ 'post_ID' ] ) ) { // sanitization unnecessary |
|
| 168 | + if ( isset( $_POST[ 'post_ID' ] ) ) { |
|
| 169 | +// sanitization unnecessary |
|
| 168 | 170 | return absint( $_POST[ 'post_ID' ] ); // sanitization done |
| 169 | 171 | } |
| 170 | 172 | return 0; |
@@ -288,10 +290,12 @@ discard block |
||
| 288 | 290 | } |
| 289 | 291 | |
| 290 | 292 | // If our nonce isn't there, or we can't verify it, bail |
| 291 | - if ( ! isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { // sanitization unnecessary |
|
| 293 | + if ( ! isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { |
|
| 294 | +// sanitization unnecessary |
|
| 292 | 295 | return false; |
| 293 | 296 | } |
| 294 | - if ( ! wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { // sanitization unnecessary |
|
| 297 | + if ( ! wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { |
|
| 298 | +// sanitization unnecessary |
|
| 295 | 299 | return false; |
| 296 | 300 | } |
| 297 | 301 | |
@@ -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 | } |
@@ -218,24 +218,24 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | - * Adds the given link(s) into the description cell of the plugin listing table. |
|
| 222 | - * |
|
| 223 | - * <h4>Example</h4> |
|
| 224 | - * <code>$this->addLinkToPluginDescription( |
|
| 225 | - * "<a href='http://www.google.com'>Google</a>", |
|
| 226 | - * "<a href='http://www.yahoo.com'>Yahoo!</a>" |
|
| 227 | - * );</code> |
|
| 228 | - * |
|
| 229 | - * @since 2.0.0 |
|
| 230 | - * @since 3.0.0 Changed the scope to public from protected. |
|
| 231 | - * @since 3.3.1 Moved from `AdminPageFramework`. |
|
| 232 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 233 | - * @param string the tagged HTML link text. |
|
| 234 | - * @param string (optional) another tagged HTML link text. |
|
| 235 | - * @param string (optional) add more as many as want by adding items to the next parameters. |
|
| 236 | - * @access public |
|
| 237 | - * @return void |
|
| 238 | - */ |
|
| 221 | + * Adds the given link(s) into the description cell of the plugin listing table. |
|
| 222 | + * |
|
| 223 | + * <h4>Example</h4> |
|
| 224 | + * <code>$this->addLinkToPluginDescription( |
|
| 225 | + * "<a href='http://www.google.com'>Google</a>", |
|
| 226 | + * "<a href='http://www.yahoo.com'>Yahoo!</a>" |
|
| 227 | + * );</code> |
|
| 228 | + * |
|
| 229 | + * @since 2.0.0 |
|
| 230 | + * @since 3.0.0 Changed the scope to public from protected. |
|
| 231 | + * @since 3.3.1 Moved from `AdminPageFramework`. |
|
| 232 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 233 | + * @param string the tagged HTML link text. |
|
| 234 | + * @param string (optional) another tagged HTML link text. |
|
| 235 | + * @param string (optional) add more as many as want by adding items to the next parameters. |
|
| 236 | + * @access public |
|
| 237 | + * @return void |
|
| 238 | + */ |
|
| 239 | 239 | public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
| 240 | 240 | if ( 'plugins.php' !== $this->oProp->sPageNow ) { |
| 241 | 241 | return; |
@@ -244,23 +244,23 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | - * Adds the given link(s) into the title cell of the plugin listing table. |
|
| 248 | - * |
|
| 249 | - * <h4>Example</h4> |
|
| 250 | - * <code>$this->addLinkToPluginTitle( |
|
| 251 | - * "<a href='http://www.wordpress.org'>WordPress</a>" |
|
| 252 | - * );</code> |
|
| 253 | - * |
|
| 254 | - * @since 2.0.0 |
|
| 255 | - * @since 3.0.0 Changed the scope to public from protected. |
|
| 256 | - * @since 3.3.1 Moved from `AdminPageFramework`. |
|
| 257 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 258 | - * @param string the tagged HTML link text. |
|
| 259 | - * @param string (optional) another tagged HTML link text. |
|
| 260 | - * @param string (optional) add more as many as want by adding items to the next parameters. |
|
| 261 | - * @access public |
|
| 262 | - * @return void |
|
| 263 | - */ |
|
| 247 | + * Adds the given link(s) into the title cell of the plugin listing table. |
|
| 248 | + * |
|
| 249 | + * <h4>Example</h4> |
|
| 250 | + * <code>$this->addLinkToPluginTitle( |
|
| 251 | + * "<a href='http://www.wordpress.org'>WordPress</a>" |
|
| 252 | + * );</code> |
|
| 253 | + * |
|
| 254 | + * @since 2.0.0 |
|
| 255 | + * @since 3.0.0 Changed the scope to public from protected. |
|
| 256 | + * @since 3.3.1 Moved from `AdminPageFramework`. |
|
| 257 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 258 | + * @param string the tagged HTML link text. |
|
| 259 | + * @param string (optional) another tagged HTML link text. |
|
| 260 | + * @param string (optional) add more as many as want by adding items to the next parameters. |
|
| 261 | + * @access public |
|
| 262 | + * @return void |
|
| 263 | + */ |
|
| 264 | 264 | public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
| 265 | 265 | |
| 266 | 266 | if ( 'plugins.php' !== $this->oProp->sPageNow ) { |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @access public |
| 269 | 269 | * @return void |
| 270 | 270 | */ |
| 271 | - public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
| 271 | + public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2 = null, $_and_more = null ) { |
|
| 272 | 272 | if ( 'plugins.php' !== $this->oProp->sPageNow ) { |
| 273 | 273 | return; |
| 274 | 274 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | * @access public |
| 294 | 294 | * @return void |
| 295 | 295 | */ |
| 296 | - public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
| 296 | + public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2 = null, $_and_more = null ) { |
|
| 297 | 297 | |
| 298 | 298 | if ( 'plugins.php' !== $this->oProp->sPageNow ) { |
| 299 | 299 | return; |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | * @param string (optional) The class selector used in the message HTML element. 'error' and 'updated' are prepared by WordPress but it's not limited to them and can pass a custom name. Default: 'error'. |
| 353 | 353 | * @param string (optional) The ID of the message. If not set, the hash of the message will be used. |
| 354 | 354 | */ |
| 355 | - public function setAdminNotice( $sMessage, $sClassSelector='error', $sID='' ) { |
|
| 355 | + public function setAdminNotice( $sMessage, $sClassSelector = 'error', $sID = '' ) { |
|
| 356 | 356 | |
| 357 | 357 | $sID = $sID ? $sID : md5( $sMessage ); |
| 358 | 358 | |
@@ -389,9 +389,9 @@ discard block |
||
| 389 | 389 | * @param boolean If true, the passed key(s) will be appended to the property; otherwise, it will override the property. |
| 390 | 390 | * @return void |
| 391 | 391 | */ |
| 392 | - public function setDisallowedQueryKeys( $asQueryKeys, $bAppend=true ) { |
|
| 392 | + public function setDisallowedQueryKeys( $asQueryKeys, $bAppend = true ) { |
|
| 393 | 393 | |
| 394 | - if ( ! $bAppend ) { |
|
| 394 | + if ( !$bAppend ) { |
|
| 395 | 395 | $this->oProp->aDisallowedQueryKeys = ( array ) $asQueryKeys; |
| 396 | 396 | return; |
| 397 | 397 | } |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
| 435 | 435 | * @return mixed If the field ID is not specified |
| 436 | 436 | */ |
| 437 | - static public function getOption( $sOptionKey, $asKey=null, $vDefault=null ) { |
|
| 437 | + static public function getOption( $sOptionKey, $asKey = null, $vDefault = null ) { |
|
| 438 | 438 | return AdminPageFramework_WPUtility::getOption( $sOptionKey, $asKey, $vDefault ); |
| 439 | 439 | } |
| 440 | 440 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @return void |
| 94 | 94 | */ |
| 95 | 95 | public function addInPageTabs( /* $aTab1, $aTab2=null, $_and_more=null */ ) { |
| 96 | - foreach( func_get_args() as $asTab ) { |
|
| 96 | + foreach ( func_get_args() as $asTab ) { |
|
| 97 | 97 | $this->addInPageTab( $asTab ); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | // Target page slug - will be applied when no page slug is specified. |
| 117 | 117 | static $__sTargetPageSlug; |
| 118 | - if ( ! is_array( $asInPageTab ) ) { |
|
| 118 | + if ( !is_array( $asInPageTab ) ) { |
|
| 119 | 119 | $__sTargetPageSlug = is_string( $asInPageTab ) |
| 120 | 120 | ? $asInPageTab |
| 121 | 121 | : $__sTargetPageSlug; // set the target page slug |
@@ -130,23 +130,23 @@ discard block |
||
| 130 | 130 | ); |
| 131 | 131 | |
| 132 | 132 | // Set the target page slug for next calls |
| 133 | - $__sTargetPageSlug = $aInPageTab[ 'page_slug' ]; |
|
| 133 | + $__sTargetPageSlug = $aInPageTab[ 'page_slug' ]; |
|
| 134 | 134 | |
| 135 | 135 | // Required keys |
| 136 | - if ( ! isset( $aInPageTab[ 'page_slug' ], $aInPageTab[ 'tab_slug' ] ) ) { |
|
| 136 | + if ( !isset( $aInPageTab[ 'page_slug' ], $aInPageTab[ 'tab_slug' ] ) ) { |
|
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // Count - the number of added in-page tabs. |
| 141 | - $_aElements = $this->oUtil->getElement( |
|
| 141 | + $_aElements = $this->oUtil->getElement( |
|
| 142 | 142 | $this->oProp->aInPageTabs, |
| 143 | 143 | $aInPageTab[ 'page_slug' ], |
| 144 | 144 | array() |
| 145 | 145 | ); |
| 146 | - $_iCountElement = count( $_aElements ); |
|
| 146 | + $_iCountElement = count( $_aElements ); |
|
| 147 | 147 | |
| 148 | 148 | // Pre-format |
| 149 | - $aInPageTab = array( |
|
| 149 | + $aInPageTab = array( |
|
| 150 | 150 | 'page_slug' => $this->oUtil->sanitizeSlug( $aInPageTab[ 'page_slug' ] ), |
| 151 | 151 | 'tab_slug' => $this->oUtil->sanitizeSlug( $aInPageTab[ 'tab_slug' ] ), |
| 152 | 152 | 'order' => $this->oUtil->getAOrB( |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @param boolean $bShow If false, the page title will not be displayed. |
| 175 | 175 | * @return void |
| 176 | 176 | */ |
| 177 | - public function setPageTitleVisibility( $bShow=true, $sPageSlug='' ) { |
|
| 177 | + public function setPageTitleVisibility( $bShow = true, $sPageSlug = '' ) { |
|
| 178 | 178 | $this->_setPageProperty( |
| 179 | 179 | 'bShowPageTitle', |
| 180 | 180 | 'show_page_title', |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @remark Page-heading tabs and in-page tabs are different. The former displays page titles and the latter displays tab titles. |
| 199 | 199 | * @remark If the second parameter is omitted, it sets the default value. |
| 200 | 200 | */ |
| 201 | - public function setPageHeadingTabsVisibility( $bShow=true, $sPageSlug='' ) { |
|
| 201 | + public function setPageHeadingTabsVisibility( $bShow = true, $sPageSlug = '' ) { |
|
| 202 | 202 | $this->_setPageProperty( |
| 203 | 203 | 'bShowPageHeadingTabs', |
| 204 | 204 | 'show_page_heading_tabs', |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @param string $sPageSlug The page to apply the visibility setting. If not set, it applies to all the pages. |
| 220 | 220 | * @remark If the second parameter is omitted, it sets the default value. |
| 221 | 221 | */ |
| 222 | - public function setInPageTabsVisibility( $bShow=true, $sPageSlug='' ) { |
|
| 222 | + public function setInPageTabsVisibility( $bShow = true, $sPageSlug = '' ) { |
|
| 223 | 223 | $this->_setPageProperty( |
| 224 | 224 | 'bShowInPageTabs', |
| 225 | 225 | 'show_in_page_tabs', |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @param string $sPageSlug The page slug that applies the setting. |
| 243 | 243 | * @remark If the second parameter is omitted, it sets the default value. |
| 244 | 244 | */ |
| 245 | - public function setInPageTabTag( $sTag='h3', $sPageSlug='' ) { |
|
| 245 | + public function setInPageTabTag( $sTag = 'h3', $sPageSlug = '' ) { |
|
| 246 | 246 | $this->_setPageProperty( |
| 247 | 247 | 'sInPageTabTag', |
| 248 | 248 | 'in_page_tab_tag', |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | * @param string $sPageSlug The page slug that applies the setting. |
| 266 | 266 | * @remark If the second parameter is omitted, it sets the default value. |
| 267 | 267 | */ |
| 268 | - public function setPageHeadingTabTag( $sTag='h2', $sPageSlug='' ) { |
|
| 268 | + public function setPageHeadingTabTag( $sTag = 'h2', $sPageSlug = '' ) { |
|
| 269 | 269 | $this->_setPageProperty( |
| 270 | - 'sPageHeadingTabTag', // property name |
|
| 270 | + 'sPageHeadingTabTag', // property name |
|
| 271 | 271 | 'page_heading_tab_tag', // property key |
| 272 | 272 | $sTag, // value |
| 273 | 273 | $sPageSlug // page slug |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $this->oProp->{$sPropertyName} = $mValue; |
| 291 | 291 | |
| 292 | - foreach( $this->oProp->aPages as &$_aPage ) { |
|
| 292 | + foreach ( $this->oProp->aPages as &$_aPage ) { |
|
| 293 | 293 | $_aPage[ $sPropertyKey ] = $mValue; |
| 294 | 294 | |
| 295 | 295 | } |
@@ -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 ); |