Changeset 2188695
- Timestamp:
- 11/08/2019 11:03:28 PM (6 years ago)
- Location:
- insert-amazon-images/trunk
- Files:
-
- 3 edited
-
AmazonImages.php (modified) (9 diffs)
-
js/manager.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
insert-amazon-images/trunk/AmazonImages.php
r2171562 r2188695 69 69 if ( ! empty( $licence_key ) ) { 70 70 71 $domain = sanitize_text_field($_SERVER['SERVER_NAME']);71 $domain = sanitize_text_field($_SERVER['SERVER_NAME']); 72 72 // check last checked time 73 73 $lastchecked = \get_option( AmazonImages::class . 'LicenceLastChecked' ); 74 74 $is_licence_valid = false; 75 if ( empty( $lastchecked ) || ( (int) $lastchecked ) < ( time() - 60 * 60 * 24 ) ) {75 if ( empty( $lastchecked ) || ( (int) $lastchecked ) < ( time() - 60 * 60 * 24 ) ) { 76 76 // check licence 77 77 // check validation code … … 258 258 $newtab = [ 'amzimage' => 'Insert From AMZ Image']; 259 259 return array_merge( $tabs, $newtab ); 260 }260 } 261 261 262 262 public function amazon_media_upload_amzimage_content(){ … … 272 272 public function add_amazon_media_button() { 273 273 ?> 274 <a name="Search images on Amazon" 275 href="#TB_inline?width=500px&height=500px&inlineId=insert-amazon-images-thickbox" 276 id="insert-amazon-images-button" class="button thickbox">Add Amazon Images</a> 277 <style> 278 a#insert-amazon-images-button { 279 position: absolute; 280 left: 27%; 281 z-index: 111; 282 top: 20px; 283 } 284 .block-editor-writing-flow { 285 height: auto; 286 } 287 </style> 274 <a name="Search images on Amazon" 275 href="#TB_inline?width=500px&height=500px&inlineId=insert-amazon-images-thickbox" 276 id="insert-amazon-images-button" class="button thickbox">Add Amazon Images</a> 277 <style> 278 .block-editor-writing-flow { 279 height: auto; 280 } 281 </style> 288 282 <?php 289 283 } 290 284 291 public function add_amazon_media_button_gutenberg() {285 public function add_amazon_media_button_gutenberg() { 292 286 ?> 293 <a name="Search images on Amazon" 294 href="#TB_inline?width=500px&height=500px&inlineId=insert-amazon-images-thickbox" 295 id="insert-amazon-images-button" class="button thickbox">Add Amazon Images</a> 296 <style> 297 a#insert-amazon-images-button { 298 position: absolute; 299 left: 27%; 300 z-index: 111; 301 top: 44px; 302 } 303 </style> 287 <a name="Search images on Amazon" 288 href="#TB_inline?width=500px&height=500px&inlineId=insert-amazon-images-thickbox" 289 id="insert-amazon-images-button" class="button thickbox">Add Amazon Images</a> 304 290 <?php 305 291 } … … 322 308 public function addAdminMenu() { 323 309 //if ( function_exists( 'add_options_page' ) ) { 324 \add_options_page( self::PLUGIN_NAME, self::PLUGIN_NAME, 'manage_options', $this->option_group, [325 $this,326 'adminMenu'327 ] );310 \add_options_page( self::PLUGIN_NAME, self::PLUGIN_NAME, 'manage_options', $this->option_group, [ 311 $this, 312 'adminMenu' 313 ] ); 328 314 //} 329 315 } … … 347 333 throw new \Exception( 'Missing Access Key parameter.' ); 348 334 } 349 $this->setApiAccessKey($access_key);335 $this->setApiAccessKey($access_key); 350 336 $this->setApiSecretKey($secret_key); 351 337 $response = $this->search( 'test', 'All', $locale,$tag ); … … 432 418 $content = preg_replace_callback( '#<a.*data-amazonimages[^>]*>#', 433 419 function ( $matches ) use ( $tag, $amazon_locale ) { 434 $line = preg_replace( '#www\.amazon\.([^/]+?)#siUu', 'www.amazon.' . $amazon_locale, $matches[0] );420 $line = preg_replace( '#www\.amazon\.([^/]+?)#siUu', 'www.amazon.' . $amazon_locale, $matches[0] ); 435 421 return preg_replace( '#href="(.+)tag=[^"]+"#siUu', 'href="$1tag=' . $tag . '"', $line ); 436 422 }, … … 499 485 case "es": 500 486 case "ca": 501 case "in":487 case "in": 502 488 break; 503 489 case "uk": … … 510 496 $Locale = "com"; 511 497 break; 512 case "au":498 case "au": 513 499 case "com.au": 514 $Locale="com.au";515 break;500 $Locale="com.au"; 501 break; 516 502 default: 517 503 $Locale = ''; … … 544 530 case "com": 545 531 return \get_option( AmazonImages::class . 'TagUs' ); 546 case "au":547 case "com.au":548 return \get_option( AmazonImages::class . 'TagAu' );532 case "au": 533 case "com.au": 534 return \get_option( AmazonImages::class . 'TagAu' ); 549 535 default: 550 536 return ''; -
insert-amazon-images/trunk/js/manager.js
r2121070 r2188695 21 21 } 22 22 23 setTimeout(function() { 24 if($('.edit-post-header-toolbar').length == 1) { 25 $('.edit-post-header-toolbar').append($('#insert-amazon-images-button')); 26 } 27 }, 1000); 23 28 24 29 search_results -
insert-amazon-images/trunk/readme.txt
r2188664 r2188695 3 3 Donate link: https://amzimage.com/ 4 4 Tags : amazon, images, affiliate, associates, editor, insert 5 Version: 0.4 25 Version: 0.43 6 6 Requires at least : 4.9 7 7 Tested up to : 5.2.3 … … 59 59 == Changelog == 60 60 61 = 0.43 = 62 * Performance improvement, issue fixing 63 61 64 = 0.42 = 62 65 * Fixed issue with Gutenberg overlay
Note: See TracChangeset
for help on using the changeset viewer.