Plugin Directory

Changeset 2946648


Ignore:
Timestamp:
08/02/2023 01:30:07 PM (3 years ago)
Author:
thronspa
Message:

tagging version 1.3.1

Location:
thron
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • thron/tags/1.3.1/README.txt

    r2868782 r2946648  
    22Contributors: thronspa, websolutedev
    33Tags: DAM
    4 Stable tag: 1.3.0
     4Stable tag: 1.3.1
    55Requires at least: 5.9
    66Tested up to: 6.1
     
    8585== Changelog ==
    8686
     87= 1.3.1 =
     88- Fixed some PHP warnings
     89- Fixed media endpoint in REST API
     90
    8791= 1.3.0 =
    8892- Extended support to PHP 8
  • thron/tags/1.3.1/admin/class-thron-admin.php

    r2868782 r2946648  
    381381
    382382        $request      = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array();
    383         $thron_source = sanitize_text_field( $request['thron_source'] );
     383        $thron_source = isset( $request['thron_source'] ) ? $request['thron_source'] : '' ;
    384384
    385385        if ( 'local' == $thron_source ) {
     
    414414         * Esco se il post__in fa riferimento ad un post in particolare
    415415         */
    416         if ( count( (array)$_REQUEST['query']['post__in'] ) > 0 ) {
     416        $post_in = isset( $_REQUEST['query']['post__in'] ) ? $_REQUEST['query']['post__in'] : array() ;
     417
     418        if (  count( (array)$post_in ) > 0 ) {
    417419            return;
    418420        }
     
    421423
    422424
    423         $source = sanitize_text_field( $query['thron_source'] );
     425        $source = isset( $query['thron_source'] ) ? sanitize_text_field( $query['thron_source'] ) : null ;
    424426
    425427        if ( 'local' == $source ) {
     
    503505         * Aggiorno i post Attachment
    504506         */
    505         $term       = sanitize_text_field( $query['s'] );
    506         $categories = sanitize_text_field( $query['thron_categories'] );
    507         $mime_type  = sanitize_text_field( $query['post_mime_type'] );
     507        $term       = isset( $query['s'] ) ? sanitize_text_field( $query['s'] ) : null ;
     508        $categories = isset( $query['thron_categories'] ) ? sanitize_text_field( $query['thron_categories'] ) : null ;
     509        $mime_type  = isset( $query['post_mime_type'] ) ? sanitize_text_field( $query['post_mime_type'] ) : null ;
    508510        $tags       = null;
    509511        $per_page   = sanitize_text_field( $query['posts_per_page'] );
     
    513515
    514516        foreach ( $_REQUEST['query'] as $key => $value ) {
     517           
    515518            if ( strpos( $key, 'thron_tags' ) !== false ) {
    516519                list( $classification, $id ) = explode( ';', str_replace( "thron_tags_", "", $key ) );
     
    589592        $screen = get_current_screen();
    590593
    591         if ( $screen->parent_base == 'upload' ) {
     594        if ( isset($screen->parent_base) && $screen->parent_base == 'upload' ) {
    592595            $t_id = get_post_meta(get_the_ID(),'thron_id', true);
    593596            if($t_id) {
     
    663666   
    664667
    665         $_SESSION['pageToken'] = $list_files->nextPageToken;
     668        $_SESSION['pageToken'] = isset( $list_files->nextPageToken ) ? $list_files->nextPageToken : '' ;
    666669
    667670        if ( is_array( $list_files->items ) and count( $list_files->items ) ) {
     
    672675                 */
    673676                $language = $file->details->locales[0];
     677
    674678                foreach ( $file->details->locales as $locale ) {
    675                     if ( 'EN' == $locale->lang ) {
     679                    if ( isset($locale) && 'EN' == $locale->lang ) {
    676680                        $language = $locale;
    677681                    }
    678682                }
    679683                foreach ( $file->details->locales as $locale ) {
    680                     if ( $this->wp_language == $locale->lang ) {
     684                    if ( isset($locale) && $this->wp_language == $locale->lang ) {
    681685                        $language = $locale;
    682686                    }
     
    688692                $thumbs = 'https://' . str_replace( '//', '', strtok( $file->thumbs[0]->url, '?' ) );
    689693
     694                $description = isset( $language->description ) ? $language->description : '' ;
     695
    690696                $generic_post = array(
    691697                    'id'          => $file->id,
    692698                    'author'      => get_current_user_id(),
    693                     'alt'         => sanitize_text_field( $language->description ),
    694                     'description' => $language->description,
     699                    'alt'         => sanitize_text_field( $description ),
     700                    'description' => $description,
    695701                    'guid'        => sanitize_title( $file->details->source->fileName ),
    696702                    'title'       => sanitize_text_field( $language->name ),
     
    933939        $language = $detail->content->locales[0];
    934940        foreach ( $detail->content->locales as $locale ) {
    935             if ( 'EN' == $locale->lang ) {
     941            if ( isset($locale) && 'EN' == $locale->lang ) {
    936942                $language = $locale;
    937943            }
    938944        }
    939945        foreach ( $detail->content->locales as $locale ) {
    940             if ( $this->wp_language == $locale->lang ) {
     946            if ( isset($locale) && $this->wp_language == $locale->lang ) {
    941947                $language = $locale;
    942948            }
     
    967973            'guid'           => sanitize_title( $thron_id ),
    968974            'post_title'     => sanitize_text_field( $language->name ),
    969             'post_content'   => $language->description ? $language->description : '',
     975            'post_content'   => isset($language->description) ? $language->description : '',
    970976            'filename'       => sanitize_file_name( $file_name ),
    971977            'caption'        => "",
     
    12301236    }
    12311237
    1232 
    1233 
    1234 function thron_add_tracking_class( $class ){
    1235 
    1236     $class .= ' tci';
    1237     return $class;
    1238 
    1239 }
    1240 
    1241 
    1242 
    1243 
    1244     function image_send_to_editor( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
     1238    function thron_add_tracking_class( $class ){
     1239        $class .= ' tci';
     1240        return $class;
     1241    }
     1242
     1243
     1244    function thron_image_send_to_editor( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
    12451245        $thron_id = get_post_meta( $id, 'thron_id', true );
    1246 
     1246       
    12471247        if ( ! $thron_id ) {
    12481248            return $html;
     
    12771277            $img->setAttribute( 'src', $src );
    12781278
     1279            $title = substr($basename, 0, strrpos($basename, "."));
     1280
     1281            $img->setAttribute( 'title', $title );
     1282
    12791283            $html = $dom->saveHTML( $img );
    1280         }
    1281 
     1284
     1285           
     1286        }
     1287       
    12821288        return $html;
    12831289    }
    12841290
    12851291    private function process_image_class( $matches ) {
    1286 
    12871292        $matches[1] = str_replace( $matches[2], $matches[2] . " tci", $matches[1] );
    12881293
  • thron/tags/1.3.1/admin/class-thron-cron.php

    r2750821 r2946648  
    128128                                'guid'           => sanitize_title($detail->content->id),
    129129                                'post_title'     => sanitize_text_field($language->name),
    130                                 'post_content'   => $language->description ? $language->description : '',
     130                                'post_content'   => $language->description ? $language->description : $language->name,
    131131                                'caption'        => "",
    132132                                'type'           => $type,
  • thron/tags/1.3.1/admin/class-thron-wp-rest-attachments-controller.php

    r2868782 r2946648  
    2626
    2727
    28     function prepare_meta($attach_id, $new_url, $thron_id, $qs) {
     28    function prepare_meta($attach_id, $new_url, $full_url, $thron_id, $qs) {
    2929
    3030        $thron_options = get_option( 'thron_option_api_page' );
     
    5555        $file_name     = sanitize_title( $detail->content->locales[0]->name ) . '.' . thron_mime2ext( $mime );
    5656        $width_default = ( array_key_exists( 'thron_maxImageWidth', $thron_options ) ) ? $thron_options['thron_maxImageWidth'] : '0';
    57         $attached_file_full = 'https://' . $clientId . '-cdn.thron.com/delivery/public/image/' . $clientId . '/' . $thron_id . '/' . $pkey . '/std/' . strval( $width_default ) . 'x0/' . $file_name;
     57       
     58        $attached_file_full = 'https://' . $clientId . '-cdn.thron.com/delivery/public/image/' . $clientId . '/' . $thron_id . '/' . $pkey . '/std/' . strval( $width_default ) . 'x0/' . $file_name . $qs;
    5859        $size = getimagesize( $attached_file_full );
    5960   
     
    133134                $saved_url = parse_url($request['src']);
    134135                parse_str($saved_url["query"], $saved_crop);
    135 
     136                $full_url = 'https://' . $clientId . '-cdn.thron.com/delivery/public/image/' . $clientId . '/' . $thron_id . '/' . $pkey . '/std/' . $request['width'] . 'x' . $request['height'] . '/' . $file_name;
    136137                $base_url = 'https://' . $clientId . '-cdn.thron.com/delivery/public/image/' . $clientId . '/' . $thron_id . '/' . $pkey . '/std/' . $file_name;
    137138
     
    200201       
    201202                // Generate image sub-sizes and meta.
    202                 $new_image_meta = $this->prepare_meta($new_attachment_id, $new_url, $thron_id, $qs);
     203                $new_image_meta = $this->prepare_meta($new_attachment_id, $new_url, $full_url, $thron_id, $qs);
    203204       
    204205                // Copy the EXIF metadata from the original attachment if not generated for the edited image.
  • thron/tags/1.3.1/admin/js/thron-block.js

    r2741703 r2946648  
    10181018                        help: '',
    10191019                        onChange: function(width) {
    1020 
    10211020                            var aspectRatio;
    10221021
     
    16621661
    16631662                aspectRatio = (maxWidth && maxHeight) ? maxHeight / maxWidth * 100 : 75;
    1664 
     1663               
    16651664                return el('div', {
    16661665                        className: props.className,
     1666                       
    16671667                    },
    16681668                    '[thron contentID="' + props.attributes.contentID + '" embedCodeId="' + props.attributes.embedCode + '" embedType="' + props.attributes.embedType + '" width="' + props.attributes.width + '" height="' + props.attributes.height + '" aspectRatio="' + aspectRatio + '"]',
  • thron/tags/1.3.1/includes/class-thron.php

    r2868782 r2946648  
    7171            $this->version = THRON_VERSION;
    7272        } else {
    73             $this->version = '1.3.0';
     73            $this->version = '1.3.1';
    7474        }
    7575        $this->plugin_name = 'thron';
     
    203203         * Adds the class for image tracking
    204204         */
    205         $this->loader->add_filter( 'image_send_to_editor', $plugin_admin, 'image_send_to_editor', 10, 8 );
     205        $this->loader->add_filter( 'image_send_to_editor', $plugin_admin, 'thron_image_send_to_editor', 10, 8 );
    206206
    207207
  • thron/tags/1.3.1/public/class-thron-public.php

    r2741703 r2946648  
    271271
    272272    public function wp_get_attachment_image_attributes( $attr, $attachment ) {
     273
    273274        $attr['class'] .= ' tci';
    274275
  • thron/tags/1.3.1/thron.php

    r2868782 r2946648  
    1717 * Plugin URI:
    1818 * Description:       Select the assets to insert within your pages directly from the DAM library
    19  * Version:           1.3.0
     19 * Version:           1.3.1
    2020 * Author:            THRON
    2121 * Author URI:        https://www.thron.com
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'THRON_VERSION', '1.3.0' );
     38define( 'THRON_VERSION', '1.3.1' );
    3939define( 'THRON_PLUGIN_URL', plugin_dir_url(__FILE__) );
    4040define( 'THRON_PLUGIN_PATH', plugin_dir_path(__FILE__) );
  • thron/trunk/README.txt

    r2868782 r2946648  
    22Contributors: thronspa, websolutedev
    33Tags: DAM
    4 Stable tag: 1.3.0
     4Stable tag: 1.3.1
    55Requires at least: 5.9
    66Tested up to: 6.1
     
    8585== Changelog ==
    8686
     87= 1.3.1 =
     88- Fixed some PHP warnings
     89- Fixed media endpoint in REST API
     90
    8791= 1.3.0 =
    8892- Extended support to PHP 8
  • thron/trunk/admin/class-thron-admin.php

    r2868782 r2946648  
    381381
    382382        $request      = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array();
    383         $thron_source = sanitize_text_field( $request['thron_source'] );
     383        $thron_source = isset( $request['thron_source'] ) ? $request['thron_source'] : '' ;
    384384
    385385        if ( 'local' == $thron_source ) {
     
    414414         * Esco se il post__in fa riferimento ad un post in particolare
    415415         */
    416         if ( count( (array)$_REQUEST['query']['post__in'] ) > 0 ) {
     416        $post_in = isset( $_REQUEST['query']['post__in'] ) ? $_REQUEST['query']['post__in'] : array() ;
     417
     418        if (  count( (array)$post_in ) > 0 ) {
    417419            return;
    418420        }
     
    421423
    422424
    423         $source = sanitize_text_field( $query['thron_source'] );
     425        $source = isset( $query['thron_source'] ) ? sanitize_text_field( $query['thron_source'] ) : null ;
    424426
    425427        if ( 'local' == $source ) {
     
    503505         * Aggiorno i post Attachment
    504506         */
    505         $term       = sanitize_text_field( $query['s'] );
    506         $categories = sanitize_text_field( $query['thron_categories'] );
    507         $mime_type  = sanitize_text_field( $query['post_mime_type'] );
     507        $term       = isset( $query['s'] ) ? sanitize_text_field( $query['s'] ) : null ;
     508        $categories = isset( $query['thron_categories'] ) ? sanitize_text_field( $query['thron_categories'] ) : null ;
     509        $mime_type  = isset( $query['post_mime_type'] ) ? sanitize_text_field( $query['post_mime_type'] ) : null ;
    508510        $tags       = null;
    509511        $per_page   = sanitize_text_field( $query['posts_per_page'] );
     
    513515
    514516        foreach ( $_REQUEST['query'] as $key => $value ) {
     517           
    515518            if ( strpos( $key, 'thron_tags' ) !== false ) {
    516519                list( $classification, $id ) = explode( ';', str_replace( "thron_tags_", "", $key ) );
     
    589592        $screen = get_current_screen();
    590593
    591         if ( $screen->parent_base == 'upload' ) {
     594        if ( isset($screen->parent_base) && $screen->parent_base == 'upload' ) {
    592595            $t_id = get_post_meta(get_the_ID(),'thron_id', true);
    593596            if($t_id) {
     
    663666   
    664667
    665         $_SESSION['pageToken'] = $list_files->nextPageToken;
     668        $_SESSION['pageToken'] = isset( $list_files->nextPageToken ) ? $list_files->nextPageToken : '' ;
    666669
    667670        if ( is_array( $list_files->items ) and count( $list_files->items ) ) {
     
    672675                 */
    673676                $language = $file->details->locales[0];
     677
    674678                foreach ( $file->details->locales as $locale ) {
    675                     if ( 'EN' == $locale->lang ) {
     679                    if ( isset($locale) && 'EN' == $locale->lang ) {
    676680                        $language = $locale;
    677681                    }
    678682                }
    679683                foreach ( $file->details->locales as $locale ) {
    680                     if ( $this->wp_language == $locale->lang ) {
     684                    if ( isset($locale) && $this->wp_language == $locale->lang ) {
    681685                        $language = $locale;
    682686                    }
     
    688692                $thumbs = 'https://' . str_replace( '//', '', strtok( $file->thumbs[0]->url, '?' ) );
    689693
     694                $description = isset( $language->description ) ? $language->description : '' ;
     695
    690696                $generic_post = array(
    691697                    'id'          => $file->id,
    692698                    'author'      => get_current_user_id(),
    693                     'alt'         => sanitize_text_field( $language->description ),
    694                     'description' => $language->description,
     699                    'alt'         => sanitize_text_field( $description ),
     700                    'description' => $description,
    695701                    'guid'        => sanitize_title( $file->details->source->fileName ),
    696702                    'title'       => sanitize_text_field( $language->name ),
     
    933939        $language = $detail->content->locales[0];
    934940        foreach ( $detail->content->locales as $locale ) {
    935             if ( 'EN' == $locale->lang ) {
     941            if ( isset($locale) && 'EN' == $locale->lang ) {
    936942                $language = $locale;
    937943            }
    938944        }
    939945        foreach ( $detail->content->locales as $locale ) {
    940             if ( $this->wp_language == $locale->lang ) {
     946            if ( isset($locale) && $this->wp_language == $locale->lang ) {
    941947                $language = $locale;
    942948            }
     
    967973            'guid'           => sanitize_title( $thron_id ),
    968974            'post_title'     => sanitize_text_field( $language->name ),
    969             'post_content'   => $language->description ? $language->description : '',
     975            'post_content'   => isset($language->description) ? $language->description : '',
    970976            'filename'       => sanitize_file_name( $file_name ),
    971977            'caption'        => "",
     
    12301236    }
    12311237
    1232 
    1233 
    1234 function thron_add_tracking_class( $class ){
    1235 
    1236     $class .= ' tci';
    1237     return $class;
    1238 
    1239 }
    1240 
    1241 
    1242 
    1243 
    1244     function image_send_to_editor( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
     1238    function thron_add_tracking_class( $class ){
     1239        $class .= ' tci';
     1240        return $class;
     1241    }
     1242
     1243
     1244    function thron_image_send_to_editor( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
    12451245        $thron_id = get_post_meta( $id, 'thron_id', true );
    1246 
     1246       
    12471247        if ( ! $thron_id ) {
    12481248            return $html;
     
    12771277            $img->setAttribute( 'src', $src );
    12781278
     1279            $title = substr($basename, 0, strrpos($basename, "."));
     1280
     1281            $img->setAttribute( 'title', $title );
     1282
    12791283            $html = $dom->saveHTML( $img );
    1280         }
    1281 
     1284
     1285           
     1286        }
     1287       
    12821288        return $html;
    12831289    }
    12841290
    12851291    private function process_image_class( $matches ) {
    1286 
    12871292        $matches[1] = str_replace( $matches[2], $matches[2] . " tci", $matches[1] );
    12881293
  • thron/trunk/admin/class-thron-cron.php

    r2750821 r2946648  
    128128                                'guid'           => sanitize_title($detail->content->id),
    129129                                'post_title'     => sanitize_text_field($language->name),
    130                                 'post_content'   => $language->description ? $language->description : '',
     130                                'post_content'   => $language->description ? $language->description : $language->name,
    131131                                'caption'        => "",
    132132                                'type'           => $type,
  • thron/trunk/admin/class-thron-wp-rest-attachments-controller.php

    r2868782 r2946648  
    2626
    2727
    28     function prepare_meta($attach_id, $new_url, $thron_id, $qs) {
     28    function prepare_meta($attach_id, $new_url, $full_url, $thron_id, $qs) {
    2929
    3030        $thron_options = get_option( 'thron_option_api_page' );
     
    5555        $file_name     = sanitize_title( $detail->content->locales[0]->name ) . '.' . thron_mime2ext( $mime );
    5656        $width_default = ( array_key_exists( 'thron_maxImageWidth', $thron_options ) ) ? $thron_options['thron_maxImageWidth'] : '0';
    57         $attached_file_full = 'https://' . $clientId . '-cdn.thron.com/delivery/public/image/' . $clientId . '/' . $thron_id . '/' . $pkey . '/std/' . strval( $width_default ) . 'x0/' . $file_name;
     57       
     58        $attached_file_full = 'https://' . $clientId . '-cdn.thron.com/delivery/public/image/' . $clientId . '/' . $thron_id . '/' . $pkey . '/std/' . strval( $width_default ) . 'x0/' . $file_name . $qs;
    5859        $size = getimagesize( $attached_file_full );
    5960   
     
    133134                $saved_url = parse_url($request['src']);
    134135                parse_str($saved_url["query"], $saved_crop);
    135 
     136                $full_url = 'https://' . $clientId . '-cdn.thron.com/delivery/public/image/' . $clientId . '/' . $thron_id . '/' . $pkey . '/std/' . $request['width'] . 'x' . $request['height'] . '/' . $file_name;
    136137                $base_url = 'https://' . $clientId . '-cdn.thron.com/delivery/public/image/' . $clientId . '/' . $thron_id . '/' . $pkey . '/std/' . $file_name;
    137138
     
    200201       
    201202                // Generate image sub-sizes and meta.
    202                 $new_image_meta = $this->prepare_meta($new_attachment_id, $new_url, $thron_id, $qs);
     203                $new_image_meta = $this->prepare_meta($new_attachment_id, $new_url, $full_url, $thron_id, $qs);
    203204       
    204205                // Copy the EXIF metadata from the original attachment if not generated for the edited image.
  • thron/trunk/admin/js/thron-block.js

    r2741703 r2946648  
    10181018                        help: '',
    10191019                        onChange: function(width) {
    1020 
    10211020                            var aspectRatio;
    10221021
     
    16621661
    16631662                aspectRatio = (maxWidth && maxHeight) ? maxHeight / maxWidth * 100 : 75;
    1664 
     1663               
    16651664                return el('div', {
    16661665                        className: props.className,
     1666                       
    16671667                    },
    16681668                    '[thron contentID="' + props.attributes.contentID + '" embedCodeId="' + props.attributes.embedCode + '" embedType="' + props.attributes.embedType + '" width="' + props.attributes.width + '" height="' + props.attributes.height + '" aspectRatio="' + aspectRatio + '"]',
  • thron/trunk/includes/class-thron.php

    r2868782 r2946648  
    7171            $this->version = THRON_VERSION;
    7272        } else {
    73             $this->version = '1.3.0';
     73            $this->version = '1.3.1';
    7474        }
    7575        $this->plugin_name = 'thron';
     
    203203         * Adds the class for image tracking
    204204         */
    205         $this->loader->add_filter( 'image_send_to_editor', $plugin_admin, 'image_send_to_editor', 10, 8 );
     205        $this->loader->add_filter( 'image_send_to_editor', $plugin_admin, 'thron_image_send_to_editor', 10, 8 );
    206206
    207207
  • thron/trunk/public/class-thron-public.php

    r2741703 r2946648  
    271271
    272272    public function wp_get_attachment_image_attributes( $attr, $attachment ) {
     273
    273274        $attr['class'] .= ' tci';
    274275
  • thron/trunk/thron.php

    r2868782 r2946648  
    1717 * Plugin URI:
    1818 * Description:       Select the assets to insert within your pages directly from the DAM library
    19  * Version:           1.3.0
     19 * Version:           1.3.1
    2020 * Author:            THRON
    2121 * Author URI:        https://www.thron.com
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'THRON_VERSION', '1.3.0' );
     38define( 'THRON_VERSION', '1.3.1' );
    3939define( 'THRON_PLUGIN_URL', plugin_dir_url(__FILE__) );
    4040define( 'THRON_PLUGIN_PATH', plugin_dir_path(__FILE__) );
Note: See TracChangeset for help on using the changeset viewer.