PATH:
home
/
lab2454c
/
sothebankuab.com
/
wp-content
/
plugins
/
jetpack
/
json-endpoints
/
jetpack
<?php include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; include_once ABSPATH . 'wp-admin/includes/file.php'; class Jetpack_JSON_API_Themes_New_Endpoint extends Jetpack_JSON_API_Themes_Endpoint { // POST /sites/%s/themes/%s/install protected $needed_capabilities = 'install_themes'; protected $action = 'install'; protected $download_links = array(); protected function validate_call( $_blog_id, $capability, $check_manage_active = true ) { $validate = parent::validate_call( $_blog_id, $capability, $check_manage_active ); if ( is_wp_error( $validate ) ) { // Lets delete the attachment... if the user doesn't have the right permissions to do things. $args = $this->input(); if ( isset( $args['zip'][0]['id'] ) ) { wp_delete_attachment( $args['zip'][0]['id'], true ); } } return $validate; } protected function validate_input( $theme ) { $this->bulk = false; $this->themes = array(); } function install() { $args = $this->input(); if ( isset( $args['zip'][0]['id'] ) ) { $attachment_id = $args['zip'][0]['id']; $local_file = get_attached_file( $attachment_id ); if ( ! $local_file ) { return new WP_Error( 'local-file-does-not-exist' ); } jetpack_require_lib( 'class.jetpack-automatic-install-skin' ); $skin = new Jetpack_Automatic_Install_Skin(); $upgrader = new Theme_Upgrader( $skin ); $pre_install_list = wp_get_themes(); $result = $upgrader->install( $local_file ); // clean up. wp_delete_attachment( $attachment_id, true ); if ( is_wp_error( $result ) ) { return $result; } $after_install_list = wp_get_themes(); $plugin = array_values( array_diff( array_keys( $after_install_list ), array_keys( $pre_install_list ) ) ); if ( ! $result ) { $error_code = $upgrader->skin->get_main_error_code(); $message = $upgrader->skin->get_main_error_message(); if ( empty( $message ) ) { $message = __( 'An unknown error occurred during installation', 'jetpack' ); } if ( 'download_failed' === $error_code ) { $error_code = 'no_package'; } return new WP_Error( $error_code, $message, 400 ); } if ( empty( $plugin ) ) { return new WP_Error( 'theme_already_installed' ); } $this->themes = $plugin; $this->log[ $plugin[0] ] = $upgrader->skin->get_upgrade_messages(); return true; } return new WP_Error( 'no_theme_installed' ); } }
[-] class.jetpack-json-api-plugins-list-endpoint.php
[edit]
[-] class.jetpack-json-api-user-create-endpoint.php
[edit]
[-] class.jetpack-json-api-modules-list-endpoint.php
[edit]
[-] class-jetpack-json-api-modules-list-v1-2-endpoint.php
[edit]
[-] class-jetpack-json-api-delete-backup-helper-script-endpoint.php
[edit]
[-] class.jetpack-json-api-themes-list-endpoint.php
[edit]
[-] class.jetpack-json-api-modules-modify-endpoint.php
[edit]
[-] class.jetpack-json-api-check-capabilities-endpoint.php
[edit]
[-] class.jetpack-json-api-modules-endpoint.php
[edit]
[-] class.jetpack-json-api-plugins-install-endpoint.php
[edit]
[-] class.jetpack-json-api-get-database-object-backup-endpoint.php
[edit]
[-] class.jetpack-json-api-plugins-delete-endpoint.php
[edit]
[-] class.jetpack-json-api-plugins-modify-endpoint.php
[edit]
[-] class.jetpack-json-api-themes-endpoint.php
[edit]
[+]
..
[-] class.jetpack-json-api-get-post-backup-endpoint.php
[edit]
[-] class.jetpack-json-api-log-endpoint.php
[edit]
[-] class.jetpack-json-api-user-connect-endpoint.php
[edit]
[-] class.jetpack-json-api-core-endpoint.php
[edit]
[-] class.jetpack-json-api-sync-endpoint.php
[edit]
[-] class.wpcom-json-api-get-option-endpoint.php
[edit]
[-] class.jetpack-json-api-get-option-backup-endpoint.php
[edit]
[-] class.jetpack-json-api-endpoint.php
[edit]
[-] class.jetpack-json-api-themes-install-endpoint.php
[edit]
[-] class.jetpack-json-api-plugins-get-endpoint.php
[edit]
[-] class.jetpack-json-api-updates-status-endpoint.php
[edit]
[-] class.jetpack-json-api-modules-get-endpoint.php
[edit]
[-] class.jetpack-json-api-plugins-modify-v1-2-endpoint.php
[edit]
[-] class.wpcom-json-api-update-option-endpoint.php
[edit]
[-] class.jetpack-json-api-themes-modify-endpoint.php
[edit]
[-] class.jetpack-json-api-get-user-backup-endpoint.php
[edit]
[-] class.jetpack-json-api-core-modify-endpoint.php
[edit]
[-] class.jetpack-json-api-jps-woocommerce-connect-endpoint.php
[edit]
[-] class.jetpack-json-api-translations-endpoint.php
[edit]
[-] class.jetpack-json-api-themes-active-endpoint.php
[edit]
[-] class.jetpack-json-api-get-term-backup-endpoint.php
[edit]
[-] class.jetpack-json-api-cron-endpoint.php
[edit]
[-] class.jetpack-json-api-plugins-new-endpoint.php
[edit]
[-] class.jetpack-json-api-themes-delete-endpoint.php
[edit]
[-] class.jetpack-json-api-themes-get-endpoint.php
[edit]
[-] class.jetpack-json-api-plugins-endpoint.php
[edit]
[-] json-api-jetpack-endpoints.php
[edit]
[-] class.jetpack-json-api-translations-modify-endpoint.php
[edit]
[-] class.jetpack-json-api-themes-new-endpoint.php
[edit]
[-] class.jetpack-json-api-maybe-auto-update-endpoint.php
[edit]
[-] class.jetpack-json-api-get-comment-backup-endpoint.php
[edit]
[-] class-jetpack-json-api-install-backup-helper-script-endpoint.php
[edit]