@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Stores section set definitions. |
| 40 | 40 | */ |
| 41 | - public $aSectionsets = array( |
|
| 41 | + public $aSectionsets = array( |
|
| 42 | 42 | '_default' => array( |
| 43 | 43 | 'section_id' => '_default', |
| 44 | 44 | ), |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * Stores field set definitions. |
| 49 | 49 | */ |
| 50 | - public $aFieldsets = array(); |
|
| 50 | + public $aFieldsets = array(); |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Multi-dimensional array holding the saved form data. |
| 54 | 54 | */ |
| 55 | - public $aSavedData = array(); |
|
| 55 | + public $aSavedData = array(); |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * The capability level of the form. |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | * Each secitonset and fieldset has individual capability. If they are not set, |
| 63 | 63 | * This value will be applied. |
| 64 | 64 | */ |
| 65 | - public $sCapability = ''; // default - an empty string |
|
| 65 | + public $sCapability = ''; // default - an empty string |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Stores callback functions. |
| 69 | 69 | * Each value will have a callback. |
| 70 | 70 | */ |
| 71 | - public $aCallbacks = array( |
|
| 71 | + public $aCallbacks = array( |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * @return string The form default capability level. |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | '' // default value |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | - if ( ! $this->canUserView( $this->sCapability ) ) { |
|
| 40 | + if ( !$this->canUserView( $this->sCapability ) ) { |
|
| 41 | 41 | return ''; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @return string |
| 41 | 41 | */ |
| 42 | 42 | private function _getTransientKey() { |
| 43 | - return 'apf_ntc_' . get_current_user_id(); |
|
| 43 | + return 'apf_ntc_'.get_current_user_id(); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | * @param string $sType If empty, the method will check if a message exists in all types. Otherwise, it checks the existence of a message of the specified type. |
| 53 | 53 | * @return boolean True if a setting notice is set; otherwise, false. |
| 54 | 54 | */ |
| 55 | - public function hasNotice( $sType='' ) { |
|
| 55 | + public function hasNotice( $sType = '' ) { |
|
| 56 | 56 | |
| 57 | - if ( ! $sType ) { |
|
| 57 | + if ( !$sType ) { |
|
| 58 | 58 | return ( boolean ) count( self::$_aNotices ); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Check if there is a message of the type. |
| 62 | - foreach( self::$_aNotices as $_aNotice ) { |
|
| 62 | + foreach ( self::$_aNotices as $_aNotice ) { |
|
| 63 | 63 | $_sClassAttribute = $this->getElement( |
| 64 | 64 | $_aNotice, |
| 65 | 65 | array( |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
| 99 | 99 | * @return void |
| 100 | 100 | */ |
| 101 | - public function set( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
| 101 | + public function set( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
| 102 | 102 | |
| 103 | 103 | // If the array is empty, schedule the task of saving the array at shutdown. |
| 104 | 104 | if ( empty( self::$_aNotices ) ) { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $_sID = md5( trim( $sMessage ) ); |
| 109 | 109 | |
| 110 | 110 | // If the override is false and a message is already set, do not add. |
| 111 | - if ( ! $bOverride && isset( self::$_aNotices[ $_sID ] ) ) { |
|
| 111 | + if ( !$bOverride && isset( self::$_aNotices[ $_sID ] ) ) { |
|
| 112 | 112 | return; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -118,14 +118,14 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $_aAttributes = $this->getAsArray( $asAttributes ); |
| 121 | - if ( is_string( $asAttributes ) && ! empty( $asAttributes ) ) { |
|
| 121 | + if ( is_string( $asAttributes ) && !empty( $asAttributes ) ) { |
|
| 122 | 122 | $_aAttributes[ 'id' ] = $asAttributes; |
| 123 | 123 | } |
| 124 | 124 | self::$_aNotices[ $_sID ] = array( |
| 125 | 125 | 'sMessage' => $sMessage, |
| 126 | 126 | 'aAttributes' => $_aAttributes + array( |
| 127 | 127 | 'class' => $sType, |
| 128 | - 'id' => 'form_submit_notice_' . $_sID, |
|
| 128 | + 'id' => 'form_submit_notice_'.$_sID, |
|
| 129 | 129 | ), |
| 130 | 130 | ); |
| 131 | 131 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // By setting false to the 'settings-notice' key, it's possible to disable the notifications set with the framework. |
| 169 | - if ( isset( $_GET[ 'settings-notice' ] ) && ! $_GET[ 'settings-notice' ] ) { |
|
| 169 | + if ( isset( $_GET[ 'settings-notice' ] ) && !$_GET[ 'settings-notice' ] ) { |
|
| 170 | 170 | return; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @return void |
| 117 | 117 | */ |
| 118 | 118 | public function _replyToSaveNotices() { |
| 119 | - if ( empty( self::$_aNotices ) ) { |
|
| 119 | + if ( empty( self::$_aNotices ) ) { |
|
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | $this->setTransient( |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $_iUserID = get_current_user_id(); |
| 138 | 138 | $_aNotices = $this->getTransient( "apf_notices_{$_iUserID}" ); |
| 139 | - if ( false === $_aNotices ) { |
|
| 139 | + if ( false === $_aNotices ) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | $this->deleteTransient( "apf_notices_{$_iUserID}" ); |
| 143 | 143 | |
| 144 | 144 | // By setting false to the 'settings-notice' key, it's possible to disable the notifications set with the framework. |
| 145 | - if ( isset( $_GET[ 'settings-notice' ] ) && ! $_GET[ 'settings-notice' ] ) { |
|
| 145 | + if ( isset( $_GET[ 'settings-notice' ] ) && ! $_GET[ 'settings-notice' ] ) { |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | private $_iLevel; |
| 40 | 40 | |
| 41 | - public function __construct( $iLevel=null ) { |
|
| 41 | + public function __construct( $iLevel = null ) { |
|
| 42 | 42 | $this->_iLevel = null !== $iLevel |
| 43 | 43 | ? $iLeevl |
| 44 | 44 | : error_reporting(); |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | private function _getIncluded() { |
| 58 | 58 | |
| 59 | 59 | $_aIncluded = array(); |
| 60 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
| 60 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
| 61 | 61 | |
| 62 | 62 | // This is where we check if a level was used or not |
| 63 | 63 | if ( $this->_iLevel & $_iLevel ) { |
| 64 | - $_aIncluded[] = $_iLevel; |
|
| 64 | + $_aIncluded[ ] = $_iLevel; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | } |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | $_aValues = array(); |
| 76 | 76 | |
| 77 | 77 | if ( count( $aIncluded ) > $_iAll / 2 ) { |
| 78 | - $_aValues[] = 'E_ALL'; |
|
| 79 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
| 80 | - if ( ! in_array( $_iLevel, $aIncluded ) ) { |
|
| 81 | - $_aValues[] = $iLevelText; |
|
| 78 | + $_aValues[ ] = 'E_ALL'; |
|
| 79 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
| 80 | + if ( !in_array( $_iLevel, $aIncluded ) ) { |
|
| 81 | + $_aValues[ ] = $iLevelText; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | return implode( ' & ~', $_aValues ); |
| 85 | 85 | } |
| 86 | - foreach( $aIncluded as $_iLevel ) { |
|
| 87 | - $_aValues[] = $this->_aLevels[ $_iLevel ]; |
|
| 86 | + foreach ( $aIncluded as $_iLevel ) { |
|
| 87 | + $_aValues[ ] = $this->_aLevels[ $_iLevel ]; |
|
| 88 | 88 | } |
| 89 | 89 | return implode( ' | ', $_aValues ); |
| 90 | 90 | |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | return; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - foreach( ( array ) $GLOBALS[ '_apf_sub_menus_to_sort' ] as $_sIndex => $_sMenuSlug ) { |
|
| 35 | - if ( ! isset( $GLOBALS[ 'submenu' ][ $_sMenuSlug ] ) ) { |
|
| 34 | + foreach ( ( array ) $GLOBALS[ '_apf_sub_menus_to_sort' ] as $_sIndex => $_sMenuSlug ) { |
|
| 35 | + if ( !isset( $GLOBALS[ 'submenu' ][ $_sMenuSlug ] ) ) { |
|
| 36 | 36 | continue; |
| 37 | 37 | } |
| 38 | 38 | ksort( $GLOBALS[ 'submenu' ][ $_sMenuSlug ] ); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param boolean $bTrimDevVer Whether the `.dev` suffix should be removed or not. |
| 52 | 52 | * @return string |
| 53 | 53 | */ |
| 54 | - static public function getFrameworkVersion( $bTrimDevVer=false ) { |
|
| 54 | + static public function getFrameworkVersion( $bTrimDevVer = false ) { |
|
| 55 | 55 | $_sVersion = AdminPageFramework_Registry::getVersion(); |
| 56 | 56 | return $bTrimDevVer |
| 57 | 57 | ? self::getSuffixRemoved( $_sVersion, '.dev' ) |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @since 3.6.0 |
| 23 | 23 | */ |
| 24 | - public $aData = array(); |
|
| 24 | + public $aData = array(); |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Stores the defaulte values. |
| 28 | 28 | */ |
| 29 | - public $aDefault = array(); |
|
| 29 | + public $aDefault = array(); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Sets up properties. |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $_aKeys = func_get_args() + array( null ); |
| 55 | 55 | |
| 56 | 56 | // If no key is specified, return the whole array. |
| 57 | - if ( ! isset( $_aKeys[ 0 ] ) ) { |
|
| 57 | + if ( !isset( $_aKeys[ 0 ] ) ) { |
|
| 58 | 58 | return $this->uniteArrays( |
| 59 | 59 | $this->aData, |
| 60 | 60 | $this->aDefault |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | // Now either the section ID or field ID is given. |
| 71 | 71 | return $this->getArrayValueByArrayKeys( |
| 72 | - $this->aData, // subject array |
|
| 73 | - $_aKeys, // dimensional keys |
|
| 72 | + $this->aData, // subject array |
|
| 73 | + $_aKeys, // dimensional keys |
|
| 74 | 74 | $this->getDefaultValue( // default value |
| 75 | 75 | $_mDefault, |
| 76 | 76 | $_aKeys |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function set( /* $asKeys, $mValue */ ) { |
| 100 | 100 | |
| 101 | - $_aParameters = func_get_args(); |
|
| 102 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
| 101 | + $_aParameters = func_get_args(); |
|
| 102 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | $_asKeys = $_aParameters[ 0 ]; |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function delete( /* $sKey1, $sKey2, $sKey3 ... OR $aKeys */ ) { |
| 125 | 125 | |
| 126 | - $_aParameters = func_get_args(); |
|
| 127 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
| 126 | + $_aParameters = func_get_args(); |
|
| 127 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
| 128 | 128 | return; |
| 129 | 129 | } |
| 130 | 130 | $_asKeys = $_aParameters[ 0 ]; |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Admin Page Framework |
|
| 4 | - * |
|
| 5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
| 6 | - * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
| 7 | - * |
|
| 8 | - */ |
|
| 3 | + * Admin Page Framework |
|
| 4 | + * |
|
| 5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
| 6 | + * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
| 7 | + * |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Provides utility methods which can be accessed among different components of the framework. |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public $sNotice = ''; |
| 35 | 35 | public $aAttributes = array(); |
| 36 | 36 | public $aCallbacks = array( |
| 37 | - 'should_show' => null, // detemines whether the admin notice should be displayed. |
|
| 37 | + 'should_show' => null, // detemines whether the admin notice should be displayed. |
|
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param array $aCallbacks DEVVER+ Stores callbacks. |
| 46 | 46 | * @since 3.5.0 |
| 47 | 47 | */ |
| 48 | - public function __construct( $sNotice, array $aAttributes=array( 'class' => 'error' ), array $aCallbacks=array() ) { |
|
| 48 | + public function __construct( $sNotice, array $aAttributes = array( 'class' => 'error' ), array $aCallbacks = array() ) { |
|
| 49 | 49 | |
| 50 | 50 | $this->aAttributes = $aAttributes + array( |
| 51 | 51 | 'class' => 'error', // 'updated' etc. |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | $this->aAttributes[ 'class' ] = $this->getClassAttribute( |
| 54 | 54 | $this->aAttributes[ 'class' ], |
| 55 | 55 | 'admin-page-framework-settings-notice-message', |
| 56 | - 'admin-page-framework-settings-notice-container', // Moved from `AdminPageFramework_Factory_View`. |
|
| 56 | + 'admin-page-framework-settings-notice-container', // Moved from `AdminPageFramework_Factory_View`. |
|
| 57 | 57 | 'notice', |
| 58 | 58 | 'is-dismissible' // 3.5.12+ |
| 59 | 59 | ); |
| 60 | - $this->aCallbacks = $aCallbacks + $this->aCallbacks; |
|
| 60 | + $this->aCallbacks = $aCallbacks + $this->aCallbacks; |
|
| 61 | 61 | |
| 62 | 62 | // Load resources. |
| 63 | 63 | new AdminPageFramework_AdminNotice___Script; |
| 64 | 64 | |
| 65 | 65 | // An empty value may be set in oreder only to laode the fade-in script. |
| 66 | - if ( ! $sNotice ) { |
|
| 66 | + if ( !$sNotice ) { |
|
| 67 | 67 | return; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function _replyToDisplayAdminNotice() { |
| 86 | 86 | |
| 87 | - if ( ! $this->_shouldProceed() ) { |
|
| 87 | + if ( !$this->_shouldProceed() ) { |
|
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | 'display: none' |
| 96 | 96 | ); |
| 97 | 97 | |
| 98 | - echo "<div " . $this->getAttributes( $_aAttributes ) . ">" |
|
| 98 | + echo "<div ".$this->getAttributes( $_aAttributes ).">" |
|
| 99 | 99 | . "<p>" |
| 100 | 100 | . self::$_aNotices[ $this->sNotice ] |
| 101 | 101 | . "</p>" |
| 102 | 102 | . "</div>" |
| 103 | 103 | // Insert the same message except it is not hidden. |
| 104 | 104 | . "<noscript>" |
| 105 | - . "<div " . $this->getAttributes( $this->aAttributes ) . ">" |
|
| 105 | + . "<div ".$this->getAttributes( $this->aAttributes ).">" |
|
| 106 | 106 | . "<p>" |
| 107 | 107 | . self::$_aNotices[ $this->sNotice ] |
| 108 | 108 | . "</p>" |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | private function _shouldProceed() { |
| 120 | 120 | |
| 121 | - if ( ! is_callable( $this->aCallbacks[ 'should_show' ] ) ) { |
|
| 121 | + if ( !is_callable( $this->aCallbacks[ 'should_show' ] ) ) { |
|
| 122 | 122 | return true; |
| 123 | 123 | } |
| 124 | 124 | return call_user_func_array( |
@@ -38,11 +38,11 @@ |
||
| 38 | 38 | * Retrieves meta data by given keys and type (user or post). |
| 39 | 39 | * @return array |
| 40 | 40 | */ |
| 41 | - static public function getMetaDataByKeys( $iObjectID, $aKeys, $sMetaType='post' ) { |
|
| 41 | + static public function getMetaDataByKeys( $iObjectID, $aKeys, $sMetaType = 'post' ) { |
|
| 42 | 42 | |
| 43 | 43 | $_aSavedMeta = array(); |
| 44 | 44 | |
| 45 | - if ( ! $iObjectID ) { |
|
| 45 | + if ( !$iObjectID ) { |
|
| 46 | 46 | return $_aSavedMeta; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | if ( is_string( $_sCustomMenuSlug ) ) { |
| 29 | 29 | return $_sCustomMenuSlug; |
| 30 | 30 | } |
| 31 | - return 'edit.php?post_type=' . $sPostTypeSlug; |
|
| 31 | + return 'edit.php?post_type='.$sPostTypeSlug; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | static public function getWPAdminDirPath() { |
| 62 | 62 | |
| 63 | 63 | $_sWPAdminPath = str_replace( |
| 64 | - get_bloginfo( 'url' ) . '/', // search |
|
| 65 | - ABSPATH, // replace |
|
| 64 | + get_bloginfo( 'url' ).'/', // search |
|
| 65 | + ABSPATH, // replace |
|
| 66 | 66 | get_admin_url() // subject - works even in the network admin |
| 67 | 67 | ); |
| 68 | 68 | return rtrim( $_sWPAdminPath, '/' ); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @since 3.7.0 |
| 79 | 79 | * @return void |
| 80 | 80 | */ |
| 81 | - static public function goToLocalURL( $sURL, $oCallbackOnError=null ) { |
|
| 81 | + static public function goToLocalURL( $sURL, $oCallbackOnError = null ) { |
|
| 82 | 82 | self::redirectByType( $sURL, 1, $oCallbackOnError ); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @since 3.7.0 Added the second callback parameter. |
| 90 | 90 | * @return void |
| 91 | 91 | */ |
| 92 | - static public function goToURL( $sURL, $oCallbackOnError=null ) { |
|
| 92 | + static public function goToURL( $sURL, $oCallbackOnError = null ) { |
|
| 93 | 93 | self::redirectByType( $sURL, 0, $oCallbackOnError ); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @param integer $iType 0: external site, 1: local site (within the same domain). |
| 100 | 100 | * @param callable $oCallbackOnError |
| 101 | 101 | */ |
| 102 | - static public function redirectByType( $sURL, $iType=0, $oCallbackOnError=null ) { |
|
| 102 | + static public function redirectByType( $sURL, $iType = 0, $oCallbackOnError = null ) { |
|
| 103 | 103 | |
| 104 | 104 | $_iRedirectError = self::getRedirectPreError( $sURL, $iType ); |
| 105 | 105 | if ( $_iRedirectError && is_callable( $oCallbackOnError ) ) { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | static public function getRedirectPreError( $sURL, $iType ) { |
| 131 | 131 | |
| 132 | 132 | // check only externnal urls as local ones can be a relative url and always fails the below check. |
| 133 | - if ( ! $iType && filter_var( $sURL, FILTER_VALIDATE_URL) === false ) { |
|
| 133 | + if ( !$iType && filter_var( $sURL, FILTER_VALIDATE_URL ) === false ) { |
|
| 134 | 134 | return 1; |
| 135 | 135 | } |
| 136 | 136 | // If HTTP headers are already sent, redirect cannot be done. |