WordPress.org

Plugin Directory

Changeset 612755


Ignore:
Timestamp:
10/15/12 14:15:37 (18 months ago)
Author:
willmot
Message:

2.3 feature release

Location:
wpremote
Files:
1 added
6 edited
9 copied

Legend:

Unmodified
Added
Removed
  • wpremote

    • Property svn:ignore set to
      trunk_git
  • wpremote/tags/2.3/plugin.php

    r612735 r612755  
    44Plugin Name: WP Remote 
    55Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. Deactivate to clear your API Key. 
    6 Version: 2.2.5 
     6Version: 2.3 
    77Author: Human Made Limited 
    88Author URI: http://hmn.md/ 
     
    144144 
    145145function _wprp_upgrade_core()  { 
    146      
     146 
    147147    include_once ( ABSPATH . 'wp-admin/includes/admin.php' ); 
    148148    include_once ( ABSPATH . 'wp-admin/includes/upgrade.php' ); 
    149149    include_once ( ABSPATH . 'wp-includes/update.php' ); 
    150150 
     151    // check for filesystem access 
     152    if ( ! _wpr_check_filesystem_access() ) 
     153        return array( 'status' => 'error', 'error' => 'The filesystem is not writable with the supplied credentials' ); 
     154 
    151155    // force refresh 
    152156    wp_version_check(); 
     
    171175 
    172176    global $wp_current_db_version, $wp_db_version; 
    173      
     177 
    174178    // we have to include version.php so $wp_db_version 
    175179    // will take the version of the updated version of wordpress 
     
    180184    return true; 
    181185} 
     186 
     187function _wpr_check_filesystem_access() { 
     188 
     189    ob_start(); 
     190    $success = request_filesystem_credentials(); 
     191    ob_end_clean(); 
     192 
     193    return (bool) $success; 
     194} 
     195 
     196function _wpr_set_filesystem_credentials( $credentials ) { 
     197 
     198    if ( empty( $_GET['filesystem_details'] ) ) 
     199        return $credentials; 
     200 
     201    $_credentials = array( 
     202        'username' => $_GET['filesystem_details']['credentials']['username'], 
     203        'password' => $_GET['filesystem_details']['credentials']['password'], 
     204        'hostname' => $_GET['filesystem_details']['credentials']['hostname'], 
     205        'connection_type' => $_GET['filesystem_details']['method'] 
     206    ); 
     207 
     208    // check whether the credentials can be used 
     209    if ( ! WP_Filesystem( $_credentials ) ) { 
     210        return $credentials; 
     211    } 
     212 
     213    return $_credentials; 
     214} 
     215add_filter( 'request_filesystem_credentials', '_wpr_set_filesystem_credentials' ); 
  • wpremote/tags/2.3/readme.txt

    r612735 r612755  
    33Tags: wpremote, remote administration, multiple wordpress 
    44Requires at least: 2.9 
    5 Tested up to: 3.4.1 
    6 Stable tag: 2.2.5 
     5Tested up to: 3.5 
     6Stable tag: 2.3 
    77 
    88WP Remote is a free web app that enables you to easily manage all of your WordPress powered sites from one place. 
     
    3232== Changelog == 
    3333 
     34#### 2.3 
     35 
     36* WP_Filesystem support for servers which don't allow PHP direct filesystem access. 
     37* Support for monitoring and updating Gravity Forms. 
     38 
    3439#### 2.2.5 
     40 
    3541* Implemented API call for Core updates 
    3642 
  • wpremote/tags/2.3/wprp.api.php

    r612735 r612755  
    2929 
    3030            $actions[$action] = '1.1'; 
    31              
     31 
    3232        break; 
    33          
     33 
    3434        case 'get_filesystem_method' : 
    3535 
    3636            $actions[$action] = get_filesystem_method(); 
    37          
     37 
    3838        break; 
    39          
     39 
     40        case 'get_supported_filesystem_methods' : 
     41 
     42            $actions[$action] = array(); 
     43 
     44            if ( extension_loaded('ftp') || extension_loaded('sockets') || function_exists('fsockopen') ) 
     45                $actions[$action][] = 'ftp'; 
     46 
     47            if ( extension_loaded('ftp') ) 
     48                $actions[$action][] = 'ftps'; 
     49 
     50            if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) 
     51                $actions[$action][] = 'ssh'; 
     52 
     53        break; 
     54 
    4055        case 'get_wp_version' : 
    4156 
     
    6378 
    6479        break; 
    65          
     80 
    6681        case 'activate_plugin' : 
    67              
     82 
    6883            $actions[$action] = _wprp_activate_plugin( (string) $_GET['plugin'] ); 
    69          
     84 
    7085        break; 
    71              
     86 
    7287        case 'get_themes' : 
    7388 
     
    86101        case 'supports_backups' : 
    87102        case 'get_backup' : 
    88      
     103 
    89104            $actions[$action] = _wprp_backups_api_call( $action ); 
    90105 
    91106        break; 
    92          
     107 
    93108        // get site info 
    94109        case 'get_site_info' : 
    95          
    96             $actions[$action] = array(  
    97                 'site_url' => get_site_url(),  
    98                 'home_url' => get_home_url(),  
     110 
     111            $actions[$action] = array( 
     112                'site_url' => get_site_url(), 
     113                'home_url' => get_home_url(), 
    99114                'admin_url' => get_admin_url(), 
    100                 'backups' => _wprp_get_backups_info()  
     115                'backups' => _wprp_get_backups_info() 
    101116            ); 
    102          
     117 
    103118        break; 
    104119 
     
    106121 
    107122            $actions[$action] = 'not-implemented'; 
    108              
     123 
    109124        break; 
    110125 
     
    112127 
    113128} 
     129 
    114130echo json_encode( $actions ); 
    115131exit; 
  • wpremote/tags/2.3/wprp.plugins.php

    r612735 r612755  
    1010    require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); 
    1111 
     12    _wpr_add_non_extend_plugin_support(); 
     13 
    1214    // Get all plugins 
    1315    $plugins = get_plugins(); 
     
    1517    // Get the list of active plugins 
    1618    $active  = get_option( 'active_plugins', array() ); 
    17      
     19 
    1820    // Delete the transient so wp_update_plugins can get fresh data 
    1921    if ( function_exists( 'get_site_transient' ) ) 
    2022        delete_site_transient( 'update_plugins' ); 
    21      
     23 
    2224    else 
    2325        delete_transient( 'update_plugins' ); 
    24      
     26 
    2527    // Force a plugin update check 
    2628    wp_update_plugins(); 
     
    3941    foreach ( (array) $plugins as $plugin_file => $plugin ) { 
    4042 
    41         $new_version = isset( $current->response[$plugin_file] ) ? $current->response[$plugin_file]->new_version : null; 
     43        $new_version = isset( $current->response[$plugin_file] ) ? $current->response[$plugin_file]->new_version : null; 
    4244 
    4345        if ( is_plugin_active( $plugin_file ) ) 
     
    7678        return array( 'status' => 'error', 'error' => 'WordPress version too old for plugin upgrades' ); 
    7779 
     80        _wpr_add_non_extend_plugin_support(); 
     81 
     82    // check for filesystem access 
     83    if ( ! _wpr_check_filesystem_access() ) 
     84        return array( 'status' => 'error', 'error' => 'The filesystem is not writable with the supplied credentials' ); 
     85 
    7886    $skin = new WPRP_Plugin_Upgrader_Skin(); 
    7987    $upgrader = new Plugin_Upgrader( $skin ); 
     
    100108    // If the plugin was activited, we have to re-activate it 
    101109    if ( $is_active ) { 
    102          
     110 
    103111        // we can not use the "normal" way or lazy activating, as thet requires wpremote to be activated 
    104112        if ( strpos( $plugin, 'wpremote' ) !== false ) { 
     
    108116 
    109117 
    110         // we do a remote request to activate, as we don;t want to kill any installs  
     118        // we do a remote request to activate, as we don;t want to kill any installs 
    111119        $url = add_query_arg( 'wpr_api_key', $_GET['wpr_api_key'], get_bloginfo( 'url' ) ); 
    112120        $url = add_query_arg( 'actions', 'activate_plugin', $url ); 
    113121        $url = add_query_arg( 'plugin', $plugin, $url ); 
    114          
     122 
    115123        $request = wp_remote_get( $url ); 
    116124 
     
    118126            return array( 'status' => 'error', 'error' => $request->get_error_code() ); 
    119127        } 
    120          
     128 
    121129        $body = wp_remote_retrieve_body( $request ); 
    122          
    123          
     130 
     131 
    124132        if ( ! $json = @json_decode( $body ) ) 
    125133            return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate.' ); 
    126          
     134 
    127135        $json = $json->activate_plugin; 
    128          
     136 
    129137        if ( empty( $json->status ) ) 
    130138            return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate. The activation reuest returned no response' ); 
    131          
     139 
    132140        if ( $json->status != 'success' ) 
    133141            return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate. The activation reuest returned response: ' . $json->status ); 
     
    138146 
    139147function _wprp_activate_plugin( $plugin ) { 
    140      
     148 
    141149    include_once ABSPATH . 'wp-admin/includes/plugin.php'; 
    142150 
     
    145153    if ( is_wp_error( $result ) ) 
    146154        return array( 'status' => 'error', 'error' => $result->get_error_code() ); 
    147      
     155 
    148156    return array( 'status' => 'success' ); 
    149157} 
     
    163171 
    164172} 
     173 
     174function _wpr_add_non_extend_plugin_support() { 
     175 
     176    add_filter( 'pre_set_site_transient_update_plugins', function( $value ) { 
     177 
     178        foreach( $non_extend_list = _wprp_get_non_extend_plugins_data() as $key => $anon_function ) { 
     179 
     180            if ( ( $returned = $non_extend_list[$key]() ) ) 
     181                $value->response[$returned->plugin_location] = $returned; 
     182        } 
     183 
     184        return $value; 
     185 
     186    } ); 
     187} 
     188 
     189function _wprp_get_non_extend_plugins_data() { 
     190 
     191    return array( 
     192        'gravity_forms' => function() { 
     193 
     194            if ( ! class_exists('GFCommon') || ! method_exists( 'GFCommon', 'get_version_info' ) || ! method_exists( 'RGForms', 'premium_update_push' ) ) 
     195                return false; 
     196 
     197            $version_data  = GFCommon::get_version_info(); 
     198            $plugin_data   = reset( RGForms::premium_update_push( array() ) ); 
     199 
     200            if ( empty( $version_data['url'] ) || empty( $version_data['is_valid_key'] ) || empty( $plugin_data['new_version'] ) || empty( $plugin_data['PluginURI'] ) || empty( $plugin_data['slug'] ) ) 
     201                return false; 
     202 
     203            return (object) array( 
     204                'plugin_location' => $plugin_data['slug'], //Not in standard structure but don't forget to include it! 
     205                'id'              => 999999999, 
     206                'slug'            => 'gravityforms', 
     207                'url'             => $plugin_data['PluginURI'], 
     208                'package'         => $version_data['url'], 
     209                'new_version'     => $version_data['version'] 
     210            ); 
     211        } 
     212    ); 
     213} 
  • wpremote/tags/2.3/wprp.themes.php

    r612735 r612755  
    9393        return array( 'status' => 'error', 'error' => 'WordPress version too old for theme upgrades' ); 
    9494 
     95    // check for filesystem access 
     96    if ( ! _wpr_check_filesystem_access() ) 
     97        return array( 'status' => 'error', 'error' => 'The filesystem is not writable with the supplied credentials' );      
     98 
    9599    $skin = new WPRP_Theme_Upgrader_Skin(); 
    96100    $upgrader = new Theme_Upgrader( $skin ); 
  • wpremote/trunk/plugin.php

    r597911 r612755  
    44Plugin Name: WP Remote 
    55Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. Deactivate to clear your API Key. 
    6 Version: 2.2.5 
     6Version: 2.3 
    77Author: Human Made Limited 
    88Author URI: http://hmn.md/ 
     
    144144 
    145145function _wprp_upgrade_core()  { 
    146      
     146 
    147147    include_once ( ABSPATH . 'wp-admin/includes/admin.php' ); 
    148148    include_once ( ABSPATH . 'wp-admin/includes/upgrade.php' ); 
    149149    include_once ( ABSPATH . 'wp-includes/update.php' ); 
    150150 
     151    // check for filesystem access 
     152    if ( ! _wpr_check_filesystem_access() ) 
     153        return array( 'status' => 'error', 'error' => 'The filesystem is not writable with the supplied credentials' ); 
     154 
    151155    // force refresh 
    152156    wp_version_check(); 
     
    171175 
    172176    global $wp_current_db_version, $wp_db_version; 
    173      
     177 
    174178    // we have to include version.php so $wp_db_version 
    175179    // will take the version of the updated version of wordpress 
     
    180184    return true; 
    181185} 
     186 
     187function _wpr_check_filesystem_access() { 
     188 
     189    ob_start(); 
     190    $success = request_filesystem_credentials(); 
     191    ob_end_clean(); 
     192 
     193    return (bool) $success; 
     194} 
     195 
     196function _wpr_set_filesystem_credentials( $credentials ) { 
     197 
     198    if ( empty( $_GET['filesystem_details'] ) ) 
     199        return $credentials; 
     200 
     201    $_credentials = array( 
     202        'username' => $_GET['filesystem_details']['credentials']['username'], 
     203        'password' => $_GET['filesystem_details']['credentials']['password'], 
     204        'hostname' => $_GET['filesystem_details']['credentials']['hostname'], 
     205        'connection_type' => $_GET['filesystem_details']['method'] 
     206    ); 
     207 
     208    // check whether the credentials can be used 
     209    if ( ! WP_Filesystem( $_credentials ) ) { 
     210        return $credentials; 
     211    } 
     212 
     213    return $_credentials; 
     214} 
     215add_filter( 'request_filesystem_credentials', '_wpr_set_filesystem_credentials' ); 
  • wpremote/trunk/readme.txt

    r597911 r612755  
    33Tags: wpremote, remote administration, multiple wordpress 
    44Requires at least: 2.9 
    5 Tested up to: 3.4.1 
    6 Stable tag: 2.2.5 
     5Tested up to: 3.5 
     6Stable tag: 2.3 
    77 
    88WP Remote is a free web app that enables you to easily manage all of your WordPress powered sites from one place. 
     
    3232== Changelog == 
    3333 
     34#### 2.3 
     35 
     36* WP_Filesystem support for servers which don't allow PHP direct filesystem access. 
     37* Support for monitoring and updating Gravity Forms. 
     38 
    3439#### 2.2.5 
     40 
    3541* Implemented API call for Core updates 
    3642 
  • wpremote/trunk/wprp.api.php

    r597911 r612755  
    2929 
    3030            $actions[$action] = '1.1'; 
    31              
     31 
    3232        break; 
    33          
     33 
    3434        case 'get_filesystem_method' : 
    3535 
    3636            $actions[$action] = get_filesystem_method(); 
    37          
     37 
    3838        break; 
    39          
     39 
     40        case 'get_supported_filesystem_methods' : 
     41 
     42            $actions[$action] = array(); 
     43 
     44            if ( extension_loaded('ftp') || extension_loaded('sockets') || function_exists('fsockopen') ) 
     45                $actions[$action][] = 'ftp'; 
     46 
     47            if ( extension_loaded('ftp') ) 
     48                $actions[$action][] = 'ftps'; 
     49 
     50            if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) 
     51                $actions[$action][] = 'ssh'; 
     52 
     53        break; 
     54 
    4055        case 'get_wp_version' : 
    4156 
     
    6378 
    6479        break; 
    65          
     80 
    6681        case 'activate_plugin' : 
    67              
     82 
    6883            $actions[$action] = _wprp_activate_plugin( (string) $_GET['plugin'] ); 
    69          
     84 
    7085        break; 
    71              
     86 
    7287        case 'get_themes' : 
    7388 
     
    86101        case 'supports_backups' : 
    87102        case 'get_backup' : 
    88      
     103 
    89104            $actions[$action] = _wprp_backups_api_call( $action ); 
    90105 
    91106        break; 
    92          
     107 
    93108        // get site info 
    94109        case 'get_site_info' : 
    95          
    96             $actions[$action] = array(  
    97                 'site_url' => get_site_url(),  
    98                 'home_url' => get_home_url(),  
     110 
     111            $actions[$action] = array( 
     112                'site_url' => get_site_url(), 
     113                'home_url' => get_home_url(), 
    99114                'admin_url' => get_admin_url(), 
    100                 'backups' => _wprp_get_backups_info()  
     115                'backups' => _wprp_get_backups_info() 
    101116            ); 
    102          
     117 
    103118        break; 
    104119 
     
    106121 
    107122            $actions[$action] = 'not-implemented'; 
    108              
     123 
    109124        break; 
    110125 
     
    112127 
    113128} 
     129 
    114130echo json_encode( $actions ); 
    115131exit; 
  • wpremote/trunk/wprp.plugins.php

    r521366 r612755  
    1010    require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); 
    1111 
     12    _wpr_add_non_extend_plugin_support(); 
     13 
    1214    // Get all plugins 
    1315    $plugins = get_plugins(); 
     
    1517    // Get the list of active plugins 
    1618    $active  = get_option( 'active_plugins', array() ); 
    17      
     19 
    1820    // Delete the transient so wp_update_plugins can get fresh data 
    1921    if ( function_exists( 'get_site_transient' ) ) 
    2022        delete_site_transient( 'update_plugins' ); 
    21      
     23 
    2224    else 
    2325        delete_transient( 'update_plugins' ); 
    24      
     26 
    2527    // Force a plugin update check 
    2628    wp_update_plugins(); 
     
    3941    foreach ( (array) $plugins as $plugin_file => $plugin ) { 
    4042 
    41         $new_version = isset( $current->response[$plugin_file] ) ? $current->response[$plugin_file]->new_version : null; 
     43        $new_version = isset( $current->response[$plugin_file] ) ? $current->response[$plugin_file]->new_version : null; 
    4244 
    4345        if ( is_plugin_active( $plugin_file ) ) 
     
    7678        return array( 'status' => 'error', 'error' => 'WordPress version too old for plugin upgrades' ); 
    7779 
     80        _wpr_add_non_extend_plugin_support(); 
     81 
     82    // check for filesystem access 
     83    if ( ! _wpr_check_filesystem_access() ) 
     84        return array( 'status' => 'error', 'error' => 'The filesystem is not writable with the supplied credentials' ); 
     85 
    7886    $skin = new WPRP_Plugin_Upgrader_Skin(); 
    7987    $upgrader = new Plugin_Upgrader( $skin ); 
     
    100108    // If the plugin was activited, we have to re-activate it 
    101109    if ( $is_active ) { 
    102          
     110 
    103111        // we can not use the "normal" way or lazy activating, as thet requires wpremote to be activated 
    104112        if ( strpos( $plugin, 'wpremote' ) !== false ) { 
     
    108116 
    109117 
    110         // we do a remote request to activate, as we don;t want to kill any installs  
     118        // we do a remote request to activate, as we don;t want to kill any installs 
    111119        $url = add_query_arg( 'wpr_api_key', $_GET['wpr_api_key'], get_bloginfo( 'url' ) ); 
    112120        $url = add_query_arg( 'actions', 'activate_plugin', $url ); 
    113121        $url = add_query_arg( 'plugin', $plugin, $url ); 
    114          
     122 
    115123        $request = wp_remote_get( $url ); 
    116124 
     
    118126            return array( 'status' => 'error', 'error' => $request->get_error_code() ); 
    119127        } 
    120          
     128 
    121129        $body = wp_remote_retrieve_body( $request ); 
    122          
    123          
     130 
     131 
    124132        if ( ! $json = @json_decode( $body ) ) 
    125133            return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate.' ); 
    126          
     134 
    127135        $json = $json->activate_plugin; 
    128          
     136 
    129137        if ( empty( $json->status ) ) 
    130138            return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate. The activation reuest returned no response' ); 
    131          
     139 
    132140        if ( $json->status != 'success' ) 
    133141            return array( 'status' => 'error', 'error' => 'The plugin was updated, but failed to re-activate. The activation reuest returned response: ' . $json->status ); 
     
    138146 
    139147function _wprp_activate_plugin( $plugin ) { 
    140      
     148 
    141149    include_once ABSPATH . 'wp-admin/includes/plugin.php'; 
    142150 
     
    145153    if ( is_wp_error( $result ) ) 
    146154        return array( 'status' => 'error', 'error' => $result->get_error_code() ); 
    147      
     155 
    148156    return array( 'status' => 'success' ); 
    149157} 
     
    163171 
    164172} 
     173 
     174function _wpr_add_non_extend_plugin_support() { 
     175 
     176    add_filter( 'pre_set_site_transient_update_plugins', function( $value ) { 
     177 
     178        foreach( $non_extend_list = _wprp_get_non_extend_plugins_data() as $key => $anon_function ) { 
     179 
     180            if ( ( $returned = $non_extend_list[$key]() ) ) 
     181                $value->response[$returned->plugin_location] = $returned; 
     182        } 
     183 
     184        return $value; 
     185 
     186    } ); 
     187} 
     188 
     189function _wprp_get_non_extend_plugins_data() { 
     190 
     191    return array( 
     192        'gravity_forms' => function() { 
     193 
     194            if ( ! class_exists('GFCommon') || ! method_exists( 'GFCommon', 'get_version_info' ) || ! method_exists( 'RGForms', 'premium_update_push' ) ) 
     195                return false; 
     196 
     197            $version_data  = GFCommon::get_version_info(); 
     198            $plugin_data   = reset( RGForms::premium_update_push( array() ) ); 
     199 
     200            if ( empty( $version_data['url'] ) || empty( $version_data['is_valid_key'] ) || empty( $plugin_data['new_version'] ) || empty( $plugin_data['PluginURI'] ) || empty( $plugin_data['slug'] ) ) 
     201                return false; 
     202 
     203            return (object) array( 
     204                'plugin_location' => $plugin_data['slug'], //Not in standard structure but don't forget to include it! 
     205                'id'              => 999999999, 
     206                'slug'            => 'gravityforms', 
     207                'url'             => $plugin_data['PluginURI'], 
     208                'package'         => $version_data['url'], 
     209                'new_version'     => $version_data['version'] 
     210            ); 
     211        } 
     212    ); 
     213} 
  • wpremote/trunk/wprp.themes.php

    r595352 r612755  
    9393        return array( 'status' => 'error', 'error' => 'WordPress version too old for theme upgrades' ); 
    9494 
     95    // check for filesystem access 
     96    if ( ! _wpr_check_filesystem_access() ) 
     97        return array( 'status' => 'error', 'error' => 'The filesystem is not writable with the supplied credentials' );      
     98 
    9599    $skin = new WPRP_Theme_Upgrader_Skin(); 
    96100    $upgrader = new Theme_Upgrader( $skin ); 
Note: See TracChangeset for help on using the changeset viewer.