Version; $theme_base = get_option('template'); /**************************************************/ //Uncomment below to find the theme slug that will need to be setup on the api server // var_dump($theme_base); function qitheme_update_check($checked_data) { global $wp_version, $theme_version, $theme_base, $api_url, $quadro_options; $request = array( 'slug' => $theme_base, 'version' => $theme_version, 'username' => $quadro_options['quadro_username'], 'userpass' => $quadro_options['quadro_userpass'], ); // Start checking for an update $send_for_check = array( 'body' => array( 'action' => 'theme_update', 'request' => serialize( $request ), 'api-key' => md5( esc_url(home_url()) ) ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . esc_url(home_url()) ); $raw_response = wp_remote_post($api_url, $send_for_check); if (!is_wp_error($raw_response) && ($raw_response['response']['code'] == 200)) $response = unserialize($raw_response['body']); // Feed the update data into WP updater if (!empty($response)) $checked_data->response[$theme_base] = $response; return $checked_data; } // Take over the Theme info screen on WP multisite function qitheme_api_call($def, $action, $args) { global $theme_base, $api_url, $theme_version; // Add check for 'slug' existence inside $args // to avoid WordPress.org server error message // in some screens if ( !property_exists($args, 'slug') ) return false; if ( $args->slug != $theme_base ) return false; // Get the current version $args->version = $theme_version; $request_string = prepare_request($action, $args); $request = wp_remote_post($api_url, $request_string); if ( is_wp_error($request) ) { $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.

Try again', 'quadro'), $request->get_error_message()); } else { $res = unserialize($request['body']); if ($res === false) $res = new WP_Error('themes_api_failed', __('An unknown error occurred', 'quadro'), $request['body']); } return $res; } // Add these functions only if updates enabled in Theme Options if ( isset($quadro_options['updates_enable']) && $quadro_options['updates_enable'] == true ) { add_filter('pre_set_site_transient_update_themes', 'qitheme_update_check'); add_filter('themes_api', 'qitheme_api_call', 10, 3); if ( is_admin() ) $current = get_transient('update_themes'); } ?>