@@ -82,7 +82,7 @@ |
||
| 82 | 82 | protected function _getFormattedSubMenuLinkArray( array $aSubMenuLink ) { |
| 83 | 83 | |
| 84 | 84 | // If the set URL is not valid, return. |
| 85 | - if ( ! filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
| 85 | + if ( !filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
| 86 | 86 | return array(); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | protected function _getFormattedSubMenuLinkArray( array $aSubMenuLink ) { |
| 83 | 83 | |
| 84 | 84 | // If the set URL is not valid, return. |
| 85 | - if ( ! filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
| 85 | + if ( ! filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
| 86 | 86 | return array(); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | 'page_slug' => null, // (required) |
| 33 | 33 | 'type' => 'page', // this is used to compare with the link type. |
| 34 | 34 | 'title' => null, |
| 35 | - 'page_title' => null, // (optional) 3.3.0+ When the page title is different from the above 'title' argument, set this. |
|
| 36 | - 'menu_title' => null, // (optional) 3.3.0+ When the menu title is different from the above 'title' argument, set this. |
|
| 35 | + 'page_title' => null, // (optional) 3.3.0+ When the page title is different from the above 'title' argument, set this. |
|
| 36 | + 'menu_title' => null, // (optional) 3.3.0+ When the menu title is different from the above 'title' argument, set this. |
|
| 37 | 37 | 'screen_icon' => null, // this will become either href_icon_32x32 or screen_icon_id |
| 38 | 38 | 'capability' => null, |
| 39 | 39 | 'order' => null, |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $aSubMenuPage = $aSubMenuPage |
| 115 | 115 | + array( |
| 116 | - 'show_page_title' => $this->oFactory->oProp->bShowPageTitle, // boolean |
|
| 116 | + 'show_page_title' => $this->oFactory->oProp->bShowPageTitle, // boolean |
|
| 117 | 117 | 'show_page_heading_tabs' => $this->oFactory->oProp->bShowPageHeadingTabs, // boolean |
| 118 | - 'show_in_page_tabs' => $this->oFactory->oProp->bShowInPageTabs, // boolean |
|
| 119 | - 'in_page_tab_tag' => $this->oFactory->oProp->sInPageTabTag, // string |
|
| 120 | - 'page_heading_tab_tag' => $this->oFactory->oProp->sPageHeadingTabTag, // string |
|
| 121 | - 'capability' => $this->oFactory->oProp->sCapability, // 3.6.0+ |
|
| 118 | + 'show_in_page_tabs' => $this->oFactory->oProp->bShowInPageTabs, // boolean |
|
| 119 | + 'in_page_tab_tag' => $this->oFactory->oProp->sInPageTabTag, // string |
|
| 120 | + 'page_heading_tab_tag' => $this->oFactory->oProp->sPageHeadingTabTag, // string |
|
| 121 | + 'capability' => $this->oFactory->oProp->sCapability, // 3.6.0+ |
|
| 122 | 122 | ) |
| 123 | 123 | + self::$aStructure; |
| 124 | 124 | |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Renders a registered meta box. |
| 23 | - |
|
| 24 | 23 | * @return void |
| 25 | 24 | * @param string $sContext `side`, `normal`, or `advanced`. |
| 26 | 25 | * @since 3.0.0 |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | public function render( $sContext ) { |
| 30 | 30 | |
| 31 | 31 | // If nothing is registered do not render even the container. |
| 32 | - if ( ! $this->doesMetaBoxExist() ) { |
|
| 32 | + if ( !$this->doesMetaBoxExist() ) { |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -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 | /** |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @since 3.0.0 |
| 55 | 55 | */ |
| 56 | - public function enqueueStyles( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
| 56 | + public function enqueueStyles( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
| 57 | 57 | return $this->oResource->_enqueueStyles( $aSRCs, $aPostTypes, $aCustomArgs ); |
| 58 | 58 | } |
| 59 | 59 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param array (optional) The argument array for more advanced parameters. |
| 77 | 77 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 78 | 78 | */ |
| 79 | - public function enqueueStyle( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
| 79 | + public function enqueueStyle( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
| 80 | 80 | return $this->oResource->_enqueueStyle( $sSRC, $aPostTypes, $aCustomArgs ); |
| 81 | 81 | } |
| 82 | 82 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @since 3.0.0 |
| 86 | 86 | */ |
| 87 | - public function enqueueScripts( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
| 87 | + public function enqueueScripts( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
| 88 | 88 | return $this->oResource->_enqueueScripts( $aSRCs, $aPostTypes, $aCustomArgs ); |
| 89 | 89 | } |
| 90 | 90 | /** |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @param array (optional) The argument array for more advanced parameters. |
| 120 | 120 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 121 | 121 | */ |
| 122 | - public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
| 122 | + public function enqueueScript( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
| 123 | 123 | return $this->oResource->_enqueueScript( $sSRC, $aPostTypes, $aCustomArgs ); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | * @param array (optional) The argument array for more advanced parameters. |
| 120 | 120 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 121 | 121 | */ |
| 122 | - public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
| 122 | + public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
| 123 | 123 | return $this->oResource->_enqueueScript( $sSRC, $aPostTypes, $aCustomArgs ); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -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 ) { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @internal |
| 115 | 115 | * @return integer The found post ID. `0` if not found. |
| 116 | 116 | */ |
| 117 | - private function _getPostID() { |
|
| 117 | + private function _getPostID() { |
|
| 118 | 118 | |
| 119 | 119 | // for an editing post page. |
| 120 | 120 | if ( isset( $GLOBALS[ 'post' ]->ID ) ) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | public function _replyToFilterSavingData( $aPostData, $aUnmodified ) { |
| 147 | 147 | |
| 148 | 148 | // Perform initial checks. |
| 149 | - if ( ! $this->_shouldProceedValidation( $aUnmodified ) ) { |
|
| 149 | + if ( ! $this->_shouldProceedValidation( $aUnmodified ) ) { |
|
| 150 | 150 | return $aPostData; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -236,12 +236,12 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | private function _shouldProceedValidation( array $aUnmodified ) { |
| 238 | 238 | |
| 239 | - if ( 'auto-draft' === $aUnmodified[ 'post_status' ] ) { |
|
| 239 | + if ( 'auto-draft' === $aUnmodified[ 'post_status' ] ) { |
|
| 240 | 240 | return false; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Bail if we're doing an auto save |
| 244 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 244 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 245 | 245 | return false; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | * Sets up hooks. |
| 22 | 22 | * @since 3.7.9 |
| 23 | 23 | */ |
| 24 | - public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID=array( 'post' ), $sContext='normal', $sPriority='default', $sCapability='edit_posts', $sTextDomain='admin-page-framework' ) { |
|
| 24 | + public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID = array( 'post' ), $sContext = 'normal', $sPriority = 'default', $sCapability = 'edit_posts', $sTextDomain = 'admin-page-framework' ) { |
|
| 25 | 25 | |
| 26 | 26 | // This is important to set the hooks before the parent constructor |
| 27 | 27 | // as the setUp wil be called in there if the default action hook (current_screen) is already triggered. |
| 28 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
| 29 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToSetUpValidationHooks' ) ); |
|
| 28 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToSetUpHooks' ) ); |
|
| 29 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToSetUpValidationHooks' ) ); |
|
| 30 | 30 | |
| 31 | 31 | parent::__construct( |
| 32 | 32 | $sMetaBoxID, |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | * @callback add_meta_boxes |
| 107 | 107 | */ |
| 108 | 108 | public function _replyToRegisterMetaBoxes() { |
| 109 | - foreach( $this->oProp->aPostTypes as $_sPostType ) { |
|
| 109 | + foreach ( $this->oProp->aPostTypes as $_sPostType ) { |
|
| 110 | 110 | add_meta_box( |
| 111 | - $this->oProp->sMetaBoxID, // id |
|
| 112 | - $this->oProp->sTitle, // title |
|
| 111 | + $this->oProp->sMetaBoxID, // id |
|
| 112 | + $this->oProp->sTitle, // title |
|
| 113 | 113 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
| 114 | - $_sPostType, // post type |
|
| 115 | - $this->oProp->sContext, // context |
|
| 116 | - $this->oProp->sPriority, // priority |
|
| 114 | + $_sPostType, // post type |
|
| 115 | + $this->oProp->sContext, // context |
|
| 116 | + $this->oProp->sPriority, // priority |
|
| 117 | 117 | null // argument - deprecated $this->oForm->aFields |
| 118 | 118 | ); |
| 119 | 119 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @internal |
| 146 | 146 | * @return integer The found post ID. `0` if not found. |
| 147 | 147 | */ |
| 148 | - private function _getPostID() { |
|
| 148 | + private function _getPostID() { |
|
| 149 | 149 | |
| 150 | 150 | // for an editing post page. |
| 151 | 151 | if ( isset( $GLOBALS[ 'post' ]->ID ) ) { |
@@ -177,14 +177,14 @@ discard block |
||
| 177 | 177 | public function _replyToFilterSavingData( $aPostData, $aUnmodified ) { |
| 178 | 178 | |
| 179 | 179 | // Perform initial checks. |
| 180 | - if ( ! $this->_shouldProceedValidation( $aUnmodified ) ) { |
|
| 180 | + if ( !$this->_shouldProceedValidation( $aUnmodified ) ) { |
|
| 181 | 181 | return $aPostData; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // Retrieve the submitted data. |
| 185 | - $_aInputs = $this->oForm->getSubmittedData( |
|
| 186 | - $_POST, // subject data to be parsed |
|
| 187 | - true, // extract data with the fieldset structure |
|
| 185 | + $_aInputs = $this->oForm->getSubmittedData( |
|
| 186 | + $_POST, // subject data to be parsed |
|
| 187 | + true, // extract data with the fieldset structure |
|
| 188 | 188 | false // strip slashes |
| 189 | 189 | ); |
| 190 | 190 | $_aInputsRaw = $_aInputs; // store one for the last input array. |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | $this->oForm->updateMetaDataByType( |
| 222 | - $_iPostID, // object id |
|
| 223 | - $_aInputs, // user submit form data |
|
| 222 | + $_iPostID, // object id |
|
| 223 | + $_aInputs, // user submit form data |
|
| 224 | 224 | $this->oForm->dropRepeatableElements( $_aSavedMeta ), // Drop repeatable section elements from the saved meta array. |
| 225 | 225 | $this->oForm->sStructureType // fields type |
| 226 | 226 | ); |
@@ -277,14 +277,14 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // If our nonce isn't there, or we can't verify it, bail |
| 280 | - if ( ! isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { |
|
| 280 | + if ( !isset( $_POST[ $this->oProp->sMetaBoxID ] ) ) { |
|
| 281 | 281 | return false; |
| 282 | 282 | } |
| 283 | - if ( ! wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { |
|
| 283 | + if ( !wp_verify_nonce( $_POST[ $this->oProp->sMetaBoxID ], $this->oProp->sMetaBoxID ) ) { |
|
| 284 | 284 | return false; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - if ( ! in_array( $aUnmodified[ 'post_type' ], $this->oProp->aPostTypes ) ) { |
|
| 287 | + if ( !in_array( $aUnmodified[ 'post_type' ], $this->oProp->aPostTypes ) ) { |
|
| 288 | 288 | return false; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -20,6 +20,8 @@ |
||
| 20 | 20 | /** |
| 21 | 21 | * Sets up hooks. |
| 22 | 22 | * @since 3.7.9 |
| 23 | + * @param string $sMetaBoxID |
|
| 24 | + * @param string $sTitle |
|
| 23 | 25 | */ |
| 24 | 26 | public function __construct( $sMetaBoxID, $sTitle, $asPostTypeOrScreenID=array( 'post' ), $sContext='normal', $sPriority='default', $sCapability='edit_posts', $sTextDomain='admin-page-framework' ) { |
| 25 | 27 | |
@@ -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,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | // Use nonce for verification |
| 33 | 33 | $_aOutput = array(); |
| 34 | - $_aOutput[] = wp_nonce_field( |
|
| 34 | + $_aOutput[ ] = wp_nonce_field( |
|
| 35 | 35 | $this->oProp->sMetaBoxID, |
| 36 | 36 | $this->oProp->sMetaBoxID, |
| 37 | 37 | true, |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | // Get the fields output. If no field is added, the form object is not instantiated. |
| 42 | 42 | if ( isset( $this->oForm ) ) { |
| 43 | - $_aOutput[] = $this->oForm->get(); |
|
| 43 | + $_aOutput[ ] = $this->oForm->get(); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // Do actions |
| 47 | - $this->oUtil->addAndDoActions( $this, 'do_' . $this->oProp->sClassName, $this ); |
|
| 47 | + $this->oUtil->addAndDoActions( $this, 'do_'.$this->oProp->sClassName, $this ); |
|
| 48 | 48 | |
| 49 | 49 | // Render the filtered output. |
| 50 | 50 | echo $this->oUtil->addAndApplyFilters( |
@@ -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; |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | protected $_aBuiltInRootMenuSlugs = array( |
| 41 | 41 | // All keys must be lower case to support case insensitive look-ups. |
| 42 | 42 | 'dashboard' => 'index.php', |
| 43 | - 'sites' => 'sites.php', // not work |
|
| 44 | - 'themes' => 'themes.php', // not work |
|
| 43 | + 'sites' => 'sites.php', // not work |
|
| 44 | + 'themes' => 'themes.php', // not work |
|
| 45 | 45 | 'plugins' => 'plugins.php', |
| 46 | 46 | 'users' => 'users.php', |
| 47 | 47 | 'settings' => 'settings.php', |
| 48 | - 'updates' => 'update-core.php', // does not work |
|
| 48 | + 'updates' => 'update-core.php', // does not work |
|
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -66,15 +66,15 @@ discard block |
||
| 66 | 66 | * @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`. |
| 67 | 67 | * @return void returns nothing. |
| 68 | 68 | */ |
| 69 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_network', $sTextDomain='admin-page-framework' ){ |
|
| 69 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_network', $sTextDomain = 'admin-page-framework' ) { |
|
| 70 | 70 | |
| 71 | - if ( ! $this->_isInstantiatable() ) { |
|
| 71 | + if ( !$this->_isInstantiatable() ) { |
|
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $sCallerPath = $sCallerPath |
| 76 | 76 | ? $sCallerPath |
| 77 | - : AdminPageFramework_Utility::getCallerScriptPath( __FILE__ ); // this is important to attempt to find the caller script path here when separating the library into multiple files. |
|
| 77 | + : AdminPageFramework_Utility::getCallerScriptPath( __FILE__ ); // this is important to attempt to find the caller script path here when separating the library into multiple files. |
|
| 78 | 78 | |
| 79 | 79 | parent::__construct( $sOptionKey, $sCallerPath, $sCapability, $sTextDomain ); |
| 80 | 80 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
| 159 | 159 | * @return mixed If the field ID is not specified. |
| 160 | 160 | */ |
| 161 | - static public function getOption( $sOptionKey, $asKey=null , $vDefault=null ) { |
|
| 161 | + static public function getOption( $sOptionKey, $asKey = null, $vDefault = null ) { |
|
| 162 | 162 | return AdminPageFramework_WPUtility::getSiteOption( $sOptionKey, $asKey, $vDefault ); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @since 3.0.0 |
| 24 | 24 | */ |
| 25 | - public function enqueueStyles( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 25 | + public function enqueueStyles( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 26 | 26 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
| 27 | 27 | return $this->oResource->_enqueueStyles( $aSRCs, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 28 | 28 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param array (optional) The argument array for more advanced parameters. |
| 39 | 39 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 40 | 40 | */ |
| 41 | - public function enqueueStyle( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 41 | + public function enqueueStyle( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 42 | 42 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
| 43 | 43 | return $this->oResource->_enqueueStyle( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 44 | 44 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @since 2.1.5 |
| 50 | 50 | */ |
| 51 | - public function enqueueScripts( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 51 | + public function enqueueScripts( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 52 | 52 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
| 53 | 53 | return $this->oResource->_enqueueScripts( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 54 | 54 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @param array (optional) The argument array for more advanced parameters. |
| 65 | 65 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 66 | 66 | */ |
| 67 | - public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 67 | + public function enqueueScript( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 68 | 68 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
| 69 | 69 | return $this->oResource->_enqueueScript( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 70 | 70 | } |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | * @param array (optional) The argument array for more advanced parameters. |
| 65 | 65 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 66 | 66 | */ |
| 67 | - public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 67 | + public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 68 | 68 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
| 69 | 69 | return $this->oResource->_enqueueScript( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 70 | 70 | } |
@@ -277,7 +277,7 @@ |
||
| 277 | 277 | ); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - /** |
|
| 280 | + /** |
|
| 281 | 281 | * Extracts meta box form fields options array from the given options array of an admin page. |
| 282 | 282 | * |
| 283 | 283 | * @since 3.5.6 |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | public function _replyToSetUpValidationHooks( $oScreen ) { |
| 47 | 47 | |
| 48 | 48 | // Validation hooks |
| 49 | - foreach( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
| 49 | + foreach ( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
| 50 | 50 | |
| 51 | 51 | if ( is_scalar( $_asTabArrayOrPageSlug ) ) { |
| 52 | 52 | $_sPageSlug = $_asTabArrayOrPageSlug; |
| 53 | - add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
| 53 | + add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
| 54 | 54 | add_filter( "validation_{$_sPageSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
| 55 | 55 | add_filter( "options_update_status_{$_sPageSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
| 56 | 56 | continue; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | // At this point, the array key is the page slug. It means the user specified the tab(s). |
| 60 | 60 | $_sPageSlug = $_sIndexOrPageSlug; |
| 61 | 61 | $_aTabs = $_asTabArrayOrPageSlug; |
| 62 | - foreach( $_aTabs as $_sTabSlug ) { |
|
| 62 | + foreach ( $_aTabs as $_sTabSlug ) { |
|
| 63 | 63 | add_filter( "validation_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
| 64 | 64 | add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
| 65 | 65 | add_filter( "options_update_status_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | * @return void |
| 80 | 80 | * @callback action add_meta_boxes |
| 81 | 81 | */ |
| 82 | - public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
|
| 83 | - foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
| 84 | - if ( is_string( $_asPage ) ) { |
|
| 82 | + public function _replyToRegisterMetaBoxes( $sPageHook = '' ) { |
|
| 83 | + foreach ( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
| 84 | + if ( is_string( $_asPage ) ) { |
|
| 85 | 85 | $this->_registerMetaBox( $_asPage ); |
| 86 | 86 | continue; |
| 87 | 87 | } |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | * @return void |
| 98 | 98 | */ |
| 99 | 99 | private function _registerMetaBoxes( $sPageSlug, $asPage ) { |
| 100 | - foreach( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
| 101 | - if ( ! $this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
| 100 | + foreach ( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
| 101 | + if ( !$this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
| 102 | 102 | continue; |
| 103 | 103 | } |
| 104 | 104 | $this->_registerMetaBox( $sPageSlug ); |
@@ -115,12 +115,12 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | private function _registerMetaBox( $sPageSlug ) { |
| 117 | 117 | add_meta_box( |
| 118 | - $this->oProp->sMetaBoxID, // id |
|
| 119 | - $this->oProp->sTitle, // title |
|
| 118 | + $this->oProp->sMetaBoxID, // id |
|
| 119 | + $this->oProp->sTitle, // title |
|
| 120 | 120 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
| 121 | 121 | $this->oProp->_getScreenIDOfPage( $sPageSlug ), // screen ID |
| 122 | - $this->oProp->sContext, // context |
|
| 123 | - $this->oProp->sPriority, // priority |
|
| 122 | + $this->oProp->sContext, // context |
|
| 123 | + $this->oProp->sPriority, // priority |
|
| 124 | 124 | null // argument (deprecated) |
| 125 | 125 | ); |
| 126 | 126 | } |
@@ -168,17 +168,17 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | $_aNewMetaBoxInputs = $this->oForm->getSubmittedData( $_POST ); |
| 170 | 170 | $_aOldMetaBoxInputs = $this->oUtil->castArrayContents( |
| 171 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 171 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 172 | 172 | $aOldPageOptions // data source |
| 173 | 173 | ); |
| 174 | 174 | |
| 175 | 175 | // Apply filters - third party scripts will have access to the input. |
| 176 | 176 | $_aNewMetaBoxInputsRaw = $_aNewMetaBoxInputs; // copy one for validation errors. |
| 177 | 177 | $_aNewMetaBoxInputs = call_user_func_array( |
| 178 | - array( $this, 'validate' ), // triggers __call() |
|
| 178 | + array( $this, 'validate' ), // triggers __call() |
|
| 179 | 179 | array( $_aNewMetaBoxInputs, $_aOldMetaBoxInputs, $this, $aSubmitInfo ) |
| 180 | 180 | ); // 3.5.3+ |
| 181 | - $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
| 181 | + $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
| 182 | 182 | $this, |
| 183 | 183 | "validation_{$this->oProp->sClassName}", |
| 184 | 184 | $_aNewMetaBoxInputs, |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function _replyToModifyOptionsUpdateStatus( $aStatus ) { |
| 215 | 215 | |
| 216 | - if ( ! $this->hasFieldError() ) { |
|
| 216 | + if ( !$this->hasFieldError() ) { |
|
| 217 | 217 | return $aStatus; |
| 218 | 218 | } |
| 219 | 219 | return array( |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | public function _replyToGetSavedFormData() { |
| 237 | 237 | $_aPageOptions = $this->oUtil->addAndApplyFilter( |
| 238 | 238 | $this, // the caller factory object |
| 239 | - 'options_' . $this->oProp->sClassName, |
|
| 239 | + 'options_'.$this->oProp->sClassName, |
|
| 240 | 240 | $this->oProp->oAdminPage->oProp->aOptions |
| 241 | 241 | ); |
| 242 | 242 | return $this->oUtil->castArrayContents( |
| 243 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 243 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 244 | 244 | $_aPageOptions // data source |
| 245 | 245 | ); |
| 246 | 246 | } |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | private function _getPageMetaBoxOptionsFromPageOptions( array $aPageOptions, array $aFieldsets ) { |
| 257 | 257 | |
| 258 | 258 | $_aOptions = array(); |
| 259 | - foreach( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
| 260 | - if ( '_default' === $_sSectionID ) { |
|
| 261 | - foreach( $_aFieldsets as $_aField ) { |
|
| 259 | + foreach ( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
| 260 | + if ( '_default' === $_sSectionID ) { |
|
| 261 | + foreach ( $_aFieldsets as $_aField ) { |
|
| 262 | 262 | if ( array_key_exists( $_aField[ 'field_id' ], $aPageOptions ) ) { |
| 263 | 263 | $_aOptions[ $_aField[ 'field_id' ] ] = $aPageOptions[ $_aField[ 'field_id' ] ]; |
| 264 | 264 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
| 83 | 83 | foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
| 84 | - if ( is_string( $_asPage ) ) { |
|
| 84 | + if ( is_string( $_asPage ) ) { |
|
| 85 | 85 | $this->_registerMetaBox( $_asPage ); |
| 86 | 86 | continue; |
| 87 | 87 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | private function _registerMetaBoxes( $sPageSlug, $asPage ) { |
| 100 | 100 | foreach( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
| 101 | - if ( ! $this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
| 101 | + if ( ! $this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
| 102 | 102 | continue; |
| 103 | 103 | } |
| 104 | 104 | $this->_registerMetaBox( $sPageSlug ); |