Plugin Directory

Changeset 2188695


Ignore:
Timestamp:
11/08/2019 11:03:28 PM (6 years ago)
Author:
amzimage
Message:

fixed issue with guttenberg

Location:
insert-amazon-images/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • insert-amazon-images/trunk/AmazonImages.php

    r2171562 r2188695  
    6969            if ( ! empty( $licence_key ) ) {
    7070
    71                  $domain = sanitize_text_field($_SERVER['SERVER_NAME']);
     71                $domain = sanitize_text_field($_SERVER['SERVER_NAME']);
    7272                // check last checked time
    7373                $lastchecked      = \get_option( AmazonImages::class . 'LicenceLastChecked' );
    7474                $is_licence_valid = false;
    75                   if ( empty( $lastchecked ) || ( (int) $lastchecked ) < ( time() - 60 * 60 * 24 ) ) {
     75                if ( empty( $lastchecked ) || ( (int) $lastchecked ) < ( time() - 60 * 60 * 24 ) ) {
    7676                    // check licence
    7777                    // check validation code
     
    258258            $newtab = [ 'amzimage' => 'Insert From AMZ Image'];
    259259            return array_merge( $tabs, $newtab );
    260         }
     260        }
    261261
    262262        public function amazon_media_upload_amzimage_content(){
     
    272272        public function add_amazon_media_button() {
    273273            ?>
    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>
    288282            <?php
    289283        }
    290284
    291             public function add_amazon_media_button_gutenberg() {
     285        public function add_amazon_media_button_gutenberg() {
    292286            ?>
    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>
    304290            <?php
    305291        }
     
    322308        public function addAdminMenu() {
    323309            //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            ] );
    328314            //}
    329315        }
     
    347333                    throw new \Exception( 'Missing Access Key parameter.' );
    348334                }
    349                 $this->setApiAccessKey($access_key);
     335                $this->setApiAccessKey($access_key);
    350336                $this->setApiSecretKey($secret_key);
    351337                $response = $this->search( 'test', 'All', $locale,$tag );
     
    432418                                $content = preg_replace_callback( '#<a.*data-amazonimages[^>]*>#',
    433419                                    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] );
    435421                                        return preg_replace( '#href="(.+)tag=[^"]+"#siUu', 'href="$1tag=' . $tag . '"', $line );
    436422                                    },
     
    499485                case "es":
    500486                case "ca":
    501                 case "in":
     487                case "in":
    502488                    break;
    503489                case "uk":
     
    510496                    $Locale = "com";
    511497                    break;
    512                 case "au":
     498                case "au":
    513499                case "com.au":
    514                     $Locale="com.au";
    515                     break;
     500                    $Locale="com.au";
     501                    break;
    516502                default:
    517503                    $Locale = '';
     
    544530                case "com":
    545531                    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' );
    549535                default:
    550536                    return '';
  • insert-amazon-images/trunk/js/manager.js

    r2121070 r2188695  
    2121    }
    2222
     23    setTimeout(function() {
     24        if($('.edit-post-header-toolbar').length == 1) {
     25            $('.edit-post-header-toolbar').append($('#insert-amazon-images-button'));
     26        }
     27    }, 1000);
    2328
    2429    search_results
  • insert-amazon-images/trunk/readme.txt

    r2188664 r2188695  
    33Donate link: https://amzimage.com/
    44Tags :  amazon, images, affiliate, associates, editor, insert
    5 Version: 0.42
     5Version: 0.43
    66Requires at least :  4.9
    77Tested up to :  5.2.3
     
    5959== Changelog ==
    6060
     61= 0.43 =
     62* Performance improvement, issue fixing
     63
    6164= 0.42 =
    6265* Fixed issue with Gutenberg overlay
Note: See TracChangeset for help on using the changeset viewer.