From 475f522f56fce353d754497968eb6f40836a3046 Mon Sep 17 00:00:00 2001 From: Shady Sharaf Date: Thu, 24 Apr 2014 19:06:25 +0200 Subject: [PATCH] Switch to get/update_{site_}_option for multisite support --- includes/admin.php | 2 +- includes/extensions.php | 2 +- includes/updater.php | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/admin.php b/includes/admin.php index 1c0528c9f..0ca66d42d 100644 --- a/includes/admin.php +++ b/includes/admin.php @@ -463,7 +463,7 @@ public static function render_extensions_page() { 'stream-activation', 'stream_activation', array( - 'action' => get_option( 'stream-license' ) ? 'disconnect' : 'connect', + 'action' => get_site_option( 'stream-license' ) ? 'disconnect' : 'connect', 'api' => array( 'connect' => apply_filters( 'stream-api-url', WP_Stream_Updater::instance()->get_api_url() . 'connect', 'connect' ), 'disconnect' => apply_filters( 'stream-api-url', WP_Stream_Updater::instance()->get_api_url() . 'disconnect', 'disconnect' ), diff --git a/includes/extensions.php b/includes/extensions.php index 51102d469..29d366021 100644 --- a/includes/extensions.php +++ b/includes/extensions.php @@ -135,7 +135,7 @@ private function activate_membership() { * @return bool true if membership active */ private function verify_membership() { - if ( get_option( 'stream-license' ) ) { + if ( get_site_option( 'stream-license' ) ) { return true; } diff --git a/includes/updater.php b/includes/updater.php index f46d87114..d33cbf828 100644 --- a/includes/updater.php +++ b/includes/updater.php @@ -74,7 +74,7 @@ public function check( $transient ) { return $transient; } $response = (array) $this->request( array_intersect_key( $transient->checked, $this->plugins ) ); - $license = get_option( 'stream-license' ); + $license = get_site_option( 'stream-license' ); $site = parse_url( get_site_url(), PHP_URL_HOST ); if ( $response ) { foreach ( $response as $key => $value ) { @@ -98,7 +98,7 @@ public function request( $plugins ) { 'plugins' => $plugins, 'name' => get_bloginfo( 'name' ), 'url' => get_bloginfo( 'url' ), - 'license' => get_option( 'stream-license' ), + 'license' => get_site_option( 'stream-license' ), ), ); @@ -149,8 +149,8 @@ public function license_check() { wp_send_json_error( $data ); } - update_option( 'stream-license', $license ); - update_option( 'stream-licensee', $data->data->user ); + update_site_option( 'stream-license', $license ); + update_site_option( 'stream-licensee', $data->data->user ); // Invalidate plugin-update transient so we can check for updates // and restore package urls to existing updates @@ -164,8 +164,8 @@ public function license_remove() { wp_die( __( 'Invalid security check.', 'stream' ) ); } - delete_option( 'stream-license' ); - delete_option( 'stream-licensee' ); + delete_site_option( 'stream-license' ); + delete_site_option( 'stream-licensee' ); // Invalidate plugin-update transient so we can check for updates // and restore package urls to existing updates @@ -175,7 +175,7 @@ public function license_remove() { } public function plugin_action_links( $links ) { - if ( ! get_option( 'stream-license' ) ) { + if ( ! get_site_option( 'stream-license' ) ) { $links[ 'activation' ] = sprintf( '%2$s', admin_url( @@ -204,7 +204,7 @@ public function install_extension( $slug = null ) { // TODO: Nonce check $site = parse_url( get_site_url(), PHP_URL_HOST ); - $license = get_option( 'stream-license' ); + $license = get_site_option( 'stream-license' ); if ( empty( $license ) ) { wp_die( __( 'You must subscribe to Stream © to be able to download premium extensions.', 'stream' ) ); }