Plugin Directory

Changeset 2566796


Ignore:
Timestamp:
07/19/2021 12:01:11 AM (5 years ago)
Author:
dtbaker
Message:

Uploading version 2.0.9

Location:
envato-elements/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • envato-elements/trunk/envato-elements.php

    r2467677 r2566796  
    55 * Author: Envato
    66 * Author URI: https://elements.envato.com/extensions/wordpress/?utm_source=extensions&utm_medium=referral&utm_campaign=elements_extensions_wpplugins
    7  * Version: 2.0.8
     7 * Version: 2.0.9
    88 * License: GPLv3 or later
    99 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
    10  * Elementor tested up to: 3.2.0
    11  * Elementor Pro tested up to: 3.1.0
     10 * Elementor tested up to: 3.3.0
     11 * Elementor Pro tested up to: 3.3.0
    1212 *
    1313 * Text Domain: envato-elements
     
    3131
    3232define( 'ENVATO_ELEMENTS_SLUG', 'envato-elements' );
    33 define( 'ENVATO_ELEMENTS_VER', '2.0.8' );
     33define( 'ENVATO_ELEMENTS_VER', '2.0.9' );
    3434define( 'ENVATO_ELEMENTS_FILE', __FILE__ );
    3535define( 'ENVATO_ELEMENTS_DIR', plugin_dir_path( ENVATO_ELEMENTS_FILE ) );
  • envato-elements/trunk/inc/api/class-template-kit-import.php

    r2467677 r2566796  
    256256                }
    257257
     258                $block_data = json_decode( file_get_contents( $temporary_json_file_path ), true );
     259
    258260                $source     = \Elementor\Plugin::$instance->templates_manager->get_source( 'local' );
     261                // FYI, newer versions of Elementor delete a JSON file after successful import
    259262                $result     = $source->import_template( basename( $temporary_json_file_path ), $temporary_json_file_path );
    260                 $block_data = json_decode( file_get_contents( $temporary_json_file_path ), true );
    261                 unlink( $temporary_json_file_path );
     263
     264                if ( file_exists( $temporary_json_file_path ) ) {
     265                    unlink( $temporary_json_file_path );
     266                }
    262267
    263268                if ( is_wp_error( $result ) ) {
  • envato-elements/trunk/readme.txt

    r2557452 r2566796  
    33Tags: elementor, elements, templates, template kit
    44Requires at least: 4.6
    5 Tested up to: 5.6
     5Tested up to: 5.8
    66Requires PHP: 5.6
    7 Stable tag: 2.0.8
     7Stable tag: 2.0.9
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    7979
    8080== Changelog ==
     81
     82= 2.0.9 - 2021-07-19 =
     83* Fix: Compatibility with Elementor 3.3.0
    8184
    8285= 2.0.8 - 2021-02-02 =
  • envato-elements/trunk/vendor/template-kit-import/inc/class-builder-elementor.php

    r2371846 r2566796  
    6363     * @param $template_index
    6464     *
    65      * @return bool|array
     65     * @return \WP_Error|array
    6666     */
    6767    public function get_template_data( $template_index ) {
     
    7070            $template_kit_folder_name       = $this->get_template_kit_temporary_folder();
    7171            $template_json_file             = $template_kit_folder_name . $template_data['source'];
    72             $template_data['template_json'] = json_decode( file_get_contents( $template_json_file ), true );
    73             return $template_data;
    74         }
    75 
    76         return false;
     72            if(file_exists($template_json_file)) {
     73                $template_data['template_json'] = json_decode( file_get_contents( $template_json_file ), true );
     74
     75                return $template_data;
     76            }
     77        }
     78
     79        return new \WP_Error( 'template_error', 'Template Data Error. Please delete the Template Kit and import it again.' );
    7780    }
    7881
     
    103106        // As Elementor only accepts the path to a JSON file for importing we temporarily modify the JSON data and
    104107        // send in that template file name to Elementor for processing. We delete the temporary JSON file after processing below.
    105         $temp_wp_json_file = false;
    106108        if ( ! empty( $local_json_data['metadata']['elementor_pro_required'] ) && ! class_exists( '\ElementorPro\Plugin' ) ) {
    107109            $local_json_data['type'] = 'page';
    108             require_once ABSPATH . '/wp-admin/includes/file.php';
    109             $temp_wp_json_file = wp_tempnam();
    110             file_put_contents( $temp_wp_json_file, json_encode( $local_json_data ) );
    111             $template_json_file = $temp_wp_json_file;
    112         }
    113         $result = $source->import_template( basename( $template_json_file ), $template_json_file );
    114 
    115         // Cleanup above free template type file if it was created.
    116         if ( $temp_wp_json_file ) {
     110        }
     111
     112        // Elementor deletes JSON files after importing them, so we have to duplicate the JSON file before sending it over.
     113        require_once ABSPATH . '/wp-admin/includes/file.php';
     114        $temp_wp_json_file = wp_tempnam('elements-tk-import-');
     115        file_put_contents( $temp_wp_json_file, json_encode( $local_json_data ) );
     116
     117        // Pass our temporary JSON file to Elementor for import:
     118        // FYI, newer versions of Elementor delete a JSON file after successful import
     119        $result = $source->import_template( basename( $temp_wp_json_file ), $temp_wp_json_file );
     120
     121        // Cleanup above temporary file
     122        if ( file_exists( $temp_wp_json_file ) ) {
    117123            unlink( $temp_wp_json_file );
    118124        }
     125
    119126        if ( is_wp_error( $result ) ) {
    120127            return new \WP_Error( 'import_error', 'Failed to import template: ' . esc_html( $result->get_error_message() ) );
Note: See TracChangeset for help on using the changeset viewer.