Plugin Directory

Changeset 2262094


Ignore:
Timestamp:
03/16/2020 11:43:05 PM (6 years ago)
Author:
envato
Message:

Uploading version 1.0.6

Location:
template-kit-export/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • template-kit-export/trunk/README.txt

    r2251744 r2262094  
    55Tested up to: 5.3.2
    66Requires PHP: 5.6
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.6
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3939== Changelog ==
    4040
     41= 1.0.6 - 2020-03-17 =
     42* Fix image thumbnail dimensions
     43
    4144= 1.0.5 - 2020-02-28 =
    4245* Fix incorrectly blocking certain image urls from export
  • template-kit-export/trunk/builders/class-template-kit-export-builders-base.php

    r2246624 r2262094  
    337337            throw new Exception( 'No attachment for template ' . $template_id );
    338338        }
    339         // Get the attached file path.
    340         $attachment_filename = get_attached_file( $attachment_id );
    341         // Get the file name of the feature image data.
    342         $attached_info = image_get_intermediate_size( $attachment_id, $size = 'tk_preview' );
    343         if ( ! $attached_info ) {
     339        // Get the file name of the feature image data. We try to get the "tk_preview" sized thumbnail first:
     340        $attached_info = image_get_intermediate_size( $attachment_id, 'tk_preview' );
     341        if ( $attached_info && ! empty( $attached_info['path'] ) ) {
     342            // We have successfully found a "tk_preview" sized image for this attachment.
     343            // Build out the full file path for this attachment so we can read its exif data and zip it up.
     344            $upload_directory = wp_upload_dir();
     345            // Do a little string append to get the file path of the feature image.
     346            $attachment_filename = trailingslashit( $upload_directory['basedir'] ) . $attached_info['path'];
     347        } else {
    344348            // We couldn't find tk_preview size, author likely uploaded exactly 600px wide thumb (as per guidelines)
    345             // Grab the full image source:
    346             $attached_info = image_get_intermediate_size( $attachment_id );
    347             if ( ! $attached_info ) {
    348                 throw new Exception( 'Could not find file for attachment ' . $attachment_id );
    349             }
    350         }
    351         // Get the up load dir array.
    352         $upload_directory = wp_upload_dir();
    353         // Do a little string append to get the file path of the feature image.
    354         $attachment_filename = trailingslashit( $upload_directory['basedir'] ) . $attached_info['path'];
    355         $screenshot_url      = get_the_post_thumbnail_url( $template_id );
    356         $screenshot_type     = exif_imagetype( $attachment_filename );
     349            // Get the attached file path. This is the full image file path.
     350            $attachment_filename = get_attached_file( $attachment_id );
     351        }
     352        if ( ! $attachment_filename ) {
     353            throw new Exception( 'Could not find file for attachment ' . $attachment_id );
     354        }
     355
     356        $screenshot_url  = get_the_post_thumbnail_url( $template_id );
     357        $screenshot_type = exif_imagetype( $attachment_filename );
    357358        if ( IMAGETYPE_PNG === $screenshot_type ) {
    358359            $screenshot_extension = 'png';
     
    380381     */
    381382    public function save_template_options( $template_id, $template_options ) {
    382 
    383383        // Loop over all possible meta fields and pull those values into the post meta array
    384384        $template_fields = $this->get_template_meta_fields();
     
    405405                $template_options['thumb_id']
    406406            );
     407
     408            // This forces the creation of the tk_preview if it failed to be created by WP
     409            // due to the exact size the user uploaded. It then updated template meta.
     410            $get_thumb_id     = get_post_thumbnail_id( $template_id );
     411            $check_tk_preview = image_get_intermediate_size( $get_thumb_id, 'tk_preview' );
     412            if ( ! $check_tk_preview ) {
     413                $generated_tk_preview                            = image_make_intermediate_size( get_attached_file( $get_thumb_id ), 600, 600, true );
     414                $template_attachment_meta                        = wp_get_attachment_metadata( $get_thumb_id );
     415                $template_attachment_meta['sizes']['tk_preview'] = $generated_tk_preview;
     416                wp_update_attachment_metadata( $get_thumb_id, $template_attachment_meta );
     417            }
    407418        }
    408419
     
    638649                // We also include any additional image metadata (such as license etc..) that is captured from the user:
    639650                foreach ( $image_fields as $image_field ) {
    640                     $image_metadata[ $image_field['name'] ] = $image['user_data'][ $image_field['name'] ];
     651                    if ( isset( $image['user_data'][ $image_field['name'] ] ) ) {
     652                        $image_metadata[ $image_field['name'] ] = $image['user_data'][ $image_field['name'] ];
     653                    }
    641654                }
    642655                // Finally we append our image metadata onto the big array of metadata that will make its way down to the manifest.json file:
  • template-kit-export/trunk/builders/class-template-kit-export-builders-elementor.php

    r2251744 r2262094  
    204204                                'user_data'         => is_array( $image_meta ) ? $image_meta : array(),
    205205                                'filesize'          => filesize( get_attached_file( $image_id ) ),
    206                                 'dimensions'        => array( $image_size['width'], $image_size['height'] ),
     206                                // Sometimes wp_get_attachment_metadata() returns an empty string '' instead of an array.
     207                                // We assume this is to do with an incorrectly coded 3rd party plugin.
     208                                // WordPress core checks for "isset( $meta['width'], $meta['height'] )" after wp_get_attachment_metadata()
     209                                // in a number of places, so we'll do the same thing here.
     210                                // The author will get a 0px x 0px dimension listed in their backend, but that's better than an uncaught error message.
     211                                'dimensions'        => isset( $image_size['width'], $image_size['height'] ) ? array( $image_size['width'], $image_size['height'] ) : array(0, 0),
    207212                            );
    208213                        }
     
    388393                    // Hunt for inline styles:
    389394                    if ( preg_match_all( '#style=[\'"]([^\'"]+)[\'"]#imsU', $val, $matches ) ) {
     395                        $allowed_built_in_styles = array(
     396                            '#text-align:[^;]+;#' => '',
     397                        );
    390398                        foreach ( $matches[1] as $match ) {
    391                             $template_errors[] = 'Please remove any inline style="' . esc_html( $match ) . '" from ' . $template['name'];
     399                            if ( preg_replace( array_keys( $allowed_built_in_styles ), array_values( $allowed_built_in_styles ), $match ) !== '' ) {
     400                                $template_errors[] = 'Please remove any inline style="' . esc_html( $match ) . '" from ' . $template['name'];
     401                            }
    392402                        }
    393403                    }
  • template-kit-export/trunk/languages/template-kit-export.pot

    r2251744 r2262094  
    5454msgstr ""
    5555
    56 #: builders/class-template-kit-export-builders-base.php:476
     56#: builders/class-template-kit-export-builders-base.php:487
    5757msgid "Image Source:"
    5858msgstr ""
    5959
    60 #: builders/class-template-kit-export-builders-base.php:480
     60#: builders/class-template-kit-export-builders-base.php:491
    6161msgid "Licensed From Envato Elements"
    6262msgstr ""
    6363
    64 #: builders/class-template-kit-export-builders-base.php:481
     64#: builders/class-template-kit-export-builders-base.php:492
    6565msgid "Created Myself"
    6666msgstr ""
    6767
    68 #: builders/class-template-kit-export-builders-base.php:482
     68#: builders/class-template-kit-export-builders-base.php:493
    6969msgid "CC0 or equivalent"
    7070msgstr ""
    7171
    72 #: builders/class-template-kit-export-builders-base.php:483
     72#: builders/class-template-kit-export-builders-base.php:494
    7373msgid "Unsure (NOT allowed)"
    7474msgstr ""
    7575
    76 #: builders/class-template-kit-export-builders-base.php:488
     76#: builders/class-template-kit-export-builders-base.php:499
    7777msgid "Contains Person or Place?"
    7878msgstr ""
    7979
    80 #: builders/class-template-kit-export-builders-base.php:492
     80#: builders/class-template-kit-export-builders-base.php:503
    8181msgid "Yes, image contains person or place"
    8282msgstr ""
    8383
    84 #: builders/class-template-kit-export-builders-base.php:493
     84#: builders/class-template-kit-export-builders-base.php:504
    8585msgid "No"
    8686msgstr ""
    8787
    88 #: builders/class-template-kit-export-builders-base.php:498
     88#: builders/class-template-kit-export-builders-base.php:509
    8989msgid "Source URLs"
    9090msgstr ""
    9191
    92 #: builders/class-template-kit-export-builders-base.php:515, builders/class-template-kit-export-builders-elementor.php:316
     92#: builders/class-template-kit-export-builders-base.php:526, builders/class-template-kit-export-builders-elementor.php:321
    9393msgid "Include Template in Export ZIP"
    9494msgstr ""
    9595
    96 #: builders/class-template-kit-export-builders-elementor.php:266
     96#: builders/class-template-kit-export-builders-elementor.php:271
    9797msgid "Template Type:"
    9898msgstr ""
    9999
    100 #: builders/class-template-kit-export-builders-elementor.php:269
     100#: builders/class-template-kit-export-builders-elementor.php:274
    101101msgid " - Select Template Type - "
    102102msgstr ""
    103103
    104 #: builders/class-template-kit-export-builders-elementor.php:271
     104#: builders/class-template-kit-export-builders-elementor.php:276
    105105msgid "Full Page"
    106106msgstr ""
    107107
    108 #: builders/class-template-kit-export-builders-elementor.php:273
     108#: builders/class-template-kit-export-builders-elementor.php:278
    109109msgid "Single: Page"
    110110msgstr ""
    111111
    112 #: builders/class-template-kit-export-builders-elementor.php:274
     112#: builders/class-template-kit-export-builders-elementor.php:279
    113113msgid "Single: Home"
    114114msgstr ""
    115115
    116 #: builders/class-template-kit-export-builders-elementor.php:275
     116#: builders/class-template-kit-export-builders-elementor.php:280
    117117msgid "Single: Post"
    118118msgstr ""
    119119
    120 #: builders/class-template-kit-export-builders-elementor.php:276
     120#: builders/class-template-kit-export-builders-elementor.php:281
    121121msgid "Single: Product"
    122122msgstr ""
    123123
    124 #: builders/class-template-kit-export-builders-elementor.php:277
     124#: builders/class-template-kit-export-builders-elementor.php:282
    125125msgid "Single: 404"
    126126msgstr ""
    127127
    128 #: builders/class-template-kit-export-builders-elementor.php:278
     128#: builders/class-template-kit-export-builders-elementor.php:283
    129129msgid "Archive: Blog"
    130130msgstr ""
    131131
    132 #: builders/class-template-kit-export-builders-elementor.php:279
     132#: builders/class-template-kit-export-builders-elementor.php:284
    133133msgid "Archive: Product"
    134134msgstr ""
    135135
    136 #: builders/class-template-kit-export-builders-elementor.php:280
     136#: builders/class-template-kit-export-builders-elementor.php:285
    137137msgid "Archive: Search"
    138138msgstr ""
    139139
    140 #: builders/class-template-kit-export-builders-elementor.php:281
     140#: builders/class-template-kit-export-builders-elementor.php:286
    141141msgid "Archive: Category"
    142142msgstr ""
    143143
    144 #: builders/class-template-kit-export-builders-elementor.php:285
     144#: builders/class-template-kit-export-builders-elementor.php:290
    145145msgid "Section / Block"
    146146msgstr ""
    147147
    148 #: builders/class-template-kit-export-builders-elementor.php:287
     148#: builders/class-template-kit-export-builders-elementor.php:292
    149149msgid "Header"
    150150msgstr ""
    151151
    152 #: builders/class-template-kit-export-builders-elementor.php:288
     152#: builders/class-template-kit-export-builders-elementor.php:293
    153153msgid "Footer"
    154154msgstr ""
    155155
    156 #: builders/class-template-kit-export-builders-elementor.php:289
     156#: builders/class-template-kit-export-builders-elementor.php:294
    157157msgid "Popup"
    158158msgstr ""
    159159
    160 #: builders/class-template-kit-export-builders-elementor.php:290
     160#: builders/class-template-kit-export-builders-elementor.php:295
    161161msgid "Hero"
    162162msgstr ""
    163163
    164 #: builders/class-template-kit-export-builders-elementor.php:291
     164#: builders/class-template-kit-export-builders-elementor.php:296
    165165msgid "About"
    166166msgstr ""
    167167
    168 #: builders/class-template-kit-export-builders-elementor.php:292
     168#: builders/class-template-kit-export-builders-elementor.php:297
    169169msgid "FAQ"
    170170msgstr ""
    171171
    172 #: builders/class-template-kit-export-builders-elementor.php:293
     172#: builders/class-template-kit-export-builders-elementor.php:298
    173173msgid "Contact"
    174174msgstr ""
    175175
    176 #: builders/class-template-kit-export-builders-elementor.php:294
     176#: builders/class-template-kit-export-builders-elementor.php:299
    177177msgid "Call to Action"
    178178msgstr ""
    179179
    180 #: builders/class-template-kit-export-builders-elementor.php:295
     180#: builders/class-template-kit-export-builders-elementor.php:300
    181181msgid "Team"
    182182msgstr ""
    183183
    184 #: builders/class-template-kit-export-builders-elementor.php:296
     184#: builders/class-template-kit-export-builders-elementor.php:301
    185185msgid "Map"
    186186msgstr ""
    187187
    188 #: builders/class-template-kit-export-builders-elementor.php:297
     188#: builders/class-template-kit-export-builders-elementor.php:302
    189189msgid "Features"
    190190msgstr ""
    191191
    192 #: builders/class-template-kit-export-builders-elementor.php:298
     192#: builders/class-template-kit-export-builders-elementor.php:303
    193193msgid "Pricing"
    194194msgstr ""
    195195
    196 #: builders/class-template-kit-export-builders-elementor.php:299
     196#: builders/class-template-kit-export-builders-elementor.php:304
    197197msgid "Testimonial"
    198198msgstr ""
    199199
    200 #: builders/class-template-kit-export-builders-elementor.php:300
     200#: builders/class-template-kit-export-builders-elementor.php:305
    201201msgid "Product"
    202202msgstr ""
    203203
    204 #: builders/class-template-kit-export-builders-elementor.php:301
     204#: builders/class-template-kit-export-builders-elementor.php:306
    205205msgid "Services"
    206206msgstr ""
    207207
    208 #: builders/class-template-kit-export-builders-elementor.php:302
     208#: builders/class-template-kit-export-builders-elementor.php:307
    209209msgid "Stats"
    210210msgstr ""
    211211
    212 #: builders/class-template-kit-export-builders-elementor.php:303
     212#: builders/class-template-kit-export-builders-elementor.php:308
    213213msgid "Countdown"
    214214msgstr ""
    215215
    216 #: builders/class-template-kit-export-builders-elementor.php:304
     216#: builders/class-template-kit-export-builders-elementor.php:309
    217217msgid "Portfolio"
    218218msgstr ""
    219219
    220 #: builders/class-template-kit-export-builders-elementor.php:305
     220#: builders/class-template-kit-export-builders-elementor.php:310
    221221msgid "Gallery"
    222222msgstr ""
    223223
    224 #: builders/class-template-kit-export-builders-elementor.php:306
     224#: builders/class-template-kit-export-builders-elementor.php:311
    225225msgid "Logo Grid"
    226226msgstr ""
    227227
    228 #: builders/class-template-kit-export-builders-elementor.php:307
     228#: builders/class-template-kit-export-builders-elementor.php:312
    229229msgid "Clients"
    230230msgstr ""
    231231
    232 #: builders/class-template-kit-export-builders-elementor.php:308
     232#: builders/class-template-kit-export-builders-elementor.php:313
    233233msgid "Other"
    234234msgstr ""
    235235
    236 #: builders/class-template-kit-export-builders-elementor.php:311
     236#: builders/class-template-kit-export-builders-elementor.php:316
    237237msgid "Global Kit Styles"
    238238msgstr ""
    239239
    240 #: builders/class-template-kit-export-builders-elementor.php:321
     240#: builders/class-template-kit-export-builders-elementor.php:326
    241241msgid "Elementor Pro Required"
    242242msgstr ""
    243243
    244 #: builders/class-template-kit-export-builders-elementor.php:465
     244#: builders/class-template-kit-export-builders-elementor.php:475
    245245msgid "Please install the \"Elementor\" Plugin to continue."
    246246msgstr ""
    247247
    248 #: builders/class-template-kit-export-builders-elementor.php:469
     248#: builders/class-template-kit-export-builders-elementor.php:479
    249249msgid "Please ensure the \"Hello Elementor\" theme is installed and active on this site."
    250250msgstr ""
  • template-kit-export/trunk/template-kit-export.php

    r2251744 r2262094  
    33 * Plugin Name:       Template Kit Export
    44 * Description:       Use this plugin to export Template Kits for Elementor.
    5  * Version:           1.0.5
     5 * Version:           1.0.6
    66 * Author:            Envato
    77 * Author URI:        https://envato.com
     
    1919 * Currently plugin version.
    2020 */
    21 define( 'TEMPLATE_KIT_EXPORT_VERSION', '1.0.5' );
     21define( 'TEMPLATE_KIT_EXPORT_VERSION', '1.0.6' );
    2222
    2323/**
Note: See TracChangeset for help on using the changeset viewer.