Plugin Directory

Changeset 2966444


Ignore:
Timestamp:
09/13/2023 12:41:58 PM (3 years ago)
Author:
stockpack
Message:

Add support to bricks builder

Location:
stockpack/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • stockpack/trunk/readme.txt

    r2823118 r2966444  
    33Tags: stock images, adobe stock, unsplash, getty, istock, pixabay, pexels
    44Requires at least: 4.6
    5 Tested up to: 6.1.1
    6 Stable tag: 3.3.6
     5Tested up to: 6.3.1
     6Stable tag: 3.3.7
    77License: GPL
    88License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
     
    3939* Automatic caption fill in to be in line with licensing requirements
    4040* 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/)
    4242* Compatible with [WPML](https://wpml.org)
    4343* Featured image caption
     
    133133
    134134== Changelog ==
     135
     136= 3.3.7 =
     137Add Bricks builder compatibility
     138Updated WordPress compatibility
    135139
    136140= 3.3.6 =
  • stockpack/trunk/src/class-stockpackadmin.php

    r2815781 r2966444  
    371371                    'default' => 'no',
    372372                ),
     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                ),
    373384            ),
    374385            'stockpack_debug'    => array(
  • stockpack/trunk/src/class-stockpackquery.php

    r2762836 r2966444  
    126126
    127127        public function token() {
    128             global $stockpack;
     128            $stockpack = StockPack::get_instance();
    129129            check_ajax_referer( 'stockpack_token', 'security' );
    130130            $token = '';
     
    243243            $search = isset( $_REQUEST['search_key'] ) ? sanitize_title( $_REQUEST['search_key'] ) : $this->get_domain();
    244244            $description = isset( $_REQUEST['description'] ) ? sanitize_textarea_field( $_REQUEST['description'] ) : '';
     245
     246
     247
    245248            $image = $this->image( $id, $post_id, $description, $search, $must_license, $provider, $new_filename );
    246249
     
    285288
    286289
    287         private function get_license_cost( $media_id, $provider ) {
     290        public function get_license_cost( $media_id, $provider ) {
    288291
    289292            return $this->call( 'GET', 'images/license-cost', array(
     
    295298        }
    296299
    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 );
    298303
    299304            $image = $this->call( 'GET', 'images/download',
     
    313318            }
    314319
    315             $filename = $image->data->name;
    316 
    317             if ( $new_filename ) {
    318                 $filename = $new_filename;
    319             }
     320            $filename = $this->getFilename($image, $new_filename, $must_license);
    320321
    321322            $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  );
    323324            if ( is_wp_error( $attachment_id ) ) {
    324325                return $attachment_id;
     
    377378        private function call( $method, $path, $query = [] ) {
    378379            /** @var StockPack $stockpack */
    379             global $stockpack;
     380            $stockpack = StockPack::get_instance();
    380381
    381382
     
    406407
    407408            $response = wp_remote_get( $url, array(
    408                 'timeout' => 10
     409                'timeout' => 10,
     410                'sslverify' => false,
    409411            ) );
    410412
     
    434436        private function limit_exceeded( $response ) {
    435437            /** @var StockPack $stockpack */
    436             global $stockpack;
     438            $stockpack = StockPack::get_instance();
    437439
    438440
     
    555557            $name = explode( '.', $name );
    556558            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;
    557580        }
    558581
     
    748771        }
    749772
     773
     774
    750775    }
    751776
  • stockpack/trunk/src/class-stockpacksettings.php

    r2815781 r2966444  
    3939    public function get_license_state() {
    4040        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' );
    4145    }
    4246
  • stockpack/trunk/stockpack.php

    r2823118 r2966444  
    66 * Author: Derikon Development
    77 * Author URI: https://derikon.com/
    8  * Version: 3.3.6
     8 * Version: 3.3.7
    99 * Text Domain: stockpack
    1010 * Domain Path: /languages
     
    148148    function stockpack_frontend_load() {
    149149        $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'] ) ) {
    151151            $load = true;
    152152        }
Note: See TracChangeset for help on using the changeset viewer.