Changeset 947412
- Timestamp:
- 07/12/2014 11:26:52 AM (12 years ago)
- Location:
- pwebonedrive/trunk
- Files:
-
- 1 deleted
- 7 edited
-
admin-buttons.php (modified) (2 diffs)
-
admin.php (modified) (9 diffs)
-
callback.php (modified) (2 diffs)
-
do.php (deleted)
-
languages/pwebonedrive-en_GB.pot (modified) (4 diffs)
-
liveconnect.php (modified) (4 diffs)
-
pwebonedrive.php (modified) (9 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pwebonedrive/trunk/admin-buttons.php
r939310 r947412 1 1 <?php 2 2 /** 3 * @version 1. 1.03 * @version 1.2.0 4 4 * @package OneDrive 5 5 * @copyright © 2014 Perfect Web sp. z o.o., All rights reserved. http://www.perfect-web.co … … 56 56 'client_id:"'.get_option('pweb_onedrive_client_id').'"', 57 57 'task_url:"'.admin_url( 'admin-ajax.php?action=pweb_onedrive_' ).'"', 58 'redirect_url:"'. plugins_url( 'callback.php', __FILE__).'"',58 'redirect_url:"'.LiveConnectClient::getRedirectUri().'"', 59 59 'spinner_url:"'.includes_url().'images/wpspin-2x.gif"' 60 60 ); -
pwebonedrive/trunk/admin.php
r939310 r947412 1 1 <?php 2 2 /** 3 * @version 1. 1.03 * @version 1.2.0 4 4 * @package OneDrive 5 5 * @copyright © 2014 Perfect Web sp. z o.o., All rights reserved. http://www.perfect-web.co … … 18 18 } 19 19 20 add_filter( 'plugin_action_links', 'pweb_onedrive_plugin_action_links', 10, 2);20 add_filter( 'plugin_action_links', 'pweb_onedrive_plugin_action_links', 10, 2 ); 21 21 function pweb_onedrive_plugin_action_links( $links, $file ) 22 22 { … … 28 28 } 29 29 30 add_action( 'admin_notices', 'pweb_onedrive_admin_notices' ); 31 function pweb_onedrive_admin_notices() 32 { 33 if ((!isset($_GET['page']) OR $_GET['page'] !== 'pwebonedrive-config') AND LiveConnectClient::getRedirectUri() !== get_option('pweb_onedrive_redirect_uri')) 34 { 35 ?> 36 <div class="error" id="pwebonedrive_redirect_uri_notice"> 37 <p><?php printf(__( 'Redirect URL for Perfect OneDrive Gallery & File has changed. You have to update your Windows Live Application. Go to plugin %ssettings%s and save it to dismiss this notice.', 'pwebonedrive' ), '<a href="' . admin_url( 'admin.php?page=pwebonedrive-config' ) . '">', '</a>'); ?></p> 38 </div> 39 <?php 40 } 41 } 30 42 31 43 // displays the page content for the settings submenu … … 35 47 36 48 //must check that the user has the required capability 37 if (!current_user_can('manage_options')) 38 { 49 if (!current_user_can('manage_options')) { 39 50 wp_die( __('You do not have sufficient permissions to access this page.') ); 40 51 } 52 53 // cleanup plugin after update 54 if (is_file( dirname(__FILE__).'/do.php' )) { 55 @unlink( dirname(__FILE__).'/do.php' ); 56 } 57 58 wp_enqueue_script('jquery'); 41 59 42 60 // See if the user has posted us some information 43 61 // If they did, this hidden field will be set to 'Y' 44 62 if (isset($_POST['submitConfig'])) { 45 63 46 64 $errors = array(); 47 65 48 if ( isset( $_POST['client_id'] ) AND $_POST['client_id'] ) 49 {66 if ( isset( $_POST['client_id'] ) AND $_POST['client_id'] ) { 67 50 68 if (preg_match('/^[0-9a-zA-Z]{16}$/', $_POST['client_id'])) { 51 69 update_option( 'pweb_onedrive_client_id', preg_replace('/[^0-9a-zA-Z]$/', '', $_POST['client_id']) ); … … 65 83 $errors[] = __('Missing Client secret.', 'pwebonedrive' ); 66 84 } 85 86 update_option('pweb_onedrive_redirect_uri', LiveConnectClient::getRedirectUri()); 67 87 68 88 if (count($errors)) { … … 77 97 } 78 98 } 99 100 if (LiveConnectClient::getRedirectUri() !== get_option('pweb_onedrive_redirect_uri')) { 101 ?> 102 <div class="error"> 103 <p><?php _e( 'Redirect URL for Perfect OneDrive Gallery & File has changed. You have to update your Windows Live Application. Save settings to dismiss this notice.', 'pwebonedrive' ); ?></p> 104 </div> 105 <?php 106 } 79 107 ?> 80 108 <div class="wrap"> … … 94 122 </h2> 95 123 96 <?php if (version_compare( $wp_version, ' 2.8', '<' ) ) { ?>97 <div class="error"><p><strong><?php _e('This plugin is compatible with WordPress 2.8or higher.', 'pwebonedrive' ); ?></strong></p></div>124 <?php if (version_compare( $wp_version, '3.1', '<' ) ) { ?> 125 <div class="error"><p><strong><?php _e('This plugin is compatible with WordPress 3.1 or higher.', 'pwebonedrive' ); ?></strong></p></div> 98 126 <?php } ?> 99 127 … … 113 141 <?php _e('Register your site in', 'pwebonedrive'); ?> 114 142 <a target="_blank" href="https://account.live.com/developers/applications/index"><?php _e('Windows Live application management', 'pwebonedrive'); ?></a>.<br> 115 <?php _e('Remember to set', 'pwebonedrive'); ?> <strong><?php _e('Redirect URL', 'pwebonedrive'); ?></strong>: 116 <a href="<?php echo plugins_url( 'callback.php', __FILE__ ); ?>" target="_blank"><?php echo plugins_url( 'callback.php', __FILE__ ); ?></a><br> 143 <?php _e('Remember to set', 'pwebonedrive'); ?> <strong><?php _e('Redirect URL', 'pwebonedrive'); ?></strong> 117 144 <?php _e('and', 'pwebonedrive'); ?> <strong><?php _e('Mobile client app: No', 'pwebonedrive'); ?></strong><br> 118 145 <?php _e('and if available', 'pwebonedrive'); ?> <strong><?php _e('Enhanced redirection security: Enabled', 'pwebonedrive'); ?></strong> <?php _e('(for applications created before June 2014)', 'pwebonedrive'); ?><br> 119 146 <?php _e('Read how to', 'pwebonedrive'); ?> <a target="_blank" href="http://msdn.microsoft.com/library/cc287659.aspx"><?php _e('get your Client ID', 'pwebonedrive'); ?></a>. 120 147 </p> 148 </td> 149 </tr> 150 <tr> 151 <th><label for="pweb-redirect_uri"><?php _e('Redirect URL', 'pwebonedrive'); ?></label></th> 152 <td> 153 <input id="pweb-redirect_uri" name="redirect_uri" type="text" size="30" readonly="readonly" value="<?php echo esc_attr( LiveConnectClient::getRedirectUri() ); ?>" class="regular-text code"> 154 <script type="text/javascript"> 155 jQuery(document).ready(function($){ 156 $("input#pweb-redirect_uri") 157 .on("click", function(e){ 158 e.preventDefault(); 159 e.stopPropagation(); 160 $(this).select(); 161 }) 162 .on("keydown", function(e){ 163 e.preventDefault(); 164 e.stopPropagation(); 165 $(this).select(); 166 }); 167 }); 168 </script> 169 <p><em><?php _e('This URL might change if you change WordPress permalinks settings', 'pwebonedrive'); ?></em></p> 121 170 </td> 122 171 </tr> … … 154 203 (function(){ 155 204 var pw=document.createElement("script");pw.type="text/javascript";pw.async=true; 156 pw.src="https://www.perfect-web.co/index.php?option=com_pwebshop&view=updates&format=raw&extension=wp_onedrive&version=<?php echo pweb_onedrive_get_version(); ?>&wpversion=<?php echo $wp_version; ?> ";205 pw.src="https://www.perfect-web.co/index.php?option=com_pwebshop&view=updates&format=raw&extension=wp_onedrive&version=<?php echo pweb_onedrive_get_version(); ?>&wpversion=<?php echo $wp_version; ?>&uid=<?php echo md5(home_url()); ?>"; 157 206 var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(pw,s); 158 207 })(); -
pwebonedrive/trunk/callback.php
r939310 r947412 1 1 <?php 2 2 /** 3 * @version 1. 1.03 * @version 1.2.0 4 4 * @package OneDrive 5 5 * @copyright © 2014 Perfect Web sp. z o.o., All rights reserved. http://www.perfect-web.co 6 6 * @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL 7 7 * @author Piotr Moćko 8 * 9 * @deprecated Enable permalinks in WordPress settings to stop using this file 8 10 */ 9 11 … … 13 15 require_once( dirname(dirname(dirname( dirname( __FILE__ ) ))) . '/wp-load.php' ); 14 16 15 16 $client = LiveConnectClient::getInstance(); 17 $client->log(__FUNCTION__); 18 19 echo $client->handlePageRequest(); 20 21 $client->log(__FUNCTION__.'. Die'); 17 pweb_onedrive_callback(); 22 18 23 19 die(); -
pwebonedrive/trunk/languages/pwebonedrive-en_GB.pot
r939310 r947412 2 2 msgstr "" 3 3 "Project-Id-Version: Perfect OneDrive\n" 4 "POT-Creation-Date: 2014-0 6-26 22:37+0100\n"5 "PO-Revision-Date: 2014-0 6-26 22:38+0100\n"4 "POT-Creation-Date: 2014-07-12 13:25+0100\n" 5 "PO-Revision-Date: 2014-07-12 13:26+0100\n" 6 6 "Last-Translator: Piotr Moćko <[email protected]>\n" 7 7 "Language-Team: Perfect-Web.co <[email protected]>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 1.6. 5\n"12 "X-Generator: Poedit 1.6.6\n" 13 13 "X-Poedit-Basepath: ../\n" 14 14 "Plural-Forms: nplurals=2; plural=(n != 1);\n" … … 59 59 msgstr "" 60 60 61 #: admin.php:39 61 #: admin.php:37 62 #, php-format 63 msgid "" 64 "Redirect URL for Perfect OneDrive Gallery & File has changed. You have to " 65 "update your Windows Live Application. Go to plugin %ssettings%s and save it " 66 "to dismiss this notice." 67 msgstr "" 68 69 #: admin.php:50 62 70 msgid "You do not have sufficient permissions to access this page." 63 71 msgstr "" 64 72 65 #: admin.php: 5473 #: admin.php:72 66 74 msgid "Incorrect Client ID." 67 75 msgstr "" 68 76 69 #: admin.php: 5877 #: admin.php:76 70 78 msgid "Missing Client ID." 71 79 msgstr "" 72 80 73 #: admin.php: 6581 #: admin.php:83 74 82 msgid "Missing Client secret." 75 83 msgstr "" 76 84 77 #: admin.php: 7585 #: admin.php:95 78 86 msgid "Settings saved." 79 87 msgstr "" 80 88 81 #: admin.php:83 89 #: admin.php:103 90 msgid "" 91 "Redirect URL for Perfect OneDrive Gallery & File has changed. You have to " 92 "update your Windows Live Application. Save settings to dismiss this notice." 93 msgstr "" 94 95 #: admin.php:111 82 96 msgid "Version" 83 97 msgstr "" 84 98 85 #: admin.php: 8799 #: admin.php:115 86 100 msgid "Perfect OneDrive Gallery & File Settings" 87 101 msgstr "" 88 102 89 #: admin.php: 90103 #: admin.php:118 90 104 msgid "Documentation" 91 105 msgstr "" 92 106 93 #: admin.php: 93107 #: admin.php:121 94 108 msgid "Buy Support" 95 109 msgstr "" 96 110 97 #: admin.php: 9798 msgid "This plugin is compatible with WordPress 2.8or higher."111 #: admin.php:125 112 msgid "This plugin is compatible with WordPress 3.1 or higher." 99 113 msgstr "" 100 114 101 #: admin.php:1 02115 #: admin.php:130 102 116 msgid "" 103 117 "Share easily your photos and files stored on Microsoft OneDrive. You can " … … 105 119 msgstr "" 106 120 107 #: admin.php:1 13121 #: admin.php:141 108 122 msgid "Register your site in" 109 123 msgstr "" 110 124 111 #: admin.php:1 14125 #: admin.php:142 112 126 msgid "Windows Live application management" 113 127 msgstr "" 114 128 115 #: admin.php:1 15129 #: admin.php:143 116 130 msgid "Remember to set" 117 131 msgstr "" 118 132 119 #: admin.php:1 15133 #: admin.php:143 admin.php:151 120 134 msgid "Redirect URL" 121 135 msgstr "" 122 136 123 #: admin.php:1 17137 #: admin.php:144 124 138 msgid "and" 125 139 msgstr "" 126 140 127 #: admin.php:1 17141 #: admin.php:144 128 142 msgid "Mobile client app: No" 129 143 msgstr "" 130 144 131 #: admin.php:1 18145 #: admin.php:145 132 146 msgid "and if available" 133 147 msgstr "" 134 148 135 #: admin.php:1 18149 #: admin.php:145 136 150 msgid "Enhanced redirection security: Enabled" 137 151 msgstr "" 138 152 139 #: admin.php:1 18153 #: admin.php:145 140 154 msgid "(for applications created before June 2014)" 141 155 msgstr "" 142 156 143 #: admin.php:1 19157 #: admin.php:146 144 158 msgid "Read how to" 145 159 msgstr "" 146 160 147 #: admin.php:1 19161 #: admin.php:146 148 162 msgid "get your Client ID" 149 163 msgstr "" 150 164 151 #: admin.php:124 165 #: admin.php:169 166 msgid "This URL might change if you change WordPress permalinks settings" 167 msgstr "" 168 169 #: admin.php:173 152 170 msgid "Client ID" 153 171 msgstr "" 154 172 155 #: admin.php:1 30173 #: admin.php:179 156 174 msgid "Client secret" 157 175 msgstr "" 158 176 159 #: pwebonedrive.php:14 1177 #: pwebonedrive.php:143 160 178 msgid "There are no images in this gallery!" 161 179 msgstr "" 162 180 163 #: pwebonedrive.php:14 7181 #: pwebonedrive.php:149 164 182 msgid "Can not load images!" 165 183 msgstr "" 166 184 167 #: pwebonedrive.php:24 4185 #: pwebonedrive.php:246 168 186 msgid "Can not load file!" 169 187 msgstr "" 170 188 171 #: pwebonedrive.php:2 68 pwebonedrive.php:309 pwebonedrive.php:382172 #: pwebonedrive.php:42 2 pwebonedrive.php:445189 #: pwebonedrive.php:270 pwebonedrive.php:311 pwebonedrive.php:385 190 #: pwebonedrive.php:426 pwebonedrive.php:449 173 191 msgid "Can not load data!" 174 192 msgstr "" -
pwebonedrive/trunk/liveconnect.php
r939310 r947412 1 1 <?php 2 2 /** 3 * @version 1. 1.03 * @version 1.2.0 4 4 * @package OneDrive 5 5 * @copyright © 2014 Perfect Web sp. z o.o., All rights reserved. http://www.perfect-web.co … … 19 19 protected $options; 20 20 protected $http; 21 protected $access_id = 0; 22 protected static $access = array(); 23 protected static $token = array(); 24 protected static $instance = null; 21 protected $access_id = 0; 22 protected static $access = array(); 23 protected static $token = array(); 24 protected static $redirect_uri = null; 25 protected static $instance = null; 25 26 26 27 public function __construct($options = null) … … 33 34 'authurl' => 'https://login.live.com/oauth20_token.srf', 34 35 'tokenurl' => 'https://login.live.com/oauth20_token.srf', 35 'redirecturi' => plugins_url( 'callback.php', __FILE__),36 'redirecturi' => self::getRedirectUri(), 36 37 'userefresh' => true, 37 38 'storetoken' => true, … … 64 65 self::$instance = & $instance; 65 66 } 67 } 68 69 70 public static function getRedirectUri() 71 { 72 if (!self::$redirect_uri) 73 { 74 $permalink_structure = get_option('permalink_structure'); 75 76 if ($permalink_structure) 77 { 78 $pos = strpos($permalink_structure, 'index.php/'); 79 if ($pos === 0 OR $pos === 1) 80 { 81 self::$redirect_uri = home_url( 'index.php/pwebonedrive/callback' ); 82 } 83 else 84 { 85 self::$redirect_uri = home_url( 'pwebonedrive/callback' ); 86 } 87 } 88 else 89 { 90 self::$redirect_uri = plugins_url( 'callback.php', __FILE__ ); 91 } 92 } 93 94 return self::$redirect_uri; 66 95 } 67 96 -
pwebonedrive/trunk/pwebonedrive.php
r942142 r947412 4 4 * Plugin URI: http://www.perfect-web.co/wordpress/microsoft-onedrive-gallery-file 5 5 * Description: Share easily your photos and files stored on Microsoft OneDrive. You can display a gallery with your photos or a link to a file for download. 6 * Version: 1. 1.06 * Version: 1.2.0 7 7 * Text Domain: pwebonedrive 8 8 * Author: Piotr Moćko … … 27 27 } 28 28 add_action('init', 'pweb_onedrive_init'); 29 29 30 30 31 … … 123 124 124 125 // Image url 125 $url = plugins_url('do.php', __FILE__).'?action=display_photo&aid='.$images->access_id.'&code='.base64_encode($image->id.'/picture?type='.$full).'#'.$image->ext;126 $src = plugins_url('do.php', __FILE__).'?action=display_photo&aid='.$images->access_id.'&code='.base64_encode($image->id.'/picture?type='.$thumbnail);126 $url = admin_url('admin-ajax.php?action=pweb_onedrive_display_photo&aid='.$images->access_id.'&code='.base64_encode($image->id.'/picture?type='.$full).'#'.$image->ext); 127 $src = admin_url('admin-ajax.php?action=pweb_onedrive_display_photo&aid='.$images->access_id.'&code='.base64_encode($image->id.'/picture?type='.$thumbnail)); 127 128 128 129 // Output image … … 190 191 191 192 // Image url 192 $src = plugins_url('do.php', __FILE__).'?action=display_photo&aid='.$file->access_id.'&code='.base64_encode($file->id.'/picture?type='.$image);193 $src = admin_url('admin-ajax.php?action=pweb_onedrive_display_photo&aid='.$file->access_id.'&code='.base64_encode($file->id.'/picture?type='.$image)); 193 194 194 195 // Output image … … 227 228 228 229 // File url 229 $url = plugins_url('do.php', __FILE__).'?action=download_file&aid='.$file->access_id.'&code='.base64_encode($file->id.'/content?download=true');230 $url = admin_url('admin-ajax.php?action=pweb_onedrive_download_file&aid='.$file->access_id.'&code='.base64_encode($file->id.'/content?download=true')); 230 231 231 232 // Output file … … 364 365 365 366 367 add_action('wp_ajax_pweb_onedrive_download_file', 'pweb_onedrive_download_file'); 366 368 add_action('wp_ajax_nopriv_pweb_onedrive_download_file', 'pweb_onedrive_download_file'); 367 369 function pweb_onedrive_download_file() … … 404 406 405 407 408 add_action('wp_ajax_pweb_onedrive_display_photo', 'pweb_onedrive_display_photo'); 406 409 add_action('wp_ajax_nopriv_pweb_onedrive_display_photo', 'pweb_onedrive_display_photo'); 407 410 function pweb_onedrive_display_photo() … … 454 457 echo $response['body']; 455 458 } 459 460 die(); 461 } 462 463 464 function pweb_onedrive_parse_request() 465 { 466 if (!empty($_SERVER['REQUEST_URI']) AND preg_match('/\/pwebonedrive\/callback\/?$/', $_SERVER['REQUEST_URI']) === 1) 467 { 468 pweb_onedrive_callback(); 469 } 470 } 471 add_action('parse_request', 'pweb_onedrive_parse_request'); 472 473 function pweb_onedrive_callback() 474 { 475 $client = LiveConnectClient::getInstance(); 476 $client->log(__FUNCTION__); 477 478 echo $client->handlePageRequest(); 479 480 $client->log(__FUNCTION__.'. Die'); 456 481 457 482 die(); … … 493 518 dbDelta( $sql ); 494 519 } 520 521 register_uninstall_hook( __FILE__, 'pweb_onedrive_uninstall' ); 522 function pweb_onedrive_uninstall() 523 { 524 global $wpdb; 525 526 $wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}onedrive_access`" ); 527 $wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}onedrive_storage`" ); 528 529 delete_option( 'pweb_onedrive_client_id' ); 530 delete_option( 'pweb_onedrive_client_secret' ); 531 delete_option( 'pweb_onedrive_redirect_uri' ); 532 } -
pwebonedrive/trunk/readme.txt
r939310 r947412 3 3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CDDZ6G6LDV4LG 4 4 Tags: onedrive, one drive, skydrive, microsoft, gallery, download, cloud storage 5 Requires at least: 2.8.05 Requires at least: 3.1.0 6 6 Tested up to: 3.9.1 7 Stable tag: 1. 1.07 Stable tag: 1.2.0 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 124 124 == Changelog == 125 125 126 = 1.2.0 / 12-07-2014 = 127 * Requires at least WordPress 3.1 128 * New redirect URL which supports permalinks 129 * Handle OneDrive calls through WordPress AJAX interface 130 126 131 = 1.1.0 / 26-06-2014 = 127 132 * Fixed redirect URL for new Windows Live applications … … 150 155 = 1.1.0 = 151 156 New redirect URL for Windows Live applications! See configuration of plugin after upgrade. 157 158 = 1.2.0 = 159 New redirect URL for Windows Live applications! See configuration of plugin after upgrade.
Note: See TracChangeset
for help on using the changeset viewer.