mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-01 03:58:07 +08:00
Merge pull request #147 from mainwp/bogdan01-cf-autofix
Apply fixes from CodeFactor
This commit is contained in:
commit
bfea2ad02f
5 changed files with 46 additions and 46 deletions
|
@ -139,16 +139,16 @@ class MainWP_Child_Branding {
|
|||
|
||||
$current_settings['branding_ext_enabled'] = 'Y';
|
||||
|
||||
$header = array(
|
||||
$header = array(
|
||||
'name' => $settings['child_plugin_name'],
|
||||
'description' => $settings['child_plugin_desc'],
|
||||
'author' => $settings['child_plugin_author'],
|
||||
'authoruri' => $settings['child_plugin_author_uri'],
|
||||
'pluginuri' => isset( $settings['child_plugin_uri'] ) ? $settings['child_plugin_uri'] : '',
|
||||
);
|
||||
$current_settings['branding_header'] = $header;
|
||||
|
||||
$current_settings['preserve_branding'] = $settings['child_preserve_branding'];
|
||||
$current_settings['branding_header'] = $header;
|
||||
|
||||
$current_settings['preserve_branding'] = $settings['child_preserve_branding'];
|
||||
$current_settings['support_email'] = $settings['child_support_email'];
|
||||
$current_settings['support_message'] = $settings['child_support_message'];
|
||||
$current_settings['remove_restore'] = $settings['child_remove_restore'];
|
||||
|
@ -162,10 +162,10 @@ class MainWP_Child_Branding {
|
|||
$current_settings['email_message'] = $settings['child_send_email_message'];
|
||||
$current_settings['return_sender'] = $settings['child_message_return_sender'];
|
||||
$current_settings['submit_button_title'] = $settings['child_submit_button_title'];
|
||||
$current_settings['hide'] = $settings['child_plugin_hide'] ? 'T' : '';
|
||||
$current_settings['show_support'] = ( $settings['child_show_support_button'] && ! empty( $settings['child_support_email'] ) ) ? 'T' : '';
|
||||
$current_settings['disable_change'] = $settings['child_disable_change'] ? 'T' : '';
|
||||
$current_settings['disable_switching_theme'] = $settings['child_disable_switching_theme'] ? 'T' : '';
|
||||
$current_settings['hide'] = $settings['child_plugin_hide'] ? 'T' : '';
|
||||
$current_settings['show_support'] = ( $settings['child_show_support_button'] && ! empty( $settings['child_support_email'] ) ) ? 'T' : '';
|
||||
$current_settings['disable_change'] = $settings['child_disable_change'] ? 'T' : '';
|
||||
$current_settings['disable_switching_theme'] = $settings['child_disable_switching_theme'] ? 'T' : '';
|
||||
if ( isset( $settings['child_disable_wp_branding'] ) && ( 'Y' === $settings['child_disable_wp_branding'] || 'N' === $settings['child_disable_wp_branding'] ) ) {
|
||||
$current_settings['disable_wp_branding'] = $settings['child_disable_wp_branding'];
|
||||
}
|
||||
|
@ -177,8 +177,8 @@ class MainWP_Child_Branding {
|
|||
return $information;
|
||||
}
|
||||
|
||||
public static function get_extra_settings( $current_extra_setting, $settings, &$information ){
|
||||
|
||||
public static function get_extra_settings( $current_extra_setting, $settings, &$information ) {
|
||||
|
||||
$extra_setting = array(
|
||||
'show_button_in' => $settings['child_show_support_button_in'],
|
||||
'global_footer' => $settings['child_global_footer'],
|
||||
|
@ -269,7 +269,7 @@ class MainWP_Child_Branding {
|
|||
}
|
||||
return $extra_setting;
|
||||
}
|
||||
|
||||
|
||||
public static function branding_upload_image( $img_url ) {
|
||||
include_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
|
||||
|
|
|
@ -428,7 +428,7 @@ class MainWP_Child_Server_Information {
|
|||
<?php
|
||||
}
|
||||
|
||||
public static function render_page(){
|
||||
public static function render_page() {
|
||||
self::render_page_js();
|
||||
?>
|
||||
<style type="text/css">
|
||||
|
|
|
@ -213,7 +213,7 @@ class MainWP_Client_Report {
|
|||
unset( $_POST['sections'] );
|
||||
unset( $_POST['other_tokens'] );
|
||||
|
||||
$args = $this->get_stream_get_params( $other_tokens, $sections );
|
||||
$args = $this->get_stream_get_params( $other_tokens, $sections );
|
||||
$records = wp_mainwp_stream_get_instance()->db->query( $args );
|
||||
|
||||
if ( ! is_array( $records ) ) {
|
||||
|
@ -226,11 +226,11 @@ class MainWP_Client_Report {
|
|||
// fix for incorrect posts created logs!
|
||||
// query created posts from WP posts data to simulate records logging for created posts.
|
||||
if ( isset( $_POST['direct_posts'] ) && ! empty( $_POST['direct_posts'] ) ) {
|
||||
$this->fix_logs_posts_created( $records, $skip_records );
|
||||
$this->fix_logs_posts_created( $records, $skip_records );
|
||||
}
|
||||
|
||||
|
||||
$other_tokens_data = $this->get_stream_others_tokens( $records, $other_tokens, $skip_records );
|
||||
$sections_data = $this->get_stream_sections_data( $records, $sections, $skip_records );
|
||||
$sections_data = $this->get_stream_sections_data( $records, $sections, $skip_records );
|
||||
|
||||
$information = array(
|
||||
'other_tokens_data' => $other_tokens_data,
|
||||
|
@ -238,9 +238,9 @@ class MainWP_Client_Report {
|
|||
);
|
||||
return $information;
|
||||
}
|
||||
|
||||
private function get_stream_get_params( $other_tokens, $sections ){
|
||||
|
||||
|
||||
private function get_stream_get_params( $other_tokens, $sections ) {
|
||||
|
||||
$allowed_params = array(
|
||||
'connector',
|
||||
'context',
|
||||
|
@ -256,7 +256,7 @@ class MainWP_Client_Report {
|
|||
'blog_id',
|
||||
'ip',
|
||||
);
|
||||
|
||||
|
||||
$args = array();
|
||||
foreach ( $allowed_params as $param ) {
|
||||
$paramval = wp_mainwp_stream_filter_input( INPUT_POST, $param );
|
||||
|
@ -351,28 +351,28 @@ class MainWP_Client_Report {
|
|||
}
|
||||
|
||||
$args['records_per_page'] = 9999;
|
||||
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
private function get_stream_others_tokens( $records, $other_tokens, $skip_records ){
|
||||
|
||||
private function get_stream_others_tokens( $records, $other_tokens, $skip_records ) {
|
||||
$other_tokens_data = array();
|
||||
$parts = array( 'header', 'body', 'footer' );
|
||||
foreach( $parts as $part ) {
|
||||
$parts = array( 'header', 'body', 'footer' );
|
||||
foreach ( $parts as $part ) {
|
||||
if ( isset( $other_tokens[ $part ] ) && is_array( $other_tokens[ $part ] ) ) {
|
||||
$other_tokens_data[ $part ] = $this->get_other_tokens_data( $records, $other_tokens[ $part ], $skip_records );
|
||||
}
|
||||
}
|
||||
}
|
||||
return $other_tokens_data;
|
||||
}
|
||||
|
||||
private function get_stream_sections_data( $records, $sections, $skip_records ){
|
||||
|
||||
private function get_stream_sections_data( $records, $sections, $skip_records ) {
|
||||
$sections_data = array();
|
||||
$parts = array( 'header', 'body', 'footer' );
|
||||
foreach( $parts as $part ) {
|
||||
$parts = array( 'header', 'body', 'footer' );
|
||||
foreach ( $parts as $part ) {
|
||||
if ( isset( $sections[ $part ] ) && is_array( $sections[ $part ] ) && ! empty( $sections[ $part ] ) ) {
|
||||
foreach ( $sections[ $part ]['section_token'] as $index => $sec ) {
|
||||
$tokens = $sections[ $part ]['section_content_tokens'][ $index ];
|
||||
$tokens = $sections[ $part ]['section_content_tokens'][ $index ];
|
||||
$sections_data[ $part ][ $index ] = $this->get_section_loop_data( $records, $tokens, $sec, $skip_records );
|
||||
}
|
||||
}
|
||||
|
@ -380,8 +380,8 @@ class MainWP_Client_Report {
|
|||
return $sections_data;
|
||||
}
|
||||
|
||||
private function fix_logs_posts_created( &$records, &$skip_records ){
|
||||
|
||||
private function fix_logs_posts_created( &$records, &$skip_records ) {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
|
@ -433,7 +433,7 @@ class MainWP_Client_Report {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function get_other_tokens_data( $records, $tokens, &$skip_records ) {
|
||||
|
||||
$token_values = array();
|
||||
|
@ -895,7 +895,7 @@ class MainWP_Client_Report {
|
|||
}
|
||||
|
||||
private function get_mainwp_maintenance_token_value( $record, $data ) {
|
||||
|
||||
|
||||
$maintenance_details = array(
|
||||
'revisions' => __( 'Delete all post revisions', 'mainwp-child' ),
|
||||
'revisions_max' => __( 'Delete all post revisions, except for the last:', 'mainwp-child' ),
|
||||
|
@ -908,7 +908,7 @@ class MainWP_Client_Report {
|
|||
'categories' => __( 'Delete categories with 0 posts associated', 'mainwp-child' ),
|
||||
'optimize' => __( 'Optimize database tables', 'mainwp-child' ),
|
||||
);
|
||||
|
||||
|
||||
$meta_value = $this->get_stream_meta_data( $record, $data );
|
||||
$meta_value = explode( ',', $meta_value );
|
||||
|
||||
|
|
|
@ -1373,9 +1373,9 @@ class MainWP_Clone {
|
|||
|
||||
MainWP_Helper::end_session();
|
||||
|
||||
$file = ( isset( $_POST['f'] ) ? $_POST['f'] : $_POST['file'] );
|
||||
$testFull = false;
|
||||
$file = $this->clone_backup_get_file( $file, $testFull );
|
||||
$file = ( isset( $_POST['f'] ) ? $_POST['f'] : $_POST['file'] );
|
||||
$testFull = false;
|
||||
$file = $this->clone_backup_get_file( $file, $testFull );
|
||||
$cloneInstall = new MainWP_Clone_Install( $file );
|
||||
$cloneInstall->read_configuration_file();
|
||||
|
||||
|
@ -1421,15 +1421,15 @@ class MainWP_Clone {
|
|||
|
||||
$cloneInstall->update_wp_config();
|
||||
$cloneInstall->clean();
|
||||
$output = $this->clone_backup_delete_files( $plugins, $themes );
|
||||
$output = $this->clone_backup_delete_files( $plugins, $themes );
|
||||
} catch ( \Exception $e ) {
|
||||
$output = array( 'error' => $e->getMessage() );
|
||||
}
|
||||
|
||||
|
||||
die( wp_json_encode( $output ) );
|
||||
}
|
||||
|
||||
private function clone_backup_get_file( $file, &$testFull ){
|
||||
private function clone_backup_get_file( $file, &$testFull ) {
|
||||
if ( '' === $file ) {
|
||||
$dirs = MainWP_Helper::get_mainwp_dir( 'backup', false );
|
||||
$backupdir = $dirs[0];
|
||||
|
@ -1456,8 +1456,8 @@ class MainWP_Clone {
|
|||
}
|
||||
return $file;
|
||||
}
|
||||
|
||||
private function clone_backup_delete_files( $plugins, $themes ){
|
||||
|
||||
private function clone_backup_delete_files( $plugins, $themes ) {
|
||||
if ( false !== $plugins ) {
|
||||
$out = array();
|
||||
if ( is_array( $plugins ) ) {
|
||||
|
@ -1504,7 +1504,7 @@ class MainWP_Clone {
|
|||
wp_set_current_user( 0 );
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
public static function permalink_changed( $action ) {
|
||||
if ( 'update-permalink' === $action ) {
|
||||
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) || isset( $_POST['tag_base'] ) ) {
|
||||
|
|
|
@ -102,7 +102,7 @@ class MainWP_Helper {
|
|||
}
|
||||
return self::parse_css_rebuild( $ordered );
|
||||
}
|
||||
|
||||
|
||||
public static function parse_css_rebuild( $ordered ) {
|
||||
// Beginning to rebuild new slim CSS-Array.
|
||||
foreach ( $ordered as $key => $val ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue