Changeset 2262094
- Timestamp:
- 03/16/2020 11:43:05 PM (6 years ago)
- Location:
- template-kit-export/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (2 diffs)
-
builders/class-template-kit-export-builders-base.php (modified) (4 diffs)
-
builders/class-template-kit-export-builders-elementor.php (modified) (2 diffs)
-
languages/template-kit-export.pot (modified) (1 diff)
-
template-kit-export.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
template-kit-export/trunk/README.txt
r2251744 r2262094 5 5 Tested up to: 5.3.2 6 6 Requires PHP: 5.6 7 Stable tag: 1.0. 57 Stable tag: 1.0.6 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 39 39 == Changelog == 40 40 41 = 1.0.6 - 2020-03-17 = 42 * Fix image thumbnail dimensions 43 41 44 = 1.0.5 - 2020-02-28 = 42 45 * Fix incorrectly blocking certain image urls from export -
template-kit-export/trunk/builders/class-template-kit-export-builders-base.php
r2246624 r2262094 337 337 throw new Exception( 'No attachment for template ' . $template_id ); 338 338 } 339 // Get the attached file path. 340 $attachment_filename = get_attached_file( $attachment_id ); 341 // Get the file name of the feature image data. 342 $attached_info = image_get_intermediate_size( $attachment_id, $size = 'tk_preview' ); 343 if ( ! $attached_info ) { 339 // Get the file name of the feature image data. We try to get the "tk_preview" sized thumbnail first: 340 $attached_info = image_get_intermediate_size( $attachment_id, 'tk_preview' ); 341 if ( $attached_info && ! empty( $attached_info['path'] ) ) { 342 // We have successfully found a "tk_preview" sized image for this attachment. 343 // Build out the full file path for this attachment so we can read its exif data and zip it up. 344 $upload_directory = wp_upload_dir(); 345 // Do a little string append to get the file path of the feature image. 346 $attachment_filename = trailingslashit( $upload_directory['basedir'] ) . $attached_info['path']; 347 } else { 344 348 // We couldn't find tk_preview size, author likely uploaded exactly 600px wide thumb (as per guidelines) 345 // Grab the full image source: 346 $attached_info = image_get_intermediate_size( $attachment_id ); 347 if ( ! $attached_info ) { 348 throw new Exception( 'Could not find file for attachment ' . $attachment_id ); 349 } 350 } 351 // Get the up load dir array. 352 $upload_directory = wp_upload_dir(); 353 // Do a little string append to get the file path of the feature image. 354 $attachment_filename = trailingslashit( $upload_directory['basedir'] ) . $attached_info['path']; 355 $screenshot_url = get_the_post_thumbnail_url( $template_id ); 356 $screenshot_type = exif_imagetype( $attachment_filename ); 349 // Get the attached file path. This is the full image file path. 350 $attachment_filename = get_attached_file( $attachment_id ); 351 } 352 if ( ! $attachment_filename ) { 353 throw new Exception( 'Could not find file for attachment ' . $attachment_id ); 354 } 355 356 $screenshot_url = get_the_post_thumbnail_url( $template_id ); 357 $screenshot_type = exif_imagetype( $attachment_filename ); 357 358 if ( IMAGETYPE_PNG === $screenshot_type ) { 358 359 $screenshot_extension = 'png'; … … 380 381 */ 381 382 public function save_template_options( $template_id, $template_options ) { 382 383 383 // Loop over all possible meta fields and pull those values into the post meta array 384 384 $template_fields = $this->get_template_meta_fields(); … … 405 405 $template_options['thumb_id'] 406 406 ); 407 408 // This forces the creation of the tk_preview if it failed to be created by WP 409 // due to the exact size the user uploaded. It then updated template meta. 410 $get_thumb_id = get_post_thumbnail_id( $template_id ); 411 $check_tk_preview = image_get_intermediate_size( $get_thumb_id, 'tk_preview' ); 412 if ( ! $check_tk_preview ) { 413 $generated_tk_preview = image_make_intermediate_size( get_attached_file( $get_thumb_id ), 600, 600, true ); 414 $template_attachment_meta = wp_get_attachment_metadata( $get_thumb_id ); 415 $template_attachment_meta['sizes']['tk_preview'] = $generated_tk_preview; 416 wp_update_attachment_metadata( $get_thumb_id, $template_attachment_meta ); 417 } 407 418 } 408 419 … … 638 649 // We also include any additional image metadata (such as license etc..) that is captured from the user: 639 650 foreach ( $image_fields as $image_field ) { 640 $image_metadata[ $image_field['name'] ] = $image['user_data'][ $image_field['name'] ]; 651 if ( isset( $image['user_data'][ $image_field['name'] ] ) ) { 652 $image_metadata[ $image_field['name'] ] = $image['user_data'][ $image_field['name'] ]; 653 } 641 654 } 642 655 // Finally we append our image metadata onto the big array of metadata that will make its way down to the manifest.json file: -
template-kit-export/trunk/builders/class-template-kit-export-builders-elementor.php
r2251744 r2262094 204 204 'user_data' => is_array( $image_meta ) ? $image_meta : array(), 205 205 'filesize' => filesize( get_attached_file( $image_id ) ), 206 'dimensions' => array( $image_size['width'], $image_size['height'] ), 206 // Sometimes wp_get_attachment_metadata() returns an empty string '' instead of an array. 207 // We assume this is to do with an incorrectly coded 3rd party plugin. 208 // WordPress core checks for "isset( $meta['width'], $meta['height'] )" after wp_get_attachment_metadata() 209 // in a number of places, so we'll do the same thing here. 210 // The author will get a 0px x 0px dimension listed in their backend, but that's better than an uncaught error message. 211 'dimensions' => isset( $image_size['width'], $image_size['height'] ) ? array( $image_size['width'], $image_size['height'] ) : array(0, 0), 207 212 ); 208 213 } … … 388 393 // Hunt for inline styles: 389 394 if ( preg_match_all( '#style=[\'"]([^\'"]+)[\'"]#imsU', $val, $matches ) ) { 395 $allowed_built_in_styles = array( 396 '#text-align:[^;]+;#' => '', 397 ); 390 398 foreach ( $matches[1] as $match ) { 391 $template_errors[] = 'Please remove any inline style="' . esc_html( $match ) . '" from ' . $template['name']; 399 if ( preg_replace( array_keys( $allowed_built_in_styles ), array_values( $allowed_built_in_styles ), $match ) !== '' ) { 400 $template_errors[] = 'Please remove any inline style="' . esc_html( $match ) . '" from ' . $template['name']; 401 } 392 402 } 393 403 } -
template-kit-export/trunk/languages/template-kit-export.pot
r2251744 r2262094 54 54 msgstr "" 55 55 56 #: builders/class-template-kit-export-builders-base.php:4 7656 #: builders/class-template-kit-export-builders-base.php:487 57 57 msgid "Image Source:" 58 58 msgstr "" 59 59 60 #: builders/class-template-kit-export-builders-base.php:4 8060 #: builders/class-template-kit-export-builders-base.php:491 61 61 msgid "Licensed From Envato Elements" 62 62 msgstr "" 63 63 64 #: builders/class-template-kit-export-builders-base.php:4 8164 #: builders/class-template-kit-export-builders-base.php:492 65 65 msgid "Created Myself" 66 66 msgstr "" 67 67 68 #: builders/class-template-kit-export-builders-base.php:4 8268 #: builders/class-template-kit-export-builders-base.php:493 69 69 msgid "CC0 or equivalent" 70 70 msgstr "" 71 71 72 #: builders/class-template-kit-export-builders-base.php:4 8372 #: builders/class-template-kit-export-builders-base.php:494 73 73 msgid "Unsure (NOT allowed)" 74 74 msgstr "" 75 75 76 #: builders/class-template-kit-export-builders-base.php:4 8876 #: builders/class-template-kit-export-builders-base.php:499 77 77 msgid "Contains Person or Place?" 78 78 msgstr "" 79 79 80 #: builders/class-template-kit-export-builders-base.php: 49280 #: builders/class-template-kit-export-builders-base.php:503 81 81 msgid "Yes, image contains person or place" 82 82 msgstr "" 83 83 84 #: builders/class-template-kit-export-builders-base.php: 49384 #: builders/class-template-kit-export-builders-base.php:504 85 85 msgid "No" 86 86 msgstr "" 87 87 88 #: builders/class-template-kit-export-builders-base.php: 49888 #: builders/class-template-kit-export-builders-base.php:509 89 89 msgid "Source URLs" 90 90 msgstr "" 91 91 92 #: builders/class-template-kit-export-builders-base.php:5 15, builders/class-template-kit-export-builders-elementor.php:31692 #: builders/class-template-kit-export-builders-base.php:526, builders/class-template-kit-export-builders-elementor.php:321 93 93 msgid "Include Template in Export ZIP" 94 94 msgstr "" 95 95 96 #: builders/class-template-kit-export-builders-elementor.php:2 6696 #: builders/class-template-kit-export-builders-elementor.php:271 97 97 msgid "Template Type:" 98 98 msgstr "" 99 99 100 #: builders/class-template-kit-export-builders-elementor.php:2 69100 #: builders/class-template-kit-export-builders-elementor.php:274 101 101 msgid " - Select Template Type - " 102 102 msgstr "" 103 103 104 #: builders/class-template-kit-export-builders-elementor.php:27 1104 #: builders/class-template-kit-export-builders-elementor.php:276 105 105 msgid "Full Page" 106 106 msgstr "" 107 107 108 #: builders/class-template-kit-export-builders-elementor.php:27 3108 #: builders/class-template-kit-export-builders-elementor.php:278 109 109 msgid "Single: Page" 110 110 msgstr "" 111 111 112 #: builders/class-template-kit-export-builders-elementor.php:27 4112 #: builders/class-template-kit-export-builders-elementor.php:279 113 113 msgid "Single: Home" 114 114 msgstr "" 115 115 116 #: builders/class-template-kit-export-builders-elementor.php:2 75116 #: builders/class-template-kit-export-builders-elementor.php:280 117 117 msgid "Single: Post" 118 118 msgstr "" 119 119 120 #: builders/class-template-kit-export-builders-elementor.php:2 76120 #: builders/class-template-kit-export-builders-elementor.php:281 121 121 msgid "Single: Product" 122 122 msgstr "" 123 123 124 #: builders/class-template-kit-export-builders-elementor.php:2 77124 #: builders/class-template-kit-export-builders-elementor.php:282 125 125 msgid "Single: 404" 126 126 msgstr "" 127 127 128 #: builders/class-template-kit-export-builders-elementor.php:2 78128 #: builders/class-template-kit-export-builders-elementor.php:283 129 129 msgid "Archive: Blog" 130 130 msgstr "" 131 131 132 #: builders/class-template-kit-export-builders-elementor.php:2 79132 #: builders/class-template-kit-export-builders-elementor.php:284 133 133 msgid "Archive: Product" 134 134 msgstr "" 135 135 136 #: builders/class-template-kit-export-builders-elementor.php:28 0136 #: builders/class-template-kit-export-builders-elementor.php:285 137 137 msgid "Archive: Search" 138 138 msgstr "" 139 139 140 #: builders/class-template-kit-export-builders-elementor.php:28 1140 #: builders/class-template-kit-export-builders-elementor.php:286 141 141 msgid "Archive: Category" 142 142 msgstr "" 143 143 144 #: builders/class-template-kit-export-builders-elementor.php:2 85144 #: builders/class-template-kit-export-builders-elementor.php:290 145 145 msgid "Section / Block" 146 146 msgstr "" 147 147 148 #: builders/class-template-kit-export-builders-elementor.php:2 87148 #: builders/class-template-kit-export-builders-elementor.php:292 149 149 msgid "Header" 150 150 msgstr "" 151 151 152 #: builders/class-template-kit-export-builders-elementor.php:2 88152 #: builders/class-template-kit-export-builders-elementor.php:293 153 153 msgid "Footer" 154 154 msgstr "" 155 155 156 #: builders/class-template-kit-export-builders-elementor.php:2 89156 #: builders/class-template-kit-export-builders-elementor.php:294 157 157 msgid "Popup" 158 158 msgstr "" 159 159 160 #: builders/class-template-kit-export-builders-elementor.php:29 0160 #: builders/class-template-kit-export-builders-elementor.php:295 161 161 msgid "Hero" 162 162 msgstr "" 163 163 164 #: builders/class-template-kit-export-builders-elementor.php:29 1164 #: builders/class-template-kit-export-builders-elementor.php:296 165 165 msgid "About" 166 166 msgstr "" 167 167 168 #: builders/class-template-kit-export-builders-elementor.php:29 2168 #: builders/class-template-kit-export-builders-elementor.php:297 169 169 msgid "FAQ" 170 170 msgstr "" 171 171 172 #: builders/class-template-kit-export-builders-elementor.php:29 3172 #: builders/class-template-kit-export-builders-elementor.php:298 173 173 msgid "Contact" 174 174 msgstr "" 175 175 176 #: builders/class-template-kit-export-builders-elementor.php:29 4176 #: builders/class-template-kit-export-builders-elementor.php:299 177 177 msgid "Call to Action" 178 178 msgstr "" 179 179 180 #: builders/class-template-kit-export-builders-elementor.php: 295180 #: builders/class-template-kit-export-builders-elementor.php:300 181 181 msgid "Team" 182 182 msgstr "" 183 183 184 #: builders/class-template-kit-export-builders-elementor.php: 296184 #: builders/class-template-kit-export-builders-elementor.php:301 185 185 msgid "Map" 186 186 msgstr "" 187 187 188 #: builders/class-template-kit-export-builders-elementor.php: 297188 #: builders/class-template-kit-export-builders-elementor.php:302 189 189 msgid "Features" 190 190 msgstr "" 191 191 192 #: builders/class-template-kit-export-builders-elementor.php: 298192 #: builders/class-template-kit-export-builders-elementor.php:303 193 193 msgid "Pricing" 194 194 msgstr "" 195 195 196 #: builders/class-template-kit-export-builders-elementor.php: 299196 #: builders/class-template-kit-export-builders-elementor.php:304 197 197 msgid "Testimonial" 198 198 msgstr "" 199 199 200 #: builders/class-template-kit-export-builders-elementor.php:30 0200 #: builders/class-template-kit-export-builders-elementor.php:305 201 201 msgid "Product" 202 202 msgstr "" 203 203 204 #: builders/class-template-kit-export-builders-elementor.php:30 1204 #: builders/class-template-kit-export-builders-elementor.php:306 205 205 msgid "Services" 206 206 msgstr "" 207 207 208 #: builders/class-template-kit-export-builders-elementor.php:30 2208 #: builders/class-template-kit-export-builders-elementor.php:307 209 209 msgid "Stats" 210 210 msgstr "" 211 211 212 #: builders/class-template-kit-export-builders-elementor.php:30 3212 #: builders/class-template-kit-export-builders-elementor.php:308 213 213 msgid "Countdown" 214 214 msgstr "" 215 215 216 #: builders/class-template-kit-export-builders-elementor.php:30 4216 #: builders/class-template-kit-export-builders-elementor.php:309 217 217 msgid "Portfolio" 218 218 msgstr "" 219 219 220 #: builders/class-template-kit-export-builders-elementor.php:3 05220 #: builders/class-template-kit-export-builders-elementor.php:310 221 221 msgid "Gallery" 222 222 msgstr "" 223 223 224 #: builders/class-template-kit-export-builders-elementor.php:3 06224 #: builders/class-template-kit-export-builders-elementor.php:311 225 225 msgid "Logo Grid" 226 226 msgstr "" 227 227 228 #: builders/class-template-kit-export-builders-elementor.php:3 07228 #: builders/class-template-kit-export-builders-elementor.php:312 229 229 msgid "Clients" 230 230 msgstr "" 231 231 232 #: builders/class-template-kit-export-builders-elementor.php:3 08232 #: builders/class-template-kit-export-builders-elementor.php:313 233 233 msgid "Other" 234 234 msgstr "" 235 235 236 #: builders/class-template-kit-export-builders-elementor.php:31 1236 #: builders/class-template-kit-export-builders-elementor.php:316 237 237 msgid "Global Kit Styles" 238 238 msgstr "" 239 239 240 #: builders/class-template-kit-export-builders-elementor.php:32 1240 #: builders/class-template-kit-export-builders-elementor.php:326 241 241 msgid "Elementor Pro Required" 242 242 msgstr "" 243 243 244 #: builders/class-template-kit-export-builders-elementor.php:4 65244 #: builders/class-template-kit-export-builders-elementor.php:475 245 245 msgid "Please install the \"Elementor\" Plugin to continue." 246 246 msgstr "" 247 247 248 #: builders/class-template-kit-export-builders-elementor.php:4 69248 #: builders/class-template-kit-export-builders-elementor.php:479 249 249 msgid "Please ensure the \"Hello Elementor\" theme is installed and active on this site." 250 250 msgstr "" -
template-kit-export/trunk/template-kit-export.php
r2251744 r2262094 3 3 * Plugin Name: Template Kit Export 4 4 * Description: Use this plugin to export Template Kits for Elementor. 5 * Version: 1.0. 55 * Version: 1.0.6 6 6 * Author: Envato 7 7 * Author URI: https://envato.com … … 19 19 * Currently plugin version. 20 20 */ 21 define( 'TEMPLATE_KIT_EXPORT_VERSION', '1.0. 5' );21 define( 'TEMPLATE_KIT_EXPORT_VERSION', '1.0.6' ); 22 22 23 23 /**
Note: See TracChangeset
for help on using the changeset viewer.