Skip to content

Commit

Permalink
Use proper wp_stream_ prefix on option keys and hook names
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejarrett committed Apr 24, 2014
1 parent 113749d commit 61d7002
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public static function render_extensions_page() {
'stream-activation',
'stream_activation',
array(
'action' => get_site_option( 'wp-stream-license' ) ? 'disconnect' : 'connect',
'action' => get_site_option( 'wp_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' ),
Expand Down
2 changes: 1 addition & 1 deletion includes/extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function filter_allowed_external_host( $allow, $host, $url ) {
* @return bool true if membership active
*/
private function verify_membership() {
if ( get_site_option( 'wp-stream-license' ) ) {
if ( get_site_option( 'wp_stream_license' ) ) {
return true;
}

Expand Down
30 changes: 15 additions & 15 deletions includes/updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static function instance() {
}

public function __construct() {
$this->api_url = apply_filters( 'stream-api-url', $this->api_url );
$this->api_url = apply_filters( 'wp_stream_update_api_url', $this->api_url );
$this->setup();
}

Expand Down Expand Up @@ -50,7 +50,7 @@ public function info( $result, $action = null, $args = null ) {
return $result;
}

$url = apply_filters( 'stream-api-url', $this->api_url . $action, $action );
$url = apply_filters( 'wp_stream_update_api_url', $this->api_url . $action, $action );
$options = array(
'body' => array(
'slug' => $args->slug,
Expand All @@ -63,7 +63,7 @@ public function info( $result, $action = null, $args = null ) {
}

$body = wp_remote_retrieve_body( $response );
do_action( 'stream-update-api-response', $body, $response, $url, $options );
do_action( 'wp_stream_update_api_response', $body, $response, $url, $options );

$info = (object) json_decode( $body, true );
return $info;
Expand All @@ -74,7 +74,7 @@ public function check( $transient ) {
return $transient;
}
$response = (array) $this->request( array_intersect_key( $transient->checked, $this->plugins ) );
$license = get_site_option( 'wp-stream-license' );
$license = get_site_option( 'wp_stream_license' );
$site = parse_url( get_site_url(), PHP_URL_HOST );
if ( $response ) {
foreach ( $response as $key => $value ) {
Expand All @@ -91,14 +91,14 @@ public function check( $transient ) {

public function request( $plugins ) {
$action = 'update';
$url = apply_filters( 'stream-api-url', $this->api_url . $action, $action );
$url = apply_filters( 'wp_stream_update_api_url', $this->api_url . $action, $action );
$options = array(
'body' => array(
'a' => $action,
'plugins' => $plugins,
'name' => get_bloginfo( 'name' ),
'url' => get_bloginfo( 'url' ),
'license' => get_site_option( 'wp-stream-license' ),
'license' => get_site_option( 'wp_stream_license' ),
),
);

Expand All @@ -111,7 +111,7 @@ public function request( $plugins ) {
}

$body = wp_remote_retrieve_body( $response );
do_action( 'stream-update-api-response', $body, $response, $url, $options );
do_action( 'wp_stream_update_api_response', $body, $response, $url, $options );

$body = json_decode( $body );

Expand All @@ -137,7 +137,7 @@ public function license_check() {
),
);

$url = apply_filters( 'stream-api-url', $this->api_url . $action, $action );
$url = apply_filters( 'wp_stream_update_api_url', $this->api_url . $action, $action );
$response = wp_remote_post( $url, $args );

if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
Expand All @@ -149,8 +149,8 @@ public function license_check() {
wp_send_json_error( $data );
}

update_site_option( 'wp-stream-license', $license );
update_site_option( 'wp-stream-licensee', $data->data->user );
update_site_option( 'wp_stream_license', $license );
update_site_option( 'wp_stream_licensee', $data->data->user );

// Invalidate plugin-update transient so we can check for updates
// and restore package urls to existing updates
Expand All @@ -164,8 +164,8 @@ public function license_remove() {
wp_die( __( 'Invalid security check.', 'stream' ) );
}

delete_site_option( 'wp-stream-license' );
delete_site_option( 'wp-stream-licensee' );
delete_site_option( 'wp_stream_license' );
delete_site_option( 'wp_stream_licensee' );

// Invalidate plugin-update transient so we can check for updates
// and restore package urls to existing updates
Expand All @@ -175,7 +175,7 @@ public function license_remove() {
}

public function plugin_action_links( $links ) {
if ( ! get_site_option( 'wp-stream-license' ) ) {
if ( ! get_site_option( 'wp_stream_license' ) ) {
$links[ 'activation' ] = sprintf(
'<a href="%1$s">%2$s</a>',
admin_url(
Expand Down Expand Up @@ -204,7 +204,7 @@ public function install_extension( $slug = null ) {
// TODO: Nonce check

$site = parse_url( get_site_url(), PHP_URL_HOST );
$license = get_site_option( 'wp-stream-license' );
$license = get_site_option( 'wp_stream_license' );
if ( empty( $license ) ) {
wp_die( __( 'You must subscribe to Stream &copy; to be able to download premium extensions.', 'stream' ) );
}
Expand All @@ -218,7 +218,7 @@ public function install_extension( $slug = null ) {
$plugin = array(
'name' => wp_stream_filter_input( INPUT_GET, 'name' ),
'slug' => $slug,
'source' => add_query_arg( $source_args, apply_filters( 'stream-api-url', $this->api_url . 'download', array( 'download', $slug, 'extension' ) ) ),
'source' => add_query_arg( $source_args, apply_filters( 'wp_stream_update_api_url', $this->api_url . 'download', array( 'download', $slug, 'extension' ) ) ),
);

// Handle fs cred. request, TODO: Test
Expand Down

0 comments on commit 61d7002

Please sign in to comment.