Changeset 3473761
- Timestamp:
- 03/03/2026 02:40:40 PM (4 weeks ago)
- Location:
- qode-optimizer/trunk
- Files:
-
- 3 deleted
- 18 edited
-
class-qode-optimizer.php (modified) (1 diff)
-
classes/class-qode-optimizer-log.php (modified) (1 diff)
-
classes/class-qode-optimizer-media.php (modified) (4 diffs)
-
classes/class-qode-optimizer-utility.php (modified) (1 diff)
-
constants.php (modified) (2 diffs)
-
helpers/helper.php (modified) (3 diffs)
-
inc/admin/helpers/helper.php (modified) (3 diffs)
-
inc/admin/inc/admin-media/assets/js/admin-media.js (modified) (1 diff)
-
inc/admin/inc/admin-media/assets/js/admin-media.min.js (modified) (1 diff)
-
inc/admin/inc/admin-pages/options-custom-pages/qode-products/templates/parts/plugins.php (modified) (1 diff)
-
inc/admin/inc/common/assets/plugins/wp-color-picker-alpha/wp-color-picker-alpha.js (modified) (1 diff)
-
inc/admin/inc/common/core/class-qode-optimizer-framework-options.php (modified) (1 diff)
-
inc/admin/inc/common/fields-wp/class-qode-optimizer-framework-field-wp-color.php (modified) (1 diff)
-
inc/admin/inc/common/fields-wp/class-qode-optimizer-framework-field-wp-textareasvg.php (modified) (1 diff)
-
inc/admin/inc/common/fields-wp/class-qode-optimizer-framework-field-wp-type.php (modified) (2 diffs)
-
inc/admin/inc/common/fields/class-qode-optimizer-framework-field-type.php (modified) (1 diff)
-
inc/admin/inc/common/modules/admin/templates/navigation.php (modified) (1 diff)
-
logs (deleted)
-
readme.txt (modified) (2 diffs)
-
tools (deleted)
-
vendor/fileeye/pel/README.markdown (deleted)
Legend:
- Unmodified
- Added
- Removed
-
qode-optimizer/trunk/class-qode-optimizer.php
r3470052 r3473761 6 6 * Author: Qode Interactive 7 7 * Author URI: https://qodeinteractive.com/ 8 * Version: 1.2 8 * Version: 1.2.1 9 9 * Requires at least: 6.3 10 10 * Requires PHP: 7.4 -
qode-optimizer/trunk/classes/class-qode-optimizer-log.php
r3470052 r3473761 32 32 * @var string $log_file 33 33 */ 34 private $log_file = QODE_OPTIMIZER_INNER_LOGS_FOLDER_PATH . DIRECTORY_SEPARATOR . 'log.txt';34 private $log_file = ''; 35 35 36 36 /** -
qode-optimizer/trunk/classes/class-qode-optimizer-media.php
r3470052 r3473761 17 17 */ 18 18 public function init() { 19 add_action( 'print_media_templates', array( $this, 'print_media_templates' ) ); 19 20 add_filter( 'manage_media_columns', array( $this, 'manage_media_columns' ) ); 20 21 add_action( 'manage_media_custom_column', array( $this, 'add_media_custom_column' ), 10, 2 ); … … 33 34 34 35 /** 36 * Add custom div with data nonce attribute right after all media templates are rendered. 37 */ 38 public function print_media_templates() { 39 $qo_nonce = wp_create_nonce( 'qo-nonce' ); 40 41 echo '<div id="qode-optimizer-custom-nonce-container" data-qo-nonce="' . esc_html( $qo_nonce ) . '"></div>'; 42 } 43 44 /** 35 45 * Add column header for optimizer results in the media library listing. 36 46 * … … 65 75 $html = $this->init_action_buttons_and_info( $id ); 66 76 67 echo qode_optimizer_framework_wp_kses_html( 'html',$html ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped77 echo wp_kses_post( $html ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 68 78 } 69 79 } … … 356 366 if ( isset( $_POST ) && ! empty( $_POST ) ) { // phpcs:ignore WordPress.Security.NonceVerification 357 367 358 if ( ! wp_doing_ajax() ) { 359 wp_die( esc_html__( 'Access denied.', 'qode-optimizer' ) ); 368 if ( 369 empty( $_POST['options']['qo_nonce'] ) || 370 ! wp_verify_nonce( sanitize_key( $_POST['options']['qo_nonce'] ), 'qo-nonce' ) 371 ) { 372 if ( ! wp_doing_ajax() ) { 373 wp_die( esc_html__( 'Access denied.', 'qode-optimizer' ) ); 374 } 375 376 wp_die( wp_json_encode( array( 'error' => esc_html__( 'Access denied.', 'qode-optimizer' ) ) ) ); 360 377 } 361 378 -
qode-optimizer/trunk/classes/class-qode-optimizer-utility.php
r3470052 r3473761 933 933 $file_body = wp_remote_retrieve_body( $response ); 934 934 935 $local_file_path = QODE_OPTIMIZER_ INNER_LOGS_FOLDER_PATH . DIRECTORY_SEPARATOR . 'filename.txt';935 $local_file_path = QODE_OPTIMIZER_TOOLS_FOLDER_PATH . DIRECTORY_SEPARATOR . 'filename.txt'; 936 936 937 937 $filesystem = new Qode_Optimizer_Filesystem( true ); -
qode-optimizer/trunk/constants.php
r3470052 r3473761 6 6 } 7 7 8 define( 'QODE_OPTIMIZER_VERSION', '1.2 ' );8 define( 'QODE_OPTIMIZER_VERSION', '1.2.1' ); 9 9 // Use the __DIR__ constant instead of calling dirname(__FILE__) (PHP >= 5.3). 10 10 define( 'QODE_OPTIMIZER_ABS_PATH', __DIR__ ); … … 34 34 define( 'QODE_OPTIMIZER_TOOLS_FOLDER_PATH', QODE_OPTIMIZER_ABS_PATH . '/tools' ); 35 35 define( 'QODE_OPTIMIZER_DEMO_FOLDER_PATH', QODE_OPTIMIZER_ABS_PATH . '/demo' ); 36 define( 'QODE_OPTIMIZER_INNER_LOGS_FOLDER_PATH', QODE_OPTIMIZER_ABS_PATH . '/logs' );37 36 define( 'QODE_OPTIMIZER_EXTERNAL_LOGS_RELATIVE_FOLDER_PATH', 'qode-optimizer-logs' ); 38 37 define( 'QODE_OPTIMIZER_SAMPLES_FOLDER_PATH', QODE_OPTIMIZER_ABS_PATH . '/samples' ); -
qode-optimizer/trunk/helpers/helper.php
r3203093 r3473761 215 215 216 216 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 217 echo qode_optimizer_framework_wp_kses_html( 'html',$svg_template_part );217 echo wp_kses_post( $svg_template_part ); 218 218 } 219 219 } … … 300 300 301 301 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 302 echo qode_optimizer_framework_wp_kses_html( 'attributes',$inline_style_part );302 echo wp_kses_post( $inline_style_part ); 303 303 } 304 304 } … … 330 330 331 331 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 332 echo qode_optimizer_framework_wp_kses_html( 'attributes',$inline_attrs_part );332 echo wp_kses_post( $inline_attrs_part ); 333 333 } 334 334 } -
qode-optimizer/trunk/inc/admin/helpers/helper.php
r3166439 r3473761 19 19 20 20 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 21 echo qode_optimizer_framework_wp_kses_html( 'html',$module_template_part );21 echo wp_kses_post( $module_template_part ); 22 22 } 23 23 } … … 124 124 125 125 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 126 echo qode_optimizer_framework_wp_kses_html( 'html',$svg_template_part );126 echo wp_kses_post( $svg_template_part ); 127 127 } 128 128 } … … 163 163 } 164 164 165 if ( ! function_exists( 'qode_optimizer_framework_wp_kses_html' ) ) { 166 /** 167 * Function that does escape of specific html. 168 * It uses wp_kses function with predefined attributes array. 169 * 170 * @see wp_kses() 171 * 172 * @param string $type - type of html element 173 * @param string $content - string to escape 174 * 175 * @return string escaped output 176 */ 177 function qode_optimizer_framework_wp_kses_html( $type, $content ) { 178 switch ( $type ) { 179 case 'description': 180 $atts = array( 181 'code' => apply_filters( 182 'qode_optimizer_filter_framework_wp_kses_description_atts', 183 array() 184 ), 185 ); 186 break; 187 case 'img': 188 $atts = array( 189 'img' => apply_filters( 190 'qode_optimizer_filter_framework_wp_kses_img_atts', 191 array( 192 'itemprop' => true, 193 'id' => true, 194 'class' => true, 195 'width' => true, 196 'height' => true, 197 'src' => true, 198 'srcset' => true, 199 'sizes' => true, 200 'alt' => true, 201 'title' => true, 202 ) 203 ), 204 ); 205 break; 206 case 'svg': 207 $atts = apply_filters( 208 'qode_optimizer_filter_framework_wp_kses_svg_atts', 209 array( 210 'svg' => array( 211 'xmlns' => true, 212 'version' => true, 213 'id' => true, 214 'class' => true, 215 'x' => true, 216 'y' => true, 217 'aria-hidden' => true, 218 'aria-labelledby' => true, 219 'role' => true, 220 'width' => true, 221 'height' => true, 222 'viewbox' => true, 223 'enable-background' => true, 224 'focusable' => true, 225 'data-prefix' => true, 226 'data-icon' => true, 227 ), 228 'g' => array( 229 'stroke' => true, 230 'stroke-width' => true, 231 'fill' => true, 232 'fill-opacity' => true, 233 'transform' => true, 234 ), 235 'rect' => array( 236 'x' => true, 237 'y' => true, 238 'width' => true, 239 'height' => true, 240 'stroke' => true, 241 'stroke-width' => true, 242 'fill' => true, 243 'fill-opacity' => true, 244 'transform' => true, 245 'rx' => true, 246 'ry' => true, 247 ), 248 'title' => array( 249 'title' => true, 250 'class' => true, 251 'style' => true, 252 ), 253 'path' => array( 254 'd' => true, 255 'stroke' => true, 256 'stroke-width' => true, 257 'fill' => true, 258 'fill-opacity' => true, 259 'transform' => true, 260 'pathlength' => true, 261 ), 262 'polygon' => array( 263 'points' => true, 264 'transform' => true, 265 ), 266 'line' => array( 267 'x1' => true, 268 'x2' => true, 269 'y1' => true, 270 'y2' => true, 271 'stroke' => true, 272 'stroke-width' => true, 273 'transform' => true, 274 ), 275 'polyline' => array( 276 'points' => true, 277 'stroke' => true, 278 'fill' => true, 279 'transform' => true, 280 ), 281 'circle' => array( 282 'cx' => true, 283 'cy' => true, 284 'r' => true, 285 'stroke' => true, 286 'stroke-width' => true, 287 'fill' => true, 288 'fill-opacity' => true, 289 'transform' => true, 290 ), 291 'ellipse' => array( 292 'class' => true, 293 'cx' => true, 294 'cy' => true, 295 'rx' => true, 296 'ry' => true, 297 'stroke' => true, 298 'stroke-width' => true, 299 'fill' => true, 300 'fill-opacity' => true, 301 'transform' => true, 302 ), 303 'text' => array( 304 'x' => true, 305 'y' => true, 306 'class' => true, 307 'style' => true, 308 'transform' => true, 309 ), 310 ) 311 ); 312 break; 313 case 'content': 314 $atts = apply_filters( 315 'qode_optimizer_filter_framework_wp_kses_content_atts', 316 array( 317 'div' => array( 318 'id' => true, 319 'class' => true, 320 'style' => true, 321 ), 322 'ul' => array( 323 'class' => true, 324 ), 325 'li' => array( 326 'class' => true, 327 ), 328 'br' => true, 329 'h1' => array( 330 'class' => true, 331 'style' => true, 332 ), 333 'h2' => array( 334 'class' => true, 335 'style' => true, 336 ), 337 'h3' => array( 338 'class' => true, 339 'style' => true, 340 ), 341 'h4' => array( 342 'class' => true, 343 'style' => true, 344 ), 345 'h5' => array( 346 'class' => true, 347 'style' => true, 348 ), 349 'h6' => array( 350 'class' => true, 351 'style' => true, 352 ), 353 'p' => array( 354 'id' => true, 355 'class' => true, 356 'style' => true, 357 ), 358 'a' => array( 359 'itemprop' => true, 360 'id' => true, 361 'class' => true, 362 'href' => true, 363 'target' => true, 364 'style' => true, 365 'rel' => true, 366 'data-rel' => true, 367 ), 368 'span' => array( 369 'id' => true, 370 'class' => true, 371 'style' => true, 372 ), 373 'i' => array( 374 'class' => true, 375 ), 376 'img' => array( 377 'itemprop' => true, 378 'id' => true, 379 'class' => true, 380 'width' => true, 381 'height' => true, 382 'src' => true, 383 'srcset' => true, 384 'sizes' => true, 385 'alt' => true, 386 'title' => true, 387 ), 388 ) 389 ); 390 break; 391 default: 392 return apply_filters( 'qode_optimizer_framework_filter_wp_kses_custom', $content, $type ); 393 } 394 395 return wp_kses( $content, $atts ); 396 } 165 166 if ( ! function_exists( 'qode_optimizer_framework_extend_wp_kses_allowed_html' ) ) { 167 /** 168 * Function that extend an array of allowed HTML tags and attributes for a given context. 169 * 170 * @param array $allowedposttags 171 * @param string|array $context The context for which to retrieve tags. Allowed values are 'post', 172 * 'strip', 'data', 'entities', or the name of a field filter such as 173 * 'pre_user_description', or an array of allowed HTML elements and attributes. 174 * 175 * @return array Array of allowed HTML tags and their allowed attributes. 176 */ 177 function qode_optimizer_framework_extend_wp_kses_allowed_html( $allowedposttags, $context ) { 178 179 if ( 'post' === $context ) { 180 $svg_atts = apply_filters( 181 'qode_optimizer_filter_framework_wp_kses_svg_atts', 182 array( 183 'svg' => array( 184 'xmlns' => true, 185 'version' => true, 186 'id' => true, 187 'class' => true, 188 'x' => true, 189 'y' => true, 190 'aria-hidden' => true, 191 'aria-labelledby' => true, 192 'role' => true, 193 'width' => true, 194 'height' => true, 195 'viewbox' => true, 196 'enable-background' => true, 197 'focusable' => true, 198 'data-prefix' => true, 199 'data-icon' => true, 200 ), 201 'g' => array( 202 'stroke' => true, 203 'stroke-width' => true, 204 'fill' => true, 205 'fill-opacity' => true, 206 'transform' => true, 207 'clip-path' => true, 208 'mask' => true, 209 ), 210 'rect' => array( 211 'x' => true, 212 'y' => true, 213 'width' => true, 214 'height' => true, 215 'stroke' => true, 216 'stroke-width' => true, 217 'fill' => true, 218 'fill-rule' => true, 219 'fill-opacity' => true, 220 'transform' => true, 221 'rx' => true, 222 'ry' => true, 223 ), 224 'path' => array( 225 'd' => true, 226 'stroke' => true, 227 'stroke-width' => true, 228 'fill' => true, 229 'fill-opacity' => true, 230 'transform' => true, 231 'pathlength' => true, 232 ), 233 'polygon' => array( 234 'fill' => true, 235 'fill-rule' => true, 236 'points' => true, 237 'transform' => true, 238 ), 239 'line' => array( 240 'x1' => true, 241 'x2' => true, 242 'y1' => true, 243 'y2' => true, 244 'fill' => true, 245 'fill-rule' => true, 246 'stroke' => true, 247 'stroke-width' => true, 248 'transform' => true, 249 ), 250 'polyline' => array( 251 'points' => true, 252 'stroke' => true, 253 'fill' => true, 254 'transform' => true, 255 ), 256 'circle' => array( 257 'cx' => true, 258 'cy' => true, 259 'r' => true, 260 'stroke' => true, 261 'stroke-width' => true, 262 'fill' => true, 263 'fill-opacity' => true, 264 'transform' => true, 265 ), 266 'ellipse' => array( 267 'class' => true, 268 'cx' => true, 269 'cy' => true, 270 'rx' => true, 271 'ry' => true, 272 'stroke' => true, 273 'stroke-width' => true, 274 'fill' => true, 275 'fill-opacity' => true, 276 'transform' => true, 277 ), 278 'text' => array( 279 'x' => true, 280 'y' => true, 281 'class' => true, 282 'style' => true, 283 'transform' => true, 284 ), 285 'mask' => array( 286 'id' => true, 287 'fill' => true, 288 'style' => true, 289 'maskUnits' => true, 290 'x' => true, 291 'y' => true, 292 'width' => true, 293 'height' => true, 294 ), 295 'defs' => array( 296 'id' => true, 297 ), 298 'clipPath' => array( 299 'id' => true, 300 ), 301 ) 302 ); 303 304 $allowedposttags['form'] = array( 305 'action' => true, 306 'method' => true, 307 'enctype' => true, 308 'id' => true, 309 'class' => true, 310 'target' => true, 311 'autocomplete' => true, 312 'novalidate' => true, 313 'accept-charset' => true, 314 'data-*' => true, 315 ); 316 317 318 $allowedposttags['input'] = array( 319 'type' => true, 320 'name' => true, 321 'value' => true, 322 'id' => true, 323 'class' => true, 324 'placeholder' => true, 325 'checked' => true, 326 'disabled' => true, 327 'readonly' => true, 328 'size' => true, 329 'maxlength' => true, 330 'min' => true, 331 'max' => true, 332 'step' => true, 333 'autocomplete' => true, 334 'pattern' => true, 335 'required' => true, 336 'multiple' => true, 337 'src' => true, 338 'alt' => true, 339 'accept' => true, 340 'data-*' => true, 341 ); 342 343 $allowedposttags['select'] = array( 344 'name' => true, 345 'class' => true, 346 'id' => true, 347 'multiple' => true, 348 'required' => true, 349 'disabled' => true, 350 'size' => true, 351 'data-*' => true, 352 ); 353 354 355 $allowedposttags['option'] = array( 356 'value' => true, 357 'selected' => true, 358 'disabled' => true, 359 'label' => true, 360 ); 361 362 363 $allowedposttags['textarea'] = array( 364 'name' => true, 365 'class' => true, 366 'id' => true, 367 'rows' => true, 368 'cols' => true, 369 'placeholder' => true, 370 'required' => true, 371 'disabled' => true, 372 'readonly' => true, 373 'maxlength' => true, 374 'data-*' => true, 375 ); 376 377 $allowedposttags = array_merge( $allowedposttags, $svg_atts ); 378 } 379 380 return $allowedposttags; 381 } 382 383 add_filter( 'wp_kses_allowed_html', 'qode_optimizer_framework_extend_wp_kses_allowed_html', 10, 2 ); 397 384 } 398 385 -
qode-optimizer/trunk/inc/admin/inc/admin-media/assets/js/admin-media.js
r3470052 r3473761 624 624 625 625 ajaxInitButtonsAndInfoHtml: function ( options ) { 626 var $customNonceContainer = $( '#qode-optimizer-custom-nonce-container' ); 627 628 if ( $customNonceContainer.length ) { 629 options.qo_nonce = $customNonceContainer.data( 'qo-nonce' ); 630 } 631 626 632 return $.ajax( 627 633 { -
qode-optimizer/trunk/inc/admin/inc/admin-media/assets/js/admin-media.min.js
r3470052 r3473761 1 !function(a){"use strict";"object"!=typeof qodefFramework&&(window.qodefFramework={}),a(document).ready(function(){e.init(),"undefined"!=typeof wp&&void 0!==wp.media&&void 0!==wp.media.frame&&wp.media.frame.on("edit:attachment",function(i){var s="",t={id:i.id};e.ajaxInitButtonsAndInfoHtml(t).then(function(i){var t=a.parseJSON(i);""!==(s=t.data)&&(wp.media.frame.$el.find(".settings").append('<div class="setting qodef-plugin-info" data-setting="qode-optimizer"><div class="name">Qode Optimizer</div><div class="value">'+s+"</div></div>"),e.initAction(wp.media.frame.$el.find(".qodef-media-action-holder")))})})});var e={init:function(){this.qodefMediaMainTable=a(".wp-list-table.media"),this.qodefMediaActionHolder=a(".qodef-media-action-holder"),this.qodefMediaActionHolder.length&&this.qodefMediaActionHolder.each(function(){var i=a(this);e.initAction(i)})},initAction:function(i){if(i.length){var s=i.find(".qodef-media-action-links"),t=i.find(".qodef-media-original-results"),n=i.find(".qodef-media-action-results");i.on("click",".qodef-media-action-link.qodef-optimize-manual",function(t){t.preventDefault(),t.stopPropagation();var d=a(this),o=i.find(".qodef-spinner-loading"),p={id:d.data("id"),qo_nonce:d.data("qo-nonce")};n.html(""),s.find(".qodef-media-action-link").remove(),o.removeClass("qodef-hidden"),e.ajaxOptimizeProcess(p,n,d,o).then(function(){o.addClass("qodef-hidden").find(".qodef-action-label").text(""),setTimeout(function(){n.addClass("qodef-init")},100),e.ajaxButtons(p,s)})}),i.on("click",".qodef-media-action-link.qodef-restore-manual",function(t){t.preventDefault(),t.stopPropagation();var d=a(this),o=i.find(".qodef-spinner-loading"),p={id:d.data("id"),qo_nonce:d.data("qo-nonce")};n.html(""),s.find(".qodef-media-action-link").remove(),o.removeClass("qodef-hidden"),e.ajaxRestore(p,n,d,o).then(function(){o.addClass("qodef-hidden").find(".qodef-action-label").text(""),e.ajaxButtons(p,s)})}),i.on("click",".qodef-media-action-link.qodef-recover-manual",function(t){t.preventDefault(),t.stopPropagation();var d=a(this),o=i.find(".qodef-spinner-loading"),p={id:d.data("id"),qo_nonce:d.data("qo-nonce")};n.html(""),s.find(".qodef-media-action-link").remove(),o.removeClass("qodef-hidden"),e.ajaxRecover(p,n,d,o).then(function(){o.addClass("qodef-hidden").find(".qodef-action-label").text(""),e.ajaxButtons(p,s)})}),i.on("click",".qodef-media-action-link.qodef-regenerate-manual",function(d){d.preventDefault(),d.stopPropagation();var o=a(this),p=i.find(".qodef-spinner-loading"),l={id:o.data("id"),qo_nonce:o.data("qo-nonce")};n.html(""),s.find(".qodef-media-action-link").remove(),p.removeClass("qodef-hidden"),e.ajaxRegenerate(l,t,n,o,p).then(function(){p.addClass("qodef-hidden").find(".qodef-action-label").text(""),e.ajaxButtons(l,s)})}),i.on("click",".qodef-media-action-link.qodef-add-watermark-manual",function(d){d.preventDefault(),d.stopPropagation();var o=a(this),p=i.find(".qodef-spinner-loading"),l={id:o.data("id"),qo_nonce:o.data("qo-nonce")};n.html(""),s.find(".qodef-media-action-link").remove(),p.removeClass("qodef-hidden"),e.ajaxAddWatermark(l,t,n,o,p).then(function(){p.addClass("qodef-hidden").find(".qodef-action-label").text(""),e.ajaxButtons(l,s)})})}},ajaxShouldBeConverted:function(e){return a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_should_be_converted",options:e}})},ajaxOptimizeProcess:function(i,s,t,n){return s.removeClass("qodef-init"),n.find(".qodef-action-label").text("Optimizing..."),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_optimize_process",options:i},success:function(t){var n=a.parseJSON(t),d=!1,o=!1,p=!1,l=!1,r=!1,m=!1, f=!1,c=!1,u=!1,v=!1;if(n.data.params.watermarked_files.length&&(d=n.data.params.watermarked_files.map(a=>a.params.media_size).indexOf("original"),-1!==(o=n.data.params.watermarked_files.map(a=>a.params.media_size).indexOf("scaled"))&&(d=o)),n.data.params.optimization_files.length&&(p=n.data.params.optimization_files.map(a=>a.params.media_size).indexOf("original"),-1!==(l=n.data.params.optimization_files.map(a=>a.params.media_size).indexOf("scaled"))&&(p=l)),n.data.params.conversion_files.length&&(r=n.data.params.conversion_files.map(a=>a.params.media_size).indexOf("original"),-1!==(m=n.data.params.conversion_files.map(a=>a.params.media_size).indexOf("scaled"))&&(r=m)),n.data.params.optimization2_files.length&&(f=n.data.params.optimization2_files.map(a=>a.params.media_size).indexOf("original"),-1!==(c=n.data.params.optimization2_files.map(a=>a.params.media_size).indexOf("scaled"))&&(f=c)),n.data.params.webp_files.length&&(u=n.data.params.webp_files.map(a=>a.params.media_size).indexOf("original"),-1!==(v=n.data.params.webp_files.map(a=>a.params.media_size).indexOf("scaled"))&&(u=v)),"success"===n.status){if(n.data.params.restoration_success&&s.append('<div><span class="qodef-title">Restoration:</span> <span class="qodef-value">'+n.data.params.restoration_result+"</span></div>"),n.data.params.watermarked_success&&!1!==d||n.data.params.optimization_success&&!1!==p||n.data.params.conversion_success&&!1!==r||n.data.params.optimization2_success&&!1!==f){if(n.data.params.watermarked_skipped||(n.data.params.watermarked_success&&!1!==d?s.append('<div><span class="qodef-title">Watermarked:</span> <span class="qodef-value">'+n.data.params.watermarked_files[d].params.filesize+", "+n.data.params.watermarked_files[d].params.result+"</span></div>"):s.append('<div><span class="qodef-title">Watermarked:</span> <span class="qodef-value">'+n.data.params.watermarked_result+"</span></div>")),n.data.params.optimization_success&&!1!==p?s.append('<div><span class="qodef-title">Optimization:</span> <span class="qodef-value">'+n.data.params.optimization_files[p].params.filesize+", "+n.data.params.optimization_files[p].params.result+"</span></div>"):s.append('<div><span class="qodef-title">Optimization:</span> <span class="qodef-value">'+n.data.params.optimization_result+"</span></div>"),n.data.params.conversion_skipped);else if(n.data.params.conversion_success&&!1!==r){var q=e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename .screen-reader-text").html();e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename").html('<span class="screen-reader-text">'+q+"</span>"+n.data.params.conversion_files[r].params.file_basename),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .copy button").attr("data-clipboard-text",n.data.params.conversion_files[r].params.url),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .download a").attr("href",n.data.params.conversion_files[r].params.url),s.append('<div><span class="qodef-title">Conversion:</span> <span class="qodef-value">'+n.data.params.conversion_files[r].params.filesize+", "+n.data.params.conversion_files[r].params.result+"</span></div>")}else s.append('<div><span class="qodef-title">Conversion:</span> <span class="qodef-value">'+n.data.params.conversion_result+"</span></div>");n.data.params.optimization2_skipped||(n.data.params.optimization2_success&&!1!==f?s.append('<div><span class="qodef-title">Compression:</span> <span class="qodef-value">'+n.data.params.optimization2_files[f].params.filesize+", "+n.data.params.optimization2_files[f].params.result+"</span></div>"):s.append('<div><span class="qodef-title">Compression:</span> <span class="qodef-value">'+n.data.params.optimization2_result+"</span></div>"))}n.data.params.webp_skipped||(n.data.params.webp_success&&!1!==u?s.append('<div><span class="qodef-title">WebP:</span> <span class="qodef-value">'+n.data.params.webp_files[u].params.filesize+", "+n.data.params.webp_files[u].params.result+"</span></div>"):s.append('<div><span class="qodef-title">WebP:</span> <span class="qodef-value">'+n.data.params.webp_result+"</span></div>"))}else s.append('<div><span class="qodef-title">Optimization:</span> <span class="qodef-value">'+n.data.params.optimization_result+"</span></div>");n.data.params.elapsed_time&&s.append('<div><span class="qodef-title">Elapsed time:</span> <span class="qodef-value">'+n.data.params.elapsed_time+"</span></div>")},complete:function(){console.log("Optimization finished!")}})},ajaxRestore:function(i,s,t,n){return n.find(".qodef-action-label").text("Restoring..."),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_restore",options:i},success:function(t){var n=a.parseJSON(t);if("success"===n.status){s.append('<div><span class="qodef-title">Restoration:</span> <span class="qodef-value">'+n.data.params.result+"</span></div>");var d=e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename .screen-reader-text").html();e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename").html('<span class="screen-reader-text">'+d+"</span>"+n.data.params.data.file_basename),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .copy button").attr("data-clipboard-text",n.data.params.data.url),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .download a").attr("href",n.data.params.data.url)}else s.append('<div><span class="qodef-title">Restoration:</span> <span class="qodef-value">'+n.data.params.result+"</span></div>");n.data.params.elapsed_time&&s.append('<div><span class="qodef-title">Elapsed time:</span> <span class="qodef-value">'+n.data.params.elapsed_time+"</span></div>")},complete:function(){console.log("Restoration Finished!")}})},ajaxRegenerate:function(e,i,s,t,n){return n.find(".qodef-action-label").text("Regenerating..."),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_regenerate",options:e},success:function(e){var t=a.parseJSON(e);"success"===t.status?(i.find(".qodef-value").html(t.data.params.filesize),s.append('<div><span class="qodef-title">Regeneration:</span> <span class="qodef-value">'+t.data.params.result+"</span></div>")):s.append('<div><span class="qodef-title">Regeneration:</span> <span class="qodef-value">'+t.data.params.result+"</span></div>"),t.data.params.elapsed_time&&s.append('<div><span class="qodef-title">Elapsed time:</span> <span class="qodef-value">'+t.data.params.elapsed_time+"</span></div>")},complete:function(){console.log("Regeneration Finished!")}})},ajaxAddWatermark:function(e,i,s,t,n){return n.find(".qodef-action-label").text("Adding Watermark..."),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_add_watermark",options:e},success:function(e){var i=a.parseJSON(e),t=!1,n=!1;i.data.params.files.length&&(t=i.data.params.files.map(a=>a.params.media_size).indexOf("original"),-1!==(n=i.data.params.files.map(a=>a.params.media_size).indexOf("scaled"))&&(t=n)),"success"===i.status&&i.data.params.success&&!1!==t?s.append('<div><span class="qodef-title">Watermarking:</span> <span class="qodef-value">'+i.data.params.files[t].params.filesize+", "+i.data.params.files[t].params.result+"</span></div>"):s.append('<div><span class="qodef-title">Watermarking:</span> <span class="qodef-value">'+i.data.params.result+"</span></div>"),i.data.params.elapsed_time&&s.append('<div><span class="qodef-title">Elapsed time:</span> <span class="qodef-value">'+i.data.params.elapsed_time+"</span></div>")},complete:function(){console.log("Adding Watermark Finished!")}})},ajaxRecover:function(i,s,t,n){return n.find(".qodef-action-label").text("Trying to recover..."),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_recover",options:i},success:function(t){var n=a.parseJSON(t);if("success"===n.status){s.append('<div><span class="qodef-title">Recover:</span> <span class="qodef-value">'+n.data.params.result+"</span></div>");var d=e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename .screen-reader-text").html();e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename").html('<span class="screen-reader-text">'+d+"</span>"+n.data.params.data.file_basename),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .copy button").attr("data-clipboard-text",n.data.params.data.url),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .download a").attr("href",n.data.params.data.url)}else s.append('<div><span class="qodef-title">Recover:</span> <span class="qodef-value">'+n.data.params.result+"</span></div>");n.data.params.elapsed_time&&s.append('<div><span class="qodef-title">Elapsed time:</span> <span class="qodef-value">'+n.data.params.elapsed_time+"</span></div>")},complete:function(){console.log("Recover Finished!")}})},ajaxInitButtonsAndInfoHtml:function(e){returna.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_init_action_buttons_and_info",options:e}})},ajaxButtons:function(e,i){return a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_include_action_buttons",options:e},success:function(e){var s=a.parseJSON(e);"success"===s.status&&i.prepend(s.data)}})}};qodefFramework.qodefMedia=e}(jQuery);1 !function(a){"use strict";"object"!=typeof qodefFramework&&(window.qodefFramework={}),a(document).ready(function(){e.init(),"undefined"!=typeof wp&&void 0!==wp.media&&void 0!==wp.media.frame&&wp.media.frame.on("edit:attachment",function(i){var s="",t={id:i.id};e.ajaxInitButtonsAndInfoHtml(t).then(function(i){var t=a.parseJSON(i);""!==(s=t.data)&&(wp.media.frame.$el.find(".settings").append('<div class="setting qodef-plugin-info" data-setting="qode-optimizer"><div class="name">Qode Optimizer</div><div class="value">'+s+"</div></div>"),e.initAction(wp.media.frame.$el.find(".qodef-media-action-holder")))})})});var e={init:function(){this.qodefMediaMainTable=a(".wp-list-table.media"),this.qodefMediaActionHolder=a(".qodef-media-action-holder"),this.qodefMediaActionHolder.length&&this.qodefMediaActionHolder.each(function(){var i=a(this);e.initAction(i)})},initAction:function(i){if(i.length){var s=i.find(".qodef-media-action-links"),t=i.find(".qodef-media-original-results"),n=i.find(".qodef-media-action-results");i.on("click",".qodef-media-action-link.qodef-optimize-manual",function(t){t.preventDefault(),t.stopPropagation();var d=a(this),o=i.find(".qodef-spinner-loading"),p={id:d.data("id"),qo_nonce:d.data("qo-nonce")};n.html(""),s.find(".qodef-media-action-link").remove(),o.removeClass("qodef-hidden"),e.ajaxOptimizeProcess(p,n,d,o).then(function(){o.addClass("qodef-hidden").find(".qodef-action-label").text(""),setTimeout(function(){n.addClass("qodef-init")},100),e.ajaxButtons(p,s)})}),i.on("click",".qodef-media-action-link.qodef-restore-manual",function(t){t.preventDefault(),t.stopPropagation();var d=a(this),o=i.find(".qodef-spinner-loading"),p={id:d.data("id"),qo_nonce:d.data("qo-nonce")};n.html(""),s.find(".qodef-media-action-link").remove(),o.removeClass("qodef-hidden"),e.ajaxRestore(p,n,d,o).then(function(){o.addClass("qodef-hidden").find(".qodef-action-label").text(""),e.ajaxButtons(p,s)})}),i.on("click",".qodef-media-action-link.qodef-recover-manual",function(t){t.preventDefault(),t.stopPropagation();var d=a(this),o=i.find(".qodef-spinner-loading"),p={id:d.data("id"),qo_nonce:d.data("qo-nonce")};n.html(""),s.find(".qodef-media-action-link").remove(),o.removeClass("qodef-hidden"),e.ajaxRecover(p,n,d,o).then(function(){o.addClass("qodef-hidden").find(".qodef-action-label").text(""),e.ajaxButtons(p,s)})}),i.on("click",".qodef-media-action-link.qodef-regenerate-manual",function(d){d.preventDefault(),d.stopPropagation();var o=a(this),p=i.find(".qodef-spinner-loading"),l={id:o.data("id"),qo_nonce:o.data("qo-nonce")};n.html(""),s.find(".qodef-media-action-link").remove(),p.removeClass("qodef-hidden"),e.ajaxRegenerate(l,t,n,o,p).then(function(){p.addClass("qodef-hidden").find(".qodef-action-label").text(""),e.ajaxButtons(l,s)})}),i.on("click",".qodef-media-action-link.qodef-add-watermark-manual",function(d){d.preventDefault(),d.stopPropagation();var o=a(this),p=i.find(".qodef-spinner-loading"),l={id:o.data("id"),qo_nonce:o.data("qo-nonce")};n.html(""),s.find(".qodef-media-action-link").remove(),p.removeClass("qodef-hidden"),e.ajaxAddWatermark(l,t,n,o,p).then(function(){p.addClass("qodef-hidden").find(".qodef-action-label").text(""),e.ajaxButtons(l,s)})})}},ajaxShouldBeConverted:function(e){return a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_should_be_converted",options:e}})},ajaxOptimizeProcess:function(i,s,t,n){return s.removeClass("qodef-init"),n.find(".qodef-action-label").text("Optimizing..."),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_optimize_process",options:i},success:function(t){var n=a.parseJSON(t),d=!1,o=!1,p=!1,l=!1,r=!1,m=!1,c=!1,f=!1,u=!1,v=!1;if(n.data.params.watermarked_files.length&&(d=n.data.params.watermarked_files.map(a=>a.params.media_size).indexOf("original"),-1!==(o=n.data.params.watermarked_files.map(a=>a.params.media_size).indexOf("scaled"))&&(d=o)),n.data.params.optimization_files.length&&(p=n.data.params.optimization_files.map(a=>a.params.media_size).indexOf("original"),-1!==(l=n.data.params.optimization_files.map(a=>a.params.media_size).indexOf("scaled"))&&(p=l)),n.data.params.conversion_files.length&&(r=n.data.params.conversion_files.map(a=>a.params.media_size).indexOf("original"),-1!==(m=n.data.params.conversion_files.map(a=>a.params.media_size).indexOf("scaled"))&&(r=m)),n.data.params.optimization2_files.length&&(c=n.data.params.optimization2_files.map(a=>a.params.media_size).indexOf("original"),-1!==(f=n.data.params.optimization2_files.map(a=>a.params.media_size).indexOf("scaled"))&&(c=f)),n.data.params.webp_files.length&&(u=n.data.params.webp_files.map(a=>a.params.media_size).indexOf("original"),-1!==(v=n.data.params.webp_files.map(a=>a.params.media_size).indexOf("scaled"))&&(u=v)),"success"===n.status){if(n.data.params.restoration_success&&s.append('<div><span class="qodef-title">Restoration:</span> <span class="qodef-value">'+n.data.params.restoration_result+"</span></div>"),n.data.params.watermarked_success&&!1!==d||n.data.params.optimization_success&&!1!==p||n.data.params.conversion_success&&!1!==r||n.data.params.optimization2_success&&!1!==c){if(n.data.params.watermarked_skipped||(n.data.params.watermarked_success&&!1!==d?s.append('<div><span class="qodef-title">Watermarked:</span> <span class="qodef-value">'+n.data.params.watermarked_files[d].params.filesize+", "+n.data.params.watermarked_files[d].params.result+"</span></div>"):s.append('<div><span class="qodef-title">Watermarked:</span> <span class="qodef-value">'+n.data.params.watermarked_result+"</span></div>")),n.data.params.optimization_success&&!1!==p?s.append('<div><span class="qodef-title">Optimization:</span> <span class="qodef-value">'+n.data.params.optimization_files[p].params.filesize+", "+n.data.params.optimization_files[p].params.result+"</span></div>"):s.append('<div><span class="qodef-title">Optimization:</span> <span class="qodef-value">'+n.data.params.optimization_result+"</span></div>"),n.data.params.conversion_skipped);else if(n.data.params.conversion_success&&!1!==r){var q=e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename .screen-reader-text").html();e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename").html('<span class="screen-reader-text">'+q+"</span>"+n.data.params.conversion_files[r].params.file_basename),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .copy button").attr("data-clipboard-text",n.data.params.conversion_files[r].params.url),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .download a").attr("href",n.data.params.conversion_files[r].params.url),s.append('<div><span class="qodef-title">Conversion:</span> <span class="qodef-value">'+n.data.params.conversion_files[r].params.filesize+", "+n.data.params.conversion_files[r].params.result+"</span></div>")}else s.append('<div><span class="qodef-title">Conversion:</span> <span class="qodef-value">'+n.data.params.conversion_result+"</span></div>");n.data.params.optimization2_skipped||(n.data.params.optimization2_success&&!1!==c?s.append('<div><span class="qodef-title">Compression:</span> <span class="qodef-value">'+n.data.params.optimization2_files[c].params.filesize+", "+n.data.params.optimization2_files[c].params.result+"</span></div>"):s.append('<div><span class="qodef-title">Compression:</span> <span class="qodef-value">'+n.data.params.optimization2_result+"</span></div>"))}n.data.params.webp_skipped||(n.data.params.webp_success&&!1!==u?s.append('<div><span class="qodef-title">WebP:</span> <span class="qodef-value">'+n.data.params.webp_files[u].params.filesize+", "+n.data.params.webp_files[u].params.result+"</span></div>"):s.append('<div><span class="qodef-title">WebP:</span> <span class="qodef-value">'+n.data.params.webp_result+"</span></div>"))}else s.append('<div><span class="qodef-title">Optimization:</span> <span class="qodef-value">'+n.data.params.optimization_result+"</span></div>");n.data.params.elapsed_time&&s.append('<div><span class="qodef-title">Elapsed time:</span> <span class="qodef-value">'+n.data.params.elapsed_time+"</span></div>")},complete:function(){console.log("Optimization finished!")}})},ajaxRestore:function(i,s,t,n){return n.find(".qodef-action-label").text("Restoring..."),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_restore",options:i},success:function(t){var n=a.parseJSON(t);if("success"===n.status){s.append('<div><span class="qodef-title">Restoration:</span> <span class="qodef-value">'+n.data.params.result+"</span></div>");var d=e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename .screen-reader-text").html();e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename").html('<span class="screen-reader-text">'+d+"</span>"+n.data.params.data.file_basename),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .copy button").attr("data-clipboard-text",n.data.params.data.url),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .download a").attr("href",n.data.params.data.url)}else s.append('<div><span class="qodef-title">Restoration:</span> <span class="qodef-value">'+n.data.params.result+"</span></div>");n.data.params.elapsed_time&&s.append('<div><span class="qodef-title">Elapsed time:</span> <span class="qodef-value">'+n.data.params.elapsed_time+"</span></div>")},complete:function(){console.log("Restoration Finished!")}})},ajaxRegenerate:function(e,i,s,t,n){return n.find(".qodef-action-label").text("Regenerating..."),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_regenerate",options:e},success:function(e){var t=a.parseJSON(e);"success"===t.status?(i.find(".qodef-value").html(t.data.params.filesize),s.append('<div><span class="qodef-title">Regeneration:</span> <span class="qodef-value">'+t.data.params.result+"</span></div>")):s.append('<div><span class="qodef-title">Regeneration:</span> <span class="qodef-value">'+t.data.params.result+"</span></div>"),t.data.params.elapsed_time&&s.append('<div><span class="qodef-title">Elapsed time:</span> <span class="qodef-value">'+t.data.params.elapsed_time+"</span></div>")},complete:function(){console.log("Regeneration Finished!")}})},ajaxAddWatermark:function(e,i,s,t,n){return n.find(".qodef-action-label").text("Adding Watermark..."),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_add_watermark",options:e},success:function(e){var i=a.parseJSON(e),t=!1,n=!1;i.data.params.files.length&&(t=i.data.params.files.map(a=>a.params.media_size).indexOf("original"),-1!==(n=i.data.params.files.map(a=>a.params.media_size).indexOf("scaled"))&&(t=n)),"success"===i.status&&i.data.params.success&&!1!==t?s.append('<div><span class="qodef-title">Watermarking:</span> <span class="qodef-value">'+i.data.params.files[t].params.filesize+", "+i.data.params.files[t].params.result+"</span></div>"):s.append('<div><span class="qodef-title">Watermarking:</span> <span class="qodef-value">'+i.data.params.result+"</span></div>"),i.data.params.elapsed_time&&s.append('<div><span class="qodef-title">Elapsed time:</span> <span class="qodef-value">'+i.data.params.elapsed_time+"</span></div>")},complete:function(){console.log("Adding Watermark Finished!")}})},ajaxRecover:function(i,s,t,n){return n.find(".qodef-action-label").text("Trying to recover..."),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_action_recover",options:i},success:function(t){var n=a.parseJSON(t);if("success"===n.status){s.append('<div><span class="qodef-title">Recover:</span> <span class="qodef-value">'+n.data.params.result+"</span></div>");var d=e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename .screen-reader-text").html();e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .filename").html('<span class="screen-reader-text">'+d+"</span>"+n.data.params.data.file_basename),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .copy button").attr("data-clipboard-text",n.data.params.data.url),e.qodefMediaMainTable.find("#post-"+i.id+" .column-title .row-actions .download a").attr("href",n.data.params.data.url)}else s.append('<div><span class="qodef-title">Recover:</span> <span class="qodef-value">'+n.data.params.result+"</span></div>");n.data.params.elapsed_time&&s.append('<div><span class="qodef-title">Elapsed time:</span> <span class="qodef-value">'+n.data.params.elapsed_time+"</span></div>")},complete:function(){console.log("Recover Finished!")}})},ajaxInitButtonsAndInfoHtml:function(e){var i=a("#qode-optimizer-custom-nonce-container");return i.length&&(e.qo_nonce=i.data("qo-nonce")),a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_init_action_buttons_and_info",options:e}})},ajaxButtons:function(e,i){return a.ajax({type:"POST",url:ajaxurl,data:{action:"qode_optimizer_media_include_action_buttons",options:e},success:function(e){var s=a.parseJSON(e);"success"===s.status&&i.prepend(s.data)}})}};qodefFramework.qodefMedia=e}(jQuery); -
qode-optimizer/trunk/inc/admin/inc/admin-pages/options-custom-pages/qode-products/templates/parts/plugins.php
r3166439 r3473761 21 21 22 22 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 23 echo qode_optimizer_framework_wp_kses_html( 'html',$plugin_link_template );23 echo wp_kses_post( $plugin_link_template ); 24 24 ?> 25 25 </div> -
qode-optimizer/trunk/inc/admin/inc/common/assets/plugins/wp-color-picker-alpha/wp-color-picker-alpha.js
r3166439 r3473761 5 5 * Only run in input and is defined data alpha in true 6 6 * 7 * Version: 3.0. 37 * Version: 3.0.4 8 8 * https://github.com/kallookoo/wp-color-picker-alpha 9 9 * Licensed under the GPLv2 license or later. 10 10 */ 11 12 ( function( $, undef ) { 13 14 var wpColorPickerAlpha = { 15 'version' : 302 16 }; 17 18 // Always try to use the last version of this script. 19 if ( 'wpColorPickerAlpha' in window && 'version' in window.wpColorPickerAlpha ) { 20 var version = parseInt( window.wpColorPickerAlpha.version, 10 ); 21 if ( ! isNaN( version ) && version >= wpColorPickerAlpha.version ) { 22 return; 23 } 24 } 25 26 // Prevent multiple initiations 27 if ( Color.fn.hasOwnProperty( 'to_s' ) ) { 28 return; 29 } 30 31 // Create new method to replace the `Color.toString()` inside the scripts. 32 Color.fn.to_s = function( type ) { 33 type = ( type || 'hex' ); 34 // Change hex to rgba to return the correct color. 35 if ( 'hex' === type && this._alpha < 1 ) { 36 type = 'rgba'; 37 } 38 39 var color = ''; 40 if ( 'hex' === type ) { 41 color = this.toString(); 42 } else if ( ! this.error ) { 43 color = this.toCSS( type ).replace( /\(\s+/, '(' ).replace( /\s+\)/, ')' ); 44 } 45 return color; 46 } 47 48 // Register the global variable. 49 window.wpColorPickerAlpha = wpColorPickerAlpha; 50 51 // Background image encoded 52 var backgroundImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg=='; 53 54 /** 55 * Iris 56 */ 57 $.widget( 'a8c.iris', $.a8c.iris, { 58 /** 59 * Alpha options 60 * 61 * @since 3.0.0 62 * 63 * @type {Object} 64 */ 65 alphaOptions: { 66 alphaEnabled: false, 67 }, 68 /** 69 * Get the current color or the new color. 70 * 71 * @since 3.0.0 72 * @access private 73 * 74 * @param {Object|*} The color instance if not defined return the cuurent color. 75 * 76 * @return {string} The element's color. 77 */ 78 _getColor: function( color ) { 79 if ( color === undef ) { 80 color = this._color; 81 } 82 83 if ( this.alphaOptions.alphaEnabled ) { 84 color = color.to_s( this.alphaOptions.alphaColorType ); 85 if ( ! this.alphaOptions.alphaColorWithSpace ) { 86 color = color.replace( /\s+/g, '' ); 87 } 88 return color; 89 } 90 return color.toString(); 91 }, 92 /** 93 * Create widget 94 * 95 * @since 3.0.0 96 * @access private 97 * 98 * @return {void} 99 */ 100 _create: function() { 101 try { 102 // Try to get the wpColorPicker alpha options. 103 this.alphaOptions = this.element.wpColorPicker( 'instance' ).alphaOptions; 104 } catch( e ) {} 105 106 // We make sure there are all options 107 $.extend( {}, this.alphaOptions, { 108 alphaEnabled: false, 109 alphaCustomWidth: 130, 110 alphaReset: false, 111 alphaColorType: 'hex', 112 alphaColorWithSpace: false, 113 alphaSkipDebounce: false, 114 alphaDebounceTimeout: 100, 115 } ); 116 117 this._super(); 118 }, 119 /** 120 * Binds event listeners to the Iris. 121 * 122 * @since 3.0.0 123 * @access private 124 * 125 * @return {void} 126 */ 127 _addInputListeners: function( input ) { 128 var self = this, 129 callback = function( event ){ 130 var val = input.val(), 131 color = new Color( val ), 132 val = val.replace( /^(#|(rgb|hsl)a?)/, '' ), 133 type = self.alphaOptions.alphaColorType; 134 135 input.removeClass( 'iris-error' ); 136 137 if ( ! color.error ) { 138 // let's not do this on keyup for hex shortcodes 139 if ( 'hex' !== type || ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) ) { 140 // Compare color ( #AARRGGBB ) 141 if ( color.toIEOctoHex() !== self._color.toIEOctoHex() ) { 142 self._setOption( 'color', self._getColor( color ) ); 143 } 144 } 145 } else if ( val !== '' ) { 146 input.addClass( 'iris-error' ); 147 } 148 }; 149 150 input.on( 'change', callback ); 151 152 if( ! self.alphaOptions.alphaSkipDebounce ) { 153 input.on( 'keyup', self._debounce( callback, self.alphaOptions.alphaDebounceTimeout ) ); 154 } 155 156 // If we initialized hidden, show on first focus. The rest is up to you. 157 if ( self.options.hide ) { 158 input.one( 'focus', function() { 159 self.show(); 160 }); 161 } 162 }, 163 /** 164 * Init Controls 165 * 166 * @since 3.0.0 167 * @access private 168 * 169 * @return {void} 170 */ 171 _initControls: function() { 172 this._super(); 173 174 if ( this.alphaOptions.alphaEnabled ) { 175 // Create Alpha controls 176 var self = this, 177 stripAlpha = self.controls.strip.clone(false, false), 178 stripAlphaSlider = stripAlpha.find( '.iris-slider-offset' ), 179 controls = { 180 stripAlpha : stripAlpha, 181 stripAlphaSlider : stripAlphaSlider 182 }; 183 184 stripAlpha.addClass( 'iris-strip-alpha' ); 185 stripAlphaSlider.addClass( 'iris-slider-offset-alpha' ); 186 stripAlpha.appendTo( self.picker.find( '.iris-picker-inner' ) ); 187 188 // Push new controls 189 $.each( controls, function( k, v ) { 190 self.controls[k] = v; 191 } ); 192 193 // Create slider 194 self.controls.stripAlphaSlider.slider( { 195 orientation : 'vertical', 196 min : 0, 197 max : 100, 198 step : 1, 199 value : parseInt( self._color._alpha * 100 ), 200 slide : function( event, ui ) { 201 self.active = 'strip'; 202 // Update alpha value 203 self._color._alpha = parseFloat( ui.value / 100 ); 204 self._change.apply( self, arguments ); 205 } 206 } ); 207 } 208 }, 209 /** 210 * Create the controls sizes 211 * 212 * @since 3.0.0 213 * @access private 214 * 215 * @param {bool} reset Set to True for recreate the controls sizes. 216 * 217 * @return {void} 218 */ 219 _dimensions: function( reset ) { 220 this._super( reset ); 221 222 if ( this.alphaOptions.alphaEnabled ) { 223 var self = this, 224 opts = self.options, 225 controls = self.controls, 226 square = controls.square, 227 strip = self.picker.find( '.iris-strip' ), 228 innerWidth, squareWidth, stripWidth, stripMargin, totalWidth; 229 230 /** 231 * I use Math.round() to avoid possible size errors, 232 * this function returns the value of a number rounded 233 * to the nearest integer. 234 * 235 * The width to append all widgets, 236 * if border is enabled, 22 is subtracted. 237 * 20 for css left and right property 238 * 2 for css border 239 */ 240 innerWidth = Math.round( self.picker.outerWidth( true ) - ( opts.border ? 22 : 0 ) ); 241 // The width of the draggable, aka square. 242 squareWidth = Math.round( square.outerWidth() ); 243 // The width for the sliders 244 stripWidth = Math.round( ( innerWidth - squareWidth ) / 2 ); 245 // The margin for the sliders 246 stripMargin = Math.round( stripWidth / 2 ); 247 // The total width of the elements. 248 totalWidth = Math.round( squareWidth + ( stripWidth * 2 ) + ( stripMargin * 2 ) ); 249 250 // Check and change if necessary. 251 while ( totalWidth > innerWidth ) { 252 stripWidth = Math.round( stripWidth - 2 ); 253 stripMargin = Math.round( stripMargin - 1 ); 254 totalWidth = Math.round( squareWidth + ( stripWidth * 2 ) + ( stripMargin * 2 ) ); 255 } 256 257 258 square.css( 'margin', '0' ); 259 strip.width( stripWidth ).css( 'margin-left', stripMargin + 'px' ); 260 } 261 }, 262 /** 263 * Callback to update the controls and the current color. 264 * 265 * @since 3.0.0 266 * @access private 267 * 268 * @return {void} 269 */ 270 _change: function() { 271 var self = this, 272 active = self.active; 273 274 self._super(); 275 276 if ( self.alphaOptions.alphaEnabled ) { 277 var controls = self.controls, 278 alpha = parseInt( self._color._alpha * 100 ), 279 color = self._color.toRgb(), 280 gradient = [ 281 'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%', 282 'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%' 283 ], 284 target = self.picker.closest( '.wp-picker-container' ).find( '.wp-color-result' ); 285 286 self.options.color = self._getColor(); 287 // Generate background slider alpha, only for CSS3. 288 controls.stripAlpha.css( { 'background' : 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + backgroundImage + ')' } ); 289 // Update alpha value 290 if ( active ) { 291 controls.stripAlphaSlider.slider( 'value', alpha ); 292 } 293 294 if ( ! self._color.error ) { 295 self.element.removeClass( 'iris-error' ).val( self.options.color ); 296 } 297 298 self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() { 299 var color = $( this ).data( 'color' ); 300 if ( self.alphaOptions.alphaReset ) { 301 self._color._alpha = 1; 302 color = self._getColor(); 303 } 304 self._setOption( 'color', color ); 305 } ); 306 } 307 }, 308 /** 309 * Paint dimensions. 310 * 311 * @since 3.0.0 312 * @access private 313 * 314 * @param {string} origin Origin (position). 315 * @param {string} control Type of the control, 316 * 317 * @return {void} 318 */ 319 _paintDimension: function( origin, control ) { 320 var self = this, 321 color = false; 322 323 // Fix for slider hue opacity. 324 if ( self.alphaOptions.alphaEnabled && 'strip' === control ) { 325 color = self._color; 326 self._color = new Color( color.toString() ); 327 self.hue = self._color.h(); 328 } 329 330 self._super( origin, control ); 331 332 // Restore the color after paint. 333 if ( color ) { 334 self._color = color; 335 } 336 }, 337 /** 338 * To update the options, see original source to view the available options. 339 * 340 * @since 3.0.0 341 * 342 * @param {string} key The Option name. 343 * @param {mixed} value The Option value to update. 344 * 345 * @return {void} 346 */ 347 _setOption: function( key, value ) { 348 var self = this; 349 if ( 'color' === key && self.alphaOptions.alphaEnabled ) { 350 // cast to string in case we have a number 351 value = '' + value; 352 newColor = new Color( value ).setHSpace( self.options.mode ); 353 // Check if error && Check the color to prevent callbacks with the same color. 354 if ( ! newColor.error && self._getColor( newColor ) !== self._getColor() ) { 355 self._color = newColor; 356 self.options.color = self._getColor(); 357 self.active = 'external'; 358 self._change(); 359 } 360 } else { 361 return self._super( key, value ); 362 } 363 }, 364 /** 365 * Returns the iris object if no new color is provided. If a new color is provided, it sets the new color. 366 * 367 * @param newColor {string|*} The new color to use. Can be undefined. 368 * 369 * @since 3.0.0 370 * 371 * @return {string} The element's color. 372 */ 373 color: function( newColor ) { 374 if ( newColor === true ) { 375 return this._color.clone(); 376 } 377 if ( newColor === undef ) { 378 return this._getColor(); 379 } 380 this.option( 'color', newColor ); 381 }, 382 } ); 383 384 /** 385 * wpColorPicker 386 */ 387 $.widget( 'wp.wpColorPicker', $.wp.wpColorPicker, { 388 /** 389 * Alpha options 390 * 391 * @since 3.0.0 392 * 393 * @type {Object} 394 */ 395 alphaOptions: { 396 alphaEnabled: false, 397 }, 398 /** 399 * Get the alpha options. 400 * 401 * @since 3.0.0 402 * @access private 403 * 404 * @return {object} The current alpha options. 405 */ 406 _getAlphaOptions: function() { 407 var el = this.element, 408 type = ( el.data( 'type' ) || this.options.type ), 409 color = ( el.data( 'defaultColor' ) || el.val() ), 410 options = { 411 alphaEnabled: ( el.data( 'alphaEnabled' ) || false ), 412 alphaCustomWidth: 130, 413 alphaReset: false, 414 alphaColorType: 'rgb', 415 alphaColorWithSpace: false, 416 alphaSkipDebounce: ( !!el.data( 'alphaSkipDebounce' ) || false ), 417 }; 418 419 if ( options.alphaEnabled ) { 420 options.alphaEnabled = ( el.is( 'input' ) && 'full' === type ); 421 } 422 423 if ( ! options.alphaEnabled ) { 424 return options; 425 } 426 427 options.alphaColorWithSpace = ( color && color.match( /\s/ ) ); 428 429 $.each( options, function( name, defaultValue ) { 430 var value = ( el.data( name ) || defaultValue ); 431 switch ( name ) { 432 case 'alphaCustomWidth': 433 value = ( value ? parseInt( value, 10 ) : 0 ); 434 value = ( isNaN( value ) ? defaultValue : value ); 435 break; 436 case 'alphaColorType': 437 if ( ! value.match( /^(hex|(rgb|hsl)a?)$/ ) ) { 438 if ( color && color.match( /^#/ ) ) { 439 value = 'hex'; 440 } else if ( color && color.match( /^hsla?/ ) ) { 441 value = 'hsl'; 442 } else { 443 value = defaultValue; 444 } 445 } 446 break; 447 default: 448 value = !!value; 449 break; 450 } 451 options[name] = value; 452 } ); 453 454 return options; 455 }, 456 /** 457 * Create widget 458 * 459 * @since 3.0.0 460 * @access private 461 * 462 * @return {void} 463 */ 464 _create: function() { 465 // Return early if Iris support is missing. 466 if ( ! $.support.iris ) { 467 return; 468 } 469 470 // Set the alpha options for the current instance. 471 this.alphaOptions = this._getAlphaOptions(); 472 473 // Create widget. 474 this._super(); 475 }, 476 /** 477 * Binds event listeners to the color picker and create options, etc... 478 * 479 * @since 3.0.0 480 * @access private 481 * 482 * @return {void} 483 */ 484 _addListeners: function() { 485 if ( ! this.alphaOptions.alphaEnabled ) { 486 return this._super(); 487 } 488 489 var self = this, 490 el = self.element, 491 isDeprecated = self.toggler.is( 'a' ); 492 493 this.alphaOptions.defaultWidth = el.width(); 494 if ( this.alphaOptions.alphaCustomWidth ) { 495 el.width( parseInt( this.alphaOptions.defaultWidth + this.alphaOptions.alphaCustomWidth, 10 ) ); 496 } 497 498 self.toggler.css( { 499 'position': 'relative', 500 'background-image' : 'url(' + backgroundImage + ')' 501 } ); 502 503 if ( isDeprecated ) { 504 self.toggler.html( '<span class="color-alpha" />' ); 505 } else { 506 self.toggler.append( '<span class="color-alpha" />' ); 507 } 508 509 self.colorAlpha = self.toggler.find( 'span.color-alpha' ).css( { 510 'width' : '30px', 511 'height' : '100%', 512 'position' : 'absolute', 513 'top' : 0, 514 'background-color' : el.val(), 515 } ); 516 517 // Define the correct position for ltr or rtl direction. 518 if ( 'ltr' === self.colorAlpha.css( 'direction' ) ) { 519 self.colorAlpha.css( { 520 'border-bottom-left-radius' : '2px', 521 'border-top-left-radius' : '2px', 522 'left' : 0 523 } ); 524 } else { 525 self.colorAlpha.css( { 526 'border-bottom-right-radius' : '2px', 527 'border-top-right-radius' : '2px', 528 'right' : 0 529 } ); 530 } 531 532 533 el.iris( { 534 /** 535 * @summary Handles the onChange event if one has been defined in the options. 536 * 537 * Handles the onChange event if one has been defined in the options and additionally 538 * sets the background color for the toggler element. 539 * 540 * @since 3.0.0 541 * 542 * @param {Event} event The event that's being called. 543 * @param {HTMLElement} ui The HTMLElement containing the color picker. 544 * 545 * @returns {void} 546 */ 547 change: function( event, ui ) { 548 self.colorAlpha.css( { 'background-color': ui.color.to_s( self.alphaOptions.alphaColorType ) } ); 549 550 // fire change callback if we have one 551 if ( typeof self.options.change === 'function' ) { 552 self.options.change.call( this, event, ui ); 553 } 554 } 555 } ); 556 557 558 /** 559 * Prevent any clicks inside this widget from leaking to the top and closing it. 560 * 561 * @since 3.0.0 562 * 563 * @param {Event} event The event that's being called. 564 * 565 * @return {void} 566 */ 567 self.wrap.on( 'click.wpcolorpicker', function( event ) { 568 event.stopPropagation(); 569 }); 570 571 /** 572 * Open or close the color picker depending on the class. 573 * 574 * @since 3.0.0 575 */ 576 self.toggler.on( 'click', function() { 577 if ( self.toggler.hasClass( 'wp-picker-open' ) ) { 578 self.close(); 579 } else { 580 self.open(); 581 } 582 }); 583 584 /** 585 * Checks if value is empty when changing the color in the color picker. 586 * If so, the background color is cleared. 587 * 588 * @since 3.0.0 589 * 590 * @param {Event} event The event that's being called. 591 * 592 * @return {void} 593 */ 594 el.on( 'change', function( event ) { 595 var val = $( this ).val(); 596 597 if ( el.hasClass( 'iris-error' ) || val === '' || val.match( /^(#|(rgb|hsl)a?)$/ ) ) { 598 if ( isDeprecated ) { 599 self.toggler.removeAttr( 'style' ); 600 } 601 602 self.colorAlpha.css( 'background-color', '' ); 603 604 // fire clear callback if we have one 605 if ( typeof self.options.clear === 'function' ) { 606 self.options.clear.call( this, event ); 607 } 608 } 609 } ); 610 611 /** 612 * Enables the user to either clear the color in the color picker or revert back to the default color. 613 * 614 * @since 3.0.0 615 * 616 * @param {Event} event The event that's being called. 617 * 618 * @return {void} 619 */ 620 self.button.on( 'click', function( event ) { 621 if ( $( this ).hasClass( 'wp-picker-default' ) ) { 622 el.val( self.options.defaultColor ).change(); 623 } else if ( $( this ).hasClass( 'wp-picker-clear' ) ) { 624 el.val( '' ); 625 if ( isDeprecated ) { 626 self.toggler.removeAttr( 'style' ); 627 } 628 629 self.colorAlpha.css( 'background-color', '' ); 630 631 // fire clear callback if we have one 632 if ( typeof self.options.clear === 'function' ) { 633 self.options.clear.call( this, event ); 634 } 635 636 el.trigger( 'change' ); 637 } 638 } ); 639 }, 640 } ); 641 } )( jQuery ); 11 !function($){var wpColorPickerAlpha={version:304};if("wpColorPickerAlpha"in window&&"version"in window.wpColorPickerAlpha){var version=parseInt(window.wpColorPickerAlpha.version,10);if(!isNaN(version)&&version>=wpColorPickerAlpha.version)return}if(!Color.fn.hasOwnProperty("to_s")){Color.fn.to_s=function(type){if(this.error)return"";"hex"===(type=type||"hex")&&this._alpha<1&&(type="rgba");var color="";if("hex"===type)color=this.toString();else if("octohex"===type){color=this.toString();var alpha=parseInt(255*this._alpha,10).toString(16);1===alpha.length&&(alpha=`0${alpha}`),color+=alpha}else color=this.toCSS(type).replace(/\(\s+/,"(").replace(/\s+\)/,")");return color},Color.fn.fromHex=function(color){if(3===(color=color.replace(/^#/,"").replace(/^0x/,"")).length||4===color.length){for(var extendedColor="",index=0;index<color.length;index++)extendedColor+=""+color[index],extendedColor+=""+color[index];color=extendedColor}if(8===color.length){if(/^[0-9A-F]{8}$/i.test(color)){var alpha=parseInt(color.substring(6),16);isNaN(alpha)?this._error():this.a(alpha/255)}else this._error();color=color.substring(0,6)}return this.error||(this.error=!/^[0-9A-F]{6}$/i.test(color)),this.fromInt(parseInt(color,16))},window.wpColorPickerAlpha=wpColorPickerAlpha;var backgroundImage="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==";$.widget("a8c.iris",$.a8c.iris,{alphaOptions:{alphaEnabled:!1},_getColor:function(color){return undefined===color&&(color=this._color),this.alphaOptions.alphaEnabled?(color=color.to_s(this.alphaOptions.alphaColorType),this.alphaOptions.alphaColorWithSpace||(color=color.replace(/\s+/g,"")),color):color.toString()},_create:function(){try{this.alphaOptions=this.element.wpColorPicker("instance").alphaOptions}catch(e){}$.extend({},this.alphaOptions,{alphaEnabled:!1,alphaCustomWidth:130,alphaReset:!1,alphaColorType:"hex",alphaColorWithSpace:!1,alphaSkipDebounce:!1,alphaDebounceTimeout:100}),this._super()},_addInputListeners:function(input){var self=this,callback=function(event){var val=input.val(),color=new Color(val),type=(val=val.replace(/^(#|(rgb|hsl)a?)/,""),self.alphaOptions.alphaColorType);input.removeClass("iris-error"),color.error?""!==val&&input.addClass("iris-error"):"hex"===type&&"keyup"===event.type&&val.match(/^[0-9a-fA-F]{3}$/)||color.toIEOctoHex()!==self._color.toIEOctoHex()&&self._setOption("color",self._getColor(color))};input.on("change",callback),self.alphaOptions.alphaSkipDebounce||input.on("keyup",self._debounce(callback,self.alphaOptions.alphaDebounceTimeout)),self.options.hide&&input.one("focus",(function(){self.show()}))},_initControls:function(){if(this._super(),this.alphaOptions.alphaEnabled){var self=this,stripAlpha=self.controls.strip.clone(!1,!1),stripAlphaSlider=stripAlpha.find(".iris-slider-offset"),controls={stripAlpha:stripAlpha,stripAlphaSlider:stripAlphaSlider};stripAlpha.addClass("iris-strip-alpha"),stripAlphaSlider.addClass("iris-slider-offset-alpha"),stripAlpha.appendTo(self.picker.find(".iris-picker-inner")),$.each(controls,(function(k,v){self.controls[k]=v})),self.controls.stripAlphaSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*self._color._alpha),slide:function(event,ui){self.active="strip",self._color._alpha=parseFloat(ui.value/100),self._change.apply(self,arguments)}})}},_dimensions:function(reset){if(this._super(reset),this.alphaOptions.alphaEnabled){var innerWidth,squareWidth,stripWidth,stripMargin,totalWidth,opts=this.options,square=this.controls.square,strip=this.picker.find(".iris-strip");for(innerWidth=Math.round(this.picker.outerWidth(!0)-(opts.border?22:0)),squareWidth=Math.round(square.outerWidth()),stripWidth=Math.round((innerWidth-squareWidth)/2),stripMargin=Math.round(stripWidth/2),totalWidth=Math.round(squareWidth+2*stripWidth+2*stripMargin);totalWidth>innerWidth;)stripWidth=Math.round(stripWidth-2),stripMargin=Math.round(stripMargin-1),totalWidth=Math.round(squareWidth+2*stripWidth+2*stripMargin);square.css("margin","0"),strip.width(stripWidth).css("margin-left",stripMargin+"px")}},_change:function(){var self=this,active=self.active;if(self._super(),self.alphaOptions.alphaEnabled){var controls=self.controls,alpha=parseInt(100*self._color._alpha),color=self._color.toRgb(),gradient=["rgb("+color.r+","+color.g+","+color.b+") 0%","rgba("+color.r+","+color.g+","+color.b+", 0) 100%"];self.picker.closest(".wp-picker-container").find(".wp-color-result");self.options.color=self._getColor(),controls.stripAlpha.css({background:"linear-gradient(to bottom, "+gradient.join(", ")+"), url("+backgroundImage+")"}),active&&controls.stripAlphaSlider.slider("value",alpha),self._color.error||self.element.removeClass("iris-error").val(self.options.color),self.picker.find(".iris-palette-container").on("click.palette",".iris-palette",(function(){var color=$(this).data("color");self.alphaOptions.alphaReset&&(self._color._alpha=1,color=self._getColor()),self._setOption("color",color)}))}},_paintDimension:function(origin,control){var color=!1;this.alphaOptions.alphaEnabled&&"strip"===control&&(color=this._color,this._color=new Color(color.toString()),this.hue=this._color.h()),this._super(origin,control),color&&(this._color=color)},_setOption:function(key,value){if("color"!==key||!this.alphaOptions.alphaEnabled)return this._super(key,value);value=""+value,newColor=new Color(value).setHSpace(this.options.mode),newColor.error||this._getColor(newColor)===this._getColor()||(this._color=newColor,this.options.color=this._getColor(),this.active="external",this._change())},color:function(newColor){return!0===newColor?this._color.clone():undefined===newColor?this._getColor():void this.option("color",newColor)}}),$.widget("wp.wpColorPicker",$.wp.wpColorPicker,{alphaOptions:{alphaEnabled:!1},_getAlphaOptions:function(){var el=this.element,type=el.data("type")||this.options.type,color=el.data("defaultColor")||el.val(),options={alphaEnabled:el.data("alphaEnabled")||!1,alphaCustomWidth:130,alphaReset:!1,alphaColorType:"rgb",alphaColorWithSpace:!1,alphaSkipDebounce:!!el.data("alphaSkipDebounce")||!1};return options.alphaEnabled&&(options.alphaEnabled=el.is("input")&&"full"===type),options.alphaEnabled?(options.alphaColorWithSpace=color&&color.match(/\s/),$.each(options,(function(name,defaultValue){var value=el.data(name)||defaultValue;switch(name){case"alphaCustomWidth":value=value?parseInt(value,10):0,value=isNaN(value)?defaultValue:value;break;case"alphaColorType":value.match(/^((octo)?hex|(rgb|hsl)a?)$/)||(value=color&&color.match(/^#/)?"hex":color&&color.match(/^hsla?/)?"hsl":defaultValue);break;default:value=!!value}options[name]=value})),options):options},_create:function(){$.support.iris&&(this.alphaOptions=this._getAlphaOptions(),this._super())},_addListeners:function(){if(!this.alphaOptions.alphaEnabled)return this._super();var self=this,el=self.element,isDeprecated=self.toggler.is("a");this.alphaOptions.defaultWidth=el.width(),this.alphaOptions.alphaCustomWidth&&el.width(parseInt(this.alphaOptions.defaultWidth+this.alphaOptions.alphaCustomWidth,10)),self.toggler.css({position:"relative","background-image":"url("+backgroundImage+")"}),isDeprecated?self.toggler.html('<span class="color-alpha" />'):self.toggler.append('<span class="color-alpha" />'),self.colorAlpha=self.toggler.find("span.color-alpha").css({width:"30px",height:"100%",position:"absolute",top:0,"background-color":el.val()}),"ltr"===self.colorAlpha.css("direction")?self.colorAlpha.css({"border-bottom-left-radius":"2px","border-top-left-radius":"2px",left:0}):self.colorAlpha.css({"border-bottom-right-radius":"2px","border-top-right-radius":"2px",right:0}),el.iris({change:function(event,ui){self.colorAlpha.css({"background-color":ui.color.to_s(self.alphaOptions.alphaColorType)}),"function"==typeof self.options.change&&self.options.change.call(this,event,ui)}}),self.wrap.on("click.wpcolorpicker",(function(event){event.stopPropagation()})),self.toggler.on("click",(function(){self.toggler.hasClass("wp-picker-open")?self.close():self.open()})),el.on("change",(function(event){var val=$(this).val();(el.hasClass("iris-error")||""===val||val.match(/^(#|(rgb|hsl)a?)$/))&&(isDeprecated&&self.toggler.removeAttr("style"),self.colorAlpha.css("background-color",""),"function"==typeof self.options.clear&&self.options.clear.call(this,event))})),self.button.on("click",(function(event){$(this).hasClass("wp-picker-default")?el.val(self.options.defaultColor).change():$(this).hasClass("wp-picker-clear")&&(el.val(""),isDeprecated&&self.toggler.removeAttr("style"),self.colorAlpha.css("background-color",""),"function"==typeof self.options.clear&&self.options.clear.call(this,event),el.trigger("change"))}))}})}}(jQuery); -
qode-optimizer/trunk/inc/admin/inc/common/core/class-qode-optimizer-framework-options.php
r3166439 r3473761 136 136 137 137 // Register 3rd party plugins scripts. 138 wp_register_script( 'wp-color-picker-alpha', QODE_OPTIMIZER_ADMIN_URL_PATH . '/inc/common/assets/plugins/wp-color-picker-alpha/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), '3.0.3', true ); 139 140 // Compatibility with WP 5.5 => wpColorPickerL10n are not loaded by WP core anymore, but we need them for the custom wp-color-picker-alpha.js. 141 global $wp_version; 142 if ( version_compare( $wp_version, '5.5', '>=' ) ) { 143 wp_localize_script( 144 'wp-color-picker-alpha', 145 'wpColorPickerL10n', 146 array( 147 'clear' => esc_html__( 'Clear', 'qode-optimizer' ), 148 'clearAriaLabel' => esc_html__( 'Clear color', 'qode-optimizer' ), 149 'defaultString' => esc_html__( 'Default', 'qode-optimizer' ), 150 'defaultAriaLabel' => esc_html__( 'Select default color', 'qode-optimizer' ), 151 'pick' => esc_html__( 'Select Color', 'qode-optimizer' ), 152 'defaultLabel' => esc_html__( 'Color value', 'qode-optimizer' ), 153 ) 154 ); 155 } 156 138 wp_register_script( 'wp-color-picker-alpha', QODE_OPTIMIZER_ADMIN_URL_PATH . '/inc/common/assets/plugins/wp-color-picker-alpha/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), '3.0.4', true ); 139 157 140 // Main dashboard js scripts. 158 141 // phpcs:ignore WordPress.WP.EnqueuedResourceParameters -
qode-optimizer/trunk/inc/admin/inc/common/fields-wp/class-qode-optimizer-framework-field-wp-color.php
r3166439 r3473761 17 17 public function render_field() { 18 18 ?> 19 <input type="text" name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo esc_attr( $this->params['id'] ); ?>" value="<?php echo esc_attr( $this->params['value'] ); ?>" data-alpha ="true" class="qodef-color-field"/>19 <input type="text" name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo esc_attr( $this->params['id'] ); ?>" value="<?php echo esc_attr( $this->params['value'] ); ?>" data-alpha-enabled="true" class="qodef-color-field"/> 20 20 <?php 21 21 } -
qode-optimizer/trunk/inc/admin/inc/common/fields-wp/class-qode-optimizer-framework-field-wp-textareasvg.php
r3166439 r3473761 8 8 public function render_field() { 9 9 ?> 10 <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo esc_attr( $this->params['id'] ); ?>" rows="5"><?php echo qode_optimizer_framework_wp_kses_html( 'svg',$this->params['value'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></textarea>10 <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo esc_attr( $this->params['id'] ); ?>" rows="5"><?php echo wp_kses_post( $this->params['value'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></textarea> 11 11 <?php 12 12 } -
qode-optimizer/trunk/inc/admin/inc/common/fields-wp/class-qode-optimizer-framework-field-wp-type.php
r3166439 r3473761 79 79 <?php 80 80 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 81 echo qode_optimizer_framework_wp_kses_html( 'html',$this->render_field() );81 echo wp_kses_post( $this->render_field() ); 82 82 ?> 83 83 </div> … … 96 96 <?php 97 97 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 98 echo qode_optimizer_framework_wp_kses_html( 'html',$this->render_field() );98 echo wp_kses_post( $this->render_field() ); 99 99 ?> 100 100 <p class="description"> -
qode-optimizer/trunk/inc/admin/inc/common/fields/class-qode-optimizer-framework-field-type.php
r3166439 r3473761 136 136 <?php 137 137 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 138 echo qode_optimizer_framework_wp_kses_html( 'description',$this->description );138 echo wp_kses_post( $this->description ); 139 139 ?> 140 140 </p> -
qode-optimizer/trunk/inc/admin/inc/common/modules/admin/templates/navigation.php
r3166439 r3473761 72 72 if ( isset( $nav_item['icon'] ) ) { 73 73 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 74 echo qode_optimizer_framework_wp_kses_html( 'svg',$nav_item['icon'] );74 echo wp_kses_post( $nav_item['icon'] ); 75 75 } 76 76 ?> -
qode-optimizer/trunk/readme.txt
r3470052 r3473761 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.2 7 Stable tag: 1.2.1 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 157 157 == Changelog == 158 158 159 = 1.2 - 02-18-2026 =159 = 1.2.1 - 03-03-2026 = 160 160 - Migrated premium options and related code to the Premium plugin 161 161
Note: See TracChangeset
for help on using the changeset viewer.