@@ -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; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @subpackage PostType |
19 | 19 | * @extends AdminPageFramework_PostType_Model |
20 | 20 | */ |
21 | -abstract class AdminPageFramework_PostType_View extends AdminPageFramework_PostType_Model { |
|
21 | +abstract class AdminPageFramework_PostType_View extends AdminPageFramework_PostType_Model { |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Sets up hooks. |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @callback action load_{post type slug} |
50 | 50 | * @since 3.7.9 |
51 | 51 | */ |
52 | - public function _replyToSetUpHooksForView() { |
|
52 | + public function _replyToSetUpHooksForView() { |
|
53 | 53 | |
54 | 54 | // Table filters |
55 | 55 | add_action( 'restrict_manage_posts', array( $this, '_replyToAddAuthorTableFilter' ) ); |
@@ -113,7 +113,7 @@ discard block |
||
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 | |
@@ -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,7 +157,7 @@ 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 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function _replyToAddTaxonomyTableFilter() { |
192 | 192 | |
193 | - if ( $GLOBALS[ 'typenow' ] != $this->oProp->sPostType ) { |
|
193 | + if ( $GLOBALS[ 'typenow' ] != $this->oProp->sPostType ) { |
|
194 | 194 | return; |
195 | 195 | } |
196 | 196 | |
@@ -238,22 +238,22 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function _replyToGetTableFilterQueryForTaxonomies( $oQuery=null ) { |
240 | 240 | |
241 | - if ( 'edit.php' != $this->oProp->sPageNow ) { |
|
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 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @remark This class should be overridden in the extended class. |
331 | 331 | * @since 3.1.5 |
332 | 332 | */ |
333 | - public function content( $sContent ) { |
|
333 | + public function content( $sContent ) { |
|
334 | 334 | return $sContent; |
335 | 335 | } |
336 | 336 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | array( $this, '_replyToAddPostTypeQueryInEditPostLink' ), |
34 | 34 | 10, |
35 | 35 | 3 |
36 | - ); |
|
36 | + ); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | * Sets up hooks and properties. |
23 | 23 | * |
24 | 24 | */ |
25 | - public function __construct( $oProp, $oMsg=null ) { |
|
25 | + public function __construct( $oProp, $oMsg = null ) { |
|
26 | 26 | |
27 | 27 | parent::__construct( $oProp, $oMsg ); |
28 | 28 | |
29 | 29 | // For post type posts listing table page ( edit.php ) |
30 | - if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == $this->oProp->sPostType ) { |
|
30 | + if ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] == $this->oProp->sPostType ) { |
|
31 | 31 | add_action( |
32 | 32 | 'get_edit_post_link', |
33 | 33 | array( $this, '_replyToAddPostTypeQueryInEditPostLink' ), |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ); |
54 | 54 | |
55 | 55 | // If the user explicitly sets an empty string to the label key, do not insert a link. |
56 | - if ( ! $_sLinkLabel ) { |
|
56 | + if ( !$_sLinkLabel ) { |
|
57 | 57 | return $aLinks; |
58 | 58 | } |
59 | 59 | |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | array_unshift( |
62 | 62 | $aLinks, |
63 | 63 | // "<a href='" . esc_url( "edit.php?post_type={$this->oProp->sPostType}" ) . "'>" |
64 | - '<a ' . $this->getAttributes( |
|
64 | + '<a '.$this->getAttributes( |
|
65 | 65 | array( |
66 | 66 | 'href' => esc_url( "edit.php?post_type={$this->oProp->sPostType}" ), |
67 | 67 | // 3.5.7+ Added for acceptance testing |
68 | 68 | 'class' => 'apf-plugin-title-action-link apf-admin-page', |
69 | 69 | ) |
70 | - ) . '>' |
|
70 | + ).'>' |
|
71 | 71 | . $_sLinkLabel |
72 | 72 | . "</a>" |
73 | 73 | ); |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | public function _replyToSetFooterInfo() { |
84 | 84 | |
85 | 85 | if ( |
86 | - ! $this->isPostDefinitionPage( $this->oProp->sPostType ) |
|
87 | - && ! $this->isPostListingPage( $this->oProp->sPostType ) |
|
88 | - && ! $this->isCustomTaxonomyPage( $this->oProp->sPostType ) |
|
86 | + !$this->isPostDefinitionPage( $this->oProp->sPostType ) |
|
87 | + && !$this->isPostListingPage( $this->oProp->sPostType ) |
|
88 | + && !$this->isCustomTaxonomyPage( $this->oProp->sPostType ) |
|
89 | 89 | ) { |
90 | 90 | return; |
91 | 91 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @remark e.g. `http://.../wp-admin/post.php?post=180&action=edit` -> `http://.../wp-admin/post.php?post=180&action=edit&post_type=[...]` |
104 | 104 | * @callback filter get_edit_post_link |
105 | 105 | */ |
106 | - public function _replyToAddPostTypeQueryInEditPostLink( $sURL, $iPostID=null, $sContext=null ) { |
|
106 | + public function _replyToAddPostTypeQueryInEditPostLink( $sURL, $iPostID = null, $sContext = null ) { |
|
107 | 107 | return add_query_arg( |
108 | 108 | array( |
109 | 109 | 'post' => $iPostID, |
@@ -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 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | if ( in_array( $oProp->sClassName, self::$aClassNames ) ) |
31 | 31 | return self::$_oInstance; |
32 | 32 | |
33 | - self::$aClassNames[] = $oProp->sClassName; |
|
33 | + self::$aClassNames[ ] = $oProp->sClassName; |
|
34 | 34 | self::$_oInstance = new AdminPageFramework_PageLoadInfo_PostType( $oProp, $oMsg ); |
35 | 35 | |
36 | 36 | return self::$_oInstance; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function _replyToSetPageLoadInfoInFooter() { |
45 | 45 | |
46 | 46 | // Some users sets $_GET['post_type'] element even in regular admin pages. In that case, do not load the style to avoid duplicates. |
47 | - if ( isset( $_GET['page'] ) && $_GET['page'] ) { return; } |
|
47 | + if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] ) { return; } |
|
48 | 48 | |
49 | 49 | // For post type pages |
50 | 50 | if ( |
@@ -27,8 +27,9 @@ |
||
27 | 27 | */ |
28 | 28 | public static function instantiate( $oProp, $oMsg ) { |
29 | 29 | |
30 | - if ( in_array( $oProp->sClassName, self::$aClassNames ) ) |
|
31 | - return self::$_oInstance; |
|
30 | + if ( in_array( $oProp->sClassName, self::$aClassNames ) ) { |
|
31 | + return self::$_oInstance; |
|
32 | + } |
|
32 | 33 | |
33 | 34 | self::$aClassNames[] = $oProp->sClassName; |
34 | 35 | self::$_oInstance = new AdminPageFramework_PageLoadInfo_PostType( $oProp, $oMsg ); |
@@ -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 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
7 | 7 | * |
8 | 8 | */ |
9 | -if ( ! class_exists( 'AdminPageFramework_NetworkAdmin_Documentation', false ) ) : |
|
9 | +if ( !class_exists( 'AdminPageFramework_NetworkAdmin_Documentation', false ) ) : |
|
10 | 10 | /** |
11 | 11 | * Provides an abstract base to create admin pages in the network admin area. |
12 | 12 | * |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param integer $iDepth The header number to parse. |
32 | 32 | * @param string $sTitle The heading title which appears at the beginning of the output. |
33 | 33 | */ |
34 | - public function __construct( $sHTML, $iDepth=4, $sTitle='' ) { |
|
34 | + public function __construct( $sHTML, $iDepth = 4, $sTitle = '' ) { |
|
35 | 35 | |
36 | 36 | $this->sTitle = $sTitle; |
37 | 37 | $this->sHTML = $sHTML; |
@@ -64,26 +64,26 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function getTOC() { |
66 | 66 | |
67 | - $iDepth = $this->iDepth; |
|
67 | + $iDepth = $this->iDepth; |
|
68 | 68 | |
69 | 69 | // get the headings down to the specified depth |
70 | 70 | $this->sHTML = preg_replace_callback( |
71 | - '/<h[2-' . $iDepth . ']*[^>]*>.*?<\/h[2-' . $iDepth . ']>/i', |
|
71 | + '/<h[2-'.$iDepth.']*[^>]*>.*?<\/h[2-'.$iDepth.']>/i', |
|
72 | 72 | array( $this, '_replyToInsertNamedElement' ), |
73 | 73 | $this->sHTML |
74 | 74 | ); |
75 | 75 | |
76 | 76 | $_aOutput = array(); |
77 | - foreach( $this->_aMatches as $_iIndex => $_sMatch ) { |
|
77 | + foreach ( $this->_aMatches as $_iIndex => $_sMatch ) { |
|
78 | 78 | $_sMatch = strip_tags( $_sMatch, '<h1><h2><h3><h4><h5><h6><h7><h8>' ); |
79 | - $_sMatch = preg_replace( '/<h([1-' . $iDepth . '])>/', '<li class="toc$1"><a href="#toc_' . $_iIndex . '">', $_sMatch ); |
|
80 | - $_sMatch = preg_replace( '/<\/h[1-' . $iDepth . ']>/', '</a></li>', $_sMatch ); |
|
81 | - $_aOutput[] = $_sMatch; |
|
79 | + $_sMatch = preg_replace( '/<h([1-'.$iDepth.'])>/', '<li class="toc$1"><a href="#toc_'.$_iIndex.'">', $_sMatch ); |
|
80 | + $_sMatch = preg_replace( '/<\/h[1-'.$iDepth.']>/', '</a></li>', $_sMatch ); |
|
81 | + $_aOutput[ ] = $_sMatch; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // plug the results into appropriate HTML tags |
85 | 85 | $this->sTitle = $this->sTitle |
86 | - ? '<p class="toc-title">' . $this->sTitle . '</p>' |
|
86 | + ? '<p class="toc-title">'.$this->sTitle.'</p>' |
|
87 | 87 | : ''; |
88 | 88 | return '<div class="toc">' |
89 | 89 | . $this->sTitle |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | public function _replyToInsertNamedElement( $aMatches ) { |
98 | 98 | static $_icount = -1; |
99 | 99 | $_icount++; |
100 | - $this->_aMatches[] = $aMatches[ 0 ]; |
|
101 | - return "<span class='toc_header_link' id='toc_{$_icount}'></span>" . PHP_EOL |
|
100 | + $this->_aMatches[ ] = $aMatches[ 0 ]; |
|
101 | + return "<span class='toc_header_link' id='toc_{$_icount}'></span>".PHP_EOL |
|
102 | 102 | . $aMatches[ 0 ]; |
103 | 103 | } |
104 | 104 |
@@ -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 | } |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @since 3.6.0 |
52 | 52 | */ |
53 | - public $aOptions = array( |
|
54 | - 'include_directory' => false, // (boolean) whether the contents should be put inside a root directory. |
|
53 | + public $aOptions = array( |
|
54 | + 'include_directory' => false, // (boolean) whether the contents should be put inside a root directory. |
|
55 | 55 | 'additional_source_directories' => array(), |
56 | 56 | // 'ignoring_file_extensions' => array(), // not implemented yet. |
57 | 57 | ); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param array|boolean $abOptions |
65 | 65 | * @param callable $aCallbacks |
66 | 66 | */ |
67 | - public function __construct( $sSource, $sDestination, $abOptions=false, array $aCallbacks=array() ) { |
|
67 | + public function __construct( $sSource, $sDestination, $abOptions = false, array $aCallbacks = array() ) { |
|
68 | 68 | |
69 | 69 | $this->sSource = $sSource; |
70 | 70 | $this->sDestination = $sDestination; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function compress() { |
97 | 97 | |
98 | 98 | // Check whether it is possible to perform the task. |
99 | - if ( ! $this->isFeasible( $this->sSource ) ) { |
|
99 | + if ( !$this->isFeasible( $this->sSource ) ) { |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | $_oZip = new ZipArchive(); |
109 | - if ( ! $_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) { |
|
109 | + if ( !$_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) { |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | 113 | $this->sSource = $this->_getSanitizedSourcePath( $this->sSource ); |
114 | 114 | // $this->sSource = str_replace( '\\', '/', realpath( $this->sSource ) ); |
115 | 115 | |
116 | - $_aMethods = array( |
|
116 | + $_aMethods = array( |
|
117 | 117 | 'unknown' => '_replyToReturnFalse', |
118 | 118 | 'directory' => '_replyToCompressDirectory', |
119 | 119 | 'file' => '_replyToCompressFile', |
120 | 120 | ); |
121 | - $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ]; |
|
121 | + $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ]; |
|
122 | 122 | return call_user_func_array( |
123 | 123 | array( $this, $_sMethodName ), |
124 | 124 | array( |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @since 3.6.0 Changed the name from `_compressDirectory`. Changed the scope to public to allow overriding the method in an extended class. |
145 | 145 | * @return boolean True on success, false otherwise. |
146 | 146 | */ |
147 | - public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks=array(), $bIncludeDir=false, array $aAdditionalSourceDirs=array() ) { |
|
147 | + public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks = array(), $bIncludeDir = false, array $aAdditionalSourceDirs = array() ) { |
|
148 | 148 | |
149 | 149 | $_sArchiveRootDirName = ''; |
150 | 150 | |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | * @since 3.6.0 |
175 | 175 | * @return void |
176 | 176 | */ |
177 | - private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName='' ) { |
|
177 | + private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName = '' ) { |
|
178 | 178 | |
179 | - $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ) . '/' : ''; |
|
179 | + $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ).'/' : ''; |
|
180 | 180 | |
181 | - foreach( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) { |
|
181 | + foreach ( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) { |
|
182 | 182 | |
183 | 183 | $_sSourceDirPath = $this->_getSanitizedSourcePath( $_sSourceDirPath ); |
184 | 184 | $_sInsideDirPrefix = is_integer( $_isIndexOrRelativeDirPath ) |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | : $_isIndexOrRelativeDirPath; |
187 | 187 | |
188 | 188 | // Add a directory inside the compressing directory. |
189 | - if( $_sInsideDirPrefix ) { |
|
189 | + if ( $_sInsideDirPrefix ) { |
|
190 | 190 | $this->_addRelativeDir( |
191 | 191 | $oZip, |
192 | 192 | $_sInsideDirPrefix, |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $_sSourceDirPath, |
205 | 205 | $_sIterationItem, |
206 | 206 | $aCallbacks, |
207 | - $sRootDirName . $_sInsideDirPrefix |
|
207 | + $sRootDirName.$_sInsideDirPrefix |
|
208 | 208 | ); |
209 | 209 | } |
210 | 210 | } |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | $sRelativeDirPath = str_replace( '\\', '/', $sRelativeDirPath ); |
219 | 219 | $_aPathPartsParse = array_filter( explode( '/', $sRelativeDirPath ) ); |
220 | 220 | $_aDirPath = array(); |
221 | - foreach( $_aPathPartsParse as $_sDirName ) { |
|
222 | - $_aDirPath[] = $_sDirName; |
|
221 | + foreach ( $_aPathPartsParse as $_sDirName ) { |
|
222 | + $_aDirPath[ ] = $_sDirName; |
|
223 | 223 | $this->_addEmptyDir( |
224 | 224 | $oZip, |
225 | 225 | implode( '/', $_aDirPath ), |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | * @param string $sInsidePathPrefix The prefix to add to the inside archive directory structure. |
239 | 239 | * @return void |
240 | 240 | */ |
241 | - private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix='' ) { |
|
241 | + private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix = '' ) { |
|
242 | 242 | |
243 | 243 | $_sIterationItem = str_replace( '\\', '/', $_sIterationItem ); |
244 | - $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ) . '/'; // add a trailing slash |
|
244 | + $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ).'/'; // add a trailing slash |
|
245 | 245 | |
246 | 246 | // Ignore "." and ".." folders |
247 | 247 | if ( |
@@ -259,18 +259,18 @@ discard block |
||
259 | 259 | if ( true === is_dir( $_sIterationItem ) ) { |
260 | 260 | $this->_addEmptyDir( |
261 | 261 | $oZip, |
262 | - $sInsidePathPrefix . str_replace( |
|
263 | - $sSource . '/', |
|
262 | + $sInsidePathPrefix.str_replace( |
|
263 | + $sSource.'/', |
|
264 | 264 | '', |
265 | - $_sIterationItem . '/' |
|
265 | + $_sIterationItem.'/' |
|
266 | 266 | ), |
267 | 267 | $aCallbacks[ 'directory_name' ] |
268 | 268 | ); |
269 | 269 | } else if ( true === is_file( $_sIterationItem ) ) { |
270 | 270 | $this->_addFromString( |
271 | 271 | $oZip, |
272 | - $sInsidePathPrefix . str_replace( |
|
273 | - $sSource . '/', |
|
272 | + $sInsidePathPrefix.str_replace( |
|
273 | + $sSource.'/', |
|
274 | 274 | '', |
275 | 275 | $_sIterationItem |
276 | 276 | ), |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * @since 3.6.0 Changed the name from `_compressFile`. Changed the scope from `private` to allow overriding in an extended class. |
299 | 299 | * @return boolean True on success, false otherwise. |
300 | 300 | */ |
301 | - public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks=null ) { |
|
301 | + public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks = null ) { |
|
302 | 302 | $this->_addFromString( |
303 | 303 | $oZip, |
304 | 304 | basename( $sSourceFilePath ), |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @return boolean |
330 | 330 | */ |
331 | 331 | private function isFeasible( $sSource ) { |
332 | - if ( ! extension_loaded( 'zip' ) ) { |
|
332 | + if ( !extension_loaded( 'zip' ) ) { |
|
333 | 333 | return false; |
334 | 334 | } |
335 | 335 | return file_exists( $sSource ); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | */ |
354 | 354 | private function _addEmptyDir( ZipArchive $oZip, $sInsidePath, $oCallable ) { |
355 | 355 | $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $oCallable ); |
356 | - if ( ! strlen( $sInsidePath ) ) { |
|
356 | + if ( !strlen( $sInsidePath ) ) { |
|
357 | 357 | return; |
358 | 358 | } |
359 | 359 | $oZip->addEmptyDir( $sInsidePath ); |
@@ -365,10 +365,10 @@ discard block |
||
365 | 365 | * @remark If the path is empty, it will not process. |
366 | 366 | * @return void |
367 | 367 | */ |
368 | - private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents='', array $aCallbacks=array() ) { |
|
368 | + private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents = '', array $aCallbacks = array() ) { |
|
369 | 369 | |
370 | 370 | $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $aCallbacks[ 'file_name' ] ); |
371 | - if ( ! strlen( $sInsidePath ) ) { |
|
371 | + if ( !strlen( $sInsidePath ) ) { |
|
372 | 372 | return; |
373 | 373 | } |
374 | 374 | $oZip->addFromString( |
@@ -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, |