@@ -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 | } |
@@ -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 |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @since 3.4.6 |
78 | 78 | */ |
79 | - public function __construct( array $aRequirements=array(), $sScriptName='' ) { |
|
79 | + public function __construct( array $aRequirements = array(), $sScriptName = '' ) { |
|
80 | 80 | |
81 | 81 | // Avoid undefined index warnings. |
82 | 82 | $aRequirements = $aRequirements + $this->_aDefaultRequirements; |
83 | 83 | $aRequirements = array_filter( $aRequirements, 'is_array' ); |
84 | - foreach( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
84 | + foreach ( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
85 | 85 | if ( isset( $aRequirements[ $_sName ] ) ) { |
86 | 86 | $aRequirements[ $_sName ] = $aRequirements[ $_sName ] + $this->_aDefaultRequirements[ $_sName ]; |
87 | 87 | } |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | $_aWarnings = array(); |
106 | 106 | |
107 | 107 | // PHP, WordPress, MySQL |
108 | - $_aWarnings[] = $this->_getWarningByType( 'php' ); |
|
109 | - $_aWarnings[] = $this->_getWarningByType( 'wordpress' ); |
|
110 | - $_aWarnings[] = $this->_getWarningByType( 'mysql' ); |
|
108 | + $_aWarnings[ ] = $this->_getWarningByType( 'php' ); |
|
109 | + $_aWarnings[ ] = $this->_getWarningByType( 'wordpress' ); |
|
110 | + $_aWarnings[ ] = $this->_getWarningByType( 'mysql' ); |
|
111 | 111 | |
112 | 112 | // Ensure necessary array elements. |
113 | 113 | $this->_aRequirements = $this->_aRequirements + array( |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | // Check the rest. |
121 | 121 | $_aWarnings = array_merge( |
122 | 122 | $_aWarnings, |
123 | - $this->_checkFunctions( $this->_aRequirements['functions'] ), |
|
124 | - $this->_checkClasses( $this->_aRequirements['classes'] ), |
|
125 | - $this->_checkConstants( $this->_aRequirements['constants'] ), |
|
126 | - $this->_checkFiles( $this->_aRequirements['files'] ) |
|
123 | + $this->_checkFunctions( $this->_aRequirements[ 'functions' ] ), |
|
124 | + $this->_checkClasses( $this->_aRequirements[ 'classes' ] ), |
|
125 | + $this->_checkConstants( $this->_aRequirements[ 'constants' ] ), |
|
126 | + $this->_checkFiles( $this->_aRequirements[ 'files' ] ) |
|
127 | 127 | ); |
128 | 128 | |
129 | 129 | $this->aWarnings = array_filter( $_aWarnings ); // drop empty elements. |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return string The warning. |
138 | 138 | */ |
139 | 139 | private function _getWarningByType( $sType ) { |
140 | - if ( ! isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
140 | + if ( !isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
141 | 141 | return ''; |
142 | 142 | } |
143 | 143 | if ( $this->_checkPHPVersion( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @since 3.4.6 |
165 | 165 | */ |
166 | 166 | private function _checkWordPressVersion( $sWordPressVersion ) { |
167 | - return version_compare( $GLOBALS['wp_version'], $sWordPressVersion, ">=" ); |
|
167 | + return version_compare( $GLOBALS[ 'wp_version' ], $sWordPressVersion, ">=" ); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | */ |
231 | 231 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
232 | 232 | $_aWarnings = array(); |
233 | - foreach( $aSubjects as $_sSubject => $_sWarning ) { |
|
234 | - if ( ! call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
235 | - $_aWarnings[] = sprintf( $_sWarning, $_sSubject ); |
|
233 | + foreach ( $aSubjects as $_sSubject => $_sWarning ) { |
|
234 | + if ( !call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
235 | + $_aWarnings[ ] = sprintf( $_sWarning, $_sSubject ); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | return $_aWarnings; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | public function _replyToPrintAdminNotices() { |
254 | 254 | |
255 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
255 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
256 | 256 | if ( empty( $_aWarnings ) ) { |
257 | 257 | return; |
258 | 258 | } |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | */ |
271 | 271 | private function _getWarnings() { |
272 | 272 | |
273 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
273 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
274 | 274 | if ( empty( $_aWarnings ) ) { |
275 | 275 | return ''; |
276 | 276 | } |
277 | - $_sScripTitle = $this->_sScriptName |
|
278 | - ? "<strong>" . $this->_sScriptName . "</strong>: " |
|
277 | + $_sScripTitle = $this->_sScriptName |
|
278 | + ? "<strong>".$this->_sScriptName."</strong>: " |
|
279 | 279 | : ''; |
280 | 280 | return $_sScripTitle |
281 | 281 | . implode( '<br />', $_aWarnings ); |
@@ -286,12 +286,12 @@ discard block |
||
286 | 286 | * Deactivates the plugin. |
287 | 287 | * @since 3.4.6 |
288 | 288 | */ |
289 | - public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
|
289 | + public function deactivatePlugin( $sPluginFilePath, $sMessage = '', $bIsOnActivation = false ) { |
|
290 | 290 | |
291 | 291 | add_action( 'admin_notices', array( $this, '_replyToPrintAdminNotices' ) ); |
292 | - $this->aWarnings[] = '<strong>' . $sMessage . '</strong>'; |
|
293 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
294 | - if ( ! @include( ABSPATH . '/wp-admin/includes/plugin.php' ) ) { |
|
292 | + $this->aWarnings[ ] = '<strong>'.$sMessage.'</strong>'; |
|
293 | + if ( !function_exists( 'deactivate_plugins' ) ) { |
|
294 | + if ( !@include( ABSPATH.'/wp-admin/includes/plugin.php' ) ) { |
|
295 | 295 | return; |
296 | 296 | } |
297 | 297 | } |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | // Before that, we can display messages to the user. |
302 | 302 | if ( $bIsOnActivation ) { |
303 | 303 | |
304 | - $_sPluginListingPage = add_query_arg( array(), $GLOBALS['pagenow'] ); |
|
305 | - wp_die( $this->_getWarnings() . "<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
304 | + $_sPluginListingPage = add_query_arg( array(), $GLOBALS[ 'pagenow' ] ); |
|
305 | + wp_die( $this->_getWarnings()."<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
306 | 306 | |
307 | 307 | } |
308 | 308 |
@@ -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 | */ |
@@ -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, |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Creates an object instance with dynamic parameters. |
44 | 44 | */ |
45 | - static public function getInstance( $sClassName, array $aParameters=array() ) { |
|
45 | + static public function getInstance( $sClassName, array $aParameters = array() ) { |
|
46 | 46 | |
47 | 47 | $_oReflection = new ReflectionClass( $sClassName ); |
48 | 48 | return $_oReflection->newInstanceArgs( $aParameters ); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // For PHP 5.2.x or below |
59 | 59 | if ( version_compare( phpversion(), '<', '5.3.0' ) ) { |
60 | 60 | trigger_error( |
61 | - 'Program Name' . ': ' |
|
61 | + 'Program Name'.': ' |
|
62 | 62 | . sprintf( |
63 | 63 | 'The method cannot run with your PHP version: %1$s', |
64 | 64 | phpversion() |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * Creates an object instance with dynamic parameters. |
46 | 46 | * |
47 | 47 | * @since 3.7.10 |
48 | - * @param string $sCalssName The class name for testing. |
|
48 | + * @param string $sClassName The class name for testing. |
|
49 | 49 | * @param array $aParameters The parameters to pass to the constructor of the class set in the first parameter. |
50 | 50 | * @return object An object instance of the class specified in the first parameter. |
51 | 51 | */ |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @since 3.7.10 |
63 | 63 | * @param object $oClass The subject class object. |
64 | - * @param string $sMathodName The subject method name. |
|
64 | + * @param string $sMethodName The subject method name. |
|
65 | 65 | * @param array $aParameters The parameters to pass to the method set in the second parameter. |
66 | 66 | * @remark This supports private methods to be executed. |
67 | 67 | */ |
@@ -87,6 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | /** |
89 | 89 | * @since 3.7.10 |
90 | + * @param string $sClassName |
|
90 | 91 | * @return object |
91 | 92 | * @internal |
92 | 93 | */ |