| @@ -1,10 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Templately\API; |
| 4 | 4 | |
| 5 | +use Elementor\Plugin; | |
| 6 | +use Elementor\Core\Experiments\Manager as Experiments_Manager; | |
| 5 | 7 | use Templately\Core\Platform\Elementor; |
| 6 | 8 | use Templately\Core\Platform\Gutenberg; |
| 9 | +use Templately\Utils\Helper; | |
| 7 | 10 | |
| 8 | 11 | /** |
| 9 | 12 | * @method Elementor|Gutenberg platform( $id ); |
| 10 | 13 | */ |
| @@ -25,9 +28,19 @@ | ||
| 25 | 28 | |
| 26 | 29 | if( $id <= 0 || $id == null ) { |
| 27 | 30 | return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'get_content', 404 ); |
| 28 | 31 | } |
| 32 | + if($platform === 'elementor') { | |
| 33 | + if(Helper::enable_elementor_container()) { | |
| 34 | + return $this->error( | |
| 35 | + 'retry_again', | |
| 36 | + __( 'Please try again we enabled container.', 'templately' ), | |
| 37 | + 'insert', 404 | |
| 38 | + ); | |
| 39 | + } | |
| 40 | + } | |
| 29 | 41 | |
| 42 | + | |
| 30 | 43 | switch ( $origin ) { |
| 31 | 44 | case 'cloud': |
| 32 | 45 | $template_data = $this->get_cloud_content( $id, $platform ); |
| 33 | 46 | break; |
| @@ -148,8 +161,17 @@ | ||
| 148 | 161 | |
| 149 | 162 | if( $id == 0 ) { |
| 150 | 163 | return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'import/page', 404 ); |
| 151 | 164 | } |
| 165 | + if($platform === 'elementor') { | |
| 166 | + if(Helper::enable_elementor_container()) { | |
| 167 | + return $this->error( | |
| 168 | + 'retry_again', | |
| 169 | + __( 'Please try again we enabled container.', 'templately' ), | |
| 170 | + 'insert', 404 | |
| 171 | + ); | |
| 172 | + } | |
| 173 | + } | |
| 152 | 174 | |
| 153 | 175 | return $this->platform( $platform )->import_in_library( $id, $this ); |
| 154 | 176 | } |
| 155 | 177 | |
| @@ -159,9 +181,18 @@ | ||
| 159 | 181 | $title = $this->get_param( 'title' ); |
| 160 | 182 | |
| 161 | 183 | if( $id == 0 ) { |
| 162 | 184 | return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'import/page', 404 ); |
| 185 | + } | |
| 186 | + if($platform === 'elementor') { | |
| 187 | + if(Helper::enable_elementor_container()) { | |
| 188 | + return $this->error( | |
| 189 | + 'retry_again', | |
| 190 | + __( 'Please try again we enabled container.', 'templately' ), | |
| 191 | + 'insert', 404 | |
| 192 | + ); | |
| 193 | + } | |
| 163 | 194 | } |
| 164 | 195 | |
| 165 | 196 | return $this->platform( $platform )->create_page( $id, $title, $this ); |
| 166 | 197 | } |
| 167 | 198 | } |