@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | if ( $this->oProp->bIsAdmin ) { |
34 | 34 | |
35 | - add_action( 'load_' . $this->oProp->sPostType, array( $this, '_replyToSetUpHooksForView' ) ); |
|
35 | + add_action( 'load_'.$this->oProp->sPostType, array( $this, '_replyToSetUpHooksForView' ) ); |
|
36 | 36 | |
37 | 37 | // 3.5.10+ |
38 | 38 | add_action( 'admin_menu', array( $this, '_replyToRemoveAddNewSidebarMenu' ) ); |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | private function _removeAddNewSidebarSubMenu( $sMenuKey, $sPostTypeSlug ) { |
107 | 107 | |
108 | 108 | // Remove the default post type menu item. |
109 | - if ( ! isset( $GLOBALS[ 'submenu' ][ $sMenuKey ] ) ) { |
|
109 | + if ( !isset( $GLOBALS[ 'submenu' ][ $sMenuKey ] ) ) { |
|
110 | 110 | // logged-in users of an insufficient access level don't have the menu to be registered. |
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
114 | 114 | foreach ( $GLOBALS[ 'submenu' ][ $sMenuKey ] as $_iIndex => $_aSubMenu ) { |
115 | 115 | |
116 | - if ( ! isset( $_aSubMenu[ 2 ] ) ) { |
|
116 | + if ( !isset( $_aSubMenu[ 2 ] ) ) { |
|
117 | 117 | continue; |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Remove the default Add New entry. |
121 | - if ( 'post-new.php?post_type=' . $sPostTypeSlug === $_aSubMenu[ 2 ] ) { |
|
121 | + if ( 'post-new.php?post_type='.$sPostTypeSlug === $_aSubMenu[ 2 ] ) { |
|
122 | 122 | unset( $GLOBALS[ 'submenu' ][ $sMenuKey ][ $_iIndex ] ); |
123 | 123 | break; |
124 | 124 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function _replyToModifyActionLinks( $aActionLinks, $oPost ) { |
137 | 137 | |
138 | - if ( $oPost->post_type !== $this->oProp->sPostType ){ |
|
138 | + if ( $oPost->post_type !== $this->oProp->sPostType ) { |
|
139 | 139 | return $aActionLinks; |
140 | 140 | } |
141 | 141 | |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function _replyToAddAuthorTableFilter() { |
159 | 159 | |
160 | - if ( ! $this->oProp->bEnableAuthorTableFileter ) { |
|
160 | + if ( !$this->oProp->bEnableAuthorTableFileter ) { |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 | |
164 | 164 | if ( |
165 | - ! ( isset( $_GET[ 'post_type' ] ) && post_type_exists( $_GET[ 'post_type' ] ) |
|
165 | + !( isset( $_GET[ 'post_type' ] ) && post_type_exists( $_GET[ 'post_type' ] ) |
|
166 | 166 | && in_array( strtolower( $_GET[ 'post_type' ] ), array( $this->oProp->sPostType ) ) ) |
167 | 167 | ) { |
168 | 168 | return; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | foreach ( get_object_taxonomies( $GLOBALS[ 'typenow' ] ) as $_sTaxonomySulg ) { |
204 | 204 | |
205 | - if ( ! in_array( $_sTaxonomySulg, $this->oProp->aTaxonomyTableFilters ) ) { |
|
205 | + if ( !in_array( $_sTaxonomySulg, $this->oProp->aTaxonomyTableFilters ) ) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | // Echo the drop down list based on the passed array argument. |
217 | 217 | wp_dropdown_categories( |
218 | 218 | array( |
219 | - 'show_option_all' => $this->oMsg->get( 'show_all' ) . ' ' . $_oTaxonomy->label, |
|
219 | + 'show_option_all' => $this->oMsg->get( 'show_all' ).' '.$_oTaxonomy->label, |
|
220 | 220 | 'taxonomy' => $_sTaxonomySulg, |
221 | 221 | 'name' => $_oTaxonomy->name, |
222 | 222 | 'orderby' => 'name', |
@@ -236,24 +236,24 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @internal |
238 | 238 | */ |
239 | - public function _replyToGetTableFilterQueryForTaxonomies( $oQuery=null ) { |
|
239 | + public function _replyToGetTableFilterQueryForTaxonomies( $oQuery = null ) { |
|
240 | 240 | |
241 | 241 | if ( 'edit.php' != $this->oProp->sPageNow ) { |
242 | 242 | return $oQuery; |
243 | 243 | } |
244 | 244 | |
245 | - if ( ! isset( $GLOBALS[ 'typenow' ] ) ) { |
|
245 | + if ( !isset( $GLOBALS[ 'typenow' ] ) ) { |
|
246 | 246 | return $oQuery; |
247 | 247 | } |
248 | 248 | |
249 | 249 | foreach ( get_object_taxonomies( $GLOBALS[ 'typenow' ] ) as $sTaxonomySlug ) { |
250 | 250 | |
251 | - if ( ! in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
251 | + if ( !in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
252 | 252 | continue; |
253 | 253 | } |
254 | 254 | |
255 | 255 | $sVar = &$oQuery->query_vars[ $sTaxonomySlug ]; |
256 | - if ( ! isset( $sVar ) ) { |
|
256 | + if ( !isset( $sVar ) ) { |
|
257 | 257 | continue; |
258 | 258 | } |
259 | 259 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $this->oProp->sStyle = $this->oUtil->addAndApplyFilters( $this, "style_{$this->oProp->sClassName}", $this->oProp->sStyle ); |
290 | 290 | |
291 | 291 | // Print out the filtered styles. |
292 | - if ( ! empty( $this->oProp->sStyle ) ) { |
|
292 | + if ( !empty( $this->oProp->sStyle ) ) { |
|
293 | 293 | echo "<style type='text/css' id='admin-page-framework-style-post-type'>" |
294 | 294 | . $this->oProp->sStyle |
295 | 295 | . "</style>"; |
@@ -344,10 +344,10 @@ discard block |
||
344 | 344 | */ |
345 | 345 | public function _replyToFilterPostTypeContent( $sContent ) { |
346 | 346 | |
347 | - if ( ! is_singular() ) { |
|
347 | + if ( !is_singular() ) { |
|
348 | 348 | return $sContent; |
349 | 349 | } |
350 | - if ( ! is_main_query() ) { |
|
350 | + if ( !is_main_query() ) { |
|
351 | 351 | return $sContent; |
352 | 352 | } |
353 | 353 | global $post; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @package AdminPageFramework/Factory/PostType |
18 | 18 | * @extends AdminPageFramework_PostType_Model |
19 | 19 | */ |
20 | -abstract class AdminPageFramework_PostType_View extends AdminPageFramework_PostType_Model { |
|
20 | +abstract class AdminPageFramework_PostType_View extends AdminPageFramework_PostType_Model { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Sets up hooks. |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @callback action load_{post type slug} |
49 | 49 | * @since 3.7.9 |
50 | 50 | */ |
51 | - public function _replyToSetUpHooksForView() { |
|
51 | + public function _replyToSetUpHooksForView() { |
|
52 | 52 | |
53 | 53 | // Table filters |
54 | 54 | add_action( 'restrict_manage_posts', array( $this, '_replyToAddAuthorTableFilter' ) ); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | foreach ( $GLOBALS[ 'submenu' ][ $sMenuKey ] as $_iIndex => $_aSubMenu ) { |
114 | 114 | |
115 | - if ( ! isset( $_aSubMenu[ 2 ] ) ) { |
|
115 | + if ( ! isset( $_aSubMenu[ 2 ] ) ) { |
|
116 | 116 | continue; |
117 | 117 | } |
118 | 118 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function _replyToModifyActionLinks( $aActionLinks, $oPost ) { |
136 | 136 | |
137 | - if ( $oPost->post_type !== $this->oProp->sPostType ){ |
|
137 | + if ( $oPost->post_type !== $this->oProp->sPostType ) { |
|
138 | 138 | return $aActionLinks; |
139 | 139 | } |
140 | 140 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function _replyToAddAuthorTableFilter() { |
158 | 158 | |
159 | - if ( ! $this->oProp->bEnableAuthorTableFileter ) { |
|
159 | + if ( ! $this->oProp->bEnableAuthorTableFileter ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function _replyToAddTaxonomyTableFilter() { |
191 | 191 | |
192 | - if ( $GLOBALS[ 'typenow' ] != $this->oProp->sPostType ) { |
|
192 | + if ( $GLOBALS[ 'typenow' ] != $this->oProp->sPostType ) { |
|
193 | 193 | return; |
194 | 194 | } |
195 | 195 | |
@@ -237,22 +237,22 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function _replyToGetTableFilterQueryForTaxonomies( $oQuery=null ) { |
239 | 239 | |
240 | - if ( 'edit.php' != $this->oProp->sPageNow ) { |
|
240 | + if ( 'edit.php' != $this->oProp->sPageNow ) { |
|
241 | 241 | return $oQuery; |
242 | 242 | } |
243 | 243 | |
244 | - if ( ! isset( $GLOBALS[ 'typenow' ] ) ) { |
|
244 | + if ( ! isset( $GLOBALS[ 'typenow' ] ) ) { |
|
245 | 245 | return $oQuery; |
246 | 246 | } |
247 | 247 | |
248 | 248 | foreach ( get_object_taxonomies( $GLOBALS[ 'typenow' ] ) as $sTaxonomySlug ) { |
249 | 249 | |
250 | - if ( ! in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
250 | + if ( ! in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
254 | 254 | $sVar = &$oQuery->query_vars[ $sTaxonomySlug ]; |
255 | - if ( ! isset( $sVar ) ) { |
|
255 | + if ( ! isset( $sVar ) ) { |
|
256 | 256 | continue; |
257 | 257 | } |
258 | 258 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @remark This class should be overridden in the extended class. |
330 | 330 | * @since 3.1.5 |
331 | 331 | */ |
332 | - public function content( $sContent ) { |
|
332 | + public function content( $sContent ) { |
|
333 | 333 | return $sContent; |
334 | 334 | } |
335 | 335 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | array( $this, '_replyToAddPostTypeQueryInEditPostLink' ), |
34 | 34 | 10, |
35 | 35 | 3 |
36 | - ); |
|
36 | + ); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * Sets up hooks and properties. |
22 | 22 | * |
23 | 23 | */ |
24 | - public function __construct( $oProp, $oMsg=null ) { |
|
24 | + public function __construct( $oProp, $oMsg = null ) { |
|
25 | 25 | |
26 | 26 | parent::__construct( $oProp, $oMsg ); |
27 | 27 | |
28 | 28 | // For post type posts listing table page ( edit.php ) |
29 | - if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == $this->oProp->sPostType ) { |
|
29 | + if ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] == $this->oProp->sPostType ) { |
|
30 | 30 | add_action( |
31 | 31 | 'get_edit_post_link', |
32 | 32 | array( $this, '_replyToAddPostTypeQueryInEditPostLink' ), |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ); |
60 | 60 | |
61 | 61 | // If the user explicitly sets an empty string to the label key, do not insert a link. |
62 | - if ( ! $_sLinkLabel ) { |
|
62 | + if ( !$_sLinkLabel ) { |
|
63 | 63 | return $aLinks; |
64 | 64 | } |
65 | 65 | |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | array_unshift( |
68 | 68 | $aLinks, |
69 | 69 | // "<a href='" . esc_url( "edit.php?post_type={$this->oProp->sPostType}" ) . "'>" |
70 | - '<a ' . $this->getAttributes( |
|
70 | + '<a '.$this->getAttributes( |
|
71 | 71 | array( |
72 | 72 | 'href' => esc_url( "edit.php?post_type={$this->oProp->sPostType}" ), |
73 | 73 | // 3.5.7+ Added for acceptance testing |
74 | 74 | 'class' => 'apf-plugin-title-action-link apf-admin-page', |
75 | 75 | ) |
76 | - ) . '>' |
|
76 | + ).'>' |
|
77 | 77 | . $_sLinkLabel |
78 | 78 | . "</a>" |
79 | 79 | ); |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | public function _replyToSetFooterInfo() { |
90 | 90 | |
91 | 91 | if ( |
92 | - ! $this->isPostDefinitionPage( $this->oProp->sPostType ) |
|
93 | - && ! $this->isPostListingPage( $this->oProp->sPostType ) |
|
94 | - && ! $this->isCustomTaxonomyPage( $this->oProp->sPostType ) |
|
92 | + !$this->isPostDefinitionPage( $this->oProp->sPostType ) |
|
93 | + && !$this->isPostListingPage( $this->oProp->sPostType ) |
|
94 | + && !$this->isCustomTaxonomyPage( $this->oProp->sPostType ) |
|
95 | 95 | ) { |
96 | 96 | return; |
97 | 97 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @remark e.g. `http://.../wp-admin/post.php?post=180&action=edit` -> `http://.../wp-admin/post.php?post=180&action=edit&post_type=[...]` |
110 | 110 | * @callback filter get_edit_post_link |
111 | 111 | */ |
112 | - public function _replyToAddPostTypeQueryInEditPostLink( $sURL, $iPostID=null, $sContext=null ) { |
|
112 | + public function _replyToAddPostTypeQueryInEditPostLink( $sURL, $iPostID = null, $sContext = null ) { |
|
113 | 113 | return add_query_arg( |
114 | 114 | array( |
115 | 115 | 'post' => $iPostID, |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | if ( $this->oProp->bIsAdmin ) { |
40 | 40 | |
41 | - add_action( 'load_' . $this->oProp->sPostType, array( $this, '_replyToSetUpHooksForModel' ) ); |
|
41 | + add_action( 'load_'.$this->oProp->sPostType, array( $this, '_replyToSetUpHooksForModel' ) ); |
|
42 | 42 | |
43 | 43 | if ( $this->oProp->sCallerPath ) { |
44 | 44 | new AdminPageFramework_PostType_Model__FlushRewriteRules( $this ); |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | |
66 | 66 | // Properties - sets translatable labels. |
67 | 67 | $this->oProp->aColumnHeaders = array( |
68 | - 'cb' => '<input type="checkbox" />', // Checkbox for bulk actions. |
|
69 | - 'title' => $this->oMsg->get( 'title' ), // Post title. Includes "edit", "quick edit", "trash" and "view" links. If $mode (set from $_REQUEST['mode']) is 'excerpt', a post excerpt is included between the title and links. |
|
70 | - 'author' => $this->oMsg->get( 'author' ), // Post author. |
|
68 | + 'cb' => '<input type="checkbox" />', // Checkbox for bulk actions. |
|
69 | + 'title' => $this->oMsg->get( 'title' ), // Post title. Includes "edit", "quick edit", "trash" and "view" links. If $mode (set from $_REQUEST['mode']) is 'excerpt', a post excerpt is included between the title and links. |
|
70 | + 'author' => $this->oMsg->get( 'author' ), // Post author. |
|
71 | 71 | 'comments' => '<div class="comment-grey-bubble"></div>', // Number of pending comments. |
72 | - 'date' => $this->oMsg->get( 'date' ), // The date and publish status of the post. |
|
72 | + 'date' => $this->oMsg->get( 'date' ), // The date and publish status of the post. |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | echo $this->oUtil->addAndApplyFilter( |
132 | 132 | $this, |
133 | 133 | "cell_{$this->oProp->sPostType}_{$sColumnKey}", |
134 | - '', // value to be filtered - cell output |
|
134 | + '', // value to be filtered - cell output |
|
135 | 135 | $iPostID |
136 | 136 | ); |
137 | 137 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @internal |
181 | 181 | */ |
182 | 182 | public function _replyToRegisterTaxonomies() { |
183 | - foreach( $this->oProp->aTaxonomies as $_sTaxonomySlug => $_aArguments ) { |
|
183 | + foreach ( $this->oProp->aTaxonomies as $_sTaxonomySlug => $_aArguments ) { |
|
184 | 184 | $this->_registerTaxonomy( |
185 | 185 | $_sTaxonomySlug, |
186 | 186 | $this->oUtil->getAsArray( $this->oProp->aTaxonomyObjectTypes[ $_sTaxonomySlug ] ), // object types |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function _registerTaxonomy( $sTaxonomySlug, array $aObjectTypes, array $aArguments ) { |
198 | 198 | |
199 | - if ( ! in_array( $this->oProp->sPostType, $aObjectTypes ) ) { |
|
200 | - $aObjectTypes[] = $this->oProp->sPostType; |
|
199 | + if ( !in_array( $this->oProp->sPostType, $aObjectTypes ) ) { |
|
200 | + $aObjectTypes[ ] = $this->oProp->sPostType; |
|
201 | 201 | } |
202 | 202 | register_taxonomy( |
203 | 203 | $sTaxonomySlug, |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function _replyToRemoveTexonomySubmenuPages() { |
237 | 237 | |
238 | - foreach( $this->oProp->aTaxonomyRemoveSubmenuPages as $sSubmenuPageSlug => $sTopLevelPageSlug ) { |
|
238 | + foreach ( $this->oProp->aTaxonomyRemoveSubmenuPages as $sSubmenuPageSlug => $sTopLevelPageSlug ) { |
|
239 | 239 | |
240 | 240 | remove_submenu_page( $sTopLevelPageSlug, $sSubmenuPageSlug ); |
241 | 241 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @package AdminPageFramework/Factory/PostType |
18 | 18 | * @internal |
19 | 19 | */ |
20 | -abstract class AdminPageFramework_PostType_Model extends AdminPageFramework_PostType_Router { |
|
20 | +abstract class AdminPageFramework_PostType_Model extends AdminPageFramework_PostType_Router { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Sets up hooks and properties. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @callback action manage_{post type slug}_posts_custom_column |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - public function _replyToPrintColumnCell( $sColumnKey, $iPostID ) { |
|
129 | + public function _replyToPrintColumnCell( $sColumnKey, $iPostID ) { |
|
130 | 130 | echo $this->oUtil->addAndApplyFilter( |
131 | 131 | $this, |
132 | 132 | "cell_{$this->oProp->sPostType}_{$sColumnKey}", |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function _replyToDisableAutoSave() { |
146 | 146 | |
147 | - if ( $this->oProp->bEnableAutoSave ) { |
|
147 | + if ( $this->oProp->bEnableAutoSave ) { |
|
148 | 148 | return; |
149 | 149 | } |
150 | - if ( $this->oProp->sPostType != get_post_type() ) { |
|
150 | + if ( $this->oProp->sPostType != get_post_type() ) { |
|
151 | 151 | return; |
152 | 152 | } |
153 | 153 | wp_dequeue_script( 'autosave' ); |
@@ -74,7 +74,7 @@ |
||
74 | 74 | 'title' => 'Title', // Post title. Includes "edit", "quick edit", "trash" and "view" links. If $mode (set from $_REQUEST['mode']) is 'excerpt', a post excerpt is included between the title and links. |
75 | 75 | 'author' => 'Author', // Post author. |
76 | 76 | 'comments' => '<div class="comment-grey-bubble"></div>', // Number of pending comments. |
77 | - 'date' => 'Date', // The date and publish status of the post. |
|
77 | + 'date' => 'Date', // The date and publish status of the post. |
|
78 | 78 | ); |
79 | 79 | |
80 | 80 | /** |
@@ -20,37 +20,37 @@ discard block |
||
20 | 20 | abstract class AdminPageFramework_PostType_Controller extends AdminPageFramework_PostType_View { |
21 | 21 | |
22 | 22 | /** |
23 | - * The method for necessary set-ups. |
|
24 | - * |
|
25 | - * <h4>Example</h4> |
|
26 | - * <code>public function setUp() { |
|
27 | - * $this->setAutoSave( false ); |
|
28 | - * $this->setAuthorTableFilter( true ); |
|
29 | - * $this->addTaxonomy( |
|
30 | - * 'sample_taxonomy', // taxonomy slug |
|
31 | - * array( // argument - for the argument array keys, refer to : http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
32 | - * 'labels' => array( |
|
33 | - * 'name' => 'Genre', |
|
34 | - * 'add_new_item' => 'Add New Genre', |
|
35 | - * 'new_item_name' => "New Genre" |
|
36 | - * ), |
|
37 | - * 'show_ui' => true, |
|
38 | - * 'show_tagcloud' => false, |
|
39 | - * 'hierarchical' => true, |
|
40 | - * 'show_admin_column' => true, |
|
41 | - * 'show_in_nav_menus' => true, |
|
42 | - * 'show_table_filter' => true, // framework specific key |
|
43 | - * 'show_in_sidebar_menus' => false, // framework specific key |
|
44 | - * ) |
|
45 | - * ); |
|
46 | - * }</code> |
|
47 | - * |
|
48 | - * @abstract |
|
49 | - * @since 2.0.0 |
|
50 | - * @remark The user should override this method in their class definition. |
|
51 | - * @remark A callback for the `wp_loaded` hook. |
|
52 | - * @callback action init |
|
53 | - */ |
|
23 | + * The method for necessary set-ups. |
|
24 | + * |
|
25 | + * <h4>Example</h4> |
|
26 | + * <code>public function setUp() { |
|
27 | + * $this->setAutoSave( false ); |
|
28 | + * $this->setAuthorTableFilter( true ); |
|
29 | + * $this->addTaxonomy( |
|
30 | + * 'sample_taxonomy', // taxonomy slug |
|
31 | + * array( // argument - for the argument array keys, refer to : http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
32 | + * 'labels' => array( |
|
33 | + * 'name' => 'Genre', |
|
34 | + * 'add_new_item' => 'Add New Genre', |
|
35 | + * 'new_item_name' => "New Genre" |
|
36 | + * ), |
|
37 | + * 'show_ui' => true, |
|
38 | + * 'show_tagcloud' => false, |
|
39 | + * 'hierarchical' => true, |
|
40 | + * 'show_admin_column' => true, |
|
41 | + * 'show_in_nav_menus' => true, |
|
42 | + * 'show_table_filter' => true, // framework specific key |
|
43 | + * 'show_in_sidebar_menus' => false, // framework specific key |
|
44 | + * ) |
|
45 | + * ); |
|
46 | + * }</code> |
|
47 | + * |
|
48 | + * @abstract |
|
49 | + * @since 2.0.0 |
|
50 | + * @remark The user should override this method in their class definition. |
|
51 | + * @remark A callback for the `wp_loaded` hook. |
|
52 | + * @callback action init |
|
53 | + */ |
|
54 | 54 | public function setUp() {} |
55 | 55 | |
56 | 56 | /** |
@@ -116,49 +116,49 @@ discard block |
||
116 | 116 | * Front-end methods |
117 | 117 | */ |
118 | 118 | /** |
119 | - * Enables or disables the auto-save feature in the custom post type's post submission page. |
|
120 | - * |
|
121 | - * <h4>Example</h4> |
|
122 | - * <code>$this->setAutoSave( false ); |
|
123 | - * </code> |
|
124 | - * |
|
125 | - * @since 2.0.0 |
|
126 | - * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
|
127 | - * return void |
|
128 | - */ |
|
119 | + * Enables or disables the auto-save feature in the custom post type's post submission page. |
|
120 | + * |
|
121 | + * <h4>Example</h4> |
|
122 | + * <code>$this->setAutoSave( false ); |
|
123 | + * </code> |
|
124 | + * |
|
125 | + * @since 2.0.0 |
|
126 | + * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
|
127 | + * return void |
|
128 | + */ |
|
129 | 129 | protected function setAutoSave( $bEnableAutoSave=True ) { |
130 | 130 | $this->oProp->bEnableAutoSave = $bEnableAutoSave; |
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
134 | - * Adds a custom taxonomy to the class post type. |
|
135 | - * <h4>Example</h4> |
|
136 | - * <code>$this->addTaxonomy( |
|
137 | - * 'sample_taxonomy', // taxonomy slug |
|
138 | - * array( // argument |
|
139 | - * 'labels' => array( |
|
140 | - * 'name' => 'Genre', |
|
141 | - * 'add_new_item' => 'Add New Genre', |
|
142 | - * 'new_item_name' => "New Genre" |
|
143 | - * ), |
|
144 | - * 'show_ui' => true, |
|
145 | - * 'show_tagcloud' => false, |
|
146 | - * 'hierarchical' => true, |
|
147 | - * 'show_admin_column' => true, |
|
148 | - * 'show_in_nav_menus' => true, |
|
149 | - * 'show_table_filter' => true, // framework specific key |
|
150 | - * 'show_in_sidebar_menus' => false, // framework specific key |
|
151 | - * ) |
|
152 | - * );</code> |
|
153 | - * |
|
154 | - * @see http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
155 | - * @since 2.0.0 |
|
156 | - * @since 3.1.1 Added the third parameter. |
|
157 | - * @param string $sTaxonomySlug The taxonomy slug. |
|
158 | - * @param array $aArguments The taxonomy argument array passed to the second parameter of the <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments">register_taxonomy()</a> function. |
|
159 | - * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
|
160 | - * @return void |
|
161 | - */ |
|
134 | + * Adds a custom taxonomy to the class post type. |
|
135 | + * <h4>Example</h4> |
|
136 | + * <code>$this->addTaxonomy( |
|
137 | + * 'sample_taxonomy', // taxonomy slug |
|
138 | + * array( // argument |
|
139 | + * 'labels' => array( |
|
140 | + * 'name' => 'Genre', |
|
141 | + * 'add_new_item' => 'Add New Genre', |
|
142 | + * 'new_item_name' => "New Genre" |
|
143 | + * ), |
|
144 | + * 'show_ui' => true, |
|
145 | + * 'show_tagcloud' => false, |
|
146 | + * 'hierarchical' => true, |
|
147 | + * 'show_admin_column' => true, |
|
148 | + * 'show_in_nav_menus' => true, |
|
149 | + * 'show_table_filter' => true, // framework specific key |
|
150 | + * 'show_in_sidebar_menus' => false, // framework specific key |
|
151 | + * ) |
|
152 | + * );</code> |
|
153 | + * |
|
154 | + * @see http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments |
|
155 | + * @since 2.0.0 |
|
156 | + * @since 3.1.1 Added the third parameter. |
|
157 | + * @param string $sTaxonomySlug The taxonomy slug. |
|
158 | + * @param array $aArguments The taxonomy argument array passed to the second parameter of the <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments">register_taxonomy()</a> function. |
|
159 | + * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
|
160 | + * @return void |
|
161 | + */ |
|
162 | 162 | protected function addTaxonomy( $sTaxonomySlug, array $aArguments, array $aAdditionalObjectTypes=array() ) { |
163 | 163 | |
164 | 164 | $sTaxonomySlug = $this->oUtil->sanitizeSlug( $sTaxonomySlug ); |
@@ -220,16 +220,16 @@ discard block |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
223 | - * Sets whether the author drop-down filter is enabled/disabled in the post type post list table. |
|
224 | - * |
|
225 | - * <h4>Example</h4> |
|
226 | - * <code>$this->setAuthorTableFilter( true ); |
|
227 | - * </code> |
|
228 | - * |
|
229 | - * @since 2.0.0 |
|
230 | - * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
|
231 | - * @return void |
|
232 | - */ |
|
223 | + * Sets whether the author drop-down filter is enabled/disabled in the post type post list table. |
|
224 | + * |
|
225 | + * <h4>Example</h4> |
|
226 | + * <code>$this->setAuthorTableFilter( true ); |
|
227 | + * </code> |
|
228 | + * |
|
229 | + * @since 2.0.0 |
|
230 | + * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
|
231 | + * @return void |
|
232 | + */ |
|
233 | 233 | protected function setAuthorTableFilter( $bEnableAuthorTableFileter=false ) { |
234 | 234 | $this->oProp->bEnableAuthorTableFileter = $bEnableAuthorTableFileter; |
235 | 235 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @since 3.0.0 |
71 | 71 | * @return array An array holding the handle IDs of queued items. |
72 | 72 | */ |
73 | - public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
73 | + public function enqueueStyles( $aSRCs, $aCustomArgs = array() ) { |
|
74 | 74 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
75 | 75 | return $this->oResource->_enqueueStyles( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
76 | 76 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * {@inheritdoc} |
82 | 82 | * |
83 | 83 | */ |
84 | - public function enqueueStyle( $sSRC, $aCustomArgs=array() ) { |
|
84 | + public function enqueueStyle( $sSRC, $aCustomArgs = array() ) { |
|
85 | 85 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
86 | 86 | return $this->oResource->_enqueueStyle( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
87 | 87 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return array An array holding the handle IDs of queued items. |
95 | 95 | */ |
96 | - public function enqueueScripts( $aSRCs, $aCustomArgs=array() ) { |
|
96 | + public function enqueueScripts( $aSRCs, $aCustomArgs = array() ) { |
|
97 | 97 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
98 | 98 | return $this->oResource->_enqueueScripts( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
99 | 99 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 3.0.0 |
107 | 107 | */ |
108 | - public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
108 | + public function enqueueScript( $sSRC, $aCustomArgs = array() ) { |
|
109 | 109 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
110 | 110 | return $this->oResource->_enqueueScript( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
111 | 111 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param boolean If true, it enables the auto-save; otherwise, it disables it. |
126 | 126 | * return void |
127 | 127 | */ |
128 | - protected function setAutoSave( $bEnableAutoSave=True ) { |
|
128 | + protected function setAutoSave( $bEnableAutoSave = True ) { |
|
129 | 129 | $this->oProp->bEnableAutoSave = $bEnableAutoSave; |
130 | 130 | } |
131 | 131 | |
@@ -158,20 +158,20 @@ discard block |
||
158 | 158 | * @param array $aAdditionalObjectTypes Additional object types (post types) besides the caller post type. |
159 | 159 | * @return void |
160 | 160 | */ |
161 | - protected function addTaxonomy( $sTaxonomySlug, array $aArguments, array $aAdditionalObjectTypes=array() ) { |
|
161 | + protected function addTaxonomy( $sTaxonomySlug, array $aArguments, array $aAdditionalObjectTypes = array() ) { |
|
162 | 162 | |
163 | 163 | $sTaxonomySlug = $this->oUtil->sanitizeSlug( $sTaxonomySlug ); |
164 | 164 | $aArguments = $aArguments + array( |
165 | 165 | 'show_table_filter' => null, |
166 | 166 | 'show_in_sidebar_menus' => null, |
167 | - 'submenu_order' => 15, // 3.7.4 |
|
168 | - ) ; |
|
167 | + 'submenu_order' => 15, // 3.7.4 |
|
168 | + ); |
|
169 | 169 | $this->oProp->aTaxonomies[ $sTaxonomySlug ] = $aArguments; |
170 | 170 | |
171 | 171 | if ( $aArguments[ 'show_table_filter' ] ) { |
172 | - $this->oProp->aTaxonomyTableFilters[] = $sTaxonomySlug; |
|
172 | + $this->oProp->aTaxonomyTableFilters[ ] = $sTaxonomySlug; |
|
173 | 173 | } |
174 | - if ( ! $aArguments[ 'show_in_sidebar_menus' ] ) { |
|
174 | + if ( !$aArguments[ 'show_in_sidebar_menus' ] ) { |
|
175 | 175 | // @todo investigate the best handling method of taxonomy sub-menu items of a custom post type added to another custom post type menu with the `show_in_menu` argument. |
176 | 176 | $this->oProp->aTaxonomyRemoveSubmenuPages[ "edit-tags.php?taxonomy={$sTaxonomySlug}&post_type={$this->oProp->sPostType}" ] = "edit.php?post_type={$this->oProp->sPostType}"; |
177 | 177 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @param boolean $bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it. |
230 | 230 | * @return void |
231 | 231 | */ |
232 | - protected function setAuthorTableFilter( $bEnableAuthorTableFileter=false ) { |
|
232 | + protected function setAuthorTableFilter( $bEnableAuthorTableFileter = false ) { |
|
233 | 233 | $this->oProp->bEnableAuthorTableFileter = $bEnableAuthorTableFileter; |
234 | 234 | } |
235 | 235 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @since 3.2.0 |
256 | 256 | * @return void |
257 | 257 | */ |
258 | - protected function setArguments( array $aArguments=array() ) { |
|
258 | + protected function setArguments( array $aArguments = array() ) { |
|
259 | 259 | $this->oProp->aPostTypeArgs = $aArguments; |
260 | 260 | } |
261 | 261 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @since 3.0.4 |
17 | 17 | * @package AdminPageFramework/Factory/PostType |
18 | 18 | */ |
19 | -abstract class AdminPageFramework_PostType_Controller extends AdminPageFramework_PostType_View { |
|
19 | +abstract class AdminPageFramework_PostType_Controller extends AdminPageFramework_PostType_View { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * The method for necessary set-ups. |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @since 3.0.0 |
71 | 71 | * @return array An array holding the handle IDs of queued items. |
72 | 72 | */ |
73 | - public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
73 | + public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
74 | 74 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
75 | 75 | return $this->oResource->_enqueueStyles( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
76 | 76 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 3.0.0 |
107 | 107 | */ |
108 | - public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
108 | + public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
109 | 109 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
110 | 110 | return $this->oResource->_enqueueScript( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
111 | 111 | } |
@@ -21,6 +21,6 @@ |
||
21 | 21 | * @extends AdminPageFramework_Form |
22 | 22 | * @internal |
23 | 23 | */ |
24 | -class AdminPageFramework_Form_post_type extends AdminPageFramework_Form { |
|
24 | +class AdminPageFramework_Form_post_type extends AdminPageFramework_Form { |
|
25 | 25 | public $sStructureType = 'post_type'; |
26 | 26 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |
@@ -278,7 +278,7 @@ |
||
278 | 278 | ? "<strong>" . $this->_sScriptName . "</strong>: " |
279 | 279 | : ''; |
280 | 280 | return $_sScripTitle |
281 | - . implode( '<br />', $_aWarnings ); |
|
281 | + . implode( '<br />', $_aWarnings ); |
|
282 | 282 | |
283 | 283 | } |
284 | 284 |
@@ -100,7 +100,7 @@ |
||
100 | 100 | * @since 3.4.6 |
101 | 101 | * @return integer The number of warnings. |
102 | 102 | */ |
103 | - public function check() { |
|
103 | + public function check() { |
|
104 | 104 | |
105 | 105 | $_aWarnings = array(); |
106 | 106 |
@@ -195,6 +195,7 @@ discard block |
||
195 | 195 | * Returns a php warning if present. |
196 | 196 | * @since 3.5.3 |
197 | 197 | * @internal |
198 | + * @param string $sType |
|
198 | 199 | * @return string The warning. |
199 | 200 | */ |
200 | 201 | private function _getWarningByType( $sType ) { |
@@ -294,6 +295,7 @@ discard block |
||
294 | 295 | * if it returns non true (false), it stores the subject warning and returns the array holding the warnings. |
295 | 296 | * |
296 | 297 | * @since 3.4.6 |
298 | + * @param string $sFuncName |
|
297 | 299 | * @return array The warning array. |
298 | 300 | * @internal |
299 | 301 | */ |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | * </ul> |
136 | 136 | * @param string $sScriptName The script name. |
137 | 137 | */ |
138 | - public function __construct( array $aRequirements=array(), $sScriptName='' ) { |
|
138 | + public function __construct( array $aRequirements = array(), $sScriptName = '' ) { |
|
139 | 139 | |
140 | 140 | // Avoid undefined index warnings. |
141 | 141 | $aRequirements = $aRequirements + $this->_aDefaultRequirements; |
142 | 142 | $aRequirements = array_filter( $aRequirements, 'is_array' ); |
143 | - foreach( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
143 | + foreach ( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
144 | 144 | if ( isset( $aRequirements[ $_sName ] ) ) { |
145 | 145 | $aRequirements[ $_sName ] = $aRequirements[ $_sName ] + $this->_aDefaultRequirements[ $_sName ]; |
146 | 146 | } |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | $_aWarnings = array(); |
166 | 166 | |
167 | 167 | // PHP, WordPress, MySQL |
168 | - $_aWarnings[] = $this->_getWarningByType( 'php' ); |
|
169 | - $_aWarnings[] = $this->_getWarningByType( 'wordpress' ); |
|
170 | - $_aWarnings[] = $this->_getWarningByType( 'mysql' ); |
|
168 | + $_aWarnings[ ] = $this->_getWarningByType( 'php' ); |
|
169 | + $_aWarnings[ ] = $this->_getWarningByType( 'wordpress' ); |
|
170 | + $_aWarnings[ ] = $this->_getWarningByType( 'mysql' ); |
|
171 | 171 | |
172 | 172 | // Ensure necessary array elements. |
173 | 173 | $this->_aRequirements = $this->_aRequirements + array( |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | // Check the rest. |
181 | 181 | $_aWarnings = array_merge( |
182 | 182 | $_aWarnings, |
183 | - $this->_checkFunctions( $this->_aRequirements['functions'] ), |
|
184 | - $this->_checkClasses( $this->_aRequirements['classes'] ), |
|
185 | - $this->_checkConstants( $this->_aRequirements['constants'] ), |
|
186 | - $this->_checkFiles( $this->_aRequirements['files'] ) |
|
183 | + $this->_checkFunctions( $this->_aRequirements[ 'functions' ] ), |
|
184 | + $this->_checkClasses( $this->_aRequirements[ 'classes' ] ), |
|
185 | + $this->_checkConstants( $this->_aRequirements[ 'constants' ] ), |
|
186 | + $this->_checkFiles( $this->_aRequirements[ 'files' ] ) |
|
187 | 187 | ); |
188 | 188 | |
189 | 189 | $this->aWarnings = array_filter( $_aWarnings ); // drop empty elements. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @return string The warning. |
198 | 198 | */ |
199 | 199 | private function _getWarningByType( $sType ) { |
200 | - if ( ! isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
200 | + if ( !isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
201 | 201 | return ''; |
202 | 202 | } |
203 | 203 | if ( $this->_checkPHPVersion( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @internal |
227 | 227 | */ |
228 | 228 | private function _checkWordPressVersion( $sWordPressVersion ) { |
229 | - return version_compare( $GLOBALS['wp_version'], $sWordPressVersion, ">=" ); |
|
229 | + return version_compare( $GLOBALS[ 'wp_version' ], $sWordPressVersion, ">=" ); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | */ |
299 | 299 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
300 | 300 | $_aWarnings = array(); |
301 | - foreach( $aSubjects as $_sSubject => $_sWarning ) { |
|
302 | - if ( ! call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
303 | - $_aWarnings[] = sprintf( $_sWarning, $_sSubject ); |
|
301 | + foreach ( $aSubjects as $_sSubject => $_sWarning ) { |
|
302 | + if ( !call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
303 | + $_aWarnings[ ] = sprintf( $_sWarning, $_sSubject ); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | return $_aWarnings; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function _replyToPrintAdminNotices() { |
324 | 324 | |
325 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
325 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
326 | 326 | if ( empty( $_aWarnings ) ) { |
327 | 327 | return; |
328 | 328 | } |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | */ |
342 | 342 | private function _getWarnings() { |
343 | 343 | |
344 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
344 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
345 | 345 | if ( empty( $_aWarnings ) ) { |
346 | 346 | return ''; |
347 | 347 | } |
348 | - $_sScripTitle = $this->_sScriptName |
|
349 | - ? "<strong>" . $this->_sScriptName . "</strong>: " |
|
348 | + $_sScripTitle = $this->_sScriptName |
|
349 | + ? "<strong>".$this->_sScriptName."</strong>: " |
|
350 | 350 | : ''; |
351 | 351 | return $_sScripTitle |
352 | 352 | . implode( '<br />', $_aWarnings ); |
@@ -361,12 +361,12 @@ discard block |
||
361 | 361 | * @param boolean $bIsOnActivation Whether it is called upon plugin activation hook. |
362 | 362 | * @return void |
363 | 363 | */ |
364 | - public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
|
364 | + public function deactivatePlugin( $sPluginFilePath, $sMessage = '', $bIsOnActivation = false ) { |
|
365 | 365 | |
366 | 366 | add_action( 'admin_notices', array( $this, '_replyToPrintAdminNotices' ) ); |
367 | - $this->aWarnings[] = '<strong>' . $sMessage . '</strong>'; |
|
368 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
369 | - if ( ! @include( ABSPATH . '/wp-admin/includes/plugin.php' ) ) { |
|
367 | + $this->aWarnings[ ] = '<strong>'.$sMessage.'</strong>'; |
|
368 | + if ( !function_exists( 'deactivate_plugins' ) ) { |
|
369 | + if ( !@include( ABSPATH.'/wp-admin/includes/plugin.php' ) ) { |
|
370 | 370 | return; |
371 | 371 | } |
372 | 372 | } |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | // Before that, we can display messages to the user. |
377 | 377 | if ( $bIsOnActivation ) { |
378 | 378 | |
379 | - $_sPluginListingPage = add_query_arg( array(), $GLOBALS['pagenow'] ); |
|
380 | - wp_die( $this->_getWarnings() . "<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
379 | + $_sPluginListingPage = add_query_arg( array(), $GLOBALS[ 'pagenow' ] ); |
|
380 | + wp_die( $this->_getWarnings()."<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
381 | 381 | |
382 | 382 | } |
383 | 383 |
@@ -248,7 +248,7 @@ |
||
248 | 248 | in_array( |
249 | 249 | substr( $_sIterationItem, strrpos( $_sIterationItem, '/' ) + 1 ), |
250 | 250 | array( '.', '..' ) |
251 | - ) |
|
251 | + ) |
|
252 | 252 | ) { |
253 | 253 | return; |
254 | 254 | } |
@@ -148,7 +148,7 @@ |
||
148 | 148 | |
149 | 149 | $_sArchiveRootDirName = ''; |
150 | 150 | |
151 | - if ( $bIncludeDir ) { |
|
151 | + if ( $bIncludeDir ) { |
|
152 | 152 | $_sArchiveRootDirName = $this->_getMainDirectoryName( $sSourceDirPath ); |
153 | 153 | $this->_addEmptyDir( |
154 | 154 | $oZip, |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @since 3.6.0 |
57 | 57 | */ |
58 | - public $aOptions = array( |
|
59 | - 'include_directory' => false, // (boolean) whether the contents should be put inside a root directory. |
|
58 | + public $aOptions = array( |
|
59 | + 'include_directory' => false, // (boolean) whether the contents should be put inside a root directory. |
|
60 | 60 | 'additional_source_directories' => array(), |
61 | 61 | // 'ignoring_file_extensions' => array(), // not implemented yet. |
62 | 62 | ); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param array|boolean $abOptions |
71 | 71 | * @param callable $aCallbacks |
72 | 72 | */ |
73 | - public function __construct( $sSource, $sDestination, $abOptions=false, array $aCallbacks=array() ) { |
|
73 | + public function __construct( $sSource, $sDestination, $abOptions = false, array $aCallbacks = array() ) { |
|
74 | 74 | |
75 | 75 | $this->sSource = $sSource; |
76 | 76 | $this->sDestination = $sDestination; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function compress() { |
104 | 104 | |
105 | 105 | // Check whether it is possible to perform the task. |
106 | - if ( ! $this->isFeasible( $this->sSource ) ) { |
|
106 | + if ( !$this->isFeasible( $this->sSource ) ) { |
|
107 | 107 | return false; |
108 | 108 | } |
109 | 109 | |
@@ -113,19 +113,19 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | $_oZip = new ZipArchive(); |
116 | - if ( ! $_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) { |
|
116 | + if ( !$_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) { |
|
117 | 117 | return false; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->sSource = $this->_getSanitizedSourcePath( $this->sSource ); |
121 | 121 | // $this->sSource = str_replace( '\\', '/', realpath( $this->sSource ) ); |
122 | 122 | |
123 | - $_aMethods = array( |
|
123 | + $_aMethods = array( |
|
124 | 124 | 'unknown' => '_replyToReturnFalse', |
125 | 125 | 'directory' => '_replyToCompressDirectory', |
126 | 126 | 'file' => '_replyToCompressFile', |
127 | 127 | ); |
128 | - $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ]; |
|
128 | + $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ]; |
|
129 | 129 | return call_user_func_array( |
130 | 130 | array( $this, $_sMethodName ), |
131 | 131 | array( |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return boolean True on success, false otherwise. |
154 | 154 | * @internal |
155 | 155 | */ |
156 | - public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks=array(), $bIncludeDir=false, array $aAdditionalSourceDirs=array() ) { |
|
156 | + public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks = array(), $bIncludeDir = false, array $aAdditionalSourceDirs = array() ) { |
|
157 | 157 | |
158 | 158 | $_sArchiveRootDirName = ''; |
159 | 159 | |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | * @return void |
185 | 185 | * @internal |
186 | 186 | */ |
187 | - private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName='' ) { |
|
187 | + private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName = '' ) { |
|
188 | 188 | |
189 | - $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ) . '/' : ''; |
|
189 | + $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ).'/' : ''; |
|
190 | 190 | |
191 | - foreach( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) { |
|
191 | + foreach ( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) { |
|
192 | 192 | |
193 | 193 | $_sSourceDirPath = $this->_getSanitizedSourcePath( $_sSourceDirPath ); |
194 | 194 | $_sInsideDirPrefix = is_integer( $_isIndexOrRelativeDirPath ) |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | : $_isIndexOrRelativeDirPath; |
197 | 197 | |
198 | 198 | // Add a directory inside the compressing directory. |
199 | - if( $_sInsideDirPrefix ) { |
|
199 | + if ( $_sInsideDirPrefix ) { |
|
200 | 200 | $this->_addRelativeDir( |
201 | 201 | $oZip, |
202 | 202 | $_sInsideDirPrefix, |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $_sSourceDirPath, |
215 | 215 | $_sIterationItem, |
216 | 216 | $aCallbacks, |
217 | - $sRootDirName . $_sInsideDirPrefix |
|
217 | + $sRootDirName.$_sInsideDirPrefix |
|
218 | 218 | ); |
219 | 219 | } |
220 | 220 | } |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | $sRelativeDirPath = str_replace( '\\', '/', $sRelativeDirPath ); |
230 | 230 | $_aPathPartsParse = array_filter( explode( '/', $sRelativeDirPath ) ); |
231 | 231 | $_aDirPath = array(); |
232 | - foreach( $_aPathPartsParse as $_sDirName ) { |
|
233 | - $_aDirPath[] = $_sDirName; |
|
232 | + foreach ( $_aPathPartsParse as $_sDirName ) { |
|
233 | + $_aDirPath[ ] = $_sDirName; |
|
234 | 234 | $this->_addEmptyDir( |
235 | 235 | $oZip, |
236 | 236 | implode( '/', $_aDirPath ), |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | * @return void |
251 | 251 | * @internal |
252 | 252 | */ |
253 | - private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix='' ) { |
|
253 | + private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix = '' ) { |
|
254 | 254 | |
255 | 255 | $_sIterationItem = str_replace( '\\', '/', $_sIterationItem ); |
256 | - $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ) . '/'; // add a trailing slash |
|
256 | + $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ).'/'; // add a trailing slash |
|
257 | 257 | |
258 | 258 | // Ignore "." and ".." folders |
259 | 259 | if ( |
@@ -271,18 +271,18 @@ discard block |
||
271 | 271 | if ( true === is_dir( $_sIterationItem ) ) { |
272 | 272 | $this->_addEmptyDir( |
273 | 273 | $oZip, |
274 | - $sInsidePathPrefix . str_replace( |
|
275 | - $sSource . '/', |
|
274 | + $sInsidePathPrefix.str_replace( |
|
275 | + $sSource.'/', |
|
276 | 276 | '', |
277 | - $_sIterationItem . '/' |
|
277 | + $_sIterationItem.'/' |
|
278 | 278 | ), |
279 | 279 | $aCallbacks[ 'directory_name' ] |
280 | 280 | ); |
281 | 281 | } else if ( true === is_file( $_sIterationItem ) ) { |
282 | 282 | $this->_addFromString( |
283 | 283 | $oZip, |
284 | - $sInsidePathPrefix . str_replace( |
|
285 | - $sSource . '/', |
|
284 | + $sInsidePathPrefix.str_replace( |
|
285 | + $sSource.'/', |
|
286 | 286 | '', |
287 | 287 | $_sIterationItem |
288 | 288 | ), |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @return boolean True on success, false otherwise. |
313 | 313 | * @internal |
314 | 314 | */ |
315 | - public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks=null ) { |
|
315 | + public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks = null ) { |
|
316 | 316 | $this->_addFromString( |
317 | 317 | $oZip, |
318 | 318 | basename( $sSourceFilePath ), |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @internal |
346 | 346 | */ |
347 | 347 | private function isFeasible( $sSource ) { |
348 | - if ( ! extension_loaded( 'zip' ) ) { |
|
348 | + if ( !extension_loaded( 'zip' ) ) { |
|
349 | 349 | return false; |
350 | 350 | } |
351 | 351 | return file_exists( $sSource ); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | private function _addEmptyDir( ZipArchive $oZip, $sInsidePath, $oCallable ) { |
373 | 373 | $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $oCallable ); |
374 | - if ( ! strlen( $sInsidePath ) ) { |
|
374 | + if ( !strlen( $sInsidePath ) ) { |
|
375 | 375 | return; |
376 | 376 | } |
377 | 377 | $oZip->addEmptyDir( ltrim( $sInsidePath, '/' ) ); |
@@ -384,10 +384,10 @@ discard block |
||
384 | 384 | * @return void |
385 | 385 | * @internal |
386 | 386 | */ |
387 | - private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents='', array $aCallbacks=array() ) { |
|
387 | + private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents = '', array $aCallbacks = array() ) { |
|
388 | 388 | |
389 | 389 | $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $aCallbacks[ 'file_name' ] ); |
390 | - if ( ! strlen( $sInsidePath ) ) { |
|
390 | + if ( !strlen( $sInsidePath ) ) { |
|
391 | 391 | return; |
392 | 392 | } |
393 | 393 | $oZip->addFromString( |