Refactoring

This commit is contained in:
thanghv 2020-05-22 00:03:42 +07:00
parent f5acc21b32
commit 64931ea48a
10 changed files with 51 additions and 69 deletions

View file

@ -153,7 +153,7 @@ class MainWP_Backup {
exit(); exit();
} }
} }
public function backup_checkpid() { public function backup_checkpid() {
$pid = $_POST['pid']; $pid = $_POST['pid'];
@ -202,7 +202,7 @@ class MainWP_Backup {
MainWP_Helper::write( $information ); MainWP_Helper::write( $information );
} }
public function backup( $pWrite = true ) { public function backup( $pWrite = true ) {
$timeout = 20 * 60 * 60; $timeout = 20 * 60 * 60;

View file

@ -334,7 +334,7 @@ class MainWP_Child_Callable {
global $wpdb; global $wpdb;
return $wpdb->get_results( $wpdb->prepare( " SELECT `post_parent`, COUNT(*) cnt FROM $wpdb->posts WHERE `post_type` = 'revision' GROUP BY `post_parent` HAVING COUNT(*) > %d ", $max_revisions ) ); return $wpdb->get_results( $wpdb->prepare( " SELECT `post_parent`, COUNT(*) cnt FROM $wpdb->posts WHERE `post_type` = 'revision' GROUP BY `post_parent` HAVING COUNT(*) > %d ", $max_revisions ) );
} }
private function maintenance_delete_revisions( $results, $max_revisions ) { private function maintenance_delete_revisions( $results, $max_revisions ) {
global $wpdb; global $wpdb;
@ -433,7 +433,7 @@ class MainWP_Child_Callable {
} }
public function backup_poll() { public function backup_poll() {
MainWP_Backup::get()->backup_poll(); MainWP_Backup::get()->backup_poll();
} }
public function backup_checkpid() { public function backup_checkpid() {
@ -441,7 +441,7 @@ class MainWP_Child_Callable {
} }
public function backup( $pWrite = true ) { public function backup( $pWrite = true ) {
return MainWP_Backup::get()->backup( $pWrite ); return MainWP_Backup::get()->backup( $pWrite );
} }
protected function backup_full( $fileName ) { protected function backup_full( $fileName ) {
@ -449,7 +449,7 @@ class MainWP_Child_Callable {
} }
protected function backup_db( $fileName = '', $ext = 'zip' ) { protected function backup_db( $fileName = '', $ext = 'zip' ) {
return MainWP_Backup::get()->backup_db( $fileName, $ext ); return MainWP_Backup::get()->backup_db( $fileName, $ext );
} }
public function get_site_icon() { public function get_site_icon() {

View file

@ -276,7 +276,7 @@ class MainWP_Child_Install {
$information['destination_name'] = $result['destination_name']; $information['destination_name'] = $result['destination_name'];
MainWP_Helper::write( $information ); MainWP_Helper::write( $information );
} }
/** /**
* Hook to set ssl verify. * Hook to set ssl verify.
*/ */
@ -284,7 +284,7 @@ class MainWP_Child_Install {
$r['sslverify'] = false; $r['sslverify'] = false;
return $r; return $r;
} }
/** /**
* Include necessary files. * Include necessary files.
*/ */

View file

@ -76,7 +76,7 @@ class MainWP_Child_Posts {
$wp_seo_enabled = false; $wp_seo_enabled = false;
if ( isset( $_POST['WPSEOEnabled'] ) && $_POST['WPSEOEnabled'] ) { if ( isset( $_POST['WPSEOEnabled'] ) && $_POST['WPSEOEnabled'] ) {
if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) && class_exists( 'WPSEO_Link_Column_Count' ) && class_exists( 'WPSEO_Meta' ) ) { if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) && class_exists( '\WPSEO_Link_Column_Count' ) && class_exists( '\WPSEO_Meta' ) ) {
$wp_seo_enabled = true; $wp_seo_enabled = true;
} }
} }
@ -685,7 +685,7 @@ class MainWP_Child_Posts {
} }
} }
$check_image_existed = $edit_post_id ? true : false; // if editing post then will check if image existed. $check_image_existed = $edit_post_id ? true : false; // if editing post then will check if image existed.
$this->create_found_images( $new_post, $upload_dir, $check_image_existed ); $this->update_found_images( $new_post, $upload_dir, $check_image_existed );
$this->create_has_shortcode_gallery( $new_post ); $this->create_has_shortcode_gallery( $new_post );
if ( $is_post_plus ) { if ( $is_post_plus ) {
$this->create_post_plus( $new_post, $post_custom ); $this->create_post_plus( $new_post, $post_custom );
@ -736,7 +736,7 @@ class MainWP_Child_Posts {
global $current_user; global $current_user;
$this->create_wp_rocket( $post_custom ); $this->update_wp_rocket_custom_post( $post_custom );
// current user may be connected admin or alternative admin. // current user may be connected admin or alternative admin.
$current_uid = $current_user->ID; $current_uid = $current_user->ID;
@ -777,13 +777,13 @@ class MainWP_Child_Posts {
private function update_post_data( $new_post_id, $post_custom, $post_category, $post_featured_image, $check_image_existed, $is_post_plus ) { private function update_post_data( $new_post_id, $post_custom, $post_category, $post_featured_image, $check_image_existed, $is_post_plus ) {
$seo_ext_activated = false; $seo_ext_activated = false;
if ( class_exists( 'WPSEO_Meta' ) && class_exists( 'WPSEO_Admin' ) ) { if ( class_exists( '\WPSEO_Meta' ) && class_exists( '\WPSEO_Admin' ) ) {
$seo_ext_activated = true; $seo_ext_activated = true;
} }
$post_to_only_existing_categories = false; $post_to_only_existing_categories = false;
$this->create_set_custom_fields( $new_post_id, $post_custom, $seo_ext_activated, $post_to_only_existing_categories ); $this->set_custom_post_fields( $new_post_id, $post_custom, $seo_ext_activated, $post_to_only_existing_categories );
// yoast seo plugin activated. // yoast seo plugin activated.
if ( $seo_ext_activated ) { if ( $seo_ext_activated ) {
@ -791,12 +791,12 @@ class MainWP_Child_Posts {
} }
$this->create_set_categories( $new_post_id, $post_category, $post_to_only_existing_categories ); $this->create_set_categories( $new_post_id, $post_category, $post_to_only_existing_categories );
$this->create_featured_image( $new_post_id, $post_featured_image, $check_image_existed ); $this->create_featured_image( $new_post_id, $post_featured_image, $check_image_existed );
// post plus extension process. // post plus extension process.
if ( $is_post_plus ) { if ( $is_post_plus ) {
$this->create_post_plus_categories( $new_post_id, $post_custom ); $this->post_plus_update_author( $new_post_id, $post_custom );
$this->post_plus_update_categories( $new_post_id, $post_custom );
} }
// to support custom post author. // to support custom post author.
@ -811,7 +811,7 @@ class MainWP_Child_Posts {
} }
} }
private function create_wp_rocket( &$post_custom ) { private function update_wp_rocket_custom_post( &$post_custom ) {
// Options fields. // Options fields.
$wprocket_fields = array( $wprocket_fields = array(
'lazyload', 'lazyload',
@ -846,7 +846,7 @@ class MainWP_Child_Posts {
} }
} }
private function create_found_images( &$new_post, $upload_dir, $check_image_existed ) { private function update_found_images( &$new_post, $upload_dir, $check_image_existed ) {
// Search for all the images added to the new post. Some images have a href tag to click to navigate to the image.. we need to replace this too. // Search for all the images added to the new post. Some images have a href tag to click to navigate to the image.. we need to replace this too.
$foundMatches = preg_match_all( '/(<a[^>]+href=\"(.*?)\"[^>]*>)?(<img[^>\/]*src=\"((.*?)(png|gif|jpg|jpeg))\")/ix', $new_post['post_content'], $matches, PREG_SET_ORDER ); $foundMatches = preg_match_all( '/(<a[^>]+href=\"(.*?)\"[^>]*>)?(<img[^>\/]*src=\"((.*?)(png|gif|jpg|jpeg))\")/ix', $new_post['post_content'], $matches, PREG_SET_ORDER );
@ -970,12 +970,11 @@ class MainWP_Child_Posts {
} }
} }
private function create_post_plus_categories( $new_post_id, $post_custom ) { private function post_plus_update_author( $new_post_id, $post_custom ) {
$random_privelege = isset( $post_custom['_saved_draft_random_privelege'] ) ? $post_custom['_saved_draft_random_privelege'] : null;
$random_privelege = isset( $post_custom['_saved_draft_random_privelege'] ) ? $post_custom['_saved_draft_random_privelege'] : null; $random_privelege = is_array( $random_privelege ) ? current( $random_privelege ) : null;
$random_privelege = is_array( $random_privelege ) ? current( $random_privelege ) : null; $random_privelege_base = base64_decode( $random_privelege ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons.
$random_privelege_base = base64_decode( $random_privelege ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons. $random_privelege = maybe_unserialize( $random_privelege_base );
$random_privelege = maybe_unserialize( $random_privelege_base );
if ( is_array( $random_privelege ) && count( $random_privelege ) > 0 ) { if ( is_array( $random_privelege ) && count( $random_privelege ) > 0 ) {
$random_post_authors = array(); $random_post_authors = array();
@ -996,9 +995,11 @@ class MainWP_Child_Posts {
); );
} }
} }
}
$random_category = isset( $post_custom['_saved_draft_random_category'] ) ? $post_custom['_saved_draft_random_category'] : false;
$random_category = is_array( $random_category ) ? current( $random_category ) : null; private function post_plus_update_categories( $new_post_id, $post_custom ) {
$random_category = isset( $post_custom['_saved_draft_random_category'] ) ? $post_custom['_saved_draft_random_category'] : false;
$random_category = is_array( $random_category ) ? current( $random_category ) : null;
if ( ! empty( $random_category ) ) { if ( ! empty( $random_category ) ) {
$cats = get_categories( $cats = get_categories(
array( array(
@ -1045,7 +1046,7 @@ class MainWP_Child_Posts {
} }
} }
private function create_set_custom_fields( $new_post_id, $post_custom, $seo_ext_activated, &$post_to_only ) { private function set_custom_post_fields( $new_post_id, $post_custom, $seo_ext_activated, &$post_to_only ) {
// Set custom fields. // Set custom fields.
$not_allowed = array( $not_allowed = array(

View file

@ -15,7 +15,7 @@ class MainWP_Child_Server_Information extends MainWP_Child_Server_Information_Ba
public static function get_class_name() { public static function get_class_name() {
return __CLASS__; return __CLASS__;
} }
public static function init() { public static function init() {
add_action( add_action(
'wp_ajax_mainwp-child_dismiss_warnings', 'wp_ajax_mainwp-child_dismiss_warnings',
@ -890,7 +890,7 @@ class MainWP_Child_Server_Information extends MainWP_Child_Server_Information_Ba
<td><?php echo esc_html( $pResult ); ?></td> <td><?php echo esc_html( $pResult ); ?></td>
<td><?php echo ( $pPassed ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : '<span class="mainwp-warning"><i class="fa fa-exclamation-circle"></i> Warning</span>' ); ?></td> <td><?php echo ( $pPassed ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : '<span class="mainwp-warning"><i class="fa fa-exclamation-circle"></i> Warning</span>' ); ?></td>
</tr> </tr>
<?php <?php
} }
protected static function render_row( $pConfig, $pCompare, $pVersion, $pGetter, $pExtraText = '', $pExtraCompare = null, $pExtraVersion = null, $sizeCompare = false ) { protected static function render_row( $pConfig, $pCompare, $pVersion, $pGetter, $pExtraText = '', $pExtraCompare = null, $pExtraVersion = null, $sizeCompare = false ) {
@ -946,7 +946,7 @@ class MainWP_Child_Server_Information extends MainWP_Child_Server_Information_Ba
*Includes last_lines() function by phant0m, licensed under cc-wiki and GPLv2+ *Includes last_lines() function by phant0m, licensed under cc-wiki and GPLv2+
*/ */
private static function render_error_page() { private static function render_error_page() {
?> ?>
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0"> <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
<thead title="Click to Toggle" style="cursor: pointer;"> <thead title="Click to Toggle" style="cursor: pointer;">

View file

@ -563,8 +563,8 @@ class MainWP_Child_Stats {
} }
} }
} }
if ( class_exists( 'COM' ) ) { if ( class_exists( '\COM' ) ) {
$obj = new COM( 'scripting.filesystemobject' ); $obj = new \COM( 'scripting.filesystemobject' );
if ( is_object( $obj ) ) { if ( is_object( $obj ) ) {
$ref = $obj->getfolder( $directory ); $ref = $obj->getfolder( $directory );
@ -578,9 +578,9 @@ class MainWP_Child_Stats {
} }
} }
// to fix for window host, performance not good? // to fix for window host, performance not good?
if ( class_exists( 'RecursiveIteratorIterator' ) ) { if ( class_exists( '\RecursiveIteratorIterator' ) ) {
$size = 0; $size = 0;
foreach ( new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $directory ) ) as $file ) { foreach ( new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( $directory ) ) as $file ) {
$size += $file->getSize(); $size += $file->getSize();
} }
if ( $size && MainWP_Helper::ctype_digit( $size ) ) { if ( $size && MainWP_Helper::ctype_digit( $size ) ) {

View file

@ -371,11 +371,11 @@ class MainWP_Child_Updates {
if ( in_array( 'backupbuddy/backupbuddy.php', $plugins ) ) { if ( in_array( 'backupbuddy/backupbuddy.php', $plugins ) ) {
if ( isset( $GLOBALS['ithemes_updater_path'] ) ) { if ( isset( $GLOBALS['ithemes_updater_path'] ) ) {
if ( ! class_exists( 'Ithemes_Updater_Settings' ) ) { if ( ! class_exists( '\Ithemes_Updater_Settings' ) ) {
require $GLOBALS['ithemes_updater_path'] . '/settings.php'; require $GLOBALS['ithemes_updater_path'] . '/settings.php';
} }
if ( class_exists( 'Ithemes_Updater_Settings' ) ) { if ( class_exists( '\Ithemes_Updater_Settings' ) ) {
$ithemes_updater = new Ithemes_Updater_Settings(); $ithemes_updater = new \Ithemes_Updater_Settings();
$ithemes_updater->update(); $ithemes_updater->update();
} }
} }

View file

@ -121,7 +121,7 @@ class MainWP_Clone {
} }
$branding_opts = MainWP_Child_Branding::instance()->get_branding_options(); $branding_opts = MainWP_Child_Branding::instance()->get_branding_options();
$hide_restore = isset( $branding_opts['remove_restore'] ) && $branding_opts['remove_restore'] ? true : false; $hide_restore = isset( $branding_opts['remove_restore'] ) && $branding_opts['remove_restore'] ? true : false;
if ( ! $hide_restore ) { if ( ! $hide_restore ) {
if ( '' == session_id() ) { if ( '' == session_id() ) {
session_start(); session_start();
@ -1464,7 +1464,7 @@ class MainWP_Clone {
} }
return $file; return $file;
} }
public static function is_archive( $pFileName, $pPrefix = '', $pSuffix = '' ) { public static function is_archive( $pFileName, $pPrefix = '', $pSuffix = '' ) {
return preg_match( '/' . $pPrefix . '(.*).(zip|tar|tar.gz|tar.bz2)' . $pSuffix . '$/', $pFileName ); return preg_match( '/' . $pPrefix . '(.*).(zip|tar|tar.gz|tar.bz2)' . $pSuffix . '$/', $pFileName );
} }

View file

@ -121,7 +121,6 @@ class MainWP_Helper {
} }
} }
} }
return null; return null;
} }
@ -151,7 +150,6 @@ class MainWP_Helper {
} else { } else {
$init = true; $init = true;
} }
return $init; return $init;
} }
@ -192,7 +190,6 @@ class MainWP_Helper {
if ( 0 == $length ) { if ( 0 == $length ) {
return true; return true;
} }
return ( substr( $haystack, - $length ) == $needle ); return ( substr( $haystack, - $length ) == $needle );
} }
@ -220,7 +217,6 @@ class MainWP_Helper {
} else { } else {
$url = $url . '/'; $url = $url . '/';
} }
return $url; return $url;
} }
@ -235,7 +231,6 @@ class MainWP_Helper {
while ( $length -- ) { while ( $length -- ) {
$str .= $charset[ mt_rand( 0, $count - 1 ) ]; // phpcs:ignore $str .= $charset[ mt_rand( 0, $count - 1 ) ]; // phpcs:ignore
} }
return $str; return $str;
} }
@ -255,7 +250,6 @@ class MainWP_Helper {
$val *= 1024; $val *= 1024;
break; break;
} }
return $val; return $val;
} }
@ -270,7 +264,6 @@ class MainWP_Helper {
if ( ! is_readable( $dir ) ) { if ( ! is_readable( $dir ) ) {
return null; return null;
} }
return ( 2 === count( scandir( $dir ) ) ); return ( 2 === count( scandir( $dir ) ) );
} }
@ -304,13 +297,11 @@ class MainWP_Helper {
return ( function_exists( $func ) && ! array_search( $func, $suhosin ) ); return ( function_exists( $func ) && ! array_search( $func, $suhosin ) );
} }
} }
return true; return true;
} }
public static function get_timestamp( $timestamp ) { public static function get_timestamp( $timestamp ) {
$gmtOffset = get_option( 'gmt_offset' ); $gmtOffset = get_option( 'gmt_offset' );
return ( $gmtOffset ? ( $gmtOffset * HOUR_IN_SECONDS ) + $timestamp : $timestamp ); return ( $gmtOffset ? ( $gmtOffset * HOUR_IN_SECONDS ) + $timestamp : $timestamp );
} }
@ -328,11 +319,9 @@ class MainWP_Helper {
public static function update_option( $option_name, $option_value, $autoload = 'no' ) { public static function update_option( $option_name, $option_value, $autoload = 'no' ) {
$success = add_option( $option_name, $option_value, '', $autoload ); $success = add_option( $option_name, $option_value, '', $autoload );
if ( ! $success ) { if ( ! $success ) {
$success = update_option( $option_name, $option_value ); $success = update_option( $option_name, $option_value );
} }
return $success; return $success;
} }
@ -340,7 +329,6 @@ class MainWP_Helper {
if ( empty( $value ) ) { if ( empty( $value ) ) {
return false; return false;
} }
if ( null != $excludes ) { if ( null != $excludes ) {
foreach ( $excludes as $exclude ) { foreach ( $excludes as $exclude ) {
if ( self::ends_with( $exclude, '*' ) ) { if ( self::ends_with( $exclude, '*' ) ) {
@ -354,7 +342,6 @@ class MainWP_Helper {
} }
} }
} }
return false; return false;
} }
@ -362,14 +349,12 @@ class MainWP_Helper {
if ( ! function_exists( 'mb_ereg_replace' ) ) { if ( ! function_exists( 'mb_ereg_replace' ) ) {
return sanitize_file_name( $filename ); return sanitize_file_name( $filename );
} }
// Remove anything which isn't a word, whitespace, number or any of the following caracters -_~,;:[](). // Remove anything which isn't a word, whitespace, number or any of the following caracters -_~,;:[]().
// If you don't need to handle multi-byte characters you can use preg_replace rather than mb_ereg_replace. // If you don't need to handle multi-byte characters you can use preg_replace rather than mb_ereg_replace.
// Thanks @<40>?ukasz Rysiak! // Thanks @<40>?ukasz Rysiak!
$filename = mb_ereg_replace( '([^\w\s\d\-_~,;:\[\]\(\).])', '', $filename ); $filename = mb_ereg_replace( '([^\w\s\d\-_~,;:\[\]\(\).])', '', $filename );
// Remove any runs of periods (thanks falstro!). // Remove any runs of periods (thanks falstro!).
$filename = mb_ereg_replace( '([\.]{2,})', '', $filename ); $filename = mb_ereg_replace( '([\.]{2,})', '', $filename );
return $filename; return $filename;
} }
@ -382,11 +367,9 @@ class MainWP_Helper {
if ( 0 == $current_user->ID ) { if ( 0 == $current_user->ID ) {
return false; return false;
} }
if ( 10 == $current_user->wp_user_level || ( isset( $current_user->user_level ) && 10 == $current_user->user_level ) || current_user_can( 'level_10' ) ) { if ( 10 == $current_user->wp_user_level || ( isset( $current_user->user_level ) && 10 == $current_user->user_level ) || current_user_can( 'level_10' ) ) {
return true; return true;
} }
return false; return false;
} }
@ -398,11 +381,9 @@ class MainWP_Helper {
} }
public static function is_updates_screen() { public static function is_updates_screen() {
if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
return false; return false;
} }
if ( function_exists( 'get_current_screen' ) ) { if ( function_exists( 'get_current_screen' ) ) {
$screen = get_current_screen(); $screen = get_current_screen();
if ( $screen ) { if ( $screen ) {
@ -431,7 +412,6 @@ class MainWP_Helper {
$missing[] = $files; $missing[] = $files;
} }
} }
if ( ! empty( $missing ) ) { if ( ! empty( $missing ) ) {
$message = 'Missing file(s): ' . implode( ',', $missing ); $message = 'Missing file(s): ' . implode( ',', $missing );
if ( $return ) { if ( $return ) {
@ -456,7 +436,6 @@ class MainWP_Helper {
$missing[] = $classes; $missing[] = $classes;
} }
} }
if ( ! empty( $missing ) ) { if ( ! empty( $missing ) ) {
$message = 'Missing classes: ' . implode( ',', $missing ); $message = 'Missing classes: ' . implode( ',', $missing );
if ( $return ) { if ( $return ) {
@ -482,7 +461,6 @@ class MainWP_Helper {
$missing[] = $methods; $missing[] = $methods;
} }
} }
if ( ! empty( $missing ) ) { if ( ! empty( $missing ) ) {
$message = 'Missing method: ' . implode( ',', $missing ); $message = 'Missing method: ' . implode( ',', $missing );
if ( $return ) { if ( $return ) {
@ -491,7 +469,6 @@ class MainWP_Helper {
throw new \Exception( $message ); throw new \Exception( $message );
} }
} }
return true; return true;
} }
@ -508,7 +485,6 @@ class MainWP_Helper {
$missing[] = $properties; $missing[] = $properties;
} }
} }
if ( ! empty( $missing ) ) { if ( ! empty( $missing ) ) {
$message = 'Missing properties: ' . implode( ',', $missing ); $message = 'Missing properties: ' . implode( ',', $missing );
if ( $return ) { if ( $return ) {
@ -517,7 +493,6 @@ class MainWP_Helper {
throw new \Exception( $message ); throw new \Exception( $message );
} }
} }
return true; return true;
} }
@ -534,7 +509,6 @@ class MainWP_Helper {
$missing[] = $funcs; $missing[] = $funcs;
} }
} }
if ( ! empty( $missing ) ) { if ( ! empty( $missing ) ) {
$message = 'Missing functions: ' . implode( ',', $missing ); $message = 'Missing functions: ' . implode( ',', $missing );
if ( $return ) { if ( $return ) {
@ -543,7 +517,6 @@ class MainWP_Helper {
throw new \Exception( $message ); throw new \Exception( $message );
} }
} }
return true; return true;
} }

View file

@ -28,11 +28,19 @@
<!-- Disable Strict comparison check. Not applicable in the mojority of cases. --> <!-- Disable Strict comparison check. Not applicable in the mojority of cases. -->
<exclude name="WordPress.PHP.StrictComparisons"/> <exclude name="WordPress.PHP.StrictComparisons"/>
<!-- Disable Strict comparison in array check. Not applicable in the mojority of cases. --> <!-- Disable Strict comparison in array check. Not applicable in the mojority of cases. -->
<exclude name="WordPress.PHP.StrictInArray"/> <exclude name="WordPress.PHP.StrictInArray"/>
<!-- Disable Misuse of WP internationalization function check. --> <!-- Disable Misuse of WP internationalization function check. -->
<exclude name="WordPress.WP.I18n"/> <exclude name="WordPress.WP.I18n"/>
</rule>
<!-- Checks the cyclomatic complexity for functions. -->
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="15" />
<property name="absoluteComplexity" value="30" />
</properties>
</rule> </rule>
<!-- Enforce PSR1 compatible namespaces. --> <!-- Enforce PSR1 compatible namespaces. -->