Changeset 2966444
- Timestamp:
- 09/13/2023 12:41:58 PM (3 years ago)
- Location:
- stockpack/trunk
- Files:
-
- 5 edited
-
readme.txt (modified) (3 diffs)
-
src/class-stockpackadmin.php (modified) (1 diff)
-
src/class-stockpackquery.php (modified) (10 diffs)
-
src/class-stockpacksettings.php (modified) (1 diff)
-
stockpack.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
stockpack/trunk/readme.txt
r2823118 r2966444 3 3 Tags: stock images, adobe stock, unsplash, getty, istock, pixabay, pexels 4 4 Requires at least: 4.6 5 Tested up to: 6. 1.16 Stable tag: 3.3. 65 Tested up to: 6.3.1 6 Stable tag: 3.3.7 7 7 License: GPL 8 8 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html … … 39 39 * Automatic caption fill in to be in line with licensing requirements 40 40 * Set custom filename prior to the upload 41 * Compatible with Gutenberg, [Elementor](https://elementor.com), [Divi](https://www.elegantthemes.com/gallery/divi/), [Beaver Builder](https://www.wpbeaverbuilder.com), [Visual Composer](https://visualcomposer.com), [Avada Fusion Builder](https://theme-fusion.com/products/fusion-builder) [Oxygen Builder](https://oxygenbuilder.com) [WPBakery](https://wpbakery.com/) [Thrive Themes](https://thrivethemes.com/)41 * Compatible with Gutenberg, [Elementor](https://elementor.com),[Bricks] (https://bricksbuilder.io/), [Divi](https://www.elegantthemes.com/gallery/divi/), [Beaver Builder](https://www.wpbeaverbuilder.com), [Visual Composer](https://visualcomposer.com), [Avada Fusion Builder](https://theme-fusion.com/products/fusion-builder) [Oxygen Builder](https://oxygenbuilder.com) [WPBakery](https://wpbakery.com/) [Thrive Themes](https://thrivethemes.com/) 42 42 * Compatible with [WPML](https://wpml.org) 43 43 * Featured image caption … … 133 133 134 134 == Changelog == 135 136 = 3.3.7 = 137 Add Bricks builder compatibility 138 Updated WordPress compatibility 135 139 136 140 = 3.3.6 = -
stockpack/trunk/src/class-stockpackadmin.php
r2815781 r2966444 371 371 'default' => 'no', 372 372 ), 373 array( 374 'name' => 'add_license_state_to_filename', 375 'label' => __( 'Update file name with provider name and license state for premium providers', 'stockpack' ), 376 'desc' => __( 'By adding details to the image file name you can use unlicensed images as placeholders and if you use Gutenberg you can later license those images directly via StockBlock, the Gutenberg module from StockPack', 'stockpack' ), 377 'options' => array( 378 'yes' => __( 'Yes', 'stockpack' ), 379 'no' => __( 'No', 'stockpack' ) 380 ), 381 'type' => 'radio', 382 'default' => 'no', 383 ), 373 384 ), 374 385 'stockpack_debug' => array( -
stockpack/trunk/src/class-stockpackquery.php
r2762836 r2966444 126 126 127 127 public function token() { 128 global $stockpack;128 $stockpack = StockPack::get_instance(); 129 129 check_ajax_referer( 'stockpack_token', 'security' ); 130 130 $token = ''; … … 243 243 $search = isset( $_REQUEST['search_key'] ) ? sanitize_title( $_REQUEST['search_key'] ) : $this->get_domain(); 244 244 $description = isset( $_REQUEST['description'] ) ? sanitize_textarea_field( $_REQUEST['description'] ) : ''; 245 246 247 245 248 $image = $this->image( $id, $post_id, $description, $search, $must_license, $provider, $new_filename ); 246 249 … … 285 288 286 289 287 p rivatefunction get_license_cost( $media_id, $provider ) {290 public function get_license_cost( $media_id, $provider ) { 288 291 289 292 return $this->call( 'GET', 'images/license-cost', array( … … 295 298 } 296 299 297 private function image( $media_id, $post_id, $description = '', $search = '', $must_license = 0, $provider = 0, $new_filename = '' ) { 300 public function image( $media_id, $post_id, $description = '', $search = '', $must_license = 0, $provider = 0, $new_filename = '' ) { 301 302 do_action( 'stockpack_before_attachment_download', $provider,$new_filename, $media_id, $must_license ); 298 303 299 304 $image = $this->call( 'GET', 'images/download', … … 313 318 } 314 319 315 $filename = $image->data->name; 316 317 if ( $new_filename ) { 318 $filename = $new_filename; 319 } 320 $filename = $this->getFilename($image, $new_filename, $must_license); 320 321 321 322 $caption = $image->data->caption ?: ''; 322 $attachment_id = $this->upload_remote_image_and_attach( $image->data->download, $post_id, $description, $filename,$image, $search, $caption ,);323 $attachment_id = $this->upload_remote_image_and_attach( $image->data->download, $post_id, $description, $filename,$image, $search, $caption ); 323 324 if ( is_wp_error( $attachment_id ) ) { 324 325 return $attachment_id; … … 377 378 private function call( $method, $path, $query = [] ) { 378 379 /** @var StockPack $stockpack */ 379 global $stockpack;380 $stockpack = StockPack::get_instance(); 380 381 381 382 … … 406 407 407 408 $response = wp_remote_get( $url, array( 408 'timeout' => 10 409 'timeout' => 10, 410 'sslverify' => false, 409 411 ) ); 410 412 … … 434 436 private function limit_exceeded( $response ) { 435 437 /** @var StockPack $stockpack */ 436 global $stockpack;438 $stockpack = StockPack::get_instance(); 437 439 438 440 … … 555 557 $name = explode( '.', $name ); 556 558 return $name[0]; 559 } 560 561 private function getFilename($image, $new_filename, $must_license) 562 { 563 $stockpack = StockPack::get_instance(); 564 565 $filename = $image->data->name; 566 567 if($new_filename) { 568 $filename = $new_filename; 569 } 570 571 if(!$this->is_provider_premium($image->data->provider) || $must_license) { 572 return $filename; 573 } 574 575 if($stockpack->settings->add_license_state_to_filename()==='yes') { 576 $filename = '--sto--placeholder--' . $image->data->provider.'--'.$image->data->id.'--'.$filename; 577 } 578 579 return $filename; 557 580 } 558 581 … … 748 771 } 749 772 773 774 750 775 } 751 776 -
stockpack/trunk/src/class-stockpacksettings.php
r2815781 r2966444 39 39 public function get_license_state() { 40 40 return $this->get_option( 'license_state', 'stockpack_advanced' ); 41 } 42 43 public function add_license_state_to_filename() { 44 return $this->get_option( 'add_license_state_to_filename', 'stockpack_advanced' ); 41 45 } 42 46 -
stockpack/trunk/stockpack.php
r2823118 r2966444 6 6 * Author: Derikon Development 7 7 * Author URI: https://derikon.com/ 8 * Version: 3.3. 68 * Version: 3.3.7 9 9 * Text Domain: stockpack 10 10 * Domain Path: /languages … … 148 148 function stockpack_frontend_load() { 149 149 $load = false; 150 if ( isset( $_GET['et_fb'] ) || isset ( $_GET[' ct_builder'] ) || isset( $_GET['fl_builder'] ) || isset( $_GET['fb-edit'] ) || isset( $_GET['brizy-edit-iframe'] ) ) {150 if ( isset( $_GET['et_fb'] ) || isset ( $_GET['bricks'] ) || isset ( $_GET['ct_builder'] ) || isset( $_GET['fl_builder'] ) || isset( $_GET['fb-edit'] ) || isset( $_GET['brizy-edit-iframe'] ) ) { 151 151 $load = true; 152 152 }
Note: See TracChangeset
for help on using the changeset viewer.