@@ -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 | ); |
@@ -127,7 +127,7 @@ |
||
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 ] |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | |
26 | 26 | // Tabs |
27 | 27 | new AdminPageFrameworkLoader_AdminPage_Help_Information( |
28 | - $oFactory, // factory object |
|
29 | - $this->sPageSlug, // page slug |
|
28 | + $oFactory, // factory object |
|
29 | + $this->sPageSlug, // page slug |
|
30 | 30 | array( // tab definition |
31 | 31 | 'tab_slug' => 'information', |
32 | 32 | 'title' => __( 'Support', 'admin-page-framework-loader' ), |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | 'title' => __( 'Getting Started', 'admin-page-framework-loader' ), |
41 | 41 | 'url' => add_query_arg( |
42 | 42 | array( |
43 | - 'page' => AdminPageFrameworkLoader_Registry::$aAdminPages['about'], |
|
43 | + 'page' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'about' ], |
|
44 | 44 | // 'tab' => 'guide', |
45 | 45 | ), |
46 | 46 | admin_url( 'index.php' ) // Dashboard |
47 | - ) . '#section-getting_started__' |
|
47 | + ).'#section-getting_started__' |
|
48 | 48 | ) |
49 | 49 | ); |
50 | 50 | new AdminPageFrameworkLoader_AdminPage_Help_FAQ( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | 'title' => __( 'About', 'admin-page-framework-loader' ), |
88 | 88 | 'url' => add_query_arg( |
89 | 89 | array( |
90 | - 'page' => AdminPageFrameworkLoader_Registry::$aAdminPages['about'] |
|
90 | + 'page' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'about' ] |
|
91 | 91 | ), |
92 | 92 | admin_url( 'index.php' ) // Dashboard |
93 | 93 | ) |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | |
106 | 106 | // Page meta boxes |
107 | 107 | new AdminPageFrameworkLoader_AdminPageMetaBox_ExternalLinks( |
108 | - null, // meta box id - passing null will make it auto generate |
|
108 | + null, // meta box id - passing null will make it auto generate |
|
109 | 109 | __( 'Resources', 'admin-page-framework-loader' ), // title |
110 | 110 | array( // page slugs |
111 | 111 | AdminPageFrameworkLoader_Registry::$aAdminPages[ 'help' ], |
112 | 112 | ), |
113 | - 'side', // context |
|
113 | + 'side', // context |
|
114 | 114 | 'default' // priority |
115 | 115 | ); |
116 | 116 | |
117 | 117 | $oFactory->enqueueStyle( |
118 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/help.css', |
|
118 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/help.css', |
|
119 | 119 | $this->sPageSlug |
120 | 120 | ); |
121 | 121 |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | // add_filter( 'wp_feed_cache_transient_lifetime', '__return_zero' ); |
34 | 34 | |
35 | 35 | // Styles |
36 | - $this->oFactory->enqueueStyle( AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/column.css' ); |
|
37 | - $this->oFactory->enqueueStyle( AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/feed-list.css' ); |
|
36 | + $this->oFactory->enqueueStyle( AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/column.css' ); |
|
37 | + $this->oFactory->enqueueStyle( AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/feed-list.css' ); |
|
38 | 38 | |
39 | 39 | // $this->oFactory->setPageTitleVisibility( false ); |
40 | 40 | $this->oFactory->setInPageTabsVisibility( false ); |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | public function replyToDoTab() { |
48 | 48 | |
49 | 49 | $_oFeedList = new AdminPageFrameworkLoader_FeedList( $this->sRSSURL ); |
50 | - $_aFeedItems = apply_filters( AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_admin_add_ons', $this->_getDemo() + $_oFeedList->get() ); |
|
50 | + $_aFeedItems = apply_filters( AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_admin_add_ons', $this->_getDemo() + $_oFeedList->get() ); |
|
51 | 51 | if ( empty( $_aFeedItems ) ) { |
52 | - echo "<p>" . __( 'No add-on could be found.', 'admin-page-framework-loader' ) . "</p>"; |
|
52 | + echo "<p>".__( 'No add-on could be found.', 'admin-page-framework-loader' )."</p>"; |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | private function _getList( array $aFeedItems ) { |
68 | 68 | |
69 | 69 | $_aOutput = array(); |
70 | - $_aColumnInfo = array ( // this will be modified as the items get rendered |
|
70 | + $_aColumnInfo = array( // this will be modified as the items get rendered |
|
71 | 71 | 'bRowTagOpened' => false, |
72 | 72 | 'bRowTagClosed' => false, |
73 | 73 | 'iCurrRowPos' => 0, |
74 | 74 | 'iCurrColPos' => 0, |
75 | 75 | ); |
76 | - $_aColumnOption = array ( |
|
76 | + $_aColumnOption = array( |
|
77 | 77 | 'iMaxCols' => 3, |
78 | 78 | 'sClassAttr' => 'apfl_columns', |
79 | 79 | 'sClassAttrGroup' => 'apfl_columns_box', |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | 'sClassAttrFirstCol' => 'apfl_columns_first_col', |
83 | 83 | ); |
84 | 84 | |
85 | - $_sSiteURLWOQuery = preg_replace( '/\?.*/', '', get_bloginfo( 'url' ) ); |
|
86 | - foreach( $aFeedItems as $_aItem ) { |
|
87 | - $_aOutput[] = $this->_getFeedListItem( |
|
85 | + $_sSiteURLWOQuery = preg_replace( '/\?.*/', '', get_bloginfo( 'url' ) ); |
|
86 | + foreach ( $aFeedItems as $_aItem ) { |
|
87 | + $_aOutput[ ] = $this->_getFeedListItem( |
|
88 | 88 | ( array ) $_aItem, |
89 | 89 | $_aColumnInfo, |
90 | 90 | $_aColumnOption, |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // If the section (row) tag is not closed, close it. |
96 | - if ( $_aColumnInfo[ 'bRowTagOpened' ] && ! $_aColumnInfo[ 'bRowTagClosed' ] ) { |
|
97 | - $_aOutput[] = '</div>'; |
|
96 | + if ( $_aColumnInfo[ 'bRowTagOpened' ] && !$_aColumnInfo[ 'bRowTagClosed' ] ) { |
|
97 | + $_aOutput[ ] = '</div>'; |
|
98 | 98 | } |
99 | 99 | $_aColumnInfo[ 'bRowTagClosed' ] = true; |
100 | 100 | |
101 | 101 | // Enclose the output in the group tag |
102 | 102 | return '<div class="apfl_addon_list_container">' |
103 | - . '<div class="' . $_aColumnOption[ 'sClassAttr' ] . ' ' . $_aColumnOption[ 'sClassAttrGroup' ] . '">' |
|
103 | + . '<div class="'.$_aColumnOption[ 'sClassAttr' ].' '.$_aColumnOption[ 'sClassAttrGroup' ].'">' |
|
104 | 104 | . implode( '', $_aOutput ) |
105 | 105 | . '</div>' |
106 | 106 | . '</div>'; |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * Returns an HTML output from the given feed item array. |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - private function _getFeedListItem( array $aItem, array &$aColumnInfo, array $aColumnOption, $sSiteURLWOQuery='' ) { |
|
113 | + private function _getFeedListItem( array $aItem, array &$aColumnInfo, array $aColumnOption, $sSiteURLWOQuery = '' ) { |
|
114 | 114 | |
115 | 115 | // Initial checks |
116 | - if ( ! isset( $aItem[ 'title' ] ) ) { |
|
116 | + if ( !isset( $aItem[ 'title' ] ) ) { |
|
117 | 117 | return ''; |
118 | 118 | } |
119 | 119 | |
@@ -139,20 +139,20 @@ discard block |
||
139 | 139 | $_sTarget = ''; |
140 | 140 | |
141 | 141 | // Enclose the item buffer into the item container |
142 | - $_sItem = '<div class="' . $aColumnOption['sClassAttrCol'] |
|
143 | - . ' apfl_col_element_of_' . $aColumnOption['iMaxCols'] . ' ' |
|
142 | + $_sItem = '<div class="'.$aColumnOption[ 'sClassAttrCol' ] |
|
143 | + . ' apfl_col_element_of_'.$aColumnOption[ 'iMaxCols' ].' ' |
|
144 | 144 | . ' apfl_extension ' |
145 | - . ( ( 1 == $aColumnInfo['iCurrColPos'] ) ? $aColumnOption['sClassAttrFirstCol'] : '' ) |
|
145 | + . ( ( 1 == $aColumnInfo[ 'iCurrColPos' ] ) ? $aColumnOption[ 'sClassAttrFirstCol' ] : '' ) |
|
146 | 146 | . '"' |
147 | 147 | . '>' |
148 | 148 | . '<div class="apfl_addon_item">' |
149 | - . "<h4 class='apfl_feed_item_title'>{$aItem['title']}</h4>" |
|
149 | + . "<h4 class='apfl_feed_item_title'>{$aItem[ 'title' ]}</h4>" |
|
150 | 150 | . "<div class='apfl_feed_item_description'>" |
151 | - . $aItem['description'] |
|
151 | + . $aItem[ 'description' ] |
|
152 | 152 | . "</div>" |
153 | 153 | . "<div class='get-now apfl_feed_item_link_button'>" |
154 | - . "<a href='" . esc_url( $aItem[ 'link' ] ) . "' target='{$_sTarget}' rel='nofollow' class='button button-secondary'>" |
|
155 | - . $aItem['label'] |
|
154 | + . "<a href='".esc_url( $aItem[ 'link' ] )."' target='{$_sTarget}' rel='nofollow' class='button button-secondary'>" |
|
155 | + . $aItem[ 'label' ] |
|
156 | 156 | . "</a>" |
157 | 157 | . "</div>" |
158 | 158 | . '</div>' |
@@ -160,18 +160,18 @@ discard block |
||
160 | 160 | |
161 | 161 | // If it's the first item in the row, add the class attribute. |
162 | 162 | // Be aware that at this point, the tag will be unclosed. Therefore, it must be closed later at some point. |
163 | - if ( 1 == $aColumnInfo['iCurrColPos'] ) { |
|
164 | - $aColumnInfo['bRowTagOpened'] = true; |
|
165 | - $_sItem = '<div class="' . $aColumnOption['sClassAttrRow'] . '">' |
|
163 | + if ( 1 == $aColumnInfo[ 'iCurrColPos' ] ) { |
|
164 | + $aColumnInfo[ 'bRowTagOpened' ] = true; |
|
165 | + $_sItem = '<div class="'.$aColumnOption[ 'sClassAttrRow' ].'">' |
|
166 | 166 | . $_sItem; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // If the current column position reached the set max column, increment the current position of row |
170 | - if ( 0 === ( $aColumnInfo['iCurrColPos'] % $aColumnOption['iMaxCols'] ) ) { |
|
171 | - $aColumnInfo['iCurrRowPos']++; // increment the row number |
|
172 | - $aColumnInfo['iCurrColPos'] = 0; // reset the current column position |
|
173 | - $_sItem .= '</div>'; // close the section(row) div tag |
|
174 | - $aColumnInfo['bRowTagClosed'] = true; |
|
170 | + if ( 0 === ( $aColumnInfo[ 'iCurrColPos' ] % $aColumnOption[ 'iMaxCols' ] ) ) { |
|
171 | + $aColumnInfo[ 'iCurrRowPos' ]++; // increment the row number |
|
172 | + $aColumnInfo[ 'iCurrColPos' ] = 0; // reset the current column position |
|
173 | + $_sItem .= '</div>'; // close the section(row) div tag |
|
174 | + $aColumnInfo[ 'bRowTagClosed' ] = true; |
|
175 | 175 | } |
176 | 176 | return $_sItem; |
177 | 177 | |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | */ |
184 | 184 | private function _getDemo() { |
185 | 185 | |
186 | - $_oOption = AdminPageFrameworkLoader_Option::getInstance( AdminPageFrameworkLoader_Registry::$aOptionKeys['main'] ); |
|
186 | + $_oOption = AdminPageFrameworkLoader_Option::getInstance( AdminPageFrameworkLoader_Registry::$aOptionKeys[ 'main' ] ); |
|
187 | 187 | $_bEnabled = $_oOption->get( 'enable_demo' ); |
188 | 188 | |
189 | 189 | $_sTitle = __( 'Demo', 'admin=page-framework-loader' ); |
190 | 190 | return array( |
191 | 191 | $_sTitle => array( |
192 | 192 | 'title' => $_sTitle, |
193 | - 'description' => '<div style="text-align: center;" class="aligncenter"><img class="aligncenter" src="' . AdminPageFrameworkLoader_Registry::getPluginURL( '/asset/image/icon-128x128.png' ) . '" alt="' . esc_attr( $_sTitle ) . '"/></div>' |
|
193 | + 'description' => '<div style="text-align: center;" class="aligncenter"><img class="aligncenter" src="'.AdminPageFrameworkLoader_Registry::getPluginURL( '/asset/image/icon-128x128.png' ).'" alt="'.esc_attr( $_sTitle ).'"/></div>' |
|
194 | 194 | . '<p>' |
195 | 195 | . __( 'Showcases the features of Admin Page Framework.', 'admin-page-framework-loader' ) |
196 | 196 | . '</p>', |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | ? 0 |
201 | 201 | : 1, |
202 | 202 | ) + $_GET, |
203 | - admin_url( $GLOBALS['pagenow'] ) |
|
203 | + admin_url( $GLOBALS[ 'pagenow' ] ) |
|
204 | 204 | ), |
205 | 205 | 'label' => $_bEnabled |
206 | 206 | ? "<span id='button-deactivate-demo' class='deactivate'>" |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function replyToDecideToLoad( /* $oScreen */ ) { |
35 | 35 | |
36 | - if ( ! $this->_isInThePage() ) { |
|
36 | + if ( !$this->_isInThePage() ) { |
|
37 | 37 | return; |
38 | 38 | } |
39 | 39 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | // Retrieve the development version. |
46 | 46 | $this->_sDevelopmentVersion = $this->oUtil->getTransient( |
47 | - AdminPageFrameworkLoader_Registry::TRANSIENT_PREFIX . 'devver' |
|
47 | + AdminPageFrameworkLoader_Registry::TRANSIENT_PREFIX.'devver' |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | // Disable the meta box if the development version is not above the running one. |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | private function _scheduleEvent() { |
65 | 65 | |
66 | - $_sActionName = AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_action_get_development_version'; |
|
66 | + $_sActionName = AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_action_get_development_version'; |
|
67 | 67 | $_aArguments = array(); |
68 | 68 | if ( wp_next_scheduled( $_sActionName, $_aArguments ) ) { |
69 | 69 | return false; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ) |
98 | 98 | . "</p>" |
99 | 99 | . "<div style='width:100%; display:inline-block;'>" |
100 | - . '<a href="' . esc_url( 'https://github.com/michaeluno/admin-page-framework/archive/dev.zip' ). '">' |
|
100 | + . '<a href="'.esc_url( 'https://github.com/michaeluno/admin-page-framework/archive/dev.zip' ).'">' |
|
101 | 101 | . "<div class='button button-primary float-right'>" |
102 | 102 | . __( 'Download', 'admin-page-framework-loader' ) |
103 | 103 | . "</div>" |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | . "</div>" |
106 | 106 | ; |
107 | 107 | |
108 | - return $_sInsert . $sContent; |
|
108 | + return $_sInsert.$sContent; |
|
109 | 109 | |
110 | 110 | } |
111 | 111 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | '' // default value |
40 | 40 | ); |
41 | 41 | |
42 | - if ( ! $this->canUserView( $this->sCapability ) ) { |
|
42 | + if ( !$this->canUserView( $this->sCapability ) ) { |
|
43 | 43 | return ''; |
44 | 44 | } |
45 | 45 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @return array |
49 | 49 | */ |
50 | - public function get( $iItems=0 ) { |
|
50 | + public function get( $iItems = 0 ) { |
|
51 | 51 | |
52 | 52 | $_aOutput = array(); |
53 | 53 | $_aURLs = $this->_aURLs; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return $_aOutput; |
57 | 57 | } |
58 | 58 | |
59 | - $_oFeed = fetch_feed( $_aURLs ); |
|
59 | + $_oFeed = fetch_feed( $_aURLs ); |
|
60 | 60 | if ( is_wp_error( $_oFeed ) ) { |
61 | 61 | return $_aOutput; |
62 | 62 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'title' => $_oItem->get_title(), |
68 | 68 | 'date' => $_oItem->get_date( 'j F Y, g:i a' ), |
69 | 69 | 'author' => $_oItem->get_author(), |
70 | - 'link' => $_oItem->get_permalink(), // get_link() may be used as well |
|
70 | + 'link' => $_oItem->get_permalink(), // get_link() may be used as well |
|
71 | 71 | ); |
72 | 72 | } |
73 | 73 |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | static public function getRelativePath( $from, $to ) { |
29 | 29 | |
30 | 30 | // some compatibility fixes for Windows paths |
31 | - $from = is_dir( $from ) ? rtrim( $from, '\/') . '/' : $from; |
|
32 | - $to = is_dir( $to ) ? rtrim( $to, '\/') . '/' : $to; |
|
31 | + $from = is_dir( $from ) ? rtrim( $from, '\/' ).'/' : $from; |
|
32 | + $to = is_dir( $to ) ? rtrim( $to, '\/' ).'/' : $to; |
|
33 | 33 | $from = str_replace( '\\', '/', $from ); |
34 | 34 | $to = str_replace( '\\', '/', $to ); |
35 | 35 | |
@@ -37,21 +37,21 @@ discard block |
||
37 | 37 | $to = explode( '/', $to ); |
38 | 38 | $relPath = $to; |
39 | 39 | |
40 | - foreach( $from as $depth => $dir ) { |
|
40 | + foreach ( $from as $depth => $dir ) { |
|
41 | 41 | // find first non-matching dir |
42 | - if( $dir === $to[ $depth ] ) { |
|
42 | + if ( $dir === $to[ $depth ] ) { |
|
43 | 43 | // ignore this directory |
44 | 44 | array_shift( $relPath ); |
45 | 45 | } else { |
46 | 46 | // get number of remaining dirs to $from |
47 | 47 | $remaining = count( $from ) - $depth; |
48 | - if( $remaining > 1 ) { |
|
48 | + if ( $remaining > 1 ) { |
|
49 | 49 | // add traversals up to first matching dir |
50 | 50 | $padLength = ( count( $relPath ) + $remaining - 1 ) * -1; |
51 | 51 | $relPath = array_pad( $relPath, $padLength, '..' ); |
52 | 52 | break; |
53 | 53 | } else { |
54 | - $relPath[ 0 ] = './' . $relPath[ 0 ]; |
|
54 | + $relPath[ 0 ] = './'.$relPath[ 0 ]; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'debug_backtrace', |
76 | 76 | self::_getDebugBacktraceArguments() |
77 | 77 | ); |
78 | - foreach( $_aBackTrace as $_aDebugInfo ) { |
|
78 | + foreach ( $_aBackTrace as $_aDebugInfo ) { |
|
79 | 79 | $_aDebugInfo = self::getAsArray( $_aDebugInfo ) + array( 'file' => '' ); // prevents an undefined index |
80 | 80 | $_sCallerFilePath = $_aDebugInfo[ 'file' ]; |
81 | 81 | if ( in_array( $_sCallerFilePath, $_aRedirectedFilePaths ) ) { |
@@ -75,7 +75,7 @@ |
||
75 | 75 | 'debug_backtrace', |
76 | 76 | self::_getDebugBacktraceArguments() |
77 | 77 | ); |
78 | - foreach( $_aBackTrace as $_aDebugInfo ) { |
|
78 | + foreach( $_aBackTrace as $_aDebugInfo ) { |
|
79 | 79 | $_aDebugInfo = self::getAsArray( $_aDebugInfo ) + array( 'file' => '' ); // prevents an undefined index |
80 | 80 | $_sCallerFilePath = $_aDebugInfo[ 'file' ]; |
81 | 81 | if ( in_array( $_sCallerFilePath, $_aRedirectedFilePaths ) ) { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | // Do actions before rendering the page. In this order, global -> page -> in-page tab |
49 | 49 | $this->addAndDoActions( |
50 | - $this->oFactory, // the caller object |
|
50 | + $this->oFactory, // the caller object |
|
51 | 51 | $this->getFilterArrayByPrefix( 'do_before_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true ), // the action hooks |
52 | 52 | $this->oFactory // the argument 1 |
53 | 53 | ); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | </div><!-- #post-body --> |
73 | 73 | </div><!-- #poststuff --> |
74 | 74 | |
75 | - <?php echo $this->_printFormClosingTag( $_sPageSlug, $_sTabSlug, $this->oFactory->oProp->bEnableForm ); // </form> ?> |
|
75 | + <?php echo $this->_printFormClosingTag( $_sPageSlug, $_sTabSlug, $this->oFactory->oProp->bEnableForm ); // </form> ?> |
|
76 | 76 | </div><!-- .admin-page-framework-container --> |
77 | 77 | |
78 | 78 | <?php |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | <?php |
84 | 84 | // Do actions after rendering the page. |
85 | 85 | $this->addAndDoActions( |
86 | - $this->oFactory, // the caller object |
|
86 | + $this->oFactory, // the caller object |
|
87 | 87 | $this->getFilterArrayByPrefix( 'do_after_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true ), // the action hooks |
88 | 88 | $this->oFactory // the argument 1 |
89 | 89 | ); |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | */ |
101 | 101 | private function _getNumberOfColumns() { |
102 | 102 | |
103 | - if ( ! $this->doesMetaBoxExist( 'side' ) ) { |
|
103 | + if ( !$this->doesMetaBoxExist( 'side' ) ) { |
|
104 | 104 | return 1; |
105 | 105 | } |
106 | 106 | |
107 | 107 | $_iColumns = $this->getNumberOfScreenColumns(); |
108 | 108 | return $_iColumns |
109 | 109 | ? $_iColumns |
110 | - : 1; // default - this is because generic pages do not have meta boxes. |
|
110 | + : 1; // default - this is because generic pages do not have meta boxes. |
|
111 | 111 | } |
112 | 112 | // @deprecated |
113 | 113 | // Make sure if no side meta box exists, set it 1. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | private function _getContentTop() { |
127 | 127 | |
128 | 128 | // Screen icon, page heading tabs(page title), and in-page tabs. |
129 | - $_oScreenIcon = new AdminPageFramework_View__PageRenderer__ScreenIcon( |
|
129 | + $_oScreenIcon = new AdminPageFramework_View__PageRenderer__ScreenIcon( |
|
130 | 130 | $this->oFactory, |
131 | 131 | $this->sPageSlug, |
132 | 132 | $this->sTabSlug |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $this->oFactory, |
143 | 143 | $this->sPageSlug |
144 | 144 | ); |
145 | - $_sContentTop .= $_oInPageTabs->get(); |
|
145 | + $_sContentTop .= $_oInPageTabs->get(); |
|
146 | 146 | |
147 | 147 | // Apply filters in this order, in-page tab -> page -> global. |
148 | 148 | return $this->addAndApplyFilters( |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | private function _getFormOutput( $sPageSlug ) { |
216 | 216 | |
217 | - if ( ! $this->oFactory->oProp->bEnableForm ) { |
|
217 | + if ( !$this->oFactory->oProp->bEnableForm ) { |
|
218 | 218 | return ''; |
219 | 219 | } |
220 | 220 | return $this->oFactory->oForm->get(); |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | * @internal |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - private function _printFormOpeningTag( $fEnableForm=true ) { |
|
247 | + private function _printFormOpeningTag( $fEnableForm = true ) { |
|
248 | 248 | |
249 | - if ( ! $fEnableForm ) { |
|
249 | + if ( !$fEnableForm ) { |
|
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | 'action' => wp_unslash( remove_query_arg( 'settings-updated', $this->oFactory->oProp->sTargetFormPage ) ), |
260 | 260 | ) |
261 | 261 | ) |
262 | - . " >" . PHP_EOL; |
|
262 | + . " >".PHP_EOL; |
|
263 | 263 | |
264 | 264 | // [3.5.11+] Insert a mark that indicates the framework form has started. |
265 | 265 | // This will be checked in the validation method with the `is_admin_page_framework` input value which gets inserted at the end of the form |
266 | 266 | // in order to determine all the fields are sent for the PHP max_input_vars limitation set in the server configuration. |
267 | - echo "<input type='hidden' name='admin_page_framework_start' value='1' />" . PHP_EOL; |
|
267 | + echo "<input type='hidden' name='admin_page_framework_start' value='1' />".PHP_EOL; |
|
268 | 268 | |
269 | 269 | // Embed the '_wp_http_referer' hidden field that is checked in the submit data processing method. |
270 | 270 | settings_fields( $this->oFactory->oProp->sOptionKey ); |
@@ -280,16 +280,16 @@ discard block |
||
280 | 280 | * @internal |
281 | 281 | * @return void |
282 | 282 | */ |
283 | - private function _printFormClosingTag( $sPageSlug, $sTabSlug, $fEnableForm=true ) { |
|
283 | + private function _printFormClosingTag( $sPageSlug, $sTabSlug, $fEnableForm = true ) { |
|
284 | 284 | |
285 | - if ( ! $fEnableForm ) { |
|
285 | + if ( !$fEnableForm ) { |
|
286 | 286 | return; |
287 | 287 | } |
288 | - $_sNonce = wp_create_nonce( 'form_' . md5( $this->oFactory->oProp->sClassName . get_current_user_id() ) ); |
|
289 | - echo "<input type='hidden' name='page_slug' value='{$sPageSlug}' />" . PHP_EOL |
|
290 | - . "<input type='hidden' name='tab_slug' value='{$sTabSlug}' />" . PHP_EOL |
|
291 | - . "<input type='hidden' name='_is_admin_page_framework' value='{$_sNonce}' />" . PHP_EOL |
|
292 | - . "</form><!-- End Form -->" . PHP_EOL; |
|
288 | + $_sNonce = wp_create_nonce( 'form_'.md5( $this->oFactory->oProp->sClassName.get_current_user_id() ) ); |
|
289 | + echo "<input type='hidden' name='page_slug' value='{$sPageSlug}' />".PHP_EOL |
|
290 | + . "<input type='hidden' name='tab_slug' value='{$sTabSlug}' />".PHP_EOL |
|
291 | + . "<input type='hidden' name='_is_admin_page_framework' value='{$_sNonce}' />".PHP_EOL |
|
292 | + . "</form><!-- End Form -->".PHP_EOL; |
|
293 | 293 | |
294 | 294 | } |
295 | 295 |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function _appendInternalAssets( $sInternal, &$aContainer ) { |
69 | 69 | $_aInternals = array_unique( $aContainer ); |
70 | - $sInternal = PHP_EOL . $sInternal; |
|
71 | - foreach( $_aInternals as $_iIndex => $_sInternal ) { |
|
72 | - $sInternal .= $_sInternal . PHP_EOL; |
|
70 | + $sInternal = PHP_EOL.$sInternal; |
|
71 | + foreach ( $_aInternals as $_iIndex => $_sInternal ) { |
|
72 | + $sInternal .= $_sInternal.PHP_EOL; |
|
73 | 73 | unset( $_aInternals[ $_iIndex ] ); |
74 | 74 | } |
75 | 75 | $aContainer = $_aInternals; // update the container array. |
@@ -83,23 +83,23 @@ discard block |
||
83 | 83 | private function _parseAssets( $oFactory ) { |
84 | 84 | |
85 | 85 | // page |
86 | - $_aPageStyles = $this->getElementAsArray( |
|
86 | + $_aPageStyles = $this->getElementAsArray( |
|
87 | 87 | $oFactory->oProp->aPages, |
88 | 88 | array( $this->sCurrentPageSlug, 'style' ) |
89 | 89 | ); |
90 | 90 | $this->_enqueuePageAssets( $_aPageStyles, 'style' ); |
91 | 91 | |
92 | - $_aPageScripts = $this->getElementAsArray( |
|
92 | + $_aPageScripts = $this->getElementAsArray( |
|
93 | 93 | $oFactory->oProp->aPages, |
94 | 94 | array( $this->sCurrentPageSlug, 'script' ) |
95 | 95 | ); |
96 | 96 | $this->_enqueuePageAssets( $_aPageScripts, 'script' ); |
97 | 97 | |
98 | 98 | // In-page tabs |
99 | - if ( ! $this->sCurrentTabSlug ) { |
|
99 | + if ( !$this->sCurrentTabSlug ) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | - $_aInPageTabStyles = $this->getElementAsArray( |
|
102 | + $_aInPageTabStyles = $this->getElementAsArray( |
|
103 | 103 | $oFactory->oProp->aInPageTabs, |
104 | 104 | array( $this->sCurrentPageSlug, $this->sCurrentTabSlug, 'style' ) |
105 | 105 | ); |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | * @since 3.6.3 |
117 | 117 | * @return void |
118 | 118 | */ |
119 | - private function _enqueuePageAssets( array $aPageAssets, $sType='style' ) { |
|
120 | - $_sMethodName = "_enqueueAsset_" . $sType; |
|
121 | - foreach( $aPageAssets as $_asPageAsset ) { |
|
122 | - $this->{$_sMethodName}( $_asPageAsset); |
|
119 | + private function _enqueuePageAssets( array $aPageAssets, $sType = 'style' ) { |
|
120 | + $_sMethodName = "_enqueueAsset_".$sType; |
|
121 | + foreach ( $aPageAssets as $_asPageAsset ) { |
|
122 | + $this->{$_sMethodName}( $_asPageAsset ); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | // Insert the CSS rule in the head tag. |
147 | - $this->aCSSRules[] = $_sSRC; |
|
147 | + $this->aCSSRules[ ] = $_sSRC; |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | // Insert the scripts in the head tag. |
172 | - $this->aScripts[] = $_sSRC; |
|
172 | + $this->aScripts[ ] = $_sSRC; |
|
173 | 173 | |
174 | 174 | } |
175 | 175 |