@@ -60,6 +60,7 @@ discard block |
||
| 60 | 60 | * @since 3.3.1 Moved from `AdminPageFramework_Page`. |
| 61 | 61 | * @since 3.5.3 Deprecated the `$aOutput` parameter. |
| 62 | 62 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. Changed the name from `_getPageHeadingTabs()`. |
| 63 | + * @param string $sTag |
|
| 63 | 64 | * @return string the output of page heading tabs. |
| 64 | 65 | */ |
| 65 | 66 | private function _getOutput( $aPage, $sTag ) { |
@@ -100,6 +101,7 @@ discard block |
||
| 100 | 101 | * @internal |
| 101 | 102 | * @since 3.5.3 |
| 102 | 103 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
| 104 | + * @param string $sTag |
|
| 103 | 105 | * @return string the HTML page heading tab navigation bar output. |
| 104 | 106 | */ |
| 105 | 107 | private function _getPageHeadingtabNavigationBar( array $aPages, $sTag, $sCurrentPageSlug ) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $_aPage = $this->oFactory->oProp->aPages[ $this->sPageSlug ]; |
| 46 | 46 | |
| 47 | 47 | // If the page title is disabled, return an empty string. |
| 48 | - if ( ! $_aPage[ 'show_page_title' ] ) { |
|
| 48 | + if ( !$_aPage[ 'show_page_title' ] ) { |
|
| 49 | 49 | return ""; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | private function _getOutput( $aPage, $sTag ) { |
| 66 | 66 | |
| 67 | - $sTag = $this->_getPageHeadingTabTag( $sTag, $aPage ); |
|
| 67 | + $sTag = $this->_getPageHeadingTabTag( $sTag, $aPage ); |
|
| 68 | 68 | |
| 69 | 69 | // If the page heading tab visibility is disabled, or only one page is registered, return the title. |
| 70 | - if ( ! $aPage[ 'show_page_heading_tabs' ] || count( $this->oFactory->oProp->aPages ) == 1 ) { |
|
| 70 | + if ( !$aPage[ 'show_page_heading_tabs' ] || count( $this->oFactory->oProp->aPages ) == 1 ) { |
|
| 71 | 71 | return "<{$sTag}>" |
| 72 | 72 | . $aPage[ 'title' ] |
| 73 | 73 | . "</{$sTag}>"; |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | private function _getPageHeadingtabNavigationBar( array $aPages, $sTag, $sCurrentPageSlug ) { |
| 106 | 106 | |
| 107 | 107 | $_oTabBar = new AdminPageFramework_TabNavigationBar( |
| 108 | - $aPages, // tab items |
|
| 108 | + $aPages, // tab items |
|
| 109 | 109 | $sCurrentPageSlug, // active tab slug |
| 110 | - $sTag, // container tag |
|
| 110 | + $sTag, // container tag |
|
| 111 | 111 | array( // container attributes |
| 112 | 112 | // 'class' => '...', |
| 113 | 113 | ), |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | * @since 3.5.10 |
| 131 | 131 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
| 132 | 132 | */ |
| 133 | - public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
| 134 | - switch( $aSubPage['type'] ) { |
|
| 133 | + public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments = array() ) { |
|
| 134 | + switch ( $aSubPage[ 'type' ] ) { |
|
| 135 | 135 | case 'link': |
| 136 | 136 | return $this->_getFormattedPageHeadingtabNavigationBarLinkItem( $aSubPage, $aStructure ); |
| 137 | 137 | default: |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | private function _getFormattedPageHeadingtabNavigationBarPageItem( array $aSubPage, $aStructure ) { |
| 150 | 150 | |
| 151 | - if ( ! isset( $aSubPage[ 'page_slug' ] ) ) { |
|
| 151 | + if ( !isset( $aSubPage[ 'page_slug' ] ) ) { |
|
| 152 | 152 | return array(); |
| 153 | 153 | } |
| 154 | - if ( ! $aSubPage[ 'show_page_heading_tab' ] ) { |
|
| 154 | + if ( !$aSubPage[ 'show_page_heading_tab' ] ) { |
|
| 155 | 155 | return array(); |
| 156 | 156 | } |
| 157 | 157 | return array( |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | private function _getFormattedPageHeadingtabNavigationBarLinkItem( array $aSubPage, $aStructure ) { |
| 184 | 184 | |
| 185 | - if ( ! isset( $aSubPage[ 'href' ] ) ) { |
|
| 185 | + if ( !isset( $aSubPage[ 'href' ] ) ) { |
|
| 186 | 186 | return array(); |
| 187 | 187 | } |
| 188 | - if ( ! $aSubPage[ 'show_page_heading_tab' ] ) { |
|
| 188 | + if ( !$aSubPage[ 'show_page_heading_tab' ] ) { |
|
| 189 | 189 | return array(); |
| 190 | 190 | } |
| 191 | 191 | $aSubPage = array( |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | + array( 'class' => null ) |
| 198 | 198 | + $aStructure; |
| 199 | 199 | |
| 200 | - $aSubPage[ 'class' ] = trim( $aSubPage[ 'class' ] . ' link' ); |
|
| 200 | + $aSubPage[ 'class' ] = trim( $aSubPage[ 'class' ].' link' ); |
|
| 201 | 201 | return $aSubPage; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $_aPage = $this->oFactory->oProp->aPages[ $this->sPageSlug ]; |
| 46 | 46 | |
| 47 | 47 | // If the page title is disabled, return an empty string. |
| 48 | - if ( ! $_aPage[ 'show_page_title' ] ) { |
|
| 48 | + if ( ! $_aPage[ 'show_page_title' ] ) { |
|
| 49 | 49 | return ""; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @since 3.5.10 |
| 131 | 131 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
| 132 | 132 | */ |
| 133 | - public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
| 133 | + public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
| 134 | 134 | switch( $aSubPage['type'] ) { |
| 135 | 135 | case 'link': |
| 136 | 136 | return $this->_getFormattedPageHeadingtabNavigationBarLinkItem( $aSubPage, $aStructure ); |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | } |
| 49 | 49 | /** |
| 50 | 50 | * @since 3.6.3 |
| 51 | - * @return boolean |
|
| 51 | + * @return boolean|null |
|
| 52 | 52 | */ |
| 53 | 53 | private function _isScreenIconVisible() { |
| 54 | 54 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function get() { |
| 42 | 42 | |
| 43 | - if ( ! $this->_isScreenIconVisible() ) { |
|
| 43 | + if ( !$this->_isScreenIconVisible() ) { |
|
| 44 | 44 | return ''; |
| 45 | 45 | } |
| 46 | 46 | return $this->_getScreenIcon( $this->sPageSlug ); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | private function _isScreenIconVisible() { |
| 54 | 54 | |
| 55 | - $_bShowPageTitle = $this->getElement( |
|
| 55 | + $_bShowPageTitle = $this->getElement( |
|
| 56 | 56 | $this->oFactory->oProp->aPages, |
| 57 | 57 | array( $this->sPageSlug, 'show_page_title' ) |
| 58 | 58 | ); |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | array( $sPageSlug, 'href_icon_32x32' ), |
| 131 | 131 | '' |
| 132 | 132 | ); |
| 133 | - if ( ! $_sScreenIconPath ) { |
|
| 133 | + if ( !$_sScreenIconPath ) { |
|
| 134 | 134 | return; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $_aAttributes = array( |
| 138 | 138 | 'style' => $this->generateInlineCSS( |
| 139 | 139 | array( |
| 140 | - 'background-image' => "url('" . esc_url( $_sScreenIconPath ) . "')" |
|
| 140 | + 'background-image' => "url('".esc_url( $_sScreenIconPath )."')" |
|
| 141 | 141 | ) |
| 142 | 142 | ) |
| 143 | 143 | ); |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | array( $sPageSlug, 'screen_icon_id' ), |
| 162 | 162 | '' |
| 163 | 163 | ); |
| 164 | - if ( ! $_sScreenIconID ) { |
|
| 164 | + if ( !$_sScreenIconID ) { |
|
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $_aAttributes = array( |
| 169 | - 'id' => "icon-" . $_sScreenIconID, |
|
| 169 | + 'id' => "icon-".$_sScreenIconID, |
|
| 170 | 170 | ); |
| 171 | 171 | |
| 172 | 172 | // Go to the catch clause. |
@@ -189,16 +189,16 @@ discard block |
||
| 189 | 189 | 'class' => $this->getClassAttribute( |
| 190 | 190 | $this->getAOrB( |
| 191 | 191 | empty( $_sIconIDAttribute ) && $_oScreen->post_type, |
| 192 | - sanitize_html_class( 'icon32-posts-' . $_oScreen->post_type ), |
|
| 192 | + sanitize_html_class( 'icon32-posts-'.$_oScreen->post_type ), |
|
| 193 | 193 | '' |
| 194 | 194 | ), |
| 195 | 195 | $this->getAOrB( |
| 196 | 196 | empty( $_sIconIDAttribute ) || $_sIconIDAttribute == $this->oFactory->oProp->sClassName, |
| 197 | - 'generic', // the default value |
|
| 197 | + 'generic', // the default value |
|
| 198 | 198 | '' |
| 199 | 199 | ) |
| 200 | 200 | ), |
| 201 | - 'id' => "icon-" . $_sIconIDAttribute, |
|
| 201 | + 'id' => "icon-".$_sIconIDAttribute, |
|
| 202 | 202 | ); |
| 203 | 203 | return $this->_getScreenIconByAttributes( $_aAttributes ); |
| 204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | private function _getScreenIDAttribute( $oScreen ) { |
| 214 | 214 | |
| 215 | - if ( ! empty( $oScreen->parent_base ) ) { |
|
| 215 | + if ( !empty( $oScreen->parent_base ) ) { |
|
| 216 | 216 | return $oScreen->parent_base; |
| 217 | 217 | } |
| 218 | 218 | if ( 'page' === $oScreen->post_type ) { |
@@ -233,10 +233,10 @@ discard block |
||
| 233 | 233 | private function _getScreenIconByAttributes( array $aAttributes ) { |
| 234 | 234 | |
| 235 | 235 | $aAttributes[ 'class' ] = $this->getClassAttribute( |
| 236 | - 'icon32', // required for a screen icon container element. |
|
| 236 | + 'icon32', // required for a screen icon container element. |
|
| 237 | 237 | $this->getElement( $aAttributes, 'class' ) |
| 238 | 238 | ); |
| 239 | - return "<div " . $this->getAttributes( $aAttributes ) . ">" |
|
| 239 | + return "<div ".$this->getAttributes( $aAttributes ).">" |
|
| 240 | 240 | . "<br />" |
| 241 | 241 | . "</div>"; |
| 242 | 242 | |
@@ -181,7 +181,7 @@ |
||
| 181 | 181 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
| 182 | 182 | * @return string |
| 183 | 183 | */ |
| 184 | - private function _getDefaultScreenIcon() { |
|
| 184 | + private function _getDefaultScreenIcon() { |
|
| 185 | 185 | |
| 186 | 186 | $_oScreen = get_current_screen(); |
| 187 | 187 | $_sIconIDAttribute = $this->_getScreenIDAttribute( $_oScreen ); |
@@ -153,9 +153,6 @@ |
||
| 153 | 153 | * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
| 154 | 154 | * @access public |
| 155 | 155 | * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
| 156 | - * @param string $sSectionID1 the section ID to remove. |
|
| 157 | - * @param string $sSectionID2 (optional) another section ID to remove. |
|
| 158 | - * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
| 159 | 156 | * @return void |
| 160 | 157 | */ |
| 161 | 158 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
@@ -140,24 +140,24 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * Removes the given section(s) by section ID. |
|
| 144 | - * |
|
| 145 | - * This accesses the property storing the added section arrays and removes the specified ones. |
|
| 146 | - * |
|
| 147 | - * <h4>Example</h4> |
|
| 148 | - * <code>$this->removeSettingSections( 'text_fields', 'selectors', 'another_section', 'yet_another_section' ); |
|
| 149 | - * </code> |
|
| 150 | - * |
|
| 151 | - * @since 2.0.0 |
|
| 152 | - * @since 3.0.0 Changed the scope to public from protected. |
|
| 153 | - * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
| 154 | - * @access public |
|
| 155 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 156 | - * @param string $sSectionID1 the section ID to remove. |
|
| 157 | - * @param string $sSectionID2 (optional) another section ID to remove. |
|
| 158 | - * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
| 159 | - * @return void |
|
| 160 | - */ |
|
| 143 | + * Removes the given section(s) by section ID. |
|
| 144 | + * |
|
| 145 | + * This accesses the property storing the added section arrays and removes the specified ones. |
|
| 146 | + * |
|
| 147 | + * <h4>Example</h4> |
|
| 148 | + * <code>$this->removeSettingSections( 'text_fields', 'selectors', 'another_section', 'yet_another_section' ); |
|
| 149 | + * </code> |
|
| 150 | + * |
|
| 151 | + * @since 2.0.0 |
|
| 152 | + * @since 3.0.0 Changed the scope to public from protected. |
|
| 153 | + * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
| 154 | + * @access public |
|
| 155 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 156 | + * @param string $sSectionID1 the section ID to remove. |
|
| 157 | + * @param string $sSectionID2 (optional) another section ID to remove. |
|
| 158 | + * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
| 159 | + * @return void |
|
| 160 | + */ |
|
| 161 | 161 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
| 162 | 162 | |
| 163 | 163 | foreach( func_get_args() as $_sSectionID ) { |
@@ -224,38 +224,38 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | /** |
| 227 | - * Adds the given field array items into the field array property. |
|
| 228 | - * |
|
| 229 | - * Identical to the `addSettingFields()` method except that this method does not accept enumerated parameters. |
|
| 230 | - * |
|
| 231 | - * @since 2.1.2 |
|
| 232 | - * @since 3.0.0 Changed the scope to public from protected. |
|
| 233 | - * @access public |
|
| 234 | - * @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. |
|
| 235 | - * @return void |
|
| 236 | - */ |
|
| 227 | + * Adds the given field array items into the field array property. |
|
| 228 | + * |
|
| 229 | + * Identical to the `addSettingFields()` method except that this method does not accept enumerated parameters. |
|
| 230 | + * |
|
| 231 | + * @since 2.1.2 |
|
| 232 | + * @since 3.0.0 Changed the scope to public from protected. |
|
| 233 | + * @access public |
|
| 234 | + * @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. |
|
| 235 | + * @return void |
|
| 236 | + */ |
|
| 237 | 237 | public function addSettingField( $asField ) { |
| 238 | 238 | $this->oForm->addField( $asField ); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | - * Removes the given field(s) by field ID. |
|
| 243 | - * |
|
| 244 | - * This accesses the property storing the added field arrays and removes the specified ones. |
|
| 245 | - * |
|
| 246 | - * <h4>Example</h4> |
|
| 247 | - * <code>$this->removeSettingFields( 'fieldID_A', 'fieldID_B', 'fieldID_C', 'fieldID_D' ); |
|
| 248 | - * </code> |
|
| 249 | - * |
|
| 250 | - * @since 2.0.0 |
|
| 251 | - * @since 3.0.0 Changed the scope to public from protected. |
|
| 252 | - * @access public |
|
| 253 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 254 | - * @param string $sFieldID1 the field ID to remove. |
|
| 255 | - * @param string $sFieldID2 (optional) another field ID to remove. |
|
| 256 | - * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
|
| 257 | - * @return void |
|
| 258 | - */ |
|
| 242 | + * Removes the given field(s) by field ID. |
|
| 243 | + * |
|
| 244 | + * This accesses the property storing the added field arrays and removes the specified ones. |
|
| 245 | + * |
|
| 246 | + * <h4>Example</h4> |
|
| 247 | + * <code>$this->removeSettingFields( 'fieldID_A', 'fieldID_B', 'fieldID_C', 'fieldID_D' ); |
|
| 248 | + * </code> |
|
| 249 | + * |
|
| 250 | + * @since 2.0.0 |
|
| 251 | + * @since 3.0.0 Changed the scope to public from protected. |
|
| 252 | + * @access public |
|
| 253 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 254 | + * @param string $sFieldID1 the field ID to remove. |
|
| 255 | + * @param string $sFieldID2 (optional) another field ID to remove. |
|
| 256 | + * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
|
| 257 | + * @return void |
|
| 258 | + */ |
|
| 259 | 259 | public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more ) { |
| 260 | 260 | foreach( func_get_args() as $_sFieldID ) { |
| 261 | 261 | $this->oForm->removeField( $_sFieldID ); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
| 74 | 74 | |
| 75 | - foreach( func_get_args() as $asSection ) { |
|
| 75 | + foreach( func_get_args() as $asSection ) { |
|
| 76 | 76 | $this->addSettingSection( $asSection ); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
| 159 | 159 | * @return void |
| 160 | 160 | */ |
| 161 | - public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
|
| 161 | + public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
|
| 162 | 162 | |
| 163 | 163 | foreach( func_get_args() as $_sSectionID ) { |
| 164 | 164 | $this->oForm->removeSection( $_sSectionID ); |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
| 219 | 219 | * @remark The actual registration will be performed in the <em>_replyToRegisterSettings()</em> method with the <em>admin_menu</em> hook. |
| 220 | 220 | */ |
| 221 | - public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
|
| 222 | - foreach( func_get_args() as $aField ) { |
|
| 221 | + public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
|
| 222 | + foreach( func_get_args() as $aField ) { |
|
| 223 | 223 | $this->addSettingField( $aField ); |
| 224 | 224 | } |
| 225 | 225 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @return void |
| 258 | 258 | */ |
| 259 | 259 | public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more ) { |
| 260 | - foreach( func_get_args() as $_sFieldID ) { |
|
| 260 | + foreach( func_get_args() as $_sFieldID ) { |
|
| 261 | 261 | $this->oForm->removeField( $_sFieldID ); |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
| 74 | 74 | |
| 75 | - foreach( func_get_args() as $asSection ) { |
|
| 75 | + foreach ( func_get_args() as $asSection ) { |
|
| 76 | 76 | $this->addSettingSection( $asSection ); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function addSettingSection( $asSection ) { |
| 97 | 97 | |
| 98 | - if ( ! is_array( $asSection ) ) { |
|
| 98 | + if ( !is_array( $asSection ) ) { |
|
| 99 | 99 | $this->_sTargetPageSlug = is_string( $asSection ) |
| 100 | 100 | ? $asSection |
| 101 | 101 | : $this->_sTargetPageSlug; |
@@ -117,10 +117,10 @@ discard block |
||
| 117 | 117 | ) |
| 118 | 118 | ); |
| 119 | 119 | |
| 120 | - $aSection[ 'section_tab_slug' ] = $this->oUtil->sanitizeSlug( $aSection[ 'section_tab_slug' ] ); |
|
| 120 | + $aSection[ 'section_tab_slug' ] = $this->oUtil->sanitizeSlug( $aSection[ 'section_tab_slug' ] ); |
|
| 121 | 121 | |
| 122 | 122 | // A page slug is required. |
| 123 | - if ( ! $aSection[ 'page_slug' ] ) { |
|
| 123 | + if ( !$aSection[ 'page_slug' ] ) { |
|
| 124 | 124 | return; |
| 125 | 125 | } |
| 126 | 126 | $this->oForm->addSection( $aSection ); |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | private function _getTargetPageSlug( $aSection ) { |
| 137 | 137 | |
| 138 | 138 | $_sTargetPageSlug = $this->oUtil->getElement( |
| 139 | - $aSection, // subject |
|
| 140 | - 'page_slug', // key |
|
| 139 | + $aSection, // subject |
|
| 140 | + 'page_slug', // key |
|
| 141 | 141 | $this->_sTargetPageSlug // default |
| 142 | 142 | ); |
| 143 | 143 | |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | private function _getTargetTabSlug( $aSection ) { |
| 159 | 159 | $_sTargetTabSlug = $this->oUtil->getElement( |
| 160 | - $aSection, // subject |
|
| 161 | - 'tab_slug', // key |
|
| 160 | + $aSection, // subject |
|
| 161 | + 'tab_slug', // key |
|
| 162 | 162 | $this->_sTargetTabSlug // default |
| 163 | 163 | ); |
| 164 | 164 | $_sTargetTabSlug = $_sTargetTabSlug |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @return void |
| 188 | 188 | */ |
| 189 | 189 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
| 190 | - foreach( func_get_args() as $_sSectionID ) { |
|
| 190 | + foreach ( func_get_args() as $_sSectionID ) { |
|
| 191 | 191 | $this->oForm->removeSection( $_sSectionID ); |
| 192 | 192 | } |
| 193 | 193 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @remark The actual registration will be performed in the <em>_replyToRegisterSettings()</em> method with the <em>admin_menu</em> hook. |
| 246 | 246 | */ |
| 247 | 247 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
| 248 | - foreach( func_get_args() as $aField ) { |
|
| 248 | + foreach ( func_get_args() as $aField ) { |
|
| 249 | 249 | $this->addSettingField( $aField ); |
| 250 | 250 | } |
| 251 | 251 | } |
@@ -282,8 +282,8 @@ discard block |
||
| 282 | 282 | * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
| 283 | 283 | * @return void |
| 284 | 284 | */ |
| 285 | - public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more ) { |
|
| 286 | - foreach( func_get_args() as $_sFieldID ) { |
|
| 285 | + public function removeSettingFields( $sFieldID1, $sFieldID2 = null, $_and_more ) { |
|
| 286 | + foreach ( func_get_args() as $_sFieldID ) { |
|
| 287 | 287 | $this->oForm->removeField( $_sFieldID ); |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $this->oProp->sOptionKey, |
| 331 | 331 | empty( $_aParams ) |
| 332 | 332 | ? null // will return the entire options array |
| 333 | - : $_aDimensionalKeys, // dimensional keys |
|
| 333 | + : $_aDimensionalKeys, // dimensional keys |
|
| 334 | 334 | $_mDefault, // default |
| 335 | 335 | $this->getSavedOptions() + $this->oForm->getDefaultFormValues() |
| 336 | 336 | ); |
@@ -349,21 +349,21 @@ discard block |
||
| 349 | 349 | * If the user has not submitted the form, the framework will try to return the default value set in the field definition array. |
| 350 | 350 | * @deprecated 3.3.0 |
| 351 | 351 | */ |
| 352 | - public function getFieldValue( $sFieldID, $sSectionID='' ) { |
|
| 352 | + public function getFieldValue( $sFieldID, $sSectionID = '' ) { |
|
| 353 | 353 | |
| 354 | 354 | $this->oUtil->showDeprecationNotice( |
| 355 | - 'The method,' . __METHOD__ . ',', // deprecated item |
|
| 355 | + 'The method,'.__METHOD__.',', // deprecated item |
|
| 356 | 356 | 'getValue()' // alternative |
| 357 | 357 | ); |
| 358 | 358 | |
| 359 | 359 | $_aOptions = $this->oUtil->uniteArrays( $this->oProp->aOptions, $this->oForm->getDefaultFormValues() ); |
| 360 | 360 | /* If it's saved, return it */ |
| 361 | - if ( ! $sSectionID ) { |
|
| 361 | + if ( !$sSectionID ) { |
|
| 362 | 362 | if ( array_key_exists( $sFieldID, $_aOptions ) ) { |
| 363 | 363 | return $_aOptions[ $sFieldID ]; |
| 364 | 364 | } |
| 365 | 365 | // loop through section elements |
| 366 | - foreach( $_aOptions as $aOptions ) { |
|
| 366 | + foreach ( $_aOptions as $aOptions ) { |
|
| 367 | 367 | if ( array_key_exists( $sFieldID, $aOptions ) ) { |
| 368 | 368 | return $aOptions[ $sFieldID ]; |
| 369 | 369 | } |
@@ -455,6 +455,7 @@ |
||
| 455 | 455 | * @internal |
| 456 | 456 | * @since 3.5.3 |
| 457 | 457 | * @since DEVVER Moved from `AdminPageFramework_FormDefinition_Page`. |
| 458 | + * @param string $sTabSlug |
|
| 458 | 459 | * @return boolean |
| 459 | 460 | */ |
| 460 | 461 | private function _isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | ); |
| 108 | 108 | // @todo Examine whether this check can be removed |
| 109 | 109 | // as the section that hods this field is already checked above outside this loop. |
| 110 | - if ( $sPageSlug !== $_aFieldset[ 'page_slug' ] ) { |
|
| 110 | + if ( $sPageSlug !== $_aFieldset[ 'page_slug' ] ) { |
|
| 111 | 111 | continue; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | * @since DEVVER Moved from `AdminPageFramework_FormDefinition_Page`. |
| 334 | 334 | * @return array |
| 335 | 335 | */ |
| 336 | - public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
| 336 | + public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
| 337 | 337 | $_aOtherTabOptions = $this->getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ); |
| 338 | 338 | return $this->invertCastArrayContents( $aOptions, $_aOtherTabOptions ); |
| 339 | 339 | } |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug='' ) { |
| 352 | 352 | |
| 353 | 353 | $_aStoredOptionsOfTheTab = array(); |
| 354 | - if ( ! $sTabSlug ) { |
|
| 354 | + if ( ! $sTabSlug ) { |
|
| 355 | 355 | return $_aStoredOptionsOfTheTab; |
| 356 | 356 | } |
| 357 | 357 | |
@@ -52,16 +52,16 @@ discard block |
||
| 52 | 52 | public function getPageOnlyOptions( $aOptions, $sPageSlug ) { |
| 53 | 53 | |
| 54 | 54 | $_aStoredOptionsOfThePage = array(); |
| 55 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
| 55 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
| 56 | 56 | |
| 57 | 57 | // Check the section |
| 58 | - if ( ! $this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
|
| 58 | + if ( !$this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
|
| 59 | 59 | continue; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // At this point, the element belongs the given page slug as the section is of the given page slug's. |
| 63 | 63 | $this->_setPageOnlyOptions( |
| 64 | - $_aStoredOptionsOfThePage, // by reference - gets updated in the method. |
|
| 64 | + $_aStoredOptionsOfThePage, // by reference - gets updated in the method. |
|
| 65 | 65 | $aOptions, |
| 66 | 66 | $_aSubSectionsOrFields, |
| 67 | 67 | $sPageSlug, |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @internal |
| 82 | 82 | */ |
| 83 | 83 | private function _setPageOnlyOptions( array &$_aStoredOptionsOfThePage, array $aOptions, array $_aSubSectionsOrFields, $sPageSlug, $_sSectionID ) { |
| 84 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
| 84 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
| 85 | 85 | |
| 86 | 86 | // If it's a sub-section array, |
| 87 | 87 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | public function getOtherPageOptions( $aOptions, $sPageSlug ) { |
| 154 | 154 | |
| 155 | 155 | $_aStoredOptionsNotOfThePage = array(); |
| 156 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
| 156 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
| 157 | 157 | |
| 158 | 158 | // Check the section |
| 159 | 159 | if ( $this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @internal |
| 183 | 183 | */ |
| 184 | 184 | private function _setOtherPageOptions( array &$_aStoredOptionsNotOfThePage, array $aOptions, array $_aSubSectionsOrFields, $sPageSlug ) { |
| 185 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
| 185 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
| 186 | 186 | |
| 187 | 187 | // It's a sub-section array. |
| 188 | 188 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | public function getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ) { |
| 246 | 246 | |
| 247 | 247 | $_aStoredOptionsNotOfTheTab = array(); |
| 248 | - foreach( $this->aFieldsets as $_sSectionPath => $_aSubSectionsOrFields ) { |
|
| 248 | + foreach ( $this->aFieldsets as $_sSectionPath => $_aSubSectionsOrFields ) { |
|
| 249 | 249 | |
| 250 | 250 | // If the section is of the given page and the given tab, skip. |
| 251 | 251 | if ( $this->_isThisSectionSetToThisTab( $_sSectionPath, $sPageSlug, $sTabSlug ) ) { |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | private function _setOtherTabOptions( array &$_aStoredOptionsNotOfTheTab, array $aOptions, array $_aSubSectionsOrFields, $sSectionPath ) { |
| 277 | 277 | |
| 278 | 278 | // At this point, the passed element belongs to the other tabs since the section of the given tab is skipped. |
| 279 | - foreach ( $_aSubSectionsOrFields as $_isSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
| 279 | + foreach ( $_aSubSectionsOrFields as $_isSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
| 280 | 280 | |
| 281 | 281 | // If it's a sub section |
| 282 | 282 | if ( $this->isNumericInteger( $_isSubSectionIndexOrFieldID ) ) { |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition_Page`. |
| 335 | 335 | * @return array |
| 336 | 336 | */ |
| 337 | - public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
| 337 | + public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug = '' ) { |
|
| 338 | 338 | |
| 339 | 339 | $_aOtherTabOptions = $this->getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ); |
| 340 | 340 | $_aTabOptions = $this->invertCastArrayContents( $aOptions, $_aOtherTabOptions ); |
@@ -352,17 +352,17 @@ discard block |
||
| 352 | 352 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition_Page`. |
| 353 | 353 | * @return array |
| 354 | 354 | */ |
| 355 | - public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
| 355 | + public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug = '' ) { |
|
| 356 | 356 | |
| 357 | 357 | $_aStoredOptionsOfTheTab = array(); |
| 358 | - if ( ! $sTabSlug ) { |
|
| 358 | + if ( !$sTabSlug ) { |
|
| 359 | 359 | return $_aStoredOptionsOfTheTab; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
| 362 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
| 363 | 363 | |
| 364 | 364 | // Check the section |
| 365 | - if ( ! $this->_isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) ) { |
|
| 365 | + if ( !$this->_isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) ) { |
|
| 366 | 366 | continue; |
| 367 | 367 | } |
| 368 | 368 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | */ |
| 389 | 389 | private function _setTabOnlyOptions( array &$_aStoredOptionsOfTheTab, array $aOptions, array $_aSubSectionsOrFields, $_sSectionID ) { |
| 390 | 390 | |
| 391 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
| 391 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
| 392 | 392 | |
| 393 | 393 | // if it's a sub-section array. |
| 394 | 394 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | */ |
| 446 | 446 | private function _isThisSectionSetToThisPage( $sSectionPath, $sPageSlug ) { |
| 447 | 447 | |
| 448 | - if ( ! isset( $this->aSectionsets[ $sSectionPath ][ 'page_slug' ] ) ) { |
|
| 448 | + if ( !isset( $this->aSectionsets[ $sSectionPath ][ 'page_slug' ] ) ) { |
|
| 449 | 449 | return false; |
| 450 | 450 | } |
| 451 | 451 | return ( |
@@ -463,10 +463,10 @@ discard block |
||
| 463 | 463 | */ |
| 464 | 464 | private function _isThisSectionSetToThisTab( $sSectionPath, $sPageSlug, $sTabSlug ) { |
| 465 | 465 | |
| 466 | - if ( ! $this->_isThisSectionSetToThisPage( $sSectionPath, $sPageSlug ) ) { |
|
| 466 | + if ( !$this->_isThisSectionSetToThisPage( $sSectionPath, $sPageSlug ) ) { |
|
| 467 | 467 | return false; |
| 468 | 468 | } |
| 469 | - if ( ! isset( $this->aSectionsets[ $sSectionPath ][ 'tab_slug' ] ) ) { |
|
| 469 | + if ( !isset( $this->aSectionsets[ $sSectionPath ][ 'tab_slug' ] ) ) { |
|
| 470 | 470 | return false; |
| 471 | 471 | } |
| 472 | 472 | return ( |
@@ -483,9 +483,9 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | private function _setOptionValue( &$aSubject, $asDimensionalPath, $aOptions ) { |
| 485 | 485 | $_aDimensionalPath = $this->getAsArray( $asDimensionalPath ); |
| 486 | - $_mValue = $this->getElement( |
|
| 486 | + $_mValue = $this->getElement( |
|
| 487 | 487 | $aOptions, |
| 488 | - $_aDimensionalPath, // as of 3.7.0, it can be an array or string |
|
| 488 | + $_aDimensionalPath, // as of 3.7.0, it can be an array or string |
|
| 489 | 489 | null |
| 490 | 490 | ); |
| 491 | 491 | if ( isset( $_mValue ) ) { |
@@ -23,6 +23,7 @@ |
||
| 23 | 23 | * Sets up internal properties. |
| 24 | 24 | * |
| 25 | 25 | * @since 3.2.0 |
| 26 | + * @param AdminPageFramework_Widget_Model $oCaller |
|
| 26 | 27 | * @return void |
| 27 | 28 | */ |
| 28 | 29 | public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @since 3.2.0 |
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
| 30 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
| 31 | 31 | |
| 32 | 32 | $aArguments = $aArguments |
| 33 | 33 | + array( |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | 'description' => '', |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | - parent::__construct( |
|
| 38 | + parent::__construct( |
|
| 39 | 39 | $oCaller->oProp->sClassName, // base id |
| 40 | 40 | $sWidgetTitle, // widget title |
| 41 | 41 | $aArguments // widget arguments |
| 42 | 42 | ); |
| 43 | 43 | $this->oCaller = $oCaller; |
| 44 | 44 | |
| 45 | - } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Displays the widget contents in the front end. |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * whether the title should be visible or not depending on the content. |
| 53 | 53 | * @return void |
| 54 | 54 | */ |
| 55 | - public function widget( $aArguments, $aFormData ) { |
|
| 55 | + public function widget( $aArguments, $aFormData ) { |
|
| 56 | 56 | |
| 57 | 57 | echo $aArguments[ 'before_widget' ]; |
| 58 | 58 | |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | echo $_sContent; |
| 77 | 77 | |
| 78 | - echo $aArguments[ 'after_widget' ]; |
|
| 78 | + echo $aArguments[ 'after_widget' ]; |
|
| 79 | 79 | |
| 80 | - } |
|
| 80 | + } |
|
| 81 | 81 | /** |
| 82 | 82 | * Returns the widget title. |
| 83 | 83 | * |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | if ( ! $_sTitle ) { |
| 107 | 107 | return ''; |
| 108 | 108 | } |
| 109 | - return $aArguments['before_title'] |
|
| 109 | + return $aArguments['before_title'] |
|
| 110 | 110 | . $_sTitle |
| 111 | 111 | . $aArguments['after_title']; |
| 112 | 112 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @since 3.2.0 |
| 119 | 119 | * @return mixed The validated form data. The type should be an array but it is dealt by the framework user it will be unknown. |
| 120 | 120 | */ |
| 121 | - public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
| 121 | + public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
| 122 | 122 | |
| 123 | 123 | return $this->oCaller->oUtil->addAndApplyFilters( |
| 124 | 124 | $this->oCaller, |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $this->oCaller |
| 132 | 132 | ); |
| 133 | 133 | |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Constructs the widget form with the given saved form data. |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @return void |
| 144 | 144 | */ |
| 145 | - public function form( $aSavedFormData ) { |
|
| 145 | + public function form( $aSavedFormData ) { |
|
| 146 | 146 | |
| 147 | 147 | $this->oCaller->oForm->aCallbacks = $this->_getFormCallbacks(); |
| 148 | 148 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $this->oCaller->oForm->aSectionsets = $_aSectionsets; |
| 182 | 182 | $this->oCaller->oForm->aFieldsets = $_aFieldsets; |
| 183 | 183 | |
| 184 | - } |
|
| 184 | + } |
|
| 185 | 185 | /** |
| 186 | 186 | * Calls the load() method of the caller factory object. |
| 187 | 187 | * |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @since 3.2.0 |
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
| 30 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments = array() ) { |
|
| 31 | 31 | |
| 32 | 32 | $aArguments = $aArguments |
| 33 | 33 | + array( |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | parent::__construct( |
| 39 | - $oCaller->oProp->sClassName, // base id |
|
| 40 | - $sWidgetTitle, // widget title |
|
| 39 | + $oCaller->oProp->sClassName, // base id |
|
| 40 | + $sWidgetTitle, // widget title |
|
| 41 | 41 | $aArguments // widget arguments |
| 42 | 42 | ); |
| 43 | 43 | $this->oCaller = $oCaller; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $this->oCaller->oUtil->addAndDoActions( |
| 60 | 60 | $this->oCaller, |
| 61 | - 'do_' . $this->oCaller->oProp->sClassName, |
|
| 61 | + 'do_'.$this->oCaller->oProp->sClassName, |
|
| 62 | 62 | $this->oCaller |
| 63 | 63 | ); |
| 64 | 64 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function _getTitle( array $aArguments, array $aFormData ) { |
| 91 | 91 | |
| 92 | - if ( ! $this->oCaller->oProp->bShowWidgetTitle ) { |
|
| 92 | + if ( !$this->oCaller->oProp->bShowWidgetTitle ) { |
|
| 93 | 93 | return ''; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | $aFormData, |
| 104 | 104 | $this->id_base |
| 105 | 105 | ); |
| 106 | - if ( ! $_sTitle ) { |
|
| 106 | + if ( !$_sTitle ) { |
|
| 107 | 107 | return ''; |
| 108 | 108 | } |
| 109 | - return $aArguments['before_title'] |
|
| 109 | + return $aArguments[ 'before_title' ] |
|
| 110 | 110 | . $_sTitle |
| 111 | - . $aArguments['after_title']; |
|
| 111 | + . $aArguments[ 'after_title' ]; |
|
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $this->oCaller, |
| 125 | 125 | "validation_{$this->oCaller->oProp->sClassName}", |
| 126 | 126 | call_user_func_array( |
| 127 | - array( $this->oCaller, 'validate' ), // triggers __call() |
|
| 127 | + array( $this->oCaller, 'validate' ), // triggers __call() |
|
| 128 | 128 | array( $aSubmittedFormData, $aSavedFormData, $this->oCaller ) // parameters |
| 129 | 129 | ), // 3.5.3+ |
| 130 | 130 | $aSavedFormData, |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | $this->oCaller->oForm = new AdminPageFramework_Form_widget( |
| 173 | 173 | array( |
| 174 | 174 | 'register_if_action_already_done' => false, // do not register fields right away |
| 175 | - ) + $this->oCaller->oProp->aFormArguments, // form arguments |
|
| 176 | - $this->oCaller->oForm->aCallbacks, // callbacks |
|
| 175 | + ) + $this->oCaller->oProp->aFormArguments, // form arguments |
|
| 176 | + $this->oCaller->oForm->aCallbacks, // callbacks |
|
| 177 | 177 | $this->oCaller->oMsg |
| 178 | 178 | ); |
| 179 | 179 | // Reuse the data of the previous widget instance. |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * Call the load method only once per class. Also the added field registrations in the class also done once. |
| 195 | 195 | * @since 3.7.9 |
| 196 | 196 | */ |
| 197 | - if ( $this->oCaller->oUtil->hasBeenCalled( '_widget_load_' . $this->oCaller->oProp->sClassName ) ) { |
|
| 197 | + if ( $this->oCaller->oUtil->hasBeenCalled( '_widget_load_'.$this->oCaller->oProp->sClassName ) ) { |
|
| 198 | 198 | |
| 199 | 199 | // The saved option callback is done with the below load_... callback so for widget form instances called from the second time |
| 200 | 200 | // need to call the callback manually. |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $this->oCaller->oUtil->addAndDoActions( |
| 209 | 209 | $this->oCaller, |
| 210 | 210 | array( |
| 211 | - 'load_' . $this->oCaller->oProp->sClassName, |
|
| 211 | + 'load_'.$this->oCaller->oProp->sClassName, |
|
| 212 | 212 | ), |
| 213 | 213 | $this->oCaller |
| 214 | 214 | ); |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | private function _getFormCallbacks() { |
| 224 | 224 | return array( |
| 225 | - 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 226 | - 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 227 | - 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
| 225 | + 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 226 | + 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 227 | + 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
| 228 | 228 | 'hfInputName' => array( $this, '_replyToGetFieldInputName' ), |
| 229 | 229 | |
| 230 | 230 | 'saved_data' => array( $this, '_replyToGetSavedFormData' ), |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | public function _replyToGetSavedFormData() { |
| 242 | 242 | return $this->oCaller->oUtil->addAndApplyFilter( |
| 243 | 243 | $this->oCaller, // the caller factory object |
| 244 | - 'options_' . $this->oCaller->oProp->sClassName, |
|
| 245 | - $this->oCaller->oProp->aOptions, // subject value to be filtered |
|
| 244 | + 'options_'.$this->oCaller->oProp->sClassName, |
|
| 245 | + $this->oCaller->oProp->aOptions, // subject value to be filtered |
|
| 246 | 246 | $this->id // 3.7.9+ |
| 247 | 247 | ); |
| 248 | 248 | } |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | ? "[{$aFieldset[ '_section_index' ]}]" |
| 276 | 276 | : ""; |
| 277 | 277 | $_sDimensions = $this->oCaller->isSectionSet( $aFieldset ) |
| 278 | - ? $aFieldset[ 'section_id' ] . "]" . $_sSectionIndex . "[" . $aFieldset[ 'field_id' ] |
|
| 278 | + ? $aFieldset[ 'section_id' ]."]".$_sSectionIndex."[".$aFieldset[ 'field_id' ] |
|
| 279 | 279 | : $aFieldset[ 'field_id' ]; |
| 280 | - return 'widget-' . $this->id_base . '[' . $this->number . '][' . $_sDimensions . ']'; |
|
| 280 | + return 'widget-'.$this->id_base.'['.$this->number.']['.$_sDimensions.']'; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -294,9 +294,9 @@ discard block |
||
| 294 | 294 | $_sIndex = $this->oCaller->oUtil->getAOrB( |
| 295 | 295 | '0' !== $sIndex && empty( $sIndex ), |
| 296 | 296 | '', |
| 297 | - "[" . $sIndex . "]" |
|
| 297 | + "[".$sIndex."]" |
|
| 298 | 298 | ); |
| 299 | - return $this->_replyToGetFieldName( '', $aFieldset ) . $_sIndex; |
|
| 299 | + return $this->_replyToGetFieldName( '', $aFieldset ).$_sIndex; |
|
| 300 | 300 | |
| 301 | 301 | } |
| 302 | 302 | |
@@ -81,7 +81,6 @@ discard block |
||
| 81 | 81 | * 'code_block' => ..., |
| 82 | 82 | * |
| 83 | 83 | * )` |
| 84 | - * @param array $aOptions The options array which determines the behaviour of the class. |
|
| 85 | 84 | * @since 3.5.0 |
| 86 | 85 | * @since 3.6.0 Made it accept string content to be passed to the first parameter. |
| 87 | 86 | */ |
@@ -156,6 +155,7 @@ discard block |
||
| 156 | 155 | * Returns the parsed text. |
| 157 | 156 | * @since 3.5.0 |
| 158 | 157 | * @internal |
| 158 | + * @param string $sContent |
|
| 159 | 159 | */ |
| 160 | 160 | private function _getParsedText( $sContent ) { |
| 161 | 161 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @since 3.5.0 |
| 86 | 86 | * @since 3.6.0 Made it accept string content to be passed to the first parameter. |
| 87 | 87 | */ |
| 88 | - public function __construct( $sFilePathOrContent='', array $aReplacements=array(), array $aCallbacks=array() ) { |
|
| 88 | + public function __construct( $sFilePathOrContent = '', array $aReplacements = array(), array $aCallbacks = array() ) { |
|
| 89 | 89 | |
| 90 | 90 | $this->sText = file_exists( $sFilePathOrContent ) |
| 91 | 91 | ? file_get_contents( $sFilePathOrContent ) |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | '/^[\s]*==[\s]*(.+?)[\s]*==/m', |
| 122 | 122 | $sText, |
| 123 | 123 | -1, |
| 124 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
| 124 | + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
| 125 | 125 | ); |
| 126 | 126 | return $_aSections; |
| 127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @since 3.5.0 |
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | - public function get( $sSectionName='' ) { |
|
| 135 | + public function get( $sSectionName = '' ) { |
|
| 136 | 136 | return $sSectionName |
| 137 | 137 | ? $this->getSection( $sSectionName ) |
| 138 | 138 | : $this->_getParsedText( $this->sText ); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function _replyToReplaceCodeBlocks( $aMatches ) { |
| 196 | 196 | |
| 197 | - if ( ! isset( $aMatches[ 1 ] ) ) { |
|
| 197 | + if ( !isset( $aMatches[ 1 ] ) ) { |
|
| 198 | 198 | return $aMatches[ 0 ]; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function getRawSection( $sSectionName ) { |
| 219 | 219 | |
| 220 | - $_iIndex = array_search( $sSectionName, $this->_aSections ); |
|
| 220 | + $_iIndex = array_search( $sSectionName, $this->_aSections ); |
|
| 221 | 221 | return false === $_iIndex |
| 222 | 222 | ? '' |
| 223 | 223 | : trim( $this->_aSections[ $_iIndex + 1 ] ); |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | // If <?php notation is missing, highlight_string() will not highlight the syntax so add it. |
| 238 | 238 | $_bHasPHPTag = "<?php" === substr( $sCode, 0, 5 ); |
| 239 | 239 | |
| 240 | - $sCode = $_bHasPHPTag ? $sCode : "<?php " . $sCode; |
|
| 240 | + $sCode = $_bHasPHPTag ? $sCode : "<?php ".$sCode; |
|
| 241 | 241 | |
| 242 | 242 | $sCode = str_replace( '"', "'", $sCode ); // highlight_string() crashes if double quotes are contained in the code. |
| 243 | 243 | $sCode = highlight_string( $sCode, true ); |
@@ -20,6 +20,8 @@ |
||
| 20 | 20 | /** |
| 21 | 21 | * |
| 22 | 22 | * @since 3.5.3 |
| 23 | + * @param string $sFilePath |
|
| 24 | + * @param string $sTOCTitle |
|
| 23 | 25 | */ |
| 24 | 26 | protected function _getReadmeContents( $sFilePath, $sTOCTitle, $asSections=array() ) { |
| 25 | 27 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | return $_oTOC->get(); |
| 47 | 47 | } |
| 48 | 48 | return '' |
| 49 | - . $_sContent; |
|
| 49 | + . $_sContent; |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @since 3.5.3 |
| 23 | 23 | */ |
| 24 | - protected function _getReadmeContents( $sFilePath, $sTOCTitle, $asSections=array() ) { |
|
| 24 | + protected function _getReadmeContents( $sFilePath, $sTOCTitle, $asSections = array() ) { |
|
| 25 | 25 | |
| 26 | 26 | $_oWPReadmeParser = new AdminPageFramework_WPReadmeParser( |
| 27 | 27 | $sFilePath, |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ) |
| 35 | 35 | ); |
| 36 | 36 | $_sContent = ''; |
| 37 | - foreach( ( array ) $asSections as $_sSection ) { |
|
| 37 | + foreach ( ( array ) $asSections as $_sSection ) { |
|
| 38 | 38 | $_sContent .= $_oWPReadmeParser->getSection( $_sSection ); |
| 39 | 39 | } |
| 40 | 40 | if ( $sTOCTitle ) { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @since 3.6.1 |
| 67 | 67 | * @return string The generate HTML output. |
| 68 | 68 | */ |
| 69 | - public function _replyToProcessShortcode_embed( $aAttributes, $sURL, $sShortcode='' ) { |
|
| 69 | + public function _replyToProcessShortcode_embed( $aAttributes, $sURL, $sShortcode = '' ) { |
|
| 70 | 70 | |
| 71 | 71 | $sURL = isset( $aAttributes[ 'src' ] ) ? $aAttributes[ 'src' ] : $sURL; |
| 72 | 72 | $_sHTML = wp_oembed_get( $sURL ); |
@@ -108,27 +108,27 @@ discard block |
||
| 108 | 108 | * array( 'Second Heading' => 'Another text', ), |
| 109 | 109 | * ) |
| 110 | 110 | */ |
| 111 | - public function getContentsByHeader( $sContents, $iHeaderNumber=2 ) { |
|
| 111 | + public function getContentsByHeader( $sContents, $iHeaderNumber = 2 ) { |
|
| 112 | 112 | |
| 113 | 113 | $_aContents = array(); |
| 114 | 114 | $_aSplitContents = preg_split( |
| 115 | 115 | // '/^[\s]*==[\s]*(.+?)[\s]*==/m', |
| 116 | - '/(<h[' . $iHeaderNumber . ']*[^>]*>.*?<\/h[' . $iHeaderNumber . ']>)/i', |
|
| 116 | + '/(<h['.$iHeaderNumber.']*[^>]*>.*?<\/h['.$iHeaderNumber.']>)/i', |
|
| 117 | 117 | $sContents, |
| 118 | 118 | -1, |
| 119 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
| 119 | + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | - foreach( $_aSplitContents as $_iIndex => $_sSplitContent ) { |
|
| 123 | - if ( ! preg_match( '/<h[' . $iHeaderNumber . ']*[^>]*>(.*?)<\/h[' . $iHeaderNumber . ']>/i', $_sSplitContent , $_aMatches ) ) { |
|
| 122 | + foreach ( $_aSplitContents as $_iIndex => $_sSplitContent ) { |
|
| 123 | + if ( !preg_match( '/<h['.$iHeaderNumber.']*[^>]*>(.*?)<\/h['.$iHeaderNumber.']>/i', $_sSplitContent, $_aMatches ) ) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if ( ! isset( $_aMatches[ 1 ] ) ) { |
|
| 127 | + if ( !isset( $_aMatches[ 1 ] ) ) { |
|
| 128 | 128 | continue; |
| 129 | 129 | } |
| 130 | - if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 131 | - $_aContents[] = array( |
|
| 130 | + if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 131 | + $_aContents[ ] = array( |
|
| 132 | 132 | $_aMatches[ 1 ], |
| 133 | 133 | $_aSplitContents[ $_iIndex + 1 ] |
| 134 | 134 | ); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | foreach( ( array ) $asSections as $_sSection ) { |
| 38 | 38 | $_sContent .= $_oWPReadmeParser->getSection( $_sSection ); |
| 39 | 39 | } |
| 40 | - if ( $sTOCTitle ) { |
|
| 40 | + if ( $sTOCTitle ) { |
|
| 41 | 41 | $_oTOC = new AdminPageFramework_TableOfContents( |
| 42 | 42 | $_sContent, |
| 43 | 43 | 4, |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | if ( ! isset( $_aMatches[ 1 ] ) ) { |
| 128 | 128 | continue; |
| 129 | 129 | } |
| 130 | - if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 130 | + if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 131 | 131 | $_aContents[] = array( |
| 132 | 132 | $_aMatches[ 1 ], |
| 133 | 133 | $_aSplitContents[ $_iIndex + 1 ] |
@@ -257,6 +257,7 @@ discard block |
||
| 257 | 257 | * Generates the framework zip data. |
| 258 | 258 | * |
| 259 | 259 | * @since 3.5.4 |
| 260 | + * @param string $sFrameworkDirPath |
|
| 260 | 261 | * @return string The binary zip data. |
| 261 | 262 | */ |
| 262 | 263 | private function _getDownloadFrameworkZipFile( $sFrameworkDirPath, $sDestinationPath ) { |
@@ -308,11 +309,7 @@ discard block |
||
| 308 | 309 | * |
| 309 | 310 | * @since 3.5.4 |
| 310 | 311 | * @remark string $sPath The path to check. It can be a directory or a file. |
| 311 | - * @param string $sPathInArchive The parsing directory path set to the archive. |
|
| 312 | - * The passed path for the archive has a trailing slash. It starts with a directory name. |
|
| 313 | - * e.g. |
|
| 314 | - * `utility/AdminPageFramework_WPReadmeParser/` |
|
| 315 | - * `factory/widget/model/` |
|
| 312 | + * @param string $sPath |
|
| 316 | 313 | * @return boolean |
| 317 | 314 | */ |
| 318 | 315 | private function _isAllowedArchivePath( $sPath ) { |
@@ -567,6 +564,7 @@ discard block |
||
| 567 | 564 | * Modifies the text domain in the given file contents. |
| 568 | 565 | * |
| 569 | 566 | * @since 3.5.4 |
| 567 | + * @param string $sFileContents |
|
| 570 | 568 | * @return string |
| 571 | 569 | */ |
| 572 | 570 | private function _modifyTextDomain( $sFileContents ) { |
@@ -585,6 +583,7 @@ discard block |
||
| 585 | 583 | * Retrieves the value from the $_POST array by the given field ID. |
| 586 | 584 | * |
| 587 | 585 | * @since 3.5.4 |
| 586 | + * @param string $sFieldID |
|
| 588 | 587 | * @return string |
| 589 | 588 | */ |
| 590 | 589 | private function _getFormSubmitValueByFieldIDAsString( $sFieldID ) { |
@@ -168,7 +168,7 @@ |
||
| 168 | 168 | * ) |
| 169 | 169 | * </code> |
| 170 | 170 | */ |
| 171 | - public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
| 171 | + public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
| 172 | 172 | |
| 173 | 173 | return isset( |
| 174 | 174 | $_POST[ $this->oFactory->oProp->sOptionKey ][ $this->sSectionID ][ 'minified_script_name' ] |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $this->oFactory = $oFactory; |
| 31 | 31 | |
| 32 | 32 | add_action( |
| 33 | - 'export_name_' . $this->sPageSlug . '_' . $this->sTabSlug, |
|
| 33 | + 'export_name_'.$this->sPageSlug.'_'.$this->sTabSlug, |
|
| 34 | 34 | array( $this, 'replyToFilterFileName' ), |
| 35 | 35 | 10, |
| 36 | 36 | 5 |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | 'label_min_width' => 0, |
| 128 | 128 | 'order' => 100, |
| 129 | 129 | 'value' => __( 'Download', 'adimn-page-framework-demo' ), |
| 130 | - 'file_name' => 'admin-page-framework.zip', // the default file name. This will be modified by the filter. |
|
| 131 | - 'format' => 'text', // 'json', 'text', 'array' |
|
| 130 | + 'file_name' => 'admin-page-framework.zip', // the default file name. This will be modified by the filter. |
|
| 131 | + 'format' => 'text', // 'json', 'text', 'array' |
|
| 132 | 132 | 'description' => $oFactory->oUtil->getAOrB( |
| 133 | 133 | class_exists( 'ZipArchive' ), |
| 134 | 134 | __( 'Download the compiled framework files as a zip file.', 'admin-page-framework-loader' ), |
@@ -182,8 +182,8 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // the class prefix must not contain white spaces and some other characters not supported in PHP class names. |
| 184 | 184 | preg_match( |
| 185 | - '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', // pattern - allowed characters for variables in PHP. |
|
| 186 | - $aInput[ 'class_prefix' ], // subject |
|
| 185 | + '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', // pattern - allowed characters for variables in PHP. |
|
| 186 | + $aInput[ 'class_prefix' ], // subject |
|
| 187 | 187 | $_aMatches |
| 188 | 188 | ); |
| 189 | 189 | if ( $aInput[ 'class_prefix' ] && empty( $_aMatches ) ) { |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | $_bVerified = false; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if ( ! $aInput[ 'text_domain' ] ) { |
|
| 194 | + if ( !$aInput[ 'text_domain' ] ) { |
|
| 195 | 195 | $_aErrors[ $this->sSectionID ][ 'text_domain' ] = __( 'The text domain cannot be empty.', 'admin-page-framework-loader' ); |
| 196 | 196 | $_bVerified = false; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | // An invalid value is found. Set a field error array and an admin notice and return the old values. |
| 200 | - if ( ! $_bVerified ) { |
|
| 200 | + if ( !$_bVerified ) { |
|
| 201 | 201 | $oAdminPage->setFieldErrors( $_aErrors ); |
| 202 | 202 | $oAdminPage->setSettingNotice( __( 'There was something wrong with your input.', 'admin-page-framework-loader' ) ); |
| 203 | 203 | return $aOldInput; |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public function replyToDownloadFramework( $aSavedData, $sSubmittedFieldID, $sSubmittedInputID, $oAdminPage ) { |
| 241 | 241 | |
| 242 | - $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf'; |
|
| 243 | - if ( ! file_exists( $_sFrameworkDirPath ) ) { |
|
| 242 | + $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf'; |
|
| 243 | + if ( !file_exists( $_sFrameworkDirPath ) ) { |
|
| 244 | 244 | return $aSavedData; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $_sFrameworkDirPath, |
| 250 | 250 | $_sTempFile |
| 251 | 251 | ); |
| 252 | - header( "Content-Length: " . strlen( $_sData ) ); |
|
| 252 | + header( "Content-Length: ".strlen( $_sData ) ); |
|
| 253 | 253 | unlink( $_sTempFile ); |
| 254 | 254 | return $_sData; |
| 255 | 255 | |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | $sFrameworkDirPath, |
| 267 | 267 | $sDestinationPath, |
| 268 | 268 | array( |
| 269 | - 'include_directory' => false, // wrap contents in a sub-directory |
|
| 269 | + 'include_directory' => false, // wrap contents in a sub-directory |
|
| 270 | 270 | 'additional_source_directories' => apply_filters( |
| 271 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_additional_source_directories', |
|
| 271 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_additional_source_directories', |
|
| 272 | 272 | array() // directory paths |
| 273 | 273 | ), |
| 274 | 274 | ), |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | ) |
| 280 | 280 | ); |
| 281 | 281 | $_bSucceed = $_oZip->compress(); |
| 282 | - if ( ! $_bSucceed ) { |
|
| 282 | + if ( !$_bSucceed ) { |
|
| 283 | 283 | return ''; |
| 284 | 284 | } |
| 285 | 285 | return file_get_contents( $sDestinationPath ); |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | |
| 300 | 300 | // Check if it belongs to selected components. |
| 301 | 301 | if ( false === $this->_isAllowedArchivePath( $sPathInArchive ) ) { |
| 302 | - return ''; // empty value will drop the entry |
|
| 302 | + return ''; // empty value will drop the entry |
|
| 303 | 303 | } |
| 304 | 304 | return $sPathInArchive; |
| 305 | 305 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | private function _isAllowedArchivePath( $sPath ) { |
| 320 | 320 | |
| 321 | - foreach( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
| 321 | + foreach ( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
| 322 | 322 | $_bHasPrefix = $this->oFactory->oUtil->hasPrefix( |
| 323 | 323 | ltrim( $_sDisallowedPath, '/' ), // needle |
| 324 | 324 | ltrim( $sPath, '/' ) // haystack |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | // List paths. |
| 388 | 388 | $_aAllComponentsPaths = array(); |
| 389 | 389 | $_aSelectedComponentsPaths = array(); |
| 390 | - foreach( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
| 390 | + foreach ( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
| 391 | 391 | |
| 392 | 392 | // Extract all component paths. |
| 393 | 393 | $_aAllComponentsPaths = array_merge( |
@@ -442,16 +442,16 @@ discard block |
||
| 442 | 442 | |
| 443 | 443 | // Check the file extension. |
| 444 | 444 | $_aAllowedExtensions = apply_filters( |
| 445 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_allowed_file_extensions', |
|
| 445 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_allowed_file_extensions', |
|
| 446 | 446 | array( 'php', 'css', 'js' ) |
| 447 | 447 | ); |
| 448 | - if ( ! in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), $_aAllowedExtensions ) ) { |
|
| 448 | + if ( !in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), $_aAllowedExtensions ) ) { |
|
| 449 | 449 | return $sFileContents; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | // Modify the file contents. |
| 453 | 453 | $sFileContents = apply_filters( |
| 454 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_file_contents', |
|
| 454 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_file_contents', |
|
| 455 | 455 | $sFileContents, |
| 456 | 456 | $sPathInArchive, |
| 457 | 457 | $this->oFactory->oUtil->getElement( |
@@ -512,12 +512,12 @@ discard block |
||
| 512 | 512 | $this->_getCheckedComponents() |
| 513 | 513 | ); |
| 514 | 514 | $_aInsert = array( |
| 515 | - 'Included Components: ' . implode( ', ', $_aCheckedComponents ), |
|
| 516 | - 'Generated on ' . date( 'Y-m-d' ), // today's date |
|
| 515 | + 'Included Components: '.implode( ', ', $_aCheckedComponents ), |
|
| 516 | + 'Generated on '.date( 'Y-m-d' ), // today's date |
|
| 517 | 517 | ); |
| 518 | 518 | return preg_replace( |
| 519 | 519 | '#\*/#', // needle - matches '*/' |
| 520 | - implode( PHP_EOL . ' ', $_aInsert ) . ' \0', // replacement \0 is a back-reference to '*/' |
|
| 520 | + implode( PHP_EOL.' ', $_aInsert ).' \0', // replacement \0 is a back-reference to '*/' |
|
| 521 | 521 | $sFileContents, // subject |
| 522 | 522 | 1 // replace only the first occurrence |
| 523 | 523 | ); |
@@ -531,14 +531,14 @@ discard block |
||
| 531 | 531 | private function _modifyClassNameOfInclusionList( $sFileContents ) { |
| 532 | 532 | // Replace the array key names. |
| 533 | 533 | $sFileContents = preg_replace_callback( |
| 534 | - '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
| 535 | - array( $this, '_replyToModifyPathName' ), // callable |
|
| 534 | + '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
| 535 | + array( $this, '_replyToModifyPathName' ), // callable |
|
| 536 | 536 | $sFileContents // subject |
| 537 | 537 | ); |
| 538 | 538 | // Replace the registry class names. |
| 539 | 539 | return preg_replace_callback( |
| 540 | - '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
| 541 | - array( $this, '_replyToModifyPathName' ), // callable |
|
| 540 | + '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
| 541 | + array( $this, '_replyToModifyPathName' ), // callable |
|
| 542 | 542 | $sFileContents // subject |
| 543 | 543 | ); |
| 544 | 544 | } |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | return strlen( $_sPrefix ) |
| 564 | 564 | ? str_replace( |
| 565 | 565 | 'AdminPageFramework', // search |
| 566 | - $_sPrefix . 'AdminPageFramework', // replace |
|
| 566 | + $_sPrefix.'AdminPageFramework', // replace |
|
| 567 | 567 | $sSubject // subject |
| 568 | 568 | ) |
| 569 | 569 | : $sSubject; |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | */ |
| 596 | 596 | private function _getFormSubmitValueByFieldIDAsString( $sFieldID ) { |
| 597 | 597 | |
| 598 | - static $_aCaches=array(); |
|
| 598 | + static $_aCaches = array(); |
|
| 599 | 599 | $_aCaches[ $sFieldID ] = isset( $_aCaches[ $sFieldID ] ) |
| 600 | 600 | ? $_aCaches[ $sFieldID ] |
| 601 | 601 | : $this->oFactory->oUtil->getElement( |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | 'public', |
| 630 | 630 | ), |
| 631 | 631 | 'Content-Description' => 'File Transfer', |
| 632 | - 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
| 632 | + 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
| 633 | 633 | 'Content-Transfer-Encoding' => 'binary', |
| 634 | - 'Content-Disposition' => 'attachment; filename="' . $sFileName .'";', |
|
| 634 | + 'Content-Disposition' => 'attachment; filename="'.$sFileName.'";', |
|
| 635 | 635 | // 'Content-Length' => strlen( $mData ), |
| 636 | 636 | ) + $aHeader; |
| 637 | 637 | |
@@ -668,10 +668,10 @@ discard block |
||
| 668 | 668 | $_sFileNameWOExtension = trim( $_sFileNameWOExtension ); |
| 669 | 669 | return $this->oFactory->oUtil->getAOrB( |
| 670 | 670 | $_sFileNameWOExtension, |
| 671 | - $_sFileNameWOExtension . '-admin-page-framework', |
|
| 671 | + $_sFileNameWOExtension.'-admin-page-framework', |
|
| 672 | 672 | 'admin-page-framework' |
| 673 | 673 | ) |
| 674 | - . '.' . AdminPageFramework_Registry::VERSION |
|
| 674 | + . '.'.AdminPageFramework_Registry::VERSION |
|
| 675 | 675 | . '.zip'; |
| 676 | 676 | |
| 677 | 677 | } |
@@ -139,6 +139,7 @@ |
||
| 139 | 139 | * Modifies the class names of the minified script. |
| 140 | 140 | * |
| 141 | 141 | * @since 3.4.6 |
| 142 | + * @param string $sCode |
|
| 142 | 143 | */ |
| 143 | 144 | private function _modifyClassNames( $sCode ) { |
| 144 | 145 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 4 |
| 27 | 27 | ); |
| 28 | 28 | add_action( |
| 29 | - 'export_name_' . $this->sPageSlug . '_' . $this->sTabSlug, |
|
| 29 | + 'export_name_'.$this->sPageSlug.'_'.$this->sTabSlug, |
|
| 30 | 30 | array( $this, 'replyToFilterFileName' ), 10, 5 |
| 31 | 31 | ); |
| 32 | 32 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'title' => __( 'Class Prefix', 'admin-page-framework-loader' ), |
| 42 | 42 | 'type' => 'text', |
| 43 | 43 | 'description' => __( 'Set alphanumeric characters for the class names', 'admin-page-framework-loader' ) |
| 44 | - . ' ' . __( 'For example, if you set here <code>MyPluginName_</code>, you will need to extend the class named <code>MyClassName_AdminPageFramework</code> instead of <code>AdminPageFramework</code>.', 'admin-page-framework-loader' ) |
|
| 44 | + . ' '.__( 'For example, if you set here <code>MyPluginName_</code>, you will need to extend the class named <code>MyClassName_AdminPageFramework</code> instead of <code>AdminPageFramework</code>.', 'admin-page-framework-loader' ) |
|
| 45 | 45 | . ' e.g.<code>MyPluginName_</code>', |
| 46 | 46 | 'attributes' => array( |
| 47 | 47 | 'size' => 30, |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | 'type' => 'export', |
| 69 | 69 | 'label_min_width' => 0, |
| 70 | 70 | 'value' => __( 'Download', 'adimn-page-framework-demo' ), |
| 71 | - 'file_name' => 'admin-page-framework.min.php', // the default file name. This will be modified by the filter. |
|
| 72 | - 'format' => 'text', // 'json', 'text', 'array' |
|
| 71 | + 'file_name' => 'admin-page-framework.min.php', // the default file name. This will be modified by the filter. |
|
| 72 | + 'format' => 'text', // 'json', 'text', 'array' |
|
| 73 | 73 | 'description' => __( 'Download the minified version.', 'admin-page-framework-loader' ), |
| 74 | 74 | ) |
| 75 | 75 | ); |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | if ( $aInput[ 'class_prefix' ] && empty( $_aMatches ) ) { |
| 102 | 102 | |
| 103 | 103 | // $variable[ 'sectioni_id' ]['field_id'] |
| 104 | - $_aErrors['class_prefix'] = __( 'The prefix must consist of alphanumeric with underscores.', 'admin-page-framework-loader' ); |
|
| 104 | + $_aErrors[ 'class_prefix' ] = __( 'The prefix must consist of alphanumeric with underscores.', 'admin-page-framework-loader' ); |
|
| 105 | 105 | $_bVerified = false; |
| 106 | 106 | |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /* 4. An invalid value is found. */ |
| 110 | - if ( ! $_bVerified ) { |
|
| 110 | + if ( !$_bVerified ) { |
|
| 111 | 111 | |
| 112 | 112 | /* 4-1. Set the error array for the input fields. */ |
| 113 | 113 | $oAdminPage->setFieldErrors( $_aErrors ); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function replyToDownloadMinifiedVersion( $aSavedData, $sSubmittedFieldID, $sSubmittedInputID, $oAdminPage ) { |
| 130 | 130 | |
| 131 | - $_sMinifiedVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/library/admin-page-framework.min.php'; |
|
| 131 | + $_sMinifiedVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/library/admin-page-framework.min.php'; |
|
| 132 | 132 | if ( file_exists( $_sMinifiedVersionPath ) ) { |
| 133 | 133 | return $this->_modifyClassNames( file_get_contents( $_sMinifiedVersionPath ) ); |
| 134 | 134 | } |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | : ''; |
| 148 | 148 | |
| 149 | 149 | return str_replace( |
| 150 | - 'AdminPageFramework', // search |
|
| 151 | - $_sPrefix . 'AdminPageFramework', // replace |
|
| 150 | + 'AdminPageFramework', // search |
|
| 151 | + $_sPrefix.'AdminPageFramework', // replace |
|
| 152 | 152 | $sCode // subject |
| 153 | 153 | ); |
| 154 | 154 | |
@@ -168,7 +168,7 @@ |
||
| 168 | 168 | * ) |
| 169 | 169 | * </code> |
| 170 | 170 | */ |
| 171 | - public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
| 171 | + public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
| 172 | 172 | |
| 173 | 173 | return isset( |
| 174 | 174 | $_POST[ $this->oFactory->oProp->sOptionKey ][ $this->sSectionID ][ 'minified_script_name' ] |