Changeset 2946648
- Timestamp:
- 08/02/2023 01:30:07 PM (3 years ago)
- Location:
- thron
- Files:
-
- 16 edited
- 1 copied
-
tags/1.3.1 (copied) (copied from thron/trunk)
-
tags/1.3.1/README.txt (modified) (2 diffs)
-
tags/1.3.1/admin/class-thron-admin.php (modified) (13 diffs)
-
tags/1.3.1/admin/class-thron-cron.php (modified) (1 diff)
-
tags/1.3.1/admin/class-thron-wp-rest-attachments-controller.php (modified) (4 diffs)
-
tags/1.3.1/admin/js/thron-block.js (modified) (2 diffs)
-
tags/1.3.1/includes/class-thron.php (modified) (2 diffs)
-
tags/1.3.1/public/class-thron-public.php (modified) (1 diff)
-
tags/1.3.1/thron.php (modified) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/class-thron-admin.php (modified) (13 diffs)
-
trunk/admin/class-thron-cron.php (modified) (1 diff)
-
trunk/admin/class-thron-wp-rest-attachments-controller.php (modified) (4 diffs)
-
trunk/admin/js/thron-block.js (modified) (2 diffs)
-
trunk/includes/class-thron.php (modified) (2 diffs)
-
trunk/public/class-thron-public.php (modified) (1 diff)
-
trunk/thron.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
thron/tags/1.3.1/README.txt
r2868782 r2946648 2 2 Contributors: thronspa, websolutedev 3 3 Tags: DAM 4 Stable tag: 1.3. 04 Stable tag: 1.3.1 5 5 Requires at least: 5.9 6 6 Tested up to: 6.1 … … 85 85 == Changelog == 86 86 87 = 1.3.1 = 88 - Fixed some PHP warnings 89 - Fixed media endpoint in REST API 90 87 91 = 1.3.0 = 88 92 - Extended support to PHP 8 -
thron/tags/1.3.1/admin/class-thron-admin.php
r2868782 r2946648 381 381 382 382 $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'] : '' ; 384 384 385 385 if ( 'local' == $thron_source ) { … … 414 414 * Esco se il post__in fa riferimento ad un post in particolare 415 415 */ 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 ) { 417 419 return; 418 420 } … … 421 423 422 424 423 $source = sanitize_text_field( $query['thron_source'] );425 $source = isset( $query['thron_source'] ) ? sanitize_text_field( $query['thron_source'] ) : null ; 424 426 425 427 if ( 'local' == $source ) { … … 503 505 * Aggiorno i post Attachment 504 506 */ 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 ; 508 510 $tags = null; 509 511 $per_page = sanitize_text_field( $query['posts_per_page'] ); … … 513 515 514 516 foreach ( $_REQUEST['query'] as $key => $value ) { 517 515 518 if ( strpos( $key, 'thron_tags' ) !== false ) { 516 519 list( $classification, $id ) = explode( ';', str_replace( "thron_tags_", "", $key ) ); … … 589 592 $screen = get_current_screen(); 590 593 591 if ( $screen->parent_base == 'upload' ) {594 if ( isset($screen->parent_base) && $screen->parent_base == 'upload' ) { 592 595 $t_id = get_post_meta(get_the_ID(),'thron_id', true); 593 596 if($t_id) { … … 663 666 664 667 665 $_SESSION['pageToken'] = $list_files->nextPageToken;668 $_SESSION['pageToken'] = isset( $list_files->nextPageToken ) ? $list_files->nextPageToken : '' ; 666 669 667 670 if ( is_array( $list_files->items ) and count( $list_files->items ) ) { … … 672 675 */ 673 676 $language = $file->details->locales[0]; 677 674 678 foreach ( $file->details->locales as $locale ) { 675 if ( 'EN' == $locale->lang ) {679 if ( isset($locale) && 'EN' == $locale->lang ) { 676 680 $language = $locale; 677 681 } 678 682 } 679 683 foreach ( $file->details->locales as $locale ) { 680 if ( $this->wp_language == $locale->lang ) {684 if ( isset($locale) && $this->wp_language == $locale->lang ) { 681 685 $language = $locale; 682 686 } … … 688 692 $thumbs = 'https://' . str_replace( '//', '', strtok( $file->thumbs[0]->url, '?' ) ); 689 693 694 $description = isset( $language->description ) ? $language->description : '' ; 695 690 696 $generic_post = array( 691 697 'id' => $file->id, 692 698 '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, 695 701 'guid' => sanitize_title( $file->details->source->fileName ), 696 702 'title' => sanitize_text_field( $language->name ), … … 933 939 $language = $detail->content->locales[0]; 934 940 foreach ( $detail->content->locales as $locale ) { 935 if ( 'EN' == $locale->lang ) {941 if ( isset($locale) && 'EN' == $locale->lang ) { 936 942 $language = $locale; 937 943 } 938 944 } 939 945 foreach ( $detail->content->locales as $locale ) { 940 if ( $this->wp_language == $locale->lang ) {946 if ( isset($locale) && $this->wp_language == $locale->lang ) { 941 947 $language = $locale; 942 948 } … … 967 973 'guid' => sanitize_title( $thron_id ), 968 974 'post_title' => sanitize_text_field( $language->name ), 969 'post_content' => $language->description? $language->description : '',975 'post_content' => isset($language->description) ? $language->description : '', 970 976 'filename' => sanitize_file_name( $file_name ), 971 977 'caption' => "", … … 1230 1236 } 1231 1237 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 ) { 1245 1245 $thron_id = get_post_meta( $id, 'thron_id', true ); 1246 1246 1247 1247 if ( ! $thron_id ) { 1248 1248 return $html; … … 1277 1277 $img->setAttribute( 'src', $src ); 1278 1278 1279 $title = substr($basename, 0, strrpos($basename, ".")); 1280 1281 $img->setAttribute( 'title', $title ); 1282 1279 1283 $html = $dom->saveHTML( $img ); 1280 } 1281 1284 1285 1286 } 1287 1282 1288 return $html; 1283 1289 } 1284 1290 1285 1291 private function process_image_class( $matches ) { 1286 1287 1292 $matches[1] = str_replace( $matches[2], $matches[2] . " tci", $matches[1] ); 1288 1293 -
thron/tags/1.3.1/admin/class-thron-cron.php
r2750821 r2946648 128 128 'guid' => sanitize_title($detail->content->id), 129 129 'post_title' => sanitize_text_field($language->name), 130 'post_content' => $language->description ? $language->description : '',130 'post_content' => $language->description ? $language->description : $language->name, 131 131 'caption' => "", 132 132 'type' => $type, -
thron/tags/1.3.1/admin/class-thron-wp-rest-attachments-controller.php
r2868782 r2946648 26 26 27 27 28 function prepare_meta($attach_id, $new_url, $ thron_id, $qs) {28 function prepare_meta($attach_id, $new_url, $full_url, $thron_id, $qs) { 29 29 30 30 $thron_options = get_option( 'thron_option_api_page' ); … … 55 55 $file_name = sanitize_title( $detail->content->locales[0]->name ) . '.' . thron_mime2ext( $mime ); 56 56 $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; 58 59 $size = getimagesize( $attached_file_full ); 59 60 … … 133 134 $saved_url = parse_url($request['src']); 134 135 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; 136 137 $base_url = 'https://' . $clientId . '-cdn.thron.com/delivery/public/image/' . $clientId . '/' . $thron_id . '/' . $pkey . '/std/' . $file_name; 137 138 … … 200 201 201 202 // 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); 203 204 204 205 // 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 1018 1018 help: '', 1019 1019 onChange: function(width) { 1020 1021 1020 var aspectRatio; 1022 1021 … … 1662 1661 1663 1662 aspectRatio = (maxWidth && maxHeight) ? maxHeight / maxWidth * 100 : 75; 1664 1663 1665 1664 return el('div', { 1666 1665 className: props.className, 1666 1667 1667 }, 1668 1668 '[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 71 71 $this->version = THRON_VERSION; 72 72 } else { 73 $this->version = '1.3. 0';73 $this->version = '1.3.1'; 74 74 } 75 75 $this->plugin_name = 'thron'; … … 203 203 * Adds the class for image tracking 204 204 */ 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 ); 206 206 207 207 -
thron/tags/1.3.1/public/class-thron-public.php
r2741703 r2946648 271 271 272 272 public function wp_get_attachment_image_attributes( $attr, $attachment ) { 273 273 274 $attr['class'] .= ' tci'; 274 275 -
thron/tags/1.3.1/thron.php
r2868782 r2946648 17 17 * Plugin URI: 18 18 * Description: Select the assets to insert within your pages directly from the DAM library 19 * Version: 1.3. 019 * Version: 1.3.1 20 20 * Author: THRON 21 21 * Author URI: https://www.thron.com … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'THRON_VERSION', '1.3. 0' );38 define( 'THRON_VERSION', '1.3.1' ); 39 39 define( 'THRON_PLUGIN_URL', plugin_dir_url(__FILE__) ); 40 40 define( 'THRON_PLUGIN_PATH', plugin_dir_path(__FILE__) ); -
thron/trunk/README.txt
r2868782 r2946648 2 2 Contributors: thronspa, websolutedev 3 3 Tags: DAM 4 Stable tag: 1.3. 04 Stable tag: 1.3.1 5 5 Requires at least: 5.9 6 6 Tested up to: 6.1 … … 85 85 == Changelog == 86 86 87 = 1.3.1 = 88 - Fixed some PHP warnings 89 - Fixed media endpoint in REST API 90 87 91 = 1.3.0 = 88 92 - Extended support to PHP 8 -
thron/trunk/admin/class-thron-admin.php
r2868782 r2946648 381 381 382 382 $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'] : '' ; 384 384 385 385 if ( 'local' == $thron_source ) { … … 414 414 * Esco se il post__in fa riferimento ad un post in particolare 415 415 */ 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 ) { 417 419 return; 418 420 } … … 421 423 422 424 423 $source = sanitize_text_field( $query['thron_source'] );425 $source = isset( $query['thron_source'] ) ? sanitize_text_field( $query['thron_source'] ) : null ; 424 426 425 427 if ( 'local' == $source ) { … … 503 505 * Aggiorno i post Attachment 504 506 */ 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 ; 508 510 $tags = null; 509 511 $per_page = sanitize_text_field( $query['posts_per_page'] ); … … 513 515 514 516 foreach ( $_REQUEST['query'] as $key => $value ) { 517 515 518 if ( strpos( $key, 'thron_tags' ) !== false ) { 516 519 list( $classification, $id ) = explode( ';', str_replace( "thron_tags_", "", $key ) ); … … 589 592 $screen = get_current_screen(); 590 593 591 if ( $screen->parent_base == 'upload' ) {594 if ( isset($screen->parent_base) && $screen->parent_base == 'upload' ) { 592 595 $t_id = get_post_meta(get_the_ID(),'thron_id', true); 593 596 if($t_id) { … … 663 666 664 667 665 $_SESSION['pageToken'] = $list_files->nextPageToken;668 $_SESSION['pageToken'] = isset( $list_files->nextPageToken ) ? $list_files->nextPageToken : '' ; 666 669 667 670 if ( is_array( $list_files->items ) and count( $list_files->items ) ) { … … 672 675 */ 673 676 $language = $file->details->locales[0]; 677 674 678 foreach ( $file->details->locales as $locale ) { 675 if ( 'EN' == $locale->lang ) {679 if ( isset($locale) && 'EN' == $locale->lang ) { 676 680 $language = $locale; 677 681 } 678 682 } 679 683 foreach ( $file->details->locales as $locale ) { 680 if ( $this->wp_language == $locale->lang ) {684 if ( isset($locale) && $this->wp_language == $locale->lang ) { 681 685 $language = $locale; 682 686 } … … 688 692 $thumbs = 'https://' . str_replace( '//', '', strtok( $file->thumbs[0]->url, '?' ) ); 689 693 694 $description = isset( $language->description ) ? $language->description : '' ; 695 690 696 $generic_post = array( 691 697 'id' => $file->id, 692 698 '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, 695 701 'guid' => sanitize_title( $file->details->source->fileName ), 696 702 'title' => sanitize_text_field( $language->name ), … … 933 939 $language = $detail->content->locales[0]; 934 940 foreach ( $detail->content->locales as $locale ) { 935 if ( 'EN' == $locale->lang ) {941 if ( isset($locale) && 'EN' == $locale->lang ) { 936 942 $language = $locale; 937 943 } 938 944 } 939 945 foreach ( $detail->content->locales as $locale ) { 940 if ( $this->wp_language == $locale->lang ) {946 if ( isset($locale) && $this->wp_language == $locale->lang ) { 941 947 $language = $locale; 942 948 } … … 967 973 'guid' => sanitize_title( $thron_id ), 968 974 'post_title' => sanitize_text_field( $language->name ), 969 'post_content' => $language->description? $language->description : '',975 'post_content' => isset($language->description) ? $language->description : '', 970 976 'filename' => sanitize_file_name( $file_name ), 971 977 'caption' => "", … … 1230 1236 } 1231 1237 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 ) { 1245 1245 $thron_id = get_post_meta( $id, 'thron_id', true ); 1246 1246 1247 1247 if ( ! $thron_id ) { 1248 1248 return $html; … … 1277 1277 $img->setAttribute( 'src', $src ); 1278 1278 1279 $title = substr($basename, 0, strrpos($basename, ".")); 1280 1281 $img->setAttribute( 'title', $title ); 1282 1279 1283 $html = $dom->saveHTML( $img ); 1280 } 1281 1284 1285 1286 } 1287 1282 1288 return $html; 1283 1289 } 1284 1290 1285 1291 private function process_image_class( $matches ) { 1286 1287 1292 $matches[1] = str_replace( $matches[2], $matches[2] . " tci", $matches[1] ); 1288 1293 -
thron/trunk/admin/class-thron-cron.php
r2750821 r2946648 128 128 'guid' => sanitize_title($detail->content->id), 129 129 'post_title' => sanitize_text_field($language->name), 130 'post_content' => $language->description ? $language->description : '',130 'post_content' => $language->description ? $language->description : $language->name, 131 131 'caption' => "", 132 132 'type' => $type, -
thron/trunk/admin/class-thron-wp-rest-attachments-controller.php
r2868782 r2946648 26 26 27 27 28 function prepare_meta($attach_id, $new_url, $ thron_id, $qs) {28 function prepare_meta($attach_id, $new_url, $full_url, $thron_id, $qs) { 29 29 30 30 $thron_options = get_option( 'thron_option_api_page' ); … … 55 55 $file_name = sanitize_title( $detail->content->locales[0]->name ) . '.' . thron_mime2ext( $mime ); 56 56 $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; 58 59 $size = getimagesize( $attached_file_full ); 59 60 … … 133 134 $saved_url = parse_url($request['src']); 134 135 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; 136 137 $base_url = 'https://' . $clientId . '-cdn.thron.com/delivery/public/image/' . $clientId . '/' . $thron_id . '/' . $pkey . '/std/' . $file_name; 137 138 … … 200 201 201 202 // 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); 203 204 204 205 // Copy the EXIF metadata from the original attachment if not generated for the edited image. -
thron/trunk/admin/js/thron-block.js
r2741703 r2946648 1018 1018 help: '', 1019 1019 onChange: function(width) { 1020 1021 1020 var aspectRatio; 1022 1021 … … 1662 1661 1663 1662 aspectRatio = (maxWidth && maxHeight) ? maxHeight / maxWidth * 100 : 75; 1664 1663 1665 1664 return el('div', { 1666 1665 className: props.className, 1666 1667 1667 }, 1668 1668 '[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 71 71 $this->version = THRON_VERSION; 72 72 } else { 73 $this->version = '1.3. 0';73 $this->version = '1.3.1'; 74 74 } 75 75 $this->plugin_name = 'thron'; … … 203 203 * Adds the class for image tracking 204 204 */ 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 ); 206 206 207 207 -
thron/trunk/public/class-thron-public.php
r2741703 r2946648 271 271 272 272 public function wp_get_attachment_image_attributes( $attr, $attachment ) { 273 273 274 $attr['class'] .= ' tci'; 274 275 -
thron/trunk/thron.php
r2868782 r2946648 17 17 * Plugin URI: 18 18 * Description: Select the assets to insert within your pages directly from the DAM library 19 * Version: 1.3. 019 * Version: 1.3.1 20 20 * Author: THRON 21 21 * Author URI: https://www.thron.com … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'THRON_VERSION', '1.3. 0' );38 define( 'THRON_VERSION', '1.3.1' ); 39 39 define( 'THRON_PLUGIN_URL', plugin_dir_url(__FILE__) ); 40 40 define( 'THRON_PLUGIN_PATH', plugin_dir_path(__FILE__) );
Note: See TracChangeset
for help on using the changeset viewer.