| @@ -37,9 +37,9 @@ | ||
| 37 | 37 | public function hooks() { |
| 38 | 38 | if ( class_exists( '\Elementor\Plugin' ) ) { |
| 39 | 39 | add_action( 'elementor/preview/enqueue_styles', [ $this, 'styles' ] ); |
| 40 | 40 | add_action( 'elementor/editor/before_enqueue_styles', [ $this, 'styles' ] ); |
| 41 | - add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'scripts' ] ); | |
| 41 | + add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'scripts' ] ); | |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| @@ -55,9 +55,9 @@ | ||
| 55 | 55 | * @return void |
| 56 | 56 | */ |
| 57 | 57 | public function scripts() { |
| 58 | 58 | templately()->assets->enqueue( 'templately-elementor', 'css/elementor.css' ); |
| 59 | - templately()->assets->enqueue( 'templately-elementor', 'js/elementor.js', [ 'jquery' ], true ); | |
| 59 | + templately()->assets->enqueue( 'templately-elementor', 'js/elementor.js', [ 'jquery' ] ); | |
| 60 | 60 | templately()->admin->scripts( 'elementor' ); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| @@ -94,12 +94,8 @@ | ||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | public function get_saved_templates( $params = [] ) { |
| 98 | - if ( ! function_exists( 'is_plugin_active' ) ){ | |
| 99 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); | |
| 100 | - } | |
| 101 | - | |
| 102 | 98 | $_page_number = isset( $params['page'] ) ? intval( $params['page'] ) : 1; |
| 103 | 99 | |
| 104 | 100 | $args = [ |
| 105 | 101 | 'post_type' => 'elementor_library', |
| @@ -132,13 +128,11 @@ | ||
| 132 | 128 | wp_reset_postdata(); |
| 133 | 129 | wp_reset_query(); |
| 134 | 130 | |
| 135 | 131 | return array( |
| 136 | - 'current_page' => $templates->query_vars['paged'], | |
| 137 | - 'total_page' => $templates->max_num_pages, | |
| 138 | - 'items' => $templateList, | |
| 139 | - 'has_elementor' => rest_sanitize_boolean( \is_plugin_active( 'elementor/elementor.php' ) ), | |
| 140 | - 'has_elementor_pro' => rest_sanitize_boolean( \is_plugin_active( 'elementor-pro/elementor-pro.php' ) ), | |
| 132 | + 'current_page' => $templates->query_vars['paged'], | |
| 133 | + 'total_page' => $templates->max_num_pages, | |
| 134 | + 'items' => $templateList, | |
| 141 | 135 | ); |
| 142 | 136 | } |
| 143 | 137 | |
| 144 | 138 | private function get_export_link( $template_id ) { |
| @@ -290,12 +284,8 @@ | ||
| 290 | 284 | } |
| 291 | 285 | |
| 292 | 286 | $importer = new ElementorImporter; |
| 293 | 287 | $imported_template = $importer->import_in_library( $template_data ); |
| 294 | - | |
| 295 | - if( is_wp_error( $imported_template ) ) { | |
| 296 | - return $imported_template; | |
| 297 | - } | |
| 298 | 288 | |
| 299 | 289 | return [ |
| 300 | 290 | 'post_id' => $imported_template['template_id'], |
| 301 | 291 | 'edit_link' => get_edit_post_link( $imported_template['template_id'], 'internal' ), |