Skip to content

Commit ef35665

Browse files
Updated Coding Standards.
1 parent 2210ed6 commit ef35665

File tree

8 files changed

+22
-13
lines changed

8 files changed

+22
-13
lines changed

includes/class-framework-modules.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace VSP;
44

5+
use Varunsridharan\PHP\Autoloader;
56
use Varunsridharan\WordPress\Localizer;
67

78
if ( ! defined( 'ABSPATH' ) ) {
@@ -106,7 +107,7 @@ protected function _autoloader_init() {
106107
'base_path' => $this->plugin_path(),
107108
'options' => array(),
108109
) );
109-
$this->autoloader = new \Varunsridharan\PHP\Autoloader( $args['namespace'], $args['base_path'], $args['options'] );
110+
$this->autoloader = new Autoloader( $args['namespace'], $args['base_path'], $args['options'] );
110111
}
111112
}
112113

includes/class-setup.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public static function create_folders( $dir ) {
5858

5959
foreach ( $files as $file ) {
6060
if ( wp_mkdir_p( $file['base'] ) && ! file_exists( vsp_slashit( $file['base'] ) . $file['file'] ) ) {
61-
if ( $file_handle = @fopen( vsp_slashit( $file['base'] ) . $file['file'], 'w' ) ) {
61+
$file_handle = @fopen( vsp_slashit( $file['base'] ) . $file['file'], 'w' );
62+
if ( $file_handle ) {
6263
fwrite( $file_handle, $file['content'] );
6364
fclose( $file_handle );
6465
}

includes/core/class-instance-handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function _instance( $class, ...$arguments ) {
9393
if ( $this->get_instance( $class ) === false ) {
9494
try {
9595
$framework_key = ( $this instanceof Framework ) ? static::class : false;
96-
$refl = new \ReflectionClass( $class );
96+
$refl = new ReflectionClass( $class );
9797

9898
if ( false === $framework_key ) {
9999
$framework_key = ( isset( $this->framework_instance ) && ! empty( $this->framework_instance ) ) ? $this->framework_instance : false;

includes/functions/general-functions.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?php
22

3+
use VSP\Modules\Logger;
4+
use VSP\Modules\Logger\File_Handler;
5+
36
if ( ! defined( 'ABSPATH' ) ) {
47
exit;
58
}
@@ -171,12 +174,12 @@ function vsp_get_logger( $subpath = false, $file_name = null, $filesize = false
171174
$class = apply_filters( 'vsp_logging_class', '\VSP\Modules\Logger' );
172175
$implements = class_implements( $class );
173176
if ( is_array( $implements ) && in_array( 'VSP\Core\Interfaces\Logger', $implements, true ) ) {
174-
$logger = ( is_object( $class ) ) ? $class : new $class( array( new \VSP\Modules\Logger\File_Handler( $subpath, $file_name, $filesize ) ) );
177+
$logger = ( is_object( $class ) ) ? $class : new $class( array( new File_Handler( $subpath, $file_name, $filesize ) ) );
175178
} else {
176179
/* translators: 1: class name 2: woocommerce_logging_class 3: WC_Logger_Interface */
177180
$smgs = sprintf( __( 'The class %1$s provided by %2$s filter must implement %3$s.', 'vsp-framework' ), '<code>' . esc_html( is_object( $class ) ? get_class( $class ) : $class ) . '</code>', '<code>vsp_logging_class</code>', '<code>\VSP\Core\Interfaces\Logger</code>' );
178181
vsp_doing_it_wrong( __FUNCTION__, $smgs, '3.0' );
179-
$logger = new \VSP\Modules\Logger( array( new \VSP\Modules\Logger\File_Handler( $subpath, $file_name, $filesize ) ) );
182+
$logger = new Logger( array( new File_Handler( $subpath, $file_name, $filesize ) ) );
180183
}
181184
return $logger;
182185
}
@@ -225,10 +228,10 @@ function vsp_log_msg( $messages = '', $type = 'critical', $handler = false, $con
225228
$handler = vsp_logger();
226229
}
227230

228-
if ( $handler instanceof \VSP\Modules\Logger && method_exists( $handler, $type ) ) {
231+
if ( $handler instanceof Logger && method_exists( $handler, $type ) ) {
229232
$handler->$type( $messages, $context );
230233
return true;
231-
} elseif ( vsp_logger() instanceof \VSP\Modules\Logger && method_exists( vsp_logger(), $type ) ) {
234+
} elseif ( vsp_logger() instanceof Logger && method_exists( vsp_logger(), $type ) ) {
232235
$msg = array_merge( array( __( 'Tried To Log A Message But Failed Got unknown Handler', 'vsp-framework' ) ), wp_debug_backtrace_summary( null, 0, false ) );
233236
vsp_log_msg( '----------------------------------------------------------------', 'notice', vsp_logger() );
234237
vsp_log_msg( $msg, 'critical', vsp_logger() );

includes/modules/class-wponion.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace VSP\Modules;
44

55
use VSP\Base;
6+
use function wponion_builder;
67

78
if ( ! defined( 'ABSPATH' ) ) {
89
die;
@@ -43,7 +44,7 @@ public function wpo_load() {
4344
$this->options['extra_js'] = ( isset( $this->options['extra_js'] ) ) ? $this->options['extra_js'] : array();
4445
$this->options['extra_js'] = ( ! is_array( $this->options['extra_js'] ) ) ? array( $this->options['extra_js'] ) : $this->options['extra_js'];
4546
$this->options['extra_js'][] = 'vsp_load_core_assets';
46-
$options = \wponion_builder();
47+
$options = wponion_builder();
4748
$this->plugin()
4849
->action( 'settings_options', $options );
4950
if ( wpo_is( $options ) ) {

includes/modules/logger/class-file-handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ protected function open( $handle, $mode = 'a' ) {
317317
$temphandle = @fopen( $file, 'w+' );
318318
@fclose( $temphandle );
319319
if ( defined( 'FS_CHMOD_FILE' ) ) {
320-
@chmod( $file, FS_CHMOD_FILE ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.chmod_chmod
320+
@chmod( $file, FS_CHMOD_FILE );
321321
}
322322
}
323323
$resource = @fopen( $file, $mode );

vsp-bootstrap.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
* Domain Path: languages/
3535
*/
3636

37+
use Varunsridharan\PHP\Autoloader;
38+
3739
if ( ! defined( 'ABSPATH' ) ) {
3840
exit;
3941
}
@@ -55,9 +57,7 @@
5557
throw new ErrorException( __( 'Framework Autoloader Not Found' ) );
5658
}
5759

58-
new \Varunsridharan\PHP\Autoloader( 'VSP\\', VSP_PATH . 'includes/', array(
59-
'prepend' => true,
60-
) );
60+
new Autoloader( 'VSP\\', VSP_PATH . 'includes/', array( 'prepend' => true ) );
6161

6262
require_once __DIR__ . '/vsp-functions.php';
6363
require_once __DIR__ . '/vsp-hooks.php';

vsp-hooks.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
use VSP\Modules\WordPress\Importers;
4+
25
if ( ! defined( 'ABSPATH' ) ) {
36
exit;
47
}
@@ -11,7 +14,7 @@
1114
* Creates A Instances For WP Importers
1215
*/
1316
function vsp_on_load() {
14-
\VSP\Modules\WordPress\Importers::instance();
17+
Importers::instance();
1518
}
1619
}
1720

0 commit comments

Comments
 (0)