| @@ -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,20 @@ | ||
| 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 | + @set_time_limit( 0 ); // Unlimited execution time for this request. | |
| 43 | + | |
| 30 | 44 | switch ( $origin ) { |
| 31 | 45 | case 'cloud': |
| 32 | 46 | $template_data = $this->get_cloud_content( $id, $platform ); |
| 33 | 47 | break; |
| @@ -148,9 +162,20 @@ | ||
| 148 | 162 | |
| 149 | 163 | if( $id == 0 ) { |
| 150 | 164 | return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'import/page', 404 ); |
| 151 | 165 | } |
| 166 | + if($platform === 'elementor') { | |
| 167 | + if(Helper::enable_elementor_container()) { | |
| 168 | + return $this->error( | |
| 169 | + 'retry_again', | |
| 170 | + __( 'Please try again we enabled container.', 'templately' ), | |
| 171 | + 'insert', 404 | |
| 172 | + ); | |
| 173 | + } | |
| 174 | + } | |
| 152 | 175 | |
| 176 | + @set_time_limit( 0 ); // Unlimited execution time for this request. | |
| 177 | + | |
| 153 | 178 | return $this->platform( $platform )->import_in_library( $id, $this ); |
| 154 | 179 | } |
| 155 | 180 | |
| 156 | 181 | public function import_as_page(){ |
| @@ -160,8 +185,19 @@ | ||
| 160 | 185 | |
| 161 | 186 | if( $id == 0 ) { |
| 162 | 187 | return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'import/page', 404 ); |
| 163 | 188 | } |
| 189 | + if($platform === 'elementor') { | |
| 190 | + if(Helper::enable_elementor_container()) { | |
| 191 | + return $this->error( | |
| 192 | + 'retry_again', | |
| 193 | + __( 'Please try again we enabled container.', 'templately' ), | |
| 194 | + 'insert', 404 | |
| 195 | + ); | |
| 196 | + } | |
| 197 | + } | |
| 198 | + | |
| 199 | + @set_time_limit( 0 ); // Unlimited execution time for this request. | |
| 164 | 200 | |
| 165 | 201 | return $this->platform( $platform )->create_page( $id, $title, $this ); |
| 166 | 202 | } |
| 167 | 203 | } |