Changeset 2566796
- Timestamp:
- 07/19/2021 12:01:11 AM (5 years ago)
- Location:
- envato-elements/trunk
- Files:
-
- 4 edited
-
envato-elements.php (modified) (2 diffs)
-
inc/api/class-template-kit-import.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
vendor/template-kit-import/inc/class-builder-elementor.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
envato-elements/trunk/envato-elements.php
r2467677 r2566796 5 5 * Author: Envato 6 6 * Author URI: https://elements.envato.com/extensions/wordpress/?utm_source=extensions&utm_medium=referral&utm_campaign=elements_extensions_wpplugins 7 * Version: 2.0. 87 * Version: 2.0.9 8 8 * License: GPLv3 or later 9 9 * License URI: https://www.gnu.org/licenses/gpl-3.0.html 10 * Elementor tested up to: 3. 2.011 * Elementor Pro tested up to: 3. 1.010 * Elementor tested up to: 3.3.0 11 * Elementor Pro tested up to: 3.3.0 12 12 * 13 13 * Text Domain: envato-elements … … 31 31 32 32 define( 'ENVATO_ELEMENTS_SLUG', 'envato-elements' ); 33 define( 'ENVATO_ELEMENTS_VER', '2.0. 8' );33 define( 'ENVATO_ELEMENTS_VER', '2.0.9' ); 34 34 define( 'ENVATO_ELEMENTS_FILE', __FILE__ ); 35 35 define( 'ENVATO_ELEMENTS_DIR', plugin_dir_path( ENVATO_ELEMENTS_FILE ) ); -
envato-elements/trunk/inc/api/class-template-kit-import.php
r2467677 r2566796 256 256 } 257 257 258 $block_data = json_decode( file_get_contents( $temporary_json_file_path ), true ); 259 258 260 $source = \Elementor\Plugin::$instance->templates_manager->get_source( 'local' ); 261 // FYI, newer versions of Elementor delete a JSON file after successful import 259 262 $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 } 262 267 263 268 if ( is_wp_error( $result ) ) { -
envato-elements/trunk/readme.txt
r2557452 r2566796 3 3 Tags: elementor, elements, templates, template kit 4 4 Requires at least: 4.6 5 Tested up to: 5. 65 Tested up to: 5.8 6 6 Requires PHP: 5.6 7 Stable tag: 2.0. 87 Stable tag: 2.0.9 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 79 79 80 80 == Changelog == 81 82 = 2.0.9 - 2021-07-19 = 83 * Fix: Compatibility with Elementor 3.3.0 81 84 82 85 = 2.0.8 - 2021-02-02 = -
envato-elements/trunk/vendor/template-kit-import/inc/class-builder-elementor.php
r2371846 r2566796 63 63 * @param $template_index 64 64 * 65 * @return bool|array65 * @return \WP_Error|array 66 66 */ 67 67 public function get_template_data( $template_index ) { … … 70 70 $template_kit_folder_name = $this->get_template_kit_temporary_folder(); 71 71 $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.' ); 77 80 } 78 81 … … 103 106 // As Elementor only accepts the path to a JSON file for importing we temporarily modify the JSON data and 104 107 // 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;106 108 if ( ! empty( $local_json_data['metadata']['elementor_pro_required'] ) && ! class_exists( '\ElementorPro\Plugin' ) ) { 107 109 $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 ) ) { 117 123 unlink( $temp_wp_json_file ); 118 124 } 125 119 126 if ( is_wp_error( $result ) ) { 120 127 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.