mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-06 11:10:43 +08:00
Merge pull request #152 from mainwp/bogdan01-cf-autofix
Apply fixes from CodeFactor
This commit is contained in:
commit
dad5f282c9
4 changed files with 26 additions and 26 deletions
|
@ -113,9 +113,8 @@ class MainWP_Child_Install {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function theme_action() {
|
||||
|
||||
$action = $_POST['action'];
|
||||
|
@ -234,7 +233,7 @@ class MainWP_Child_Install {
|
|||
if ( is_wp_error( $result ) ) {
|
||||
if ( true == $ssl_verify && strpos( $url, 'https://' ) === 0 ) {
|
||||
$ssl_verify = false;
|
||||
$result = $this->try_install_one_more( $url, $installer );
|
||||
$result = $this->try_install_one_more( $url, $installer );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,7 +248,7 @@ class MainWP_Child_Install {
|
|||
);
|
||||
if ( 'plugin' === $_POST['type'] ) {
|
||||
$path = $result['destination'];
|
||||
$fileName = '';
|
||||
$fileName = '';
|
||||
wp_cache_set( 'plugins', array(), 'plugins' );
|
||||
foreach ( $result['source_files'] as $srcFile ) {
|
||||
if ( is_dir( $path . $srcFile ) ) {
|
||||
|
@ -290,10 +289,10 @@ class MainWP_Child_Install {
|
|||
$information['destination_name'] = $result['destination_name'];
|
||||
mainwp_child_helper()->write( $information );
|
||||
}
|
||||
|
||||
|
||||
private function try_install_one_more( $url, $installer ) {
|
||||
add_filter( 'http_request_args', array( MainWP_Helper::get_class_name(), 'no_ssl_filter_function' ), 99, 2 );
|
||||
$result = $installer->run(
|
||||
add_filter( 'http_request_args', array( MainWP_Helper::get_class_name(), 'no_ssl_filter_function' ), 99, 2 );
|
||||
$result = $installer->run(
|
||||
array(
|
||||
'package' => $url,
|
||||
'destination' => ( 'plugin' === $_POST['type'] ? WP_PLUGIN_DIR : WP_CONTENT_DIR . '/themes' ),
|
||||
|
@ -311,6 +310,6 @@ class MainWP_Child_Install {
|
|||
MainWP_Helper::error( implode( ', ', $error ), $err_code );
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,17 +245,17 @@ class MainWP_Connect {
|
|||
MainWP_Utility::instance()->upload_file( $_REQUEST['fdl'], isset( $_REQUEST['foffset'] ) ? $_REQUEST['foffset'] : 0 );
|
||||
exit;
|
||||
}
|
||||
// to support open not wp-admin url.
|
||||
// to support open not wp-admin url.
|
||||
if ( isset( $_REQUEST['open_location'] ) ) {
|
||||
$open_location = base64_decode( $_REQUEST['open_location'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons.
|
||||
$this->open_location_redirect( $open_location );
|
||||
}
|
||||
$this->where_redirect();
|
||||
}
|
||||
$this->where_redirect();
|
||||
}
|
||||
|
||||
private function open_location_redirect( $open_location ) {
|
||||
$_vars = MainWP_Helper::parse_query( $open_location );
|
||||
$_path = wp_parse_url( $open_location, PHP_URL_PATH );
|
||||
private function open_location_redirect( $open_location ) {
|
||||
$_vars = MainWP_Helper::parse_query( $open_location );
|
||||
$_path = wp_parse_url( $open_location, PHP_URL_PATH );
|
||||
if ( isset( $_vars['_mwpNoneName'] ) && isset( $_vars['_mwpNoneValue'] ) ) {
|
||||
$_vars[ $_vars['_mwpNoneName'] ] = wp_create_nonce( $_vars['_mwpNoneValue'] );
|
||||
unset( $_vars['_mwpNoneName'] );
|
||||
|
@ -274,8 +274,8 @@ class MainWP_Connect {
|
|||
wp_safe_redirect( site_url() . $open_location );
|
||||
exit();
|
||||
}
|
||||
|
||||
private function where_redirect() {
|
||||
|
||||
private function where_redirect() {
|
||||
$where = isset( $_REQUEST['where'] ) ? $_REQUEST['where'] : '';
|
||||
if ( isset( $_POST['f'] ) || isset( $_POST['file'] ) ) {
|
||||
$file = '';
|
||||
|
@ -293,9 +293,9 @@ class MainWP_Connect {
|
|||
$_SESSION['size'] = $_POST['size'];
|
||||
}
|
||||
wp_safe_redirect( admin_url( $where ) );
|
||||
exit();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
public function check_login() {
|
||||
|
||||
// to login requires 'mainwpsignature'.
|
||||
|
|
|
@ -306,11 +306,12 @@ class MainWP_Custom_Post_Type {
|
|||
return array( 'error' => __( 'Product SKU must be unique', $this->plugin_translate ) );
|
||||
}
|
||||
}
|
||||
if ( '_product_image_gallery' == $key['meta_key'] ) {
|
||||
if ( '_product_image_gallery' == $key['meta_key'] ) {
|
||||
if ( isset( $data['extras']['woocommerce']['product_images'] ) ) {
|
||||
$ret = $this->upload_postmeta_image( $data['extras']['woocommerce']['product_images'], $meta_value, $check_image_existed );
|
||||
if ( true !== $ret )
|
||||
if ( true !== $ret ) {
|
||||
return $ret;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
@ -343,8 +344,8 @@ class MainWP_Custom_Post_Type {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private function upload_postmeta_image( $product_images, &$meta_value, $check_image_existed ){
|
||||
|
||||
private function upload_postmeta_image( $product_images, &$meta_value, $check_image_existed ) {
|
||||
$product_image_gallery = array();
|
||||
foreach ( $product_images as $product_image ) {
|
||||
try {
|
||||
|
|
|
@ -105,16 +105,16 @@ class MainWP_Pages {
|
|||
|
||||
// if preserve branding and do not hide menus.
|
||||
if ( ( ! $remove_all_child_menu && 'T' !== $is_hide ) || $cancelled_branding ) {
|
||||
|
||||
|
||||
$branding_header = isset( $branding_opts['branding_header'] ) ? $branding_opts['branding_header'] : array();
|
||||
if ( ( is_array( $branding_header ) && ! empty( $branding_header['name'] ) ) && ! $cancelled_branding ) {
|
||||
self::$brandingTitle = stripslashes( $branding_header['name'] );
|
||||
self::$brandingTitle = stripslashes( $branding_header['name'] );
|
||||
$child_menu_title = stripslashes( $branding_header['name'] );
|
||||
$child_page_title = $child_menu_title . ' Settings';
|
||||
} else {
|
||||
$child_menu_title = 'MainWP Child';
|
||||
$child_page_title = 'MainWPSettings';
|
||||
}
|
||||
}
|
||||
$this->init_pages( $branding_header );
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ class MainWP_Pages {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function plugin_row_meta( $plugin_meta, $plugin_file ) {
|
||||
global $mainWPChild;
|
||||
if ( $mainWPChild->plugin_slug !== $plugin_file ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue