@@ -71,6 +71,7 @@ |
||
| 71 | 71 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
| 72 | 72 | * @remark `$aInputs` has only the page elements that called the validation callback. |
| 73 | 73 | * In other words, it does not hold other pages' option keys. |
| 74 | + * @param string $sKeyToReset |
|
| 74 | 75 | * @return array The modified input array. |
| 75 | 76 | */ |
| 76 | 77 | private function _resetOptions( $sKeyToReset, array $aInputs, array $aSubmitInformation ) { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
| 36 | 36 | |
| 37 | - if ( ! $this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
| 37 | + if ( !$this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | 'reset_key' |
| 45 | 45 | ); |
| 46 | 46 | $_sKeyToReset = trim( $_sKeyToReset ); |
| 47 | - if ( ! $_sKeyToReset ) { |
|
| 47 | + if ( !$_sKeyToReset ) { |
|
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | $_oException = new Exception( 'aReturn' ); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @return boolean |
| 62 | 62 | */ |
| 63 | 63 | protected function _shouldProceed( $oFactory, $aSubmits ) { |
| 64 | - return ! $oFactory->hasFieldError(); |
|
| 64 | + return !$oFactory->hasFieldError(); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | $this->_doResetActions( $sKeyToReset, $aInputs, $aSubmitInformation ); |
| 80 | 80 | |
| 81 | 81 | // As of 3.1.0, an empty value is accepted for the option key. |
| 82 | - if ( ! $this->oFactory->oProp->sOptionKey ) { |
|
| 82 | + if ( !$this->oFactory->oProp->sOptionKey ) { |
|
| 83 | 83 | return array(); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // The key to delete is not specified, 1 is sent from the form input. |
| 87 | - if ( in_array( $sKeyToReset, array( '1', ), true ) ) { |
|
| 87 | + if ( in_array( $sKeyToReset, array( '1',), true ) ) { |
|
| 88 | 88 | delete_option( $this->oFactory->oProp->sOptionKey ); |
| 89 | 89 | return array(); |
| 90 | 90 | } |
@@ -233,6 +233,7 @@ discard block |
||
| 233 | 233 | * @param string the tagged HTML link text. |
| 234 | 234 | * @param string (optional) another tagged HTML link text. |
| 235 | 235 | * @param string (optional) add more as many as want by adding items to the next parameters. |
| 236 | + * @param string $sTaggedLinkHTML1 |
|
| 236 | 237 | * @access public |
| 237 | 238 | * @return void |
| 238 | 239 | */ |
@@ -258,6 +259,9 @@ discard block |
||
| 258 | 259 | * @param string the tagged HTML link text. |
| 259 | 260 | * @param string (optional) another tagged HTML link text. |
| 260 | 261 | * @param string (optional) add more as many as want by adding items to the next parameters. |
| 262 | + * @param null|string $sTaggedLinkHTML1 |
|
| 263 | + * @param string $sTaggedLinkHTML2 |
|
| 264 | + * @param string $_and_more |
|
| 261 | 265 | * @access public |
| 262 | 266 | * @return void |
| 263 | 267 | */ |
@@ -277,6 +281,7 @@ discard block |
||
| 277 | 281 | * |
| 278 | 282 | * @since 3.1.0 |
| 279 | 283 | * @since 3.3.1 Moved from `AdminPageFramework`. |
| 284 | + * @param string $sLabel |
|
| 280 | 285 | */ |
| 281 | 286 | public function setPluginSettingsLinkLabel( $sLabel ) { |
| 282 | 287 | $this->oProp->sLabelPluginSettingsLink = $sLabel; |
@@ -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 ) { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @param array $aCustomArgs (optional) The argument array for more advanced parameters. |
| 115 | 115 | * @return array The array holing the queued items. |
| 116 | 116 | */ |
| 117 | - public function enqueueStyles( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 117 | + public function enqueueStyles( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 118 | 118 | return $this->oResource->_enqueueStyles( $aSRCs, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 119 | 119 | } |
| 120 | 120 | /** |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * </ul> |
| 150 | 150 | * @return string The style handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 151 | 151 | */ |
| 152 | - public function enqueueStyle( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 152 | + public function enqueueStyle( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 153 | 153 | return $this->oResource->_enqueueStyle( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 154 | 154 | } |
| 155 | 155 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @param array (optional) The argument array for more advanced parameters. |
| 175 | 175 | * @return array The array holding the queued items. |
| 176 | 176 | */ |
| 177 | - public function enqueueScripts( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 177 | + public function enqueueScripts( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 178 | 178 | return $this->oResource->_enqueueScripts( $aSRCs, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 179 | 179 | } |
| 180 | 180 | /** |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * </ul> |
| 214 | 214 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 215 | 215 | */ |
| 216 | - public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 216 | + public function enqueueScript( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 217 | 217 | return $this->oResource->_enqueueScript( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @access public |
| 237 | 237 | * @return void |
| 238 | 238 | */ |
| 239 | - public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
| 239 | + public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2 = null, $_and_more = null ) { |
|
| 240 | 240 | if ( 'plugins.php' !== $this->oProp->sPageNow ) { |
| 241 | 241 | return; |
| 242 | 242 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @access public |
| 262 | 262 | * @return void |
| 263 | 263 | */ |
| 264 | - public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
| 264 | + public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2 = null, $_and_more = null ) { |
|
| 265 | 265 | |
| 266 | 266 | if ( 'plugins.php' !== $this->oProp->sPageNow ) { |
| 267 | 267 | return; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * @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'. |
| 321 | 321 | * @param string (optional) The ID of the message. If not set, the hash of the message will be used. |
| 322 | 322 | */ |
| 323 | - public function setAdminNotice( $sMessage, $sClassSelector='error', $sID='' ) { |
|
| 323 | + public function setAdminNotice( $sMessage, $sClassSelector = 'error', $sID = '' ) { |
|
| 324 | 324 | |
| 325 | 325 | $sID = $sID ? $sID : md5( $sMessage ); |
| 326 | 326 | |
@@ -357,9 +357,9 @@ discard block |
||
| 357 | 357 | * @param boolean If true, the passed key(s) will be appended to the property; otherwise, it will override the property. |
| 358 | 358 | * @return void |
| 359 | 359 | */ |
| 360 | - public function setDisallowedQueryKeys( $asQueryKeys, $bAppend=true ) { |
|
| 360 | + public function setDisallowedQueryKeys( $asQueryKeys, $bAppend = true ) { |
|
| 361 | 361 | |
| 362 | - if ( ! $bAppend ) { |
|
| 362 | + if ( !$bAppend ) { |
|
| 363 | 363 | $this->oProp->aDisallowedQueryKeys = ( array ) $asQueryKeys; |
| 364 | 364 | return; |
| 365 | 365 | } |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
| 403 | 403 | * @return mixed If the field ID is not specified |
| 404 | 404 | */ |
| 405 | - static public function getOption( $sOptionKey, $asKey=null, $vDefault=null ) { |
|
| 405 | + static public function getOption( $sOptionKey, $asKey = null, $vDefault = null ) { |
|
| 406 | 406 | return AdminPageFramework_WPUtility::getOption( $sOptionKey, $asKey, $vDefault ); |
| 407 | 407 | } |
| 408 | 408 | |
@@ -193,9 +193,6 @@ |
||
| 193 | 193 | * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
| 194 | 194 | * @access public |
| 195 | 195 | * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
| 196 | - * @param string $sSectionID1 the section ID to remove. |
|
| 197 | - * @param string $sSectionID2 (optional) another section ID to remove. |
|
| 198 | - * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
| 199 | 196 | * @return void |
| 200 | 197 | */ |
| 201 | 198 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
@@ -180,24 +180,24 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * Removes the given section(s) by section ID. |
|
| 184 | - * |
|
| 185 | - * This accesses the property storing the added section arrays and removes the specified ones. |
|
| 186 | - * |
|
| 187 | - * <h4>Example</h4> |
|
| 188 | - * <code>$this->removeSettingSections( 'text_fields', 'selectors', 'another_section', 'yet_another_section' ); |
|
| 189 | - * </code> |
|
| 190 | - * |
|
| 191 | - * @since 2.0.0 |
|
| 192 | - * @since 3.0.0 Changed the scope to public from protected. |
|
| 193 | - * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
| 194 | - * @access public |
|
| 195 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 196 | - * @param string $sSectionID1 the section ID to remove. |
|
| 197 | - * @param string $sSectionID2 (optional) another section ID to remove. |
|
| 198 | - * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
| 199 | - * @return void |
|
| 200 | - */ |
|
| 183 | + * Removes the given section(s) by section ID. |
|
| 184 | + * |
|
| 185 | + * This accesses the property storing the added section arrays and removes the specified ones. |
|
| 186 | + * |
|
| 187 | + * <h4>Example</h4> |
|
| 188 | + * <code>$this->removeSettingSections( 'text_fields', 'selectors', 'another_section', 'yet_another_section' ); |
|
| 189 | + * </code> |
|
| 190 | + * |
|
| 191 | + * @since 2.0.0 |
|
| 192 | + * @since 3.0.0 Changed the scope to public from protected. |
|
| 193 | + * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
| 194 | + * @access public |
|
| 195 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 196 | + * @param string $sSectionID1 the section ID to remove. |
|
| 197 | + * @param string $sSectionID2 (optional) another section ID to remove. |
|
| 198 | + * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
| 199 | + * @return void |
|
| 200 | + */ |
|
| 201 | 201 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
| 202 | 202 | foreach( func_get_args() as $_sSectionID ) { |
| 203 | 203 | $this->oForm->removeSection( $_sSectionID ); |
@@ -262,38 +262,38 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | /** |
| 265 | - * Adds the given field array items into the field array property. |
|
| 266 | - * |
|
| 267 | - * Identical to the `addSettingFields()` method except that this method does not accept enumerated parameters. |
|
| 268 | - * |
|
| 269 | - * @since 2.1.2 |
|
| 270 | - * @since 3.0.0 Changed the scope to public from protected. |
|
| 271 | - * @access public |
|
| 272 | - * @param array|string $asField the field array or the target section ID. If the target section ID is set, the section_id key can be omitted from the next passing field array. |
|
| 273 | - * @return void |
|
| 274 | - */ |
|
| 265 | + * Adds the given field array items into the field array property. |
|
| 266 | + * |
|
| 267 | + * Identical to the `addSettingFields()` method except that this method does not accept enumerated parameters. |
|
| 268 | + * |
|
| 269 | + * @since 2.1.2 |
|
| 270 | + * @since 3.0.0 Changed the scope to public from protected. |
|
| 271 | + * @access public |
|
| 272 | + * @param array|string $asField the field array or the target section ID. If the target section ID is set, the section_id key can be omitted from the next passing field array. |
|
| 273 | + * @return void |
|
| 274 | + */ |
|
| 275 | 275 | public function addSettingField( $asField ) { |
| 276 | 276 | $this->oForm->addField( $asField ); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
| 280 | - * Removes the given field(s) by field ID. |
|
| 281 | - * |
|
| 282 | - * This accesses the property storing the added field arrays and removes the specified ones. |
|
| 283 | - * |
|
| 284 | - * <h4>Example</h4> |
|
| 285 | - * <code>$this->removeSettingFields( 'fieldID_A', 'fieldID_B', 'fieldID_C', 'fieldID_D' ); |
|
| 286 | - * </code> |
|
| 287 | - * |
|
| 288 | - * @since 2.0.0 |
|
| 289 | - * @since 3.0.0 Changed the scope to public from protected. |
|
| 290 | - * @access public |
|
| 291 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 292 | - * @param string $sFieldID1 the field ID to remove. |
|
| 293 | - * @param string $sFieldID2 (optional) another field ID to remove. |
|
| 294 | - * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
|
| 295 | - * @return void |
|
| 296 | - */ |
|
| 280 | + * Removes the given field(s) by field ID. |
|
| 281 | + * |
|
| 282 | + * This accesses the property storing the added field arrays and removes the specified ones. |
|
| 283 | + * |
|
| 284 | + * <h4>Example</h4> |
|
| 285 | + * <code>$this->removeSettingFields( 'fieldID_A', 'fieldID_B', 'fieldID_C', 'fieldID_D' ); |
|
| 286 | + * </code> |
|
| 287 | + * |
|
| 288 | + * @since 2.0.0 |
|
| 289 | + * @since 3.0.0 Changed the scope to public from protected. |
|
| 290 | + * @access public |
|
| 291 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 292 | + * @param string $sFieldID1 the field ID to remove. |
|
| 293 | + * @param string $sFieldID2 (optional) another field ID to remove. |
|
| 294 | + * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
|
| 295 | + * @return void |
|
| 296 | + */ |
|
| 297 | 297 | public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more=null ) { |
| 298 | 298 | foreach( func_get_args() as $_sFieldID ) { |
| 299 | 299 | $this->oForm->removeField( $_sFieldID ); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
| 86 | 86 | |
| 87 | - foreach( func_get_args() as $asSection ) { |
|
| 87 | + foreach ( func_get_args() as $asSection ) { |
|
| 88 | 88 | $this->addSettingSection( $asSection ); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function addSettingSection( $asSection ) { |
| 109 | 109 | |
| 110 | - if ( ! is_array( $asSection ) ) { |
|
| 110 | + if ( !is_array( $asSection ) ) { |
|
| 111 | 111 | $this->_sTargetPageSlug = is_string( $asSection ) |
| 112 | 112 | ? $asSection |
| 113 | 113 | : $this->_sTargetPageSlug; |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | ) |
| 130 | 130 | ); |
| 131 | 131 | |
| 132 | - $aSection[ 'section_tab_slug' ] = $this->oUtil->sanitizeSlug( $aSection[ 'section_tab_slug' ] ); |
|
| 132 | + $aSection[ 'section_tab_slug' ] = $this->oUtil->sanitizeSlug( $aSection[ 'section_tab_slug' ] ); |
|
| 133 | 133 | |
| 134 | 134 | // A page slug is required. |
| 135 | - if ( ! $aSection[ 'page_slug' ] ) { |
|
| 135 | + if ( !$aSection[ 'page_slug' ] ) { |
|
| 136 | 136 | return; |
| 137 | 137 | } |
| 138 | 138 | $this->oForm->addSection( $aSection ); |
@@ -148,8 +148,8 @@ discard block |
||
| 148 | 148 | private function _getTargetPageSlug( $aSection ) { |
| 149 | 149 | |
| 150 | 150 | $_sTargetPageSlug = $this->oUtil->getElement( |
| 151 | - $aSection, // subject |
|
| 152 | - 'page_slug', // key |
|
| 151 | + $aSection, // subject |
|
| 152 | + 'page_slug', // key |
|
| 153 | 153 | $this->_sTargetPageSlug // default |
| 154 | 154 | ); |
| 155 | 155 | |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | private function _getTargetTabSlug( $aSection ) { |
| 171 | 171 | $_sTargetTabSlug = $this->oUtil->getElement( |
| 172 | - $aSection, // subject |
|
| 173 | - 'tab_slug', // key |
|
| 172 | + $aSection, // subject |
|
| 173 | + 'tab_slug', // key |
|
| 174 | 174 | $this->_sTargetTabSlug // default |
| 175 | 175 | ); |
| 176 | 176 | $_sTargetTabSlug = $_sTargetTabSlug |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @return void |
| 200 | 200 | */ |
| 201 | 201 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
| 202 | - foreach( func_get_args() as $_sSectionID ) { |
|
| 202 | + foreach ( func_get_args() as $_sSectionID ) { |
|
| 203 | 203 | $this->oForm->removeSection( $_sSectionID ); |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @remark The actual registration will be performed in the <em>_replyToRegisterSettings()</em> method with the <em>admin_menu</em> hook. |
| 258 | 258 | */ |
| 259 | 259 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
| 260 | - foreach( func_get_args() as $aField ) { |
|
| 260 | + foreach ( func_get_args() as $aField ) { |
|
| 261 | 261 | $this->addSettingField( $aField ); |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -294,8 +294,8 @@ discard block |
||
| 294 | 294 | * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
| 295 | 295 | * @return void |
| 296 | 296 | */ |
| 297 | - public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more=null ) { |
|
| 298 | - foreach( func_get_args() as $_sFieldID ) { |
|
| 297 | + public function removeSettingFields( $sFieldID1, $sFieldID2 = null, $_and_more = null ) { |
|
| 298 | + foreach ( func_get_args() as $_sFieldID ) { |
|
| 299 | 299 | $this->oForm->removeField( $_sFieldID ); |
| 300 | 300 | } |
| 301 | 301 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $this->oProp->sOptionKey, |
| 343 | 343 | empty( $_aParams ) |
| 344 | 344 | ? null // will return the entire options array |
| 345 | - : $_aDimensionalKeys, // dimensional keys |
|
| 345 | + : $_aDimensionalKeys, // dimensional keys |
|
| 346 | 346 | $_mDefault, // default |
| 347 | 347 | $this->getSavedOptions() + $this->oForm->getDefaultFormValues() |
| 348 | 348 | ); |
@@ -361,21 +361,21 @@ discard block |
||
| 361 | 361 | * If the user has not submitted the form, the framework will try to return the default value set in the field definition array. |
| 362 | 362 | * @deprecated 3.3.0 |
| 363 | 363 | */ |
| 364 | - public function getFieldValue( $sFieldID, $sSectionID='' ) { |
|
| 364 | + public function getFieldValue( $sFieldID, $sSectionID = '' ) { |
|
| 365 | 365 | |
| 366 | 366 | $this->oUtil->showDeprecationNotice( |
| 367 | - 'The method,' . __METHOD__ . ',', // deprecated item |
|
| 367 | + 'The method,'.__METHOD__.',', // deprecated item |
|
| 368 | 368 | 'getValue()' // alternative |
| 369 | 369 | ); |
| 370 | 370 | |
| 371 | 371 | $_aOptions = $this->oUtil->uniteArrays( $this->oProp->aOptions, $this->oForm->getDefaultFormValues() ); |
| 372 | 372 | /* If it's saved, return it */ |
| 373 | - if ( ! $sSectionID ) { |
|
| 373 | + if ( !$sSectionID ) { |
|
| 374 | 374 | if ( array_key_exists( $sFieldID, $_aOptions ) ) { |
| 375 | 375 | return $_aOptions[ $sFieldID ]; |
| 376 | 376 | } |
| 377 | 377 | // loop through section elements |
| 378 | - foreach( $_aOptions as $aOptions ) { |
|
| 378 | + foreach ( $_aOptions as $aOptions ) { |
|
| 379 | 379 | if ( array_key_exists( $sFieldID, $aOptions ) ) { |
| 380 | 380 | return $aOptions[ $sFieldID ]; |
| 381 | 381 | } |
@@ -51,43 +51,6 @@ discard block |
||
| 51 | 51 | * @since 2.0.0 |
| 52 | 52 | * @since 3.0.0 Changed the scope to public. Added page slug target support. |
| 53 | 53 | * @since 3.3.1 Moved from `AdminPageFramework_Page`. |
| 54 | - * @param array $aTab1 The in-page tab array. |
|
| 55 | - * <h4>In-Page Tab Array</h4> |
|
| 56 | - * <ul> |
|
| 57 | - * <li>**page_slug** - (string) the page slug that the tab belongs to.</li> |
|
| 58 | - * <li>**tab_slug** - (string) the tab slug. Non-alphabetical characters should not be used including dots(.) and hyphens(-).</li> |
|
| 59 | - * <li>**title** - (string) the title of the tab.</li> |
|
| 60 | - * <li>**order** - (optional, integer) the order number of the tab. The lager the number is, the lower the position it is placed in the menu.</li> |
|
| 61 | - * <li>**show_in_page_tab** - (optional, boolean) default: `true`. If this is set to `false`, the tab title will not be displayed in the tab navigation menu; however, it is still accessible from the direct URL.</li> |
|
| 62 | - * <li>**parent_tab_slug** - (optional, string) this needs to be set if the above `show_in_page_tab` argument is `false` so that the parent tab will be emphasized as active when the hidden page is accessed.</li> |
|
| 63 | - * <li>**url** - [3.5.0+] (optional, string) If this is set, the link url of the navigation tab will be this url. Use this to create link only tab.</li> |
|
| 64 | - * <li>**capability** - [3.6.0+] (optional, string) The capability level.</li> |
|
| 65 | - * <li>**if** - [3.6.0+] (optional, boolean) Whether the tab should be displayed or not.</li> |
|
| 66 | - * <li>style - [3.6.3+] (optional) (string|array) The path or url of a stylesheet which gets loaded in the head tag. Or inline CSS rules. |
|
| 67 | - * When custom arguments need to be set such as whether it should be inserted in the footer, set an array holding the following arguments. |
|
| 68 | - * <ul> |
|
| 69 | - * <li>src - (required, string) the source url or path.</li> |
|
| 70 | - * <li>handle_id - (optional, string) The handle ID of the stylesheet.</li> |
|
| 71 | - * <li>dependencies - (optional, array) The dependency array.</li> |
|
| 72 | - * <li>version - (optional, string) The stylesheet version number.</li> |
|
| 73 | - * <li>media - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
| 74 | - * </ul> |
|
| 75 | - * </li> |
|
| 76 | - * <li>script - [3.6.3+] (optional) (string|array) The path or url of a JavaScript script which gets loaded in the head tag. Or an inline JavaScript script. |
|
| 77 | - * When custom arguments need to be set such as whether it should be inserted in the footer, set an array holding the following arguments. |
|
| 78 | - * <ul> |
|
| 79 | - * <li>src - (required, string) the source url or path.</li> |
|
| 80 | - * <li>handle_id - (optional, string) The handle ID of the stylesheet.</li> |
|
| 81 | - * <li>dependencies - (optional, array) The dependency array.</li> |
|
| 82 | - * <li>version - (optional, string) The stylesheet version number.</li> |
|
| 83 | - * <li>translation - (optional, array) an array holding translation key-value pairs.</li> |
|
| 84 | - * </ul> |
|
| 85 | - * </li> |
|
| 86 | - * <li>show_debug_info - [3.8.8+] (optional, boolean) Whether to show debug information. If `WP_DEBUG` is false, the debug output will not be displayed. Default: `true`.</li> |
|
| 87 | - * </ul> |
|
| 88 | - * @param array $aTab2 Another in-page tab array. |
|
| 89 | - * @param array $_and_more (optional) Add in-page tab arrays as many as necessary to the next parameters. |
|
| 90 | - * @param string $sPageSlug (optional) If the passed parameter item is a string, it will be stored as the target page slug so that it will be applied to the next passed tab arrays as the page_slug element. |
|
| 91 | 54 | * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
| 92 | 55 | * @remark In-page tabs are different from page-heading tabs which is automatically added with page titles. |
| 93 | 56 | * @return void |
@@ -277,6 +240,10 @@ discard block |
||
| 277 | 240 | /** |
| 278 | 241 | * Sets a page property. |
| 279 | 242 | * @since 3.6.0 |
| 243 | + * @param string $sPropertyName |
|
| 244 | + * @param string $sPropertyKey |
|
| 245 | + * @param boolean|string $mValue |
|
| 246 | + * @param string $sPageSlug |
|
| 280 | 247 | * @return void |
| 281 | 248 | */ |
| 282 | 249 | private function _setPageProperty( $sPropertyName, $sPropertyKey, $mValue, $sPageSlug ) { |
@@ -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 | } |
@@ -25,6 +25,7 @@ |
||
| 25 | 25 | * Sets up hooks and properties. |
| 26 | 26 | * |
| 27 | 27 | * @internal |
| 28 | + * @param AdminPageFramework_PostType_Model $oFactory |
|
| 28 | 29 | */ |
| 29 | 30 | public function __construct( $oFactory ) { |
| 30 | 31 | |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - /** |
|
| 95 | + /** |
|
| 96 | 96 | * Resets the rewrite rules for custom post types. |
| 97 | 97 | * |
| 98 | 98 | * This must be done after the post type is registered. So the shutdown action hook is used. |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function __construct( $oFactory ) { |
| 30 | 30 | |
| 31 | - if ( ! $this->_shouldProceed( $oFactory ) ) { |
|
| 31 | + if ( !$this->_shouldProceed( $oFactory ) ) { |
|
| 32 | 32 | return; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | private function _shouldProceed( $oFactory ) { |
| 55 | 55 | |
| 56 | - if ( ! $oFactory->oProp->bIsAdmin ) { |
|
| 56 | + if ( !$oFactory->oProp->bIsAdmin ) { |
|
| 57 | 57 | return false; |
| 58 | 58 | } |
| 59 | - if ( ! $oFactory->oProp->sCallerPath ) { |
|
| 59 | + if ( !$oFactory->oProp->sCallerPath ) { |
|
| 60 | 60 | return false; |
| 61 | 61 | } |
| 62 | 62 | return 'plugin' === $oFactory->oProp->sScriptType; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // If the execution flow in the plugin activation hook, schedule flushing rewrite rules. |
| 89 | - if ( did_action( 'activate_' . plugin_basename( $this->oFactory->oProp->sCallerPath ) ) ) { |
|
| 89 | + if ( did_action( 'activate_'.plugin_basename( $this->oFactory->oProp->sCallerPath ) ) ) { |
|
| 90 | 90 | add_action( 'shutdown', array( $this, '_replyToFlushRewriteRules' ) ); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -25,6 +25,7 @@ discard block |
||
| 25 | 25 | * Sets up hooks and properties. |
| 26 | 26 | * |
| 27 | 27 | * @internal |
| 28 | + * @param AdminPageFramework_PostType_Model $oFactory |
|
| 28 | 29 | */ |
| 29 | 30 | public function __construct( $oFactory ) { |
| 30 | 31 | |
@@ -81,6 +82,7 @@ discard block |
||
| 81 | 82 | |
| 82 | 83 | /** |
| 83 | 84 | * @since 3.7.4 |
| 85 | + * @param string $sSubMenuSlug |
|
| 84 | 86 | */ |
| 85 | 87 | private function _setSubMenuSlugForSorting( $sSubMenuSlug ) { |
| 86 | 88 | |
@@ -93,6 +95,7 @@ discard block |
||
| 93 | 95 | |
| 94 | 96 | /** |
| 95 | 97 | * @since 3.7.4 |
| 98 | + * @param string $sSubMenuSlug |
|
| 96 | 99 | */ |
| 97 | 100 | private function _setSubMenuItemIndex( $sSubMenuSlug ) { |
| 98 | 101 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $this->oFactory = $oFactory; |
| 32 | 32 | |
| 33 | - if ( ! $oFactory->oProp->bIsAdmin ) { |
|
| 33 | + if ( !$oFactory->oProp->bIsAdmin ) { |
|
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | add_action( |
| 48 | 48 | 'admin_menu', |
| 49 | - array( $this, 'sortAdminSubMenu' ), // defined in the framework utility class. |
|
| 49 | + array( $this, 'sortAdminSubMenu' ), // defined in the framework utility class. |
|
| 50 | 50 | 9999 |
| 51 | 51 | ); |
| 52 | 52 | |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | // Check the post type `show_ui` and other related UI arguments. |
| 63 | 63 | $_bsShowInMeenu = $this->getShowInMenuPostTypeArgument( $this->oFactory->oProp->aPostTypeArgs ); |
| 64 | - if ( ! $_bsShowInMeenu ) { |
|
| 64 | + if ( !$_bsShowInMeenu ) { |
|
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // If the user sets a menu slug to the 'show_in_menu' argument, use that. |
| 69 | 69 | // It is used to set a custom post type sub-menu belong to another menu. |
| 70 | - $_sSubMenuSlug = is_string( $_bsShowInMeenu ) |
|
| 70 | + $_sSubMenuSlug = is_string( $_bsShowInMeenu ) |
|
| 71 | 71 | ? $_bsShowInMeenu |
| 72 | - : 'edit.php?post_type=' . $this->oFactory->oProp->sPostType; |
|
| 72 | + : 'edit.php?post_type='.$this->oFactory->oProp->sPostType; |
|
| 73 | 73 | |
| 74 | 74 | // Set the index to the framework specific global array for sorting. |
| 75 | 75 | $this->_setSubMenuSlugForSorting( $_sSubMenuSlug ); |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | // @remark This is the partial link url set in the third element ( index of 2 ) in the third dimension of submenu global array element. |
| 132 | 132 | // This is not the submenu slug. |
| 133 | - $_sLinkSlugManage = 'edit.php?post_type=' . $this->oFactory->oProp->sPostType; |
|
| 133 | + $_sLinkSlugManage = 'edit.php?post_type='.$this->oFactory->oProp->sPostType; |
|
| 134 | 134 | |
| 135 | 135 | $_aLinkSlugs = array( |
| 136 | 136 | $_sLinkSlugManage => $_nSubMenuOrderManage, |
| 137 | - 'post-new.php?post_type=' . $this->oFactory->oProp->sPostType => $_nSubMenuOrderAddNew, |
|
| 137 | + 'post-new.php?post_type='.$this->oFactory->oProp->sPostType => $_nSubMenuOrderAddNew, |
|
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | 140 | // If the user does not set a custom value, unset it |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | // If the user does not want to show the Add New sub menu, no need to change the order. |
| 146 | - if ( ! $_bShowAddNew || 10 == $_nSubMenuOrderAddNew ) { |
|
| 147 | - unset( $_aLinkSlugs[ 'post-new.php?post_type=' . $this->oFactory->oProp->sPostType ] ); |
|
| 146 | + if ( !$_bShowAddNew || 10 == $_nSubMenuOrderAddNew ) { |
|
| 147 | + unset( $_aLinkSlugs[ 'post-new.php?post_type='.$this->oFactory->oProp->sPostType ] ); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | return $_aLinkSlugs; |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | private function _setSubMenuIndexByLinksSlugs( $sSubMenuSlug, array $aLinkSlugs ) { |
| 166 | 166 | |
| 167 | - foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sSubMenuSlug ) ) as $_nIndex => $_aSubMenuItem ) { |
|
| 167 | + foreach ( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sSubMenuSlug ) ) as $_nIndex => $_aSubMenuItem ) { |
|
| 168 | 168 | |
| 169 | - foreach( $aLinkSlugs as $_sLinkSlug => $_nOrder ) { |
|
| 169 | + foreach ( $aLinkSlugs as $_sLinkSlug => $_nOrder ) { |
|
| 170 | 170 | |
| 171 | 171 | $_bIsSet = $this->_setSubMenuIndexByLinksSlug( $sSubMenuSlug, $_nIndex, $_aSubMenuItem, $_sLinkSlug, $_nOrder ); |
| 172 | 172 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | private function _setSubMenuIndexByLinksSlug( $sSubMenuSlug, $nIndex, $aSubMenuItem, $sLinkSlug, $nOrder ) { |
| 193 | 193 | |
| 194 | 194 | // The third item is the link slug. |
| 195 | - if ( ! isset( $aSubMenuItem[ 2 ] ) ) { |
|
| 195 | + if ( !isset( $aSubMenuItem[ 2 ] ) ) { |
|
| 196 | 196 | return false; |
| 197 | 197 | } |
| 198 | 198 | if ( $aSubMenuItem[ 2 ] !== $sLinkSlug ) { |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * |
| 70 | 70 | * @since 3.7.0 |
| 71 | 71 | * @see https://codex.wordpress.org/Plugin_API/Admin_Screen_Reference |
| 72 | - * @param array|strin $asScreenIDs Screen IDs or page slug. |
|
| 72 | + * @param string[] $asScreenIDs Screen IDs or page slug. |
|
| 73 | 73 | * @param string $sPointerID A unique pointer ID. |
| 74 | 74 | * @param array $aPointerData The pointer data. |
| 75 | 75 | * <h4>Arguments</h4> |
@@ -213,7 +213,7 @@ |
||
| 213 | 213 | get_current_user_id(), |
| 214 | 214 | 'dismissed_wp_pointers', |
| 215 | 215 | true |
| 216 | - ) |
|
| 216 | + ) |
|
| 217 | 217 | ); |
| 218 | 218 | $_aValidPointers = array(); |
| 219 | 219 | |
@@ -111,18 +111,18 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | private function _setHooks( $aScreenIDs ) { |
| 113 | 113 | |
| 114 | - foreach( $aScreenIDs as $_sScreenID ) { |
|
| 115 | - if ( ! $_sScreenID ) { |
|
| 114 | + foreach ( $aScreenIDs as $_sScreenID ) { |
|
| 115 | + if ( !$_sScreenID ) { |
|
| 116 | 116 | continue; |
| 117 | 117 | } |
| 118 | 118 | add_filter( |
| 119 | - get_class( $this ) . '-' . $_sScreenID, |
|
| 119 | + get_class( $this ).'-'.$_sScreenID, |
|
| 120 | 120 | array( $this, '_replyToSetPointer' ) |
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if ( ! $this->_hasBeenCalled() ) { |
|
| 125 | + if ( !$this->_hasBeenCalled() ) { |
|
| 126 | 126 | return; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $_aPointers = $this->_getValidPointers( $this->_getPointers() ); |
| 171 | 171 | |
| 172 | - if ( empty( $_aPointers ) || ! is_array( $_aPointers ) ) { |
|
| 172 | + if ( empty( $_aPointers ) || !is_array( $_aPointers ) ) { |
|
| 173 | 173 | return; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | $_oScreen = get_current_screen(); |
| 190 | 190 | $_sScreenID = $_oScreen->id; |
| 191 | 191 | if ( in_array( $_sScreenID, $this->aScreenIDs ) ) { |
| 192 | - return apply_filters( get_class( $this ) . '-' . $_sScreenID, array() ); |
|
| 192 | + return apply_filters( get_class( $this ).'-'.$_sScreenID, array() ); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if ( isset( $_GET[ 'page' ] ) ) { |
| 196 | - return apply_filters( get_class( $this ) . '-' . $_GET[ 'page' ], array() ); |
|
| 196 | + return apply_filters( get_class( $this ).'-'.$_GET[ 'page' ], array() ); |
|
| 197 | 197 | } |
| 198 | 198 | return array(); |
| 199 | 199 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | private function _getValidPointers( $_aPointers ) { |
| 208 | 208 | |
| 209 | 209 | // Get dismissed pointers |
| 210 | - $_aDismissed = explode( |
|
| 210 | + $_aDismissed = explode( |
|
| 211 | 211 | ',', |
| 212 | 212 | ( string ) get_user_meta( |
| 213 | 213 | get_current_user_id(), |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $_aPointer[ 'pointer_id' ] = $_iPointerID; |
| 236 | 236 | |
| 237 | 237 | // Add the pointer to $_aValidPointers array |
| 238 | - $_aValidPointers[] = $_aPointer; |
|
| 238 | + $_aValidPointers[ ] = $_aPointer; |
|
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | return $_aValidPointers; |
@@ -311,9 +311,9 @@ discard block |
||
| 311 | 311 | * @return string |
| 312 | 312 | * @internal |
| 313 | 313 | */ |
| 314 | - public function _getInternalScript( $aPointers=array() ) { |
|
| 314 | + public function _getInternalScript( $aPointers = array() ) { |
|
| 315 | 315 | |
| 316 | - $_aJSArray = json_encode( $aPointers ); |
|
| 316 | + $_aJSArray = json_encode( $aPointers ); |
|
| 317 | 317 | |
| 318 | 318 | /** |
| 319 | 319 | * Checks check-boxes in siblings. |
@@ -92,7 +92,6 @@ discard block |
||
| 92 | 92 | * 'code_block' => ..., |
| 93 | 93 | * |
| 94 | 94 | * )</code> |
| 95 | - * @param array $aOptions The options array which determines the behaviour of the class. |
|
| 96 | 95 | * @since 3.5.0 |
| 97 | 96 | * @since 3.6.0 Made it accept string content to be passed to the first parameter. |
| 98 | 97 | */ |
@@ -167,6 +166,7 @@ discard block |
||
| 167 | 166 | * Returns the parsed text. |
| 168 | 167 | * @since 3.5.0 |
| 169 | 168 | * @internal |
| 169 | + * @param string $sContent |
|
| 170 | 170 | */ |
| 171 | 171 | private function _getParsedText( $sContent ) { |
| 172 | 172 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @since 3.5.0 |
| 97 | 97 | * @since 3.6.0 Made it accept string content to be passed to the first parameter. |
| 98 | 98 | */ |
| 99 | - public function __construct( $sFilePathOrContent='', array $aReplacements=array(), array $aCallbacks=array() ) { |
|
| 99 | + public function __construct( $sFilePathOrContent = '', array $aReplacements = array(), array $aCallbacks = array() ) { |
|
| 100 | 100 | |
| 101 | 101 | $this->sText = file_exists( $sFilePathOrContent ) |
| 102 | 102 | ? file_get_contents( $sFilePathOrContent ) |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | '/^[\s]*==[\s]*(.+?)[\s]*==/m', |
| 133 | 133 | $sText, |
| 134 | 134 | -1, |
| 135 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
| 135 | + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
| 136 | 136 | ); |
| 137 | 137 | return $_aSections; |
| 138 | 138 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @since 3.5.0 |
| 144 | 144 | * @return string |
| 145 | 145 | */ |
| 146 | - public function get( $sSectionName='' ) { |
|
| 146 | + public function get( $sSectionName = '' ) { |
|
| 147 | 147 | return $sSectionName |
| 148 | 148 | ? $this->getSection( $sSectionName ) |
| 149 | 149 | : $this->_getParsedText( $this->sText ); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function _replyToReplaceCodeBlocks( $aMatches ) { |
| 207 | 207 | |
| 208 | - if ( ! isset( $aMatches[ 1 ] ) ) { |
|
| 208 | + if ( !isset( $aMatches[ 1 ] ) ) { |
|
| 209 | 209 | return $aMatches[ 0 ]; |
| 210 | 210 | } |
| 211 | 211 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function getRawSection( $sSectionName ) { |
| 230 | 230 | |
| 231 | - $_iIndex = array_search( $sSectionName, $this->_aSections ); |
|
| 231 | + $_iIndex = array_search( $sSectionName, $this->_aSections ); |
|
| 232 | 232 | return false === $_iIndex |
| 233 | 233 | ? '' |
| 234 | 234 | : trim( $this->_aSections[ $_iIndex + 1 ] ); |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | // If <?php notation is missing, highlight_string() will not highlight the syntax so add it. |
| 249 | 249 | $_bHasPHPTag = "<?php" === substr( $sCode, 0, 5 ); |
| 250 | 250 | |
| 251 | - $sCode = $_bHasPHPTag ? $sCode : "<?php " . $sCode; |
|
| 251 | + $sCode = $_bHasPHPTag ? $sCode : "<?php ".$sCode; |
|
| 252 | 252 | |
| 253 | 253 | $sCode = str_replace( '"', "'", $sCode ); // highlight_string() crashes if double quotes are contained in the code. |
| 254 | 254 | $sCode = highlight_string( $sCode, true ); |
@@ -194,6 +194,7 @@ discard block |
||
| 194 | 194 | * Returns a php warning if present. |
| 195 | 195 | * @since 3.5.3 |
| 196 | 196 | * @internal |
| 197 | + * @param string $sType |
|
| 197 | 198 | * @return string The warning. |
| 198 | 199 | */ |
| 199 | 200 | private function _getWarningByType( $sType ) { |
@@ -293,6 +294,7 @@ discard block |
||
| 293 | 294 | * if it returns non true (false), it stores the subject warning and returns the array holding the warnings. |
| 294 | 295 | * |
| 295 | 296 | * @since 3.4.6 |
| 297 | + * @param string $sFuncName |
|
| 296 | 298 | * @return array The warning array. |
| 297 | 299 | * @internal |
| 298 | 300 | */ |
@@ -349,7 +349,7 @@ |
||
| 349 | 349 | ? "<strong>" . $this->_sScriptName . "</strong>: " |
| 350 | 350 | : ''; |
| 351 | 351 | return $_sScripTitle |
| 352 | - . implode( '<br />', $_aWarnings ); |
|
| 352 | + . implode( '<br />', $_aWarnings ); |
|
| 353 | 353 | |
| 354 | 354 | } |
| 355 | 355 | |
@@ -135,12 +135,12 @@ discard block |
||
| 135 | 135 | * </ul> |
| 136 | 136 | * @param string $sScriptName The script name. |
| 137 | 137 | */ |
| 138 | - public function __construct( array $aRequirements=array(), $sScriptName='' ) { |
|
| 138 | + public function __construct( array $aRequirements = array(), $sScriptName = '' ) { |
|
| 139 | 139 | |
| 140 | 140 | // Avoid undefined index warnings. |
| 141 | 141 | $aRequirements = $aRequirements + $this->_aDefaultRequirements; |
| 142 | 142 | $aRequirements = array_filter( $aRequirements, 'is_array' ); |
| 143 | - foreach( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
| 143 | + foreach ( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
| 144 | 144 | if ( isset( $aRequirements[ $_sName ] ) ) { |
| 145 | 145 | $aRequirements[ $_sName ] = $aRequirements[ $_sName ] + $this->_aDefaultRequirements[ $_sName ]; |
| 146 | 146 | } |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | $_aWarnings = array(); |
| 166 | 166 | |
| 167 | 167 | // PHP, WordPress, MySQL |
| 168 | - $_aWarnings[] = $this->_getWarningByType( 'php' ); |
|
| 169 | - $_aWarnings[] = $this->_getWarningByType( 'wordpress' ); |
|
| 170 | - $_aWarnings[] = $this->_getWarningByType( 'mysql' ); |
|
| 168 | + $_aWarnings[ ] = $this->_getWarningByType( 'php' ); |
|
| 169 | + $_aWarnings[ ] = $this->_getWarningByType( 'wordpress' ); |
|
| 170 | + $_aWarnings[ ] = $this->_getWarningByType( 'mysql' ); |
|
| 171 | 171 | |
| 172 | 172 | // Ensure necessary array elements. |
| 173 | 173 | $this->_aRequirements = $this->_aRequirements + array( |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | // Check the rest. |
| 181 | 181 | $_aWarnings = array_merge( |
| 182 | 182 | $_aWarnings, |
| 183 | - $this->_checkFunctions( $this->_aRequirements['functions'] ), |
|
| 184 | - $this->_checkClasses( $this->_aRequirements['classes'] ), |
|
| 185 | - $this->_checkConstants( $this->_aRequirements['constants'] ), |
|
| 186 | - $this->_checkFiles( $this->_aRequirements['files'] ) |
|
| 183 | + $this->_checkFunctions( $this->_aRequirements[ 'functions' ] ), |
|
| 184 | + $this->_checkClasses( $this->_aRequirements[ 'classes' ] ), |
|
| 185 | + $this->_checkConstants( $this->_aRequirements[ 'constants' ] ), |
|
| 186 | + $this->_checkFiles( $this->_aRequirements[ 'files' ] ) |
|
| 187 | 187 | ); |
| 188 | 188 | |
| 189 | 189 | $this->aWarnings = array_filter( $_aWarnings ); // drop empty elements. |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @return string The warning. |
| 198 | 198 | */ |
| 199 | 199 | private function _getWarningByType( $sType ) { |
| 200 | - if ( ! isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
| 200 | + if ( !isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
| 201 | 201 | return ''; |
| 202 | 202 | } |
| 203 | 203 | if ( $this->_checkPHPVersion( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * @internal |
| 227 | 227 | */ |
| 228 | 228 | private function _checkWordPressVersion( $sWordPressVersion ) { |
| 229 | - return version_compare( $GLOBALS['wp_version'], $sWordPressVersion, ">=" ); |
|
| 229 | + return version_compare( $GLOBALS[ 'wp_version' ], $sWordPressVersion, ">=" ); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
| 300 | 300 | $_aWarnings = array(); |
| 301 | - foreach( $aSubjects as $_sSubject => $_sWarning ) { |
|
| 302 | - if ( ! call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
| 303 | - $_aWarnings[] = sprintf( $_sWarning, $_sSubject ); |
|
| 301 | + foreach ( $aSubjects as $_sSubject => $_sWarning ) { |
|
| 302 | + if ( !call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
| 303 | + $_aWarnings[ ] = sprintf( $_sWarning, $_sSubject ); |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | return $_aWarnings; |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | */ |
| 323 | 323 | public function _replyToPrintAdminNotices() { |
| 324 | 324 | |
| 325 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
| 325 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
| 326 | 326 | if ( empty( $_aWarnings ) ) { |
| 327 | 327 | return; |
| 328 | 328 | } |
@@ -341,12 +341,12 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | private function _getWarnings() { |
| 343 | 343 | |
| 344 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
| 344 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
| 345 | 345 | if ( empty( $_aWarnings ) ) { |
| 346 | 346 | return ''; |
| 347 | 347 | } |
| 348 | - $_sScripTitle = $this->_sScriptName |
|
| 349 | - ? "<strong>" . $this->_sScriptName . "</strong>: " |
|
| 348 | + $_sScripTitle = $this->_sScriptName |
|
| 349 | + ? "<strong>".$this->_sScriptName."</strong>: " |
|
| 350 | 350 | : ''; |
| 351 | 351 | return $_sScripTitle |
| 352 | 352 | . implode( '<br />', $_aWarnings ); |
@@ -361,12 +361,12 @@ discard block |
||
| 361 | 361 | * @param boolean $bIsOnActivation Whether it is called upon plugin activation hook. |
| 362 | 362 | * @return void |
| 363 | 363 | */ |
| 364 | - public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
|
| 364 | + public function deactivatePlugin( $sPluginFilePath, $sMessage = '', $bIsOnActivation = false ) { |
|
| 365 | 365 | |
| 366 | 366 | add_action( 'admin_notices', array( $this, '_replyToPrintAdminNotices' ) ); |
| 367 | - $this->aWarnings[] = '<strong>' . $sMessage . '</strong>'; |
|
| 368 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
| 369 | - if ( ! @include( preg_replace( '/[\/\\\\]wp-content$/', '', rtrim( WP_CONTENT_DIR, '/\\' ) ) . '/wp-admin/includes/plugin.php' ) ) { |
|
| 367 | + $this->aWarnings[ ] = '<strong>'.$sMessage.'</strong>'; |
|
| 368 | + if ( !function_exists( 'deactivate_plugins' ) ) { |
|
| 369 | + if ( !@include( preg_replace( '/[\/\\\\]wp-content$/', '', rtrim( WP_CONTENT_DIR, '/\\' ) ).'/wp-admin/includes/plugin.php' ) ) { |
|
| 370 | 370 | return; |
| 371 | 371 | } |
| 372 | 372 | } |
@@ -376,8 +376,8 @@ discard block |
||
| 376 | 376 | // Before that, we can display messages to the user. |
| 377 | 377 | if ( $bIsOnActivation ) { |
| 378 | 378 | |
| 379 | - $_sPluginListingPage = add_query_arg( array(), $GLOBALS['pagenow'] ); |
|
| 380 | - wp_die( $this->_getWarnings() . "<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
| 379 | + $_sPluginListingPage = add_query_arg( array(), $GLOBALS[ 'pagenow' ] ); |
|
| 380 | + wp_die( $this->_getWarnings()."<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
| 381 | 381 | |
| 382 | 382 | } |
| 383 | 383 | |