Skip to content

Commit

Permalink
Merge pull request #512 from x-team/issue-502
Browse files Browse the repository at this point in the history
Fix activation link in extensions page
  • Loading branch information
frankiejarrett committed May 7, 2014
2 parents b5f1361 + 065326f commit 5092f4a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions includes/extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public static function get_instance() {
if ( ! self::$instance ) {
self::$instance = new self();
}

return self::$instance;
}

Expand Down Expand Up @@ -134,9 +135,8 @@ function filter_plugin_api_info( $false, $action, $args ) {
return $false;
} elseif ( 'plugin_information' == $action && empty( $false ) ) {
/** @internal The querying the api using the filter endpoint doesn't seem to work. For now I'm looping through all the extensions to get the api info for using WordPress install api */
$site = esc_url_raw( parse_url( get_option( 'siteurl' ), PHP_URL_HOST ) );
$license = get_site_option( WP_Stream_Updater::LICENSE_KEY );

$site = esc_url_raw( parse_url( get_option( 'siteurl' ), PHP_URL_HOST ) );
$license = get_site_option( WP_Stream_Updater::LICENSE_KEY );
$join_url = self::API_TRANSPORT . self::API_DOMAIN . '/join/' . $this->get_affiliate();

foreach ( $this->get_extension_data() as $extension ) {
Expand Down Expand Up @@ -203,11 +203,13 @@ private function verify_membership() {
*/
function get_plugin_paths() {
$plugin_paths = array();

foreach ( get_plugins() as $path => $data ) {
if ( isset( $data['TextDomain'] ) && ! empty( $data['TextDomain'] ) ) {
$plugin_paths[ $data['TextDomain'] ] = $path;
}
}

return $plugin_paths;
}

Expand Down Expand Up @@ -291,7 +293,7 @@ function extensions_display_body( $extensions ) {
$image_src = isset( $extension->featured_image->source ) ? $extension->featured_image->source : null;
$image_src = ! empty( $image_src ) ? $image_src : null;
$install_link = wp_nonce_url( add_query_arg( array( 'action' => 'install-plugin', 'plugin' => $extension->slug ), self_admin_url( 'update.php' ) ), 'install-plugin_' . $extension->slug );
$activate_link = wp_nonce_url( add_query_arg( array( 'action' => 'activate', 'plugin' => $extension->post_meta->plugin_path[0], 'plugin_status' => 'all', 'paged' => '1' ), self_admin_url( 'plugins.php' ) ), 'activate-plugin_' . $extension->post_meta->plugin_path[0] );
$activate_link = wp_nonce_url( add_query_arg( array( 'action' => 'activate', 'plugin' => $plugin_path, 'plugin_status' => 'all', 'paged' => '1' ), self_admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_path );
$aria_action = esc_attr( $extension->slug . '-action' );
?>

Expand Down Expand Up @@ -370,7 +372,7 @@ function prepare_extensions_for_js( $extensions ) {
'activate18n' => __( 'Activate', 'stream' ),
'active18n' => __( 'Active', 'stream' ),
'actions' => array(
'activate' => wp_nonce_url( add_query_arg( array( 'action' => 'activate', 'plugin' => $extension->post_meta->plugin_path[0], 'plugin_status' => 'all', 'paged' => '1' ), self_admin_url( 'plugins.php' ) ), 'activate-plugin_' . $extension->post_meta->plugin_path[0] ), // xss ok (todo fix WPCS sniff)
'activate' => wp_nonce_url( add_query_arg( array( 'action' => 'activate', 'plugin' => $plugin_path, 'plugin_status' => 'all', 'paged' => '1' ), self_admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_path ), // xss ok (todo fix WPCS sniff)
'install' => wp_nonce_url( add_query_arg( array( 'action' => 'install-plugin', 'plugin' => $extension->slug ), self_admin_url( 'update.php' ) ), 'install-plugin_' . $extension->slug ), // xss ok (todo fix WPCS sniff)
'delete' => null,
),
Expand Down

0 comments on commit 5092f4a

Please sign in to comment.