/home/vianto5/cititower.mx/wp-content/plugins/siteorigin-panels/inc/installer/inc
NameSizeModeActions
admin.php109660644editdlrm
Edit: /home/vianto5/cititower.mx/wp-content/plugins/siteorigin-panels/inc/installer/inc/admin.php (10966B)
'so_installer_dismiss' ), admin_url( 'admin-ajax.php' ) ), 'so_installer_dismiss' ); ?>

' . __( 'Click here', 'siteorigin-panels' ) . '' ); ?>

wp_nonce_url( admin_url( 'admin-ajax.php?action=siteorigin_installer_manage' ), 'siteorigin-installer-manage' ), 'activateText' => __( 'Activate', 'siteorigin-panels' ), ) ); } public function manage_product() { check_ajax_referer( 'siteorigin-installer-manage' ); if ( empty( $_POST['slug'] ) || empty( $_POST['task'] ) || empty( $_POST['type'] ) ) { die(); } $task = sanitize_key( $_POST['task'] ); $type = sanitize_key( $_POST['type'] ); $capability = ''; if ( $type === 'plugins' ) { if ( $task === 'install' ) { $capability = 'install_plugins'; } elseif ( $task === 'update' ) { $capability = 'update_plugins'; } elseif ( $task === 'activate' ) { $capability = 'activate_plugins'; } } elseif ( $type === 'themes' ) { if ( $task === 'install' ) { $capability = 'install_themes'; } elseif ( $task === 'update' ) { $capability = 'update_themes'; } elseif ( $task === 'activate' ) { $capability = 'switch_themes'; } } if ( empty( $capability ) || ! current_user_can( $capability ) ) { die(); } // SO Premium won't have a version. if ( empty( $_POST['version'] ) && $_POST['slug'] != 'siteorigin-premium' ) { die(); } $slug = sanitize_file_name( $_POST['slug'] ); $product_url = 'https://wordpress.org/' . urlencode( $type ) . '/download/' . urlencode( $slug ) . '.' . urlencode( $_POST['version'] ) . '.zip'; // check_ajax_referer( 'so_installer_manage' ); if ( ! class_exists( 'WP_Upgrader' ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; } $upgrader = new WP_Upgrader(); if ( $type === 'plugins' ) { if ( $task === 'install' || $task === 'update' ) { $upgrader->run( array( 'package' => esc_url( $product_url ), 'destination' => WP_PLUGIN_DIR, 'clear_destination' => true, 'abort_if_destination_exists' => false, 'hook_extra' => array( 'type' => 'plugin', 'action' => 'install', ), ) ); $clear = true; } elseif ( $task === 'activate' && ! is_wp_error( validate_plugin( $slug . '/' . $slug . '.php' ) ) ) { activate_plugin( $slug . '/' . $slug . '.php' ); $clear = true; } } elseif ( $type === 'themes' ) { if ( $task === 'install' || $task === 'update' ) { $upgrader->run( array( 'package' => esc_url( $product_url ), 'destination' => get_theme_root(), 'clear_destination' => true, 'clear_working' => true, 'abort_if_destination_exists' => false, ) ); $clear = true; } elseif ( $task === 'activate' ) { switch_theme( $slug ); $clear = true; } } if ( ! empty( $clear ) ) { delete_transient( 'siteorigin_installer_product_data' ); } die(); } private function update_product_data( $product = array(), $return = true ) { $current_theme = wp_get_theme(); if ( empty( $products ) ) { $products = apply_filters( 'siteorigin_installer_products', json_decode( file_get_contents( SITEORIGIN_INSTALLER_DIR . '/data/products.json' ), true ) ); } require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $fields = array( 'short_description' => true, 'version' => true, ); // Should we remove the premium teaser? if ( ! apply_filters( 'siteorigin_premium_upgrade_teaser', true ) || defined( 'SITEORIGIN_PREMIUM_VERSION' ) ) { unset( $products['siteorigin-premium'] ); } // $product_data = get_transient( 'siteorigin_installer_product_data' ); foreach ( $products as $slug => $item ) { $status = false; if ( $item['type'] == 'themes' ) { $api = themes_api( 'theme_information', array( 'slug' => $slug, 'fields' => $fields, ) ); $theme = wp_get_theme( $slug ); // Work out the status of the theme. if ( is_object( $theme->errors() ) ) { $status = 'install'; } else { $products[ $slug ]['update'] = version_compare( $theme->get( 'Version' ), $api->version, '<' ); if ( $theme->get_stylesheet() != $current_theme->get_stylesheet() ) { $status = 'activate'; } } // Theme descriptions are too long so we need to shorten them. $description = explode( '.', $api->sections['description'] ); $description = $description[0] . '. ' . $description[1]; } else { $api = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => $fields, ) ); // Work out the status of the plugin. $plugin_file = "$slug/$slug.php"; if ( ! file_exists( WP_PLUGIN_DIR . "/$plugin_file" ) ) { $status = 'install'; } elseif ( ! is_plugin_active( $plugin_file ) ) { $status = 'activate'; } if ( $status != 'install' ) { $plugin = get_plugin_data( WP_PLUGIN_DIR . "/$plugin_file" ); $products[ $slug ]['update'] = ! is_wp_error( $api ) ? version_compare( $plugin['Version'], $api->version, '<' ) : false; } if ( empty( $item['screenshot'] ) ) { $products[ $slug ]['screenshot'] = 'https://plugins.svn.wordpress.org/' . $slug . '/assets/icon.svg'; } } $products[ $slug ]['status'] = $status; $products[ $slug ]['version'] = ! is_wp_error( $api ) ? $api->version : false; if ( empty( $item['description'] ) ) { $products[ $slug ]['description'] = $item['type'] == 'themes' ? "$description." : $api->short_description; } } if ( isset( $products['siteorigin-premium'] ) ) { $products['siteorigin-premium']['screenshot'] = SITEORIGIN_INSTALLER_URL . 'img/premium-icon.svg'; } uasort( $products, array( $this, 'sort_compare' ) ); set_transient( 'siteorigin_installer_product_data', $products, 43200 ); return $products; } /** * Display the theme admin page */ public function display_admin_page() { $products = apply_filters( 'siteorigin_installer_products_transient', get_transient( 'siteorigin_installer_product_data' ) ); if ( empty( $products ) ) { $products = $this->update_product_data(); } if ( ! empty( $_GET['highlight'] ) && isset( $products[ (string) $_GET['highlight'] ] ) ) { $products[ (string) $_GET['highlight'] ]['weight'] = 9999; uasort( $products, array( $this, 'sort_compare' ) ); $highlight = $_GET['highlight']; } include SITEORIGIN_INSTALLER_DIR . '/tpl/admin.php'; } /** * Comparison function for sorting * * @return int */ public function sort_compare( $a, $b ) { if ( empty( $a['weight'] ) || empty( $b['weight'] ) ) { return 0; } return $a['weight'] < $b['weight'] ? 1 : -1; } } } SiteOrigin_Installer_Admin::single();