Version Description
- 20 April 2021 ==
- Updated the Google fonts list.
- Updated Font Awesome from
5.14.0
to5.15.1
. - Block Editor: Styling fixes including specific fixes for the Twenty Twenty-One theme.
- Contact Form: Set missing message default value.
- Contact Form: Nested the required indicator to make styling easier.
- Editor: Stopped processing the
<!--more-->
quicktag in previews. - Features: Ensured the title tag exists before outputting.
- Image: Added ability to set custom image sizes.
- Image Grid: Changed to use Flexbox to avoid unintended spacing.
- Post Carousel: Added an overlay hover opacity setting.
- Slider: Added a
Height
setting if theForeground image
is set. - Social Media Buttons: Added Discord.
- Video: Added a
Loop
setting for self-hosted videos. - Video: If
autoplay
is enabled,playsinline
will be added. - Developer: Post Carousel: Added
siteorigin_widgets_post_carousel_post_limit
filter - Developer: Google Maps: Corrected marker JavaScript property names.
- Developer: Block Editor: Store and serve rendered widget.
- Developer: Image form field: Added an optional parameter
custom_size
to enable custom sizes. - Developer: State Emitters: Improved media field external support.
- Developer: Sanitized italic fonts rather than clearing them.
- Developer: Replaced older-style PHP type conversion functions with type casts.
- Developer: Add
units
anddefault_unit
parameters for the measurement field. - Developer: Changes for PHP 8.
=
Download this release
Release Info
Developer | SiteOrigin |
Plugin | SiteOrigin Widgets Bundle |
Version | 1.18.0 |
Comparing to | |
See all releases |
Code changes from version 1.17.11 to 1.18.0
- admin/admin.js +12 -1
- admin/admin.min.js +1 -1
- admin/tpl/admin.php +2 -2
- base/base.php +2 -2
- base/css/admin.css +1 -1
- base/inc/actions.php +1 -1
- base/inc/attachments.php +2 -2
- base/inc/fields/autocomplete.class.php +2 -1
- base/inc/fields/code.class.php +1 -1
- base/inc/fields/css/icon-field.css +1 -1
- base/inc/fields/css/image-size-field.css +1 -0
- base/inc/fields/css/measurement-field.css +1 -1
- base/inc/fields/css/media-field.css +1 -1
- base/inc/fields/date-range.class.php +1 -1
- base/inc/fields/font.class.php +3 -3
- base/inc/fields/icon.class.php +2 -2
- base/inc/fields/image-size.class.php +56 -0
- base/inc/fields/js/autocomplete-field.js +6 -1
- base/inc/fields/js/autocomplete-field.min.js +1 -1
- base/inc/fields/js/icon-field.js +16 -3
- base/inc/fields/js/icon-field.min.js +1 -1
- base/inc/fields/js/image-size-field.js +18 -0
- base/inc/fields/js/image-size-field.min.js +1 -0
- base/inc/fields/js/media-field.js +8 -5
- base/inc/fields/js/media-field.min.js +1 -1
- base/inc/fields/link.class.php +12 -1
- base/inc/fields/measurement.class.php +27 -8
- base/inc/fields/media.class.php +2 -2
- base/inc/fields/repeater.class.php +5 -5
- base/inc/fields/slider.class.php +4 -4
- base/inc/fields/textarea.class.php +2 -2
- base/inc/fields/tinymce.class.php +1 -1
- base/inc/fonts.php +770 -146
- base/inc/lessc.inc.php +15 -17
- base/inc/lib/Less/Autoloader.php +15 -17
- base/inc/lib/Less/Cache.php +93 -119
- base/inc/lib/Less/Colors.php +150 -151
- base/inc/lib/Less/Configurable.php +66 -69
- base/inc/lib/Less/Environment.php +27 -36
- base/inc/lib/Less/Exception/Chunk.php +203 -203
- base/inc/lib/Less/Exception/Compiler.php +11 -11
- base/inc/lib/Less/Exception/Parser.php +116 -125
- base/inc/lib/Less/Functions.php +507 -509
- base/inc/lib/Less/Mime.php +19 -19
- base/inc/lib/Less/Output.php +7 -8
- base/inc/lib/Less/Output/Mapped.php +119 -122
- base/inc/lib/Less/Parser.php +778 -903
- base/inc/lib/Less/SourceMap/Base64VLQ.php +24 -24
- base/inc/lib/Less/SourceMap/Generator.php +354 -365
- base/inc/lib/Less/Tree.php +26 -32
- base/inc/lib/Less/Tree/Alpha.php +16 -19
- base/inc/lib/Less/Tree/Anonymous.php +12 -12
- base/inc/lib/Less/Tree/Assignment.php +10 -10
- base/inc/lib/Less/Tree/Attribute.php +16 -17
- base/inc/lib/Less/Tree/Call.php +48 -52
- base/inc/lib/Less/Tree/Color.php +80 -80
- base/inc/lib/Less/Tree/Comment.php +15 -15
- base/inc/lib/Less/Tree/Condition.php +16 -16
- base/inc/lib/Less/Tree/DefaultFunc.php +10 -10
- base/inc/lib/Less/Tree/DetachedRuleset.php +11 -12
- base/inc/lib/Less/Tree/Dimension.php +84 -87
- base/inc/lib/Less/Tree/Directive.php +31 -35
- base/inc/lib/Less/Tree/Element.php +19 -24
- base/inc/lib/Less/Tree/Expression.php +29 -31
- base/inc/lib/Less/Tree/Extend.php +11 -13
- base/inc/lib/Less/Tree/Import.php +92 -108
- base/inc/lib/Less/Tree/Javascript.php +4 -4
- base/inc/lib/Less/Tree/Keyword.php +11 -12
- base/inc/lib/Less/Tree/Media.php +59 -65
- base/inc/lib/Less/Tree/Mixin/Call.php +56 -65
- base/inc/lib/Less/Tree/Mixin/Definition.php +82 -90
- base/inc/lib/Less/Tree/NameValue.php +8 -10
- base/inc/lib/Less/Tree/Negative.php +13 -13
- base/inc/lib/Less/Tree/Operation.php +21 -23
- base/inc/lib/Less/Tree/Paren.php +10 -10
- base/inc/lib/Less/Tree/Quoted.php +28 -30
- base/inc/lib/Less/Tree/Rule.php +33 -36
- base/inc/lib/Less/Tree/Ruleset.php +195 -217
- base/inc/lib/Less/Tree/RulesetCall.php +8 -8
- base/inc/lib/Less/Tree/Selector.php +44 -52
- base/inc/lib/Less/Tree/UnicodeDescriptor.php +7 -8
- base/inc/lib/Less/Tree/Unit.php +44 -49
- base/inc/lib/Less/Tree/UnitConversions.php +14 -14
- base/inc/lib/Less/Tree/Url.php +25 -25
- base/inc/lib/Less/Tree/Value.php +16 -17
- base/inc/lib/Less/Tree/Variable.php +19 -20
- base/inc/lib/Less/Version.php +4 -4
- base/inc/lib/Less/Visitor.php +13 -16
- base/inc/lib/Less/Visitor/extendFinder.php +30 -35
- base/inc/lib/Less/Visitor/import.php +0 -2
- base/inc/lib/Less/Visitor/joinSelector.php +20 -22
- base/inc/lib/Less/Visitor/processExtends.php +112 -142
- base/inc/lib/Less/Visitor/toCSS.php +79 -91
- base/inc/lib/Less/VisitorReplacing.php +23 -28
- base/inc/widgets/base-slider.class.php +1 -1
- base/js/admin.js +84 -20
- base/js/admin.min.js +1 -1
- base/siteorigin-widget.class.php +1 -1
- compat/block-editor/widget-block.js +14 -4
- compat/block-editor/widget-block.min.js +1 -1
- compat/block-editor/widget-block.php +16 -8
- icons/fontawesome/filter.php +12 -1
- icons/fontawesome/style.css +1 -1
- icons/fontawesome/webfonts/fa-brands-400.eot +0 -0
- icons/fontawesome/webfonts/fa-brands-400.svg +111 -31
- icons/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- icons/fontawesome/webfonts/fa-brands-400.woff +0 -0
- icons/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- icons/fontawesome/webfonts/fa-regular-400.eot +0 -0
- icons/fontawesome/webfonts/fa-regular-400.svg +2 -6
- icons/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- icons/fontawesome/webfonts/fa-regular-400.woff +0 -0
- icons/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- icons/fontawesome/webfonts/fa-solid-900.eot +0 -0
- icons/fontawesome/webfonts/fa-solid-900.svg +19 -6
- icons/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- icons/fontawesome/webfonts/fa-solid-900.woff +0 -0
- icons/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- js/sow.google-map.js +3 -3
- js/sow.google-map.min.js +1 -1
- lang/so-widgets-bundle.pot +287 -251
- readme.txt +27 -2
- so-widgets-bundle.php +6 -5
- widgets/accordion/js/accordion.js +2 -2
- widgets/accordion/js/accordion.min.js +1 -1
- widgets/button/button.php +1 -0
- widgets/button/tpl/default.php +1 -1
- widgets/contact/contact.php +18 -9
- widgets/editor/editor.php +11 -1
- widgets/features/features.php +1 -1
- widgets/features/tpl/default.php +10 -3
- widgets/google-map/google-map.php +46 -2
- widgets/headline/headline.php +2 -2
- widgets/hero/hero.php +3 -3
- widgets/image-grid/image-grid.php +2 -2
- widgets/image-grid/styles/default.less +3 -4
- widgets/image-grid/tpl/default.php +2 -2
- widgets/image/image.php +13 -0
- widgets/layout-slider/layout-slider.php +2 -2
- widgets/post-carousel/css/style.css +1 -1
- widgets/post-carousel/js/carousel.js +1 -5
- widgets/post-carousel/js/carousel.min.js +1 -1
- widgets/post-carousel/post-carousel.php +61 -11
- widgets/post-carousel/styles/default.less +10 -6
- widgets/post-carousel/tpl/base.php +1 -1
- widgets/simple-masonry/simple-masonry.php +6 -6
- widgets/slider/slider.php +53 -13
- widgets/slider/styles/default.less +45 -1
- widgets/social-media-buttons/data/networks.php +6 -0
- widgets/tabs/js/tabs.js +1 -1
- widgets/tabs/js/tabs.min.js +1 -1
- widgets/testimonial/testimonial.php +7 -7
- widgets/video/tpl/default.php +4 -0
- widgets/video/video.php +10 -0
admin/admin.js
CHANGED
@@ -144,9 +144,20 @@ jQuery( function( $ ){
|
|
144 |
} );
|
145 |
|
146 |
dialog.show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
} );
|
148 |
|
149 |
-
dialog.find( '.so-close' ).on( 'click', function( e )
|
|
|
|
|
|
|
150 |
e.preventDefault();
|
151 |
dialog.hide();
|
152 |
} );
|
144 |
} );
|
145 |
|
146 |
dialog.show();
|
147 |
+
$( '#sow-settings-dialog .so-close' ).trigger( 'focus' );
|
148 |
+
|
149 |
+
// Close dialog when escape is pressed.
|
150 |
+
$( window ).one( 'keyup', function( e ) {
|
151 |
+
if ( e.which === 27 ) {
|
152 |
+
dialog.hide();
|
153 |
+
}
|
154 |
+
} );
|
155 |
} );
|
156 |
|
157 |
+
dialog.find( '.so-close' ).on( 'click keyup', function( e ){
|
158 |
+
if ( e.type == 'keyup' && ! window.sowbForms.isEnter( e ) ) {
|
159 |
+
return;
|
160 |
+
}
|
161 |
e.preventDefault();
|
162 |
dialog.hide();
|
163 |
} );
|
admin/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery((function(i){i(".so-widget-toggle-active button").on("click",(function(){var t=i(this),e=t.data("status"),s=t.closest(".so-widget");e?s.addClass("so-widget-is-active").removeClass("so-widget-is-inactive"):s.removeClass("so-widget-is-active").addClass("so-widget-is-inactive"),i.post(soWidgetsAdmin.toggleUrl,{widget:s.data("id"),active:e},(function(i){}))})),i(".so-widget-banner").each((function(){var t=i(this),e=t.find("img");if(e.length)e.width()>128&&e.css("margin-left",-(e.width()-128)/2+"px");else{var s=Trianglify({width:128,height:128,variance:1,cell_size:32,seed:t.data("seed")});t.append(s.svg())}}));var t=function(){var t=i(this).val().toLowerCase();""===t?i(".so-widget-wrap").show():i(".so-widget").each((function(){var e=i(this);e.find("h3").html().toLowerCase().indexOf(t)>-1?e.parent().show():e.parent().hide()}))};i("#sow-widget-search input").on({keyup:t,search:t}),i(window).on("resize",(function(){var t=i(".so-widget-text").css("height","auto"),e=0;t.each((function(){e=Math.max(e,i(this).height())})),t.each((function(){i(this).css("height",e+"px")}))})).trigger("resize"),i("#sow-widgets-page .page-nav a").on("click",(function(t){t.preventDefault();var e=i(this),s=e.attr("href"),
|
1 |
+
jQuery((function(i){i(".so-widget-toggle-active button").on("click",(function(){var t=i(this),e=t.data("status"),s=t.closest(".so-widget");e?s.addClass("so-widget-is-active").removeClass("so-widget-is-inactive"):s.removeClass("so-widget-is-active").addClass("so-widget-is-inactive"),i.post(soWidgetsAdmin.toggleUrl,{widget:s.data("id"),active:e},(function(i){}))})),i(".so-widget-banner").each((function(){var t=i(this),e=t.find("img");if(e.length)e.width()>128&&e.css("margin-left",-(e.width()-128)/2+"px");else{var s=Trianglify({width:128,height:128,variance:1,cell_size:32,seed:t.data("seed")});t.append(s.svg())}}));var t=function(){var t=i(this).val().toLowerCase();""===t?i(".so-widget-wrap").show():i(".so-widget").each((function(){var e=i(this);e.find("h3").html().toLowerCase().indexOf(t)>-1?e.parent().show():e.parent().hide()}))};i("#sow-widget-search input").on({keyup:t,search:t}),i(window).on("resize",(function(){var t=i(".so-widget-text").css("height","auto"),e=0;t.each((function(){e=Math.max(e,i(this).height())})),t.each((function(){i(this).css("height",e+"px")}))})).trigger("resize"),i("#sow-widgets-page .page-nav a").on("click",(function(t){t.preventDefault();var e=i(this),s=e.attr("href"),o=e.closest("li");switch(i("#sow-widgets-page .page-nav li").not(o).removeClass("active"),o.addClass("active"),s){case"#all":i(".so-widget-wrap").show();break;case"#enabled":i(".so-widget-wrap").hide(),i(".so-widget-wrap .so-widget-is-active").each((function(){i(this).closest(".so-widget-wrap").show()})),i(".so-widget-wrap .so-widget-is-inactive").each((function(){i(this).closest(".so-widget-wrap").hide()}));break;case"#disabled":i(".so-widget-wrap .so-widget-is-active").each((function(){i(this).closest(".so-widget-wrap").hide()})),i(".so-widget-wrap .so-widget-is-inactive").each((function(){i(this).closest(".so-widget-wrap").show()}))}i(window).trigger("resize")})),i("#widgets-list").addClass("so-animated");var e=i("#sow-settings-dialog");if(i("#widgets-list .so-widget-settings").on("click",(function(t){var s=i(this);t.preventDefault(),$content=e.find(".so-content"),$content.empty().addClass("so-loading"),i.get(s.data("form-url"),(function(i){$content.html(i).removeClass("so-loading")})),e.show(),i("#sow-settings-dialog .so-close").trigger("focus"),i(window).one("keyup",(function(i){27===i.which&&e.hide()}))})),e.find(".so-close").on("click keyup",(function(i){("keyup"!=i.type||window.sowbForms.isEnter(i))&&(i.preventDefault(),e.hide())})),e.find(".so-save").on("click",(function(t){t.preventDefault();var s=i(this);s.prop("disabled",!0),e.find("form").on("submit",(function(){s.prop("disabled",!1),e.hide()})).trigger("submit")})),i("#so-widget-settings-save").on("load",(function(){i("#widgets-list .so-widget-settings").prop("disabled",!1)})),window.location.hash&&"#settings-"===window.location.hash.substring(0,10)){var s=window.location.hash.substring(10);i('div[data-id="'+s+'"] button.so-widget-settings').trigger("click")}}));
|
admin/tpl/admin.php
CHANGED
@@ -117,7 +117,7 @@
|
|
117 |
|
118 |
<div class="so-title-bar">
|
119 |
<h3 class="so-title"><?php _e( 'Widget Settings', 'so-widgets-bundle' ) ?></h3>
|
120 |
-
<a class="so-close">
|
121 |
<span class="so-dialog-icon"></span>
|
122 |
</a>
|
123 |
</div>
|
@@ -127,7 +127,7 @@
|
|
127 |
|
128 |
<div class="so-toolbar">
|
129 |
<div class="so-buttons">
|
130 |
-
<button class="button-primary so-save"><?php _e( 'Save', 'so-widgets-bundle' ) ?></button>
|
131 |
</div>
|
132 |
</div>
|
133 |
</div>
|
117 |
|
118 |
<div class="so-title-bar">
|
119 |
<h3 class="so-title"><?php _e( 'Widget Settings', 'so-widgets-bundle' ) ?></h3>
|
120 |
+
<a class="so-close" tabindex="0">
|
121 |
<span class="so-dialog-icon"></span>
|
122 |
</a>
|
123 |
</div>
|
127 |
|
128 |
<div class="so-toolbar">
|
129 |
<div class="so-buttons">
|
130 |
+
<button class="button-primary so-save" tabindex="0"><?php _e( 'Save', 'so-widgets-bundle' ) ?></button>
|
131 |
</div>
|
132 |
</div>
|
133 |
</div>
|
base/base.php
CHANGED
@@ -188,7 +188,7 @@ add_filter('siteorigin_panels_widgets', 'siteorigin_widget_add_bundle_groups', 1
|
|
188 |
function sow_esc_url( $url ) {
|
189 |
if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
|
190 |
// Convert the special post URL into a permalink
|
191 |
-
$url = get_the_permalink(
|
192 |
if( empty($url) ) return '';
|
193 |
}
|
194 |
|
@@ -207,7 +207,7 @@ function sow_esc_url( $url ) {
|
|
207 |
function sow_esc_url_raw( $url ) {
|
208 |
if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
|
209 |
// Convert the special post URL into a permalink
|
210 |
-
$url = get_the_permalink(
|
211 |
}
|
212 |
|
213 |
$protocols = wp_allowed_protocols();
|
188 |
function sow_esc_url( $url ) {
|
189 |
if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
|
190 |
// Convert the special post URL into a permalink
|
191 |
+
$url = get_the_permalink( (int) $matches[1] );
|
192 |
if( empty($url) ) return '';
|
193 |
}
|
194 |
|
207 |
function sow_esc_url_raw( $url ) {
|
208 |
if( preg_match('/^post: *([0-9]+)/', $url, $matches) ) {
|
209 |
// Convert the special post URL into a permalink
|
210 |
+
$url = get_the_permalink( (int) $matches[1] );
|
211 |
}
|
212 |
|
213 |
$protocols = wp_allowed_protocols();
|
base/css/admin.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.siteorigin-widget-form-no-styles{display:none !important}.siteorigin-widget-teaser{padding:10px 12px;border:1px solid #5fc133;background:#edfbe7;color:#394a3a;margin-bottom:20px}.siteorigin-widget-teaser .dashicons{float:right;margin:1px 2px 6px 10px;cursor:pointer;font-size:18px;width:18px;height:18px}.siteorigin-widget-form-notification{padding:8px 12px;border:1px solid #a4cadd;background-color:#CDE2EC;margin-bottom:20px}.siteorigin-widget-form-notification>span{line-height:22px}.siteorigin-widget-form-notification>a.button.button-small{margin-left:10px;height:22px}.siteorigin-widget-form{display:block !important;margin:15px 0}.siteorigin-widget-form>div:first-child{margin-top:0}.siteorigin-widget-form a{box-shadow:none}@media (min-width:680px){.siteorigin-widget-form.siteorigin-widget-form-main{min-width:600px}}.siteorigin-widget-form .siteorigin-widget-field{margin:1em 0}.siteorigin-widget-form .siteorigin-widget-field>label{display:block;font-size:13px;font-weight:400;margin-bottom:3px}.siteorigin-widget-form .siteorigin-widget-field>label.siteorigin-widget-field-label{font-weight:bold}.siteorigin-widget-form .siteorigin-widget-field>label.so-checkbox-label{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.siteorigin-widget-form .siteorigin-widget-field .siteorigin-widget-description{font-size:.9em;margin-top:.2em;color:#999;font-style:italic}.siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-separator{margin:1.75em 0}.siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-is-optional .field-optional{font-weight:normal;font-size:.8em;vertical-align:super;padding-left:.5em;color:#54a242;font-style:italic}.siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-is-required .field-required{font-weight:normal;font-size:.8em;vertical-align:super;padding-left:.5em;color:#F02311;font-style:italic}.siteorigin-widget-form .siteorigin-widget-field input[type="text"]{width:100%}.siteorigin-widget-form .siteorigin-widget-field input.siteorigin-widget-input-color{width:auto}.siteorigin-widget-form .siteorigin-widget-field .wp-picker-clear{margin-left:6px;min-height:30px}.siteorigin-widget-form .siteorigin-widget-field textarea.siteorigin-widget-code-input{font-family:"Courier New",Courier,monospace}.siteorigin-widget-form .siteorigin-widget-field select{min-width:150px}@media (max-width:680px){.siteorigin-widget-form .siteorigin-widget-field select{max-width:none;width:100%}}.siteorigin-widget-form .siteorigin-widget-field select[multiple]{max-height:83px}.siteorigin-widget-form .siteorigin-widget-field-type-slider .siteorigin-widget-slider-wrapper{margin:10px 0;border:1px solid #E0E0E0;padding:12px 15px;background:#F4F4F4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;max-width:500px;display:block;margin-left:55px}.siteorigin-widget-form .siteorigin-widget-field-type-slider .siteorigin-widget-slider-value{display:block;float:left;margin-top:0;border:1px solid #E0E0E0;padding:11px 0;background:#F4F4F4;font-weight:bold;color:#666;width:45px;text-align:center}.siteorigin-widget-form .siteorigin-widget-field-type-slider .siteorigin-widget-value-slider{position:relative;height:5px;background:#A0A0A0;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.25);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.25);box-shadow:inset 0 1px 2px rgba(0,0,0,0.25);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.siteorigin-widget-form .siteorigin-widget-field-type-slider .ui-slider-handle{cursor:move;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid #a4a3a8;z-index:10;position:absolute;width:18px;height:18px;margin-top:-7px;margin-left:-9px;background:#F9F9F9;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;top:0;left:0;-webkit-box-shadow:inset 0 1px 0 #FFFFFF, 0 1px 1px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 0 #FFFFFF, 0 1px 1px rgba(0,0,0,0.1);box-shadow:inset 0 1px 0 #FFFFFF, 0 1px 1px rgba(0,0,0,0.1)}.siteorigin-widget-form .siteorigin-widget-field-type-slider input[type="number"]{display:none}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top{background:#F0F0F0;border:1px solid #D0D0D0;padding:10px;position:relative}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top h3{font-size:13px;margin:0;padding:0 !important}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove{width:14px;height:14px;position:absolute;top:50%;margin-top:-7px;cursor:pointer;font-size:14px;line-height:14px;text-align:center}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:before,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy:before,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:before{font-family:dashicons;color:#999999}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand{right:48px}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:before{content:"\f140"}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:hover:before{color:#50575D}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy{right:28px}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy:before{content:"\f105"}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy:hover:before{color:#50575D}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove{right:12px}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:before{content:'\f158'}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:hover{background:#ff0000}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:hover:before{color:#FFFFFF}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items{background:#FCFCFC;border:1px solid #EEEEEE;border-top:0;border-bottom:0}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item{background:#FCFCFC;border-bottom:1px solid #EEEEEE}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top{padding:10px;cursor:move;position:relative;background:#F6F6F6}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top h4{font-size:12px;margin:0}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item h4{font-size:15px;margin:0}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item:last-child{border-bottom:0}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-form{border-top:1px solid #EEEEEE;display:none;padding:1px 10px}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add{padding:7px 10px;background:#F0F0F0;border:1px dashed #D0D0D0;font-size:12px;line-height:1em;text-align:center;cursor:pointer}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add:hover{background:#F4F4F4}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top{background:#eaf2f6;border-color:#c9d0d4}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top h3{color:#42484b}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items{background:#f6fdff;border-color:#e8eff3}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item{background:#f8fdff;border-bottom-color:#e8eff3}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top{background:#f0f8fc}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-form{border-top-color:#e8eff3}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add{background:#eaf2f6;border-color:#c9d0d4;color:#42484b}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add:hover{background:#edf5f9}.siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper{background:#F0F0F0;border:1px solid #D0D0D0;padding:10px;display:block;margin-bottom:0}.siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper>label{display:inline;font-weight:bold}.siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper:before{float:left;margin:3px 6px 0 0;display:block;width:14px;height:14px;font-size:14px;line-height:1;font-family:"dashicons";content:"\f132"}.siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper.siteorigin-widget-section-visible:before{content:"\f460"}.siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper span.sow-current-count{display:inline-block;border-radius:9px;background:#f92700;border:1px solid #da0900;line-height:14px;font-size:7px;width:17px;height:17px;text-align:center;vertical-align:middle;font-weight:bold;color:#FFFFFF;box-sizing:border-box;margin:1px 5px}.siteorigin-widget-form .siteorigin-widget-field-type-widget>label,.siteorigin-widget-form .siteorigin-widget-field-type-section>label{background:#F0F0F0;border:1px solid #D0D0D0;line-height:1.4;padding:10px;display:block;margin-bottom:0}.siteorigin-widget-form .siteorigin-widget-field-type-widget>label:before,.siteorigin-widget-form .siteorigin-widget-field-type-section>label:before{float:left;margin:3px 6px 0 0;display:block;width:14px;height:14px;font-size:14px;line-height:1;font-family:"dashicons";content:"\f132"}.siteorigin-widget-form .siteorigin-widget-field-type-widget>label.siteorigin-widget-section-visible:before,.siteorigin-widget-form .siteorigin-widget-field-type-section>label.siteorigin-widget-section-visible:before{content:"\f460"}.siteorigin-widget-form .siteorigin-widget-field-type-posts .siteorigin-widget-section,.siteorigin-widget-form .siteorigin-widget-field-type-widget .siteorigin-widget-section,.siteorigin-widget-form .siteorigin-widget-field-type-section .siteorigin-widget-section{padding:1px 10px;background:#FCFCFC;border:1px solid #EEEEEE;border-top:0}.siteorigin-widget-form .siteorigin-widget-field-type-posts .siteorigin-widget-section.siteorigin-widget-section-hide,.siteorigin-widget-form .siteorigin-widget-field-type-widget .siteorigin-widget-section.siteorigin-widget-section-hide,.siteorigin-widget-form .siteorigin-widget-field-type-section .siteorigin-widget-section.siteorigin-widget-section-hide{display:none}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete,.siteorigin-widget-form .siteorigin-widget-field-type-link{position:relative}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector{padding:20px;display:none;position:absolute;top:110%;width:360px;z-index:10;border:1px solid #c0c0c0;background:#F6F6F6;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);-moz-box-shadow:0 2px 4px rgba(0,0,0,0.2);box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .content-text-search,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .content-text-search{width:100%;margin-bottom:15px}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts{margin:0;padding:0;background:#fff;max-height:300px;overflow-y:scroll;border:1px solid #e4e4e4}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li{cursor:pointer;padding:5px 10px;color:#32373c;border-bottom:1px solid #f1f1f1;margin:0;font-size:.95em}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li.selected,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li.selected,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li.selected,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li.selected{background:#e1edfa}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li:hover,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li:hover,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li:hover,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li:hover{background:#eaf2fa}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li:last-child,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li:last-child,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li:last-child,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li:last-child{border-bottom:0}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li span,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li span,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li span,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li span{font-size:.9em;display:inline-block;float:right;color:#999;margin-left:10px}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items.loading,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items.loading,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts.loading,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts.loading{min-height:40px;background:#FFFFFF url("img/wpspin_light.gif") center center no-repeat}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items.loading,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items.loading,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts.loading,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts.loading{background-image:url("img/wpspin_light-2x.gif");background-size:16px 16px}}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items.loading li,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items.loading li,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts.loading li,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts.loading li{display:none}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .buttons,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .buttons{margin-top:15px;text-align:right}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .buttons a,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .buttons a{display:inline-block}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .url-input-wrapper,.siteorigin-widget-form .siteorigin-widget-field-type-link .url-input-wrapper{display:block;margin-right:130px}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .select-content-button,.siteorigin-widget-form .siteorigin-widget-field-type-link .select-content-button{float:right;line-height:28px;min-height:30px;width:120px;text-align:center}.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector{right:0}.siteorigin-widget-form .siteorigin-widget-description{clear:both}.siteorigin-widget-preview{display:block !important}.siteorigin-widget-help-link{display:block;margin:1em 0}.so-widgets-dialog .so-widgets-dialog-overlay{position:fixed;z-index:500000;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.7)}.so-widgets-dialog .so-widgets-toolbar,.so-widgets-dialog .so-widgets-dialog-frame{position:fixed;z-index:500001;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.so-widgets-dialog .so-widgets-toolbar{left:30px;right:30px;top:30px;height:50px;background:#fafafa;border-bottom:1px solid #D8D8D8}.so-widgets-dialog .so-widgets-toolbar h3{margin:15px 0 15px 20px}.so-widgets-dialog .so-widgets-toolbar .close{position:absolute;box-sizing:border-box;width:50px;height:50px;display:block;cursor:pointer;top:0;right:0;-webkit-transition:all .2s ease;-moz-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease;background:#fafafa;border-left:1px solid #d8d8d8;border-bottom:1px solid #d8d8d8}.so-widgets-dialog .so-widgets-toolbar .close:hover{background:#e9e9e9}.so-widgets-dialog .so-widgets-toolbar .close:hover .so-dialog-icon{color:#333333}.so-widgets-dialog .so-widgets-toolbar .close .dashicons{position:absolute;top:50%;left:50%;text-decoration:none;width:21px;height:21px;margin-left:-11px;margin-top:-10px;font-size:21px;color:#666666;text-align:center}.so-widgets-dialog .so-widgets-dialog-frame{top:80px;left:30px;right:30px;bottom:30px;background:#FFFFFF url("img/wpspin_light.gif") center center no-repeat}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.so-widgets-dialog .so-widgets-dialog-frame{background-image:url("img/wpspin_light-2x.gif");background-size:16px 16px}}.so-widgets-dialog .so-widgets-dialog-frame iframe{width:100%;height:100%}.widget-icon.so-widget-icon{background-size:cover;background-image:url("img/bundle-icon.png")}.widget-icon.so-widget-icon.so-block-editor-icon{width:20px;height:20px;display:inline-block}.block-editor .so-widget-placeholder{text-align:left}.block-editor .so-widget-placeholder>.components-placeholder__label{background:url("img/bundle-icon.png") no-repeat left;background-size:20px;padding-left:25px}.block-editor .so-widget-placeholder>.components-placeholder__fieldset{max-width:unset}.block-editor .so-widget-placeholder>.components-placeholder__fieldset .so-widget-block-container{width:100%}.block-editor .so-widget-placeholder>.components-placeholder__fieldset .so-widget-block-container .components-base-control__field select{max-width:unset}.block-editor .so-widget-placeholder>.components-placeholder__fieldset .so-widget-block-container .siteorigin-widget-form.siteorigin-widget-form-main{min-width:unset}.block-editor .siteorigin-widget-form .siteorigin-widget-field{text-align:left}.block-editor .siteorigin-widget-form .siteorigin-widget-field input{padding:3px 5px}.block-editor .siteorigin-widget-form .siteorigin-widget-field input[type=checkbox]{background-color:#ffffff}.block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-autocomplete .select-content-button,.block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-link .select-content-button{box-shadow:unset;font-size:13px;height:28px}.block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current{height:37px}.block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-tinymce .wp-switch-editor{box-sizing:content-box}.block-editor .so-widget-preview-container .so-widgets-spinner-container{text-align:center}.block-editor .so-widget-preview-container .so-widgets-spinner-container>span{display:inline-block}
|
1 |
+
.siteorigin-widget-form-no-styles{display:none !important}.siteorigin-widget-teaser{padding:10px 12px;border:1px solid #5fc133;background:#edfbe7;color:#394a3a;margin-bottom:20px}.siteorigin-widget-teaser .dashicons{float:right;margin:1px 2px 6px 10px;cursor:pointer;font-size:18px;width:18px;height:18px}.siteorigin-widget-form-notification{padding:8px 12px;border:1px solid #a4cadd;background-color:#CDE2EC;margin-bottom:20px}.siteorigin-widget-form-notification>span{line-height:22px}.siteorigin-widget-form-notification>a.button.button-small{margin-left:10px;height:22px}.siteorigin-widget-form{display:block !important;margin:15px 0}.siteorigin-widget-form>div:first-child{margin-top:0}.siteorigin-widget-form a{box-shadow:none}@media (min-width:680px){.siteorigin-widget-form.siteorigin-widget-form-main{min-width:600px}}.siteorigin-widget-form .siteorigin-widget-field{margin:1em 0}.siteorigin-widget-form .siteorigin-widget-field>label{display:block;font-size:13px;font-weight:400;margin-bottom:3px}.siteorigin-widget-form .siteorigin-widget-field>label.siteorigin-widget-field-label{font-weight:bold}.siteorigin-widget-form .siteorigin-widget-field>label.so-checkbox-label{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.siteorigin-widget-form .siteorigin-widget-field .siteorigin-widget-description{font-size:.9em;margin-top:.2em;color:#999;font-style:italic}.siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-separator{margin:1.75em 0}.siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-is-optional .field-optional{font-weight:normal;font-size:.8em;vertical-align:super;padding-left:.5em;color:#54a242;font-style:italic}.siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-is-required .field-required{font-weight:normal;font-size:.8em;vertical-align:super;padding-left:.5em;color:#F02311;font-style:italic}.siteorigin-widget-form .siteorigin-widget-field input[type="text"]{width:100%}.siteorigin-widget-form .siteorigin-widget-field input.siteorigin-widget-input-color{width:auto}.siteorigin-widget-form .siteorigin-widget-field .wp-picker-clear{margin-left:6px;min-height:30px}.siteorigin-widget-form .siteorigin-widget-field textarea.siteorigin-widget-code-input{font-family:"Courier New",Courier,monospace}.siteorigin-widget-form .siteorigin-widget-field select{min-width:150px}@media (max-width:680px){.siteorigin-widget-form .siteorigin-widget-field select{max-width:none;width:100%}}.siteorigin-widget-form .siteorigin-widget-field select[multiple]{max-height:83px}.siteorigin-widget-form .siteorigin-widget-field-type-slider .siteorigin-widget-slider-wrapper{margin:10px 0;border:1px solid #E0E0E0;padding:12px 15px;background:#F4F4F4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;max-width:500px;display:block;margin-left:55px}.siteorigin-widget-form .siteorigin-widget-field-type-slider .siteorigin-widget-slider-value{display:block;float:left;margin-top:0;border:1px solid #E0E0E0;padding:11px 0;background:#F4F4F4;font-weight:bold;color:#666;width:45px;text-align:center}.siteorigin-widget-form .siteorigin-widget-field-type-slider .siteorigin-widget-value-slider{position:relative;height:5px;background:#A0A0A0;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.25);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.25);box-shadow:inset 0 1px 2px rgba(0,0,0,0.25);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.siteorigin-widget-form .siteorigin-widget-field-type-slider .ui-slider-handle{cursor:move;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid #a4a3a8;z-index:10;position:absolute;width:18px;height:18px;margin-top:-7px;margin-left:-9px;background:#F9F9F9;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;top:0;left:0;-webkit-box-shadow:inset 0 1px 0 #FFFFFF, 0 1px 1px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 0 #FFFFFF, 0 1px 1px rgba(0,0,0,0.1);box-shadow:inset 0 1px 0 #FFFFFF, 0 1px 1px rgba(0,0,0,0.1)}.siteorigin-widget-form .siteorigin-widget-field-type-slider input[type="number"]{display:none}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top{background:#F0F0F0;border:1px solid #D0D0D0;padding:10px;position:relative}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top h3{font-size:13px;margin:0;padding:0 !important}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove{width:14px;height:14px;position:absolute;top:50%;margin-top:-7px;cursor:pointer;font-size:14px;line-height:14px;text-align:center}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:before,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy:before,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:before{font-family:dashicons;color:#999999}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand{right:48px}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:before{content:"\f140"}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:focus:before,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-expand:hover:before{color:#50575D}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy{right:28px}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy:before{content:"\f105"}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy:focus:before,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-copy:hover:before{color:#50575D}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove{right:12px}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:before{content:'\f158'}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:focus,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:hover{background:#ff0000}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:focus:before,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-remove:hover:before{color:#FFFFFF}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items{background:#FCFCFC;border:1px solid #EEEEEE;border-top:0;border-bottom:0}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item{background:#FCFCFC;border-bottom:1px solid #EEEEEE}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top{padding:10px;cursor:move;position:relative;background:#F6F6F6}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top:focus,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top:focus-within{background:#FAFAFA}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top h4{font-size:12px;margin:0}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item h4{font-size:15px;margin:0}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item:last-child{border-bottom:0}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-form{border-top:1px solid #EEEEEE;display:none;padding:1px 10px}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add{padding:7px 10px;background:#F0F0F0;border:1px dashed #D0D0D0;font-size:12px;line-height:1em;text-align:center;cursor:pointer}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add:focus,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add:hover{background:#F4F4F4}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top{background:#eaf2f6;border-color:#c9d0d4}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top:focus,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top:focus-within{background:#eaf2f6}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-top h3{color:#42484b}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items{background:#f6fdff;border-color:#e8eff3}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item{background:#f8fdff;border-bottom-color:#e8eff3}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-top{background:#f0f8fc}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-items .siteorigin-widget-field-repeater-item .siteorigin-widget-field-repeater-item-form{border-top-color:#e8eff3}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add{background:#eaf2f6;border-color:#c9d0d4;color:#42484b}.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add:focus,.siteorigin-widget-form .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater .siteorigin-widget-field-repeater-add:hover{background:#edf5f9}.siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper{background:#F0F0F0;border:1px solid #D0D0D0;padding:10px;display:block;margin-bottom:0}.siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper>label{display:inline;font-weight:bold}.siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper:before{float:left;margin:3px 6px 0 0;display:block;width:14px;height:14px;font-size:14px;line-height:1;font-family:"dashicons";content:"\f132"}.siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper.siteorigin-widget-section-visible:before{content:"\f460"}.siteorigin-widget-form .siteorigin-widget-field-type-posts .posts-container-label-wrapper span.sow-current-count{display:inline-block;border-radius:9px;background:#f92700;border:1px solid #da0900;line-height:14px;font-size:7px;width:17px;height:17px;text-align:center;vertical-align:middle;font-weight:bold;color:#FFFFFF;box-sizing:border-box;margin:1px 5px}.siteorigin-widget-form .siteorigin-widget-field-type-widget>label,.siteorigin-widget-form .siteorigin-widget-field-type-section>label{background:#F0F0F0;border:1px solid #D0D0D0;line-height:1.4;padding:10px;display:block;margin-bottom:0}.siteorigin-widget-form .siteorigin-widget-field-type-widget>label:focus,.siteorigin-widget-form .siteorigin-widget-field-type-section>label:focus{background:#F5F5F5}.siteorigin-widget-form .siteorigin-widget-field-type-widget>label:before,.siteorigin-widget-form .siteorigin-widget-field-type-section>label:before{float:left;margin:3px 6px 0 0;display:block;width:14px;height:14px;font-size:14px;line-height:1;font-family:"dashicons";content:"\f132"}.siteorigin-widget-form .siteorigin-widget-field-type-widget>label.siteorigin-widget-section-visible:before,.siteorigin-widget-form .siteorigin-widget-field-type-section>label.siteorigin-widget-section-visible:before{content:"\f460"}.siteorigin-widget-form .siteorigin-widget-field-type-posts .siteorigin-widget-section,.siteorigin-widget-form .siteorigin-widget-field-type-widget .siteorigin-widget-section,.siteorigin-widget-form .siteorigin-widget-field-type-section .siteorigin-widget-section{padding:1px 10px;background:#FCFCFC;border:1px solid #EEEEEE;border-top:0}.siteorigin-widget-form .siteorigin-widget-field-type-posts .siteorigin-widget-section.siteorigin-widget-section-hide,.siteorigin-widget-form .siteorigin-widget-field-type-widget .siteorigin-widget-section.siteorigin-widget-section-hide,.siteorigin-widget-form .siteorigin-widget-field-type-section .siteorigin-widget-section.siteorigin-widget-section-hide{display:none}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete,.siteorigin-widget-form .siteorigin-widget-field-type-link{position:relative}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector{padding:20px;display:none;position:absolute;top:110%;width:360px;z-index:10;border:1px solid #c0c0c0;background:#F6F6F6;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);-moz-box-shadow:0 2px 4px rgba(0,0,0,0.2);box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .content-text-search,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .content-text-search{width:100%;margin-bottom:15px}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts{margin:0;padding:0;background:#fff;max-height:300px;overflow-y:scroll;border:1px solid #e4e4e4}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li{cursor:pointer;padding:5px 10px;color:#32373c;border-bottom:1px solid #f1f1f1;margin:0;font-size:.95em}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li.selected,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li.selected,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li.selected,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li.selected{background:#e1edfa}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li:focus,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li:focus,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li:focus,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li:focus,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li:hover,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li:hover,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li:hover,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li:hover{background:#eaf2fa}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li:last-child,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li:last-child,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li:last-child,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li:last-child{border-bottom:0}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items li span,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items li span,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts li span,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts li span{font-size:.9em;display:inline-block;float:right;color:#999;margin-left:10px}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items.loading,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items.loading,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts.loading,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts.loading{min-height:40px;background:#FFFFFF url("img/wpspin_light.gif") center center no-repeat}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items.loading,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items.loading,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts.loading,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts.loading{background-image:url("img/wpspin_light-2x.gif");background-size:16px 16px}}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .items.loading li,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .items.loading li,.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .posts.loading li,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .posts.loading li{display:none}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .buttons,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .buttons{margin-top:15px;text-align:right}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .existing-content-selector .buttons a,.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector .buttons a{display:inline-block}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .url-input-wrapper,.siteorigin-widget-form .siteorigin-widget-field-type-link .url-input-wrapper{display:block;margin-right:130px}.siteorigin-widget-form .siteorigin-widget-field-type-autocomplete .select-content-button,.siteorigin-widget-form .siteorigin-widget-field-type-link .select-content-button{float:right;line-height:28px;min-height:30px;width:120px;text-align:center}.siteorigin-widget-form .siteorigin-widget-field-type-link .existing-content-selector{right:0}.siteorigin-widget-form .siteorigin-widget-description{clear:both}.siteorigin-widget-preview{display:block !important}.siteorigin-widget-help-link{display:block;margin:1em 0}.so-widgets-dialog .so-widgets-dialog-overlay{position:fixed;z-index:500000;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.7)}.so-widgets-dialog .so-widgets-toolbar,.so-widgets-dialog .so-widgets-dialog-frame{position:fixed;z-index:500001;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.so-widgets-dialog .so-widgets-toolbar{left:30px;right:30px;top:30px;height:50px;background:#fafafa;border-bottom:1px solid #D8D8D8}.so-widgets-dialog .so-widgets-toolbar h3{margin:15px 0 15px 20px}.so-widgets-dialog .so-widgets-toolbar .close{position:absolute;box-sizing:border-box;width:50px;height:50px;display:block;cursor:pointer;top:0;right:0;-webkit-transition:all .2s ease;-moz-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease;background:#fafafa;border-left:1px solid #d8d8d8;border-bottom:1px solid #d8d8d8}.so-widgets-dialog .so-widgets-toolbar .close:focus,.so-widgets-dialog .so-widgets-toolbar .close:hover{background:#e9e9e9}.so-widgets-dialog .so-widgets-toolbar .close:focus .so-dialog-icon,.so-widgets-dialog .so-widgets-toolbar .close:hover .so-dialog-icon{color:#333333}.so-widgets-dialog .so-widgets-toolbar .close .dashicons{position:absolute;top:50%;left:50%;text-decoration:none;width:21px;height:21px;margin-left:-11px;margin-top:-10px;font-size:21px;color:#666666;text-align:center}.so-widgets-dialog .so-widgets-dialog-frame{top:80px;left:30px;right:30px;bottom:30px;background:#FFFFFF url("img/wpspin_light.gif") center center no-repeat}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.so-widgets-dialog .so-widgets-dialog-frame{background-image:url("img/wpspin_light-2x.gif");background-size:16px 16px}}.so-widgets-dialog .so-widgets-dialog-frame iframe{width:100%;height:100%}.widget-icon.so-widget-icon{background-size:cover;background-image:url("img/bundle-icon.png")}.widget-icon.so-widget-icon.so-block-editor-icon{width:20px;height:20px;display:inline-block}.block-editor .so-widget-placeholder{text-align:left}.block-editor .so-widget-placeholder>.components-placeholder__label{background:url("img/bundle-icon.png") no-repeat left;background-size:20px;padding-left:25px}.block-editor .so-widget-placeholder>.components-placeholder__fieldset{max-width:unset}.block-editor .so-widget-placeholder>.components-placeholder__fieldset .so-widget-block-container{width:100%}.block-editor .so-widget-placeholder>.components-placeholder__fieldset .so-widget-block-container .components-base-control__field select{max-width:unset}.block-editor .so-widget-placeholder>.components-placeholder__fieldset .so-widget-block-container .siteorigin-widget-form.siteorigin-widget-form-main{min-width:unset}.block-editor .so-widget-placeholder .components-base-control__field select,.block-editor .siteorigin-widget-field select{border:1px solid #8c8f94;border-radius:3px;box-shadow:none;color:#2c3338;font-size:14px;padding:0 24px 0 8px}.block-editor .siteorigin-widget-form .siteorigin-widget-field{text-align:left}.block-editor .siteorigin-widget-form .siteorigin-widget-field input{padding:0 8px;line-height:2}.block-editor .siteorigin-widget-form .siteorigin-widget-field input[type=checkbox]{background-color:#ffffff}.block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-autocomplete .select-content-button,.block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-link .select-content-button{box-shadow:unset;font-size:13px;height:28px}.block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current{height:37px}.block-editor .siteorigin-widget-form .siteorigin-widget-field.siteorigin-widget-field-type-tinymce .wp-switch-editor{box-sizing:content-box}.block-editor .so-widget-preview-container .so-widgets-spinner-container{text-align:center}.block-editor .so-widget-preview-container .so-widgets-spinner-container>span{display:inline-block}
|
base/inc/actions.php
CHANGED
@@ -177,7 +177,7 @@ function siteorigin_widget_remote_image_search(){
|
|
177 |
// Send the query to stock search server
|
178 |
$url = add_query_arg( array(
|
179 |
'q' => $_GET[ 'q' ],
|
180 |
-
'page' => !empty( $_GET[ 'page' ] ) ?
|
181 |
), 'http://stock.siteorigin.com/wp-admin/admin-ajax.php?action=image_search' );
|
182 |
|
183 |
$result = wp_remote_get( $url, array(
|
177 |
// Send the query to stock search server
|
178 |
$url = add_query_arg( array(
|
179 |
'q' => $_GET[ 'q' ],
|
180 |
+
'page' => ! empty( $_GET[ 'page' ] ) ? (int) $_GET[ 'page' ] : 1,
|
181 |
), 'http://stock.siteorigin.com/wp-admin/admin-ajax.php?action=image_search' );
|
182 |
|
183 |
$result = wp_remote_get( $url, array(
|
base/inc/attachments.php
CHANGED
@@ -14,8 +14,8 @@ function siteorigin_widgets_get_attachment_image_src( $attachment, $size, $fallb
|
|
14 |
$url = parse_url( $fallback );
|
15 |
|
16 |
if( !empty($url['fragment']) && preg_match('/^([0-9]+)x([0-9]+)$/', $url['fragment'], $matches) ) {
|
17 |
-
$width =
|
18 |
-
$height =
|
19 |
}
|
20 |
else {
|
21 |
$width = 0;
|
14 |
$url = parse_url( $fallback );
|
15 |
|
16 |
if( !empty($url['fragment']) && preg_match('/^([0-9]+)x([0-9]+)$/', $url['fragment'], $matches) ) {
|
17 |
+
$width = (int) $matches[1];
|
18 |
+
$height = (int) $matches[2];
|
19 |
}
|
20 |
else {
|
21 |
$width = 0;
|
base/inc/fields/autocomplete.class.php
CHANGED
@@ -43,7 +43,8 @@ class SiteOrigin_Widget_Field_Autocomplete extends SiteOrigin_Widget_Field_Text_
|
|
43 |
<input type="text" class="content-text-search"
|
44 |
data-post-types="<?php echo esc_attr( $post_types ) ?>"
|
45 |
data-source="<?php echo esc_attr( $this->source ) ?>"
|
46 |
-
placeholder="<?php esc_attr_e( 'Search', 'so-widgets-bundle' ) ?>"
|
|
|
47 |
|
48 |
<ul class="items"></ul>
|
49 |
|
43 |
<input type="text" class="content-text-search"
|
44 |
data-post-types="<?php echo esc_attr( $post_types ) ?>"
|
45 |
data-source="<?php echo esc_attr( $this->source ) ?>"
|
46 |
+
placeholder="<?php esc_attr_e( 'Search', 'so-widgets-bundle' ) ?>"
|
47 |
+
tabindex="0"/>
|
48 |
|
49 |
<ul class="items"></ul>
|
50 |
|
base/inc/fields/code.class.php
CHANGED
@@ -18,7 +18,7 @@ class SiteOrigin_Widget_Field_Code extends SiteOrigin_Widget_Field_Text_Input_Ba
|
|
18 |
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
19 |
<?php if ( ! empty( $this->placeholder ) ) echo 'placeholder="' . esc_attr( $this->placeholder ) . '"' ?>
|
20 |
<?php $this->render_CSS_classes( $this->get_input_classes() ) ?>
|
21 |
-
rows="<?php echo ! empty( $this->rows ) ?
|
22 |
<?php if( ! empty( $this->readonly ) ) echo 'readonly' ?>><?php echo esc_textarea( $value ) ?></textarea>
|
23 |
<?php
|
24 |
}
|
18 |
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
19 |
<?php if ( ! empty( $this->placeholder ) ) echo 'placeholder="' . esc_attr( $this->placeholder ) . '"' ?>
|
20 |
<?php $this->render_CSS_classes( $this->get_input_classes() ) ?>
|
21 |
+
rows="<?php echo ! empty( $this->rows ) ? (int) $this->rows : 4 ?>"
|
22 |
<?php if( ! empty( $this->readonly ) ) echo 'readonly' ?>><?php echo esc_textarea( $value ) ?></textarea>
|
23 |
<?php
|
24 |
}
|
base/inc/fields/css/icon-field.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current{display:inline-block;background:#f9f9f9;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #f2f2f2), color-stop(1, #f9f9f9));background:-ms-linear-gradient(bottom, #f2f2f2, #f9f9f9);background:-moz-linear-gradient(center bottom, #f2f2f2 0%, #f9f9f9 100%);background:-o-linear-gradient(#f9f9f9, #f2f2f2);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#f2f2f2', GradientType=0);-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.1);box-shadow:0 1px 2px rgba(0,0,0,0.1);box-sizing:content-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;vertical-align:middle;border:1px solid #bbbbbb;height:35px}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current:hover{background:#ffffff;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #f7f7f7), color-stop(1, #ffffff));background:-ms-linear-gradient(bottom, #f7f7f7, #ffffff);background:-moz-linear-gradient(center bottom, #f7f7f7 0%, #ffffff 100%);background:-o-linear-gradient(#ffffff, #f7f7f7);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f7f7f7', GradientType=0);-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.15);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.15);box-shadow:0 1px 2px rgba(0,0,0,0.15)}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current .siteorigin-widget-icon{-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;margin:4px;padding:3px;border:1px solid #999;background:#f3f3f3;height:27px;width:32px;text-align:center}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current .siteorigin-widget-icon span{color:#333;font-size:20px}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current label{display:block;float:left;color:#666;text-decoration:none;text-shadow:0 1px 0 #FFF;font-weight:600;font-size:11px;padding:9px 10px 7px 7px;outline:none;cursor:pointer}.siteorigin-widget-form .siteorigin-widget-field-type-icon .so-icon-remove{cursor:pointer;display:inline-block;text-decoration:none;color:#AAA;font-size:11px;line-height:1em;padding:11px 0 11px 6px}.siteorigin-widget-form .siteorigin-widget-field-type-icon.siteorigin-widget-active .so-icon-remove{display:none}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector{display:none;padding:10px;border:1px solid #D8D8D8;background:#FFFFFF;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.0275);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.0275);box-shadow:0 1px 2px rgba(0,0,0,0.0275);margin-top:10px}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector select.siteorigin-widget-icon-family{font-size:11px;display:inline-block}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-search{font-size:11px;display:inline-block;width:260px;padding:6px 8px}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons{height:160px;overflow-y:scroll;margin-top:10px}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons .siteorigin-widget-icon-icons-icon{-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;width:58px;height:48px;margin:3px;padding:5px 0;border:1px solid #D0D0D0;background:#FFFFFF;font-size:35px;overflow:hidden;cursor:pointer;text-align:center}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons .siteorigin-widget-icon-icons-icon.siteorigin-widget-active{background:#f6fafc;border:1px solid #43aaec;color:#078dce;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.25);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.25);box-shadow:0 1px 2px rgba(0,0,0,0.25)}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons.loading{min-height:40px;background:#FFFFFF url("../../../css/img/wpspin_light.gif") center center no-repeat}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons.loading{background-image:url("../../../css/img/wpspin_light-2x.gif");background-size:16px 16px}}
|
1 |
+
.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current{display:inline-block;background:#f9f9f9;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #f2f2f2), color-stop(1, #f9f9f9));background:-ms-linear-gradient(bottom, #f2f2f2, #f9f9f9);background:-moz-linear-gradient(center bottom, #f2f2f2 0%, #f9f9f9 100%);background:-o-linear-gradient(#f9f9f9, #f2f2f2);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#f2f2f2', GradientType=0);-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.1);box-shadow:0 1px 2px rgba(0,0,0,0.1);box-sizing:content-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;vertical-align:middle;border:1px solid #bbbbbb;height:35px}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current:focus,.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current:hover{background:#ffffff;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #f7f7f7), color-stop(1, #ffffff));background:-ms-linear-gradient(bottom, #f7f7f7, #ffffff);background:-moz-linear-gradient(center bottom, #f7f7f7 0%, #ffffff 100%);background:-o-linear-gradient(#ffffff, #f7f7f7);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f7f7f7', GradientType=0);-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.15);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.15);box-shadow:0 1px 2px rgba(0,0,0,0.15)}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current .siteorigin-widget-icon{-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;margin:4px;padding:3px;border:1px solid #999;background:#f3f3f3;height:27px;width:32px;text-align:center}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current .siteorigin-widget-icon span{color:#333;font-size:20px}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector-current label{display:block;float:left;color:#666;text-decoration:none;text-shadow:0 1px 0 #FFF;font-weight:600;font-size:11px;padding:9px 10px 7px 7px;outline:none;cursor:pointer}.siteorigin-widget-form .siteorigin-widget-field-type-icon .so-icon-remove{cursor:pointer;display:inline-block;text-decoration:none;color:#AAA;font-size:11px;line-height:1em;padding:11px 0 11px 6px;-webkit-transition:all .25s ease;-moz-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease}.siteorigin-widget-form .siteorigin-widget-field-type-icon .so-icon-remove:focus,.siteorigin-widget-form .siteorigin-widget-field-type-icon .so-icon-remove:hover{color:#bc0b0b}.siteorigin-widget-form .siteorigin-widget-field-type-icon.siteorigin-widget-active .so-icon-remove{display:none}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector{display:none;padding:10px;border:1px solid #D8D8D8;background:#FFFFFF;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.0275);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.0275);box-shadow:0 1px 2px rgba(0,0,0,0.0275);margin-top:10px}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector select.siteorigin-widget-icon-family{font-size:11px;display:inline-block}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-search{font-size:11px;display:inline-block;width:260px;padding:6px 8px}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons{height:160px;overflow-y:scroll;margin-top:10px}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons .siteorigin-widget-icon-icons-icon{-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;width:58px;height:48px;margin:3px;padding:5px 0;border:1px solid #D0D0D0;background:#FFFFFF;font-size:35px;overflow:hidden;cursor:pointer;text-align:center}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons .siteorigin-widget-icon-icons-icon:focus{background:#fcf8f8;border:1px solid #43aaec}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons .siteorigin-widget-icon-icons-icon.siteorigin-widget-active{background:#f6fafc;border:1px solid #43aaec;color:#078dce;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.25);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.25);box-shadow:0 1px 2px rgba(0,0,0,0.25)}.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons.loading{min-height:40px;background:#FFFFFF url("../../../css/img/wpspin_light.gif") center center no-repeat}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.siteorigin-widget-form .siteorigin-widget-field-type-icon .siteorigin-widget-icon-selector .siteorigin-widget-icon-icons.loading{background-image:url("../../../css/img/wpspin_light-2x.gif");background-size:16px 16px}}
|
base/inc/fields/css/image-size-field.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.siteorigin-widget-form .siteorigin-widget-field-size .custom-size-wrapper{margin-top:15px}.siteorigin-widget-form .siteorigin-widget-field-size .custom-size-wrapper label{font-weight:bold;font-size:13px}.siteorigin-widget-form .siteorigin-widget-field-size .custom-size-wrapper .siteorigin-widget-input{font-weight:400;width:80px}
|
base/inc/fields/css/measurement-field.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.siteorigin-widget-form .siteorigin-widget-field input[type="text"].siteorigin-widget-input-measurement{float:left;max-width:58px;margin-right:1px;min-height:
|
1 |
+
.siteorigin-widget-form .siteorigin-widget-field input[type="text"].siteorigin-widget-input-measurement{float:left;max-width:58px;margin-right:1px;min-height:30px;vertical-align:middle;padding:0 8px}.siteorigin-widget-form .siteorigin-widget-field select.sow-measurement-select-unit{min-width:inherit;padding:0 24px 0}.siteorigin-widget-form .siteorigin-widget-field input[type="text"].siteorigin-widget-input-measurement,.siteorigin-widget-form .siteorigin-widget-field select.sow-measurement-select-unit{line-height:2em}@media (max-width:680px){.siteorigin-widget-form .siteorigin-widget-field input[type="text"].siteorigin-widget-input-measurement{margin-right:1%;max-width:none}.siteorigin-widget-form .siteorigin-widget-field input[type="text"].siteorigin-widget-input-measurement,.siteorigin-widget-form .siteorigin-widget-field select.sow-measurement-select-unit{width:49%}}
|
base/inc/fields/css/media-field.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper{border:1px solid #bbb;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.1);box-shadow:0 1px 2px rgba(0, 0, 0, 0.1);box-sizing:content-box;display:block;float:left;font-size:13px;background:#f9f9f9;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #f2f2f2), color-stop(1, #f9f9f9));background:-ms-linear-gradient(bottom, #f2f2f2, #f9f9f9);background:-moz-linear-gradient(center bottom, #f2f2f2 0%, #f9f9f9 100%);background:-o-linear-gradient(#f9f9f9, #f2f2f2);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#f2f2f2', GradientType=0);height:32px;line-height:18.2px;overflow:auto;position:relative;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper:hover{-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.15);box-shadow:0 1px 2px rgba(0, 0, 0, 0.15)}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper *{box-sizing:content-box}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .current{border-right:1px solid #bbb;box-shadow:1px 0 0 #fff;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;height:32px;overflow:hidden;padding:4px;position:relative}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .current .title{background:#333;bottom:34px;color:#ccc;display:none;font-weight:bold;left:0;padding:4px 12px;position:absolute;white-space:nowrap;width:auto}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .current .thumbnail-wrapper{border:1px solid #999;box-shadow:0 1px 1px #fff;box-shadow:inset 0 1px 3px rgba(0,0,0,0.2);height:22px;background:#cfcfcf;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #cccccc), color-stop(1, #cfcfcf));background:-ms-linear-gradient(bottom, #cccccc, #cfcfcf);background:-moz-linear-gradient(center bottom, #cccccc 0%, #cfcfcf 100%);background:-o-linear-gradient(#cfcfcf, #cccccc);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#cfcfcf', endColorstr='#cccccc', GradientType=0);line-height:0;width:22px}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .current .thumbnail-wrapper img{box-shadow:inset 0 1px 3px rgba(0,0,0,0.2);height:100%;width:100%}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .media-upload-button,.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .find-image-button{display:block;border-bottom:none;cursor:pointer;float:left;font-size:11px;font-weight:600;color:#666;outline:none;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;line-height:32px;padding:0 8px;text-decoration:none;text-shadow:0 1px 0 #fff}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .media-upload-button:hover,.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .find-image-button:hover{background:rgba(255,255,255,0.75)}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .find-image-button{border-left:1px solid #bbb}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper:hover .media-upload-button{color:#707070}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-remove-button{display:block;border-bottom:none;color:#aaa;float:left;font-size:11px;line-height:1em;margin-right:25px;opacity:1;padding:11px 0 11px 6px;position:static;text-decoration:none;-webkit-transition:all .25s ease;-moz-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-remove-button.remove-hide{opacity:0;pointer-events:none}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-remove-button:hover{color:#bc0b0b}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-fallback-external{width:100%}@media (max-width:680px){.siteorigin-widget-form .siteorigin-widget-field-type-media .media-fallback-external{margin-top:1em !important}}@media (min-width:680px){.siteorigin-widget-form .siteorigin-widget-field-type-media .media-fallback-external{float:left;margin-top:2px !important;max-width:320px}}#so-widgets-image-search-frame{background-color:#fff;bottom:0;left:0;overflow-x:hidden;overflow-y:scroll;padding:25px;position:absolute;right:0;top:0}#so-widgets-image-search-frame #so-widgets-image-search-form{box-sizing:border-box;display:block;margin-bottom:2px;position:relative;width:100%}@media (min-width:783px){#so-widgets-image-search-frame #so-widgets-image-search-form{padding-right:368px}}#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-input{box-shadow:none;margin-bottom:0px;padding:9px 12px}#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-input:focus{box-shadow:none}#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-button{border-width:1px;box-shadow:none;font-size:1.2em;height:100%;padding:0 14px;position:absolute;right:320px;top:0}@media (max-width:783px){#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-button{right:0}}#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-button .dashicons-search{vertical-align:middle}#so-widgets-image-search-frame #so-widgets-image-search-suggestions{display:none;font-size:1.1em;height:40px;overflow:hidden;position:absolute;right:0;text-align:right;top:0;width:300px}#so-widgets-image-search-frame #so-widgets-image-search-suggestions strong{display:block}#so-widgets-image-search-frame #so-widgets-image-search-suggestions ul{display:block;list-style:none;margin:0;padding:0}#so-widgets-image-search-frame #so-widgets-image-search-suggestions ul li{display:inline-block;margin-right:4px}#so-widgets-image-search-frame #so-widgets-image-search-powered{color:#888;font-size:.85em;margin-bottom:15px}#so-widgets-image-search-frame .so-widgets-image-results{zoom:1;margin:0 -8px}#so-widgets-image-search-frame .so-widgets-image-results:before{content:'';display:block}#so-widgets-image-search-frame .so-widgets-image-results:after{content:'';display:table;clear:both}#so-widgets-image-search-frame .so-widgets-image-results .so-widgets-result{-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;margin:8px}#so-widgets-image-search-frame .so-widgets-image-results .so-widgets-result a{background-color:#e8e8e8;background-repeat:no-repeat;background-size:cover;display:block;position:relative;height:180px;width:260px}#so-widgets-image-search-frame .so-widgets-image-results .so-widgets-result a .so-widgets-result-sponsored{background:#59946b;border-radius:2px;color:#fff;font-size:.8em;line-height:1em;padding:5px;position:absolute;right:5px;top:5px}#so-widgets-image-search-frame .so-widgets-results-loading{background-color:#f7f7f7;display:none;font-size:1.1em;margin-top:20px;padding:15px 5px;text-align:center}#so-widgets-image-search-frame .so-widgets-results-loading .so-widgets-loading-icon{background-image:url("images/wpspin_light.gif");background-position:center center;background-repeat:no-repeat;display:inline-block;height:16px;margin:0 6px -3px 0;width:16px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#so-widgets-image-search-frame .so-widgets-results-loading .so-widgets-loading-icon{background-image:url(images/wpspin_light-2x.gif);background-size:16px 16px}}#so-widgets-image-search-frame .so-widgets-results-more{display:none;margin-top:20px;padding-bottom:20px;text-align:center}#so-widgets-image-search-frame .so-widgets-preview-window{background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,0.35);display:none;padding:10px;pointer-events:none;position:fixed}#so-widgets-image-search-frame .so-widgets-preview-window .so-widgets-preview-window-inside{background-size:cover;overflow:hidden}#so-widgets-image-search-frame .so-widgets-preview-window img{height:auto;width:100%}#so-widgets-image-search-frame.so-widgets-importing .so-widgets-preview-window,#so-widgets-image-search-frame.so-widgets-importing #so-widgets-image-search-form,#so-widgets-image-search-frame.so-widgets-importing #so-widgets-image-search-powered,#so-widgets-image-search-frame.so-widgets-importing .so-widgets-image-results{display:none !important;visibility:hidden !important}
|
1 |
+
.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper{border:1px solid #bbb;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.1);box-shadow:0 1px 2px rgba(0, 0, 0, 0.1);box-sizing:content-box;display:block;float:left;font-size:13px;background:#f9f9f9;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #f2f2f2), color-stop(1, #f9f9f9));background:-ms-linear-gradient(bottom, #f2f2f2, #f9f9f9);background:-moz-linear-gradient(center bottom, #f2f2f2 0%, #f9f9f9 100%);background:-o-linear-gradient(#f9f9f9, #f2f2f2);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#f2f2f2', GradientType=0);height:32px;line-height:18.2px;overflow:auto;position:relative;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper:focus,.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper:hover{-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.15);box-shadow:0 1px 2px rgba(0, 0, 0, 0.15)}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper *{box-sizing:content-box}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .current{border-right:1px solid #bbb;box-shadow:1px 0 0 #fff;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;height:32px;overflow:hidden;padding:4px;position:relative}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .current .title{background:#333;bottom:34px;color:#ccc;display:none;font-weight:bold;left:0;padding:4px 12px;position:absolute;white-space:nowrap;width:auto}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .current .thumbnail-wrapper{border:1px solid #999;box-shadow:0 1px 1px #fff;box-shadow:inset 0 1px 3px rgba(0,0,0,0.2);height:22px;background:#cfcfcf;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #cccccc), color-stop(1, #cfcfcf));background:-ms-linear-gradient(bottom, #cccccc, #cfcfcf);background:-moz-linear-gradient(center bottom, #cccccc 0%, #cfcfcf 100%);background:-o-linear-gradient(#cfcfcf, #cccccc);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#cfcfcf', endColorstr='#cccccc', GradientType=0);line-height:0;width:22px}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .current .thumbnail-wrapper img{box-shadow:inset 0 1px 3px rgba(0,0,0,0.2);height:100%;width:100%}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .media-upload-button,.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .find-image-button{display:block;border-bottom:none;cursor:pointer;float:left;font-size:11px;font-weight:600;color:#666;outline:none;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;line-height:32px;padding:0 8px;text-decoration:none;text-shadow:0 1px 0 #fff}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .media-upload-button:focus,.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .find-image-button:focus,.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .media-upload-button:hover,.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .find-image-button:hover{background:rgba(255,255,255,0.75)}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper .find-image-button{border-left:1px solid #bbb}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper:focus .media-upload-button,.siteorigin-widget-form .siteorigin-widget-field-type-media .media-field-wrapper:hover .media-upload-button{color:#707070}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-remove-button{display:block;border-bottom:none;color:#aaa;float:left;font-size:11px;line-height:1em;margin-right:25px;opacity:1;padding:11px 0 11px 6px;position:static;text-decoration:none;-webkit-transition:all .25s ease;-moz-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-remove-button.remove-hide{opacity:0;pointer-events:none}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-remove-button:focus,.siteorigin-widget-form .siteorigin-widget-field-type-media .media-remove-button:hover{color:#bc0b0b}.siteorigin-widget-form .siteorigin-widget-field-type-media .media-fallback-external{width:100%}@media (max-width:680px){.siteorigin-widget-form .siteorigin-widget-field-type-media .media-fallback-external{margin-top:1em !important}}@media (min-width:680px){.siteorigin-widget-form .siteorigin-widget-field-type-media .media-fallback-external{float:left;margin-top:2px !important;max-width:320px}}#so-widgets-image-search-frame{background-color:#fff;bottom:0;left:0;overflow-x:hidden;overflow-y:scroll;padding:25px;position:absolute;right:0;top:0}#so-widgets-image-search-frame #so-widgets-image-search-form{box-sizing:border-box;display:block;margin-bottom:2px;position:relative;width:100%}@media (min-width:783px){#so-widgets-image-search-frame #so-widgets-image-search-form{padding-right:368px}}#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-input{box-shadow:none;margin-bottom:0px;padding:9px 12px}#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-input:focus{box-shadow:none}#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-button{border-width:1px;box-shadow:none;font-size:1.2em;height:100%;padding:0 14px;position:absolute;right:320px;top:0}@media (max-width:783px){#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-button{right:0}}#so-widgets-image-search-frame #so-widgets-image-search-form .so-widgets-search-button .dashicons-search{vertical-align:middle}#so-widgets-image-search-frame #so-widgets-image-search-suggestions{display:none;font-size:1.1em;height:40px;overflow:hidden;position:absolute;right:0;text-align:right;top:0;width:300px}#so-widgets-image-search-frame #so-widgets-image-search-suggestions strong{display:block}#so-widgets-image-search-frame #so-widgets-image-search-suggestions ul{display:block;list-style:none;margin:0;padding:0}#so-widgets-image-search-frame #so-widgets-image-search-suggestions ul li{display:inline-block;margin-right:4px}#so-widgets-image-search-frame #so-widgets-image-search-powered{color:#888;font-size:.85em;margin-bottom:15px}#so-widgets-image-search-frame .so-widgets-image-results{zoom:1;margin:0 -8px}#so-widgets-image-search-frame .so-widgets-image-results:before{content:'';display:block}#so-widgets-image-search-frame .so-widgets-image-results:after{content:'';display:table;clear:both}#so-widgets-image-search-frame .so-widgets-image-results .so-widgets-result{-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;margin:8px}#so-widgets-image-search-frame .so-widgets-image-results .so-widgets-result a{background-color:#e8e8e8;background-repeat:no-repeat;background-size:cover;display:block;position:relative;height:180px;width:260px}#so-widgets-image-search-frame .so-widgets-image-results .so-widgets-result a .so-widgets-result-sponsored{background:#59946b;border-radius:2px;color:#fff;font-size:.8em;line-height:1em;padding:5px;position:absolute;right:5px;top:5px}#so-widgets-image-search-frame .so-widgets-results-loading{background-color:#f7f7f7;display:none;font-size:1.1em;margin-top:20px;padding:15px 5px;text-align:center}#so-widgets-image-search-frame .so-widgets-results-loading .so-widgets-loading-icon{background-image:url("images/wpspin_light.gif");background-position:center center;background-repeat:no-repeat;display:inline-block;height:16px;margin:0 6px -3px 0;width:16px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#so-widgets-image-search-frame .so-widgets-results-loading .so-widgets-loading-icon{background-image:url(images/wpspin_light-2x.gif);background-size:16px 16px}}#so-widgets-image-search-frame .so-widgets-results-more{display:none;margin-top:20px;padding-bottom:20px;text-align:center}#so-widgets-image-search-frame .so-widgets-preview-window{background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,0.35);display:none;padding:10px;pointer-events:none;position:fixed}#so-widgets-image-search-frame .so-widgets-preview-window .so-widgets-preview-window-inside{background-size:cover;overflow:hidden}#so-widgets-image-search-frame .so-widgets-preview-window img{height:auto;width:100%}#so-widgets-image-search-frame.so-widgets-importing .so-widgets-preview-window,#so-widgets-image-search-frame.so-widgets-importing #so-widgets-image-search-form,#so-widgets-image-search-frame.so-widgets-importing #so-widgets-image-search-powered,#so-widgets-image-search-frame.so-widgets-importing .so-widgets-image-results{display:none !important;visibility:hidden !important}
|
base/inc/fields/date-range.class.php
CHANGED
@@ -118,7 +118,7 @@ class SiteOrigin_Widget_Field_Date_Range extends SiteOrigin_Widget_Field_Base {
|
|
118 |
$value[$key] = array();
|
119 |
}
|
120 |
$item = $value[$key];
|
121 |
-
$val = empty( $item['value'] ) ? 0 :
|
122 |
$unit = ( ! empty( $item['unit'] ) && in_array( $item['unit'], $unit_keys ) ) ? $item['unit'] : $unit_keys[0];
|
123 |
$value[$key] = array( 'value' => $val, 'unit' => $unit );
|
124 |
}
|
118 |
$value[$key] = array();
|
119 |
}
|
120 |
$item = $value[$key];
|
121 |
+
$val = empty( $item['value'] ) ? 0 : (int) $item['value'];
|
122 |
$unit = ( ! empty( $item['unit'] ) && in_array( $item['unit'], $unit_keys ) ) ? $item['unit'] : $unit_keys[0];
|
123 |
$value[$key] = array( 'value' => $val, 'unit' => $unit );
|
124 |
}
|
base/inc/fields/font.class.php
CHANGED
@@ -26,8 +26,8 @@ class SiteOrigin_Widget_Field_Font extends SiteOrigin_Widget_Field_Base {
|
|
26 |
protected function sanitize_field_input( $value, $instance ) {
|
27 |
$sanitized_value = trim( $value );
|
28 |
// Any alphanumeric character followed by alphanumeric or whitespace characters (except newline),
|
29 |
-
// with optional colon
|
30 |
-
if( preg_match( '/[\w\d]+[\w\d\t\r ]*(:\
|
31 |
$sanitized_value = $sanitized_matches[0];
|
32 |
}
|
33 |
else {
|
@@ -43,4 +43,4 @@ class SiteOrigin_Widget_Field_Font extends SiteOrigin_Widget_Field_Base {
|
|
43 |
|
44 |
return $sanitized_value;
|
45 |
}
|
46 |
-
}
|
26 |
protected function sanitize_field_input( $value, $instance ) {
|
27 |
$sanitized_value = trim( $value );
|
28 |
// Any alphanumeric character followed by alphanumeric or whitespace characters (except newline),
|
29 |
+
// with optional colon followed by optional variant.
|
30 |
+
if ( preg_match( '/[\w\d]+[\w\d\t\r ]*(:\w+)?/', $sanitized_value, $sanitized_matches ) ) {
|
31 |
$sanitized_value = $sanitized_matches[0];
|
32 |
}
|
33 |
else {
|
43 |
|
44 |
return $sanitized_value;
|
45 |
}
|
46 |
+
}
|
base/inc/fields/icon.class.php
CHANGED
@@ -33,12 +33,12 @@ class SiteOrigin_Widget_Field_Icon extends SiteOrigin_Widget_Field_Base {
|
|
33 |
}
|
34 |
?>
|
35 |
|
36 |
-
<div class="siteorigin-widget-icon-selector-current">
|
37 |
<div class="siteorigin-widget-icon"><span></span></div>
|
38 |
<label><?php _e('Choose Icon', 'so-widgets-bundle') ?></label>
|
39 |
</div>
|
40 |
|
41 |
-
<a class="so-icon-remove" style="display: <?php echo !empty( $value ) ? 'inline-block' : 'none' ?>;"><?php esc_html_e( 'Remove', 'so-widgets-bundle' ) ?></a>
|
42 |
|
43 |
<div class="clear"></div>
|
44 |
|
33 |
}
|
34 |
?>
|
35 |
|
36 |
+
<div class="siteorigin-widget-icon-selector-current" tabindex="0">
|
37 |
<div class="siteorigin-widget-icon"><span></span></div>
|
38 |
<label><?php _e('Choose Icon', 'so-widgets-bundle') ?></label>
|
39 |
</div>
|
40 |
|
41 |
+
<a class="so-icon-remove" style="display: <?php echo !empty( $value ) ? 'inline-block' : 'none' ?>;" tabindex="0"><?php esc_html_e( 'Remove', 'so-widgets-bundle' ) ?></a>
|
42 |
|
43 |
<div class="clear"></div>
|
44 |
|
base/inc/fields/image-size.class.php
CHANGED
@@ -4,6 +4,13 @@
|
|
4 |
* Class SiteOrigin_Widget_Field_Image_Size
|
5 |
*/
|
6 |
class SiteOrigin_Widget_Field_Image_Size extends SiteOrigin_Widget_Field_Select {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
protected function get_default_options() {
|
9 |
$image_size_configs = siteorigin_widgets_get_image_sizes();
|
@@ -23,4 +30,53 @@ class SiteOrigin_Widget_Field_Image_Size extends SiteOrigin_Widget_Field_Select
|
|
23 |
);
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
4 |
* Class SiteOrigin_Widget_Field_Image_Size
|
5 |
*/
|
6 |
class SiteOrigin_Widget_Field_Image_Size extends SiteOrigin_Widget_Field_Select {
|
7 |
+
/**
|
8 |
+
* Whether to allow custom image sizes. By default, Custom Sizes are disabled.
|
9 |
+
*
|
10 |
+
* @access protected
|
11 |
+
* @var bool
|
12 |
+
*/
|
13 |
+
protected $custom_size;
|
14 |
|
15 |
protected function get_default_options() {
|
16 |
$image_size_configs = siteorigin_widgets_get_image_sizes();
|
30 |
);
|
31 |
}
|
32 |
|
33 |
+
// get_default_options() is triggered prior to $this->custom_size being
|
34 |
+
// available so we have to set up custom sizes at field initialization.
|
35 |
+
protected function initialize() {
|
36 |
+
if ( ! empty( $this->custom_size ) && ! empty( $this->options ) ) {
|
37 |
+
$this->options['custom_size'] = __( 'Custom Size', 'so-widgets-bundle' );
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
function enqueue_scripts() {
|
42 |
+
if ( ! empty( $this->custom_size ) ) {
|
43 |
+
wp_enqueue_script( 'so-image-size-field', plugin_dir_url( __FILE__ ) . 'js/image-size-field' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'jquery' ), SOW_BUNDLE_VERSION );
|
44 |
+
wp_enqueue_style( 'so-image-size-field', plugin_dir_url( __FILE__ ) . 'css/image-size-field.css', array(), SOW_BUNDLE_VERSION );
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
protected function render_after_field( $value, $instance ) {
|
49 |
+
if ( ! empty( $this->custom_size ) ) {
|
50 |
+
$field_prefix = $this->get_custom_size_setting_prefix( $this->base_name );
|
51 |
+
$width = ! empty( $instance[ $field_prefix . '_width' ] ) ? $instance[ $field_prefix . '_width' ] : '';
|
52 |
+
$height = ! empty( $instance[ $field_prefix . '_height' ] ) ? $instance[ $field_prefix . '_height' ] : '';
|
53 |
+
?>
|
54 |
+
|
55 |
+
<div class="custom-size-wrapper">
|
56 |
+
<label>
|
57 |
+
<?php _e( 'Width', 'so-widgets-bundle' ); ?>
|
58 |
+
<input type="number" value="<?php echo esc_attr( $width ); ?>"
|
59 |
+
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_width', $this->parent_container ) ); ?>"
|
60 |
+
class="custom-size-width siteorigin-widget-input" />
|
61 |
+
</label>
|
62 |
+
|
63 |
+
<label>
|
64 |
+
<?php _e( 'Height', 'so-widgets-bundle' ); ?>
|
65 |
+
<input type="number" value="<?php echo esc_attr( $height ); ?>"
|
66 |
+
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_height', $this->parent_container ) ); ?>"
|
67 |
+
class="custom-size-height siteorigin-widget-input" />
|
68 |
+
</label>
|
69 |
+
</div>
|
70 |
+
<?php
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
public function get_custom_size_setting_prefix( $base_name ) {
|
75 |
+
if ( strpos( $base_name, '][' ) !== false ) {
|
76 |
+
// Remove this splitter
|
77 |
+
$base_name = substr( $base_name, strpos( $base_name, '][' ) + 2 );
|
78 |
+
}
|
79 |
+
return $base_name;
|
80 |
+
}
|
81 |
+
|
82 |
}
|
base/inc/fields/js/autocomplete-field.js
CHANGED
@@ -94,8 +94,13 @@
|
|
94 |
$$.find('.button-close').on( 'click', closeContent );
|
95 |
|
96 |
// Clicking on one of the url items
|
97 |
-
$$.on( 'click', '.items li', function(e) {
|
98 |
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
99 |
var $li = $(this);
|
100 |
var selectedItems = getSelectedItems();
|
101 |
var clickedItem = $li.data( 'value' );
|
94 |
$$.find('.button-close').on( 'click', closeContent );
|
95 |
|
96 |
// Clicking on one of the url items
|
97 |
+
$$.on( 'click keypress', '.items li', function( e ) {
|
98 |
e.preventDefault();
|
99 |
+
|
100 |
+
if ( e.type == 'keyup' && ! window.sowbForms.isEnter( e ) ) {
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
|
104 |
var $li = $(this);
|
105 |
var selectedItems = getSelectedItems();
|
106 |
var clickedItem = $li.data( 'value' );
|
base/inc/fields/js/autocomplete-field.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){e(document).on("sowsetupformfield",".siteorigin-widget-field-type-autocomplete",(function(t){var i=e(this);if(!i.data("initialized")){var n=function(){var e=i.find("input.siteorigin-widget-input").val();return 0===e.length?[]:e.split(",")},
|
1 |
+
!function(e){e(document).on("sowsetupformfield",".siteorigin-widget-field-type-autocomplete",(function(t){var i=e(this);if(!i.data("initialized")){var n=function(){var e=i.find("input.siteorigin-widget-input").val();return 0===e.length?[]:e.split(",")},s=function(){var t=n();i.find("ul.items > li").each((function(i,n){var s=e(this);t.indexOf(s.data("value"))>-1?s.addClass("selected"):s.removeClass("selected")}))},a=function(){var t=i.find(".content-text-search"),n=t.val(),s=t.data("source"),a=t.data("postTypes"),o={action:"so_widgets_search_"+s};"posts"===s?(o.query=n,o.postTypes=a):"terms"===s&&(o.term=n);var l=i.find("ul.items").empty().addClass("loading");return e.get(soWidgets.ajaxurl,o,(function(t){t.forEach((function(t){""===t.label&&(t.label=" "),l.append(e("<li>").html(t.label+"<span>("+t.type+")</span>").data(t))})),l.removeClass("loading")}))};i.find(".siteorigin-widget-autocomplete-input").on("click",(function(){var t=i.find(".existing-content-selector");t.show();var n=new e.Deferred;t.is(":visible")&&0===t.find("ul.items li").length?n=a():n.resolve(),n.done(s)}));var o=function(){i.find(".existing-content-selector").hide()};e(window).on("mousedown",(function(e){0===i.find(e.target).length&&o()})),i.find(".button-close").on("click",o),i.on("click keypress",".items li",(function(t){if(t.preventDefault(),"keyup"!=t.type||window.sowbForms.isEnter(t)){var s=e(this),a=n(),o=s.data("value"),l=a.indexOf(o);l>-1?(a.splice(l,1),s.removeClass("selected")):(a.push(o),s.addClass("selected"));var d=i.find("input.siteorigin-widget-input");d.val(a.join(",")),d.trigger("change")}}));var l=null;i.find(".content-text-search").on("keyup",(function(){null!==l&&clearTimeout(l),l=setTimeout((function(){a()}),500)})),i.data("initialized",!0)}}))}(jQuery);
|
base/inc/fields/js/icon-field.js
CHANGED
@@ -17,16 +17,24 @@
|
|
17 |
}
|
18 |
|
19 |
// Clicking on the button should display the icon selector
|
20 |
-
$b.on( 'click', function() {
|
|
|
|
|
|
|
|
|
21 |
$is.slideToggle();
|
22 |
$search.val( '' );
|
23 |
searchIcons();
|
24 |
} );
|
25 |
|
26 |
// Clicking on the remove button
|
27 |
-
$remove.on( 'click', function( e )
|
28 |
e.preventDefault();
|
29 |
|
|
|
|
|
|
|
|
|
30 |
// Trigger a click on the existing icon to remove it.
|
31 |
$$.find('.siteorigin-widget-active').trigger( 'click' );
|
32 |
} );
|
@@ -116,11 +124,16 @@
|
|
116 |
}
|
117 |
var familyStyle = 'sow-icon-' + family + ( style ? ' ' + style : '' );
|
118 |
var familyValue = family + ( style ? '-' + style : '' ) + '-' + i;
|
|
|
119 |
var $icon = $( '<div data-sow-icon="' + unicode + '"></div>' )
|
120 |
.attr('data-value', familyValue )
|
121 |
.addClass( familyStyle )
|
122 |
.addClass( 'siteorigin-widget-icon-icons-icon' )
|
123 |
-
.on( 'click', function() {
|
|
|
|
|
|
|
|
|
124 |
var $$ = $(this);
|
125 |
|
126 |
if( $$.hasClass('siteorigin-widget-active') ) {
|
17 |
}
|
18 |
|
19 |
// Clicking on the button should display the icon selector
|
20 |
+
$b.on( 'click keyup', function( e ) {
|
21 |
+
if ( e.type == 'keyup' && ! window.sowbForms.isEnter( e ) ) {
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
|
25 |
$is.slideToggle();
|
26 |
$search.val( '' );
|
27 |
searchIcons();
|
28 |
} );
|
29 |
|
30 |
// Clicking on the remove button
|
31 |
+
$remove.on( 'click keyup', function( e ){
|
32 |
e.preventDefault();
|
33 |
|
34 |
+
if ( e.type == 'keyup' && ! window.sowbForms.isEnter( e ) ) {
|
35 |
+
return;
|
36 |
+
}
|
37 |
+
|
38 |
// Trigger a click on the existing icon to remove it.
|
39 |
$$.find('.siteorigin-widget-active').trigger( 'click' );
|
40 |
} );
|
124 |
}
|
125 |
var familyStyle = 'sow-icon-' + family + ( style ? ' ' + style : '' );
|
126 |
var familyValue = family + ( style ? '-' + style : '' ) + '-' + i;
|
127 |
+
|
128 |
var $icon = $( '<div data-sow-icon="' + unicode + '"></div>' )
|
129 |
.attr('data-value', familyValue )
|
130 |
.addClass( familyStyle )
|
131 |
.addClass( 'siteorigin-widget-icon-icons-icon' )
|
132 |
+
.on( 'click keyup', function( e ) {
|
133 |
+
if ( e.type == 'keyup' && ! window.sowbForms.isEnter( e ) ) {
|
134 |
+
return;
|
135 |
+
}
|
136 |
+
|
137 |
var $$ = $(this);
|
138 |
|
139 |
if( $$.hasClass('siteorigin-widget-active') ) {
|
base/inc/fields/js/icon-field.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(i){var e={};i(document).on("sowsetupformfield",".siteorigin-widget-field-type-icon",(function(n){var t=i(this),o=t.find(".siteorigin-widget-icon-selector"),s=o.find(".siteorigin-widget-icon-icon"),a=t.find(".siteorigin-widget-icon-selector-current"),d=t.find(".so-icon-remove"),
|
1 |
+
!function(i){var e={};i(document).on("sowsetupformfield",".siteorigin-widget-field-type-icon",(function(n){var t=i(this),o=t.find(".siteorigin-widget-icon-selector"),s=o.find(".siteorigin-widget-icon-icon"),a=t.find(".siteorigin-widget-icon-selector-current"),d=t.find(".so-icon-remove"),r=t.find(".siteorigin-widget-icon-search");if(!t.data("initialized")){a.on("click keyup",(function(i){("keyup"!=i.type||window.sowbForms.isEnter(i))&&(o.slideToggle(),r.val(""),c())})),d.on("click keyup",(function(i){i.preventDefault(),("keyup"!=i.type||window.sowbForms.isEnter(i))&&t.find(".siteorigin-widget-active").trigger("click")}));var c=function(){var e=r.val().toLowerCase();""===e?o.find(".siteorigin-widget-icon-icons-icon").show():o.find(".siteorigin-widget-icon-icons-icon").each((function(){var n=i(this),t=n.attr("data-value");-1===(t=t.replace(/-/," ")).indexOf(e)?n.hide():n.show()}))};r.keyup(c).on("change",c);var l=function(){var n=o.find("select.siteorigin-widget-icon-family").val(),t=o.find(".siteorigin-widget-icon-icons");if(void 0!==e[n]){t.empty();var r,l=e[n],g=l.icons;for(var f in l.hasOwnProperty("styles")&&l.styles&&(r=o.find(".siteorigin-widget-icon-family-styles").val()),0===i("#siteorigin-widget-font-"+n).length&&i("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+n).attr("href",e[n].style_uri).appendTo("head"),g){var w=g[f],v=w.hasOwnProperty("unicode")?w.unicode:w;if(!w.hasOwnProperty("styles")||-1!==w.styles.indexOf(r)){var y="sow-icon-"+n+(r?" "+r:""),p=n+(r?"-"+r:"")+"-"+f,u=i('<div data-sow-icon="'+v+'"></div>').attr("data-value",p).addClass(y).addClass("siteorigin-widget-icon-icons-icon").on("click keyup",(function(e){if("keyup"!=e.type||window.sowbForms.isEnter(e)){var n=i(this);n.hasClass("siteorigin-widget-active")?(n.removeClass("siteorigin-widget-active"),s.val(""),a.find("span").hide(),d.hide()):(t.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),n.addClass("siteorigin-widget-active"),s.val(n.data("value")),a.find("span").show().attr("data-sow-icon",n.attr("data-sow-icon")).attr("class","").addClass(y),d.show()),s.trigger("change",{isRendering:!0}),o.slideUp()}}));t.append(u),s.val()===p&&(a.find("span").show().attr("data-sow-icon",u.attr("data-sow-icon")).attr("class","").addClass(y),u.addClass("siteorigin-widget-active"))}}t.prepend(t.find(".siteorigin-widget-active")),c()}},g=function(n){var t=o.find("select.siteorigin-widget-icon-family").val(),s=o.find("select.siteorigin-widget-icon-family option:selected").data("icons");if(null!==s&&(e[t]=s),void 0!==t&&""!==t)if(void 0===e[t]){var a=o.find(".siteorigin-widget-icon-icons");a.addClass("loading"),i.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:o.find("select.siteorigin-widget-icon-family").val()},(function(s){e[t]=s,function(n){var t=o.find("select.siteorigin-widget-icon-family"),s=t.val();if(void 0!==e[s]){var a=o.find(".siteorigin-widget-icon-family-styles");if(!n){a.off("change",l),a.remove();var d=e[s];if(d.hasOwnProperty("styles")&&d.styles){var r="";for(var c in d.styles)r+='<option value="'+c+'">'+d.styles[c]+"</option>";r&&(a=i('<select class="siteorigin-widget-icon-family-styles"></select>').append(r),t.after(a))}}a.on("change",l)}}(n),a.removeClass("loading"),l()}))}else l()};g(!0),o.find("select.siteorigin-widget-icon-family").on("change",(function(){o.find(".siteorigin-widget-icon-icons").empty(),g()})),s.on("change",(function(i,e){e&&e.isRendering||l()})),t.data("initialized",!0)}}))}(jQuery);
|
base/inc/fields/js/image-size-field.js
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* global jQuery, soWidgets */
|
2 |
+
|
3 |
+
( function( $ ) {
|
4 |
+
|
5 |
+
$( document ).on( 'sowsetupformfield', '.siteorigin-widget-field-type-image-size', function( e ) {
|
6 |
+
var $$ = $( this ),
|
7 |
+
custom_size_wrapper = $$.find( '.custom-size-wrapper' );
|
8 |
+
|
9 |
+
$$.find( 'select.siteorigin-widget-input' ).on( 'change', function() {
|
10 |
+
if ( $( this ).val() == 'custom_size' ) {
|
11 |
+
custom_size_wrapper.show();
|
12 |
+
} else {
|
13 |
+
custom_size_wrapper.hide();
|
14 |
+
}
|
15 |
+
} ).trigger( 'change' );
|
16 |
+
} );
|
17 |
+
|
18 |
+
}( jQuery ) );
|
base/inc/fields/js/image-size-field.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(i){i(document).on("sowsetupformfield",".siteorigin-widget-field-type-image-size",(function(e){var t=i(this),n=t.find(".custom-size-wrapper");t.find("select.siteorigin-widget-input").on("change",(function(){"custom_size"==i(this).val()?n.show():n.hide()})).trigger("change")}))}(jQuery);
|
base/inc/fields/js/media-field.js
CHANGED
@@ -83,7 +83,7 @@
|
|
83 |
$thumbnail.attr('src', attachment.icon).fadeIn();
|
84 |
}
|
85 |
|
86 |
-
$field.find('.media-remove-button').removeClass('remove-hide');
|
87 |
|
88 |
frame.close();
|
89 |
} );
|
@@ -99,7 +99,7 @@
|
|
99 |
$field.find('.current .title' ).empty();
|
100 |
$inputField.trigger( 'change', { silent: true } );
|
101 |
$field.find('.current .thumbnail' ).fadeOut('fast');
|
102 |
-
$(this).addClass('remove-hide');
|
103 |
} );
|
104 |
|
105 |
// Everything for the dialog
|
@@ -127,7 +127,10 @@
|
|
127 |
if( ! dialog ) {
|
128 |
// Create the dialog
|
129 |
dialog = $( $('#so-widgets-bundle-tpl-image-search-dialog').html().trim() ).appendTo( 'body' );
|
130 |
-
dialog.find( '.close' ).on( 'click', function() {
|
|
|
|
|
|
|
131 |
dialog.hide();
|
132 |
} );
|
133 |
|
@@ -274,7 +277,7 @@
|
|
274 |
$inputField.val( response.attachment_id ).trigger('change', { silent: true } );
|
275 |
$field.find('.current .thumbnail' ).attr('src', response.thumb ).fadeIn();
|
276 |
|
277 |
-
$field.find('.media-remove-button').removeClass('remove-hide');
|
278 |
}
|
279 |
else {
|
280 |
alert( response.message );
|
@@ -394,7 +397,7 @@
|
|
394 |
else {
|
395 |
$thumbnail.attr( 'src', attachment.get('icon') ).fadeIn();
|
396 |
}
|
397 |
-
$field.find('.media-remove-button').removeClass('remove-hide');
|
398 |
} );
|
399 |
} else {
|
400 |
$field.find( 'a.media-remove-button' ).trigger( 'click' );
|
83 |
$thumbnail.attr('src', attachment.icon).fadeIn();
|
84 |
}
|
85 |
|
86 |
+
$field.find('.media-remove-button').removeClass('remove-hide').attr( 'tabindex', 0 );
|
87 |
|
88 |
frame.close();
|
89 |
} );
|
99 |
$field.find('.current .title' ).empty();
|
100 |
$inputField.trigger( 'change', { silent: true } );
|
101 |
$field.find('.current .thumbnail' ).fadeOut('fast');
|
102 |
+
$(this).addClass( 'remove-hide' ).attr( 'tabindex', -1 );
|
103 |
} );
|
104 |
|
105 |
// Everything for the dialog
|
127 |
if( ! dialog ) {
|
128 |
// Create the dialog
|
129 |
dialog = $( $('#so-widgets-bundle-tpl-image-search-dialog').html().trim() ).appendTo( 'body' );
|
130 |
+
dialog.find( '.close' ).on( 'click keyup', function( e ) {
|
131 |
+
if ( e.type == 'keyup' && ! window.sowbForms.isEnter( e ) ) {
|
132 |
+
return;
|
133 |
+
}
|
134 |
dialog.hide();
|
135 |
} );
|
136 |
|
277 |
$inputField.val( response.attachment_id ).trigger('change', { silent: true } );
|
278 |
$field.find('.current .thumbnail' ).attr('src', response.thumb ).fadeIn();
|
279 |
|
280 |
+
$field.find( '.media-remove-button' ).removeClass( 'remove-hide' ).attr( 'tabindex', 0 );
|
281 |
}
|
282 |
else {
|
283 |
alert( response.message );
|
397 |
else {
|
398 |
$thumbnail.attr( 'src', attachment.get('icon') ).fadeIn();
|
399 |
}
|
400 |
+
$field.find( '.media-remove-button' ).removeClass( 'remove-hide' ).attr( 'tabindex', 0 );
|
401 |
} );
|
402 |
} else {
|
403 |
$field.find( 'a.media-remove-button' ).trigger( 'click' );
|
base/inc/fields/js/media-field.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){e(document).on("sowsetupformfield",".siteorigin-widget-field-type-media",(function(t){var i=e(this),a=i.find("> .media-field-wrapper"),n=i.find(".siteorigin-widget-input").not(".media-fallback-external");if(!a.data("initialized")){var s;a.find(".media-upload-button").on("click",(function(t){if(t.preventDefault(),void 0!==wp.media){var a=e(this),s=e(this).data("frame");if(s)return s.open(),!1;(s=wp.media({title:a.data("choose"),library:{type:a.data("library").split(",").map((function(e){return e.trim()}))},button:{text:a.data("update"),close:!1}})).on("open",(function(){var e=s.state().get("selection"),t=i.find('.siteorigin-widget-input[type="hidden"]').val();t&&e.add(wp.media.attachment(t))})),a.data("frame",s),s.on("select",(function(){var e=s.state().get("selection").first().attributes;i.find(".current .thumbnail").attr("title",e.title),i.find(".current .title").html(e.title),n.val(e.id),n.trigger("change",{silent:!0});var t=i.find(".current .thumbnail");void 0!==e.sizes?void 0!==e.sizes.thumbnail?t.attr("src",e.sizes.thumbnail.url).fadeIn():t.attr("src",e.sizes.full.url).fadeIn():t.attr("src",e.icon).fadeIn(),i.find(".media-remove-button").removeClass("remove-hide"),s.close()})),s.open()}})),i.find("a.media-remove-button").on("click",(function(t){t.preventDefault(),n.val(""),i.find(".current .title").empty(),n.trigger("change",{silent:!0}),i.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")}));var r=function(){if(s){var e=s.find(".so-widgets-image-results");if(0!==e.length){var t=e.width(),i=Math.floor(t/276),a=(t-276*i)/i+260;e.find(".so-widgets-result-image").css({width:a+"px",height:a/1.4+"px"})}}};e(window).on("resize",r);a.find(".find-image-button").on("click",(function(t){t.preventDefault(),function(){if(!s){(s=e(e("#so-widgets-bundle-tpl-image-search-dialog").html().trim()).appendTo("body")).find(".close").on("click",(function(){s.hide()}));var t,a=s.find(".so-widgets-image-results"),o=function(t,i){s.find(".so-widgets-results-loading").fadeIn("fast"),s.find(".so-widgets-results-loading strong").html(s.find(".so-widgets-results-loading strong").data("loading")),s.find(".so-widgets-results-more").hide(),e.get(ajaxurl,{action:"so_widgets_image_search",q:t,page:i,_sononce:s.find('input[name="_sononce"]').val()},(function(n){n.error?alert(n.message):(a.removeClass("so-loading"),e.each(n.items,(function(t,i){var n=e(e("#so-widgets-bundle-tpl-image-search-result").html().trim()).appendTo(a).addClass("source-"+i.source).find(".so-widgets-result-image");n.css("background-image","url("+i.thumbnail+")"),n.data("thumbnail",i.thumbnail),n.data("preview",i.preview),i.url&&n.attr({href:i.url,target:"_blank"}),i.full_url&&(n.data({full_url:i.full_url,import_signature:i.import_signature}),n.attr("href",i.full_url)),"shutterstock"===i.source&&n.append(e("#so-widgets-bundle-tpl-image-search-result-sponsored").html())})),1===i&&(s.find("#so-widgets-image-search-suggestions ul").empty(),e.each(n.keywords,(function(t,i){s.find("#so-widgets-image-search-suggestions").show(),s.find("#so-widgets-image-search-suggestions ul").append(e("<li></li>").append(e('<a href="#"></a>').html(i).data("keyword",i)))}))),s.find(".so-widgets-results-loading").fadeOut("fast"),r(),s.find(".so-widgets-results-more").show().find("button").data({query:t,page:i+1}))}))};s.find("#so-widgets-image-search-form").on("submit",(function(e){e.preventDefault();var t=s.find(".so-widgets-search-input").val();a.empty(),""!==t&&o(t,1)})),s.on("click",".so-keywords-list a",(function(t){t.preventDefault();var i=e(this).trigger("blur");s.find(".so-widgets-search-input").val(i.data("keyword")),s.find("#so-widgets-image-search-form").trigger("submit")})),s.find(".so-widgets-results-more button").on("click",(function(){var t=e(this);o(t.data("query"),t.data("page"))})),s.on("click",".so-widgets-result-image",(function(t){var a=e(this);if(a.data("full_url")&&(t.preventDefault(),confirm(s.data("confirm-import")))){s.addClass("so-widgets-importing");var r=e("#post_ID").val();null===r&&(r=""),e.get(ajaxurl,{action:"so_widgets_image_import",full_url:a.data("full_url"),import_signature:a.data("import_signature"),post_id:r,_sononce:s.find('input[name="_sononce"]').val()},(function(e){s.find("#so-widgets-image-search-frame").removeClass("so-widgets-importing"),!1===e.error?(s.hide(),s.find(".so-widgets-results-loading").hide(),n.val(e.attachment_id).trigger("change",{silent:!0}),i.find(".current .thumbnail").attr("src",e.thumb).fadeIn(),i.find(".media-remove-button").removeClass("remove-hide")):(alert(e.message),s.find(".so-widgets-results-loading").hide())})),s.find(".so-widgets-results-loading").fadeIn("fast"),s.find(".so-widgets-results-loading strong").html(s.find(".so-widgets-results-loading strong").data("importing")),s.find(".so-widgets-results-more").hide(),s.find("#so-widgets-image-search-frame").addClass("so-widgets-importing")}}));var d,l,u=s.find(".so-widgets-preview-window");s.on("mouseenter",".so-widgets-result-image",(function(){var i=e(this),a=i.data("preview");clearTimeout(t),t=setTimeout((function(){var t=1,n=1;a[1]>.33*e(window).outerWidth()&&(t=.33*e(window).outerWidth()/a[1]),a[2]>.5*e(window).outerHeight()&&(n=.5*e(window).outerHeight()/a[2]);var r=Math.min(t,n);r>1&&(r=1),u.show().find(".so-widgets-preview-window-inside").css({"background-image":"url("+i.data("thumbnail")+")",width:a[1]*r+"px",height:a[2]*r+"px"}).append(e("<img />").attr("src",a[0])),s.trigger("mousemove")}),1e3)})).on("mouseleave",".so-widgets-result-image",(function(){u.hide().find("img").remove(),clearTimeout(t)})),s.on("mousemove",(function(t){if(t.clientX&&(d=t.clientX),t.clientY&&(l=t.clientY),u.is(":visible")){var i=u.outerHeight(),a=u.outerWidth(),n=e(window).outerHeight(),s=e(window).outerWidth(),r=l-i/2;r=Math.max(r,10),r=Math.min(r,n-10-i);var o=d<s/2?d+15:d-15-a;u.css({top:r+"px",left:o+"px"})}}))}s.show(),s.find(".so-widgets-search-input").trigger("focus")}()})),n.on("change",(function(e,t){if(!t||!t.silent){var a=n.val();if(a){var s=i.find(".current .thumbnail"),r=wp.media.attachment(a);r.fetch().done((function(){if(r.has("sizes")){var e=r.get("sizes");void 0!==e.thumbnail?s.attr("src",e.thumbnail.url).fadeIn():s.attr("src",e.full.url).fadeIn()}else s.attr("src",r.get("icon")).fadeIn();i.find(".media-remove-button").removeClass("remove-hide")}))}else i.find("a.media-remove-button").trigger("click")}})),a.data("initialized",!0)}}))}(jQuery);
|
1 |
+
!function(e){e(document).on("sowsetupformfield",".siteorigin-widget-field-type-media",(function(t){var i=e(this),a=i.find("> .media-field-wrapper"),n=i.find(".siteorigin-widget-input").not(".media-fallback-external");if(!a.data("initialized")){var s;a.find(".media-upload-button").on("click",(function(t){if(t.preventDefault(),void 0!==wp.media){var a=e(this),s=e(this).data("frame");if(s)return s.open(),!1;(s=wp.media({title:a.data("choose"),library:{type:a.data("library").split(",").map((function(e){return e.trim()}))},button:{text:a.data("update"),close:!1}})).on("open",(function(){var e=s.state().get("selection"),t=i.find('.siteorigin-widget-input[type="hidden"]').val();t&&e.add(wp.media.attachment(t))})),a.data("frame",s),s.on("select",(function(){var e=s.state().get("selection").first().attributes;i.find(".current .thumbnail").attr("title",e.title),i.find(".current .title").html(e.title),n.val(e.id),n.trigger("change",{silent:!0});var t=i.find(".current .thumbnail");void 0!==e.sizes?void 0!==e.sizes.thumbnail?t.attr("src",e.sizes.thumbnail.url).fadeIn():t.attr("src",e.sizes.full.url).fadeIn():t.attr("src",e.icon).fadeIn(),i.find(".media-remove-button").removeClass("remove-hide").attr("tabindex",0),s.close()})),s.open()}})),i.find("a.media-remove-button").on("click",(function(t){t.preventDefault(),n.val(""),i.find(".current .title").empty(),n.trigger("change",{silent:!0}),i.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide").attr("tabindex",-1)}));var r=function(){if(s){var e=s.find(".so-widgets-image-results");if(0!==e.length){var t=e.width(),i=Math.floor(t/276),a=(t-276*i)/i+260;e.find(".so-widgets-result-image").css({width:a+"px",height:a/1.4+"px"})}}};e(window).on("resize",r);a.find(".find-image-button").on("click",(function(t){t.preventDefault(),function(){if(!s){(s=e(e("#so-widgets-bundle-tpl-image-search-dialog").html().trim()).appendTo("body")).find(".close").on("click keyup",(function(e){("keyup"!=e.type||window.sowbForms.isEnter(e))&&s.hide()}));var t,a=s.find(".so-widgets-image-results"),o=function(t,i){s.find(".so-widgets-results-loading").fadeIn("fast"),s.find(".so-widgets-results-loading strong").html(s.find(".so-widgets-results-loading strong").data("loading")),s.find(".so-widgets-results-more").hide(),e.get(ajaxurl,{action:"so_widgets_image_search",q:t,page:i,_sononce:s.find('input[name="_sononce"]').val()},(function(n){n.error?alert(n.message):(a.removeClass("so-loading"),e.each(n.items,(function(t,i){var n=e(e("#so-widgets-bundle-tpl-image-search-result").html().trim()).appendTo(a).addClass("source-"+i.source).find(".so-widgets-result-image");n.css("background-image","url("+i.thumbnail+")"),n.data("thumbnail",i.thumbnail),n.data("preview",i.preview),i.url&&n.attr({href:i.url,target:"_blank"}),i.full_url&&(n.data({full_url:i.full_url,import_signature:i.import_signature}),n.attr("href",i.full_url)),"shutterstock"===i.source&&n.append(e("#so-widgets-bundle-tpl-image-search-result-sponsored").html())})),1===i&&(s.find("#so-widgets-image-search-suggestions ul").empty(),e.each(n.keywords,(function(t,i){s.find("#so-widgets-image-search-suggestions").show(),s.find("#so-widgets-image-search-suggestions ul").append(e("<li></li>").append(e('<a href="#"></a>').html(i).data("keyword",i)))}))),s.find(".so-widgets-results-loading").fadeOut("fast"),r(),s.find(".so-widgets-results-more").show().find("button").data({query:t,page:i+1}))}))};s.find("#so-widgets-image-search-form").on("submit",(function(e){e.preventDefault();var t=s.find(".so-widgets-search-input").val();a.empty(),""!==t&&o(t,1)})),s.on("click",".so-keywords-list a",(function(t){t.preventDefault();var i=e(this).trigger("blur");s.find(".so-widgets-search-input").val(i.data("keyword")),s.find("#so-widgets-image-search-form").trigger("submit")})),s.find(".so-widgets-results-more button").on("click",(function(){var t=e(this);o(t.data("query"),t.data("page"))})),s.on("click",".so-widgets-result-image",(function(t){var a=e(this);if(a.data("full_url")&&(t.preventDefault(),confirm(s.data("confirm-import")))){s.addClass("so-widgets-importing");var r=e("#post_ID").val();null===r&&(r=""),e.get(ajaxurl,{action:"so_widgets_image_import",full_url:a.data("full_url"),import_signature:a.data("import_signature"),post_id:r,_sononce:s.find('input[name="_sononce"]').val()},(function(e){s.find("#so-widgets-image-search-frame").removeClass("so-widgets-importing"),!1===e.error?(s.hide(),s.find(".so-widgets-results-loading").hide(),n.val(e.attachment_id).trigger("change",{silent:!0}),i.find(".current .thumbnail").attr("src",e.thumb).fadeIn(),i.find(".media-remove-button").removeClass("remove-hide").attr("tabindex",0)):(alert(e.message),s.find(".so-widgets-results-loading").hide())})),s.find(".so-widgets-results-loading").fadeIn("fast"),s.find(".so-widgets-results-loading strong").html(s.find(".so-widgets-results-loading strong").data("importing")),s.find(".so-widgets-results-more").hide(),s.find("#so-widgets-image-search-frame").addClass("so-widgets-importing")}}));var d,l,u=s.find(".so-widgets-preview-window");s.on("mouseenter",".so-widgets-result-image",(function(){var i=e(this),a=i.data("preview");clearTimeout(t),t=setTimeout((function(){var t=1,n=1;a[1]>.33*e(window).outerWidth()&&(t=.33*e(window).outerWidth()/a[1]),a[2]>.5*e(window).outerHeight()&&(n=.5*e(window).outerHeight()/a[2]);var r=Math.min(t,n);r>1&&(r=1),u.show().find(".so-widgets-preview-window-inside").css({"background-image":"url("+i.data("thumbnail")+")",width:a[1]*r+"px",height:a[2]*r+"px"}).append(e("<img />").attr("src",a[0])),s.trigger("mousemove")}),1e3)})).on("mouseleave",".so-widgets-result-image",(function(){u.hide().find("img").remove(),clearTimeout(t)})),s.on("mousemove",(function(t){if(t.clientX&&(d=t.clientX),t.clientY&&(l=t.clientY),u.is(":visible")){var i=u.outerHeight(),a=u.outerWidth(),n=e(window).outerHeight(),s=e(window).outerWidth(),r=l-i/2;r=Math.max(r,10),r=Math.min(r,n-10-i);var o=d<s/2?d+15:d-15-a;u.css({top:r+"px",left:o+"px"})}}))}s.show(),s.find(".so-widgets-search-input").trigger("focus")}()})),n.on("change",(function(e,t){if(!t||!t.silent){var a=n.val();if(a){var s=i.find(".current .thumbnail"),r=wp.media.attachment(a);r.fetch().done((function(){if(r.has("sizes")){var e=r.get("sizes");void 0!==e.thumbnail?s.attr("src",e.thumbnail.url).fadeIn():s.attr("src",e.full.url).fadeIn()}else s.attr("src",r.get("icon")).fadeIn();i.find(".media-remove-button").removeClass("remove-hide").attr("tabindex",0)}))}else i.find("a.media-remove-button").trigger("click")}})),a.data("initialized",!0)}}))}(jQuery);
|
base/inc/fields/link.class.php
CHANGED
@@ -13,6 +13,14 @@ class SiteOrigin_Widget_Field_Link extends SiteOrigin_Widget_Field_Text_Input_Ba
|
|
13 |
*/
|
14 |
protected $post_types;
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
protected function render_before_field( $value, $instance ) {
|
17 |
parent::render_before_field( $value, $instance );
|
18 |
$post_types = ! empty( $this->post_types ) && is_array( $this->post_types ) ? implode( ',', $this->post_types ) : '';
|
@@ -22,7 +30,8 @@ class SiteOrigin_Widget_Field_Link extends SiteOrigin_Widget_Field_Text_Input_Ba
|
|
22 |
|
23 |
<input type="text" class="content-text-search"
|
24 |
data-post-types="<?php echo esc_attr( $post_types ) ?>"
|
25 |
-
placeholder="<?php esc_attr_e( 'Search Content', 'so-widgets-bundle' ) ?>"
|
|
|
26 |
|
27 |
<ul class="posts"></ul>
|
28 |
|
@@ -45,6 +54,8 @@ class SiteOrigin_Widget_Field_Link extends SiteOrigin_Widget_Field_Text_Input_Ba
|
|
45 |
$sanitized_value = trim( $value );
|
46 |
if ( preg_match( '/^post\: *([0-9]+)/', $sanitized_value, $matches ) ) {
|
47 |
$sanitized_value = 'post: ' . $matches[1];
|
|
|
|
|
48 |
} else {
|
49 |
$sanitized_value = sow_esc_url_raw( $sanitized_value );
|
50 |
}
|
13 |
*/
|
14 |
protected $post_types;
|
15 |
|
16 |
+
/**
|
17 |
+
* Prevents protocol from automatically being added to better support shortcodes.
|
18 |
+
*
|
19 |
+
* @access protected
|
20 |
+
* @var boolean
|
21 |
+
*/
|
22 |
+
protected $allow_shortcode;
|
23 |
+
|
24 |
protected function render_before_field( $value, $instance ) {
|
25 |
parent::render_before_field( $value, $instance );
|
26 |
$post_types = ! empty( $this->post_types ) && is_array( $this->post_types ) ? implode( ',', $this->post_types ) : '';
|
30 |
|
31 |
<input type="text" class="content-text-search"
|
32 |
data-post-types="<?php echo esc_attr( $post_types ) ?>"
|
33 |
+
placeholder="<?php esc_attr_e( 'Search Content', 'so-widgets-bundle' ) ?>"
|
34 |
+
tabindex="0"/>
|
35 |
|
36 |
<ul class="posts"></ul>
|
37 |
|
54 |
$sanitized_value = trim( $value );
|
55 |
if ( preg_match( '/^post\: *([0-9]+)/', $sanitized_value, $matches ) ) {
|
56 |
$sanitized_value = 'post: ' . $matches[1];
|
57 |
+
} elseif ( $this->allow_shortcode && strpos( $sanitized_value, '[' ) !== false ) {
|
58 |
+
$sanitized_value = esc_attr( $sanitized_value );
|
59 |
} else {
|
60 |
$sanitized_value = sow_esc_url_raw( $sanitized_value );
|
61 |
}
|
base/inc/fields/measurement.class.php
CHANGED
@@ -5,6 +5,21 @@
|
|
5 |
*/
|
6 |
class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_Input_Base {
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
protected function get_input_classes() {
|
9 |
$input_classes = parent::get_input_classes();
|
10 |
$input_classes[] = 'siteorigin-widget-input-measurement';
|
@@ -34,23 +49,27 @@ class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_I
|
|
34 |
|
35 |
protected function render_after_field( $value, $instance ) {
|
36 |
$value_parts = $this->get_render_values($value);
|
37 |
-
$
|
38 |
-
if ( is_null( $
|
39 |
$unit_name = $this->get_unit_field_name( $this->base_name );
|
40 |
|
41 |
if( !empty( $instance[ $unit_name ] ) ) {
|
42 |
-
$
|
43 |
}
|
44 |
else if ( isset( $this->default ) ) {
|
45 |
$default_parts = $this->get_render_values($this->default);
|
46 |
-
$
|
47 |
}
|
48 |
}
|
|
|
|
|
49 |
?>
|
50 |
<select class="sow-measurement-select-unit siteorigin-widget-input"
|
51 |
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_unit', $this->parent_container ) ) ?>">
|
52 |
-
<?php foreach (
|
53 |
-
<option value="<?php echo esc_attr( $
|
|
|
|
|
54 |
<?php endforeach?>
|
55 |
</select>
|
56 |
<div class="clear"></div>
|
@@ -73,7 +92,7 @@ class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_I
|
|
73 |
$default_parts = $this->get_render_values($this->default);
|
74 |
$unit = $default_parts['unit'];
|
75 |
if( isset( $instance[ $unit_name ] ) ) {
|
76 |
-
$units = siteorigin_widgets_get_measurements_list();
|
77 |
if ( in_array( $instance[ $unit_name ], $units ) ) {
|
78 |
$unit = $instance[ $unit_name ];
|
79 |
}
|
@@ -82,7 +101,7 @@ class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_I
|
|
82 |
|
83 |
// Sensible default, if we somehow end up without a unit.
|
84 |
if ( empty( $unit ) ) {
|
85 |
-
$unit = 'px';
|
86 |
}
|
87 |
|
88 |
// `strlen( $value ) == 0` should prevent 0, 0.0, or '0' from being seen as empty.
|
5 |
*/
|
6 |
class SiteOrigin_Widget_Field_Measurement extends SiteOrigin_Widget_Field_Text_Input_Base {
|
7 |
|
8 |
+
/* The 'units' property is optional and defaults to the list returned by `siteorigin_widgets_get_measurements_list`.
|
9 |
+
*
|
10 |
+
* @access protected
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
protected $units;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* The default unit of measurement if the unit of measurement isn't able to be detected. Default to px.
|
17 |
+
*
|
18 |
+
* @access protected
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
protected $default_unit;
|
22 |
+
|
23 |
protected function get_input_classes() {
|
24 |
$input_classes = parent::get_input_classes();
|
25 |
$input_classes[] = 'siteorigin-widget-input-measurement';
|
49 |
|
50 |
protected function render_after_field( $value, $instance ) {
|
51 |
$value_parts = $this->get_render_values($value);
|
52 |
+
$selected_unit = $value_parts['unit'];
|
53 |
+
if ( is_null( $selected_unit ) ) {
|
54 |
$unit_name = $this->get_unit_field_name( $this->base_name );
|
55 |
|
56 |
if( !empty( $instance[ $unit_name ] ) ) {
|
57 |
+
$selected_unit = $instance[ $unit_name ];
|
58 |
}
|
59 |
else if ( isset( $this->default ) ) {
|
60 |
$default_parts = $this->get_render_values($this->default);
|
61 |
+
$selected_unit = $default_parts['unit'];
|
62 |
}
|
63 |
}
|
64 |
+
|
65 |
+
$units = ! empty( $this->units ) && is_array( $this->units ) ? $this->units : siteorigin_widgets_get_measurements_list();
|
66 |
?>
|
67 |
<select class="sow-measurement-select-unit siteorigin-widget-input"
|
68 |
name="<?php echo esc_attr( $this->for_widget->so_get_field_name( $this->base_name . '_unit', $this->parent_container ) ) ?>">
|
69 |
+
<?php foreach ( $units as $unit ):?>
|
70 |
+
<option value="<?php echo esc_attr( $unit ); ?>" <?php selected( $unit, $selected_unit, true ); ?>>
|
71 |
+
<?php echo esc_html( $unit ); ?>
|
72 |
+
</option>
|
73 |
<?php endforeach?>
|
74 |
</select>
|
75 |
<div class="clear"></div>
|
92 |
$default_parts = $this->get_render_values($this->default);
|
93 |
$unit = $default_parts['unit'];
|
94 |
if( isset( $instance[ $unit_name ] ) ) {
|
95 |
+
$units = ! empty( $this->units ) && is_array( $this->units ) ? $this->units : siteorigin_widgets_get_measurements_list();
|
96 |
if ( in_array( $instance[ $unit_name ], $units ) ) {
|
97 |
$unit = $instance[ $unit_name ];
|
98 |
}
|
101 |
|
102 |
// Sensible default, if we somehow end up without a unit.
|
103 |
if ( empty( $unit ) ) {
|
104 |
+
$unit = empty( $this->default_unit ) ? 'px' : $this->default_unit;
|
105 |
}
|
106 |
|
107 |
// `strlen( $value ) == 0` should prevent 0, 0.0, or '0' from being seen as empty.
|
base/inc/fields/media.class.php
CHANGED
@@ -137,7 +137,7 @@ class SiteOrigin_Widget_Field_Media extends SiteOrigin_Widget_Field_Base {
|
|
137 |
|
138 |
protected function sanitize_field_input( $value, $instance ) {
|
139 |
// Media values should be integer
|
140 |
-
return
|
141 |
}
|
142 |
|
143 |
public function sanitize_instance( $instance ) {
|
@@ -170,7 +170,7 @@ class SiteOrigin_Widget_Field_Media extends SiteOrigin_Widget_Field_Base {
|
|
170 |
|
171 |
<div class="so-widgets-toolbar">
|
172 |
<h3><?php _e( 'Search For Images', 'so-widgets-bundle' ) ?></h3>
|
173 |
-
<div class="close"><span class="dashicons dashicons-no-alt"></span></div>
|
174 |
</div>
|
175 |
|
176 |
<div class="so-widgets-dialog-frame">
|
137 |
|
138 |
protected function sanitize_field_input( $value, $instance ) {
|
139 |
// Media values should be integer
|
140 |
+
return (int) $value;
|
141 |
}
|
142 |
|
143 |
public function sanitize_instance( $instance ) {
|
170 |
|
171 |
<div class="so-widgets-toolbar">
|
172 |
<h3><?php _e( 'Search For Images', 'so-widgets-bundle' ) ?></h3>
|
173 |
+
<div class="close" tabindex="0"><span class="dashicons dashicons-no-alt"></span></div>
|
174 |
</div>
|
175 |
|
176 |
<div class="so-widgets-dialog-frame">
|
base/inc/fields/repeater.class.php
CHANGED
@@ -70,11 +70,11 @@ class SiteOrigin_Widget_Field_Repeater extends SiteOrigin_Widget_Field_Container
|
|
70 |
foreach( $value as $v ) {
|
71 |
?>
|
72 |
<div class="siteorigin-widget-field-repeater-item ui-draggable">
|
73 |
-
<div class="siteorigin-widget-field-repeater-item-top">
|
74 |
-
<div class="siteorigin-widget-field-expand"></div>
|
75 |
<?php if( empty( $this->readonly ) ) : ?>
|
76 |
-
<div class="siteorigin-widget-field-copy"></div>
|
77 |
-
<div class="siteorigin-widget-field-remove"></div>
|
78 |
<?php endif; ?>
|
79 |
<h4><?php echo esc_html( $this->item_name ) ?></h4>
|
80 |
</div>
|
@@ -90,7 +90,7 @@ class SiteOrigin_Widget_Field_Repeater extends SiteOrigin_Widget_Field_Container
|
|
90 |
?>
|
91 |
</div>
|
92 |
<?php if( empty( $this->readonly ) ) : ?>
|
93 |
-
<div class="siteorigin-widget-field-repeater-add"><?php esc_html_e( 'Add', 'so-widgets-bundle' ) ?></div>
|
94 |
<?php endif; ?>
|
95 |
<?php
|
96 |
ob_start();
|
70 |
foreach( $value as $v ) {
|
71 |
?>
|
72 |
<div class="siteorigin-widget-field-repeater-item ui-draggable">
|
73 |
+
<div class="siteorigin-widget-field-repeater-item-top" tabindex="0">
|
74 |
+
<div class="siteorigin-widget-field-expand" tabindex="0"></div>
|
75 |
<?php if( empty( $this->readonly ) ) : ?>
|
76 |
+
<div class="siteorigin-widget-field-copy" tabindex="0"></div>
|
77 |
+
<div class="siteorigin-widget-field-remove" tabindex="0"></div>
|
78 |
<?php endif; ?>
|
79 |
<h4><?php echo esc_html( $this->item_name ) ?></h4>
|
80 |
</div>
|
90 |
?>
|
91 |
</div>
|
92 |
<?php if( empty( $this->readonly ) ) : ?>
|
93 |
+
<div class="siteorigin-widget-field-repeater-add" tabindex="0"><?php esc_html_e( 'Add', 'so-widgets-bundle' ) ?></div>
|
94 |
<?php endif; ?>
|
95 |
<?php
|
96 |
ob_start();
|
base/inc/fields/slider.class.php
CHANGED
@@ -37,9 +37,9 @@ class SiteOrigin_Widget_Field_Slider extends SiteOrigin_Widget_Field_Base {
|
|
37 |
</div>
|
38 |
<input type="number" class="siteorigin-widget-input" name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
|
39 |
value="<?php echo !empty( $value ) ? esc_attr( $value ) : 0 ?>"
|
40 |
-
min="<?php echo isset( $this->min ) ?
|
41 |
-
max="<?php echo isset( $this->max ) ?
|
42 |
-
step="<?php echo isset( $this->step ) ?
|
43 |
<?php
|
44 |
}
|
45 |
|
@@ -47,4 +47,4 @@ class SiteOrigin_Widget_Field_Slider extends SiteOrigin_Widget_Field_Base {
|
|
47 |
return (float) $value;
|
48 |
}
|
49 |
|
50 |
-
}
|
37 |
</div>
|
38 |
<input type="number" class="siteorigin-widget-input" name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
|
39 |
value="<?php echo !empty( $value ) ? esc_attr( $value ) : 0 ?>"
|
40 |
+
min="<?php echo isset( $this->min ) ? (float) $this->min : 0 ?>"
|
41 |
+
max="<?php echo isset( $this->max ) ? (float) $this->max : 100 ?>"
|
42 |
+
step="<?php echo isset( $this->step ) ? (float) $this->step : 1 ?>"/>
|
43 |
<?php
|
44 |
}
|
45 |
|
47 |
return (float) $value;
|
48 |
}
|
49 |
|
50 |
+
}
|
base/inc/fields/textarea.class.php
CHANGED
@@ -17,8 +17,8 @@ class SiteOrigin_Widget_Field_Textarea extends SiteOrigin_Widget_Field_Text_Inpu
|
|
17 |
<textarea type="text" name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
|
18 |
<?php if ( ! empty( $this->placeholder ) ) echo 'placeholder="' . esc_attr( $this->placeholder ) . '"' ?>
|
19 |
<?php $this->render_CSS_classes( $this->get_input_classes() ) ?>
|
20 |
-
rows="<?php echo ! empty( $this->rows ) ?
|
21 |
<?php if( ! empty( $this->readonly ) ) echo 'readonly' ?>><?php echo esc_textarea( $value ) ?></textarea>
|
22 |
<?php
|
23 |
}
|
24 |
-
}
|
17 |
<textarea type="text" name="<?php echo esc_attr( $this->element_name ) ?>" id="<?php echo esc_attr( $this->element_id ) ?>"
|
18 |
<?php if ( ! empty( $this->placeholder ) ) echo 'placeholder="' . esc_attr( $this->placeholder ) . '"' ?>
|
19 |
<?php $this->render_CSS_classes( $this->get_input_classes() ) ?>
|
20 |
+
rows="<?php echo ! empty( $this->rows ) ? (int) $this->rows : 4 ?>"
|
21 |
<?php if( ! empty( $this->readonly ) ) echo 'readonly' ?>><?php echo esc_textarea( $value ) ?></textarea>
|
22 |
<?php
|
23 |
}
|
24 |
+
}
|
base/inc/fields/tinymce.class.php
CHANGED
@@ -429,7 +429,7 @@ class SiteOrigin_Widget_Field_TinyMCE extends SiteOrigin_Widget_Field_Text_Input
|
|
429 |
<textarea id="<?php echo esc_attr( $this->element_id ) ?>"
|
430 |
name="<?php echo esc_attr( $this->element_name ) ?>"
|
431 |
<?php if ( isset( $this->editor_height ) ) : ?>
|
432 |
-
style="height: <?php echo
|
433 |
<?php else : ?>
|
434 |
rows="<?php echo esc_attr( $this->rows ) ?>"
|
435 |
<?php endif; ?>
|
429 |
<textarea id="<?php echo esc_attr( $this->element_id ) ?>"
|
430 |
name="<?php echo esc_attr( $this->element_name ) ?>"
|
431 |
<?php if ( isset( $this->editor_height ) ) : ?>
|
432 |
+
style="height: <?php echo (int) $this->editor_height; ?>px"
|
433 |
<?php else : ?>
|
434 |
rows="<?php echo esc_attr( $this->rows ) ?>"
|
435 |
<?php endif; ?>
|
base/inc/fonts.php
CHANGED
@@ -52,6 +52,14 @@ return array(
|
|
52 |
array(
|
53 |
0 => 'regular',
|
54 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
'Akronim' =>
|
56 |
array(
|
57 |
0 => 'regular',
|
@@ -80,15 +88,17 @@ return array(
|
|
80 |
'Alegreya' =>
|
81 |
array(
|
82 |
0 => 'regular',
|
83 |
-
1 => '
|
84 |
-
2 => '
|
85 |
-
3 => '
|
86 |
-
4 => '
|
87 |
-
5 => '
|
88 |
-
6 => '
|
89 |
-
7 => '
|
90 |
-
8 => '
|
91 |
-
9 => '
|
|
|
|
|
92 |
),
|
93 |
'Alegreya SC' =>
|
94 |
array(
|
@@ -255,6 +265,13 @@ return array(
|
|
255 |
array(
|
256 |
0 => 'regular',
|
257 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
'Angkor' =>
|
259 |
array(
|
260 |
0 => 'regular',
|
@@ -305,14 +322,24 @@ return array(
|
|
305 |
),
|
306 |
'Archivo' =>
|
307 |
array(
|
308 |
-
0 => '
|
309 |
-
1 => '
|
310 |
-
2 => '
|
311 |
-
3 => '
|
312 |
-
4 => '
|
313 |
-
5 => '
|
314 |
6 => '700',
|
315 |
-
7 => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
),
|
317 |
'Archivo Black' =>
|
318 |
array(
|
@@ -348,9 +375,13 @@ return array(
|
|
348 |
'Arimo' =>
|
349 |
array(
|
350 |
0 => 'regular',
|
351 |
-
1 => '
|
352 |
-
2 => '
|
353 |
-
3 => '
|
|
|
|
|
|
|
|
|
354 |
),
|
355 |
'Arizonia' =>
|
356 |
array(
|
@@ -386,12 +417,12 @@ return array(
|
|
386 |
'Asap' =>
|
387 |
array(
|
388 |
0 => 'regular',
|
389 |
-
1 => '
|
390 |
-
2 => '
|
391 |
-
3 => '
|
392 |
-
4 => '
|
393 |
-
5 => '
|
394 |
-
6 => '
|
395 |
7 => '700italic',
|
396 |
),
|
397 |
'Asap Condensed' =>
|
@@ -418,9 +449,10 @@ return array(
|
|
418 |
0 => '200',
|
419 |
1 => '300',
|
420 |
2 => 'regular',
|
421 |
-
3 => '
|
422 |
-
4 => '
|
423 |
-
5 => '
|
|
|
424 |
),
|
425 |
'Astloch' =>
|
426 |
array(
|
@@ -545,6 +577,10 @@ return array(
|
|
545 |
10 => '700',
|
546 |
11 => '700italic',
|
547 |
),
|
|
|
|
|
|
|
|
|
548 |
'Baloo 2' =>
|
549 |
array(
|
550 |
0 => 'regular',
|
@@ -782,6 +818,10 @@ return array(
|
|
782 |
1 => 'regular',
|
783 |
2 => '700',
|
784 |
),
|
|
|
|
|
|
|
|
|
785 |
'Bentham' =>
|
786 |
array(
|
787 |
0 => 'regular',
|
@@ -809,6 +849,50 @@ return array(
|
|
809 |
6 => '800',
|
810 |
7 => '900',
|
811 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
812 |
'Big Shoulders Text' =>
|
813 |
array(
|
814 |
0 => '100',
|
@@ -864,9 +948,24 @@ return array(
|
|
864 |
),
|
865 |
'Bitter' =>
|
866 |
array(
|
867 |
-
0 => '
|
868 |
-
1 => '
|
869 |
-
2 => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
870 |
),
|
871 |
'Black And White Picture' =>
|
872 |
array(
|
@@ -891,6 +990,21 @@ return array(
|
|
891 |
6 => '800',
|
892 |
7 => '900',
|
893 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
894 |
'Bokor' =>
|
895 |
array(
|
896 |
0 => 'regular',
|
@@ -919,6 +1033,17 @@ return array(
|
|
919 |
array(
|
920 |
0 => 'regular',
|
921 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
922 |
'Bubblegum Sans' =>
|
923 |
array(
|
924 |
0 => 'regular',
|
@@ -967,12 +1092,12 @@ return array(
|
|
967 |
'Cabin' =>
|
968 |
array(
|
969 |
0 => 'regular',
|
970 |
-
1 => '
|
971 |
-
2 => '
|
972 |
-
3 => '
|
973 |
-
4 => '
|
974 |
-
5 => '
|
975 |
-
6 => '
|
976 |
7 => '700italic',
|
977 |
),
|
978 |
'Cabin Condensed' =>
|
@@ -1075,6 +1200,11 @@ return array(
|
|
1075 |
array(
|
1076 |
0 => 'regular',
|
1077 |
),
|
|
|
|
|
|
|
|
|
|
|
1078 |
'Catamaran' =>
|
1079 |
array(
|
1080 |
0 => '100',
|
@@ -1097,7 +1227,9 @@ return array(
|
|
1097 |
'Caveat' =>
|
1098 |
array(
|
1099 |
0 => 'regular',
|
1100 |
-
1 => '
|
|
|
|
|
1101 |
),
|
1102 |
'Caveat Brush' =>
|
1103 |
array(
|
@@ -1217,8 +1349,11 @@ return array(
|
|
1217 |
'Cinzel' =>
|
1218 |
array(
|
1219 |
0 => 'regular',
|
1220 |
-
1 => '
|
1221 |
-
2 => '
|
|
|
|
|
|
|
1222 |
),
|
1223 |
'Cinzel Decorative' =>
|
1224 |
array(
|
@@ -1273,6 +1408,18 @@ return array(
|
|
1273 |
array(
|
1274 |
0 => 'regular',
|
1275 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1276 |
'Concert One' =>
|
1277 |
array(
|
1278 |
0 => 'regular',
|
@@ -1449,9 +1596,13 @@ return array(
|
|
1449 |
'Cuprum' =>
|
1450 |
array(
|
1451 |
0 => 'regular',
|
1452 |
-
1 => '
|
1453 |
-
2 => '
|
1454 |
-
3 => '
|
|
|
|
|
|
|
|
|
1455 |
),
|
1456 |
'Cute Font' =>
|
1457 |
array(
|
@@ -1536,6 +1687,10 @@ return array(
|
|
1536 |
array(
|
1537 |
0 => 'regular',
|
1538 |
),
|
|
|
|
|
|
|
|
|
1539 |
'Delius' =>
|
1540 |
array(
|
1541 |
0 => 'regular',
|
@@ -1588,7 +1743,9 @@ return array(
|
|
1588 |
'Domine' =>
|
1589 |
array(
|
1590 |
0 => 'regular',
|
1591 |
-
1 => '
|
|
|
|
|
1592 |
),
|
1593 |
'Donegal One' =>
|
1594 |
array(
|
@@ -1612,6 +1769,10 @@ return array(
|
|
1612 |
5 => '700',
|
1613 |
6 => '800',
|
1614 |
),
|
|
|
|
|
|
|
|
|
1615 |
'Dr Sugiyama' =>
|
1616 |
array(
|
1617 |
0 => 'regular',
|
@@ -1768,6 +1929,27 @@ return array(
|
|
1768 |
2 => '600',
|
1769 |
3 => '700',
|
1770 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1771 |
'Erica One' =>
|
1772 |
array(
|
1773 |
0 => 'regular',
|
@@ -2038,9 +2220,30 @@ return array(
|
|
2038 |
3 => '700',
|
2039 |
4 => '900',
|
2040 |
),
|
2041 |
-
'
|
2042 |
array(
|
2043 |
-
0 => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2044 |
),
|
2045 |
'Fredericka the Great' =>
|
2046 |
array(
|
@@ -2196,6 +2399,11 @@ return array(
|
|
2196 |
array(
|
2197 |
0 => 'regular',
|
2198 |
),
|
|
|
|
|
|
|
|
|
|
|
2199 |
'Gorditas' =>
|
2200 |
array(
|
2201 |
0 => 'regular',
|
@@ -2229,6 +2437,27 @@ return array(
|
|
2229 |
array(
|
2230 |
0 => 'regular',
|
2231 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2232 |
'Gravitas One' =>
|
2233 |
array(
|
2234 |
0 => 'regular',
|
@@ -2258,6 +2487,18 @@ return array(
|
|
2258 |
16 => '900',
|
2259 |
17 => '900italic',
|
2260 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2261 |
'Griffy' =>
|
2262 |
array(
|
2263 |
0 => 'regular',
|
@@ -2290,6 +2531,10 @@ return array(
|
|
2290 |
array(
|
2291 |
0 => 'regular',
|
2292 |
),
|
|
|
|
|
|
|
|
|
2293 |
'Halant' =>
|
2294 |
array(
|
2295 |
0 => '300',
|
@@ -2326,6 +2571,7 @@ return array(
|
|
2326 |
'Harmattan' =>
|
2327 |
array(
|
2328 |
0 => 'regular',
|
|
|
2329 |
),
|
2330 |
'Headland One' =>
|
2331 |
array(
|
@@ -2334,12 +2580,14 @@ return array(
|
|
2334 |
'Heebo' =>
|
2335 |
array(
|
2336 |
0 => '100',
|
2337 |
-
1 => '
|
2338 |
-
2 => '
|
2339 |
-
3 => '
|
2340 |
-
4 => '
|
2341 |
-
5 => '
|
2342 |
-
6 => '
|
|
|
|
|
2343 |
),
|
2344 |
'Henny Penny' =>
|
2345 |
array(
|
@@ -2533,11 +2781,13 @@ return array(
|
|
2533 |
'Ibarra Real Nova' =>
|
2534 |
array(
|
2535 |
0 => 'regular',
|
2536 |
-
1 => '
|
2537 |
2 => '600',
|
2538 |
-
3 => '
|
2539 |
-
4 => '
|
2540 |
-
5 => '
|
|
|
|
|
2541 |
),
|
2542 |
'Iceberg' =>
|
2543 |
array(
|
@@ -2547,6 +2797,18 @@ return array(
|
|
2547 |
array(
|
2548 |
0 => 'regular',
|
2549 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2550 |
'Imprima' =>
|
2551 |
array(
|
2552 |
0 => 'regular',
|
@@ -2651,6 +2913,25 @@ return array(
|
|
2651 |
0 => 'regular',
|
2652 |
1 => '700',
|
2653 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2654 |
'Jim Nightshade' =>
|
2655 |
array(
|
2656 |
0 => 'regular',
|
@@ -2691,15 +2972,19 @@ return array(
|
|
2691 |
'Josefin Slab' =>
|
2692 |
array(
|
2693 |
0 => '100',
|
2694 |
-
1 => '
|
2695 |
2 => '300',
|
2696 |
-
3 => '
|
2697 |
-
4 => '
|
2698 |
-
5 => '
|
2699 |
-
6 => '
|
2700 |
-
7 => '
|
2701 |
-
8 => '
|
2702 |
-
9 => '
|
|
|
|
|
|
|
|
|
2703 |
),
|
2704 |
'Jost' =>
|
2705 |
array(
|
@@ -2828,10 +3113,20 @@ return array(
|
|
2828 |
),
|
2829 |
'Karla' =>
|
2830 |
array(
|
2831 |
-
0 => '
|
2832 |
-
1 => '
|
2833 |
-
2 => '
|
2834 |
-
3 => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2835 |
),
|
2836 |
'Karma' =>
|
2837 |
array(
|
@@ -2901,6 +3196,12 @@ return array(
|
|
2901 |
array(
|
2902 |
0 => 'regular',
|
2903 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
2904 |
'Knewave' =>
|
2905 |
array(
|
2906 |
0 => 'regular',
|
@@ -2986,6 +3287,21 @@ return array(
|
|
2986 |
10 => '700',
|
2987 |
11 => '700italic',
|
2988 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2989 |
'Kulim Park' =>
|
2990 |
array(
|
2991 |
0 => '200',
|
@@ -3007,6 +3323,12 @@ return array(
|
|
3007 |
array(
|
3008 |
0 => 'regular',
|
3009 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
3010 |
'Kurale' =>
|
3011 |
array(
|
3012 |
0 => 'regular',
|
@@ -3039,6 +3361,10 @@ return array(
|
|
3039 |
array(
|
3040 |
0 => 'regular',
|
3041 |
),
|
|
|
|
|
|
|
|
|
3042 |
'Lateef' =>
|
3043 |
array(
|
3044 |
0 => 'regular',
|
@@ -3086,6 +3412,16 @@ return array(
|
|
3086 |
3 => '600',
|
3087 |
4 => '700',
|
3088 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3089 |
'Lexend Deca' =>
|
3090 |
array(
|
3091 |
0 => 'regular',
|
@@ -3138,6 +3474,10 @@ return array(
|
|
3138 |
array(
|
3139 |
0 => 'regular',
|
3140 |
),
|
|
|
|
|
|
|
|
|
3141 |
'Libre Baskerville' =>
|
3142 |
array(
|
3143 |
0 => 'regular',
|
@@ -3157,22 +3497,22 @@ return array(
|
|
3157 |
'Libre Franklin' =>
|
3158 |
array(
|
3159 |
0 => '100',
|
3160 |
-
1 => '
|
3161 |
-
2 => '
|
3162 |
-
3 => '
|
3163 |
-
4 => '
|
3164 |
-
5 => '
|
3165 |
-
6 => '
|
3166 |
-
7 => '
|
3167 |
-
8 => '
|
3168 |
-
9 => '
|
3169 |
-
10 => '
|
3170 |
-
11 => '
|
3171 |
-
12 => '
|
3172 |
-
13 => '
|
3173 |
-
14 => '
|
3174 |
-
15 => '
|
3175 |
-
16 => '
|
3176 |
17 => '900italic',
|
3177 |
),
|
3178 |
'Life Savers' =>
|
@@ -3200,14 +3540,22 @@ return array(
|
|
3200 |
),
|
3201 |
'Literata' =>
|
3202 |
array(
|
3203 |
-
0 => '
|
3204 |
-
1 => '
|
3205 |
-
2 => '
|
3206 |
-
3 => '
|
3207 |
-
4 => '
|
3208 |
-
5 => '
|
3209 |
-
6 => '
|
3210 |
-
7 => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3211 |
),
|
3212 |
'Liu Jian Mao Cao' =>
|
3213 |
array(
|
@@ -3551,13 +3899,17 @@ return array(
|
|
3551 |
'Merriweather Sans' =>
|
3552 |
array(
|
3553 |
0 => '300',
|
3554 |
-
1 => '
|
3555 |
-
2 => '
|
3556 |
-
3 => '
|
3557 |
4 => '700',
|
3558 |
-
5 => '
|
3559 |
-
6 => '
|
3560 |
-
7 => '
|
|
|
|
|
|
|
|
|
3561 |
),
|
3562 |
'Metal' =>
|
3563 |
array(
|
@@ -3794,7 +4146,7 @@ return array(
|
|
3794 |
5 => '700',
|
3795 |
6 => '800',
|
3796 |
),
|
3797 |
-
'
|
3798 |
array(
|
3799 |
0 => '200',
|
3800 |
1 => '300',
|
@@ -3813,15 +4165,27 @@ return array(
|
|
3813 |
14 => '800italic',
|
3814 |
15 => '900italic',
|
3815 |
),
|
3816 |
-
'
|
3817 |
-
array(
|
3818 |
-
0 => 'regular',
|
3819 |
-
),
|
3820 |
-
'NTR' =>
|
3821 |
array(
|
3822 |
-
0 => '
|
3823 |
-
|
3824 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3825 |
array(
|
3826 |
0 => 'regular',
|
3827 |
),
|
@@ -3846,6 +4210,10 @@ return array(
|
|
3846 |
array(
|
3847 |
0 => 'regular',
|
3848 |
),
|
|
|
|
|
|
|
|
|
3849 |
'Neucha' =>
|
3850 |
array(
|
3851 |
0 => 'regular',
|
@@ -3863,11 +4231,32 @@ return array(
|
|
3863 |
array(
|
3864 |
0 => 'regular',
|
3865 |
),
|
|
|
|
|
|
|
|
|
3866 |
'News Cycle' =>
|
3867 |
array(
|
3868 |
0 => 'regular',
|
3869 |
1 => '700',
|
3870 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3871 |
'Niconne' =>
|
3872 |
array(
|
3873 |
0 => 'regular',
|
@@ -4109,6 +4498,10 @@ return array(
|
|
4109 |
array(
|
4110 |
0 => 'regular',
|
4111 |
),
|
|
|
|
|
|
|
|
|
4112 |
'Old Standard TT' =>
|
4113 |
array(
|
4114 |
0 => 'regular',
|
@@ -4377,7 +4770,24 @@ return array(
|
|
4377 |
),
|
4378 |
'Petrona' =>
|
4379 |
array(
|
4380 |
-
0 => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4381 |
),
|
4382 |
'Philosopher' =>
|
4383 |
array(
|
@@ -4386,6 +4796,27 @@ return array(
|
|
4386 |
2 => '700',
|
4387 |
3 => '700italic',
|
4388 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4389 |
'Piedra' =>
|
4390 |
array(
|
4391 |
0 => 'regular',
|
@@ -4497,6 +4928,10 @@ return array(
|
|
4497 |
array(
|
4498 |
0 => 'regular',
|
4499 |
),
|
|
|
|
|
|
|
|
|
4500 |
'Pragati Narrow' =>
|
4501 |
array(
|
4502 |
0 => 'regular',
|
@@ -4668,22 +5103,22 @@ return array(
|
|
4668 |
'Raleway' =>
|
4669 |
array(
|
4670 |
0 => '100',
|
4671 |
-
1 => '
|
4672 |
-
2 => '
|
4673 |
-
3 => '
|
4674 |
-
4 => '
|
4675 |
-
5 => '
|
4676 |
-
6 => '
|
4677 |
-
7 => '
|
4678 |
-
8 => '
|
4679 |
-
9 => '
|
4680 |
-
10 => '
|
4681 |
-
11 => '
|
4682 |
-
12 => '
|
4683 |
-
13 => '
|
4684 |
-
14 => '
|
4685 |
-
15 => '
|
4686 |
-
16 => '
|
4687 |
17 => '900italic',
|
4688 |
),
|
4689 |
'Raleway Dots' =>
|
@@ -4738,6 +5173,16 @@ return array(
|
|
4738 |
array(
|
4739 |
0 => 'regular',
|
4740 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4741 |
'Red Hat Display' =>
|
4742 |
array(
|
4743 |
0 => 'regular',
|
@@ -4758,6 +5203,14 @@ return array(
|
|
4758 |
4 => '700',
|
4759 |
5 => '700italic',
|
4760 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4761 |
'Redressed' =>
|
4762 |
array(
|
4763 |
0 => 'regular',
|
@@ -4770,6 +5223,10 @@ return array(
|
|
4770 |
array(
|
4771 |
0 => 'regular',
|
4772 |
),
|
|
|
|
|
|
|
|
|
4773 |
'Revalia' =>
|
4774 |
array(
|
4775 |
0 => 'regular',
|
@@ -4821,15 +5278,19 @@ return array(
|
|
4821 |
'Roboto Mono' =>
|
4822 |
array(
|
4823 |
0 => '100',
|
4824 |
-
1 => '
|
4825 |
2 => '300',
|
4826 |
-
3 => '
|
4827 |
-
4 => '
|
4828 |
-
5 => '
|
4829 |
-
6 => '
|
4830 |
-
7 => '
|
4831 |
-
8 => '
|
4832 |
-
9 => '
|
|
|
|
|
|
|
|
|
4833 |
),
|
4834 |
'Roboto Slab' =>
|
4835 |
array(
|
@@ -4851,6 +5312,10 @@ return array(
|
|
4851 |
array(
|
4852 |
0 => 'regular',
|
4853 |
),
|
|
|
|
|
|
|
|
|
4854 |
'Rokkitt' =>
|
4855 |
array(
|
4856 |
0 => '100',
|
@@ -4894,6 +5359,12 @@ return array(
|
|
4894 |
array(
|
4895 |
0 => 'regular',
|
4896 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
4897 |
'Rozha One' =>
|
4898 |
array(
|
4899 |
0 => 'regular',
|
@@ -4901,15 +5372,19 @@ return array(
|
|
4901 |
'Rubik' =>
|
4902 |
array(
|
4903 |
0 => '300',
|
4904 |
-
1 => '
|
4905 |
-
2 => '
|
4906 |
-
3 => '
|
4907 |
-
4 => '
|
4908 |
-
5 => '
|
4909 |
-
6 => '
|
4910 |
-
7 => '
|
4911 |
-
8 => '
|
4912 |
-
9 => '
|
|
|
|
|
|
|
|
|
4913 |
),
|
4914 |
'Rubik Mono One' =>
|
4915 |
array(
|
@@ -4981,6 +5456,15 @@ return array(
|
|
4981 |
6 => '700',
|
4982 |
7 => '800',
|
4983 |
8 => '900',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4984 |
),
|
4985 |
'Saira Condensed' =>
|
4986 |
array(
|
@@ -5046,6 +5530,16 @@ return array(
|
|
5046 |
6 => '900',
|
5047 |
7 => '900italic',
|
5048 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5049 |
'Sarabun' =>
|
5050 |
array(
|
5051 |
0 => '100',
|
@@ -5172,6 +5666,22 @@ return array(
|
|
5172 |
array(
|
5173 |
0 => 'regular',
|
5174 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5175 |
'Shojumaru' =>
|
5176 |
array(
|
5177 |
0 => 'regular',
|
@@ -5196,8 +5706,9 @@ return array(
|
|
5196 |
array(
|
5197 |
0 => '300',
|
5198 |
1 => 'regular',
|
5199 |
-
2 => '
|
5200 |
-
3 => '
|
|
|
5201 |
),
|
5202 |
'Signika Negative' =>
|
5203 |
array(
|
@@ -5292,6 +5803,17 @@ return array(
|
|
5292 |
array(
|
5293 |
0 => 'regular',
|
5294 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5295 |
'Sorts Mill Goudy' =>
|
5296 |
array(
|
5297 |
0 => 'regular',
|
@@ -5331,9 +5853,26 @@ return array(
|
|
5331 |
),
|
5332 |
'Source Serif Pro' =>
|
5333 |
array(
|
5334 |
-
0 => '
|
5335 |
-
1 => '
|
5336 |
-
2 => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5337 |
),
|
5338 |
'Space Mono' =>
|
5339 |
array(
|
@@ -5438,6 +5977,10 @@ return array(
|
|
5438 |
0 => 'regular',
|
5439 |
1 => '700',
|
5440 |
),
|
|
|
|
|
|
|
|
|
5441 |
'Stint Ultra Condensed' =>
|
5442 |
array(
|
5443 |
0 => 'regular',
|
@@ -5518,6 +6061,22 @@ return array(
|
|
5518 |
0 => 'regular',
|
5519 |
1 => '700',
|
5520 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5521 |
'Tajawal' =>
|
5522 |
array(
|
5523 |
0 => '200',
|
@@ -5586,6 +6145,27 @@ return array(
|
|
5586 |
array(
|
5587 |
0 => 'regular',
|
5588 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5589 |
'Thasadith' =>
|
5590 |
array(
|
5591 |
0 => 'regular',
|
@@ -5665,6 +6245,10 @@ return array(
|
|
5665 |
array(
|
5666 |
0 => 'regular',
|
5667 |
),
|
|
|
|
|
|
|
|
|
5668 |
'Trirong' =>
|
5669 |
array(
|
5670 |
0 => '100',
|
@@ -5686,6 +6270,17 @@ return array(
|
|
5686 |
16 => '900',
|
5687 |
17 => '900italic',
|
5688 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5689 |
'Trocchi' =>
|
5690 |
array(
|
5691 |
0 => 'regular',
|
@@ -5696,6 +6291,18 @@ return array(
|
|
5696 |
1 => 'italic',
|
5697 |
2 => '700',
|
5698 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5699 |
'Trykker' =>
|
5700 |
array(
|
5701 |
0 => 'regular',
|
@@ -5791,6 +6398,14 @@ return array(
|
|
5791 |
array(
|
5792 |
0 => 'regular',
|
5793 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5794 |
'Vast Shadow' =>
|
5795 |
array(
|
5796 |
0 => 'regular',
|
@@ -5908,6 +6523,11 @@ return array(
|
|
5908 |
16 => '800italic',
|
5909 |
17 => '900italic',
|
5910 |
),
|
|
|
|
|
|
|
|
|
|
|
5911 |
'Yanone Kaffeesatz' =>
|
5912 |
array(
|
5913 |
0 => '200',
|
@@ -5954,6 +6574,10 @@ return array(
|
|
5954 |
3 => '600',
|
5955 |
4 => '700',
|
5956 |
),
|
|
|
|
|
|
|
|
|
5957 |
'ZCOOL KuaiLe' =>
|
5958 |
array(
|
5959 |
0 => 'regular',
|
52 |
array(
|
53 |
0 => 'regular',
|
54 |
),
|
55 |
+
'Akaya Kanadaka' =>
|
56 |
+
array(
|
57 |
+
0 => 'regular',
|
58 |
+
),
|
59 |
+
'Akaya Telivigala' =>
|
60 |
+
array(
|
61 |
+
0 => 'regular',
|
62 |
+
),
|
63 |
'Akronim' =>
|
64 |
array(
|
65 |
0 => 'regular',
|
88 |
'Alegreya' =>
|
89 |
array(
|
90 |
0 => 'regular',
|
91 |
+
1 => '500',
|
92 |
+
2 => '600',
|
93 |
+
3 => '700',
|
94 |
+
4 => '800',
|
95 |
+
5 => '900',
|
96 |
+
6 => 'italic',
|
97 |
+
7 => '500italic',
|
98 |
+
8 => '600italic',
|
99 |
+
9 => '700italic',
|
100 |
+
10 => '800italic',
|
101 |
+
11 => '900italic',
|
102 |
),
|
103 |
'Alegreya SC' =>
|
104 |
array(
|
265 |
array(
|
266 |
0 => 'regular',
|
267 |
),
|
268 |
+
'Andika New Basic' =>
|
269 |
+
array(
|
270 |
+
0 => 'regular',
|
271 |
+
1 => 'italic',
|
272 |
+
2 => '700',
|
273 |
+
3 => '700italic',
|
274 |
+
),
|
275 |
'Angkor' =>
|
276 |
array(
|
277 |
0 => 'regular',
|
322 |
),
|
323 |
'Archivo' =>
|
324 |
array(
|
325 |
+
0 => '100',
|
326 |
+
1 => '200',
|
327 |
+
2 => '300',
|
328 |
+
3 => 'regular',
|
329 |
+
4 => '500',
|
330 |
+
5 => '600',
|
331 |
6 => '700',
|
332 |
+
7 => '800',
|
333 |
+
8 => '900',
|
334 |
+
9 => '100italic',
|
335 |
+
10 => '200italic',
|
336 |
+
11 => '300italic',
|
337 |
+
12 => 'italic',
|
338 |
+
13 => '500italic',
|
339 |
+
14 => '600italic',
|
340 |
+
15 => '700italic',
|
341 |
+
16 => '800italic',
|
342 |
+
17 => '900italic',
|
343 |
),
|
344 |
'Archivo Black' =>
|
345 |
array(
|
375 |
'Arimo' =>
|
376 |
array(
|
377 |
0 => 'regular',
|
378 |
+
1 => '500',
|
379 |
+
2 => '600',
|
380 |
+
3 => '700',
|
381 |
+
4 => 'italic',
|
382 |
+
5 => '500italic',
|
383 |
+
6 => '600italic',
|
384 |
+
7 => '700italic',
|
385 |
),
|
386 |
'Arizonia' =>
|
387 |
array(
|
417 |
'Asap' =>
|
418 |
array(
|
419 |
0 => 'regular',
|
420 |
+
1 => '500',
|
421 |
+
2 => '600',
|
422 |
+
3 => '700',
|
423 |
+
4 => 'italic',
|
424 |
+
5 => '500italic',
|
425 |
+
6 => '600italic',
|
426 |
7 => '700italic',
|
427 |
),
|
428 |
'Asap Condensed' =>
|
449 |
0 => '200',
|
450 |
1 => '300',
|
451 |
2 => 'regular',
|
452 |
+
3 => '500',
|
453 |
+
4 => '600',
|
454 |
+
5 => '700',
|
455 |
+
6 => '800',
|
456 |
),
|
457 |
'Astloch' =>
|
458 |
array(
|
577 |
10 => '700',
|
578 |
11 => '700italic',
|
579 |
),
|
580 |
+
'Ballet' =>
|
581 |
+
array(
|
582 |
+
0 => 'regular',
|
583 |
+
),
|
584 |
'Baloo 2' =>
|
585 |
array(
|
586 |
0 => 'regular',
|
818 |
1 => 'regular',
|
819 |
2 => '700',
|
820 |
),
|
821 |
+
'Benne' =>
|
822 |
+
array(
|
823 |
+
0 => 'regular',
|
824 |
+
),
|
825 |
'Bentham' =>
|
826 |
array(
|
827 |
0 => 'regular',
|
849 |
6 => '800',
|
850 |
7 => '900',
|
851 |
),
|
852 |
+
'Big Shoulders Inline Display' =>
|
853 |
+
array(
|
854 |
+
0 => '100',
|
855 |
+
1 => '300',
|
856 |
+
2 => 'regular',
|
857 |
+
3 => '500',
|
858 |
+
4 => '600',
|
859 |
+
5 => '700',
|
860 |
+
6 => '800',
|
861 |
+
7 => '900',
|
862 |
+
),
|
863 |
+
'Big Shoulders Inline Text' =>
|
864 |
+
array(
|
865 |
+
0 => '100',
|
866 |
+
1 => '300',
|
867 |
+
2 => 'regular',
|
868 |
+
3 => '500',
|
869 |
+
4 => '600',
|
870 |
+
5 => '700',
|
871 |
+
6 => '800',
|
872 |
+
7 => '900',
|
873 |
+
),
|
874 |
+
'Big Shoulders Stencil Display' =>
|
875 |
+
array(
|
876 |
+
0 => '100',
|
877 |
+
1 => '300',
|
878 |
+
2 => 'regular',
|
879 |
+
3 => '500',
|
880 |
+
4 => '600',
|
881 |
+
5 => '700',
|
882 |
+
6 => '800',
|
883 |
+
7 => '900',
|
884 |
+
),
|
885 |
+
'Big Shoulders Stencil Text' =>
|
886 |
+
array(
|
887 |
+
0 => '100',
|
888 |
+
1 => '300',
|
889 |
+
2 => 'regular',
|
890 |
+
3 => '500',
|
891 |
+
4 => '600',
|
892 |
+
5 => '700',
|
893 |
+
6 => '800',
|
894 |
+
7 => '900',
|
895 |
+
),
|
896 |
'Big Shoulders Text' =>
|
897 |
array(
|
898 |
0 => '100',
|
948 |
),
|
949 |
'Bitter' =>
|
950 |
array(
|
951 |
+
0 => '100',
|
952 |
+
1 => '200',
|
953 |
+
2 => '300',
|
954 |
+
3 => 'regular',
|
955 |
+
4 => '500',
|
956 |
+
5 => '600',
|
957 |
+
6 => '700',
|
958 |
+
7 => '800',
|
959 |
+
8 => '900',
|
960 |
+
9 => '100italic',
|
961 |
+
10 => '200italic',
|
962 |
+
11 => '300italic',
|
963 |
+
12 => 'italic',
|
964 |
+
13 => '500italic',
|
965 |
+
14 => '600italic',
|
966 |
+
15 => '700italic',
|
967 |
+
16 => '800italic',
|
968 |
+
17 => '900italic',
|
969 |
),
|
970 |
'Black And White Picture' =>
|
971 |
array(
|
990 |
6 => '800',
|
991 |
7 => '900',
|
992 |
),
|
993 |
+
'Bodoni Moda' =>
|
994 |
+
array(
|
995 |
+
0 => 'regular',
|
996 |
+
1 => '500',
|
997 |
+
2 => '600',
|
998 |
+
3 => '700',
|
999 |
+
4 => '800',
|
1000 |
+
5 => '900',
|
1001 |
+
6 => 'italic',
|
1002 |
+
7 => '500italic',
|
1003 |
+
8 => '600italic',
|
1004 |
+
9 => '700italic',
|
1005 |
+
10 => '800italic',
|
1006 |
+
11 => '900italic',
|
1007 |
+
),
|
1008 |
'Bokor' =>
|
1009 |
array(
|
1010 |
0 => 'regular',
|
1033 |
array(
|
1034 |
0 => 'regular',
|
1035 |
),
|
1036 |
+
'Brygada 1918' =>
|
1037 |
+
array(
|
1038 |
+
0 => 'regular',
|
1039 |
+
1 => '500',
|
1040 |
+
2 => '600',
|
1041 |
+
3 => '700',
|
1042 |
+
4 => 'italic',
|
1043 |
+
5 => '500italic',
|
1044 |
+
6 => '600italic',
|
1045 |
+
7 => '700italic',
|
1046 |
+
),
|
1047 |
'Bubblegum Sans' =>
|
1048 |
array(
|
1049 |
0 => 'regular',
|
1092 |
'Cabin' =>
|
1093 |
array(
|
1094 |
0 => 'regular',
|
1095 |
+
1 => '500',
|
1096 |
+
2 => '600',
|
1097 |
+
3 => '700',
|
1098 |
+
4 => 'italic',
|
1099 |
+
5 => '500italic',
|
1100 |
+
6 => '600italic',
|
1101 |
7 => '700italic',
|
1102 |
),
|
1103 |
'Cabin Condensed' =>
|
1200 |
array(
|
1201 |
0 => 'regular',
|
1202 |
),
|
1203 |
+
'Castoro' =>
|
1204 |
+
array(
|
1205 |
+
0 => 'regular',
|
1206 |
+
1 => 'italic',
|
1207 |
+
),
|
1208 |
'Catamaran' =>
|
1209 |
array(
|
1210 |
0 => '100',
|
1227 |
'Caveat' =>
|
1228 |
array(
|
1229 |
0 => 'regular',
|
1230 |
+
1 => '500',
|
1231 |
+
2 => '600',
|
1232 |
+
3 => '700',
|
1233 |
),
|
1234 |
'Caveat Brush' =>
|
1235 |
array(
|
1349 |
'Cinzel' =>
|
1350 |
array(
|
1351 |
0 => 'regular',
|
1352 |
+
1 => '500',
|
1353 |
+
2 => '600',
|
1354 |
+
3 => '700',
|
1355 |
+
4 => '800',
|
1356 |
+
5 => '900',
|
1357 |
),
|
1358 |
'Cinzel Decorative' =>
|
1359 |
array(
|
1408 |
array(
|
1409 |
0 => 'regular',
|
1410 |
),
|
1411 |
+
'Commissioner' =>
|
1412 |
+
array(
|
1413 |
+
0 => '100',
|
1414 |
+
1 => '200',
|
1415 |
+
2 => '300',
|
1416 |
+
3 => 'regular',
|
1417 |
+
4 => '500',
|
1418 |
+
5 => '600',
|
1419 |
+
6 => '700',
|
1420 |
+
7 => '800',
|
1421 |
+
8 => '900',
|
1422 |
+
),
|
1423 |
'Concert One' =>
|
1424 |
array(
|
1425 |
0 => 'regular',
|
1596 |
'Cuprum' =>
|
1597 |
array(
|
1598 |
0 => 'regular',
|
1599 |
+
1 => '500',
|
1600 |
+
2 => '600',
|
1601 |
+
3 => '700',
|
1602 |
+
4 => 'italic',
|
1603 |
+
5 => '500italic',
|
1604 |
+
6 => '600italic',
|
1605 |
+
7 => '700italic',
|
1606 |
),
|
1607 |
'Cute Font' =>
|
1608 |
array(
|
1687 |
array(
|
1688 |
0 => 'regular',
|
1689 |
),
|
1690 |
+
'Dela Gothic One' =>
|
1691 |
+
array(
|
1692 |
+
0 => 'regular',
|
1693 |
+
),
|
1694 |
'Delius' =>
|
1695 |
array(
|
1696 |
0 => 'regular',
|
1743 |
'Domine' =>
|
1744 |
array(
|
1745 |
0 => 'regular',
|
1746 |
+
1 => '500',
|
1747 |
+
2 => '600',
|
1748 |
+
3 => '700',
|
1749 |
),
|
1750 |
'Donegal One' =>
|
1751 |
array(
|
1769 |
5 => '700',
|
1770 |
6 => '800',
|
1771 |
),
|
1772 |
+
'DotGothic16' =>
|
1773 |
+
array(
|
1774 |
+
0 => 'regular',
|
1775 |
+
),
|
1776 |
'Dr Sugiyama' =>
|
1777 |
array(
|
1778 |
0 => 'regular',
|
1929 |
2 => '600',
|
1930 |
3 => '700',
|
1931 |
),
|
1932 |
+
'Epilogue' =>
|
1933 |
+
array(
|
1934 |
+
0 => '100',
|
1935 |
+
1 => '200',
|
1936 |
+
2 => '300',
|
1937 |
+
3 => 'regular',
|
1938 |
+
4 => '500',
|
1939 |
+
5 => '600',
|
1940 |
+
6 => '700',
|
1941 |
+
7 => '800',
|
1942 |
+
8 => '900',
|
1943 |
+
9 => '100italic',
|
1944 |
+
10 => '200italic',
|
1945 |
+
11 => '300italic',
|
1946 |
+
12 => 'italic',
|
1947 |
+
13 => '500italic',
|
1948 |
+
14 => '600italic',
|
1949 |
+
15 => '700italic',
|
1950 |
+
16 => '800italic',
|
1951 |
+
17 => '900italic',
|
1952 |
+
),
|
1953 |
'Erica One' =>
|
1954 |
array(
|
1955 |
0 => 'regular',
|
2220 |
3 => '700',
|
2221 |
4 => '900',
|
2222 |
),
|
2223 |
+
'Fraunces' =>
|
2224 |
array(
|
2225 |
+
0 => '100',
|
2226 |
+
1 => '200',
|
2227 |
+
2 => '300',
|
2228 |
+
3 => 'regular',
|
2229 |
+
4 => '500',
|
2230 |
+
5 => '600',
|
2231 |
+
6 => '700',
|
2232 |
+
7 => '800',
|
2233 |
+
8 => '900',
|
2234 |
+
9 => '100italic',
|
2235 |
+
10 => '200italic',
|
2236 |
+
11 => '300italic',
|
2237 |
+
12 => 'italic',
|
2238 |
+
13 => '500italic',
|
2239 |
+
14 => '600italic',
|
2240 |
+
15 => '700italic',
|
2241 |
+
16 => '800italic',
|
2242 |
+
17 => '900italic',
|
2243 |
+
),
|
2244 |
+
'Freckle Face' =>
|
2245 |
+
array(
|
2246 |
+
0 => 'regular',
|
2247 |
),
|
2248 |
'Fredericka the Great' =>
|
2249 |
array(
|
2399 |
array(
|
2400 |
0 => 'regular',
|
2401 |
),
|
2402 |
+
'Goldman' =>
|
2403 |
+
array(
|
2404 |
+
0 => 'regular',
|
2405 |
+
1 => '700',
|
2406 |
+
),
|
2407 |
'Gorditas' =>
|
2408 |
array(
|
2409 |
0 => 'regular',
|
2437 |
array(
|
2438 |
0 => 'regular',
|
2439 |
),
|
2440 |
+
'Grandstander' =>
|
2441 |
+
array(
|
2442 |
+
0 => '100',
|
2443 |
+
1 => '200',
|
2444 |
+
2 => '300',
|
2445 |
+
3 => 'regular',
|
2446 |
+
4 => '500',
|
2447 |
+
5 => '600',
|
2448 |
+
6 => '700',
|
2449 |
+
7 => '800',
|
2450 |
+
8 => '900',
|
2451 |
+
9 => '100italic',
|
2452 |
+
10 => '200italic',
|
2453 |
+
11 => '300italic',
|
2454 |
+
12 => 'italic',
|
2455 |
+
13 => '500italic',
|
2456 |
+
14 => '600italic',
|
2457 |
+
15 => '700italic',
|
2458 |
+
16 => '800italic',
|
2459 |
+
17 => '900italic',
|
2460 |
+
),
|
2461 |
'Gravitas One' =>
|
2462 |
array(
|
2463 |
0 => 'regular',
|
2487 |
16 => '900',
|
2488 |
17 => '900italic',
|
2489 |
),
|
2490 |
+
'Grenze Gotisch' =>
|
2491 |
+
array(
|
2492 |
+
0 => '100',
|
2493 |
+
1 => '200',
|
2494 |
+
2 => '300',
|
2495 |
+
3 => 'regular',
|
2496 |
+
4 => '500',
|
2497 |
+
5 => '600',
|
2498 |
+
6 => '700',
|
2499 |
+
7 => '800',
|
2500 |
+
8 => '900',
|
2501 |
+
),
|
2502 |
'Griffy' =>
|
2503 |
array(
|
2504 |
0 => 'regular',
|
2531 |
array(
|
2532 |
0 => 'regular',
|
2533 |
),
|
2534 |
+
'Hachi Maru Pop' =>
|
2535 |
+
array(
|
2536 |
+
0 => 'regular',
|
2537 |
+
),
|
2538 |
'Halant' =>
|
2539 |
array(
|
2540 |
0 => '300',
|
2571 |
'Harmattan' =>
|
2572 |
array(
|
2573 |
0 => 'regular',
|
2574 |
+
1 => '700',
|
2575 |
),
|
2576 |
'Headland One' =>
|
2577 |
array(
|
2580 |
'Heebo' =>
|
2581 |
array(
|
2582 |
0 => '100',
|
2583 |
+
1 => '200',
|
2584 |
+
2 => '300',
|
2585 |
+
3 => 'regular',
|
2586 |
+
4 => '500',
|
2587 |
+
5 => '600',
|
2588 |
+
6 => '700',
|
2589 |
+
7 => '800',
|
2590 |
+
8 => '900',
|
2591 |
),
|
2592 |
'Henny Penny' =>
|
2593 |
array(
|
2781 |
'Ibarra Real Nova' =>
|
2782 |
array(
|
2783 |
0 => 'regular',
|
2784 |
+
1 => '500',
|
2785 |
2 => '600',
|
2786 |
+
3 => '700',
|
2787 |
+
4 => 'italic',
|
2788 |
+
5 => '500italic',
|
2789 |
+
6 => '600italic',
|
2790 |
+
7 => '700italic',
|
2791 |
),
|
2792 |
'Iceberg' =>
|
2793 |
array(
|
2797 |
array(
|
2798 |
0 => 'regular',
|
2799 |
),
|
2800 |
+
'Imbue' =>
|
2801 |
+
array(
|
2802 |
+
0 => '100',
|
2803 |
+
1 => '200',
|
2804 |
+
2 => '300',
|
2805 |
+
3 => 'regular',
|
2806 |
+
4 => '500',
|
2807 |
+
5 => '600',
|
2808 |
+
6 => '700',
|
2809 |
+
7 => '800',
|
2810 |
+
8 => '900',
|
2811 |
+
),
|
2812 |
'Imprima' =>
|
2813 |
array(
|
2814 |
0 => 'regular',
|
2913 |
0 => 'regular',
|
2914 |
1 => '700',
|
2915 |
),
|
2916 |
+
'JetBrains Mono' =>
|
2917 |
+
array(
|
2918 |
+
0 => '100',
|
2919 |
+
1 => '200',
|
2920 |
+
2 => '300',
|
2921 |
+
3 => 'regular',
|
2922 |
+
4 => '500',
|
2923 |
+
5 => '600',
|
2924 |
+
6 => '700',
|
2925 |
+
7 => '800',
|
2926 |
+
8 => '100italic',
|
2927 |
+
9 => '200italic',
|
2928 |
+
10 => '300italic',
|
2929 |
+
11 => 'italic',
|
2930 |
+
12 => '500italic',
|
2931 |
+
13 => '600italic',
|
2932 |
+
14 => '700italic',
|
2933 |
+
15 => '800italic',
|
2934 |
+
),
|
2935 |
'Jim Nightshade' =>
|
2936 |
array(
|
2937 |
0 => 'regular',
|
2972 |
'Josefin Slab' =>
|
2973 |
array(
|
2974 |
0 => '100',
|
2975 |
+
1 => '200',
|
2976 |
2 => '300',
|
2977 |
+
3 => 'regular',
|
2978 |
+
4 => '500',
|
2979 |
+
5 => '600',
|
2980 |
+
6 => '700',
|
2981 |
+
7 => '100italic',
|
2982 |
+
8 => '200italic',
|
2983 |
+
9 => '300italic',
|
2984 |
+
10 => 'italic',
|
2985 |
+
11 => '500italic',
|
2986 |
+
12 => '600italic',
|
2987 |
+
13 => '700italic',
|
2988 |
),
|
2989 |
'Jost' =>
|
2990 |
array(
|
3113 |
),
|
3114 |
'Karla' =>
|
3115 |
array(
|
3116 |
+
0 => '200',
|
3117 |
+
1 => '300',
|
3118 |
+
2 => 'regular',
|
3119 |
+
3 => '500',
|
3120 |
+
4 => '600',
|
3121 |
+
5 => '700',
|
3122 |
+
6 => '800',
|
3123 |
+
7 => '200italic',
|
3124 |
+
8 => '300italic',
|
3125 |
+
9 => 'italic',
|
3126 |
+
10 => '500italic',
|
3127 |
+
11 => '600italic',
|
3128 |
+
12 => '700italic',
|
3129 |
+
13 => '800italic',
|
3130 |
),
|
3131 |
'Karma' =>
|
3132 |
array(
|
3196 |
array(
|
3197 |
0 => 'regular',
|
3198 |
),
|
3199 |
+
'Kiwi Maru' =>
|
3200 |
+
array(
|
3201 |
+
0 => '300',
|
3202 |
+
1 => 'regular',
|
3203 |
+
2 => '500',
|
3204 |
+
),
|
3205 |
'Knewave' =>
|
3206 |
array(
|
3207 |
0 => 'regular',
|
3287 |
10 => '700',
|
3288 |
11 => '700italic',
|
3289 |
),
|
3290 |
+
'Kufam' =>
|
3291 |
+
array(
|
3292 |
+
0 => 'regular',
|
3293 |
+
1 => '500',
|
3294 |
+
2 => '600',
|
3295 |
+
3 => '700',
|
3296 |
+
4 => '800',
|
3297 |
+
5 => '900',
|
3298 |
+
6 => 'italic',
|
3299 |
+
7 => '500italic',
|
3300 |
+
8 => '600italic',
|
3301 |
+
9 => '700italic',
|
3302 |
+
10 => '800italic',
|
3303 |
+
11 => '900italic',
|
3304 |
+
),
|
3305 |
'Kulim Park' =>
|
3306 |
array(
|
3307 |
0 => '200',
|
3323 |
array(
|
3324 |
0 => 'regular',
|
3325 |
),
|
3326 |
+
'Kumbh Sans' =>
|
3327 |
+
array(
|
3328 |
+
0 => '300',
|
3329 |
+
1 => 'regular',
|
3330 |
+
2 => '700',
|
3331 |
+
),
|
3332 |
'Kurale' =>
|
3333 |
array(
|
3334 |
0 => 'regular',
|
3361 |
array(
|
3362 |
0 => 'regular',
|
3363 |
),
|
3364 |
+
'Langar' =>
|
3365 |
+
array(
|
3366 |
+
0 => 'regular',
|
3367 |
+
),
|
3368 |
'Lateef' =>
|
3369 |
array(
|
3370 |
0 => 'regular',
|
3412 |
3 => '600',
|
3413 |
4 => '700',
|
3414 |
),
|
3415 |
+
'Lexend' =>
|
3416 |
+
array(
|
3417 |
+
0 => '100',
|
3418 |
+
1 => '300',
|
3419 |
+
2 => 'regular',
|
3420 |
+
3 => '500',
|
3421 |
+
4 => '600',
|
3422 |
+
5 => '700',
|
3423 |
+
6 => '800',
|
3424 |
+
),
|
3425 |
'Lexend Deca' =>
|
3426 |
array(
|
3427 |
0 => 'regular',
|
3474 |
array(
|
3475 |
0 => 'regular',
|
3476 |
),
|
3477 |
+
'Libre Barcode EAN13 Text' =>
|
3478 |
+
array(
|
3479 |
+
0 => 'regular',
|
3480 |
+
),
|
3481 |
'Libre Baskerville' =>
|
3482 |
array(
|
3483 |
0 => 'regular',
|
3497 |
'Libre Franklin' =>
|
3498 |
array(
|
3499 |
0 => '100',
|
3500 |
+
1 => '200',
|
3501 |
+
2 => '300',
|
3502 |
+
3 => 'regular',
|
3503 |
+
4 => '500',
|
3504 |
+
5 => '600',
|
3505 |
+
6 => '700',
|
3506 |
+
7 => '800',
|
3507 |
+
8 => '900',
|
3508 |
+
9 => '100italic',
|
3509 |
+
10 => '200italic',
|
3510 |
+
11 => '300italic',
|
3511 |
+
12 => 'italic',
|
3512 |
+
13 => '500italic',
|
3513 |
+
14 => '600italic',
|
3514 |
+
15 => '700italic',
|
3515 |
+
16 => '800italic',
|
3516 |
17 => '900italic',
|
3517 |
),
|
3518 |
'Life Savers' =>
|
3540 |
),
|
3541 |
'Literata' =>
|
3542 |
array(
|
3543 |
+
0 => '200',
|
3544 |
+
1 => '300',
|
3545 |
+
2 => 'regular',
|
3546 |
+
3 => '500',
|
3547 |
+
4 => '600',
|
3548 |
+
5 => '700',
|
3549 |
+
6 => '800',
|
3550 |
+
7 => '900',
|
3551 |
+
8 => '200italic',
|
3552 |
+
9 => '300italic',
|
3553 |
+
10 => 'italic',
|
3554 |
+
11 => '500italic',
|
3555 |
+
12 => '600italic',
|
3556 |
+
13 => '700italic',
|
3557 |
+
14 => '800italic',
|
3558 |
+
15 => '900italic',
|
3559 |
),
|
3560 |
'Liu Jian Mao Cao' =>
|
3561 |
array(
|
3899 |
'Merriweather Sans' =>
|
3900 |
array(
|
3901 |
0 => '300',
|
3902 |
+
1 => 'regular',
|
3903 |
+
2 => '500',
|
3904 |
+
3 => '600',
|
3905 |
4 => '700',
|
3906 |
+
5 => '800',
|
3907 |
+
6 => '300italic',
|
3908 |
+
7 => 'italic',
|
3909 |
+
8 => '500italic',
|
3910 |
+
9 => '600italic',
|
3911 |
+
10 => '700italic',
|
3912 |
+
11 => '800italic',
|
3913 |
),
|
3914 |
'Metal' =>
|
3915 |
array(
|
4146 |
5 => '700',
|
4147 |
6 => '800',
|
4148 |
),
|
4149 |
+
'Mulish' =>
|
4150 |
array(
|
4151 |
0 => '200',
|
4152 |
1 => '300',
|
4165 |
14 => '800italic',
|
4166 |
15 => '900italic',
|
4167 |
),
|
4168 |
+
'MuseoModerno' =>
|
|
|
|
|
|
|
|
|
4169 |
array(
|
4170 |
+
0 => '100',
|
4171 |
+
1 => '200',
|
4172 |
+
2 => '300',
|
4173 |
+
3 => 'regular',
|
4174 |
+
4 => '500',
|
4175 |
+
5 => '600',
|
4176 |
+
6 => '700',
|
4177 |
+
7 => '800',
|
4178 |
+
8 => '900',
|
4179 |
+
),
|
4180 |
+
'Mystery Quest' =>
|
4181 |
+
array(
|
4182 |
+
0 => 'regular',
|
4183 |
+
),
|
4184 |
+
'NTR' =>
|
4185 |
+
array(
|
4186 |
+
0 => 'regular',
|
4187 |
+
),
|
4188 |
+
'Nanum Brush Script' =>
|
4189 |
array(
|
4190 |
0 => 'regular',
|
4191 |
),
|
4210 |
array(
|
4211 |
0 => 'regular',
|
4212 |
),
|
4213 |
+
'Nerko One' =>
|
4214 |
+
array(
|
4215 |
+
0 => 'regular',
|
4216 |
+
),
|
4217 |
'Neucha' =>
|
4218 |
array(
|
4219 |
0 => 'regular',
|
4231 |
array(
|
4232 |
0 => 'regular',
|
4233 |
),
|
4234 |
+
'New Tegomin' =>
|
4235 |
+
array(
|
4236 |
+
0 => 'regular',
|
4237 |
+
),
|
4238 |
'News Cycle' =>
|
4239 |
array(
|
4240 |
0 => 'regular',
|
4241 |
1 => '700',
|
4242 |
),
|
4243 |
+
'Newsreader' =>
|
4244 |
+
array(
|
4245 |
+
0 => '200',
|
4246 |
+
1 => '300',
|
4247 |
+
2 => 'regular',
|
4248 |
+
3 => '500',
|
4249 |
+
4 => '600',
|
4250 |
+
5 => '700',
|
4251 |
+
6 => '800',
|
4252 |
+
7 => '200italic',
|
4253 |
+
8 => '300italic',
|
4254 |
+
9 => 'italic',
|
4255 |
+
10 => '500italic',
|
4256 |
+
11 => '600italic',
|
4257 |
+
12 => '700italic',
|
4258 |
+
13 => '800italic',
|
4259 |
+
),
|
4260 |
'Niconne' =>
|
4261 |
array(
|
4262 |
0 => 'regular',
|
4498 |
array(
|
4499 |
0 => 'regular',
|
4500 |
),
|
4501 |
+
'Oi' =>
|
4502 |
+
array(
|
4503 |
+
0 => 'regular',
|
4504 |
+
),
|
4505 |
'Old Standard TT' =>
|
4506 |
array(
|
4507 |
0 => 'regular',
|
4770 |
),
|
4771 |
'Petrona' =>
|
4772 |
array(
|
4773 |
+
0 => '100',
|
4774 |
+
1 => '200',
|
4775 |
+
2 => '300',
|
4776 |
+
3 => 'regular',
|
4777 |
+
4 => '500',
|
4778 |
+
5 => '600',
|
4779 |
+
6 => '700',
|
4780 |
+
7 => '800',
|
4781 |
+
8 => '900',
|
4782 |
+
9 => '100italic',
|
4783 |
+
10 => '200italic',
|
4784 |
+
11 => '300italic',
|
4785 |
+
12 => 'italic',
|
4786 |
+
13 => '500italic',
|
4787 |
+
14 => '600italic',
|
4788 |
+
15 => '700italic',
|
4789 |
+
16 => '800italic',
|
4790 |
+
17 => '900italic',
|
4791 |
),
|
4792 |
'Philosopher' =>
|
4793 |
array(
|
4796 |
2 => '700',
|
4797 |
3 => '700italic',
|
4798 |
),
|
4799 |
+
'Piazzolla' =>
|
4800 |
+
array(
|
4801 |
+
0 => '100',
|
4802 |
+
1 => '200',
|
4803 |
+
2 => '300',
|
4804 |
+
3 => 'regular',
|
4805 |
+
4 => '500',
|
4806 |
+
5 => '600',
|
4807 |
+
6 => '700',
|
4808 |
+
7 => '800',
|
4809 |
+
8 => '900',
|
4810 |
+
9 => '100italic',
|
4811 |
+
10 => '200italic',
|
4812 |
+
11 => '300italic',
|
4813 |
+
12 => 'italic',
|
4814 |
+
13 => '500italic',
|
4815 |
+
14 => '600italic',
|
4816 |
+
15 => '700italic',
|
4817 |
+
16 => '800italic',
|
4818 |
+
17 => '900italic',
|
4819 |
+
),
|
4820 |
'Piedra' =>
|
4821 |
array(
|
4822 |
0 => 'regular',
|
4928 |
array(
|
4929 |
0 => 'regular',
|
4930 |
),
|
4931 |
+
'Potta One' =>
|
4932 |
+
array(
|
4933 |
+
0 => 'regular',
|
4934 |
+
),
|
4935 |
'Pragati Narrow' =>
|
4936 |
array(
|
4937 |
0 => 'regular',
|
5103 |
'Raleway' =>
|
5104 |
array(
|
5105 |
0 => '100',
|
5106 |
+
1 => '200',
|
5107 |
+
2 => '300',
|
5108 |
+
3 => 'regular',
|
5109 |
+
4 => '500',
|
5110 |
+
5 => '600',
|
5111 |
+
6 => '700',
|
5112 |
+
7 => '800',
|
5113 |
+
8 => '900',
|
5114 |
+
9 => '100italic',
|
5115 |
+
10 => '200italic',
|
5116 |
+
11 => '300italic',
|
5117 |
+
12 => 'italic',
|
5118 |
+
13 => '500italic',
|
5119 |
+
14 => '600italic',
|
5120 |
+
15 => '700italic',
|
5121 |
+
16 => '800italic',
|
5122 |
17 => '900italic',
|
5123 |
),
|
5124 |
'Raleway Dots' =>
|
5173 |
array(
|
5174 |
0 => 'regular',
|
5175 |
),
|
5176 |
+
'Recursive' =>
|
5177 |
+
array(
|
5178 |
+
0 => '300',
|
5179 |
+
1 => 'regular',
|
5180 |
+
2 => '500',
|
5181 |
+
3 => '600',
|
5182 |
+
4 => '700',
|
5183 |
+
5 => '800',
|
5184 |
+
6 => '900',
|
5185 |
+
),
|
5186 |
'Red Hat Display' =>
|
5187 |
array(
|
5188 |
0 => 'regular',
|
5203 |
4 => '700',
|
5204 |
5 => '700italic',
|
5205 |
),
|
5206 |
+
'Red Rose' =>
|
5207 |
+
array(
|
5208 |
+
0 => '300',
|
5209 |
+
1 => 'regular',
|
5210 |
+
2 => '500',
|
5211 |
+
3 => '600',
|
5212 |
+
4 => '700',
|
5213 |
+
),
|
5214 |
'Redressed' =>
|
5215 |
array(
|
5216 |
0 => 'regular',
|
5223 |
array(
|
5224 |
0 => 'regular',
|
5225 |
),
|
5226 |
+
'Reggae One' =>
|
5227 |
+
array(
|
5228 |
+
0 => 'regular',
|
5229 |
+
),
|
5230 |
'Revalia' =>
|
5231 |
array(
|
5232 |
0 => 'regular',
|
5278 |
'Roboto Mono' =>
|
5279 |
array(
|
5280 |
0 => '100',
|
5281 |
+
1 => '200',
|
5282 |
2 => '300',
|
5283 |
+
3 => 'regular',
|
5284 |
+
4 => '500',
|
5285 |
+
5 => '600',
|
5286 |
+
6 => '700',
|
5287 |
+
7 => '100italic',
|
5288 |
+
8 => '200italic',
|
5289 |
+
9 => '300italic',
|
5290 |
+
10 => 'italic',
|
5291 |
+
11 => '500italic',
|
5292 |
+
12 => '600italic',
|
5293 |
+
13 => '700italic',
|
5294 |
),
|
5295 |
'Roboto Slab' =>
|
5296 |
array(
|
5312 |
array(
|
5313 |
0 => 'regular',
|
5314 |
),
|
5315 |
+
'RocknRoll One' =>
|
5316 |
+
array(
|
5317 |
+
0 => 'regular',
|
5318 |
+
),
|
5319 |
'Rokkitt' =>
|
5320 |
array(
|
5321 |
0 => '100',
|
5359 |
array(
|
5360 |
0 => 'regular',
|
5361 |
),
|
5362 |
+
'Rowdies' =>
|
5363 |
+
array(
|
5364 |
+
0 => '300',
|
5365 |
+
1 => 'regular',
|
5366 |
+
2 => '700',
|
5367 |
+
),
|
5368 |
'Rozha One' =>
|
5369 |
array(
|
5370 |
0 => 'regular',
|
5372 |
'Rubik' =>
|
5373 |
array(
|
5374 |
0 => '300',
|
5375 |
+
1 => 'regular',
|
5376 |
+
2 => '500',
|
5377 |
+
3 => '600',
|
5378 |
+
4 => '700',
|
5379 |
+
5 => '800',
|
5380 |
+
6 => '900',
|
5381 |
+
7 => '300italic',
|
5382 |
+
8 => 'italic',
|
5383 |
+
9 => '500italic',
|
5384 |
+
10 => '600italic',
|
5385 |
+
11 => '700italic',
|
5386 |
+
12 => '800italic',
|
5387 |
+
13 => '900italic',
|
5388 |
),
|
5389 |
'Rubik Mono One' =>
|
5390 |
array(
|
5456 |
6 => '700',
|
5457 |
7 => '800',
|
5458 |
8 => '900',
|
5459 |
+
9 => '100italic',
|
5460 |
+
10 => '200italic',
|
5461 |
+
11 => '300italic',
|
5462 |
+
12 => 'italic',
|
5463 |
+
13 => '500italic',
|
5464 |
+
14 => '600italic',
|
5465 |
+
15 => '700italic',
|
5466 |
+
16 => '800italic',
|
5467 |
+
17 => '900italic',
|
5468 |
),
|
5469 |
'Saira Condensed' =>
|
5470 |
array(
|
5530 |
6 => '900',
|
5531 |
7 => '900italic',
|
5532 |
),
|
5533 |
+
'Sansita Swashed' =>
|
5534 |
+
array(
|
5535 |
+
0 => '300',
|
5536 |
+
1 => 'regular',
|
5537 |
+
2 => '500',
|
5538 |
+
3 => '600',
|
5539 |
+
4 => '700',
|
5540 |
+
5 => '800',
|
5541 |
+
6 => '900',
|
5542 |
+
),
|
5543 |
'Sarabun' =>
|
5544 |
array(
|
5545 |
0 => '100',
|
5666 |
array(
|
5667 |
0 => 'regular',
|
5668 |
),
|
5669 |
+
'Shippori Mincho' =>
|
5670 |
+
array(
|
5671 |
+
0 => 'regular',
|
5672 |
+
1 => '500',
|
5673 |
+
2 => '600',
|
5674 |
+
3 => '700',
|
5675 |
+
4 => '800',
|
5676 |
+
),
|
5677 |
+
'Shippori Mincho B1' =>
|
5678 |
+
array(
|
5679 |
+
0 => 'regular',
|
5680 |
+
1 => '500',
|
5681 |
+
2 => '600',
|
5682 |
+
3 => '700',
|
5683 |
+
4 => '800',
|
5684 |
+
),
|
5685 |
'Shojumaru' =>
|
5686 |
array(
|
5687 |
0 => 'regular',
|
5706 |
array(
|
5707 |
0 => '300',
|
5708 |
1 => 'regular',
|
5709 |
+
2 => '500',
|
5710 |
+
3 => '600',
|
5711 |
+
4 => '700',
|
5712 |
),
|
5713 |
'Signika Negative' =>
|
5714 |
array(
|
5803 |
array(
|
5804 |
0 => 'regular',
|
5805 |
),
|
5806 |
+
'Sora' =>
|
5807 |
+
array(
|
5808 |
+
0 => '100',
|
5809 |
+
1 => '200',
|
5810 |
+
2 => '300',
|
5811 |
+
3 => 'regular',
|
5812 |
+
4 => '500',
|
5813 |
+
5 => '600',
|
5814 |
+
6 => '700',
|
5815 |
+
7 => '800',
|
5816 |
+
),
|
5817 |
'Sorts Mill Goudy' =>
|
5818 |
array(
|
5819 |
0 => 'regular',
|
5853 |
),
|
5854 |
'Source Serif Pro' =>
|
5855 |
array(
|
5856 |
+
0 => '200',
|
5857 |
+
1 => '200italic',
|
5858 |
+
2 => '300',
|
5859 |
+
3 => '300italic',
|
5860 |
+
4 => 'regular',
|
5861 |
+
5 => 'italic',
|
5862 |
+
6 => '600',
|
5863 |
+
7 => '600italic',
|
5864 |
+
8 => '700',
|
5865 |
+
9 => '700italic',
|
5866 |
+
10 => '900',
|
5867 |
+
11 => '900italic',
|
5868 |
+
),
|
5869 |
+
'Space Grotesk' =>
|
5870 |
+
array(
|
5871 |
+
0 => '300',
|
5872 |
+
1 => 'regular',
|
5873 |
+
2 => '500',
|
5874 |
+
3 => '600',
|
5875 |
+
4 => '700',
|
5876 |
),
|
5877 |
'Space Mono' =>
|
5878 |
array(
|
5977 |
0 => 'regular',
|
5978 |
1 => '700',
|
5979 |
),
|
5980 |
+
'Stick' =>
|
5981 |
+
array(
|
5982 |
+
0 => 'regular',
|
5983 |
+
),
|
5984 |
'Stint Ultra Condensed' =>
|
5985 |
array(
|
5986 |
0 => 'regular',
|
6061 |
0 => 'regular',
|
6062 |
1 => '700',
|
6063 |
),
|
6064 |
+
'Syne' =>
|
6065 |
+
array(
|
6066 |
+
0 => 'regular',
|
6067 |
+
1 => '500',
|
6068 |
+
2 => '600',
|
6069 |
+
3 => '700',
|
6070 |
+
4 => '800',
|
6071 |
+
),
|
6072 |
+
'Syne Mono' =>
|
6073 |
+
array(
|
6074 |
+
0 => 'regular',
|
6075 |
+
),
|
6076 |
+
'Syne Tactile' =>
|
6077 |
+
array(
|
6078 |
+
0 => 'regular',
|
6079 |
+
),
|
6080 |
'Tajawal' =>
|
6081 |
array(
|
6082 |
0 => '200',
|
6145 |
array(
|
6146 |
0 => 'regular',
|
6147 |
),
|
6148 |
+
'Texturina' =>
|
6149 |
+
array(
|
6150 |
+
0 => '100',
|
6151 |
+
1 => '200',
|
6152 |
+
2 => '300',
|
6153 |
+
3 => 'regular',
|
6154 |
+
4 => '500',
|
6155 |
+
5 => '600',
|
6156 |
+
6 => '700',
|
6157 |
+
7 => '800',
|
6158 |
+
8 => '900',
|
6159 |
+
9 => '100italic',
|
6160 |
+
10 => '200italic',
|
6161 |
+
11 => '300italic',
|
6162 |
+
12 => 'italic',
|
6163 |
+
13 => '500italic',
|
6164 |
+
14 => '600italic',
|
6165 |
+
15 => '700italic',
|
6166 |
+
16 => '800italic',
|
6167 |
+
17 => '900italic',
|
6168 |
+
),
|
6169 |
'Thasadith' =>
|
6170 |
array(
|
6171 |
0 => 'regular',
|
6245 |
array(
|
6246 |
0 => 'regular',
|
6247 |
),
|
6248 |
+
'Train One' =>
|
6249 |
+
array(
|
6250 |
+
0 => 'regular',
|
6251 |
+
),
|
6252 |
'Trirong' =>
|
6253 |
array(
|
6254 |
0 => '100',
|
6270 |
16 => '900',
|
6271 |
17 => '900italic',
|
6272 |
),
|
6273 |
+
'Trispace' =>
|
6274 |
+
array(
|
6275 |
+
0 => '100',
|
6276 |
+
1 => '200',
|
6277 |
+
2 => '300',
|
6278 |
+
3 => 'regular',
|
6279 |
+
4 => '500',
|
6280 |
+
5 => '600',
|
6281 |
+
6 => '700',
|
6282 |
+
7 => '800',
|
6283 |
+
),
|
6284 |
'Trocchi' =>
|
6285 |
array(
|
6286 |
0 => 'regular',
|
6291 |
1 => 'italic',
|
6292 |
2 => '700',
|
6293 |
),
|
6294 |
+
'Truculenta' =>
|
6295 |
+
array(
|
6296 |
+
0 => '100',
|
6297 |
+
1 => '200',
|
6298 |
+
2 => '300',
|
6299 |
+
3 => 'regular',
|
6300 |
+
4 => '500',
|
6301 |
+
5 => '600',
|
6302 |
+
6 => '700',
|
6303 |
+
7 => '800',
|
6304 |
+
8 => '900',
|
6305 |
+
),
|
6306 |
'Trykker' =>
|
6307 |
array(
|
6308 |
0 => 'regular',
|
6398 |
array(
|
6399 |
0 => 'regular',
|
6400 |
),
|
6401 |
+
'Varta' =>
|
6402 |
+
array(
|
6403 |
+
0 => '300',
|
6404 |
+
1 => 'regular',
|
6405 |
+
2 => '500',
|
6406 |
+
3 => '600',
|
6407 |
+
4 => '700',
|
6408 |
+
),
|
6409 |
'Vast Shadow' =>
|
6410 |
array(
|
6411 |
0 => 'regular',
|
6523 |
16 => '800italic',
|
6524 |
17 => '900italic',
|
6525 |
),
|
6526 |
+
'Xanh Mono' =>
|
6527 |
+
array(
|
6528 |
+
0 => 'regular',
|
6529 |
+
1 => 'italic',
|
6530 |
+
),
|
6531 |
'Yanone Kaffeesatz' =>
|
6532 |
array(
|
6533 |
0 => '200',
|
6574 |
3 => '600',
|
6575 |
4 => '700',
|
6576 |
),
|
6577 |
+
'Yusei Magic' =>
|
6578 |
+
array(
|
6579 |
+
0 => 'regular',
|
6580 |
+
),
|
6581 |
'ZCOOL KuaiLe' =>
|
6582 |
array(
|
6583 |
0 => 'regular',
|
base/inc/lessc.inc.php
CHANGED
@@ -23,7 +23,8 @@ class SiteOrigin_LessC {
|
|
23 |
private $formatterName;
|
24 |
private $options = array();
|
25 |
|
26 |
-
public function __construct( $lessc=null, $sourceName=null ) {
|
|
|
27 |
|
28 |
public function setImportDir( $dirs ) {
|
29 |
$this->importDir = (array)$dirs;
|
@@ -38,7 +39,8 @@ class SiteOrigin_LessC {
|
|
38 |
$this->formatterName = $name;
|
39 |
}
|
40 |
|
41 |
-
public function setPreserveComments( $preserve ) {
|
|
|
42 |
|
43 |
public function registerFunction( $name, $func ) {
|
44 |
$this->libFunctions[$name] = $func;
|
@@ -48,7 +50,7 @@ class SiteOrigin_LessC {
|
|
48 |
unset( $this->libFunctions[$name] );
|
49 |
}
|
50 |
|
51 |
-
public function setVariables( $variables ){
|
52 |
foreach ( $variables as $name => $value ) {
|
53 |
$this->setVariable( $name, $value );
|
54 |
}
|
@@ -64,7 +66,7 @@ class SiteOrigin_LessC {
|
|
64 |
|
65 |
public function setOptions( $options ) {
|
66 |
foreach ( $options as $name => $value ) {
|
67 |
-
$this->setOption( $name, $value);
|
68 |
}
|
69 |
}
|
70 |
|
@@ -73,7 +75,6 @@ class SiteOrigin_LessC {
|
|
73 |
}
|
74 |
|
75 |
public function parse( $buffer, $presets = array() ) {
|
76 |
-
|
77 |
$this->setVariables( $presets );
|
78 |
|
79 |
$parser = new Less_Parser( $this->getOptions() );
|
@@ -81,7 +82,7 @@ class SiteOrigin_LessC {
|
|
81 |
foreach ( $this->libFunctions as $name => $func ) {
|
82 |
$parser->registerFunction( $name, $func );
|
83 |
}
|
84 |
-
$parser->parse($buffer);
|
85 |
if ( count( $this->registeredVars ) ) {
|
86 |
$parser->ModifyVars( $this->registeredVars );
|
87 |
}
|
@@ -90,15 +91,14 @@ class SiteOrigin_LessC {
|
|
90 |
}
|
91 |
|
92 |
protected function getOptions() {
|
93 |
-
$options = array( 'relativeUrls'=>false );
|
94 |
-
switch( $this->formatterName ) {
|
95 |
case 'compressed':
|
96 |
$options['compress'] = true;
|
97 |
break;
|
98 |
}
|
99 |
-
if (is_array($this->options))
|
100 |
-
|
101 |
-
$options = array_merge($options, $this->options);
|
102 |
}
|
103 |
return $options;
|
104 |
}
|
@@ -113,7 +113,6 @@ class SiteOrigin_LessC {
|
|
113 |
}
|
114 |
|
115 |
public function compile( $string, $name = null ) {
|
116 |
-
|
117 |
$oldImport = $this->importDir;
|
118 |
$this->importDir = (array)$this->importDir;
|
119 |
|
@@ -182,13 +181,12 @@ class SiteOrigin_LessC {
|
|
182 |
|
183 |
public function checkedCompile( $in, $out ) {
|
184 |
if ( !is_file( $out ) || filemtime( $in ) > filemtime( $out ) ) {
|
185 |
-
$this->compileFile($in, $out);
|
186 |
return true;
|
187 |
}
|
188 |
return false;
|
189 |
}
|
190 |
|
191 |
-
|
192 |
/**
|
193 |
* Execute lessphp on a .less file or a lessphp cache structure
|
194 |
*
|
@@ -216,7 +214,7 @@ class SiteOrigin_LessC {
|
|
216 |
if ( is_string( $in ) ) {
|
217 |
$root = $in;
|
218 |
} elseif ( is_array( $in ) and isset( $in['root'] ) ) {
|
219 |
-
if ( $force or !
|
220 |
// If we are forcing a recompile or if for some reason the
|
221 |
// structure does not contain any file information we should
|
222 |
// specify the root to trigger a rebuild.
|
@@ -241,7 +239,7 @@ class SiteOrigin_LessC {
|
|
241 |
// If we have a root value which means we should rebuild.
|
242 |
$out = array();
|
243 |
$out['root'] = $root;
|
244 |
-
$out['compiled'] = $this->compileFile($root);
|
245 |
$out['files'] = $this->allParsedFiles();
|
246 |
$out['updated'] = time();
|
247 |
return $out;
|
@@ -263,7 +261,7 @@ class SiteOrigin_LessC {
|
|
263 |
if ( $less === null ) {
|
264 |
$less = new self;
|
265 |
}
|
266 |
-
return $less->cachedCompile($in, $force);
|
267 |
}
|
268 |
|
269 |
public function allParsedFiles() {
|
23 |
private $formatterName;
|
24 |
private $options = array();
|
25 |
|
26 |
+
public function __construct( $lessc = null, $sourceName = null ) {
|
27 |
+
}
|
28 |
|
29 |
public function setImportDir( $dirs ) {
|
30 |
$this->importDir = (array)$dirs;
|
39 |
$this->formatterName = $name;
|
40 |
}
|
41 |
|
42 |
+
public function setPreserveComments( $preserve ) {
|
43 |
+
}
|
44 |
|
45 |
public function registerFunction( $name, $func ) {
|
46 |
$this->libFunctions[$name] = $func;
|
50 |
unset( $this->libFunctions[$name] );
|
51 |
}
|
52 |
|
53 |
+
public function setVariables( $variables ) {
|
54 |
foreach ( $variables as $name => $value ) {
|
55 |
$this->setVariable( $name, $value );
|
56 |
}
|
66 |
|
67 |
public function setOptions( $options ) {
|
68 |
foreach ( $options as $name => $value ) {
|
69 |
+
$this->setOption( $name, $value );
|
70 |
}
|
71 |
}
|
72 |
|
75 |
}
|
76 |
|
77 |
public function parse( $buffer, $presets = array() ) {
|
|
|
78 |
$this->setVariables( $presets );
|
79 |
|
80 |
$parser = new Less_Parser( $this->getOptions() );
|
82 |
foreach ( $this->libFunctions as $name => $func ) {
|
83 |
$parser->registerFunction( $name, $func );
|
84 |
}
|
85 |
+
$parser->parse( $buffer );
|
86 |
if ( count( $this->registeredVars ) ) {
|
87 |
$parser->ModifyVars( $this->registeredVars );
|
88 |
}
|
91 |
}
|
92 |
|
93 |
protected function getOptions() {
|
94 |
+
$options = array( 'relativeUrls' => false );
|
95 |
+
switch ( $this->formatterName ) {
|
96 |
case 'compressed':
|
97 |
$options['compress'] = true;
|
98 |
break;
|
99 |
}
|
100 |
+
if ( is_array( $this->options ) ) {
|
101 |
+
$options = array_merge( $options, $this->options );
|
|
|
102 |
}
|
103 |
return $options;
|
104 |
}
|
113 |
}
|
114 |
|
115 |
public function compile( $string, $name = null ) {
|
|
|
116 |
$oldImport = $this->importDir;
|
117 |
$this->importDir = (array)$this->importDir;
|
118 |
|
181 |
|
182 |
public function checkedCompile( $in, $out ) {
|
183 |
if ( !is_file( $out ) || filemtime( $in ) > filemtime( $out ) ) {
|
184 |
+
$this->compileFile( $in, $out );
|
185 |
return true;
|
186 |
}
|
187 |
return false;
|
188 |
}
|
189 |
|
|
|
190 |
/**
|
191 |
* Execute lessphp on a .less file or a lessphp cache structure
|
192 |
*
|
214 |
if ( is_string( $in ) ) {
|
215 |
$root = $in;
|
216 |
} elseif ( is_array( $in ) and isset( $in['root'] ) ) {
|
217 |
+
if ( $force or !isset( $in['files'] ) ) {
|
218 |
// If we are forcing a recompile or if for some reason the
|
219 |
// structure does not contain any file information we should
|
220 |
// specify the root to trigger a rebuild.
|
239 |
// If we have a root value which means we should rebuild.
|
240 |
$out = array();
|
241 |
$out['root'] = $root;
|
242 |
+
$out['compiled'] = $this->compileFile( $root );
|
243 |
$out['files'] = $this->allParsedFiles();
|
244 |
$out['updated'] = time();
|
245 |
return $out;
|
261 |
if ( $less === null ) {
|
262 |
$less = new self;
|
263 |
}
|
264 |
+
return $less->cachedCompile( $in, $force );
|
265 |
}
|
266 |
|
267 |
public function allParsedFiles() {
|
base/inc/lib/Less/Autoloader.php
CHANGED
@@ -28,15 +28,15 @@ class Less_Autoloader {
|
|
28 |
* @return void
|
29 |
* @throws Exception If there was an error in registration
|
30 |
*/
|
31 |
-
public static function register(){
|
32 |
-
if( self::$registered ){
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
-
self::$libDir = dirname(__FILE__);
|
37 |
|
38 |
-
if(false === spl_autoload_register(array('Less_Autoloader', 'loadClass'))){
|
39 |
-
throw new Exception('Unable to register Less_Autoloader::loadClass as an autoloading method.');
|
40 |
}
|
41 |
|
42 |
self::$registered = true;
|
@@ -47,8 +47,8 @@ class Less_Autoloader {
|
|
47 |
*
|
48 |
* @return void
|
49 |
*/
|
50 |
-
public static function unregister(){
|
51 |
-
spl_autoload_unregister(array('Less_Autoloader', 'loadClass'));
|
52 |
self::$registered = false;
|
53 |
}
|
54 |
|
@@ -57,23 +57,21 @@ class Less_Autoloader {
|
|
57 |
*
|
58 |
* @param string $className The class to load
|
59 |
*/
|
60 |
-
public static function loadClass($className){
|
61 |
-
|
62 |
-
|
63 |
// handle only package classes
|
64 |
-
if(strpos($className, 'Less_') !== 0){
|
65 |
return;
|
66 |
}
|
67 |
|
68 |
-
$className = substr($className,5);
|
69 |
-
$fileName = self::$libDir . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
|
70 |
|
71 |
-
if(file_exists($fileName)){
|
72 |
require $fileName;
|
73 |
return true;
|
74 |
-
}else{
|
75 |
-
throw new Exception('file not loadable '.$fileName);
|
76 |
}
|
77 |
}
|
78 |
|
79 |
-
}
|
28 |
* @return void
|
29 |
* @throws Exception If there was an error in registration
|
30 |
*/
|
31 |
+
public static function register() {
|
32 |
+
if ( self::$registered ) {
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
+
self::$libDir = dirname( __FILE__ );
|
37 |
|
38 |
+
if ( false === spl_autoload_register( array( 'Less_Autoloader', 'loadClass' ) ) ) {
|
39 |
+
throw new Exception( 'Unable to register Less_Autoloader::loadClass as an autoloading method.' );
|
40 |
}
|
41 |
|
42 |
self::$registered = true;
|
47 |
*
|
48 |
* @return void
|
49 |
*/
|
50 |
+
public static function unregister() {
|
51 |
+
spl_autoload_unregister( array( 'Less_Autoloader', 'loadClass' ) );
|
52 |
self::$registered = false;
|
53 |
}
|
54 |
|
57 |
*
|
58 |
* @param string $className The class to load
|
59 |
*/
|
60 |
+
public static function loadClass( $className ) {
|
|
|
|
|
61 |
// handle only package classes
|
62 |
+
if ( strpos( $className, 'Less_' ) !== 0 ) {
|
63 |
return;
|
64 |
}
|
65 |
|
66 |
+
$className = substr( $className, 5 );
|
67 |
+
$fileName = self::$libDir . DIRECTORY_SEPARATOR . str_replace( '_', DIRECTORY_SEPARATOR, $className ) . '.php';
|
68 |
|
69 |
+
if ( file_exists( $fileName ) ) {
|
70 |
require $fileName;
|
71 |
return true;
|
72 |
+
} else {
|
73 |
+
throw new Exception( 'file not loadable '.$fileName );
|
74 |
}
|
75 |
}
|
76 |
|
77 |
+
}
|
base/inc/lib/Less/Cache.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
require_once
|
4 |
|
5 |
/**
|
6 |
* Utility for handling the generation and caching of css files
|
@@ -9,7 +9,7 @@ require_once( dirname(__FILE__).'/Version.php');
|
|
9 |
* @subpackage cache
|
10 |
*
|
11 |
*/
|
12 |
-
class Less_Cache{
|
13 |
|
14 |
// directory less.php can use for storing data
|
15 |
public static $cache_dir = false;
|
@@ -23,7 +23,6 @@ class Less_Cache{
|
|
23 |
// specifies the number of seconds after which data created by less.php will be seen as 'garbage' and potentially cleaned up
|
24 |
public static $gc_lifetime = 604800;
|
25 |
|
26 |
-
|
27 |
/**
|
28 |
* Save and reuse the results of compiled less files.
|
29 |
* The first call to Get() will generate css and save it.
|
@@ -34,99 +33,92 @@ class Less_Cache{
|
|
34 |
* @param array $modify_vars Array of variables
|
35 |
* @return string Name of the css file
|
36 |
*/
|
37 |
-
public static function Get( $less_files, $parser_options = array(), $modify_vars = array() ){
|
38 |
-
|
39 |
-
|
40 |
-
//check $cache_dir
|
41 |
-
if( isset($parser_options['cache_dir']) ){
|
42 |
Less_Cache::$cache_dir = $parser_options['cache_dir'];
|
43 |
}
|
44 |
|
45 |
-
if( empty(Less_Cache::$cache_dir) ){
|
46 |
-
throw new Exception('cache_dir not set');
|
47 |
}
|
48 |
|
49 |
-
if( isset($parser_options['prefix']) ){
|
50 |
Less_Cache::$prefix = $parser_options['prefix'];
|
51 |
}
|
52 |
|
53 |
-
if( empty(Less_Cache::$prefix) ){
|
54 |
-
throw new Exception('prefix not set');
|
55 |
}
|
56 |
|
57 |
-
if( isset($parser_options['prefix_vars']) ){
|
58 |
Less_Cache::$prefix_vars = $parser_options['prefix_vars'];
|
59 |
}
|
60 |
|
61 |
-
if( empty(Less_Cache::$prefix_vars) ){
|
62 |
-
throw new Exception('prefix_vars not set');
|
63 |
}
|
64 |
|
65 |
self::CheckCacheDir();
|
66 |
$less_files = (array)$less_files;
|
67 |
|
|
|
|
|
|
|
|
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
$lessvars = Less_Parser::serializeVars($modify_vars);
|
72 |
-
$vars_file = Less_Cache::$cache_dir . Less_Cache::$prefix_vars . sha1($lessvars) . '.less';
|
73 |
-
|
74 |
-
if( !file_exists($vars_file) ){
|
75 |
-
file_put_contents($vars_file, $lessvars);
|
76 |
}
|
77 |
|
78 |
-
$less_files += array($vars_file => '/');
|
79 |
}
|
80 |
|
81 |
-
|
82 |
// generate name for compiled css file
|
83 |
-
$hash = md5(json_encode($less_files));
|
84 |
-
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
if( file_exists($list_file) ){
|
89 |
|
90 |
-
self::ListFiles($list_file, $list, $cached_name);
|
91 |
-
$compiled_name = self::CompiledName($list, $hash);
|
92 |
|
93 |
// if $cached_name is the same as the $compiled name, don't regenerate
|
94 |
-
if( !$cached_name || $cached_name === $compiled_name ){
|
95 |
|
96 |
-
$output_file = self::OutputFile($compiled_name, $parser_options );
|
97 |
|
98 |
-
if( $output_file && file_exists($output_file) ){
|
99 |
-
@touch($list_file);
|
100 |
-
return basename($output_file); // for backwards compatibility, we just return the name of the file
|
101 |
}
|
102 |
}
|
103 |
}
|
104 |
}
|
105 |
|
106 |
$compiled = self::Cache( $less_files, $parser_options );
|
107 |
-
if( !$compiled ){
|
108 |
return false;
|
109 |
}
|
110 |
|
111 |
$compiled_name = self::CompiledName( $less_files, $hash );
|
112 |
-
$output_file = self::OutputFile($compiled_name, $parser_options );
|
113 |
-
|
114 |
|
115 |
-
//save the file list
|
116 |
$list = $less_files;
|
117 |
$list[] = $compiled_name;
|
118 |
-
$cache = implode("\n"
|
119 |
file_put_contents( $list_file, $cache );
|
120 |
|
121 |
-
|
122 |
-
//save the css
|
123 |
file_put_contents( $output_file, $compiled );
|
124 |
|
125 |
-
|
126 |
-
//clean up
|
127 |
self::CleanCache();
|
128 |
|
129 |
-
return basename($output_file);
|
130 |
}
|
131 |
|
132 |
/**
|
@@ -137,29 +129,26 @@ class Less_Cache{
|
|
137 |
* @param array $modify_vars Array of variables
|
138 |
* @return string Name of the css file
|
139 |
*/
|
140 |
-
public static function Regen( $less_files, $parser_options = array(), $modify_vars = array() ){
|
141 |
$parser_options['use_cache'] = false;
|
142 |
return self::Get( $less_files, $parser_options, $modify_vars );
|
143 |
}
|
144 |
|
145 |
-
public static function Cache( &$less_files, $parser_options = array() ){
|
146 |
-
|
147 |
-
|
148 |
// get less.php if it exists
|
149 |
-
$file = dirname(__FILE__) . '/Less.php';
|
150 |
-
if( file_exists($file) && !class_exists('Less_Parser') ){
|
151 |
-
require_once
|
152 |
}
|
153 |
|
154 |
$parser_options['cache_dir'] = Less_Cache::$cache_dir;
|
155 |
-
$parser = new Less_Parser($parser_options);
|
156 |
-
|
157 |
|
158 |
// combine files
|
159 |
-
foreach($less_files as $file_path => $uri_or_less ){
|
160 |
|
161 |
-
//treat as less markup if there are newline characters
|
162 |
-
if( strpos($uri_or_less,"\n") !== false ){
|
163 |
$parser->Parse( $uri_or_less );
|
164 |
continue;
|
165 |
}
|
@@ -169,20 +158,17 @@ class Less_Cache{
|
|
169 |
|
170 |
$compiled = $parser->getCss();
|
171 |
|
172 |
-
|
173 |
$less_files = $parser->allParsedFiles();
|
174 |
|
175 |
return $compiled;
|
176 |
}
|
177 |
|
|
|
|
|
|
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
//custom output file
|
182 |
-
if( !empty($parser_options['output']) ){
|
183 |
-
|
184 |
-
//relative to cache directory?
|
185 |
-
if( preg_match('#[\\\\/]#',$parser_options['output']) ){
|
186 |
return $parser_options['output'];
|
187 |
}
|
188 |
|
@@ -192,54 +178,48 @@ class Less_Cache{
|
|
192 |
return Less_Cache::$cache_dir.$compiled_name;
|
193 |
}
|
194 |
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
foreach($files as $file){
|
201 |
-
$temp[] = filemtime($file)."\t".filesize($file)."\t".$file;
|
202 |
}
|
203 |
|
204 |
-
return Less_Cache::$prefix.sha1(json_encode($temp).$extrahash).'.css';
|
205 |
}
|
206 |
|
207 |
-
|
208 |
-
public static function SetCacheDir( $dir ){
|
209 |
Less_Cache::$cache_dir = $dir;
|
210 |
self::CheckCacheDir();
|
211 |
}
|
212 |
|
213 |
-
public static function CheckCacheDir(){
|
|
|
|
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
if( !file_exists(Less_Cache::$cache_dir) ){
|
219 |
-
if( !mkdir(Less_Cache::$cache_dir) ){
|
220 |
-
throw new Less_Exception_Parser('Less.php cache directory couldn\'t be created: '.Less_Cache::$cache_dir);
|
221 |
}
|
222 |
|
223 |
-
}elseif( !is_dir(Less_Cache::$cache_dir) ){
|
224 |
-
throw new Less_Exception_Parser('Less.php cache directory doesn\'t exist: '.Less_Cache::$cache_dir);
|
225 |
|
226 |
-
}elseif( !is_writable(Less_Cache::$cache_dir) ){
|
227 |
-
throw new Less_Exception_Parser('Less.php cache directory isn\'t writable: '.Less_Cache::$cache_dir);
|
228 |
|
229 |
}
|
230 |
|
231 |
}
|
232 |
|
233 |
-
|
234 |
/**
|
235 |
* Delete unused less.php files
|
236 |
*
|
237 |
*/
|
238 |
-
public static function CleanCache(){
|
239 |
static $clean = false;
|
240 |
|
241 |
-
|
242 |
-
if( $clean || empty(Less_Cache::$cache_dir) ){
|
243 |
return;
|
244 |
}
|
245 |
|
@@ -247,69 +227,63 @@ class Less_Cache{
|
|
247 |
|
248 |
// only remove files with extensions created by less.php
|
249 |
// css files removed based on the list files
|
250 |
-
$remove_types = array('lesscache'=>1,'list'=>1,'less'=>1,'map'=>1);
|
251 |
|
252 |
-
$files = scandir(Less_Cache::$cache_dir);
|
253 |
-
if( !$files ){
|
254 |
return;
|
255 |
}
|
256 |
|
257 |
$check_time = time() - self::$gc_lifetime;
|
258 |
-
foreach($files as $file){
|
259 |
-
|
260 |
|
261 |
// don't delete if the file wasn't created with less.php
|
262 |
-
if( strpos($file,Less_Cache::$prefix) !== 0 ){
|
263 |
continue;
|
264 |
}
|
265 |
|
266 |
-
$parts = explode('.'
|
267 |
-
$type = array_pop($parts);
|
268 |
-
|
269 |
|
270 |
-
if( !isset($remove_types[$type]) ){
|
271 |
continue;
|
272 |
}
|
273 |
|
274 |
$full_path = Less_Cache::$cache_dir . $file;
|
275 |
-
$mtime = filemtime($full_path);
|
276 |
|
277 |
// don't delete if it's a relatively new file
|
278 |
-
if( $mtime > $check_time ){
|
279 |
continue;
|
280 |
}
|
281 |
|
282 |
-
|
283 |
// delete the list file and associated css file
|
284 |
-
if( $type === 'list' ){
|
285 |
-
self::ListFiles($full_path, $list, $css_file_name);
|
286 |
-
if( $css_file_name ){
|
287 |
$css_file = Less_Cache::$cache_dir . $css_file_name;
|
288 |
-
if( file_exists($css_file) ){
|
289 |
-
unlink($css_file);
|
290 |
}
|
291 |
}
|
292 |
}
|
293 |
|
294 |
-
unlink($full_path);
|
295 |
}
|
296 |
|
297 |
-
|
298 |
}
|
299 |
|
300 |
-
|
301 |
/**
|
302 |
* Get the list of less files and generated css file from a list file
|
303 |
*
|
304 |
*/
|
305 |
-
static function ListFiles($list_file, &$list, &$css_file_name ){
|
306 |
-
|
307 |
-
$list = explode("\n",file_get_contents($list_file));
|
308 |
|
309 |
-
//pop the cached name that should match $compiled_name
|
310 |
-
$css_file_name = array_pop($list);
|
311 |
|
312 |
-
if( !preg_match('/^' . Less_Cache::$prefix . '[a-f0-9]+\.css$/'
|
313 |
$list[] = $css_file_name;
|
314 |
$css_file_name = false;
|
315 |
}
|
1 |
<?php
|
2 |
|
3 |
+
require_once dirname( __FILE__ ).'/Version.php';
|
4 |
|
5 |
/**
|
6 |
* Utility for handling the generation and caching of css files
|
9 |
* @subpackage cache
|
10 |
*
|
11 |
*/
|
12 |
+
class Less_Cache {
|
13 |
|
14 |
// directory less.php can use for storing data
|
15 |
public static $cache_dir = false;
|
23 |
// specifies the number of seconds after which data created by less.php will be seen as 'garbage' and potentially cleaned up
|
24 |
public static $gc_lifetime = 604800;
|
25 |
|
|
|
26 |
/**
|
27 |
* Save and reuse the results of compiled less files.
|
28 |
* The first call to Get() will generate css and save it.
|
33 |
* @param array $modify_vars Array of variables
|
34 |
* @return string Name of the css file
|
35 |
*/
|
36 |
+
public static function Get( $less_files, $parser_options = array(), $modify_vars = array() ) {
|
37 |
+
// check $cache_dir
|
38 |
+
if ( isset( $parser_options['cache_dir'] ) ) {
|
|
|
|
|
39 |
Less_Cache::$cache_dir = $parser_options['cache_dir'];
|
40 |
}
|
41 |
|
42 |
+
if ( empty( Less_Cache::$cache_dir ) ) {
|
43 |
+
throw new Exception( 'cache_dir not set' );
|
44 |
}
|
45 |
|
46 |
+
if ( isset( $parser_options['prefix'] ) ) {
|
47 |
Less_Cache::$prefix = $parser_options['prefix'];
|
48 |
}
|
49 |
|
50 |
+
if ( empty( Less_Cache::$prefix ) ) {
|
51 |
+
throw new Exception( 'prefix not set' );
|
52 |
}
|
53 |
|
54 |
+
if ( isset( $parser_options['prefix_vars'] ) ) {
|
55 |
Less_Cache::$prefix_vars = $parser_options['prefix_vars'];
|
56 |
}
|
57 |
|
58 |
+
if ( empty( Less_Cache::$prefix_vars ) ) {
|
59 |
+
throw new Exception( 'prefix_vars not set' );
|
60 |
}
|
61 |
|
62 |
self::CheckCacheDir();
|
63 |
$less_files = (array)$less_files;
|
64 |
|
65 |
+
// create a file for variables
|
66 |
+
if ( !empty( $modify_vars ) ) {
|
67 |
+
$lessvars = Less_Parser::serializeVars( $modify_vars );
|
68 |
+
$vars_file = Less_Cache::$cache_dir . Less_Cache::$prefix_vars . sha1( $lessvars ) . '.less';
|
69 |
|
70 |
+
if ( !file_exists( $vars_file ) ) {
|
71 |
+
file_put_contents( $vars_file, $lessvars );
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
+
$less_files += array( $vars_file => '/' );
|
75 |
}
|
76 |
|
|
|
77 |
// generate name for compiled css file
|
78 |
+
$hash = md5( json_encode( $less_files ) );
|
79 |
+
$list_file = Less_Cache::$cache_dir . Less_Cache::$prefix . $hash . '.list';
|
80 |
|
81 |
+
// check cached content
|
82 |
+
if ( !isset( $parser_options['use_cache'] ) || $parser_options['use_cache'] === true ) {
|
83 |
+
if ( file_exists( $list_file ) ) {
|
84 |
|
85 |
+
self::ListFiles( $list_file, $list, $cached_name );
|
86 |
+
$compiled_name = self::CompiledName( $list, $hash );
|
87 |
|
88 |
// if $cached_name is the same as the $compiled name, don't regenerate
|
89 |
+
if ( !$cached_name || $cached_name === $compiled_name ) {
|
90 |
|
91 |
+
$output_file = self::OutputFile( $compiled_name, $parser_options );
|
92 |
|
93 |
+
if ( $output_file && file_exists( $output_file ) ) {
|
94 |
+
@touch( $list_file );
|
95 |
+
return basename( $output_file ); // for backwards compatibility, we just return the name of the file
|
96 |
}
|
97 |
}
|
98 |
}
|
99 |
}
|
100 |
|
101 |
$compiled = self::Cache( $less_files, $parser_options );
|
102 |
+
if ( !$compiled ) {
|
103 |
return false;
|
104 |
}
|
105 |
|
106 |
$compiled_name = self::CompiledName( $less_files, $hash );
|
107 |
+
$output_file = self::OutputFile( $compiled_name, $parser_options );
|
|
|
108 |
|
109 |
+
// save the file list
|
110 |
$list = $less_files;
|
111 |
$list[] = $compiled_name;
|
112 |
+
$cache = implode( "\n", $list );
|
113 |
file_put_contents( $list_file, $cache );
|
114 |
|
115 |
+
// save the css
|
|
|
116 |
file_put_contents( $output_file, $compiled );
|
117 |
|
118 |
+
// clean up
|
|
|
119 |
self::CleanCache();
|
120 |
|
121 |
+
return basename( $output_file );
|
122 |
}
|
123 |
|
124 |
/**
|
129 |
* @param array $modify_vars Array of variables
|
130 |
* @return string Name of the css file
|
131 |
*/
|
132 |
+
public static function Regen( $less_files, $parser_options = array(), $modify_vars = array() ) {
|
133 |
$parser_options['use_cache'] = false;
|
134 |
return self::Get( $less_files, $parser_options, $modify_vars );
|
135 |
}
|
136 |
|
137 |
+
public static function Cache( &$less_files, $parser_options = array() ) {
|
|
|
|
|
138 |
// get less.php if it exists
|
139 |
+
$file = dirname( __FILE__ ) . '/Less.php';
|
140 |
+
if ( file_exists( $file ) && !class_exists( 'Less_Parser' ) ) {
|
141 |
+
require_once $file;
|
142 |
}
|
143 |
|
144 |
$parser_options['cache_dir'] = Less_Cache::$cache_dir;
|
145 |
+
$parser = new Less_Parser( $parser_options );
|
|
|
146 |
|
147 |
// combine files
|
148 |
+
foreach ( $less_files as $file_path => $uri_or_less ) {
|
149 |
|
150 |
+
// treat as less markup if there are newline characters
|
151 |
+
if ( strpos( $uri_or_less, "\n" ) !== false ) {
|
152 |
$parser->Parse( $uri_or_less );
|
153 |
continue;
|
154 |
}
|
158 |
|
159 |
$compiled = $parser->getCss();
|
160 |
|
|
|
161 |
$less_files = $parser->allParsedFiles();
|
162 |
|
163 |
return $compiled;
|
164 |
}
|
165 |
|
166 |
+
private static function OutputFile( $compiled_name, $parser_options ) {
|
167 |
+
// custom output file
|
168 |
+
if ( !empty( $parser_options['output'] ) ) {
|
169 |
|
170 |
+
// relative to cache directory?
|
171 |
+
if ( preg_match( '#[\\\\/]#', $parser_options['output'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
172 |
return $parser_options['output'];
|
173 |
}
|
174 |
|
178 |
return Less_Cache::$cache_dir.$compiled_name;
|
179 |
}
|
180 |
|
181 |
+
private static function CompiledName( $files, $extrahash ) {
|
182 |
+
// save the file list
|
183 |
+
$temp = array( Less_Version::cache_version );
|
184 |
+
foreach ( $files as $file ) {
|
185 |
+
$temp[] = filemtime( $file )."\t".filesize( $file )."\t".$file;
|
|
|
|
|
186 |
}
|
187 |
|
188 |
+
return Less_Cache::$prefix.sha1( json_encode( $temp ).$extrahash ).'.css';
|
189 |
}
|
190 |
|
191 |
+
public static function SetCacheDir( $dir ) {
|
|
|
192 |
Less_Cache::$cache_dir = $dir;
|
193 |
self::CheckCacheDir();
|
194 |
}
|
195 |
|
196 |
+
public static function CheckCacheDir() {
|
197 |
+
Less_Cache::$cache_dir = str_replace( '\\', '/', Less_Cache::$cache_dir );
|
198 |
+
Less_Cache::$cache_dir = rtrim( Less_Cache::$cache_dir, '/' ).'/';
|
199 |
|
200 |
+
if ( !file_exists( Less_Cache::$cache_dir ) ) {
|
201 |
+
if ( !mkdir( Less_Cache::$cache_dir ) ) {
|
202 |
+
throw new Less_Exception_Parser( 'Less.php cache directory couldn\'t be created: '.Less_Cache::$cache_dir );
|
|
|
|
|
|
|
203 |
}
|
204 |
|
205 |
+
} elseif ( !is_dir( Less_Cache::$cache_dir ) ) {
|
206 |
+
throw new Less_Exception_Parser( 'Less.php cache directory doesn\'t exist: '.Less_Cache::$cache_dir );
|
207 |
|
208 |
+
} elseif ( !is_writable( Less_Cache::$cache_dir ) ) {
|
209 |
+
throw new Less_Exception_Parser( 'Less.php cache directory isn\'t writable: '.Less_Cache::$cache_dir );
|
210 |
|
211 |
}
|
212 |
|
213 |
}
|
214 |
|
|
|
215 |
/**
|
216 |
* Delete unused less.php files
|
217 |
*
|
218 |
*/
|
219 |
+
public static function CleanCache() {
|
220 |
static $clean = false;
|
221 |
|
222 |
+
if ( $clean || empty( Less_Cache::$cache_dir ) ) {
|
|
|
223 |
return;
|
224 |
}
|
225 |
|
227 |
|
228 |
// only remove files with extensions created by less.php
|
229 |
// css files removed based on the list files
|
230 |
+
$remove_types = array( 'lesscache' => 1,'list' => 1,'less' => 1,'map' => 1 );
|
231 |
|
232 |
+
$files = scandir( Less_Cache::$cache_dir );
|
233 |
+
if ( !$files ) {
|
234 |
return;
|
235 |
}
|
236 |
|
237 |
$check_time = time() - self::$gc_lifetime;
|
238 |
+
foreach ( $files as $file ) {
|
|
|
239 |
|
240 |
// don't delete if the file wasn't created with less.php
|
241 |
+
if ( strpos( $file, Less_Cache::$prefix ) !== 0 ) {
|
242 |
continue;
|
243 |
}
|
244 |
|
245 |
+
$parts = explode( '.', $file );
|
246 |
+
$type = array_pop( $parts );
|
|
|
247 |
|
248 |
+
if ( !isset( $remove_types[$type] ) ) {
|
249 |
continue;
|
250 |
}
|
251 |
|
252 |
$full_path = Less_Cache::$cache_dir . $file;
|
253 |
+
$mtime = filemtime( $full_path );
|
254 |
|
255 |
// don't delete if it's a relatively new file
|
256 |
+
if ( $mtime > $check_time ) {
|
257 |
continue;
|
258 |
}
|
259 |
|
|
|
260 |
// delete the list file and associated css file
|
261 |
+
if ( $type === 'list' ) {
|
262 |
+
self::ListFiles( $full_path, $list, $css_file_name );
|
263 |
+
if ( $css_file_name ) {
|
264 |
$css_file = Less_Cache::$cache_dir . $css_file_name;
|
265 |
+
if ( file_exists( $css_file ) ) {
|
266 |
+
unlink( $css_file );
|
267 |
}
|
268 |
}
|
269 |
}
|
270 |
|
271 |
+
unlink( $full_path );
|
272 |
}
|
273 |
|
|
|
274 |
}
|
275 |
|
|
|
276 |
/**
|
277 |
* Get the list of less files and generated css file from a list file
|
278 |
*
|
279 |
*/
|
280 |
+
static function ListFiles( $list_file, &$list, &$css_file_name ) {
|
281 |
+
$list = explode( "\n", file_get_contents( $list_file ) );
|
|
|
282 |
|
283 |
+
// pop the cached name that should match $compiled_name
|
284 |
+
$css_file_name = array_pop( $list );
|
285 |
|
286 |
+
if ( !preg_match( '/^' . Less_Cache::$prefix . '[a-f0-9]+\.css$/', $css_file_name ) ) {
|
287 |
$list[] = $css_file_name;
|
288 |
$css_file_name = false;
|
289 |
}
|
base/inc/lib/Less/Colors.php
CHANGED
@@ -9,161 +9,160 @@
|
|
9 |
class Less_Colors {
|
10 |
|
11 |
public static $colors = array(
|
12 |
-
'aliceblue'=>'#f0f8ff',
|
13 |
-
'antiquewhite'=>'#faebd7',
|
14 |
-
'aqua'=>'#00ffff',
|
15 |
-
'aquamarine'=>'#7fffd4',
|
16 |
-
'azure'=>'#f0ffff',
|
17 |
-
'beige'=>'#f5f5dc',
|
18 |
-
'bisque'=>'#ffe4c4',
|
19 |
-
'black'=>'#000000',
|
20 |
-
'blanchedalmond'=>'#ffebcd',
|
21 |
-
'blue'=>'#0000ff',
|
22 |
-
'blueviolet'=>'#8a2be2',
|
23 |
-
'brown'=>'#a52a2a',
|
24 |
-
'burlywood'=>'#deb887',
|
25 |
-
'cadetblue'=>'#5f9ea0',
|
26 |
-
'chartreuse'=>'#7fff00',
|
27 |
-
'chocolate'=>'#d2691e',
|
28 |
-
'coral'=>'#ff7f50',
|
29 |
-
'cornflowerblue'=>'#6495ed',
|
30 |
-
'cornsilk'=>'#fff8dc',
|
31 |
-
'crimson'=>'#dc143c',
|
32 |
-
'cyan'=>'#00ffff',
|
33 |
-
'darkblue'=>'#00008b',
|
34 |
-
'darkcyan'=>'#008b8b',
|
35 |
-
'darkgoldenrod'=>'#b8860b',
|
36 |
-
'darkgray'=>'#a9a9a9',
|
37 |
-
'darkgrey'=>'#a9a9a9',
|
38 |
-
'darkgreen'=>'#006400',
|
39 |
-
'darkkhaki'=>'#bdb76b',
|
40 |
-
'darkmagenta'=>'#8b008b',
|
41 |
-
'darkolivegreen'=>'#556b2f',
|
42 |
-
'darkorange'=>'#ff8c00',
|
43 |
-
'darkorchid'=>'#9932cc',
|
44 |
-
'darkred'=>'#8b0000',
|
45 |
-
'darksalmon'=>'#e9967a',
|
46 |
-
'darkseagreen'=>'#8fbc8f',
|
47 |
-
'darkslateblue'=>'#483d8b',
|
48 |
-
'darkslategray'=>'#2f4f4f',
|
49 |
-
'darkslategrey'=>'#2f4f4f',
|
50 |
-
'darkturquoise'=>'#00ced1',
|
51 |
-
'darkviolet'=>'#9400d3',
|
52 |
-
'deeppink'=>'#ff1493',
|
53 |
-
'deepskyblue'=>'#00bfff',
|
54 |
-
'dimgray'=>'#696969',
|
55 |
-
'dimgrey'=>'#696969',
|
56 |
-
'dodgerblue'=>'#1e90ff',
|
57 |
-
'firebrick'=>'#b22222',
|
58 |
-
'floralwhite'=>'#fffaf0',
|
59 |
-
'forestgreen'=>'#228b22',
|
60 |
-
'fuchsia'=>'#ff00ff',
|
61 |
-
'gainsboro'=>'#dcdcdc',
|
62 |
-
'ghostwhite'=>'#f8f8ff',
|
63 |
-
'gold'=>'#ffd700',
|
64 |
-
'goldenrod'=>'#daa520',
|
65 |
-
'gray'=>'#808080',
|
66 |
-
'grey'=>'#808080',
|
67 |
-
'green'=>'#008000',
|
68 |
-
'greenyellow'=>'#adff2f',
|
69 |
-
'honeydew'=>'#f0fff0',
|
70 |
-
'hotpink'=>'#ff69b4',
|
71 |
-
'indianred'=>'#cd5c5c',
|
72 |
-
'indigo'=>'#4b0082',
|
73 |
-
'ivory'=>'#fffff0',
|
74 |
-
'khaki'=>'#f0e68c',
|
75 |
-
'lavender'=>'#e6e6fa',
|
76 |
-
'lavenderblush'=>'#fff0f5',
|
77 |
-
'lawngreen'=>'#7cfc00',
|
78 |
-
'lemonchiffon'=>'#fffacd',
|
79 |
-
'lightblue'=>'#add8e6',
|
80 |
-
'lightcoral'=>'#f08080',
|
81 |
-
'lightcyan'=>'#e0ffff',
|
82 |
-
'lightgoldenrodyellow'=>'#fafad2',
|
83 |
-
'lightgray'=>'#d3d3d3',
|
84 |
-
'lightgrey'=>'#d3d3d3',
|
85 |
-
'lightgreen'=>'#90ee90',
|
86 |
-
'lightpink'=>'#ffb6c1',
|
87 |
-
'lightsalmon'=>'#ffa07a',
|
88 |
-
'lightseagreen'=>'#20b2aa',
|
89 |
-
'lightskyblue'=>'#87cefa',
|
90 |
-
'lightslategray'=>'#778899',
|
91 |
-
'lightslategrey'=>'#778899',
|
92 |
-
'lightsteelblue'=>'#b0c4de',
|
93 |
-
'lightyellow'=>'#ffffe0',
|
94 |
-
'lime'=>'#00ff00',
|
95 |
-
'limegreen'=>'#32cd32',
|
96 |
-
'linen'=>'#faf0e6',
|
97 |
-
'magenta'=>'#ff00ff',
|
98 |
-
'maroon'=>'#800000',
|
99 |
-
'mediumaquamarine'=>'#66cdaa',
|
100 |
-
'mediumblue'=>'#0000cd',
|
101 |
-
'mediumorchid'=>'#ba55d3',
|
102 |
-
'mediumpurple'=>'#9370d8',
|
103 |
-
'mediumseagreen'=>'#3cb371',
|
104 |
-
'mediumslateblue'=>'#7b68ee',
|
105 |
-
'mediumspringgreen'=>'#00fa9a',
|
106 |
-
'mediumturquoise'=>'#48d1cc',
|
107 |
-
'mediumvioletred'=>'#c71585',
|
108 |
-
'midnightblue'=>'#191970',
|
109 |
-
'mintcream'=>'#f5fffa',
|
110 |
-
'mistyrose'=>'#ffe4e1',
|
111 |
-
'moccasin'=>'#ffe4b5',
|
112 |
-
'navajowhite'=>'#ffdead',
|
113 |
-
'navy'=>'#000080',
|
114 |
-
'oldlace'=>'#fdf5e6',
|
115 |
-
'olive'=>'#808000',
|
116 |
-
'olivedrab'=>'#6b8e23',
|
117 |
-
'orange'=>'#ffa500',
|
118 |
-
'orangered'=>'#ff4500',
|
119 |
-
'orchid'=>'#da70d6',
|
120 |
-
'palegoldenrod'=>'#eee8aa',
|
121 |
-
'palegreen'=>'#98fb98',
|
122 |
-
'paleturquoise'=>'#afeeee',
|
123 |
-
'palevioletred'=>'#d87093',
|
124 |
-
'papayawhip'=>'#ffefd5',
|
125 |
-
'peachpuff'=>'#ffdab9',
|
126 |
-
'peru'=>'#cd853f',
|
127 |
-
'pink'=>'#ffc0cb',
|
128 |
-
'plum'=>'#dda0dd',
|
129 |
-
'powderblue'=>'#b0e0e6',
|
130 |
-
'purple'=>'#800080',
|
131 |
-
'red'=>'#ff0000',
|
132 |
-
'rosybrown'=>'#bc8f8f',
|
133 |
-
'royalblue'=>'#4169e1',
|
134 |
-
'saddlebrown'=>'#8b4513',
|
135 |
-
'salmon'=>'#fa8072',
|
136 |
-
'sandybrown'=>'#f4a460',
|
137 |
-
'seagreen'=>'#2e8b57',
|
138 |
-
'seashell'=>'#fff5ee',
|
139 |
-
'sienna'=>'#a0522d',
|
140 |
-
'silver'=>'#c0c0c0',
|
141 |
-
'skyblue'=>'#87ceeb',
|
142 |
-
'slateblue'=>'#6a5acd',
|
143 |
-
'slategray'=>'#708090',
|
144 |
-
'slategrey'=>'#708090',
|
145 |
-
'snow'=>'#fffafa',
|
146 |
-
'springgreen'=>'#00ff7f',
|
147 |
-
'steelblue'=>'#4682b4',
|
148 |
-
'tan'=>'#d2b48c',
|
149 |
-
'teal'=>'#008080',
|
150 |
-
'thistle'=>'#d8bfd8',
|
151 |
-
'tomato'=>'#ff6347',
|
152 |
-
'turquoise'=>'#40e0d0',
|
153 |
-
'violet'=>'#ee82ee',
|
154 |
-
'wheat'=>'#f5deb3',
|
155 |
-
'white'=>'#ffffff',
|
156 |
-
'whitesmoke'=>'#f5f5f5',
|
157 |
-
'yellow'=>'#ffff00',
|
158 |
-
'yellowgreen'=>'#9acd32'
|
159 |
);
|
160 |
|
161 |
-
public static function hasOwnProperty($color) {
|
162 |
-
return isset(self::$colors[$color]);
|
163 |
}
|
164 |
|
165 |
-
|
166 |
-
public static function color($color) {
|
167 |
return self::$colors[$color];
|
168 |
}
|
169 |
|
9 |
class Less_Colors {
|
10 |
|
11 |
public static $colors = array(
|
12 |
+
'aliceblue' => '#f0f8ff',
|
13 |
+
'antiquewhite' => '#faebd7',
|
14 |
+
'aqua' => '#00ffff',
|
15 |
+
'aquamarine' => '#7fffd4',
|
16 |
+
'azure' => '#f0ffff',
|
17 |
+
'beige' => '#f5f5dc',
|
18 |
+
'bisque' => '#ffe4c4',
|
19 |
+
'black' => '#000000',
|
20 |
+
'blanchedalmond' => '#ffebcd',
|
21 |
+
'blue' => '#0000ff',
|
22 |
+
'blueviolet' => '#8a2be2',
|
23 |
+
'brown' => '#a52a2a',
|
24 |
+
'burlywood' => '#deb887',
|
25 |
+
'cadetblue' => '#5f9ea0',
|
26 |
+
'chartreuse' => '#7fff00',
|
27 |
+
'chocolate' => '#d2691e',
|
28 |
+
'coral' => '#ff7f50',
|
29 |
+
'cornflowerblue' => '#6495ed',
|
30 |
+
'cornsilk' => '#fff8dc',
|
31 |
+
'crimson' => '#dc143c',
|
32 |
+
'cyan' => '#00ffff',
|
33 |
+
'darkblue' => '#00008b',
|
34 |
+
'darkcyan' => '#008b8b',
|
35 |
+
'darkgoldenrod' => '#b8860b',
|
36 |
+
'darkgray' => '#a9a9a9',
|
37 |
+
'darkgrey' => '#a9a9a9',
|
38 |
+
'darkgreen' => '#006400',
|
39 |
+
'darkkhaki' => '#bdb76b',
|
40 |
+
'darkmagenta' => '#8b008b',
|
41 |
+
'darkolivegreen' => '#556b2f',
|
42 |
+
'darkorange' => '#ff8c00',
|
43 |
+
'darkorchid' => '#9932cc',
|
44 |
+
'darkred' => '#8b0000',
|
45 |
+
'darksalmon' => '#e9967a',
|
46 |
+
'darkseagreen' => '#8fbc8f',
|
47 |
+
'darkslateblue' => '#483d8b',
|
48 |
+
'darkslategray' => '#2f4f4f',
|
49 |
+
'darkslategrey' => '#2f4f4f',
|
50 |
+
'darkturquoise' => '#00ced1',
|
51 |
+
'darkviolet' => '#9400d3',
|
52 |
+
'deeppink' => '#ff1493',
|
53 |
+
'deepskyblue' => '#00bfff',
|
54 |
+
'dimgray' => '#696969',
|
55 |
+
'dimgrey' => '#696969',
|
56 |
+
'dodgerblue' => '#1e90ff',
|
57 |
+
'firebrick' => '#b22222',
|
58 |
+
'floralwhite' => '#fffaf0',
|
59 |
+
'forestgreen' => '#228b22',
|
60 |
+
'fuchsia' => '#ff00ff',
|
61 |
+
'gainsboro' => '#dcdcdc',
|
62 |
+
'ghostwhite' => '#f8f8ff',
|
63 |
+
'gold' => '#ffd700',
|
64 |
+
'goldenrod' => '#daa520',
|
65 |
+
'gray' => '#808080',
|
66 |
+
'grey' => '#808080',
|
67 |
+
'green' => '#008000',
|
68 |
+
'greenyellow' => '#adff2f',
|
69 |
+
'honeydew' => '#f0fff0',
|
70 |
+
'hotpink' => '#ff69b4',
|
71 |
+
'indianred' => '#cd5c5c',
|
72 |
+
'indigo' => '#4b0082',
|
73 |
+
'ivory' => '#fffff0',
|
74 |
+
'khaki' => '#f0e68c',
|
75 |
+
'lavender' => '#e6e6fa',
|
76 |
+
'lavenderblush' => '#fff0f5',
|
77 |
+
'lawngreen' => '#7cfc00',
|
78 |
+
'lemonchiffon' => '#fffacd',
|
79 |
+
'lightblue' => '#add8e6',
|
80 |
+
'lightcoral' => '#f08080',
|
81 |
+
'lightcyan' => '#e0ffff',
|
82 |
+
'lightgoldenrodyellow' => '#fafad2',
|
83 |
+
'lightgray' => '#d3d3d3',
|
84 |
+
'lightgrey' => '#d3d3d3',
|
85 |
+
'lightgreen' => '#90ee90',
|
86 |
+
'lightpink' => '#ffb6c1',
|
87 |
+
'lightsalmon' => '#ffa07a',
|
88 |
+
'lightseagreen' => '#20b2aa',
|
89 |
+
'lightskyblue' => '#87cefa',
|
90 |
+
'lightslategray' => '#778899',
|
91 |
+
'lightslategrey' => '#778899',
|
92 |
+
'lightsteelblue' => '#b0c4de',
|
93 |
+
'lightyellow' => '#ffffe0',
|
94 |
+
'lime' => '#00ff00',
|
95 |
+
'limegreen' => '#32cd32',
|
96 |
+
'linen' => '#faf0e6',
|
97 |
+
'magenta' => '#ff00ff',
|
98 |
+
'maroon' => '#800000',
|
99 |
+
'mediumaquamarine' => '#66cdaa',
|
100 |
+
'mediumblue' => '#0000cd',
|
101 |
+
'mediumorchid' => '#ba55d3',
|
102 |
+
'mediumpurple' => '#9370d8',
|
103 |
+
'mediumseagreen' => '#3cb371',
|
104 |
+
'mediumslateblue' => '#7b68ee',
|
105 |
+
'mediumspringgreen' => '#00fa9a',
|
106 |
+
'mediumturquoise' => '#48d1cc',
|
107 |
+
'mediumvioletred' => '#c71585',
|
108 |
+
'midnightblue' => '#191970',
|
109 |
+
'mintcream' => '#f5fffa',
|
110 |
+
'mistyrose' => '#ffe4e1',
|
111 |
+
'moccasin' => '#ffe4b5',
|
112 |
+
'navajowhite' => '#ffdead',
|
113 |
+
'navy' => '#000080',
|
114 |
+
'oldlace' => '#fdf5e6',
|
115 |
+
'olive' => '#808000',
|
116 |
+
'olivedrab' => '#6b8e23',
|
117 |
+
'orange' => '#ffa500',
|
118 |
+
'orangered' => '#ff4500',
|
119 |
+
'orchid' => '#da70d6',
|
120 |
+
'palegoldenrod' => '#eee8aa',
|
121 |
+
'palegreen' => '#98fb98',
|
122 |
+
'paleturquoise' => '#afeeee',
|
123 |
+
'palevioletred' => '#d87093',
|
124 |
+
'papayawhip' => '#ffefd5',
|
125 |
+
'peachpuff' => '#ffdab9',
|
126 |
+
'peru' => '#cd853f',
|
127 |
+
'pink' => '#ffc0cb',
|
128 |
+
'plum' => '#dda0dd',
|
129 |
+
'powderblue' => '#b0e0e6',
|
130 |
+
'purple' => '#800080',
|
131 |
+
'red' => '#ff0000',
|
132 |
+
'rosybrown' => '#bc8f8f',
|
133 |
+
'royalblue' => '#4169e1',
|
134 |
+
'saddlebrown' => '#8b4513',
|
135 |
+
'salmon' => '#fa8072',
|
136 |
+
'sandybrown' => '#f4a460',
|
137 |
+
'seagreen' => '#2e8b57',
|
138 |
+
'seashell' => '#fff5ee',
|
139 |
+
'sienna' => '#a0522d',
|
140 |
+
'silver' => '#c0c0c0',
|
141 |
+
'skyblue' => '#87ceeb',
|
142 |
+
'slateblue' => '#6a5acd',
|
143 |
+
'slategray' => '#708090',
|
144 |
+
'slategrey' => '#708090',
|
145 |
+
'snow' => '#fffafa',
|
146 |
+
'springgreen' => '#00ff7f',
|
147 |
+
'steelblue' => '#4682b4',
|
148 |
+
'tan' => '#d2b48c',
|
149 |
+
'teal' => '#008080',
|
150 |
+
'thistle' => '#d8bfd8',
|
151 |
+
'tomato' => '#ff6347',
|
152 |
+
'turquoise' => '#40e0d0',
|
153 |
+
'violet' => '#ee82ee',
|
154 |
+
'wheat' => '#f5deb3',
|
155 |
+
'white' => '#ffffff',
|
156 |
+
'whitesmoke' => '#f5f5f5',
|
157 |
+
'yellow' => '#ffff00',
|
158 |
+
'yellowgreen' => '#9acd32'
|
159 |
);
|
160 |
|
161 |
+
public static function hasOwnProperty( $color ) {
|
162 |
+
return isset( self::$colors[$color] );
|
163 |
}
|
164 |
|
165 |
+
public static function color( $color ) {
|
|
|
166 |
return self::$colors[$color];
|
167 |
}
|
168 |
|
base/inc/lib/Less/Configurable.php
CHANGED
@@ -1,69 +1,66 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Configurable
|
5 |
-
*
|
6 |
-
* @package Less
|
7 |
-
* @subpackage Core
|
8 |
-
*/
|
9 |
-
abstract class Less_Configurable {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Array of options
|
13 |
-
*
|
14 |
-
* @var array
|
15 |
-
*/
|
16 |
-
protected $options = array();
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Array of default options
|
20 |
-
*
|
21 |
-
* @var array
|
22 |
-
*/
|
23 |
-
protected $defaultOptions = array();
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
*
|
28 |
-
*
|
29 |
-
*
|
30 |
-
*
|
31 |
-
*
|
32 |
-
* @
|
33 |
-
*
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
$options =
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
*
|
44 |
-
*
|
45 |
-
*
|
46 |
-
*
|
47 |
-
* @
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
*
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
}
|
68 |
-
|
69 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Configurable
|
5 |
+
*
|
6 |
+
* @package Less
|
7 |
+
* @subpackage Core
|
8 |
+
*/
|
9 |
+
abstract class Less_Configurable {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Array of options
|
13 |
+
*
|
14 |
+
* @var array
|
15 |
+
*/
|
16 |
+
protected $options = array();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Array of default options
|
20 |
+
*
|
21 |
+
* @var array
|
22 |
+
*/
|
23 |
+
protected $defaultOptions = array();
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Set options
|
27 |
+
*
|
28 |
+
* If $options is an object it will be converted into an array by called
|
29 |
+
* it's toArray method.
|
30 |
+
*
|
31 |
+
* @throws Exception
|
32 |
+
* @param array|object $options
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
public function setOptions( $options ) {
|
36 |
+
$options = array_intersect_key( $options, $this->defaultOptions );
|
37 |
+
$this->options = array_merge( $this->defaultOptions, $this->options, $options );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get an option value by name
|
42 |
+
*
|
43 |
+
* If the option is empty or not set a NULL value will be returned.
|
44 |
+
*
|
45 |
+
* @param string $name
|
46 |
+
* @param mixed $default Default value if confiuration of $name is not present
|
47 |
+
* @return mixed
|
48 |
+
*/
|
49 |
+
public function getOption( $name, $default = null ) {
|
50 |
+
if ( isset( $this->options[$name] ) ) {
|
51 |
+
return $this->options[$name];
|
52 |
+
}
|
53 |
+
return $default;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Set an option
|
58 |
+
*
|
59 |
+
* @param string $name
|
60 |
+
* @param mixed $value
|
61 |
+
*/
|
62 |
+
public function setOption( $name, $value ) {
|
63 |
+
$this->options[$name] = $value;
|
64 |
+
}
|
65 |
+
|
66 |
+
}
|
|
|
|
|
|
base/inc/lib/Less/Environment.php
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
/**
|
5 |
* Environment
|
6 |
*
|
7 |
* @package Less
|
8 |
* @subpackage environment
|
9 |
*/
|
10 |
-
class Less_Environment{
|
11 |
|
12 |
-
//public $paths = array();
|
13 |
//public static $files = array(); // list of files that have been imported, used for import-once
|
14 |
//public $rootpath; // option - rootpath to append to URL's
|
15 |
//public static $strictImports = null; // option -
|
@@ -21,7 +20,6 @@ class Less_Environment{
|
|
21 |
|
22 |
public $importMultiple = false; // whether we are currently importing multiple copies
|
23 |
|
24 |
-
|
25 |
/**
|
26 |
* @var array
|
27 |
*/
|
@@ -52,15 +50,13 @@ class Less_Environment{
|
|
52 |
*/
|
53 |
public $functions = array();
|
54 |
|
55 |
-
|
56 |
-
public function Init(){
|
57 |
-
|
58 |
self::$parensStack = 0;
|
59 |
self::$tabLevel = 0;
|
60 |
self::$lastRule = false;
|
61 |
self::$mixin_stack = 0;
|
62 |
|
63 |
-
if( Less_Parser::$options['compress'] ){
|
64 |
|
65 |
Less_Environment::$_outputMap = array(
|
66 |
',' => ',',
|
@@ -72,11 +68,11 @@ class Less_Environment{
|
|
72 |
'~' => '~',
|
73 |
'>' => '>',
|
74 |
'|' => '|',
|
75 |
-
|
76 |
-
|
77 |
);
|
78 |
|
79 |
-
}else{
|
80 |
|
81 |
Less_Environment::$_outputMap = array(
|
82 |
',' => ', ',
|
@@ -88,30 +84,27 @@ class Less_Environment{
|
|
88 |
'~' => ' ~ ',
|
89 |
'>' => ' > ',
|
90 |
'|' => '|',
|
91 |
-
|
92 |
-
|
93 |
);
|
94 |
|
95 |
}
|
96 |
}
|
97 |
|
98 |
-
|
99 |
-
public function copyEvalEnv($frames = array() ){
|
100 |
$new_env = new Less_Environment();
|
101 |
$new_env->frames = $frames;
|
102 |
return $new_env;
|
103 |
}
|
104 |
|
105 |
-
|
106 |
-
public static function isMathOn(){
|
107 |
return !Less_Parser::$options['strictMath'] || Less_Environment::$parensStack;
|
108 |
}
|
109 |
|
110 |
-
public static function isPathRelative($path){
|
111 |
-
return !preg_match('/^(?:[a-z-]+:|\/)/'
|
112 |
}
|
113 |
|
114 |
-
|
115 |
/**
|
116 |
* Canonicalize a path by resolving references to '/./', '/../'
|
117 |
* Does not remove leading "../"
|
@@ -119,27 +112,26 @@ class Less_Environment{
|
|
119 |
* @return string Canonicalized path
|
120 |
*
|
121 |
*/
|
122 |
-
public static function normalizePath($path){
|
123 |
-
|
124 |
-
$segments =
|
125 |
-
$segments = array_reverse($segments);
|
126 |
|
127 |
$path = array();
|
128 |
$path_len = 0;
|
129 |
|
130 |
-
while( $segments ){
|
131 |
-
$segment = array_pop($segments);
|
132 |
-
switch( $segment ) {
|
133 |
|
134 |
case '.':
|
135 |
break;
|
136 |
|
137 |
case '..':
|
138 |
-
if( !$path_len || ( $path[$path_len-1] === '..') ){
|
139 |
$path[] = $segment;
|
140 |
$path_len++;
|
141 |
-
}else{
|
142 |
-
array_pop($path);
|
143 |
$path_len--;
|
144 |
}
|
145 |
break;
|
@@ -151,16 +143,15 @@ class Less_Environment{
|
|
151 |
}
|
152 |
}
|
153 |
|
154 |
-
return implode('/'
|
155 |
}
|
156 |
|
157 |
-
|
158 |
-
|
159 |
-
array_unshift($this->frames, $frame);
|
160 |
}
|
161 |
|
162 |
-
public function shiftFrame(){
|
163 |
-
return array_shift($this->frames);
|
164 |
}
|
165 |
|
166 |
}
|
1 |
<?php
|
2 |
|
|
|
3 |
/**
|
4 |
* Environment
|
5 |
*
|
6 |
* @package Less
|
7 |
* @subpackage environment
|
8 |
*/
|
9 |
+
class Less_Environment {
|
10 |
|
11 |
+
// public $paths = array(); // option - unmodified - paths to search for imports on
|
12 |
//public static $files = array(); // list of files that have been imported, used for import-once
|
13 |
//public $rootpath; // option - rootpath to append to URL's
|
14 |
//public static $strictImports = null; // option -
|
20 |
|
21 |
public $importMultiple = false; // whether we are currently importing multiple copies
|
22 |
|
|
|
23 |
/**
|
24 |
* @var array
|
25 |
*/
|
50 |
*/
|
51 |
public $functions = array();
|
52 |
|
53 |
+
public function Init() {
|
|
|
|
|
54 |
self::$parensStack = 0;
|
55 |
self::$tabLevel = 0;
|
56 |
self::$lastRule = false;
|
57 |
self::$mixin_stack = 0;
|
58 |
|
59 |
+
if ( Less_Parser::$options['compress'] ) {
|
60 |
|
61 |
Less_Environment::$_outputMap = array(
|
62 |
',' => ',',
|
68 |
'~' => '~',
|
69 |
'>' => '>',
|
70 |
'|' => '|',
|
71 |
+
'^' => '^',
|
72 |
+
'^^' => '^^'
|
73 |
);
|
74 |
|
75 |
+
} else {
|
76 |
|
77 |
Less_Environment::$_outputMap = array(
|
78 |
',' => ', ',
|
84 |
'~' => ' ~ ',
|
85 |
'>' => ' > ',
|
86 |
'|' => '|',
|
87 |
+
'^' => ' ^ ',
|
88 |
+
'^^' => ' ^^ '
|
89 |
);
|
90 |
|
91 |
}
|
92 |
}
|
93 |
|
94 |
+
public function copyEvalEnv( $frames = array() ) {
|
|
|
95 |
$new_env = new Less_Environment();
|
96 |
$new_env->frames = $frames;
|
97 |
return $new_env;
|
98 |
}
|
99 |
|
100 |
+
public static function isMathOn() {
|
|
|
101 |
return !Less_Parser::$options['strictMath'] || Less_Environment::$parensStack;
|
102 |
}
|
103 |
|
104 |
+
public static function isPathRelative( $path ) {
|
105 |
+
return !preg_match( '/^(?:[a-z-]+:|\/)/', $path );
|
106 |
}
|
107 |
|
|
|
108 |
/**
|
109 |
* Canonicalize a path by resolving references to '/./', '/../'
|
110 |
* Does not remove leading "../"
|
112 |
* @return string Canonicalized path
|
113 |
*
|
114 |
*/
|
115 |
+
public static function normalizePath( $path ) {
|
116 |
+
$segments = explode( '/', $path );
|
117 |
+
$segments = array_reverse( $segments );
|
|
|
118 |
|
119 |
$path = array();
|
120 |
$path_len = 0;
|
121 |
|
122 |
+
while ( $segments ) {
|
123 |
+
$segment = array_pop( $segments );
|
124 |
+
switch ( $segment ) {
|
125 |
|
126 |
case '.':
|
127 |
break;
|
128 |
|
129 |
case '..':
|
130 |
+
if ( !$path_len || ( $path[$path_len - 1] === '..' ) ) {
|
131 |
$path[] = $segment;
|
132 |
$path_len++;
|
133 |
+
} else {
|
134 |
+
array_pop( $path );
|
135 |
$path_len--;
|
136 |
}
|
137 |
break;
|
143 |
}
|
144 |
}
|
145 |
|
146 |
+
return implode( '/', $path );
|
147 |
}
|
148 |
|
149 |
+
public function unshiftFrame( $frame ) {
|
150 |
+
array_unshift( $this->frames, $frame );
|
|
|
151 |
}
|
152 |
|
153 |
+
public function shiftFrame() {
|
154 |
+
return array_shift( $this->frames );
|
155 |
}
|
156 |
|
157 |
}
|
base/inc/lib/Less/Exception/Chunk.php
CHANGED
@@ -1,203 +1,203 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Chunk Exception
|
5 |
-
*
|
6 |
-
* @package Less
|
7 |
-
* @subpackage exception
|
8 |
-
*/
|
9 |
-
class Less_Exception_Chunk extends Less_Exception_Parser{
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
*
|
21 |
-
*
|
22 |
-
* @param
|
23 |
-
* @param
|
24 |
-
* @param integer $
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
$this->
|
35 |
-
|
36 |
-
$this->
|
37 |
-
$this->
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
$
|
51 |
-
$
|
52 |
-
|
53 |
-
$
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
if(
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
$cc2
|
113 |
-
|
114 |
-
if ($cc2 ==
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
return $this->fail("unmatched `" . chr($cc) . "`", $currentChunkStartIndex);
|
124 |
-
|
125 |
-
// /, check for comment
|
126 |
-
case 47:
|
127 |
-
if ($parenLevel || ($this->parserCurrentIndex == $this->input_len - 1)) { break;
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
if ($
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
/*
|
193 |
-
function emitChunk( $force = false ){
|
194 |
-
$len = $this->parserCurrentIndex - $this->emitFrom;
|
195 |
-
if ((($len < 512) && !$force) || !$len) {
|
196 |
-
return;
|
197 |
-
}
|
198 |
-
$chunks[] = substr($this->input, $this->emitFrom, $this->parserCurrentIndex + 1 - $this->emitFrom );
|
199 |
-
$this->emitFrom = $this->parserCurrentIndex + 1;
|
200 |
-
}
|
201 |
-
*/
|
202 |
-
|
203 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Chunk Exception
|
5 |
+
*
|
6 |
+
* @package Less
|
7 |
+
* @subpackage exception
|
8 |
+
*/
|
9 |
+
class Less_Exception_Chunk extends Less_Exception_Parser {
|
10 |
+
|
11 |
+
protected $parserCurrentIndex = 0;
|
12 |
+
|
13 |
+
protected $emitFrom = 0;
|
14 |
+
|
15 |
+
protected $input_len;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Constructor
|
19 |
+
*
|
20 |
+
* @param string $input
|
21 |
+
* @param Exception $previous Previous exception
|
22 |
+
* @param integer $index The current parser index
|
23 |
+
* @param Less_FileInfo|string $currentFile The file
|
24 |
+
* @param integer $code The exception code
|
25 |
+
*/
|
26 |
+
public function __construct( $input, Exception $previous = null, $index = null, $currentFile = null, $code = 0 ) {
|
27 |
+
$this->message = 'ParseError: Unexpected input'; // default message
|
28 |
+
|
29 |
+
$this->index = $index;
|
30 |
+
|
31 |
+
$this->currentFile = $currentFile;
|
32 |
+
|
33 |
+
$this->input = $input;
|
34 |
+
$this->input_len = strlen( $input );
|
35 |
+
|
36 |
+
$this->Chunks();
|
37 |
+
$this->genMessage();
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* See less.js chunks()
|
42 |
+
* We don't actually need the chunks
|
43 |
+
*
|
44 |
+
*/
|
45 |
+
protected function Chunks() {
|
46 |
+
$level = 0;
|
47 |
+
$parenLevel = 0;
|
48 |
+
$lastMultiCommentEndBrace = null;
|
49 |
+
$lastOpening = null;
|
50 |
+
$lastMultiComment = null;
|
51 |
+
$lastParen = null;
|
52 |
+
|
53 |
+
for ( $this->parserCurrentIndex = 0; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) {
|
54 |
+
$cc = $this->CharCode( $this->parserCurrentIndex );
|
55 |
+
if ( ( ( $cc >= 97 ) && ( $cc <= 122 ) ) || ( $cc < 34 ) ) {
|
56 |
+
// a-z or whitespace
|
57 |
+
continue;
|
58 |
+
}
|
59 |
+
|
60 |
+
switch ( $cc ) {
|
61 |
+
|
62 |
+
// (
|
63 |
+
case 40:
|
64 |
+
$parenLevel++;
|
65 |
+
$lastParen = $this->parserCurrentIndex;
|
66 |
+
break;
|
67 |
+
|
68 |
+
// )
|
69 |
+
case 41:
|
70 |
+
$parenLevel--;
|
71 |
+
if ( $parenLevel < 0 ) {
|
72 |
+
return $this->fail( "missing opening `(`" );
|
73 |
+
}
|
74 |
+
break;
|
75 |
+
|
76 |
+
// ;
|
77 |
+
case 59:
|
78 |
+
// if (!$parenLevel) { $this->emitChunk(); }
|
79 |
+
break;
|
80 |
+
|
81 |
+
// {
|
82 |
+
case 123:
|
83 |
+
$level++;
|
84 |
+
$lastOpening = $this->parserCurrentIndex;
|
85 |
+
break;
|
86 |
+
|
87 |
+
// }
|
88 |
+
case 125:
|
89 |
+
$level--;
|
90 |
+
if ( $level < 0 ) {
|
91 |
+
return $this->fail( "missing opening `{`" );
|
92 |
+
|
93 |
+
}
|
94 |
+
// if (!$level && !$parenLevel) { $this->emitChunk(); }
|
95 |
+
break;
|
96 |
+
// \
|
97 |
+
case 92:
|
98 |
+
if ( $this->parserCurrentIndex < $this->input_len - 1 ) { $this->parserCurrentIndex++; break;
|
99 |
+
}
|
100 |
+
return $this->fail( "unescaped `\\`" );
|
101 |
+
|
102 |
+
// ", ' and `
|
103 |
+
case 34:
|
104 |
+
case 39:
|
105 |
+
case 96:
|
106 |
+
$matched = 0;
|
107 |
+
$currentChunkStartIndex = $this->parserCurrentIndex;
|
108 |
+
for ( $this->parserCurrentIndex = $this->parserCurrentIndex + 1; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) {
|
109 |
+
$cc2 = $this->CharCode( $this->parserCurrentIndex );
|
110 |
+
if ( $cc2 > 96 ) { continue;
|
111 |
+
}
|
112 |
+
if ( $cc2 == $cc ) { $matched = 1; break;
|
113 |
+
}
|
114 |
+
if ( $cc2 == 92 ) { // \
|
115 |
+
if ( $this->parserCurrentIndex == $this->input_len - 1 ) {
|
116 |
+
return $this->fail( "unescaped `\\`" );
|
117 |
+
}
|
118 |
+
$this->parserCurrentIndex++;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
if ( $matched ) { break;
|
122 |
+
}
|
123 |
+
return $this->fail( "unmatched `" . chr( $cc ) . "`", $currentChunkStartIndex );
|
124 |
+
|
125 |
+
// /, check for comment
|
126 |
+
case 47:
|
127 |
+
if ( $parenLevel || ( $this->parserCurrentIndex == $this->input_len - 1 ) ) { break;
|
128 |
+
}
|
129 |
+
$cc2 = $this->CharCode( $this->parserCurrentIndex + 1 );
|
130 |
+
if ( $cc2 == 47 ) {
|
131 |
+
// //, find lnfeed
|
132 |
+
for ( $this->parserCurrentIndex = $this->parserCurrentIndex + 2; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) {
|
133 |
+
$cc2 = $this->CharCode( $this->parserCurrentIndex );
|
134 |
+
if ( ( $cc2 <= 13 ) && ( ( $cc2 == 10 ) || ( $cc2 == 13 ) ) ) { break;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
} else if ( $cc2 == 42 ) {
|
138 |
+
// /*, find */
|
139 |
+
$lastMultiComment = $currentChunkStartIndex = $this->parserCurrentIndex;
|
140 |
+
for ( $this->parserCurrentIndex = $this->parserCurrentIndex + 2; $this->parserCurrentIndex < $this->input_len - 1; $this->parserCurrentIndex++ ) {
|
141 |
+
$cc2 = $this->CharCode( $this->parserCurrentIndex );
|
142 |
+
if ( $cc2 == 125 ) { $lastMultiCommentEndBrace = $this->parserCurrentIndex;
|
143 |
+
}
|
144 |
+
if ( $cc2 != 42 ) { continue;
|
145 |
+
}
|
146 |
+
if ( $this->CharCode( $this->parserCurrentIndex + 1 ) == 47 ) { break;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
if ( $this->parserCurrentIndex == $this->input_len - 1 ) {
|
150 |
+
return $this->fail( "missing closing `*/`", $currentChunkStartIndex );
|
151 |
+
}
|
152 |
+
}
|
153 |
+
break;
|
154 |
+
|
155 |
+
// *, check for unmatched */
|
156 |
+
case 42:
|
157 |
+
if ( ( $this->parserCurrentIndex < $this->input_len - 1 ) && ( $this->CharCode( $this->parserCurrentIndex + 1 ) == 47 ) ) {
|
158 |
+
return $this->fail( "unmatched `/*`" );
|
159 |
+
}
|
160 |
+
break;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
if ( $level !== 0 ) {
|
165 |
+
if ( ( $lastMultiComment > $lastOpening ) && ( $lastMultiCommentEndBrace > $lastMultiComment ) ) {
|
166 |
+
return $this->fail( "missing closing `}` or `*/`", $lastOpening );
|
167 |
+
} else {
|
168 |
+
return $this->fail( "missing closing `}`", $lastOpening );
|
169 |
+
}
|
170 |
+
} else if ( $parenLevel !== 0 ) {
|
171 |
+
return $this->fail( "missing closing `)`", $lastParen );
|
172 |
+
}
|
173 |
+
|
174 |
+
// chunk didn't fail
|
175 |
+
|
176 |
+
//$this->emitChunk(true);
|
177 |
+
}
|
178 |
+
|
179 |
+
public function CharCode( $pos ) {
|
180 |
+
return ord( $this->input[$pos] );
|
181 |
+
}
|
182 |
+
|
183 |
+
public function fail( $msg, $index = null ) {
|
184 |
+
if ( !$index ) {
|
185 |
+
$this->index = $this->parserCurrentIndex;
|
186 |
+
} else {
|
187 |
+
$this->index = $index;
|
188 |
+
}
|
189 |
+
$this->message = 'ParseError: '.$msg;
|
190 |
+
}
|
191 |
+
|
192 |
+
/*
|
193 |
+
function emitChunk( $force = false ){
|
194 |
+
$len = $this->parserCurrentIndex - $this->emitFrom;
|
195 |
+
if ((($len < 512) && !$force) || !$len) {
|
196 |
+
return;
|
197 |
+
}
|
198 |
+
$chunks[] = substr($this->input, $this->emitFrom, $this->parserCurrentIndex + 1 - $this->emitFrom );
|
199 |
+
$this->emitFrom = $this->parserCurrentIndex + 1;
|
200 |
+
}
|
201 |
+
*/
|
202 |
+
|
203 |
+
}
|
base/inc/lib/Less/Exception/Compiler.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Compiler Exception
|
5 |
-
*
|
6 |
-
* @package Less
|
7 |
-
* @subpackage exception
|
8 |
-
*/
|
9 |
-
class Less_Exception_Compiler extends Less_Exception_Parser{
|
10 |
-
|
11 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Compiler Exception
|
5 |
+
*
|
6 |
+
* @package Less
|
7 |
+
* @subpackage exception
|
8 |
+
*/
|
9 |
+
class Less_Exception_Compiler extends Less_Exception_Parser {
|
10 |
+
|
11 |
+
}
|
base/inc/lib/Less/Exception/Parser.php
CHANGED
@@ -1,125 +1,116 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Parser Exception
|
5 |
-
*
|
6 |
-
* @package Less
|
7 |
-
* @subpackage exception
|
8 |
-
*/
|
9 |
-
class Less_Exception_Parser extends Exception{
|
10 |
-
|
11 |
-
/**
|
12 |
-
* The current file
|
13 |
-
*
|
14 |
-
* @var Less_ImportedFile
|
15 |
-
*/
|
16 |
-
public $currentFile;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* The current parser index
|
20 |
-
*
|
21 |
-
* @var integer
|
22 |
-
*/
|
23 |
-
public $index;
|
24 |
-
|
25 |
-
protected $input;
|
26 |
-
|
27 |
-
protected $details = array();
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
*
|
32 |
-
*
|
33 |
-
* @param
|
34 |
-
* @param
|
35 |
-
* @param
|
36 |
-
* @param
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
parent::__construct($message, $code);
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$this->
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
$
|
79 |
-
$
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
*/
|
118 |
-
public function getColumn(){
|
119 |
-
|
120 |
-
$part = substr($this->input, 0, $this->index);
|
121 |
-
$pos = strrpos($part,"\n");
|
122 |
-
return $this->index - $pos;
|
123 |
-
}
|
124 |
-
|
125 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Parser Exception
|
5 |
+
*
|
6 |
+
* @package Less
|
7 |
+
* @subpackage exception
|
8 |
+
*/
|
9 |
+
class Less_Exception_Parser extends Exception {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* The current file
|
13 |
+
*
|
14 |
+
* @var Less_ImportedFile
|
15 |
+
*/
|
16 |
+
public $currentFile;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* The current parser index
|
20 |
+
*
|
21 |
+
* @var integer
|
22 |
+
*/
|
23 |
+
public $index;
|
24 |
+
|
25 |
+
protected $input;
|
26 |
+
|
27 |
+
protected $details = array();
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Constructor
|
31 |
+
*
|
32 |
+
* @param string $message
|
33 |
+
* @param Exception $previous Previous exception
|
34 |
+
* @param integer $index The current parser index
|
35 |
+
* @param Less_FileInfo|string $currentFile The file
|
36 |
+
* @param integer $code The exception code
|
37 |
+
*/
|
38 |
+
public function __construct( $message = null, Exception $previous = null, $index = null, $currentFile = null, $code = 0 ) {
|
39 |
+
if ( PHP_VERSION_ID < 50300 ) {
|
40 |
+
$this->previous = $previous;
|
41 |
+
parent::__construct( $message, $code );
|
42 |
+
} else {
|
43 |
+
parent::__construct( $message, $code, $previous );
|
44 |
+
}
|
45 |
+
|
46 |
+
$this->currentFile = $currentFile;
|
47 |
+
$this->index = $index;
|
48 |
+
|
49 |
+
$this->genMessage();
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function getInput() {
|
53 |
+
if ( !$this->input && $this->currentFile && $this->currentFile['filename'] && file_exists( $this->currentFile['filename'] ) ) {
|
54 |
+
$this->input = file_get_contents( $this->currentFile['filename'] );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Converts the exception to string
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function genMessage() {
|
64 |
+
if ( $this->currentFile && $this->currentFile['filename'] ) {
|
65 |
+
$this->message .= ' in '.basename( $this->currentFile['filename'] );
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( $this->index !== null ) {
|
69 |
+
$this->getInput();
|
70 |
+
if ( $this->input ) {
|
71 |
+
$line = self::getLineNumber();
|
72 |
+
$this->message .= ' on line '.$line.', column '.self::getColumn();
|
73 |
+
|
74 |
+
$lines = explode( "\n", $this->input );
|
75 |
+
|
76 |
+
$count = count( $lines );
|
77 |
+
$start_line = max( 0, $line - 3 );
|
78 |
+
$last_line = min( $count, $start_line + 6 );
|
79 |
+
$num_len = strlen( $last_line );
|
80 |
+
for ( $i = $start_line; $i < $last_line; $i++ ) {
|
81 |
+
$this->message .= "\n".str_pad( $i + 1, $num_len, '0', STR_PAD_LEFT ).'| '.$lines[$i];
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Returns the line number the error was encountered
|
90 |
+
*
|
91 |
+
* @return integer
|
92 |
+
*/
|
93 |
+
public function getLineNumber() {
|
94 |
+
if ( $this->index ) {
|
95 |
+
// https://bugs.php.net/bug.php?id=49790
|
96 |
+
if ( ini_get( "mbstring.func_overload" ) ) {
|
97 |
+
return substr_count( substr( $this->input, 0, $this->index ), "\n" ) + 1;
|
98 |
+
} else {
|
99 |
+
return substr_count( $this->input, "\n", 0, $this->index ) + 1;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
return 1;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Returns the column the error was encountered
|
107 |
+
*
|
108 |
+
* @return integer
|
109 |
+
*/
|
110 |
+
public function getColumn() {
|
111 |
+
$part = substr( $this->input, 0, $this->index );
|
112 |
+
$pos = strrpos( $part, "\n" );
|
113 |
+
return $this->index - $pos;
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
base/inc/lib/Less/Functions.php
CHANGED
@@ -7,12 +7,12 @@
|
|
7 |
* @subpackage function
|
8 |
* @see http://lesscss.org/functions/
|
9 |
*/
|
10 |
-
class Less_Functions{
|
11 |
|
12 |
public $env;
|
13 |
public $currentFileInfo;
|
14 |
|
15 |
-
function __construct($env, $currentFileInfo = null ){
|
16 |
$this->env = $env;
|
17 |
$this->currentFileInfo = $currentFileInfo;
|
18 |
}
|
@@ -20,374 +20,367 @@ class Less_Functions{
|
|
20 |
/**
|
21 |
* @param string $op
|
22 |
*/
|
23 |
-
public static function operate( $op, $a, $b ){
|
24 |
-
switch ($op) {
|
25 |
-
case '+':
|
26 |
-
|
27 |
-
case '
|
28 |
-
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
}
|
31 |
|
32 |
-
public static function clamp($val, $max = 1){
|
33 |
-
return min( max($val, 0), $max);
|
34 |
}
|
35 |
|
36 |
-
public static function fround( $value ){
|
37 |
-
|
38 |
-
if( $value === 0 ){
|
39 |
return $value;
|
40 |
}
|
41 |
|
42 |
-
if( Less_Parser::$options['numPrecision'] ){
|
43 |
-
$p = pow(10, Less_Parser::$options['numPrecision']);
|
44 |
-
return round( $value * $p) / $p;
|
45 |
}
|
46 |
return $value;
|
47 |
}
|
48 |
|
49 |
-
public static function number($n){
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
} else if (is_numeric($n)) {
|
54 |
return $n;
|
55 |
} else {
|
56 |
-
throw new Less_Exception_Compiler("color functions take numbers as parameters");
|
57 |
}
|
58 |
}
|
59 |
|
60 |
-
public static function scaled($n, $size = 255 ){
|
61 |
-
if( $n instanceof Less_Tree_Dimension && $n->unit->is('%') ){
|
62 |
return (float)$n->value * $size / 100;
|
63 |
} else {
|
64 |
-
return Less_Functions::number($n);
|
65 |
}
|
66 |
}
|
67 |
|
68 |
-
public function rgb
|
69 |
-
if (is_null($r) || is_null($g) || is_null($b)) {
|
70 |
-
throw new Less_Exception_Compiler("rgb expects three parameters");
|
71 |
}
|
72 |
-
return $this->rgba($r, $g, $b, 1.0);
|
73 |
}
|
74 |
|
75 |
-
public function rgba($r = null, $g = null, $b = null, $a = null){
|
76 |
-
$rgb = array($r, $g, $b);
|
77 |
-
$rgb = array_map(array('Less_Functions','scaled')
|
78 |
|
79 |
-
$a = self::number($a);
|
80 |
-
return new Less_Tree_Color($rgb, $a);
|
81 |
}
|
82 |
|
83 |
-
public function hsl($h, $s, $l){
|
84 |
-
return $this->hsla($h, $s, $l, 1.0);
|
85 |
}
|
86 |
|
87 |
-
public function hsla($h, $s, $l, $a){
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
$
|
90 |
-
$s = self::clamp(self::number($s));
|
91 |
-
$l = self::clamp(self::number($l));
|
92 |
-
$a = self::clamp(self::number($a));
|
93 |
-
|
94 |
-
$m2 = $l <= 0.5 ? $l * ($s + 1) : $l + $s - $l * $s;
|
95 |
|
96 |
$m1 = $l * 2 - $m2;
|
97 |
|
98 |
-
return $this->rgba( self::hsla_hue($h + 1/3, $m1, $m2) * 255,
|
99 |
-
self::hsla_hue($h, $m1, $m2) * 255,
|
100 |
-
self::hsla_hue($h - 1/3, $m1, $m2) * 255,
|
101 |
-
$a);
|
102 |
}
|
103 |
|
104 |
/**
|
105 |
* @param double $h
|
106 |
*/
|
107 |
-
public function hsla_hue($h, $m1, $m2){
|
108 |
-
$h = $h < 0 ? $h + 1 : ($h > 1 ? $h - 1 : $h);
|
109 |
-
if
|
110 |
-
else if ($h * 2 < 1) return $m2;
|
111 |
-
else if ($h * 3 < 2) return $m1 + ($m2 - $m1) * (2/3 - $h) * 6;
|
112 |
-
else return $m1;
|
113 |
}
|
114 |
|
115 |
-
public function hsv($h, $s, $v) {
|
116 |
-
return $this->hsva($h, $s, $v, 1.0);
|
117 |
}
|
118 |
|
119 |
/**
|
120 |
* @param double $a
|
121 |
*/
|
122 |
-
public function hsva($h, $s, $v, $a) {
|
123 |
-
$h = ((Less_Functions::number($h) % 360) / 360 ) * 360;
|
124 |
-
$s = Less_Functions::number($s);
|
125 |
-
$v = Less_Functions::number($v);
|
126 |
-
$a = Less_Functions::number($a);
|
127 |
|
128 |
-
$i = floor(($h / 60) % 6);
|
129 |
-
$f = ($h / 60) - $i;
|
130 |
|
131 |
$vs = array( $v,
|
132 |
-
$v * (1 - $s),
|
133 |
-
$v * (1 - $f * $s),
|
134 |
-
$v * (1 - (1 - $f) * $s));
|
135 |
-
|
136 |
-
$perm = array(array(0, 3, 1),
|
137 |
-
array(2, 0, 1),
|
138 |
-
array(1, 0, 3),
|
139 |
-
array(1, 2, 0),
|
140 |
-
array(3, 1, 0),
|
141 |
-
array(0, 1, 2));
|
142 |
-
|
143 |
-
return $this->rgba($vs[$perm[$i][0]] * 255,
|
144 |
$vs[$perm[$i][1]] * 255,
|
145 |
$vs[$perm[$i][2]] * 255,
|
146 |
-
$a);
|
147 |
}
|
148 |
|
149 |
-
public function hue($color = null){
|
150 |
-
if (!$color instanceof Less_Tree_Color) {
|
151 |
-
throw new Less_Exception_Compiler('The first argument to hue must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
152 |
}
|
153 |
|
154 |
$c = $color->toHSL();
|
155 |
-
return new Less_Tree_Dimension(Less_Parser::round($c['h']));
|
156 |
}
|
157 |
|
158 |
-
public function saturation($color = null){
|
159 |
-
if (!$color instanceof Less_Tree_Color) {
|
160 |
-
throw new Less_Exception_Compiler('The first argument to saturation must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
161 |
}
|
162 |
|
163 |
$c = $color->toHSL();
|
164 |
-
return new Less_Tree_Dimension(Less_Parser::round($c['s'] * 100), '%');
|
165 |
}
|
166 |
|
167 |
-
public function lightness($color = null){
|
168 |
-
if (!$color instanceof Less_Tree_Color) {
|
169 |
-
throw new Less_Exception_Compiler('The first argument to lightness must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
170 |
}
|
171 |
|
172 |
$c = $color->toHSL();
|
173 |
-
return new Less_Tree_Dimension(Less_Parser::round($c['l'] * 100), '%');
|
174 |
}
|
175 |
|
176 |
-
public function hsvhue( $color = null ){
|
177 |
-
if (!$color instanceof Less_Tree_Color) {
|
178 |
-
throw new Less_Exception_Compiler('The first argument to hsvhue must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
179 |
}
|
180 |
|
181 |
$hsv = $color->toHSV();
|
182 |
-
return new Less_Tree_Dimension( Less_Parser::round($hsv['h']) );
|
183 |
}
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
throw new Less_Exception_Compiler('The first argument to hsvsaturation must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
189 |
}
|
190 |
|
191 |
$hsv = $color->toHSV();
|
192 |
-
return new Less_Tree_Dimension( Less_Parser::round($hsv['s'] * 100), '%' );
|
193 |
}
|
194 |
|
195 |
-
public function hsvvalue( $color = null ){
|
196 |
-
if (!$color instanceof Less_Tree_Color) {
|
197 |
-
throw new Less_Exception_Compiler('The first argument to hsvvalue must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
198 |
}
|
199 |
|
200 |
$hsv = $color->toHSV();
|
201 |
-
return new Less_Tree_Dimension( Less_Parser::round($hsv['v'] * 100), '%' );
|
202 |
}
|
203 |
|
204 |
-
public function red($color = null) {
|
205 |
-
if (!$color instanceof Less_Tree_Color) {
|
206 |
-
throw new Less_Exception_Compiler('The first argument to red must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
207 |
}
|
208 |
|
209 |
return new Less_Tree_Dimension( $color->rgb[0] );
|
210 |
}
|
211 |
|
212 |
-
public function green($color = null) {
|
213 |
-
if (!$color instanceof Less_Tree_Color) {
|
214 |
-
throw new Less_Exception_Compiler('The first argument to green must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
215 |
}
|
216 |
|
217 |
return new Less_Tree_Dimension( $color->rgb[1] );
|
218 |
}
|
219 |
|
220 |
-
public function blue($color = null) {
|
221 |
-
if (!$color instanceof Less_Tree_Color) {
|
222 |
-
throw new Less_Exception_Compiler('The first argument to blue must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
223 |
}
|
224 |
|
225 |
return new Less_Tree_Dimension( $color->rgb[2] );
|
226 |
}
|
227 |
|
228 |
-
public function alpha($color = null){
|
229 |
-
if (!$color instanceof Less_Tree_Color) {
|
230 |
-
throw new Less_Exception_Compiler('The first argument to alpha must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
231 |
}
|
232 |
|
233 |
$c = $color->toHSL();
|
234 |
-
return new Less_Tree_Dimension($c['a']);
|
235 |
}
|
236 |
|
237 |
-
public function luma
|
238 |
-
if (!$color instanceof Less_Tree_Color) {
|
239 |
-
throw new Less_Exception_Compiler('The first argument to luma must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
240 |
}
|
241 |
|
242 |
-
return new Less_Tree_Dimension(Less_Parser::round( $color->luma() * $color->alpha * 100), '%');
|
243 |
}
|
244 |
|
245 |
-
public function luminance( $color = null ){
|
246 |
-
if (!$color instanceof Less_Tree_Color) {
|
247 |
-
throw new Less_Exception_Compiler('The first argument to luminance must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
248 |
}
|
249 |
|
250 |
$luminance =
|
251 |
-
(0.2126 * $color->rgb[0] / 255)
|
252 |
-
+ (0.7152 * $color->rgb[1] / 255)
|
253 |
-
+ (0.0722 * $color->rgb[2] / 255);
|
254 |
|
255 |
-
return new Less_Tree_Dimension(Less_Parser::round( $luminance * $color->alpha * 100), '%');
|
256 |
}
|
257 |
|
258 |
-
public function saturate($color = null, $amount = null){
|
259 |
// filter: saturate(3.2);
|
260 |
// should be kept as is, so check for color
|
261 |
-
if ($color instanceof Less_Tree_Dimension) {
|
262 |
return null;
|
263 |
}
|
264 |
|
265 |
-
if (!$color instanceof Less_Tree_Color) {
|
266 |
-
throw new Less_Exception_Compiler('The first argument to saturate must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
267 |
}
|
268 |
-
if (!$amount instanceof Less_Tree_Dimension) {
|
269 |
-
throw new Less_Exception_Compiler('The second argument to saturate must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
270 |
}
|
271 |
|
272 |
$hsl = $color->toHSL();
|
273 |
|
274 |
$hsl['s'] += $amount->value / 100;
|
275 |
-
$hsl['s'] = self::clamp($hsl['s']);
|
276 |
|
277 |
-
return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']);
|
278 |
}
|
279 |
|
280 |
/**
|
281 |
* @param Less_Tree_Dimension $amount
|
282 |
*/
|
283 |
-
public function desaturate($color = null, $amount = null){
|
284 |
-
if (!$color instanceof Less_Tree_Color) {
|
285 |
-
throw new Less_Exception_Compiler('The first argument to desaturate must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
286 |
}
|
287 |
-
if (!$amount instanceof Less_Tree_Dimension) {
|
288 |
-
throw new Less_Exception_Compiler('The second argument to desaturate must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
289 |
}
|
290 |
|
291 |
$hsl = $color->toHSL();
|
292 |
|
293 |
$hsl['s'] -= $amount->value / 100;
|
294 |
-
$hsl['s'] = self::clamp($hsl['s']);
|
295 |
|
296 |
-
return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']);
|
297 |
}
|
298 |
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
if (!$color instanceof Less_Tree_Color) {
|
303 |
-
throw new Less_Exception_Compiler('The first argument to lighten must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
304 |
}
|
305 |
-
if (!$amount instanceof Less_Tree_Dimension) {
|
306 |
-
throw new Less_Exception_Compiler('The second argument to lighten must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
307 |
}
|
308 |
|
309 |
$hsl = $color->toHSL();
|
310 |
|
311 |
$hsl['l'] += $amount->value / 100;
|
312 |
-
$hsl['l'] = self::clamp($hsl['l']);
|
313 |
|
314 |
-
return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']);
|
315 |
}
|
316 |
|
317 |
-
public function darken($color = null, $amount = null){
|
318 |
-
if (!$color instanceof Less_Tree_Color) {
|
319 |
-
throw new Less_Exception_Compiler('The first argument to darken must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
320 |
}
|
321 |
-
if (!$amount instanceof Less_Tree_Dimension) {
|
322 |
-
throw new Less_Exception_Compiler('The second argument to darken must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
323 |
}
|
324 |
|
325 |
$hsl = $color->toHSL();
|
326 |
$hsl['l'] -= $amount->value / 100;
|
327 |
-
$hsl['l'] = self::clamp($hsl['l']);
|
328 |
|
329 |
-
return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']);
|
330 |
}
|
331 |
|
332 |
-
public function fadein($color = null, $amount = null){
|
333 |
-
if (!$color instanceof Less_Tree_Color) {
|
334 |
-
throw new Less_Exception_Compiler('The first argument to fadein must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
335 |
}
|
336 |
-
if (!$amount instanceof Less_Tree_Dimension) {
|
337 |
-
throw new Less_Exception_Compiler('The second argument to fadein must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
338 |
}
|
339 |
|
340 |
$hsl = $color->toHSL();
|
341 |
$hsl['a'] += $amount->value / 100;
|
342 |
-
$hsl['a'] = self::clamp($hsl['a']);
|
343 |
-
return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']);
|
344 |
}
|
345 |
|
346 |
-
public function fadeout($color = null, $amount = null){
|
347 |
-
if (!$color instanceof Less_Tree_Color) {
|
348 |
-
throw new Less_Exception_Compiler('The first argument to fadeout must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
349 |
}
|
350 |
-
if (!$amount instanceof Less_Tree_Dimension) {
|
351 |
-
throw new Less_Exception_Compiler('The second argument to fadeout must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
352 |
}
|
353 |
|
354 |
$hsl = $color->toHSL();
|
355 |
$hsl['a'] -= $amount->value / 100;
|
356 |
-
$hsl['a'] = self::clamp($hsl['a']);
|
357 |
-
return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']);
|
358 |
}
|
359 |
|
360 |
-
public function fade($color = null, $amount = null){
|
361 |
-
if (!$color instanceof Less_Tree_Color) {
|
362 |
-
throw new Less_Exception_Compiler('The first argument to fade must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
363 |
}
|
364 |
-
if (!$amount instanceof Less_Tree_Dimension) {
|
365 |
-
throw new Less_Exception_Compiler('The second argument to fade must be a percentage' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
366 |
}
|
367 |
|
368 |
$hsl = $color->toHSL();
|
369 |
|
370 |
$hsl['a'] = $amount->value / 100;
|
371 |
-
$hsl['a'] = self::clamp($hsl['a']);
|
372 |
-
return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']);
|
373 |
}
|
374 |
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
if (!$color instanceof Less_Tree_Color) {
|
379 |
-
throw new Less_Exception_Compiler('The first argument to spin must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
380 |
}
|
381 |
-
if (!$amount instanceof Less_Tree_Dimension) {
|
382 |
-
throw new Less_Exception_Compiler('The second argument to spin must be a number' . ($amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
383 |
}
|
384 |
|
385 |
$hsl = $color->toHSL();
|
386 |
-
$hue = fmod($hsl['h'] + $amount->value, 360);
|
387 |
|
388 |
$hsl['h'] = $hue < 0 ? 360 + $hue : $hue;
|
389 |
|
390 |
-
return $this->hsla($hsl['h'], $hsl['s'], $hsl['l'], $hsl['a']);
|
391 |
}
|
392 |
|
393 |
//
|
@@ -398,18 +391,18 @@ class Less_Functions{
|
|
398 |
/**
|
399 |
* @param Less_Tree_Color $color1
|
400 |
*/
|
401 |
-
public function mix($color1 = null, $color2 = null, $weight = null){
|
402 |
-
if (!$color1 instanceof Less_Tree_Color) {
|
403 |
-
throw new Less_Exception_Compiler('The first argument to mix must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
404 |
}
|
405 |
-
if (!$color2 instanceof Less_Tree_Color) {
|
406 |
-
throw new Less_Exception_Compiler('The second argument to mix must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
407 |
}
|
408 |
-
if (!$weight) {
|
409 |
-
$weight = new Less_Tree_Dimension('50', '%');
|
410 |
}
|
411 |
-
if (!$weight instanceof Less_Tree_Dimension) {
|
412 |
-
throw new Less_Exception_Compiler('The third argument to contrast must be a percentage' . ($weight instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
413 |
}
|
414 |
|
415 |
$p = $weight->value / 100.0;
|
@@ -418,104 +411,100 @@ class Less_Functions{
|
|
418 |
$hsl2 = $color2->toHSL();
|
419 |
$a = $hsl1['a'] - $hsl2['a'];
|
420 |
|
421 |
-
$w1 = (((($w * $a) == -1) ? $w : ($w + $a) / (1 + $w * $a)) + 1) / 2;
|
422 |
$w2 = 1 - $w1;
|
423 |
|
424 |
-
$rgb = array($color1->rgb[0] * $w1 + $color2->rgb[0] * $w2,
|
425 |
$color1->rgb[1] * $w1 + $color2->rgb[1] * $w2,
|
426 |
-
$color1->rgb[2] * $w1 + $color2->rgb[2] * $w2);
|
427 |
|
428 |
-
$alpha = $color1->alpha * $p + $color2->alpha * (1 - $p);
|
429 |
|
430 |
-
return new Less_Tree_Color($rgb, $alpha);
|
431 |
}
|
432 |
|
433 |
-
public function greyscale($color){
|
434 |
-
return $this->desaturate($color, new Less_Tree_Dimension(100,'%'));
|
435 |
}
|
436 |
|
437 |
-
|
438 |
-
public function contrast( $color, $dark = null, $light = null, $threshold = null){
|
439 |
// filter: contrast(3.2);
|
440 |
// should be kept as is, so check for color
|
441 |
-
if (!$color instanceof Less_Tree_Color) {
|
442 |
return null;
|
443 |
}
|
444 |
-
if( !$light ){
|
445 |
-
$light = $this->rgba(255, 255, 255, 1.0);
|
446 |
}
|
447 |
-
if( !$dark ){
|
448 |
-
$dark = $this->rgba(0, 0, 0, 1.0);
|
449 |
}
|
450 |
|
451 |
-
if (!$dark instanceof Less_Tree_Color) {
|
452 |
-
throw new Less_Exception_Compiler('The second argument to contrast must be a color' . ($dark instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
453 |
}
|
454 |
-
if (!$light instanceof Less_Tree_Color) {
|
455 |
-
throw new Less_Exception_Compiler('The third argument to contrast must be a color' . ($light instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
456 |
}
|
457 |
|
458 |
-
//Figure out which is actually light and dark!
|
459 |
-
if( $dark->luma() > $light->luma() ){
|
460 |
$t = $light;
|
461 |
$light = $dark;
|
462 |
$dark = $t;
|
463 |
}
|
464 |
-
if( !$threshold ){
|
465 |
$threshold = 0.43;
|
466 |
} else {
|
467 |
-
$threshold = Less_Functions::number($threshold);
|
468 |
}
|
469 |
|
470 |
-
if( $color->luma() < $threshold ){
|
471 |
return $light;
|
472 |
} else {
|
473 |
return $dark;
|
474 |
}
|
475 |
}
|
476 |
|
477 |
-
public function e
|
478 |
-
if( is_string($str) ){
|
479 |
-
return new Less_Tree_Anonymous($str);
|
480 |
}
|
481 |
-
return new Less_Tree_Anonymous($str instanceof Less_Tree_JavaScript ? $str->expression : $str->value);
|
482 |
}
|
483 |
|
484 |
-
public function escape
|
485 |
-
|
486 |
-
$revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'",'%3F'=>'?','%26'=>'&','%2C'=>',','%2F'=>'/','%40'=>'@','%2B'=>'+','%24'=>'$');
|
487 |
|
488 |
-
return new Less_Tree_Anonymous(strtr(rawurlencode($str->value), $revert));
|
489 |
}
|
490 |
|
491 |
-
|
492 |
/**
|
493 |
* todo: This function will need some additional work to make it work the same as less.js
|
494 |
*
|
495 |
*/
|
496 |
-
public function replace( $string, $pattern, $replacement, $flags = null ){
|
497 |
$result = $string->value;
|
498 |
|
499 |
-
$expr = '/'.str_replace('/','\\/'
|
500 |
-
if( $flags && $flags->value){
|
501 |
-
$expr .= self::replace_flags($flags->value);
|
502 |
}
|
503 |
|
504 |
-
$result = preg_replace($expr
|
505 |
-
|
506 |
|
507 |
-
if( property_exists($string,'quote') ){
|
508 |
-
return new Less_Tree_Quoted( $string->quote, $result, $string->escaped);
|
509 |
}
|
510 |
return new Less_Tree_Quoted( '', $result );
|
511 |
}
|
512 |
|
513 |
-
public static function replace_flags($flags){
|
514 |
-
$flags = str_split($flags,1);
|
515 |
$new_flags = '';
|
516 |
|
517 |
-
foreach($flags as $flag){
|
518 |
-
switch($flag){
|
519 |
case 'e':
|
520 |
case 'g':
|
521 |
break;
|
@@ -529,33 +518,33 @@ class Less_Functions{
|
|
529 |
return $new_flags;
|
530 |
}
|
531 |
|
532 |
-
public function _percent(){
|
533 |
-
$string = func_get_arg(0);
|
534 |
|
535 |
$args = func_get_args();
|
536 |
-
array_shift($args);
|
537 |
$result = $string->value;
|
538 |
|
539 |
-
foreach($args as $arg){
|
540 |
-
if( preg_match('/%[sda]/i'
|
541 |
$token = $token[0];
|
542 |
-
$value = stristr($token, 's') ? $arg->value : $arg->toCSS();
|
543 |
-
$value = preg_match('/[A-Z]$/', $token) ? urlencode($value) : $value;
|
544 |
-
$result = preg_replace('/%[sda]/i'
|
545 |
}
|
546 |
}
|
547 |
-
$result = str_replace('%%', '%', $result);
|
548 |
|
549 |
-
return new Less_Tree_Quoted( $string->quote
|
550 |
}
|
551 |
|
552 |
-
public function unit( $val, $unit = null) {
|
553 |
-
if( !($val instanceof Less_Tree_Dimension) ){
|
554 |
-
throw new Less_Exception_Compiler('The first argument to unit must be a number' . ($val instanceof Less_Tree_Operation ? '. Have you forgotten parenthesis?' : '.') );
|
555 |
}
|
556 |
|
557 |
-
if( $unit ){
|
558 |
-
if( $unit instanceof Less_Tree_Keyword ){
|
559 |
$unit = $unit->value;
|
560 |
} else {
|
561 |
$unit = $unit->toCSS();
|
@@ -563,320 +552,335 @@ class Less_Functions{
|
|
563 |
} else {
|
564 |
$unit = "";
|
565 |
}
|
566 |
-
return new Less_Tree_Dimension($val->value, $unit );
|
567 |
}
|
568 |
|
569 |
-
public function convert($val, $unit){
|
570 |
-
return $val->convertTo($unit->value);
|
571 |
}
|
572 |
|
573 |
-
public function round($n, $f = false) {
|
574 |
-
|
575 |
$fraction = 0;
|
576 |
-
if( $f !== false ){
|
577 |
$fraction = $f->value;
|
578 |
}
|
579 |
|
580 |
-
return $this->_math('Less_Parser::round',null, $n, $fraction);
|
581 |
}
|
582 |
|
583 |
-
public function pi(){
|
584 |
-
return new Less_Tree_Dimension(M_PI);
|
585 |
}
|
586 |
|
587 |
-
public function mod($a, $b) {
|
588 |
-
return new Less_Tree_Dimension( $a->value % $b->value, $a->unit);
|
589 |
}
|
590 |
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
}elseif( !($x instanceof Less_Tree_Dimension) || !($y instanceof Less_Tree_Dimension) ){
|
598 |
-
throw new Less_Exception_Compiler('Arguments must be numbers');
|
599 |
}
|
600 |
|
601 |
-
return new Less_Tree_Dimension( pow($x->value, $y->value), $x->unit );
|
602 |
}
|
603 |
|
604 |
// var mathFunctions = [{name:"ce ...
|
605 |
-
public function ceil( $n ){
|
606 |
-
|
607 |
-
|
608 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
609 |
|
610 |
-
public function tan( $n ){
|
611 |
-
|
612 |
-
|
613 |
|
614 |
-
public function
|
615 |
-
|
616 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
617 |
|
618 |
private function _math() {
|
619 |
$args = func_get_args();
|
620 |
-
$fn = array_shift($args);
|
621 |
-
$unit = array_shift($args);
|
622 |
|
623 |
-
if ($args[0] instanceof Less_Tree_Dimension) {
|
624 |
|
625 |
-
if( $unit === null ){
|
626 |
$unit = $args[0]->unit;
|
627 |
-
}else{
|
628 |
$args[0] = $args[0]->unify();
|
629 |
}
|
630 |
$args[0] = (float)$args[0]->value;
|
631 |
-
return new Less_Tree_Dimension( call_user_func_array($fn, $args), $unit);
|
632 |
-
} else if (is_numeric($args[0])) {
|
633 |
-
return call_user_func_array($fn
|
634 |
} else {
|
635 |
-
throw new Less_Exception_Compiler("math functions take numbers as parameters");
|
636 |
}
|
637 |
}
|
638 |
|
639 |
/**
|
640 |
* @param boolean $isMin
|
641 |
*/
|
642 |
-
private function _minmax( $isMin, $args ){
|
643 |
-
|
644 |
-
$arg_count = count($args);
|
645 |
|
646 |
-
if( $arg_count < 1 ){
|
647 |
-
throw new Less_Exception_Compiler( 'one or more arguments required');
|
648 |
}
|
649 |
|
650 |
$j = null;
|
651 |
$unitClone = null;
|
652 |
$unitStatic = null;
|
653 |
|
654 |
-
|
655 |
$order = array(); // elems only contains original argument values.
|
656 |
$values = array(); // key is the unit.toString() for unified tree.Dimension values,
|
657 |
// value is the index into the order array.
|
658 |
|
659 |
-
|
660 |
-
for( $i = 0; $i < $arg_count; $i++ ){
|
661 |
$current = $args[$i];
|
662 |
-
if( !($current instanceof Less_Tree_Dimension) ){
|
663 |
-
if( is_array($args[$i]->value) ){
|
664 |
$args[] = $args[$i]->value;
|
665 |
}
|
666 |
continue;
|
667 |
}
|
668 |
|
669 |
-
if( $current->unit->toString() === '' && !$unitClone ){
|
670 |
-
$temp = new Less_Tree_Dimension($current->value, $unitClone);
|
671 |
$currentUnified = $temp->unify();
|
672 |
-
}else{
|
673 |
$currentUnified = $current->unify();
|
674 |
}
|
675 |
|
676 |
-
if( $currentUnified->unit->toString() === "" && !$unitStatic ){
|
677 |
$unit = $unitStatic;
|
678 |
-
}else{
|
679 |
$unit = $currentUnified->unit->toString();
|
680 |
}
|
681 |
|
682 |
-
if( $unit !== '' && !$unitStatic || $unit !== '' && $order[0]->unify()->unit->toString() === "" ){
|
683 |
$unitStatic = $unit;
|
684 |
}
|
685 |
|
686 |
-
if( $unit != '' && !$unitClone ){
|
687 |
$unitClone = $current->unit->toString();
|
688 |
}
|
689 |
|
690 |
-
if( isset($values['']) && $unit !== '' && $unit === $unitStatic ){
|
691 |
$j = $values[''];
|
692 |
-
}elseif( isset($values[$unit]) ){
|
693 |
$j = $values[$unit];
|
694 |
-
}else{
|
695 |
|
696 |
-
if( $unitStatic && $unit !== $unitStatic ){
|
697 |
-
throw new Less_Exception_Compiler( 'incompatible types');
|
698 |
}
|
699 |
-
$values[$unit] = count($order);
|
700 |
$order[] = $current;
|
701 |
continue;
|
702 |
}
|
703 |
|
704 |
-
|
705 |
-
|
706 |
-
$temp = new Less_Tree_Dimension( $order[$j]->value, $unitClone);
|
707 |
$referenceUnified = $temp->unify();
|
708 |
-
}else{
|
709 |
$referenceUnified = $order[$j]->unify();
|
710 |
}
|
711 |
-
if( ($isMin && $currentUnified->value < $referenceUnified->value) || (!$isMin && $currentUnified->value > $referenceUnified->value) ){
|
712 |
$order[$j] = $current;
|
713 |
}
|
714 |
}
|
715 |
|
716 |
-
if( count($order) == 1 ){
|
717 |
return $order[0];
|
718 |
}
|
719 |
$args = array();
|
720 |
-
foreach($order as $a){
|
721 |
-
$args[] = $a->toCSS($this->env);
|
722 |
}
|
723 |
-
return new Less_Tree_Anonymous( ($isMin?'min(':'max(') . implode(Less_Environment::$_outputMap[',']
|
724 |
}
|
725 |
|
726 |
-
public function min(){
|
727 |
$args = func_get_args();
|
728 |
return $this->_minmax( true, $args );
|
729 |
}
|
730 |
|
731 |
-
public function max(){
|
732 |
$args = func_get_args();
|
733 |
return $this->_minmax( false, $args );
|
734 |
}
|
735 |
|
736 |
-
public function getunit($n){
|
737 |
-
return new Less_Tree_Anonymous($n->unit);
|
738 |
}
|
739 |
|
740 |
-
public function argb($color) {
|
741 |
-
if (!$color instanceof Less_Tree_Color) {
|
742 |
-
throw new Less_Exception_Compiler('The first argument to argb must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
743 |
}
|
744 |
|
745 |
-
return new Less_Tree_Anonymous($color->toARGB());
|
746 |
}
|
747 |
|
748 |
-
public function percentage($n) {
|
749 |
-
return new Less_Tree_Dimension($n->value * 100, '%');
|
750 |
}
|
751 |
|
752 |
-
public function color($n) {
|
753 |
-
|
754 |
-
if( $n instanceof Less_Tree_Quoted ){
|
755 |
$colorCandidate = $n->value;
|
756 |
-
$returnColor = Less_Tree_Color::fromKeyword($colorCandidate);
|
757 |
-
if( $returnColor ){
|
758 |
return $returnColor;
|
759 |
}
|
760 |
-
if( preg_match('/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/'
|
761 |
-
return new Less_Tree_Color(substr($colorCandidate, 1));
|
762 |
}
|
763 |
-
throw new Less_Exception_Compiler("argument must be a color keyword or 3/6 digit hex e.g. #FFF");
|
764 |
} else {
|
765 |
-
throw new Less_Exception_Compiler("argument must be a string");
|
766 |
}
|
767 |
}
|
768 |
|
769 |
-
|
770 |
-
|
771 |
-
return $this->_isa($n, 'Less_Tree_Color');
|
772 |
}
|
773 |
|
774 |
-
public function isnumber($n) {
|
775 |
-
return $this->_isa($n, 'Less_Tree_Dimension');
|
776 |
}
|
777 |
|
778 |
-
public function isstring($n) {
|
779 |
-
return $this->_isa($n, 'Less_Tree_Quoted');
|
780 |
}
|
781 |
|
782 |
-
public function iskeyword($n) {
|
783 |
-
return $this->_isa($n, 'Less_Tree_Keyword');
|
784 |
}
|
785 |
|
786 |
-
public function isurl($n) {
|
787 |
-
return $this->_isa($n, 'Less_Tree_Url');
|
788 |
}
|
789 |
|
790 |
-
public function ispixel($n) {
|
791 |
-
return $this->isunit($n, 'px');
|
792 |
}
|
793 |
|
794 |
-
public function ispercentage($n) {
|
795 |
-
return $this->isunit($n, '%');
|
796 |
}
|
797 |
|
798 |
-
public function isem($n) {
|
799 |
-
return $this->isunit($n, 'em');
|
800 |
}
|
801 |
|
802 |
/**
|
803 |
* @param string $unit
|
804 |
*/
|
805 |
-
public function isunit( $n, $unit ){
|
806 |
-
|
807 |
-
if( is_object($unit) && property_exists($unit,'value') ){
|
808 |
$unit = $unit->value;
|
809 |
}
|
810 |
|
811 |
-
return ($n instanceof Less_Tree_Dimension) && $n->unit->is($unit) ? new Less_Tree_Keyword('true') : new Less_Tree_Keyword('false');
|
812 |
}
|
813 |
|
814 |
/**
|
815 |
* @param string $type
|
816 |
*/
|
817 |
-
private function _isa($n, $type) {
|
818 |
-
return is_a($n, $type) ? new Less_Tree_Keyword('true') : new Less_Tree_Keyword('false');
|
819 |
}
|
820 |
|
821 |
-
public function tint($color, $amount = null) {
|
822 |
-
return $this->mix( $this->rgb(255,255,255), $color, $amount);
|
823 |
}
|
824 |
|
825 |
-
public function shade($color, $amount = null) {
|
826 |
-
return $this->mix($this->rgb(0, 0, 0), $color, $amount);
|
827 |
}
|
828 |
|
829 |
-
public function extract($values, $index ){
|
830 |
$index = (int)$index->value - 1; // (1-based index)
|
831 |
// handle non-array values as an array of length 1
|
832 |
// return 'undefined' if index is invalid
|
833 |
-
if( property_exists($values,'value') && is_array($values->value) ){
|
834 |
-
if( isset($values->value[$index]) ){
|
835 |
return $values->value[$index];
|
836 |
}
|
837 |
return null;
|
838 |
|
839 |
-
}elseif( (int)$index === 0 ){
|
840 |
return $values;
|
841 |
}
|
842 |
|
843 |
return null;
|
844 |
}
|
845 |
|
846 |
-
public function length($values){
|
847 |
-
$n = (property_exists($values,'value') && is_array($values->value)) ? count($values->value) : 1;
|
848 |
-
return new Less_Tree_Dimension($n);
|
849 |
}
|
850 |
|
851 |
-
public function datauri($mimetypeNode, $filePathNode = null ) {
|
852 |
-
|
853 |
$filePath = ( $filePathNode ? $filePathNode->value : null );
|
854 |
$mimetype = $mimetypeNode->value;
|
855 |
|
856 |
$args = 2;
|
857 |
-
if( !$filePath ){
|
858 |
$filePath = $mimetype;
|
859 |
$args = 1;
|
860 |
}
|
861 |
|
862 |
-
$filePath = str_replace('\\','/'
|
863 |
-
if( Less_Environment::isPathRelative($filePath) ){
|
864 |
|
865 |
-
if( Less_Parser::$options['relativeUrls'] ){
|
866 |
$temp = $this->currentFileInfo['currentDirectory'];
|
867 |
} else {
|
868 |
$temp = $this->currentFileInfo['entryPath'];
|
869 |
}
|
870 |
|
871 |
-
if( !empty($temp) ){
|
872 |
-
$filePath = Less_Environment::normalizePath(rtrim($temp,'/').'/'.$filePath);
|
873 |
}
|
874 |
|
875 |
}
|
876 |
|
877 |
-
|
878 |
// detect the mimetype if not given
|
879 |
-
if( $args < 2 ){
|
880 |
|
881 |
/* incomplete
|
882 |
$mime = require('mime');
|
@@ -888,59 +892,56 @@ class Less_Functions{
|
|
888 |
if (useBase64) mimetype += ';base64';
|
889 |
*/
|
890 |
|
891 |
-
$mimetype = Less_Mime::lookup($filePath);
|
892 |
|
893 |
-
$charset = Less_Mime::charsets_lookup($mimetype);
|
894 |
-
$useBase64 = !in_array($charset,array('US-ASCII', 'UTF-8'));
|
895 |
-
if( $useBase64 ){ $mimetype .= ';base64';
|
|
|
896 |
|
897 |
-
}else{
|
898 |
-
$useBase64 = preg_match('/;base64$/'
|
899 |
}
|
900 |
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
}else{
|
905 |
$buf = false;
|
906 |
}
|
907 |
|
908 |
-
|
909 |
// IE8 cannot handle a data-uri larger than 32KB. If this is exceeded
|
910 |
// and the --ieCompat flag is enabled, return a normal url() instead.
|
911 |
$DATA_URI_MAX_KB = 32;
|
912 |
-
$fileSizeInKB = round( strlen($buf) / 1024 );
|
913 |
-
if( $fileSizeInKB >= $DATA_URI_MAX_KB ){
|
914 |
-
$url = new Less_Tree_Url( ($filePathNode ? $filePathNode : $mimetypeNode), $this->currentFileInfo);
|
915 |
-
return $url->compile($this);
|
916 |
}
|
917 |
|
918 |
-
if( $buf ){
|
919 |
-
$buf = $useBase64 ? base64_encode($buf) : rawurlencode($buf);
|
920 |
$filePath = '"data:' . $mimetype . ',' . $buf . '"';
|
921 |
}
|
922 |
|
923 |
-
return new Less_Tree_Url( new Less_Tree_Anonymous($filePath) );
|
924 |
}
|
925 |
|
926 |
-
//svg-gradient
|
927 |
-
public function svggradient( $direction ){
|
928 |
-
|
929 |
$throw_message = 'svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]';
|
930 |
$arguments = func_get_args();
|
931 |
|
932 |
-
if( count($arguments) < 3 ){
|
933 |
throw new Less_Exception_Compiler( $throw_message );
|
934 |
}
|
935 |
|
936 |
-
$stops = array_slice($arguments,1);
|
937 |
$gradientType = 'linear';
|
938 |
$rectangleDimension = 'x="0" y="0" width="1" height="1"';
|
939 |
$useBase64 = true;
|
940 |
$directionValue = $direction->toCSS();
|
941 |
|
942 |
-
|
943 |
-
switch( $directionValue ){
|
944 |
case "to bottom":
|
945 |
$gradientDirectionSvg = 'x1="0%" y1="0%" x2="0%" y2="100%"';
|
946 |
break;
|
@@ -967,220 +968,217 @@ class Less_Functions{
|
|
967 |
'<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none">' .
|
968 |
'<' . $gradientType . 'Gradient id="gradient" gradientUnits="userSpaceOnUse" ' . $gradientDirectionSvg . '>';
|
969 |
|
970 |
-
for( $i = 0; $i < count($stops); $i++ ){
|
971 |
-
if( is_object($stops[$i]) && property_exists($stops[$i],'value') ){
|
972 |
$color = $stops[$i]->value[0];
|
973 |
$position = $stops[$i]->value[1];
|
974 |
-
}else{
|
975 |
$color = $stops[$i];
|
976 |
$position = null;
|
977 |
}
|
978 |
|
979 |
-
if( !($color instanceof Less_Tree_Color) || (!(($i === 0 || $i+1 === count($stops)) && $position === null) && !($position instanceof Less_Tree_Dimension)) ){
|
980 |
throw new Less_Exception_Compiler( $throw_message );
|
981 |
}
|
982 |
-
if( $position ){
|
983 |
$positionValue = $position->toCSS();
|
984 |
-
}elseif( $i === 0 ){
|
985 |
$positionValue = '0%';
|
986 |
-
}else{
|
987 |
$positionValue = '100%';
|
988 |
}
|
989 |
$alpha = $color->alpha;
|
990 |
-
$returner .= '<stop offset="' . $positionValue . '" stop-color="' . $color->toRGB() . '"' . ($alpha < 1 ? ' stop-opacity="' . $alpha . '"' : '') . '/>';
|
991 |
}
|
992 |
|
993 |
$returner .= '</' . $gradientType . 'Gradient><rect ' . $rectangleDimension . ' fill="url(#gradient)" /></svg>';
|
994 |
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
}else{
|
999 |
$returner = "'data:image/svg+xml,".$returner."'";
|
1000 |
}
|
1001 |
|
1002 |
return new Less_Tree_URL( new Less_Tree_Anonymous( $returner ) );
|
1003 |
}
|
1004 |
|
1005 |
-
|
1006 |
/**
|
1007 |
* Php version of javascript's `encodeURIComponent` function
|
1008 |
*
|
1009 |
* @param string $string The string to encode
|
1010 |
* @return string The encoded string
|
1011 |
*/
|
1012 |
-
public static function encodeURIComponent($string){
|
1013 |
-
$revert = array('%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')');
|
1014 |
-
return strtr(rawurlencode($string), $revert);
|
1015 |
}
|
1016 |
|
1017 |
-
|
1018 |
// Color Blending
|
1019 |
// ref: http://www.w3.org/TR/compositing-1
|
1020 |
|
1021 |
-
public function colorBlend( $mode, $color1, $color2 ){
|
1022 |
$ab = $color1->alpha; // backdrop
|
1023 |
$as = $color2->alpha; // source
|
1024 |
$r = array(); // result
|
1025 |
|
1026 |
-
$ar = $as + $ab * (1 - $as);
|
1027 |
-
for( $i = 0; $i < 3; $i++ ){
|
1028 |
$cb = $color1->rgb[$i] / 255;
|
1029 |
$cs = $color2->rgb[$i] / 255;
|
1030 |
$cr = call_user_func( $mode, $cb, $cs );
|
1031 |
-
if( $ar ){
|
1032 |
-
$cr = ($as * $cs + $ab * ($cb - $as * ($cb + $cs - $cr))) / $ar;
|
1033 |
}
|
1034 |
$r[$i] = $cr * 255;
|
1035 |
}
|
1036 |
|
1037 |
-
return new Less_Tree_Color($r, $ar);
|
1038 |
}
|
1039 |
|
1040 |
-
public function multiply($color1 = null, $color2 = null ){
|
1041 |
-
if (!$color1 instanceof Less_Tree_Color) {
|
1042 |
-
throw new Less_Exception_Compiler('The first argument to multiply must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1043 |
}
|
1044 |
-
if (!$color2 instanceof Less_Tree_Color) {
|
1045 |
-
throw new Less_Exception_Compiler('The second argument to multiply must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1046 |
}
|
1047 |
|
1048 |
-
return $this->colorBlend( array($this,'colorBlendMultiply'), $color1, $color2 );
|
1049 |
}
|
1050 |
|
1051 |
-
private function colorBlendMultiply($cb, $cs){
|
1052 |
return $cb * $cs;
|
1053 |
}
|
1054 |
|
1055 |
-
public function screen($color1 = null, $color2 = null ){
|
1056 |
-
if (!$color1 instanceof Less_Tree_Color) {
|
1057 |
-
throw new Less_Exception_Compiler('The first argument to screen must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1058 |
}
|
1059 |
-
if (!$color2 instanceof Less_Tree_Color) {
|
1060 |
-
throw new Less_Exception_Compiler('The second argument to screen must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1061 |
}
|
1062 |
|
1063 |
-
return $this->colorBlend( array($this,'colorBlendScreen'), $color1, $color2 );
|
1064 |
}
|
1065 |
|
1066 |
-
private function colorBlendScreen( $cb, $cs){
|
1067 |
return $cb + $cs - $cb * $cs;
|
1068 |
}
|
1069 |
|
1070 |
-
public function overlay($color1 = null, $color2 = null){
|
1071 |
-
if (!$color1 instanceof Less_Tree_Color) {
|
1072 |
-
throw new Less_Exception_Compiler('The first argument to overlay must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1073 |
}
|
1074 |
-
if (!$color2 instanceof Less_Tree_Color) {
|
1075 |
-
throw new Less_Exception_Compiler('The second argument to overlay must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1076 |
}
|
1077 |
|
1078 |
-
return $this->colorBlend( array($this,'colorBlendOverlay'), $color1, $color2 );
|
1079 |
}
|
1080 |
|
1081 |
-
private function colorBlendOverlay($cb, $cs ){
|
1082 |
$cb *= 2;
|
1083 |
-
return ($cb <= 1)
|
1084 |
-
? $this->colorBlendMultiply($cb, $cs)
|
1085 |
-
: $this->colorBlendScreen($cb - 1, $cs);
|
1086 |
}
|
1087 |
|
1088 |
-
public function softlight($color1 = null, $color2 = null){
|
1089 |
-
if (!$color1 instanceof Less_Tree_Color) {
|
1090 |
-
throw new Less_Exception_Compiler('The first argument to softlight must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1091 |
}
|
1092 |
-
if (!$color2 instanceof Less_Tree_Color) {
|
1093 |
-
throw new Less_Exception_Compiler('The second argument to softlight must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1094 |
}
|
1095 |
|
1096 |
-
return $this->colorBlend( array($this,'colorBlendSoftlight'), $color1, $color2 );
|
1097 |
}
|
1098 |
|
1099 |
-
private function colorBlendSoftlight($cb, $cs ){
|
1100 |
$d = 1;
|
1101 |
$e = $cb;
|
1102 |
-
if( $cs > 0.5 ){
|
1103 |
$e = 1;
|
1104 |
-
$d = ($cb > 0.25) ? sqrt($cb)
|
1105 |
-
: ((16 * $cb - 12) * $cb + 4) * $cb;
|
1106 |
}
|
1107 |
-
return $cb - (1 - 2 * $cs) * $e * ($d - $cb);
|
1108 |
}
|
1109 |
|
1110 |
-
public function hardlight($color1 = null, $color2 = null){
|
1111 |
-
if (!$color1 instanceof Less_Tree_Color) {
|
1112 |
-
throw new Less_Exception_Compiler('The first argument to hardlight must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1113 |
}
|
1114 |
-
if (!$color2 instanceof Less_Tree_Color) {
|
1115 |
-
throw new Less_Exception_Compiler('The second argument to hardlight must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1116 |
}
|
1117 |
|
1118 |
-
return $this->colorBlend( array($this,'colorBlendHardlight'), $color1, $color2 );
|
1119 |
}
|
1120 |
|
1121 |
-
private function colorBlendHardlight( $cb, $cs ){
|
1122 |
-
return $this->colorBlendOverlay($cs, $cb);
|
1123 |
}
|
1124 |
|
1125 |
-
public function difference($color1 = null, $color2 = null) {
|
1126 |
-
if (!$color1 instanceof Less_Tree_Color) {
|
1127 |
-
throw new Less_Exception_Compiler('The first argument to difference must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1128 |
}
|
1129 |
-
if (!$color2 instanceof Less_Tree_Color) {
|
1130 |
-
throw new Less_Exception_Compiler('The second argument to difference must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1131 |
}
|
1132 |
|
1133 |
-
return $this->colorBlend( array($this,'colorBlendDifference'), $color1, $color2 );
|
1134 |
}
|
1135 |
|
1136 |
-
private function colorBlendDifference( $cb, $cs ){
|
1137 |
-
return abs($cb - $cs);
|
1138 |
}
|
1139 |
|
1140 |
-
public function exclusion( $color1 = null, $color2 = null ){
|
1141 |
-
if (!$color1 instanceof Less_Tree_Color) {
|
1142 |
-
throw new Less_Exception_Compiler('The first argument to exclusion must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1143 |
}
|
1144 |
-
if (!$color2 instanceof Less_Tree_Color) {
|
1145 |
-
throw new Less_Exception_Compiler('The second argument to exclusion must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1146 |
}
|
1147 |
|
1148 |
-
return $this->colorBlend( array($this,'colorBlendExclusion'), $color1, $color2 );
|
1149 |
}
|
1150 |
|
1151 |
-
private function colorBlendExclusion( $cb, $cs ){
|
1152 |
return $cb + $cs - 2 * $cb * $cs;
|
1153 |
}
|
1154 |
|
1155 |
-
public function average($color1 = null, $color2 = null){
|
1156 |
-
if (!$color1 instanceof Less_Tree_Color) {
|
1157 |
-
throw new Less_Exception_Compiler('The first argument to average must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1158 |
}
|
1159 |
-
if (!$color2 instanceof Less_Tree_Color) {
|
1160 |
-
throw new Less_Exception_Compiler('The second argument to average must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1161 |
}
|
1162 |
|
1163 |
-
return $this->colorBlend( array($this,'colorBlendAverage'), $color1, $color2 );
|
1164 |
}
|
1165 |
|
1166 |
// non-w3c functions:
|
1167 |
-
public function colorBlendAverage($cb, $cs ){
|
1168 |
-
return ($cb + $cs) / 2;
|
1169 |
}
|
1170 |
|
1171 |
-
public function negation($color1 = null, $color2 = null ){
|
1172 |
-
if (!$color1 instanceof Less_Tree_Color) {
|
1173 |
-
throw new Less_Exception_Compiler('The first argument to negation must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1174 |
}
|
1175 |
-
if (!$color2 instanceof Less_Tree_Color) {
|
1176 |
-
throw new Less_Exception_Compiler('The second argument to negation must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') );
|
1177 |
}
|
1178 |
|
1179 |
-
return $this->colorBlend( array($this,'colorBlendNegation'), $color1, $color2 );
|
1180 |
}
|
1181 |
|
1182 |
-
public function colorBlendNegation($cb, $cs){
|
1183 |
-
return 1 - abs($cb + $cs - 1);
|
1184 |
}
|
1185 |
|
1186 |
// ~ End of Color Blending
|
7 |
* @subpackage function
|
8 |
* @see http://lesscss.org/functions/
|
9 |
*/
|
10 |
+
class Less_Functions {
|
11 |
|
12 |
public $env;
|
13 |
public $currentFileInfo;
|
14 |
|
15 |
+
function __construct( $env, $currentFileInfo = null ) {
|
16 |
$this->env = $env;
|
17 |
$this->currentFileInfo = $currentFileInfo;
|
18 |
}
|
20 |
/**
|
21 |
* @param string $op
|
22 |
*/
|
23 |
+
public static function operate( $op, $a, $b ) {
|
24 |
+
switch ( $op ) {
|
25 |
+
case '+':
|
26 |
+
return $a + $b;
|
27 |
+
case '-':
|
28 |
+
return $a - $b;
|
29 |
+
case '*':
|
30 |
+
return $a * $b;
|
31 |
+
case '/':
|
32 |
+
return $a / $b;
|
33 |
}
|
34 |
}
|
35 |
|
36 |
+
public static function clamp( $val, $max = 1 ) {
|
37 |
+
return min( max( $val, 0 ), $max );
|
38 |
}
|
39 |
|
40 |
+
public static function fround( $value ) {
|
41 |
+
if ( $value === 0 ) {
|
|
|
42 |
return $value;
|
43 |
}
|
44 |
|
45 |
+
if ( Less_Parser::$options['numPrecision'] ) {
|
46 |
+
$p = pow( 10, Less_Parser::$options['numPrecision'] );
|
47 |
+
return round( $value * $p ) / $p;
|
48 |
}
|
49 |
return $value;
|
50 |
}
|
51 |
|
52 |
+
public static function number( $n ) {
|
53 |
+
if ( $n instanceof Less_Tree_Dimension ) {
|
54 |
+
return floatval( $n->unit->is( '%' ) ? $n->value / 100 : $n->value );
|
55 |
+
} else if ( is_numeric( $n ) ) {
|
|
|
56 |
return $n;
|
57 |
} else {
|
58 |
+
throw new Less_Exception_Compiler( "color functions take numbers as parameters" );
|
59 |
}
|
60 |
}
|
61 |
|
62 |
+
public static function scaled( $n, $size = 255 ) {
|
63 |
+
if ( $n instanceof Less_Tree_Dimension && $n->unit->is( '%' ) ) {
|
64 |
return (float)$n->value * $size / 100;
|
65 |
} else {
|
66 |
+
return Less_Functions::number( $n );
|
67 |
}
|
68 |
}
|
69 |
|
70 |
+
public function rgb( $r = null, $g = null, $b = null ) {
|
71 |
+
if ( is_null( $r ) || is_null( $g ) || is_null( $b ) ) {
|
72 |
+
throw new Less_Exception_Compiler( "rgb expects three parameters" );
|
73 |
}
|
74 |
+
return $this->rgba( $r, $g, $b, 1.0 );
|
75 |
}
|
76 |
|
77 |
+
public function rgba( $r = null, $g = null, $b = null, $a = null ) {
|
78 |
+
$rgb = array( $r, $g, $b );
|
79 |
+
$rgb = array_map( array( 'Less_Functions','scaled' ), $rgb );
|
80 |
|
81 |
+
$a = self::number( $a );
|
82 |
+
return new Less_Tree_Color( $rgb, $a );
|
83 |
}
|
84 |
|
85 |
+
public function hsl( $h, $s, $l ) {
|
86 |
+
return $this->hsla( $h, $s, $l, 1.0 );
|
87 |
}
|
88 |
|
89 |
+
public function hsla( $h, $s, $l, $a ) {
|
90 |
+
$h = fmod( self::number( $h ), 360 ) / 360; // Classic % operator will change float to int
|
91 |
+
$s = self::clamp( self::number( $s ) );
|
92 |
+
$l = self::clamp( self::number( $l ) );
|
93 |
+
$a = self::clamp( self::number( $a ) );
|
94 |
|
95 |
+
$m2 = $l <= 0.5 ? $l * ( $s + 1 ) : $l + $s - $l * $s;
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
$m1 = $l * 2 - $m2;
|
98 |
|
99 |
+
return $this->rgba( self::hsla_hue( $h + 1 / 3, $m1, $m2 ) * 255,
|
100 |
+
self::hsla_hue( $h, $m1, $m2 ) * 255,
|
101 |
+
self::hsla_hue( $h - 1 / 3, $m1, $m2 ) * 255,
|
102 |
+
$a );
|
103 |
}
|
104 |
|
105 |
/**
|
106 |
* @param double $h
|
107 |
*/
|
108 |
+
public function hsla_hue( $h, $m1, $m2 ) {
|
109 |
+
$h = $h < 0 ? $h + 1 : ( $h > 1 ? $h - 1 : $h );
|
110 |
+
if ( $h * 6 < 1 ) return $m1 + ( $m2 - $m1 ) * $h * 6; else if ( $h * 2 < 1 ) return $m2; else if ( $h * 3 < 2 ) return $m1 + ( $m2 - $m1 ) * ( 2 / 3 - $h ) * 6; else return $m1;
|
|
|
|
|
|
|
111 |
}
|
112 |
|
113 |
+
public function hsv( $h, $s, $v ) {
|
114 |
+
return $this->hsva( $h, $s, $v, 1.0 );
|
115 |
}
|
116 |
|
117 |
/**
|
118 |
* @param double $a
|
119 |
*/
|
120 |
+
public function hsva( $h, $s, $v, $a ) {
|
121 |
+
$h = ( ( Less_Functions::number( $h ) % 360 ) / 360 ) * 360;
|
122 |
+
$s = Less_Functions::number( $s );
|
123 |
+
$v = Less_Functions::number( $v );
|
124 |
+
$a = Less_Functions::number( $a );
|
125 |
|
126 |
+
$i = floor( ( $h / 60 ) % 6 );
|
127 |
+
$f = ( $h / 60 ) - $i;
|
128 |
|
129 |
$vs = array( $v,
|
130 |
+
$v * ( 1 - $s ),
|
131 |
+
$v * ( 1 - $f * $s ),
|
132 |
+
$v * ( 1 - ( 1 - $f ) * $s ) );
|
133 |
+
|
134 |
+
$perm = array( array( 0, 3, 1 ),
|
135 |
+
array( 2, 0, 1 ),
|
136 |
+
array( 1, 0, 3 ),
|
137 |
+
array( 1, 2, 0 ),
|
138 |
+
array( 3, 1, 0 ),
|
139 |
+
array( 0, 1, 2 ) );
|
140 |
+
|
141 |
+
return $this->rgba( $vs[$perm[$i][0]] * 255,
|
142 |
$vs[$perm[$i][1]] * 255,
|
143 |
$vs[$perm[$i][2]] * 255,
|
144 |
+
$a );
|
145 |
}
|
146 |
|
147 |
+
public function hue( $color = null ) {
|
148 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
149 |
+
throw new Less_Exception_Compiler( 'The first argument to hue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
150 |
}
|
151 |
|
152 |
$c = $color->toHSL();
|
153 |
+
return new Less_Tree_Dimension( Less_Parser::round( $c['h'] ) );
|
154 |
}
|
155 |
|
156 |
+
public function saturation( $color = null ) {
|
157 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
158 |
+
throw new Less_Exception_Compiler( 'The first argument to saturation must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
159 |
}
|
160 |
|
161 |
$c = $color->toHSL();
|
162 |
+
return new Less_Tree_Dimension( Less_Parser::round( $c['s'] * 100 ), '%' );
|
163 |
}
|
164 |
|
165 |
+
public function lightness( $color = null ) {
|
166 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
167 |
+
throw new Less_Exception_Compiler( 'The first argument to lightness must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
168 |
}
|
169 |
|
170 |
$c = $color->toHSL();
|
171 |
+
return new Less_Tree_Dimension( Less_Parser::round( $c['l'] * 100 ), '%' );
|
172 |
}
|
173 |
|
174 |
+
public function hsvhue( $color = null ) {
|
175 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
176 |
+
throw new Less_Exception_Compiler( 'The first argument to hsvhue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
177 |
}
|
178 |
|
179 |
$hsv = $color->toHSV();
|
180 |
+
return new Less_Tree_Dimension( Less_Parser::round( $hsv['h'] ) );
|
181 |
}
|
182 |
|
183 |
+
public function hsvsaturation( $color = null ) {
|
184 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
185 |
+
throw new Less_Exception_Compiler( 'The first argument to hsvsaturation must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
|
|
186 |
}
|
187 |
|
188 |
$hsv = $color->toHSV();
|
189 |
+
return new Less_Tree_Dimension( Less_Parser::round( $hsv['s'] * 100 ), '%' );
|
190 |
}
|
191 |
|
192 |
+
public function hsvvalue( $color = null ) {
|
193 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
194 |
+
throw new Less_Exception_Compiler( 'The first argument to hsvvalue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
195 |
}
|
196 |
|
197 |
$hsv = $color->toHSV();
|
198 |
+
return new Less_Tree_Dimension( Less_Parser::round( $hsv['v'] * 100 ), '%' );
|
199 |
}
|
200 |
|
201 |
+
public function red( $color = null ) {
|
202 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
203 |
+
throw new Less_Exception_Compiler( 'The first argument to red must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
204 |
}
|
205 |
|
206 |
return new Less_Tree_Dimension( $color->rgb[0] );
|
207 |
}
|
208 |
|
209 |
+
public function green( $color = null ) {
|
210 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
211 |
+
throw new Less_Exception_Compiler( 'The first argument to green must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
212 |
}
|
213 |
|
214 |
return new Less_Tree_Dimension( $color->rgb[1] );
|
215 |
}
|
216 |
|
217 |
+
public function blue( $color = null ) {
|
218 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
219 |
+
throw new Less_Exception_Compiler( 'The first argument to blue must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
220 |
}
|
221 |
|
222 |
return new Less_Tree_Dimension( $color->rgb[2] );
|
223 |
}
|
224 |
|
225 |
+
public function alpha( $color = null ) {
|
226 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
227 |
+
throw new Less_Exception_Compiler( 'The first argument to alpha must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
228 |
}
|
229 |
|
230 |
$c = $color->toHSL();
|
231 |
+
return new Less_Tree_Dimension( $c['a'] );
|
232 |
}
|
233 |
|
234 |
+
public function luma( $color = null ) {
|
235 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
236 |
+
throw new Less_Exception_Compiler( 'The first argument to luma must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
237 |
}
|
238 |
|
239 |
+
return new Less_Tree_Dimension( Less_Parser::round( $color->luma() * $color->alpha * 100 ), '%' );
|
240 |
}
|
241 |
|
242 |
+
public function luminance( $color = null ) {
|
243 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
244 |
+
throw new Less_Exception_Compiler( 'The first argument to luminance must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
245 |
}
|
246 |
|
247 |
$luminance =
|
248 |
+
( 0.2126 * $color->rgb[0] / 255 )
|
249 |
+
+ ( 0.7152 * $color->rgb[1] / 255 )
|
250 |
+
+ ( 0.0722 * $color->rgb[2] / 255 );
|
251 |
|
252 |
+
return new Less_Tree_Dimension( Less_Parser::round( $luminance * $color->alpha * 100 ), '%' );
|
253 |
}
|
254 |
|
255 |
+
public function saturate( $color = null, $amount = null ) {
|
256 |
// filter: saturate(3.2);
|
257 |
// should be kept as is, so check for color
|
258 |
+
if ( $color instanceof Less_Tree_Dimension ) {
|
259 |
return null;
|
260 |
}
|
261 |
|
262 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
263 |
+
throw new Less_Exception_Compiler( 'The first argument to saturate must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
264 |
}
|
265 |
+
if ( !$amount instanceof Less_Tree_Dimension ) {
|
266 |
+
throw new Less_Exception_Compiler( 'The second argument to saturate must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
267 |
}
|
268 |
|
269 |
$hsl = $color->toHSL();
|
270 |
|
271 |
$hsl['s'] += $amount->value / 100;
|
272 |
+
$hsl['s'] = self::clamp( $hsl['s'] );
|
273 |
|
274 |
+
return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] );
|
275 |
}
|
276 |
|
277 |
/**
|
278 |
* @param Less_Tree_Dimension $amount
|
279 |
*/
|
280 |
+
public function desaturate( $color = null, $amount = null ) {
|
281 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
282 |
+
throw new Less_Exception_Compiler( 'The first argument to desaturate must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
283 |
}
|
284 |
+
if ( !$amount instanceof Less_Tree_Dimension ) {
|
285 |
+
throw new Less_Exception_Compiler( 'The second argument to desaturate must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
286 |
}
|
287 |
|
288 |
$hsl = $color->toHSL();
|
289 |
|
290 |
$hsl['s'] -= $amount->value / 100;
|
291 |
+
$hsl['s'] = self::clamp( $hsl['s'] );
|
292 |
|
293 |
+
return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] );
|
294 |
}
|
295 |
|
296 |
+
public function lighten( $color = null, $amount = null ) {
|
297 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
298 |
+
throw new Less_Exception_Compiler( 'The first argument to lighten must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
|
|
|
|
299 |
}
|
300 |
+
if ( !$amount instanceof Less_Tree_Dimension ) {
|
301 |
+
throw new Less_Exception_Compiler( 'The second argument to lighten must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
302 |
}
|
303 |
|
304 |
$hsl = $color->toHSL();
|
305 |
|
306 |
$hsl['l'] += $amount->value / 100;
|
307 |
+
$hsl['l'] = self::clamp( $hsl['l'] );
|
308 |
|
309 |
+
return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] );
|
310 |
}
|
311 |
|
312 |
+
public function darken( $color = null, $amount = null ) {
|
313 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
314 |
+
throw new Less_Exception_Compiler( 'The first argument to darken must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
315 |
}
|
316 |
+
if ( !$amount instanceof Less_Tree_Dimension ) {
|
317 |
+
throw new Less_Exception_Compiler( 'The second argument to darken must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
318 |
}
|
319 |
|
320 |
$hsl = $color->toHSL();
|
321 |
$hsl['l'] -= $amount->value / 100;
|
322 |
+
$hsl['l'] = self::clamp( $hsl['l'] );
|
323 |
|
324 |
+
return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] );
|
325 |
}
|
326 |
|
327 |
+
public function fadein( $color = null, $amount = null ) {
|
328 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
329 |
+
throw new Less_Exception_Compiler( 'The first argument to fadein must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
330 |
}
|
331 |
+
if ( !$amount instanceof Less_Tree_Dimension ) {
|
332 |
+
throw new Less_Exception_Compiler( 'The second argument to fadein must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
333 |
}
|
334 |
|
335 |
$hsl = $color->toHSL();
|
336 |
$hsl['a'] += $amount->value / 100;
|
337 |
+
$hsl['a'] = self::clamp( $hsl['a'] );
|
338 |
+
return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] );
|
339 |
}
|
340 |
|
341 |
+
public function fadeout( $color = null, $amount = null ) {
|
342 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
343 |
+
throw new Less_Exception_Compiler( 'The first argument to fadeout must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
344 |
}
|
345 |
+
if ( !$amount instanceof Less_Tree_Dimension ) {
|
346 |
+
throw new Less_Exception_Compiler( 'The second argument to fadeout must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
347 |
}
|
348 |
|
349 |
$hsl = $color->toHSL();
|
350 |
$hsl['a'] -= $amount->value / 100;
|
351 |
+
$hsl['a'] = self::clamp( $hsl['a'] );
|
352 |
+
return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] );
|
353 |
}
|
354 |
|
355 |
+
public function fade( $color = null, $amount = null ) {
|
356 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
357 |
+
throw new Less_Exception_Compiler( 'The first argument to fade must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
358 |
}
|
359 |
+
if ( !$amount instanceof Less_Tree_Dimension ) {
|
360 |
+
throw new Less_Exception_Compiler( 'The second argument to fade must be a percentage' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
361 |
}
|
362 |
|
363 |
$hsl = $color->toHSL();
|
364 |
|
365 |
$hsl['a'] = $amount->value / 100;
|
366 |
+
$hsl['a'] = self::clamp( $hsl['a'] );
|
367 |
+
return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] );
|
368 |
}
|
369 |
|
370 |
+
public function spin( $color = null, $amount = null ) {
|
371 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
372 |
+
throw new Less_Exception_Compiler( 'The first argument to spin must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
|
|
|
|
373 |
}
|
374 |
+
if ( !$amount instanceof Less_Tree_Dimension ) {
|
375 |
+
throw new Less_Exception_Compiler( 'The second argument to spin must be a number' . ( $amount instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
376 |
}
|
377 |
|
378 |
$hsl = $color->toHSL();
|
379 |
+
$hue = fmod( $hsl['h'] + $amount->value, 360 );
|
380 |
|
381 |
$hsl['h'] = $hue < 0 ? 360 + $hue : $hue;
|
382 |
|
383 |
+
return $this->hsla( $hsl['h'], $hsl['s'], $hsl['l'], $hsl['a'] );
|
384 |
}
|
385 |
|
386 |
//
|
391 |
/**
|
392 |
* @param Less_Tree_Color $color1
|
393 |
*/
|
394 |
+
public function mix( $color1 = null, $color2 = null, $weight = null ) {
|
395 |
+
if ( !$color1 instanceof Less_Tree_Color ) {
|
396 |
+
throw new Less_Exception_Compiler( 'The first argument to mix must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
397 |
}
|
398 |
+
if ( !$color2 instanceof Less_Tree_Color ) {
|
399 |
+
throw new Less_Exception_Compiler( 'The second argument to mix must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
400 |
}
|
401 |
+
if ( !$weight ) {
|
402 |
+
$weight = new Less_Tree_Dimension( '50', '%' );
|
403 |
}
|
404 |
+
if ( !$weight instanceof Less_Tree_Dimension ) {
|
405 |
+
throw new Less_Exception_Compiler( 'The third argument to contrast must be a percentage' . ( $weight instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
406 |
}
|
407 |
|
408 |
$p = $weight->value / 100.0;
|
411 |
$hsl2 = $color2->toHSL();
|
412 |
$a = $hsl1['a'] - $hsl2['a'];
|
413 |
|
414 |
+
$w1 = ( ( ( ( $w * $a ) == -1 ) ? $w : ( $w + $a ) / ( 1 + $w * $a ) ) + 1 ) / 2;
|
415 |
$w2 = 1 - $w1;
|
416 |
|
417 |
+
$rgb = array( $color1->rgb[0] * $w1 + $color2->rgb[0] * $w2,
|
418 |
$color1->rgb[1] * $w1 + $color2->rgb[1] * $w2,
|
419 |
+
$color1->rgb[2] * $w1 + $color2->rgb[2] * $w2 );
|
420 |
|
421 |
+
$alpha = $color1->alpha * $p + $color2->alpha * ( 1 - $p );
|
422 |
|
423 |
+
return new Less_Tree_Color( $rgb, $alpha );
|
424 |
}
|
425 |
|
426 |
+
public function greyscale( $color ) {
|
427 |
+
return $this->desaturate( $color, new Less_Tree_Dimension( 100, '%' ) );
|
428 |
}
|
429 |
|
430 |
+
public function contrast( $color, $dark = null, $light = null, $threshold = null ) {
|
|
|
431 |
// filter: contrast(3.2);
|
432 |
// should be kept as is, so check for color
|
433 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
434 |
return null;
|
435 |
}
|
436 |
+
if ( !$light ) {
|
437 |
+
$light = $this->rgba( 255, 255, 255, 1.0 );
|
438 |
}
|
439 |
+
if ( !$dark ) {
|
440 |
+
$dark = $this->rgba( 0, 0, 0, 1.0 );
|
441 |
}
|
442 |
|
443 |
+
if ( !$dark instanceof Less_Tree_Color ) {
|
444 |
+
throw new Less_Exception_Compiler( 'The second argument to contrast must be a color' . ( $dark instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
445 |
}
|
446 |
+
if ( !$light instanceof Less_Tree_Color ) {
|
447 |
+
throw new Less_Exception_Compiler( 'The third argument to contrast must be a color' . ( $light instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
448 |
}
|
449 |
|
450 |
+
// Figure out which is actually light and dark!
|
451 |
+
if ( $dark->luma() > $light->luma() ) {
|
452 |
$t = $light;
|
453 |
$light = $dark;
|
454 |
$dark = $t;
|
455 |
}
|
456 |
+
if ( !$threshold ) {
|
457 |
$threshold = 0.43;
|
458 |
} else {
|
459 |
+
$threshold = Less_Functions::number( $threshold );
|
460 |
}
|
461 |
|
462 |
+
if ( $color->luma() < $threshold ) {
|
463 |
return $light;
|
464 |
} else {
|
465 |
return $dark;
|
466 |
}
|
467 |
}
|
468 |
|
469 |
+
public function e( $str ) {
|
470 |
+
if ( is_string( $str ) ) {
|
471 |
+
return new Less_Tree_Anonymous( $str );
|
472 |
}
|
473 |
+
return new Less_Tree_Anonymous( $str instanceof Less_Tree_JavaScript ? $str->expression : $str->value );
|
474 |
}
|
475 |
|
476 |
+
public function escape( $str ) {
|
477 |
+
$revert = array( '%21' => '!', '%2A' => '*', '%27' => "'",'%3F' => '?','%26' => '&','%2C' => ',','%2F' => '/','%40' => '@','%2B' => '+','%24' => '$' );
|
|
|
478 |
|
479 |
+
return new Less_Tree_Anonymous( strtr( rawurlencode( $str->value ), $revert ) );
|
480 |
}
|
481 |
|
|
|
482 |
/**
|
483 |
* todo: This function will need some additional work to make it work the same as less.js
|
484 |
*
|
485 |
*/
|
486 |
+
public function replace( $string, $pattern, $replacement, $flags = null ) {
|
487 |
$result = $string->value;
|
488 |
|
489 |
+
$expr = '/'.str_replace( '/', '\\/', $pattern->value ).'/';
|
490 |
+
if ( $flags && $flags->value ) {
|
491 |
+
$expr .= self::replace_flags( $flags->value );
|
492 |
}
|
493 |
|
494 |
+
$result = preg_replace( $expr, $replacement->value, $result );
|
|
|
495 |
|
496 |
+
if ( property_exists( $string, 'quote' ) ) {
|
497 |
+
return new Less_Tree_Quoted( $string->quote, $result, $string->escaped );
|
498 |
}
|
499 |
return new Less_Tree_Quoted( '', $result );
|
500 |
}
|
501 |
|
502 |
+
public static function replace_flags( $flags ) {
|
503 |
+
$flags = str_split( $flags, 1 );
|
504 |
$new_flags = '';
|
505 |
|
506 |
+
foreach ( $flags as $flag ) {
|
507 |
+
switch ( $flag ) {
|
508 |
case 'e':
|
509 |
case 'g':
|
510 |
break;
|
518 |
return $new_flags;
|
519 |
}
|
520 |
|
521 |
+
public function _percent() {
|
522 |
+
$string = func_get_arg( 0 );
|
523 |
|
524 |
$args = func_get_args();
|
525 |
+
array_shift( $args );
|
526 |
$result = $string->value;
|
527 |
|
528 |
+
foreach ( $args as $arg ) {
|
529 |
+
if ( preg_match( '/%[sda]/i', $result, $token ) ) {
|
530 |
$token = $token[0];
|
531 |
+
$value = stristr( $token, 's' ) ? $arg->value : $arg->toCSS();
|
532 |
+
$value = preg_match( '/[A-Z]$/', $token ) ? urlencode( $value ) : $value;
|
533 |
+
$result = preg_replace( '/%[sda]/i', $value, $result, 1 );
|
534 |
}
|
535 |
}
|
536 |
+
$result = str_replace( '%%', '%', $result );
|
537 |
|
538 |
+
return new Less_Tree_Quoted( $string->quote, $result, $string->escaped );
|
539 |
}
|
540 |
|
541 |
+
public function unit( $val, $unit = null ) {
|
542 |
+
if ( !( $val instanceof Less_Tree_Dimension ) ) {
|
543 |
+
throw new Less_Exception_Compiler( 'The first argument to unit must be a number' . ( $val instanceof Less_Tree_Operation ? '. Have you forgotten parenthesis?' : '.' ) );
|
544 |
}
|
545 |
|
546 |
+
if ( $unit ) {
|
547 |
+
if ( $unit instanceof Less_Tree_Keyword ) {
|
548 |
$unit = $unit->value;
|
549 |
} else {
|
550 |
$unit = $unit->toCSS();
|
552 |
} else {
|
553 |
$unit = "";
|
554 |
}
|
555 |
+
return new Less_Tree_Dimension( $val->value, $unit );
|
556 |
}
|
557 |
|
558 |
+
public function convert( $val, $unit ) {
|
559 |
+
return $val->convertTo( $unit->value );
|
560 |
}
|
561 |
|
562 |
+
public function round( $n, $f = false ) {
|
|
|
563 |
$fraction = 0;
|
564 |
+
if ( $f !== false ) {
|
565 |
$fraction = $f->value;
|
566 |
}
|
567 |
|
568 |
+
return $this->_math( 'Less_Parser::round', null, $n, $fraction );
|
569 |
}
|
570 |
|
571 |
+
public function pi() {
|
572 |
+
return new Less_Tree_Dimension( M_PI );
|
573 |
}
|
574 |
|
575 |
+
public function mod( $a, $b ) {
|
576 |
+
return new Less_Tree_Dimension( $a->value % $b->value, $a->unit );
|
577 |
}
|
578 |
|
579 |
+
public function pow( $x, $y ) {
|
580 |
+
if ( is_numeric( $x ) && is_numeric( $y ) ) {
|
581 |
+
$x = new Less_Tree_Dimension( $x );
|
582 |
+
$y = new Less_Tree_Dimension( $y );
|
583 |
+
} elseif ( !( $x instanceof Less_Tree_Dimension ) || !( $y instanceof Less_Tree_Dimension ) ) {
|
584 |
+
throw new Less_Exception_Compiler( 'Arguments must be numbers' );
|
|
|
|
|
585 |
}
|
586 |
|
587 |
+
return new Less_Tree_Dimension( pow( $x->value, $y->value ), $x->unit );
|
588 |
}
|
589 |
|
590 |
// var mathFunctions = [{name:"ce ...
|
591 |
+
public function ceil( $n ) {
|
592 |
+
return $this->_math( 'ceil', null, $n );
|
593 |
+
}
|
594 |
+
|
595 |
+
public function floor( $n ) {
|
596 |
+
return $this->_math( 'floor', null, $n );
|
597 |
+
}
|
598 |
+
|
599 |
+
public function sqrt( $n ) {
|
600 |
+
return $this->_math( 'sqrt', null, $n );
|
601 |
+
}
|
602 |
+
|
603 |
+
public function abs( $n ) {
|
604 |
+
return $this->_math( 'abs', null, $n );
|
605 |
+
}
|
606 |
|
607 |
+
public function tan( $n ) {
|
608 |
+
return $this->_math( 'tan', '', $n );
|
609 |
+
}
|
610 |
|
611 |
+
public function sin( $n ) {
|
612 |
+
return $this->_math( 'sin', '', $n );
|
613 |
+
}
|
614 |
+
|
615 |
+
public function cos( $n ) {
|
616 |
+
return $this->_math( 'cos', '', $n );
|
617 |
+
}
|
618 |
+
|
619 |
+
public function atan( $n ) {
|
620 |
+
return $this->_math( 'atan', 'rad', $n );
|
621 |
+
}
|
622 |
+
|
623 |
+
public function asin( $n ) {
|
624 |
+
return $this->_math( 'asin', 'rad', $n );
|
625 |
+
}
|
626 |
+
|
627 |
+
public function acos( $n ) {
|
628 |
+
return $this->_math( 'acos', 'rad', $n );
|
629 |
+
}
|
630 |
|
631 |
private function _math() {
|
632 |
$args = func_get_args();
|
633 |
+
$fn = array_shift( $args );
|
634 |
+
$unit = array_shift( $args );
|
635 |
|
636 |
+
if ( $args[0] instanceof Less_Tree_Dimension ) {
|
637 |
|
638 |
+
if ( $unit === null ) {
|
639 |
$unit = $args[0]->unit;
|
640 |
+
} else {
|
641 |
$args[0] = $args[0]->unify();
|
642 |
}
|
643 |
$args[0] = (float)$args[0]->value;
|
644 |
+
return new Less_Tree_Dimension( call_user_func_array( $fn, $args ), $unit );
|
645 |
+
} else if ( is_numeric( $args[0] ) ) {
|
646 |
+
return call_user_func_array( $fn, $args );
|
647 |
} else {
|
648 |
+
throw new Less_Exception_Compiler( "math functions take numbers as parameters" );
|
649 |
}
|
650 |
}
|
651 |
|
652 |
/**
|
653 |
* @param boolean $isMin
|
654 |
*/
|
655 |
+
private function _minmax( $isMin, $args ) {
|
656 |
+
$arg_count = count( $args );
|
|
|
657 |
|
658 |
+
if ( $arg_count < 1 ) {
|
659 |
+
throw new Less_Exception_Compiler( 'one or more arguments required' );
|
660 |
}
|
661 |
|
662 |
$j = null;
|
663 |
$unitClone = null;
|
664 |
$unitStatic = null;
|
665 |
|
|
|
666 |
$order = array(); // elems only contains original argument values.
|
667 |
$values = array(); // key is the unit.toString() for unified tree.Dimension values,
|
668 |
// value is the index into the order array.
|
669 |
|
670 |
+
for ( $i = 0; $i < $arg_count; $i++ ) {
|
|
|
671 |
$current = $args[$i];
|
672 |
+
if ( !( $current instanceof Less_Tree_Dimension ) ) {
|
673 |
+
if ( is_array( $args[$i]->value ) ) {
|
674 |
$args[] = $args[$i]->value;
|
675 |
}
|
676 |
continue;
|
677 |
}
|
678 |
|
679 |
+
if ( $current->unit->toString() === '' && !$unitClone ) {
|
680 |
+
$temp = new Less_Tree_Dimension( $current->value, $unitClone );
|
681 |
$currentUnified = $temp->unify();
|
682 |
+
} else {
|
683 |
$currentUnified = $current->unify();
|
684 |
}
|
685 |
|
686 |
+
if ( $currentUnified->unit->toString() === "" && !$unitStatic ) {
|
687 |
$unit = $unitStatic;
|
688 |
+
} else {
|
689 |
$unit = $currentUnified->unit->toString();
|
690 |
}
|
691 |
|
692 |
+
if ( $unit !== '' && !$unitStatic || $unit !== '' && $order[0]->unify()->unit->toString() === "" ) {
|
693 |
$unitStatic = $unit;
|
694 |
}
|
695 |
|
696 |
+
if ( $unit != '' && !$unitClone ) {
|
697 |
$unitClone = $current->unit->toString();
|
698 |
}
|
699 |
|
700 |
+
if ( isset( $values[''] ) && $unit !== '' && $unit === $unitStatic ) {
|
701 |
$j = $values[''];
|
702 |
+
} elseif ( isset( $values[$unit] ) ) {
|
703 |
$j = $values[$unit];
|
704 |
+
} else {
|
705 |
|
706 |
+
if ( $unitStatic && $unit !== $unitStatic ) {
|
707 |
+
throw new Less_Exception_Compiler( 'incompatible types' );
|
708 |
}
|
709 |
+
$values[$unit] = count( $order );
|
710 |
$order[] = $current;
|
711 |
continue;
|
712 |
}
|
713 |
|
714 |
+
if ( $order[$j]->unit->toString() === "" && $unitClone ) {
|
715 |
+
$temp = new Less_Tree_Dimension( $order[$j]->value, $unitClone );
|
|
|
716 |
$referenceUnified = $temp->unify();
|
717 |
+
} else {
|
718 |
$referenceUnified = $order[$j]->unify();
|
719 |
}
|
720 |
+
if ( ( $isMin && $currentUnified->value < $referenceUnified->value ) || ( !$isMin && $currentUnified->value > $referenceUnified->value ) ) {
|
721 |
$order[$j] = $current;
|
722 |
}
|
723 |
}
|
724 |
|
725 |
+
if ( count( $order ) == 1 ) {
|
726 |
return $order[0];
|
727 |
}
|
728 |
$args = array();
|
729 |
+
foreach ( $order as $a ) {
|
730 |
+
$args[] = $a->toCSS( $this->env );
|
731 |
}
|
732 |
+
return new Less_Tree_Anonymous( ( $isMin ? 'min(' : 'max(' ) . implode( Less_Environment::$_outputMap[','], $args ).')' );
|
733 |
}
|
734 |
|
735 |
+
public function min() {
|
736 |
$args = func_get_args();
|
737 |
return $this->_minmax( true, $args );
|
738 |
}
|
739 |
|
740 |
+
public function max() {
|
741 |
$args = func_get_args();
|
742 |
return $this->_minmax( false, $args );
|
743 |
}
|
744 |
|
745 |
+
public function getunit( $n ) {
|
746 |
+
return new Less_Tree_Anonymous( $n->unit );
|
747 |
}
|
748 |
|
749 |
+
public function argb( $color ) {
|
750 |
+
if ( !$color instanceof Less_Tree_Color ) {
|
751 |
+
throw new Less_Exception_Compiler( 'The first argument to argb must be a color' . ( $color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
752 |
}
|
753 |
|
754 |
+
return new Less_Tree_Anonymous( $color->toARGB() );
|
755 |
}
|
756 |
|
757 |
+
public function percentage( $n ) {
|
758 |
+
return new Less_Tree_Dimension( $n->value * 100, '%' );
|
759 |
}
|
760 |
|
761 |
+
public function color( $n ) {
|
762 |
+
if ( $n instanceof Less_Tree_Quoted ) {
|
|
|
763 |
$colorCandidate = $n->value;
|
764 |
+
$returnColor = Less_Tree_Color::fromKeyword( $colorCandidate );
|
765 |
+
if ( $returnColor ) {
|
766 |
return $returnColor;
|
767 |
}
|
768 |
+
if ( preg_match( '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/', $colorCandidate ) ) {
|
769 |
+
return new Less_Tree_Color( substr( $colorCandidate, 1 ) );
|
770 |
}
|
771 |
+
throw new Less_Exception_Compiler( "argument must be a color keyword or 3/6 digit hex e.g. #FFF" );
|
772 |
} else {
|
773 |
+
throw new Less_Exception_Compiler( "argument must be a string" );
|
774 |
}
|
775 |
}
|
776 |
|
777 |
+
public function iscolor( $n ) {
|
778 |
+
return $this->_isa( $n, 'Less_Tree_Color' );
|
|
|
779 |
}
|
780 |
|
781 |
+
public function isnumber( $n ) {
|
782 |
+
return $this->_isa( $n, 'Less_Tree_Dimension' );
|
783 |
}
|
784 |
|
785 |
+
public function isstring( $n ) {
|
786 |
+
return $this->_isa( $n, 'Less_Tree_Quoted' );
|
787 |
}
|
788 |
|
789 |
+
public function iskeyword( $n ) {
|
790 |
+
return $this->_isa( $n, 'Less_Tree_Keyword' );
|
791 |
}
|
792 |
|
793 |
+
public function isurl( $n ) {
|
794 |
+
return $this->_isa( $n, 'Less_Tree_Url' );
|
795 |
}
|
796 |
|
797 |
+
public function ispixel( $n ) {
|
798 |
+
return $this->isunit( $n, 'px' );
|
799 |
}
|
800 |
|
801 |
+
public function ispercentage( $n ) {
|
802 |
+
return $this->isunit( $n, '%' );
|
803 |
}
|
804 |
|
805 |
+
public function isem( $n ) {
|
806 |
+
return $this->isunit( $n, 'em' );
|
807 |
}
|
808 |
|
809 |
/**
|
810 |
* @param string $unit
|
811 |
*/
|
812 |
+
public function isunit( $n, $unit ) {
|
813 |
+
if ( is_object( $unit ) && property_exists( $unit, 'value' ) ) {
|
|
|
814 |
$unit = $unit->value;
|
815 |
}
|
816 |
|
817 |
+
return ( $n instanceof Less_Tree_Dimension ) && $n->unit->is( $unit ) ? new Less_Tree_Keyword( 'true' ) : new Less_Tree_Keyword( 'false' );
|
818 |
}
|
819 |
|
820 |
/**
|
821 |
* @param string $type
|
822 |
*/
|
823 |
+
private function _isa( $n, $type ) {
|
824 |
+
return is_a( $n, $type ) ? new Less_Tree_Keyword( 'true' ) : new Less_Tree_Keyword( 'false' );
|
825 |
}
|
826 |
|
827 |
+
public function tint( $color, $amount = null ) {
|
828 |
+
return $this->mix( $this->rgb( 255, 255, 255 ), $color, $amount );
|
829 |
}
|
830 |
|
831 |
+
public function shade( $color, $amount = null ) {
|
832 |
+
return $this->mix( $this->rgb( 0, 0, 0 ), $color, $amount );
|
833 |
}
|
834 |
|
835 |
+
public function extract( $values, $index ) {
|
836 |
$index = (int)$index->value - 1; // (1-based index)
|
837 |
// handle non-array values as an array of length 1
|
838 |
// return 'undefined' if index is invalid
|
839 |
+
if ( property_exists( $values, 'value' ) && is_array( $values->value ) ) {
|
840 |
+
if ( isset( $values->value[$index] ) ) {
|
841 |
return $values->value[$index];
|
842 |
}
|
843 |
return null;
|
844 |
|
845 |
+
} elseif ( (int)$index === 0 ) {
|
846 |
return $values;
|
847 |
}
|
848 |
|
849 |
return null;
|
850 |
}
|
851 |
|
852 |
+
public function length( $values ) {
|
853 |
+
$n = ( property_exists( $values, 'value' ) && is_array( $values->value ) ) ? count( $values->value ) : 1;
|
854 |
+
return new Less_Tree_Dimension( $n );
|
855 |
}
|
856 |
|
857 |
+
public function datauri( $mimetypeNode, $filePathNode = null ) {
|
|
|
858 |
$filePath = ( $filePathNode ? $filePathNode->value : null );
|
859 |
$mimetype = $mimetypeNode->value;
|
860 |
|
861 |
$args = 2;
|
862 |
+
if ( !$filePath ) {
|
863 |
$filePath = $mimetype;
|
864 |
$args = 1;
|
865 |
}
|
866 |
|
867 |
+
$filePath = str_replace( '\\', '/', $filePath );
|
868 |
+
if ( Less_Environment::isPathRelative( $filePath ) ) {
|
869 |
|
870 |
+
if ( Less_Parser::$options['relativeUrls'] ) {
|
871 |
$temp = $this->currentFileInfo['currentDirectory'];
|
872 |
} else {
|
873 |
$temp = $this->currentFileInfo['entryPath'];
|
874 |
}
|
875 |
|
876 |
+
if ( !empty( $temp ) ) {
|
877 |
+
$filePath = Less_Environment::normalizePath( rtrim( $temp, '/' ).'/'.$filePath );
|
878 |
}
|
879 |
|
880 |
}
|
881 |
|
|
|
882 |
// detect the mimetype if not given
|
883 |
+
if ( $args < 2 ) {
|
884 |
|
885 |
/* incomplete
|
886 |
$mime = require('mime');
|
892 |
if (useBase64) mimetype += ';base64';
|
893 |
*/
|
894 |
|
895 |
+
$mimetype = Less_Mime::lookup( $filePath );
|
896 |
|
897 |
+
$charset = Less_Mime::charsets_lookup( $mimetype );
|
898 |
+
$useBase64 = !in_array( $charset, array( 'US-ASCII', 'UTF-8' ) );
|
899 |
+
if ( $useBase64 ) { $mimetype .= ';base64';
|
900 |
+
}
|
901 |
|
902 |
+
} else {
|
903 |
+
$useBase64 = preg_match( '/;base64$/', $mimetype );
|
904 |
}
|
905 |
|
906 |
+
if ( file_exists( $filePath ) ) {
|
907 |
+
$buf = @file_get_contents( $filePath );
|
908 |
+
} else {
|
|
|
909 |
$buf = false;
|
910 |
}
|
911 |
|
|
|
912 |
// IE8 cannot handle a data-uri larger than 32KB. If this is exceeded
|
913 |
// and the --ieCompat flag is enabled, return a normal url() instead.
|
914 |
$DATA_URI_MAX_KB = 32;
|
915 |
+
$fileSizeInKB = round( strlen( $buf ) / 1024 );
|
916 |
+
if ( $fileSizeInKB >= $DATA_URI_MAX_KB ) {
|
917 |
+
$url = new Less_Tree_Url( ( $filePathNode ? $filePathNode : $mimetypeNode ), $this->currentFileInfo );
|
918 |
+
return $url->compile( $this );
|
919 |
}
|
920 |
|
921 |
+
if ( $buf ) {
|
922 |
+
$buf = $useBase64 ? base64_encode( $buf ) : rawurlencode( $buf );
|
923 |
$filePath = '"data:' . $mimetype . ',' . $buf . '"';
|
924 |
}
|
925 |
|
926 |
+
return new Less_Tree_Url( new Less_Tree_Anonymous( $filePath ) );
|
927 |
}
|
928 |
|
929 |
+
// svg-gradient
|
930 |
+
public function svggradient( $direction ) {
|
|
|
931 |
$throw_message = 'svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]';
|
932 |
$arguments = func_get_args();
|
933 |
|
934 |
+
if ( count( $arguments ) < 3 ) {
|
935 |
throw new Less_Exception_Compiler( $throw_message );
|
936 |
}
|
937 |
|
938 |
+
$stops = array_slice( $arguments, 1 );
|
939 |
$gradientType = 'linear';
|
940 |
$rectangleDimension = 'x="0" y="0" width="1" height="1"';
|
941 |
$useBase64 = true;
|
942 |
$directionValue = $direction->toCSS();
|
943 |
|
944 |
+
switch ( $directionValue ) {
|
|
|
945 |
case "to bottom":
|
946 |
$gradientDirectionSvg = 'x1="0%" y1="0%" x2="0%" y2="100%"';
|
947 |
break;
|
968 |
'<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none">' .
|
969 |
'<' . $gradientType . 'Gradient id="gradient" gradientUnits="userSpaceOnUse" ' . $gradientDirectionSvg . '>';
|
970 |
|
971 |
+
for ( $i = 0; $i < count( $stops ); $i++ ) {
|
972 |
+
if ( is_object( $stops[$i] ) && property_exists( $stops[$i], 'value' ) ) {
|
973 |
$color = $stops[$i]->value[0];
|
974 |
$position = $stops[$i]->value[1];
|
975 |
+
} else {
|
976 |
$color = $stops[$i];
|
977 |
$position = null;
|
978 |
}
|
979 |
|
980 |
+
if ( !( $color instanceof Less_Tree_Color ) || ( !( ( $i === 0 || $i + 1 === count( $stops ) ) && $position === null ) && !( $position instanceof Less_Tree_Dimension ) ) ) {
|
981 |
throw new Less_Exception_Compiler( $throw_message );
|
982 |
}
|
983 |
+
if ( $position ) {
|
984 |
$positionValue = $position->toCSS();
|
985 |
+
} elseif ( $i === 0 ) {
|
986 |
$positionValue = '0%';
|
987 |
+
} else {
|
988 |
$positionValue = '100%';
|
989 |
}
|
990 |
$alpha = $color->alpha;
|
991 |
+
$returner .= '<stop offset="' . $positionValue . '" stop-color="' . $color->toRGB() . '"' . ( $alpha < 1 ? ' stop-opacity="' . $alpha . '"' : '' ) . '/>';
|
992 |
}
|
993 |
|
994 |
$returner .= '</' . $gradientType . 'Gradient><rect ' . $rectangleDimension . ' fill="url(#gradient)" /></svg>';
|
995 |
|
996 |
+
if ( $useBase64 ) {
|
997 |
+
$returner = "'data:image/svg+xml;base64,".base64_encode( $returner )."'";
|
998 |
+
} else {
|
|
|
999 |
$returner = "'data:image/svg+xml,".$returner."'";
|
1000 |
}
|
1001 |
|
1002 |
return new Less_Tree_URL( new Less_Tree_Anonymous( $returner ) );
|
1003 |
}
|
1004 |
|
|
|
1005 |
/**
|
1006 |
* Php version of javascript's `encodeURIComponent` function
|
1007 |
*
|
1008 |
* @param string $string The string to encode
|
1009 |
* @return string The encoded string
|
1010 |
*/
|
1011 |
+
public static function encodeURIComponent( $string ) {
|
1012 |
+
$revert = array( '%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')' );
|
1013 |
+
return strtr( rawurlencode( $string ), $revert );
|
1014 |
}
|
1015 |
|
|
|
1016 |
// Color Blending
|
1017 |
// ref: http://www.w3.org/TR/compositing-1
|
1018 |
|
1019 |
+
public function colorBlend( $mode, $color1, $color2 ) {
|
1020 |
$ab = $color1->alpha; // backdrop
|
1021 |
$as = $color2->alpha; // source
|
1022 |
$r = array(); // result
|
1023 |
|
1024 |
+
$ar = $as + $ab * ( 1 - $as );
|
1025 |
+
for ( $i = 0; $i < 3; $i++ ) {
|
1026 |
$cb = $color1->rgb[$i] / 255;
|
1027 |
$cs = $color2->rgb[$i] / 255;
|
1028 |
$cr = call_user_func( $mode, $cb, $cs );
|
1029 |
+
if ( $ar ) {
|
1030 |
+
$cr = ( $as * $cs + $ab * ( $cb - $as * ( $cb + $cs - $cr ) ) ) / $ar;
|
1031 |
}
|
1032 |
$r[$i] = $cr * 255;
|
1033 |
}
|
1034 |
|
1035 |
+
return new Less_Tree_Color( $r, $ar );
|
1036 |
}
|
1037 |
|
1038 |
+
public function multiply( $color1 = null, $color2 = null ) {
|
1039 |
+
if ( !$color1 instanceof Less_Tree_Color ) {
|
1040 |
+
throw new Less_Exception_Compiler( 'The first argument to multiply must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1041 |
}
|
1042 |
+
if ( !$color2 instanceof Less_Tree_Color ) {
|
1043 |
+
throw new Less_Exception_Compiler( 'The second argument to multiply must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1044 |
}
|
1045 |
|
1046 |
+
return $this->colorBlend( array( $this,'colorBlendMultiply' ), $color1, $color2 );
|
1047 |
}
|
1048 |
|
1049 |
+
private function colorBlendMultiply( $cb, $cs ) {
|
1050 |
return $cb * $cs;
|
1051 |
}
|
1052 |
|
1053 |
+
public function screen( $color1 = null, $color2 = null ) {
|
1054 |
+
if ( !$color1 instanceof Less_Tree_Color ) {
|
1055 |
+
throw new Less_Exception_Compiler( 'The first argument to screen must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1056 |
}
|
1057 |
+
if ( !$color2 instanceof Less_Tree_Color ) {
|
1058 |
+
throw new Less_Exception_Compiler( 'The second argument to screen must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1059 |
}
|
1060 |
|
1061 |
+
return $this->colorBlend( array( $this,'colorBlendScreen' ), $color1, $color2 );
|
1062 |
}
|
1063 |
|
1064 |
+
private function colorBlendScreen( $cb, $cs ) {
|
1065 |
return $cb + $cs - $cb * $cs;
|
1066 |
}
|
1067 |
|
1068 |
+
public function overlay( $color1 = null, $color2 = null ) {
|
1069 |
+
if ( !$color1 instanceof Less_Tree_Color ) {
|
1070 |
+
throw new Less_Exception_Compiler( 'The first argument to overlay must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1071 |
}
|
1072 |
+
if ( !$color2 instanceof Less_Tree_Color ) {
|
1073 |
+
throw new Less_Exception_Compiler( 'The second argument to overlay must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1074 |
}
|
1075 |
|
1076 |
+
return $this->colorBlend( array( $this,'colorBlendOverlay' ), $color1, $color2 );
|
1077 |
}
|
1078 |
|
1079 |
+
private function colorBlendOverlay( $cb, $cs ) {
|
1080 |
$cb *= 2;
|
1081 |
+
return ( $cb <= 1 )
|
1082 |
+
? $this->colorBlendMultiply( $cb, $cs )
|
1083 |
+
: $this->colorBlendScreen( $cb - 1, $cs );
|
1084 |
}
|
1085 |
|
1086 |
+
public function softlight( $color1 = null, $color2 = null ) {
|
1087 |
+
if ( !$color1 instanceof Less_Tree_Color ) {
|
1088 |
+
throw new Less_Exception_Compiler( 'The first argument to softlight must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1089 |
}
|
1090 |
+
if ( !$color2 instanceof Less_Tree_Color ) {
|
1091 |
+
throw new Less_Exception_Compiler( 'The second argument to softlight must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1092 |
}
|
1093 |
|
1094 |
+
return $this->colorBlend( array( $this,'colorBlendSoftlight' ), $color1, $color2 );
|
1095 |
}
|
1096 |
|
1097 |
+
private function colorBlendSoftlight( $cb, $cs ) {
|
1098 |
$d = 1;
|
1099 |
$e = $cb;
|
1100 |
+
if ( $cs > 0.5 ) {
|
1101 |
$e = 1;
|
1102 |
+
$d = ( $cb > 0.25 ) ? sqrt( $cb )
|
1103 |
+
: ( ( 16 * $cb - 12 ) * $cb + 4 ) * $cb;
|
1104 |
}
|
1105 |
+
return $cb - ( 1 - 2 * $cs ) * $e * ( $d - $cb );
|
1106 |
}
|
1107 |
|
1108 |
+
public function hardlight( $color1 = null, $color2 = null ) {
|
1109 |
+
if ( !$color1 instanceof Less_Tree_Color ) {
|
1110 |
+
throw new Less_Exception_Compiler( 'The first argument to hardlight must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1111 |
}
|
1112 |
+
if ( !$color2 instanceof Less_Tree_Color ) {
|
1113 |
+
throw new Less_Exception_Compiler( 'The second argument to hardlight must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1114 |
}
|
1115 |
|
1116 |
+
return $this->colorBlend( array( $this,'colorBlendHardlight' ), $color1, $color2 );
|
1117 |
}
|
1118 |
|
1119 |
+
private function colorBlendHardlight( $cb, $cs ) {
|
1120 |
+
return $this->colorBlendOverlay( $cs, $cb );
|
1121 |
}
|
1122 |
|
1123 |
+
public function difference( $color1 = null, $color2 = null ) {
|
1124 |
+
if ( !$color1 instanceof Less_Tree_Color ) {
|
1125 |
+
throw new Less_Exception_Compiler( 'The first argument to difference must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1126 |
}
|
1127 |
+
if ( !$color2 instanceof Less_Tree_Color ) {
|
1128 |
+
throw new Less_Exception_Compiler( 'The second argument to difference must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1129 |
}
|
1130 |
|
1131 |
+
return $this->colorBlend( array( $this,'colorBlendDifference' ), $color1, $color2 );
|
1132 |
}
|
1133 |
|
1134 |
+
private function colorBlendDifference( $cb, $cs ) {
|
1135 |
+
return abs( $cb - $cs );
|
1136 |
}
|
1137 |
|
1138 |
+
public function exclusion( $color1 = null, $color2 = null ) {
|
1139 |
+
if ( !$color1 instanceof Less_Tree_Color ) {
|
1140 |
+
throw new Less_Exception_Compiler( 'The first argument to exclusion must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1141 |
}
|
1142 |
+
if ( !$color2 instanceof Less_Tree_Color ) {
|
1143 |
+
throw new Less_Exception_Compiler( 'The second argument to exclusion must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1144 |
}
|
1145 |
|
1146 |
+
return $this->colorBlend( array( $this,'colorBlendExclusion' ), $color1, $color2 );
|
1147 |
}
|
1148 |
|
1149 |
+
private function colorBlendExclusion( $cb, $cs ) {
|
1150 |
return $cb + $cs - 2 * $cb * $cs;
|
1151 |
}
|
1152 |
|
1153 |
+
public function average( $color1 = null, $color2 = null ) {
|
1154 |
+
if ( !$color1 instanceof Less_Tree_Color ) {
|
1155 |
+
throw new Less_Exception_Compiler( 'The first argument to average must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1156 |
}
|
1157 |
+
if ( !$color2 instanceof Less_Tree_Color ) {
|
1158 |
+
throw new Less_Exception_Compiler( 'The second argument to average must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1159 |
}
|
1160 |
|
1161 |
+
return $this->colorBlend( array( $this,'colorBlendAverage' ), $color1, $color2 );
|
1162 |
}
|
1163 |
|
1164 |
// non-w3c functions:
|
1165 |
+
public function colorBlendAverage( $cb, $cs ) {
|
1166 |
+
return ( $cb + $cs ) / 2;
|
1167 |
}
|
1168 |
|
1169 |
+
public function negation( $color1 = null, $color2 = null ) {
|
1170 |
+
if ( !$color1 instanceof Less_Tree_Color ) {
|
1171 |
+
throw new Less_Exception_Compiler( 'The first argument to negation must be a color' . ( $color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1172 |
}
|
1173 |
+
if ( !$color2 instanceof Less_Tree_Color ) {
|
1174 |
+
throw new Less_Exception_Compiler( 'The second argument to negation must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
|
1175 |
}
|
1176 |
|
1177 |
+
return $this->colorBlend( array( $this,'colorBlendNegation' ), $color1, $color2 );
|
1178 |
}
|
1179 |
|
1180 |
+
public function colorBlendNegation( $cb, $cs ) {
|
1181 |
+
return 1 - abs( $cb + $cs - 1 );
|
1182 |
}
|
1183 |
|
1184 |
// ~ End of Color Blending
|
base/inc/lib/Less/Mime.php
CHANGED
@@ -6,36 +6,36 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage node
|
8 |
*/
|
9 |
-
class Less_Mime{
|
10 |
|
11 |
// this map is intentionally incomplete
|
12 |
// if you want more, install 'mime' dep
|
13 |
static $_types = array(
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
public static function lookup( $filepath ){
|
28 |
-
$parts = explode('.'
|
29 |
-
$ext = '.'.strtolower(array_pop($parts));
|
30 |
|
31 |
-
if( !isset(self::$_types[$ext]) ){
|
32 |
return null;
|
33 |
}
|
34 |
return self::$_types[$ext];
|
35 |
}
|
36 |
|
37 |
-
public static function charsets_lookup( $type = null ){
|
38 |
// assumes all text types are UTF-8
|
39 |
-
return $type && preg_match('/^text\//'
|
40 |
}
|
41 |
}
|
6 |
* @package Less
|
7 |
* @subpackage node
|
8 |
*/
|
9 |
+
class Less_Mime {
|
10 |
|
11 |
// this map is intentionally incomplete
|
12 |
// if you want more, install 'mime' dep
|
13 |
static $_types = array(
|
14 |
+
'.htm' => 'text/html',
|
15 |
+
'.html' => 'text/html',
|
16 |
+
'.gif' => 'image/gif',
|
17 |
+
'.jpg' => 'image/jpeg',
|
18 |
+
'.jpeg' => 'image/jpeg',
|
19 |
+
'.png' => 'image/png',
|
20 |
+
'.ttf' => 'application/x-font-ttf',
|
21 |
+
'.otf' => 'application/x-font-otf',
|
22 |
+
'.eot' => 'application/vnd.ms-fontobject',
|
23 |
+
'.woff' => 'application/x-font-woff',
|
24 |
+
'.svg' => 'image/svg+xml',
|
25 |
+
);
|
26 |
|
27 |
+
public static function lookup( $filepath ) {
|
28 |
+
$parts = explode( '.', $filepath );
|
29 |
+
$ext = '.'.strtolower( array_pop( $parts ) );
|
30 |
|
31 |
+
if ( !isset( self::$_types[$ext] ) ) {
|
32 |
return null;
|
33 |
}
|
34 |
return self::$_types[$ext];
|
35 |
}
|
36 |
|
37 |
+
public static function charsets_lookup( $type = null ) {
|
38 |
// assumes all text types are UTF-8
|
39 |
+
return $type && preg_match( '/^text\//', $type ) ? 'UTF-8' : '';
|
40 |
}
|
41 |
}
|
base/inc/lib/Less/Output.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage output
|
8 |
*/
|
9 |
-
class Less_Output{
|
10 |
|
11 |
/**
|
12 |
* Output holder
|
@@ -23,7 +23,7 @@ class Less_Output{
|
|
23 |
* @param integer $index The index
|
24 |
* @param mixed $mapLines
|
25 |
*/
|
26 |
-
public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){
|
27 |
$this->strs[] = $chunk;
|
28 |
}
|
29 |
|
@@ -32,18 +32,17 @@ class Less_Output{
|
|
32 |
*
|
33 |
* @return boolean
|
34 |
*/
|
35 |
-
public function isEmpty(){
|
36 |
-
return count($this->strs) === 0;
|
37 |
}
|
38 |
|
39 |
-
|
40 |
/**
|
41 |
* Converts the output to string
|
42 |
*
|
43 |
* @return string
|
44 |
*/
|
45 |
-
public function toString(){
|
46 |
-
return implode(''
|
47 |
}
|
48 |
|
49 |
-
}
|
6 |
* @package Less
|
7 |
* @subpackage output
|
8 |
*/
|
9 |
+
class Less_Output {
|
10 |
|
11 |
/**
|
12 |
* Output holder
|
23 |
* @param integer $index The index
|
24 |
* @param mixed $mapLines
|
25 |
*/
|
26 |
+
public function add( $chunk, $fileInfo = null, $index = 0, $mapLines = null ) {
|
27 |
$this->strs[] = $chunk;
|
28 |
}
|
29 |
|
32 |
*
|
33 |
* @return boolean
|
34 |
*/
|
35 |
+
public function isEmpty() {
|
36 |
+
return count( $this->strs ) === 0;
|
37 |
}
|
38 |
|
|
|
39 |
/**
|
40 |
* Converts the output to string
|
41 |
*
|
42 |
* @return string
|
43 |
*/
|
44 |
+
public function toString() {
|
45 |
+
return implode( '', $this->strs );
|
46 |
}
|
47 |
|
48 |
+
}
|
base/inc/lib/Less/Output/Mapped.php
CHANGED
@@ -1,122 +1,119 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Parser output with source map
|
5 |
-
*
|
6 |
-
* @package Less
|
7 |
-
* @subpackage Output
|
8 |
-
*/
|
9 |
-
class Less_Output_Mapped extends Less_Output {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* The source map generator
|
13 |
-
*
|
14 |
-
* @var Less_SourceMap_Generator
|
15 |
-
*/
|
16 |
-
protected $generator;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Current line
|
20 |
-
*
|
21 |
-
* @var integer
|
22 |
-
*/
|
23 |
-
protected $lineNumber = 0;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Current column
|
27 |
-
*
|
28 |
-
* @var integer
|
29 |
-
*/
|
30 |
-
protected $column = 0;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Array of contents map (file and its content)
|
34 |
-
*
|
35 |
-
* @var array
|
36 |
-
*/
|
37 |
-
protected $contentsMap = array();
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Constructor
|
41 |
-
*
|
42 |
-
* @param array $contentsMap Array of filename to contents map
|
43 |
-
* @param Less_SourceMap_Generator $generator
|
44 |
-
*/
|
45 |
-
public function __construct(array $contentsMap, $generator){
|
46 |
-
$this->contentsMap = $contentsMap;
|
47 |
-
$this->generator = $generator;
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Adds a chunk to the stack
|
52 |
-
* The $index for less.php may be different from less.js since less.php does not chunkify inputs
|
53 |
-
*
|
54 |
-
* @param string $chunk
|
55 |
-
* @param string $fileInfo
|
56 |
-
* @param integer $index
|
57 |
-
* @param mixed $mapLines
|
58 |
-
*/
|
59 |
-
public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
$
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
$
|
93 |
-
$
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
$
|
102 |
-
$
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
$this->column
|
113 |
-
}
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
}
|
121 |
-
|
122 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Parser output with source map
|
5 |
+
*
|
6 |
+
* @package Less
|
7 |
+
* @subpackage Output
|
8 |
+
*/
|
9 |
+
class Less_Output_Mapped extends Less_Output {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* The source map generator
|
13 |
+
*
|
14 |
+
* @var Less_SourceMap_Generator
|
15 |
+
*/
|
16 |
+
protected $generator;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Current line
|
20 |
+
*
|
21 |
+
* @var integer
|
22 |
+
*/
|
23 |
+
protected $lineNumber = 0;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Current column
|
27 |
+
*
|
28 |
+
* @var integer
|
29 |
+
*/
|
30 |
+
protected $column = 0;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Array of contents map (file and its content)
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
protected $contentsMap = array();
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Constructor
|
41 |
+
*
|
42 |
+
* @param array $contentsMap Array of filename to contents map
|
43 |
+
* @param Less_SourceMap_Generator $generator
|
44 |
+
*/
|
45 |
+
public function __construct( array $contentsMap, $generator ) {
|
46 |
+
$this->contentsMap = $contentsMap;
|
47 |
+
$this->generator = $generator;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Adds a chunk to the stack
|
52 |
+
* The $index for less.php may be different from less.js since less.php does not chunkify inputs
|
53 |
+
*
|
54 |
+
* @param string $chunk
|
55 |
+
* @param string $fileInfo
|
56 |
+
* @param integer $index
|
57 |
+
* @param mixed $mapLines
|
58 |
+
*/
|
59 |
+
public function add( $chunk, $fileInfo = null, $index = 0, $mapLines = null ) {
|
60 |
+
// ignore adding empty strings
|
61 |
+
if ( $chunk === '' ) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
|
65 |
+
$sourceLines = array();
|
66 |
+
$sourceColumns = ' ';
|
67 |
+
|
68 |
+
if ( $fileInfo ) {
|
69 |
+
|
70 |
+
$url = $fileInfo['currentUri'];
|
71 |
+
|
72 |
+
if ( isset( $this->contentsMap[$url] ) ) {
|
73 |
+
$inputSource = substr( $this->contentsMap[$url], 0, $index );
|
74 |
+
$sourceLines = explode( "\n", $inputSource );
|
75 |
+
$sourceColumns = end( $sourceLines );
|
76 |
+
} else {
|
77 |
+
throw new Exception( 'Filename '.$url.' not in contentsMap' );
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
$lines = explode( "\n", $chunk );
|
83 |
+
$columns = end( $lines );
|
84 |
+
|
85 |
+
if ( $fileInfo ) {
|
86 |
+
|
87 |
+
if ( !$mapLines ) {
|
88 |
+
$this->generator->addMapping(
|
89 |
+
$this->lineNumber + 1, // generated_line
|
90 |
+
$this->column, // generated_column
|
91 |
+
count( $sourceLines ), // original_line
|
92 |
+
strlen( $sourceColumns ), // original_column
|
93 |
+
$fileInfo
|
94 |
+
);
|
95 |
+
} else {
|
96 |
+
for ( $i = 0, $count = count( $lines ); $i < $count; $i++ ) {
|
97 |
+
$this->generator->addMapping(
|
98 |
+
$this->lineNumber + $i + 1, // generated_line
|
99 |
+
$i === 0 ? $this->column : 0, // generated_column
|
100 |
+
count( $sourceLines ) + $i, // original_line
|
101 |
+
$i === 0 ? strlen( $sourceColumns ) : 0, // original_column
|
102 |
+
$fileInfo
|
103 |
+
);
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
if ( count( $lines ) === 1 ) {
|
109 |
+
$this->column += strlen( $columns );
|
110 |
+
} else {
|
111 |
+
$this->lineNumber += count( $lines ) - 1;
|
112 |
+
$this->column = strlen( $columns );
|
113 |
+
}
|
114 |
+
|
115 |
+
// add only chunk
|
116 |
+
parent::add( $chunk );
|
117 |
+
}
|
118 |
+
|
119 |
+
}
|
|
|
|
|
|
base/inc/lib/Less/Parser.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
require_once
|
4 |
|
5 |
/**
|
6 |
* Class for parsing and compiling less files into css
|
@@ -9,8 +9,7 @@ require_once( dirname(__FILE__).'/Cache.php');
|
|
9 |
* @subpackage parser
|
10 |
*
|
11 |
*/
|
12 |
-
class Less_Parser{
|
13 |
-
|
14 |
|
15 |
/**
|
16 |
* Default parser options
|
@@ -43,7 +42,6 @@ class Less_Parser{
|
|
43 |
|
44 |
public static $options = array();
|
45 |
|
46 |
-
|
47 |
private $input; // Less input string
|
48 |
private $input_len; // input string length
|
49 |
private $pos; // current index in `input`
|
@@ -71,49 +69,46 @@ class Less_Parser{
|
|
71 |
*/
|
72 |
public static $contentsMap = array();
|
73 |
|
74 |
-
|
75 |
/**
|
76 |
* @param Less_Environment|array|null $env
|
77 |
*/
|
78 |
-
public function __construct( $env = null ){
|
79 |
-
|
80 |
// Top parser on an import tree must be sure there is one "env"
|
81 |
// which will then be passed around by reference.
|
82 |
-
if( $env instanceof Less_Environment ){
|
83 |
$this->env = $env;
|
84 |
-
}else{
|
85 |
-
$this->SetOptions(Less_Parser::$default_options);
|
86 |
$this->Reset( $env );
|
87 |
}
|
88 |
|
89 |
// mbstring.func_overload > 1 bugfix
|
90 |
// The encoding value must be set for each source file,
|
91 |
// therefore, to conserve resources and improve the speed of this design is taken here
|
92 |
-
if (ini_get('mbstring.func_overload')) {
|
93 |
-
$this->mb_internal_encoding = ini_get('mbstring.internal_encoding');
|
94 |
-
@ini_set('mbstring.internal_encoding', 'ascii');
|
95 |
}
|
96 |
|
97 |
}
|
98 |
|
99 |
-
|
100 |
/**
|
101 |
* Reset the parser state completely
|
102 |
*
|
103 |
*/
|
104 |
-
public function Reset( $options = null ){
|
105 |
$this->rules = array();
|
106 |
self::$imports = array();
|
107 |
self::$has_extends = false;
|
108 |
self::$imports = array();
|
109 |
self::$contentsMap = array();
|
110 |
|
111 |
-
$this->env = new Less_Environment($options);
|
112 |
|
113 |
-
//set new options
|
114 |
-
if( is_array($options) ){
|
115 |
-
$this->SetOptions(Less_Parser::$default_options);
|
116 |
-
$this->SetOptions($options);
|
117 |
}
|
118 |
|
119 |
$this->env->Init();
|
@@ -124,9 +119,9 @@ class Less_Parser{
|
|
124 |
* options: import_dirs, cache_dir, cache_method
|
125 |
*
|
126 |
*/
|
127 |
-
public function SetOptions( $options ){
|
128 |
-
foreach($options as $option => $value){
|
129 |
-
$this->SetOption($option
|
130 |
}
|
131 |
}
|
132 |
|
@@ -134,17 +129,16 @@ class Less_Parser{
|
|
134 |
* Set one compiler option
|
135 |
*
|
136 |
*/
|
137 |
-
public function SetOption($option
|
138 |
-
|
139 |
-
switch($option){
|
140 |
|
141 |
case 'import_dirs':
|
142 |
-
$this->SetImportDirs($value);
|
143 |
return;
|
144 |
|
145 |
case 'cache_dir':
|
146 |
-
if( is_string($value) ){
|
147 |
-
Less_Cache::SetCacheDir($value);
|
148 |
Less_Cache::CheckCacheDir();
|
149 |
}
|
150 |
return;
|
@@ -156,93 +150,87 @@ class Less_Parser{
|
|
156 |
/**
|
157 |
* Registers a new custom function
|
158 |
*
|
159 |
-
* @param
|
160 |
-
* @param
|
161 |
*/
|
162 |
-
public function registerFunction($name, $callback) {
|
163 |
$this->env->functions[$name] = $callback;
|
164 |
}
|
165 |
|
166 |
/**
|
167 |
* Removed an already registered function
|
168 |
*
|
169 |
-
* @param
|
170 |
*/
|
171 |
-
public function unregisterFunction($name) {
|
172 |
-
if( isset($this->env->functions[$name]) )
|
173 |
-
unset($this->env->functions[$name]);
|
174 |
}
|
175 |
|
176 |
-
|
177 |
/**
|
178 |
* Get the current css buffer
|
179 |
*
|
180 |
* @return string
|
181 |
*/
|
182 |
-
public function getCss(){
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
setlocale(LC_NUMERIC, "C");
|
188 |
|
189 |
try {
|
190 |
|
191 |
-
|
192 |
$root->root = true;
|
193 |
$root->firstRoot = true;
|
194 |
|
195 |
-
|
196 |
-
$this->PreVisitors($root);
|
197 |
|
198 |
self::$has_extends = false;
|
199 |
-
$evaldRoot = $root->compile($this->env);
|
200 |
|
|
|
201 |
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
if( Less_Parser::$options['sourceMap'] ){
|
206 |
-
$generator = new Less_SourceMap_Generator($evaldRoot, Less_Parser::$contentsMap, Less_Parser::$options );
|
207 |
// will also save file
|
208 |
// FIXME: should happen somewhere else?
|
209 |
$css = $generator->generateCSS();
|
210 |
-
}else{
|
211 |
$css = $evaldRoot->toCSS();
|
212 |
}
|
213 |
|
214 |
-
if( Less_Parser::$options['compress'] ){
|
215 |
-
$css = preg_replace('/(^(\s)+)|((\s)+$)/', '', $css);
|
216 |
}
|
217 |
|
218 |
-
} catch (Exception $exc) {
|
219 |
// Intentional fall-through so we can reset environment
|
220 |
}
|
221 |
|
222 |
-
//reset php settings
|
223 |
-
@ini_set('precision'
|
224 |
-
setlocale(LC_NUMERIC, $locale);
|
225 |
|
226 |
// If you previously defined $this->mb_internal_encoding
|
227 |
// is required to return the encoding as it was before
|
228 |
-
if ($this->mb_internal_encoding != '') {
|
229 |
-
@ini_set("mbstring.internal_encoding", $this->mb_internal_encoding);
|
230 |
$this->mb_internal_encoding = '';
|
231 |
}
|
232 |
|
233 |
// Rethrow exception after we handled resetting the environment
|
234 |
-
if (!empty($exc)) {
|
235 |
throw $exc;
|
236 |
}
|
237 |
|
238 |
return $css;
|
239 |
}
|
240 |
|
241 |
-
public function findValueOf($varName)
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
return $this->getVariableValue($rule);
|
246 |
}
|
247 |
}
|
248 |
return null;
|
@@ -255,8 +243,7 @@ class Less_Parser{
|
|
255 |
*
|
256 |
* @return array
|
257 |
*/
|
258 |
-
public function getVariables()
|
259 |
-
{
|
260 |
$variables = array();
|
261 |
|
262 |
$not_variable_type = array(
|
@@ -267,29 +254,28 @@ class Less_Parser{
|
|
267 |
);
|
268 |
|
269 |
// @TODO run compilation if not runned yet
|
270 |
-
foreach ($this->rules as $key => $rule) {
|
271 |
-
if (in_array($rule->type, $not_variable_type)) {
|
272 |
continue;
|
273 |
}
|
274 |
|
275 |
// Note: it seems rule->type is always Rule when variable = true
|
276 |
-
if ($rule->type == 'Rule' && $rule->variable) {
|
277 |
-
$variables[$rule->name] = $this->getVariableValue($rule);
|
278 |
} else {
|
279 |
-
if ($rule->type == 'Comment') {
|
280 |
-
$variables[] = $this->getVariableValue($rule);
|
281 |
}
|
282 |
}
|
283 |
}
|
284 |
return $variables;
|
285 |
}
|
286 |
|
287 |
-
public function findVarByName($var_name)
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
return $this->getVariableValue($rule);
|
293 |
}
|
294 |
}
|
295 |
}
|
@@ -305,69 +291,67 @@ class Less_Parser{
|
|
305 |
*
|
306 |
* @return bool|string
|
307 |
*/
|
308 |
-
private function getVariableValue($var)
|
309 |
-
|
310 |
-
|
311 |
-
throw new Exception('var is not a Less_Tree object');
|
312 |
}
|
313 |
|
314 |
-
switch ($var->type) {
|
315 |
case 'Color':
|
316 |
-
return $this->rgb2html($var->rgb);
|
317 |
case 'Unit':
|
318 |
return $var->value. $var->unit->numerator[0];
|
319 |
case 'Variable':
|
320 |
-
return $this->findVarByName($var->name);
|
321 |
case 'Keyword':
|
322 |
return $var->value;
|
323 |
case 'Rule':
|
324 |
-
return $this->getVariableValue($var->value);
|
325 |
case 'Value':
|
326 |
$value = '';
|
327 |
-
foreach ($var->value as $sub_value) {
|
328 |
-
$value .= $this->getVariableValue($sub_value).' ';
|
329 |
}
|
330 |
return $value;
|
331 |
case 'Quoted':
|
332 |
return $var->quote.$var->value.$var->quote;
|
333 |
case 'Dimension':
|
334 |
$value = $var->value;
|
335 |
-
if ($var->unit && $var->unit->numerator) {
|
336 |
$value .= $var->unit->numerator[0];
|
337 |
}
|
338 |
return $value;
|
339 |
case 'Expression':
|
340 |
$value = "";
|
341 |
-
foreach($var->value as $item) {
|
342 |
-
$value .= $this->getVariableValue($item)." ";
|
343 |
}
|
344 |
return $value;
|
345 |
case 'Operation':
|
346 |
-
throw new Exception('getVariables() require Less to be compiled. please use $parser->getCss() before calling getVariables()');
|
347 |
case 'Comment':
|
348 |
case 'Import':
|
349 |
case 'Ruleset':
|
350 |
default:
|
351 |
-
throw new Exception("type missing in switch/case getVariableValue for ".$var->type);
|
352 |
}
|
353 |
return false;
|
354 |
}
|
355 |
|
356 |
-
private function rgb2html($r, $g
|
357 |
-
|
358 |
-
|
359 |
-
list($r, $g, $b) = $r;
|
360 |
|
361 |
-
$r = intval($r); $g = intval($g);
|
362 |
-
$b = intval($b);
|
363 |
|
364 |
-
$r = dechex($r<0?0:($r>255?255
|
365 |
-
$g = dechex($g<0?0:($g>255?255
|
366 |
-
$b = dechex($b<0?0:($b>255?255
|
367 |
|
368 |
-
$color = (strlen($r) < 2?'0':'').$r;
|
369 |
-
$color .= (strlen($g) < 2?'0':'').$g;
|
370 |
-
$color .= (strlen($b) < 2?'0':'').$b;
|
371 |
return '#'.$color;
|
372 |
}
|
373 |
|
@@ -375,54 +359,48 @@ class Less_Parser{
|
|
375 |
* Run pre-compile visitors
|
376 |
*
|
377 |
*/
|
378 |
-
private function PreVisitors($root){
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
$plugin->run($root);
|
384 |
}
|
385 |
}
|
386 |
}
|
387 |
}
|
388 |
|
389 |
-
|
390 |
/**
|
391 |
* Run post-compile visitors
|
392 |
*
|
393 |
*/
|
394 |
-
private function PostVisitors($evaldRoot){
|
395 |
-
|
396 |
$visitors = array();
|
397 |
$visitors[] = new Less_Visitor_joinSelector();
|
398 |
-
if( self::$has_extends ){
|
399 |
$visitors[] = new Less_Visitor_processExtends();
|
400 |
}
|
401 |
$visitors[] = new Less_Visitor_toCSS();
|
402 |
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
if( property_exists($plugin,'isPreEvalVisitor') && $plugin->isPreEvalVisitor ){
|
407 |
continue;
|
408 |
}
|
409 |
|
410 |
-
if( property_exists($plugin,'isPreVisitor') && $plugin->isPreVisitor ){
|
411 |
-
array_unshift( $visitors, $plugin);
|
412 |
-
}else{
|
413 |
$visitors[] = $plugin;
|
414 |
}
|
415 |
}
|
416 |
}
|
417 |
|
418 |
-
|
419 |
-
|
420 |
-
$visitors[$i]->run($evaldRoot);
|
421 |
}
|
422 |
|
423 |
}
|
424 |
|
425 |
-
|
426 |
/**
|
427 |
* Parse a Less string into css
|
428 |
*
|
@@ -430,32 +408,30 @@ class Less_Parser{
|
|
430 |
* @param string $uri_root The url of the file
|
431 |
* @return Less_Tree_Ruleset|Less_Parser
|
432 |
*/
|
433 |
-
public function parse( $str, $file_uri = null ){
|
434 |
-
|
435 |
-
if( !$file_uri ){
|
436 |
$uri_root = '';
|
437 |
$filename = 'anonymous-file-'.Less_Parser::$next_id++.'.less';
|
438 |
-
}else{
|
439 |
-
$file_uri = self::WinPath($file_uri);
|
440 |
$filename = $file_uri;
|
441 |
-
$uri_root = dirname($file_uri);
|
442 |
}
|
443 |
|
444 |
$previousFileInfo = $this->env->currentFileInfo;
|
445 |
-
$uri_root = self::WinPath($uri_root);
|
446 |
-
$this->SetFileInfo($filename, $uri_root);
|
447 |
|
448 |
$this->input = $str;
|
449 |
$this->_parse();
|
450 |
|
451 |
-
if( $previousFileInfo ){
|
452 |
$this->env->currentFileInfo = $previousFileInfo;
|
453 |
}
|
454 |
|
455 |
return $this;
|
456 |
}
|
457 |
|
458 |
-
|
459 |
/**
|
460 |
* Parse a Less string from a given file
|
461 |
*
|
@@ -465,148 +441,136 @@ class Less_Parser{
|
|
465 |
* @param bool $returnRoot Indicates whether the return value should be a css string a root node
|
466 |
* @return Less_Tree_Ruleset|Less_Parser
|
467 |
*/
|
468 |
-
public function parseFile( $filename, $uri_root = '', $returnRoot = false){
|
469 |
-
|
470 |
-
|
471 |
-
$this->Error(sprintf('File `%s` not found.', $filename));
|
472 |
}
|
473 |
|
474 |
-
|
475 |
// fix uri_root?
|
476 |
// Instead of The mixture of file path for the first argument and directory path for the second argument has bee
|
477 |
-
if( !$returnRoot && !empty($uri_root) && basename($uri_root) == basename($filename) ){
|
478 |
-
$uri_root = dirname($uri_root);
|
479 |
}
|
480 |
|
481 |
-
|
482 |
$previousFileInfo = $this->env->currentFileInfo;
|
483 |
|
484 |
-
|
485 |
-
|
486 |
-
$filename = self::AbsPath($filename, true);
|
487 |
}
|
488 |
-
$uri_root = self::WinPath($uri_root);
|
489 |
|
490 |
-
$this->SetFileInfo($filename, $uri_root);
|
491 |
|
492 |
-
self::AddParsedFile($filename);
|
493 |
|
494 |
-
if( $returnRoot ){
|
495 |
$rules = $this->GetRules( $filename );
|
496 |
-
$return = new Less_Tree_Ruleset(array(), $rules );
|
497 |
-
}else{
|
498 |
$this->_parse( $filename );
|
499 |
$return = $this;
|
500 |
}
|
501 |
|
502 |
-
if( $previousFileInfo ){
|
503 |
$this->env->currentFileInfo = $previousFileInfo;
|
504 |
}
|
505 |
|
506 |
return $return;
|
507 |
}
|
508 |
|
509 |
-
|
510 |
/**
|
511 |
* Allows a user to set variables values
|
512 |
* @param array $vars
|
513 |
* @return Less_Parser
|
514 |
*/
|
515 |
-
public function ModifyVars( $vars ){
|
516 |
-
|
517 |
$this->input = Less_Parser::serializeVars( $vars );
|
518 |
$this->_parse();
|
519 |
|
520 |
return $this;
|
521 |
}
|
522 |
|
523 |
-
|
524 |
/**
|
525 |
* @param string $filename
|
526 |
*/
|
527 |
-
public function SetFileInfo( $filename, $uri_root = ''){
|
528 |
-
|
529 |
-
$
|
530 |
-
$dirname = preg_replace('/[^\/\\\\]*$/','',$filename);
|
531 |
|
532 |
-
if( !empty($uri_root) ){
|
533 |
-
$uri_root = rtrim($uri_root,'/').'/';
|
534 |
}
|
535 |
|
536 |
$currentFileInfo = array();
|
537 |
|
538 |
-
//entry info
|
539 |
-
if( isset($this->env->currentFileInfo) ){
|
540 |
$currentFileInfo['entryPath'] = $this->env->currentFileInfo['entryPath'];
|
541 |
$currentFileInfo['entryUri'] = $this->env->currentFileInfo['entryUri'];
|
542 |
$currentFileInfo['rootpath'] = $this->env->currentFileInfo['rootpath'];
|
543 |
|
544 |
-
}else{
|
545 |
$currentFileInfo['entryPath'] = $dirname;
|
546 |
$currentFileInfo['entryUri'] = $uri_root;
|
547 |
$currentFileInfo['rootpath'] = $dirname;
|
548 |
}
|
549 |
|
550 |
$currentFileInfo['currentDirectory'] = $dirname;
|
551 |
-
$currentFileInfo['currentUri'] = $uri_root.basename($filename);
|
552 |
$currentFileInfo['filename'] = $filename;
|
553 |
$currentFileInfo['uri_root'] = $uri_root;
|
554 |
|
555 |
-
|
556 |
-
|
557 |
-
if( isset($this->env->currentFileInfo['reference']) && $this->env->currentFileInfo['reference'] ){
|
558 |
$currentFileInfo['reference'] = true;
|
559 |
}
|
560 |
|
561 |
$this->env->currentFileInfo = $currentFileInfo;
|
562 |
}
|
563 |
|
564 |
-
|
565 |
/**
|
566 |
* @deprecated 1.5.1.2
|
567 |
*
|
568 |
*/
|
569 |
-
public function SetCacheDir( $dir ){
|
570 |
-
|
571 |
-
|
572 |
-
if( mkdir($dir) ){
|
573 |
return true;
|
574 |
}
|
575 |
-
throw new Less_Exception_Parser('Less.php cache directory couldn\'t be created: '.$dir);
|
576 |
|
577 |
-
}elseif( !is_dir($dir) ){
|
578 |
-
throw new Less_Exception_Parser('Less.php cache directory doesn\'t exist: '.$dir);
|
579 |
|
580 |
-
}elseif( !is_writable($dir) ){
|
581 |
-
throw new Less_Exception_Parser('Less.php cache directory isn\'t writable: '.$dir);
|
582 |
|
583 |
-
}else{
|
584 |
-
$dir = self::WinPath($dir);
|
585 |
-
Less_Cache::$cache_dir = rtrim($dir,'/').'/';
|
586 |
return true;
|
587 |
}
|
588 |
}
|
589 |
|
590 |
-
|
591 |
/**
|
592 |
* Set a list of directories or callbacks the parser should use for determining import paths
|
593 |
*
|
594 |
* @param array $dirs
|
595 |
*/
|
596 |
-
public function SetImportDirs( $dirs ){
|
597 |
Less_Parser::$options['import_dirs'] = array();
|
598 |
|
599 |
-
foreach($dirs as $path => $uri_root){
|
600 |
|
601 |
-
$path = self::WinPath($path);
|
602 |
-
if( !empty($path) ){
|
603 |
-
$path = rtrim($path,'/').'/';
|
604 |
}
|
605 |
|
606 |
-
if ( !is_callable($uri_root) ){
|
607 |
-
$uri_root = self::WinPath($uri_root);
|
608 |
-
if( !empty($uri_root) ){
|
609 |
-
$uri_root = rtrim($uri_root,'/').'/';
|
610 |
}
|
611 |
}
|
612 |
|
@@ -617,91 +581,87 @@ class Less_Parser{
|
|
617 |
/**
|
618 |
* @param string $file_path
|
619 |
*/
|
620 |
-
private function _parse( $file_path = null ){
|
621 |
-
$this->rules = array_merge($this->rules, $this->GetRules( $file_path ));
|
622 |
}
|
623 |
|
624 |
-
|
625 |
/**
|
626 |
* Return the results of parsePrimary for $file_path
|
627 |
* Use cache and save cached results if possible
|
628 |
*
|
629 |
* @param string|null $file_path
|
630 |
*/
|
631 |
-
private function GetRules( $file_path ){
|
632 |
-
|
633 |
-
$this->SetInput($file_path);
|
634 |
|
635 |
$cache_file = $this->CacheFile( $file_path );
|
636 |
-
if( $cache_file ){
|
637 |
-
if( Less_Parser::$options['cache_method'] == 'callback' ){
|
638 |
-
if( is_callable(Less_Parser::$options['cache_callback_get']) ){
|
639 |
$cache = call_user_func_array(
|
640 |
Less_Parser::$options['cache_callback_get'],
|
641 |
-
array($this, $file_path, $cache_file)
|
642 |
);
|
643 |
|
644 |
-
if( $cache ){
|
645 |
$this->UnsetInput();
|
646 |
return $cache;
|
647 |
}
|
648 |
}
|
649 |
|
650 |
-
}elseif( file_exists($cache_file) ){
|
651 |
-
switch(Less_Parser::$options['cache_method']){
|
652 |
|
653 |
// Using serialize
|
654 |
// Faster but uses more memory
|
655 |
case 'serialize':
|
656 |
-
$cache = unserialize(file_get_contents($cache_file));
|
657 |
-
if( $cache ){
|
658 |
-
touch($cache_file);
|
659 |
$this->UnsetInput();
|
660 |
return $cache;
|
661 |
}
|
662 |
break;
|
663 |
|
664 |
-
|
665 |
// Using generated php code
|
666 |
case 'var_export':
|
667 |
case 'php':
|
668 |
$this->UnsetInput();
|
669 |
-
return include
|
670 |
}
|
671 |
}
|
672 |
}
|
673 |
|
674 |
$rules = $this->parsePrimary();
|
675 |
|
676 |
-
if( $this->pos < $this->input_len ){
|
677 |
-
throw new Less_Exception_Chunk($this->input, null, $this->furthest, $this->env->currentFileInfo);
|
678 |
}
|
679 |
|
680 |
$this->UnsetInput();
|
681 |
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
if( is_callable(Less_Parser::$options['cache_callback_set']) ){
|
687 |
call_user_func_array(
|
688 |
Less_Parser::$options['cache_callback_set'],
|
689 |
-
array($this, $file_path, $cache_file, $rules)
|
690 |
);
|
691 |
}
|
692 |
|
693 |
-
}else{
|
694 |
-
//msg('write cache file');
|
695 |
-
switch(Less_Parser::$options['cache_method']){
|
696 |
case 'serialize':
|
697 |
-
file_put_contents( $cache_file, serialize($rules) );
|
698 |
break;
|
699 |
case 'php':
|
700 |
-
file_put_contents( $cache_file, '<?php return '.self::ArgString($rules).'; ?>' );
|
701 |
break;
|
702 |
case 'var_export':
|
703 |
-
//Requires __set_state()
|
704 |
-
file_put_contents( $cache_file, '<?php return '.var_export($rules,true).'; ?>' );
|
705 |
break;
|
706 |
}
|
707 |
|
@@ -712,48 +672,42 @@ class Less_Parser{
|
|
712 |
return $rules;
|
713 |
}
|
714 |
|
715 |
-
|
716 |
/**
|
717 |
* Set up the input buffer
|
718 |
*
|
719 |
*/
|
720 |
-
public function SetInput( $file_path ){
|
721 |
-
|
722 |
-
if( $file_path ){
|
723 |
$this->input = file_get_contents( $file_path );
|
724 |
}
|
725 |
|
726 |
$this->pos = $this->furthest = 0;
|
727 |
|
728 |
// Remove potential UTF Byte Order Mark
|
729 |
-
$this->input = preg_replace('/\\G\xEF\xBB\xBF/', '', $this->input);
|
730 |
-
$this->input_len = strlen($this->input);
|
731 |
|
732 |
-
|
733 |
-
if( Less_Parser::$options['sourceMap'] && $this->env->currentFileInfo ){
|
734 |
$uri = $this->env->currentFileInfo['currentUri'];
|
735 |
Less_Parser::$contentsMap[$uri] = $this->input;
|
736 |
}
|
737 |
|
738 |
}
|
739 |
|
740 |
-
|
741 |
/**
|
742 |
* Free up some memory
|
743 |
*
|
744 |
*/
|
745 |
-
public function UnsetInput(){
|
746 |
-
unset($this->input, $this->pos, $this->input_len, $this->furthest);
|
747 |
$this->saveStack = array();
|
748 |
}
|
749 |
|
|
|
|
|
750 |
|
751 |
-
|
752 |
-
|
753 |
-
if( $file_path && $this->CacheEnabled() ){
|
754 |
-
|
755 |
-
$env = get_object_vars($this->env);
|
756 |
-
unset($env['frames']);
|
757 |
|
758 |
$parts = array();
|
759 |
$parts[] = $file_path;
|
@@ -762,37 +716,35 @@ class Less_Parser{
|
|
762 |
$parts[] = $env;
|
763 |
$parts[] = Less_Version::cache_version;
|
764 |
$parts[] = Less_Parser::$options['cache_method'];
|
765 |
-
return Less_Cache::$cache_dir . Less_Cache::$prefix . base_convert( sha1(json_encode($parts) ), 16, 36) . '.lesscache';
|
766 |
}
|
767 |
}
|
768 |
|
769 |
-
|
770 |
-
static function AddParsedFile($file){
|
771 |
self::$imports[] = $file;
|
772 |
}
|
773 |
|
774 |
-
static function AllParsedFiles(){
|
775 |
return self::$imports;
|
776 |
}
|
777 |
|
778 |
/**
|
779 |
* @param string $file
|
780 |
*/
|
781 |
-
static function FileParsed($file){
|
782 |
-
return in_array($file,self::$imports);
|
783 |
}
|
784 |
|
785 |
-
|
786 |
function save() {
|
787 |
$this->saveStack[] = $this->pos;
|
788 |
}
|
789 |
|
790 |
private function restore() {
|
791 |
-
$this->pos = array_pop($this->saveStack);
|
792 |
}
|
793 |
|
794 |
-
private function forget(){
|
795 |
-
array_pop($this->saveStack);
|
796 |
}
|
797 |
|
798 |
/**
|
@@ -802,8 +754,8 @@ class Less_Parser{
|
|
802 |
*
|
803 |
* @return bool
|
804 |
*/
|
805 |
-
private function isWhitespace($offset = 0) {
|
806 |
-
return strpos(" \t\n\r\v\f", $this->input[$this->pos + $offset]) !== false;
|
807 |
}
|
808 |
|
809 |
/**
|
@@ -812,35 +764,34 @@ class Less_Parser{
|
|
812 |
* @param array $toks
|
813 |
* @return array
|
814 |
*/
|
815 |
-
private function match($toks){
|
816 |
-
|
817 |
// The match is confirmed, add the match length to `this::pos`,
|
818 |
// and consume any extra white-space characters (' ' || '\n')
|
819 |
// which come after that. The reason for this is that LeSS's
|
820 |
// grammar is mostly white-space insensitive.
|
821 |
//
|
822 |
|
823 |
-
foreach($toks as $tok){
|
824 |
|
825 |
$char = $tok[0];
|
826 |
|
827 |
-
if( $char === '/' ){
|
828 |
-
$match = $this->MatchReg($tok);
|
829 |
|
830 |
-
if( $match ){
|
831 |
-
return count($match) === 1 ? $match[0] : $match;
|
832 |
}
|
833 |
|
834 |
-
}elseif( $char === '#' ){
|
835 |
-
$match = $this->MatchChar($tok[1]);
|
836 |
|
837 |
-
}else{
|
838 |
// Non-terminal, match using a function call
|
839 |
$match = $this->$tok();
|
840 |
|
841 |
}
|
842 |
|
843 |
-
if( $match ){
|
844 |
return $match;
|
845 |
}
|
846 |
}
|
@@ -851,12 +802,11 @@ class Less_Parser{
|
|
851 |
*
|
852 |
* @return string
|
853 |
*/
|
854 |
-
private function MatchFuncs($toks){
|
855 |
-
|
856 |
-
|
857 |
-
foreach($toks as $tok){
|
858 |
$match = $this->$tok();
|
859 |
-
if( $match ){
|
860 |
return $match;
|
861 |
}
|
862 |
}
|
@@ -865,23 +815,21 @@ class Less_Parser{
|
|
865 |
}
|
866 |
|
867 |
// Match a single character in the input,
|
868 |
-
private function MatchChar($tok){
|
869 |
-
if( ($this->pos < $this->input_len) && ($this->input[$this->pos] === $tok) ){
|
870 |
-
$this->skipWhitespace(1);
|
871 |
return $tok;
|
872 |
}
|
873 |
}
|
874 |
|
875 |
// Match a regexp from the current start point
|
876 |
-
private function MatchReg($tok){
|
877 |
-
|
878 |
-
|
879 |
-
$this->skipWhitespace(strlen($match[0]));
|
880 |
return $match;
|
881 |
}
|
882 |
}
|
883 |
|
884 |
-
|
885 |
/**
|
886 |
* Same as match(), but don't change the state of the parser,
|
887 |
* just return the match.
|
@@ -889,44 +837,41 @@ class Less_Parser{
|
|
889 |
* @param string $tok
|
890 |
* @return integer
|
891 |
*/
|
892 |
-
public function PeekReg($tok){
|
893 |
-
return preg_match($tok, $this->input, $match, 0, $this->pos);
|
894 |
}
|
895 |
|
896 |
/**
|
897 |
* @param string $tok
|
898 |
*/
|
899 |
-
public function PeekChar($tok){
|
900 |
-
//return ($this->input[$this->pos] === $tok );
|
901 |
-
return ($this->pos < $this->input_len) && ($this->input[$this->pos] === $tok );
|
902 |
}
|
903 |
|
904 |
-
|
905 |
/**
|
906 |
* @param integer $length
|
907 |
*/
|
908 |
-
public function skipWhitespace($length){
|
909 |
-
|
910 |
$this->pos += $length;
|
911 |
|
912 |
-
for(; $this->pos < $this->input_len; $this->pos++ ){
|
913 |
$c = $this->input[$this->pos];
|
914 |
|
915 |
-
if( ($c !== "\n") && ($c !== "\r") && ($c !== "\t") && ($c !== ' ') ){
|
916 |
break;
|
917 |
}
|
918 |
}
|
919 |
}
|
920 |
|
921 |
-
|
922 |
/**
|
923 |
* @param string $tok
|
924 |
* @param string|null $msg
|
925 |
*/
|
926 |
-
public function expect($tok, $msg = NULL) {
|
927 |
-
$result = $this->match( array($tok) );
|
928 |
-
if (!$result) {
|
929 |
-
$this->Error( $msg
|
930 |
} else {
|
931 |
return $result;
|
932 |
}
|
@@ -935,12 +880,12 @@ class Less_Parser{
|
|
935 |
/**
|
936 |
* @param string $tok
|
937 |
*/
|
938 |
-
public function expectChar($tok, $msg = null ){
|
939 |
-
$result = $this->MatchChar($tok);
|
940 |
-
if( !$result ){
|
941 |
$msg = $msg ? $msg : "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'";
|
942 |
$this->Error( $msg );
|
943 |
-
}else{
|
944 |
return $result;
|
945 |
}
|
946 |
}
|
@@ -990,31 +935,31 @@ class Less_Parser{
|
|
990 |
// Only at one point is the primary rule not called from the
|
991 |
// block rule: at the root level.
|
992 |
//
|
993 |
-
private function parsePrimary(){
|
994 |
$root = array();
|
995 |
|
996 |
-
while( true ){
|
997 |
|
998 |
-
if( $this->pos >= $this->input_len ){
|
999 |
break;
|
1000 |
}
|
1001 |
|
1002 |
-
$node = $this->parseExtend(true);
|
1003 |
-
if( $node ){
|
1004 |
-
$root = array_merge($root
|
1005 |
continue;
|
1006 |
}
|
1007 |
|
1008 |
-
|
1009 |
-
$node = $this->MatchFuncs( array( 'parseMixinDefinition', 'parseNameValue', 'parseRule', 'parseRuleset', 'parseMixinCall', 'parseComment', 'parseRulesetCall', 'parseDirective'));
|
1010 |
|
1011 |
-
if( $node ){
|
1012 |
$root[] = $node;
|
1013 |
-
}elseif( !$this->MatchReg('/\\G[\s\n;]+/') ){
|
1014 |
break;
|
1015 |
}
|
1016 |
|
1017 |
-
if( $this->PeekChar('}') ){
|
1018 |
break;
|
1019 |
}
|
1020 |
}
|
@@ -1022,35 +967,32 @@ class Less_Parser{
|
|
1022 |
return $root;
|
1023 |
}
|
1024 |
|
1025 |
-
|
1026 |
-
|
1027 |
// We create a Comment node for CSS comments `/* */`,
|
1028 |
// but keep the LeSS comments `//` silent, by just skipping
|
1029 |
// over them.
|
1030 |
-
private function parseComment(){
|
1031 |
-
|
1032 |
-
if( $this->input[$this->pos] !== '/' ){
|
1033 |
return;
|
1034 |
}
|
1035 |
|
1036 |
-
if( $this->input[$this->pos+1] === '/' ){
|
1037 |
-
$match = $this->MatchReg('/\\G\/\/.*/');
|
1038 |
-
return $this->NewObj4('Less_Tree_Comment',array($match[0], true, $this->pos, $this->env->currentFileInfo));
|
1039 |
}
|
1040 |
|
1041 |
-
|
1042 |
-
$comment = $this->MatchReg('/\\G\/\*(?s).*?\*+\/\n?/');//not the same as less.js to prevent fatal errors
|
1043 |
-
if( $comment ){
|
1044 |
-
return $this->NewObj4('Less_Tree_Comment',array($comment[0], false, $this->pos, $this->env->currentFileInfo));
|
1045 |
}
|
1046 |
}
|
1047 |
|
1048 |
-
private function parseComments(){
|
1049 |
$comments = array();
|
1050 |
|
1051 |
-
while( $this->pos < $this->input_len ){
|
1052 |
$comment = $this->parseComment();
|
1053 |
-
if( !$comment ){
|
1054 |
break;
|
1055 |
}
|
1056 |
|
@@ -1060,8 +1002,6 @@ class Less_Parser{
|
|
1060 |
return $comments;
|
1061 |
}
|
1062 |
|
1063 |
-
|
1064 |
-
|
1065 |
//
|
1066 |
// A string, which supports escaping " and '
|
1067 |
//
|
@@ -1072,31 +1012,29 @@ class Less_Parser{
|
|
1072 |
$e = false;
|
1073 |
$index = $this->pos;
|
1074 |
|
1075 |
-
if( $this->input[$this->pos] === '~' ){
|
1076 |
$j++;
|
1077 |
$e = true; // Escaped strings
|
1078 |
}
|
1079 |
|
1080 |
$char = $this->input[$j];
|
1081 |
-
if( $char !== '"' && $char !== "'" ){
|
1082 |
return;
|
1083 |
}
|
1084 |
|
1085 |
-
if ($e) {
|
1086 |
-
$this->MatchChar('~');
|
1087 |
}
|
1088 |
|
1089 |
-
|
1090 |
-
$matched
|
1091 |
-
if( $matched === false ){
|
1092 |
return;
|
1093 |
}
|
1094 |
|
1095 |
$quoted = $char.$matched.$char;
|
1096 |
-
return $this->NewObj5('Less_Tree_Quoted',array($quoted, $matched, $e, $index, $this->env->currentFileInfo) );
|
1097 |
}
|
1098 |
|
1099 |
-
|
1100 |
/**
|
1101 |
* When PCRE JIT is enabled in php, regular expressions don't work for matching quoted strings
|
1102 |
*
|
@@ -1104,26 +1042,25 @@ class Less_Parser{
|
|
1104 |
* $regex = '/\\G"((?:[^"\\\\\r\n]|\\\\.|\\\\\r\n|\\\\[\n\r\f])*)"/';
|
1105 |
*
|
1106 |
*/
|
1107 |
-
private function MatchQuoted($quote_char, $i){
|
1108 |
-
|
1109 |
$matched = '';
|
1110 |
-
while( $i < $this->input_len ){
|
1111 |
$c = $this->input[$i];
|
1112 |
|
1113 |
-
//escaped character
|
1114 |
-
if( $c === '\\' ){
|
1115 |
-
$matched .= $c . $this->input[$i+1];
|
1116 |
$i += 2;
|
1117 |
continue;
|
1118 |
}
|
1119 |
|
1120 |
-
if( $c === $quote_char ){
|
1121 |
-
$this->pos = $i+1;
|
1122 |
-
$this->skipWhitespace(0);
|
1123 |
return $matched;
|
1124 |
}
|
1125 |
|
1126 |
-
if( $c === "\r" || $c === "\n" ){
|
1127 |
return false;
|
1128 |
}
|
1129 |
|
@@ -1134,37 +1071,35 @@ class Less_Parser{
|
|
1134 |
return false;
|
1135 |
}
|
1136 |
|
1137 |
-
|
1138 |
//
|
1139 |
// A catch-all word, such as:
|
1140 |
//
|
1141 |
// black border-collapse
|
1142 |
//
|
1143 |
-
private function parseEntitiesKeyword(){
|
1144 |
-
|
1145 |
-
|
1146 |
-
$k
|
1147 |
-
if( $k ){
|
1148 |
$k = $k[0];
|
1149 |
-
$color = $this->fromKeyword($k);
|
1150 |
-
if( $color ){
|
1151 |
return $color;
|
1152 |
}
|
1153 |
-
return $this->NewObj1('Less_Tree_Keyword'
|
1154 |
}
|
1155 |
}
|
1156 |
|
1157 |
// duplicate of Less_Tree_Color::FromKeyword
|
1158 |
-
private function FromKeyword( $keyword ){
|
1159 |
-
$keyword = strtolower($keyword);
|
1160 |
|
1161 |
-
if( Less_Colors::hasOwnProperty($keyword) ){
|
1162 |
// detect named color
|
1163 |
-
return $this->NewObj1('Less_Tree_Color',substr(Less_Colors::color($keyword), 1));
|
1164 |
}
|
1165 |
|
1166 |
-
if( $keyword === 'transparent' ){
|
1167 |
-
return $this->NewObj3('Less_Tree_Color', array( array(0, 0, 0), 0, true));
|
1168 |
}
|
1169 |
}
|
1170 |
|
@@ -1178,38 +1113,38 @@ class Less_Parser{
|
|
1178 |
//
|
1179 |
// The arguments are parsed with the `entities.arguments` parser.
|
1180 |
//
|
1181 |
-
private function parseEntitiesCall(){
|
1182 |
$index = $this->pos;
|
1183 |
|
1184 |
-
if( !preg_match('/\\G([\w-]+|%|progid:[\w\.]+)\(/', $this->input, $name,0
|
1185 |
return;
|
1186 |
}
|
1187 |
$name = $name[1];
|
1188 |
-
$nameLC = strtolower($name);
|
1189 |
|
1190 |
-
if ($nameLC === 'url') {
|
1191 |
return null;
|
1192 |
}
|
1193 |
|
1194 |
-
$this->pos += strlen($name);
|
1195 |
|
1196 |
-
if( $nameLC === 'alpha' ){
|
1197 |
$alpha_ret = $this->parseAlpha();
|
1198 |
-
if( $alpha_ret ){
|
1199 |
return $alpha_ret;
|
1200 |
}
|
1201 |
}
|
1202 |
|
1203 |
-
$this->MatchChar('('); // Parse the '(' and consume whitespace.
|
1204 |
|
1205 |
$args = $this->parseEntitiesArguments();
|
1206 |
|
1207 |
-
if( !$this->MatchChar(')') ){
|
1208 |
return;
|
1209 |
}
|
1210 |
|
1211 |
-
if ($name) {
|
1212 |
-
return $this->NewObj4('Less_Tree_Call',array($name, $args, $index, $this->env->currentFileInfo) );
|
1213 |
}
|
1214 |
}
|
1215 |
|
@@ -1218,25 +1153,24 @@ class Less_Parser{
|
|
1218 |
*
|
1219 |
* @return array
|
1220 |
*/
|
1221 |
-
private function parseEntitiesArguments(){
|
1222 |
-
|
1223 |
$args = array();
|
1224 |
-
while( true ){
|
1225 |
-
$arg = $this->MatchFuncs( array('parseEntitiesAssignment','parseExpression') );
|
1226 |
-
if( !$arg ){
|
1227 |
break;
|
1228 |
}
|
1229 |
|
1230 |
$args[] = $arg;
|
1231 |
-
if( !$this->MatchChar(',') ){
|
1232 |
break;
|
1233 |
}
|
1234 |
}
|
1235 |
return $args;
|
1236 |
}
|
1237 |
|
1238 |
-
private function parseEntitiesLiteral(){
|
1239 |
-
return $this->MatchFuncs( array('parseEntitiesDimension','parseEntitiesColor','parseEntitiesQuoted','parseUnicodeDescriptor') );
|
1240 |
}
|
1241 |
|
1242 |
// Assignments are argument entities for calls.
|
@@ -1245,19 +1179,18 @@ class Less_Parser{
|
|
1245 |
// filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* )
|
1246 |
//
|
1247 |
private function parseEntitiesAssignment() {
|
1248 |
-
|
1249 |
-
|
1250 |
-
if( !$key ){
|
1251 |
return;
|
1252 |
}
|
1253 |
|
1254 |
-
if( !$this->MatchChar('=') ){
|
1255 |
return;
|
1256 |
}
|
1257 |
|
1258 |
$value = $this->parseEntity();
|
1259 |
-
if( $value ){
|
1260 |
-
return $this->NewObj2('Less_Tree_Assignment',array($key[0], $value));
|
1261 |
}
|
1262 |
}
|
1263 |
|
@@ -1268,30 +1201,25 @@ class Less_Parser{
|
|
1268 |
// standard function calls. The difference is that the argument doesn't have
|
1269 |
// to be enclosed within a string, so it can't be parsed as an Expression.
|
1270 |
//
|
1271 |
-
private function parseEntitiesUrl(){
|
1272 |
-
|
1273 |
-
|
1274 |
-
if( $this->input[$this->pos] !== 'u' || !$this->matchReg('/\\Gurl\(/') ){
|
1275 |
return;
|
1276 |
}
|
1277 |
|
1278 |
-
$value = $this->match( array('parseEntitiesQuoted','parseEntitiesVariable','/\\Gdata\:.*?[^\)]+/','/\\G(?:(?:\\\\[\(\)\'"])|[^\(\)\'"])+/') );
|
1279 |
-
if( !$value ){
|
1280 |
$value = '';
|
1281 |
}
|
1282 |
|
|
|
1283 |
|
1284 |
-
$
|
1285 |
-
|
1286 |
-
|
1287 |
-
if( isset($value->value) || $value instanceof Less_Tree_Variable ){
|
1288 |
-
return $this->NewObj2('Less_Tree_Url',array($value, $this->env->currentFileInfo));
|
1289 |
}
|
1290 |
|
1291 |
-
return $this->NewObj2('Less_Tree_Url', array( $this->NewObj1('Less_Tree_Anonymous'
|
1292 |
}
|
1293 |
|
1294 |
-
|
1295 |
//
|
1296 |
// A Variable entity, such as `@fink`, in
|
1297 |
//
|
@@ -1300,20 +1228,19 @@ class Less_Parser{
|
|
1300 |
// We use a different parser for variable definitions,
|
1301 |
// see `parsers.variable`.
|
1302 |
//
|
1303 |
-
private function parseEntitiesVariable(){
|
1304 |
$index = $this->pos;
|
1305 |
-
if ($this->PeekChar('@') && ($name = $this->MatchReg('/\\G@@?[\w-]+/'))) {
|
1306 |
-
return $this->NewObj3('Less_Tree_Variable', array( $name[0], $index, $this->env->currentFileInfo));
|
1307 |
}
|
1308 |
}
|
1309 |
|
1310 |
-
|
1311 |
// A variable entity using the protective {} e.g. @{var}
|
1312 |
private function parseEntitiesVariableCurly() {
|
1313 |
$index = $this->pos;
|
1314 |
|
1315 |
-
if( $this->input_len > ($this->pos+1) && $this->input[$this->pos] === '@' && ($curly = $this->MatchReg('/\\G@\{([\w-]+)\}/')) ){
|
1316 |
-
return $this->NewObj3('Less_Tree_Variable',array('@'.$curly[1], $index, $this->env->currentFileInfo));
|
1317 |
}
|
1318 |
}
|
1319 |
|
@@ -1324,9 +1251,9 @@ class Less_Parser{
|
|
1324 |
//
|
1325 |
// `rgb` and `hsl` colors are parsed through the `entities.call` parser.
|
1326 |
//
|
1327 |
-
private function parseEntitiesColor(){
|
1328 |
-
if ($this->PeekChar('#') && ($rgb = $this->MatchReg('/\\G#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/'))) {
|
1329 |
-
return $this->NewObj1('Less_Tree_Color'
|
1330 |
}
|
1331 |
}
|
1332 |
|
@@ -1335,129 +1262,122 @@ class Less_Parser{
|
|
1335 |
//
|
1336 |
// 0.5em 95%
|
1337 |
//
|
1338 |
-
private function parseEntitiesDimension(){
|
1339 |
-
|
1340 |
-
$c = @ord($this->input[$this->pos]);
|
1341 |
|
1342 |
-
//Is the first char of the dimension 0-9, '.', '+' or '-'
|
1343 |
-
if (($c > 57 || $c < 43) || $c === 47 || $c == 44){
|
1344 |
return;
|
1345 |
}
|
1346 |
|
1347 |
-
$value = $this->MatchReg('/\\G([+-]?\d*\.?\d+)(%|[a-z]+)?/');
|
1348 |
-
if( $value ){
|
1349 |
|
1350 |
-
if( isset($value[2]) ){
|
1351 |
-
return $this->NewObj2('Less_Tree_Dimension', array($value[1],$value[2]));
|
1352 |
}
|
1353 |
-
return $this->NewObj1('Less_Tree_Dimension'
|
1354 |
}
|
1355 |
}
|
1356 |
|
1357 |
-
|
1358 |
//
|
1359 |
// A unicode descriptor, as is used in unicode-range
|
1360 |
//
|
1361 |
// U+0?? or U+00A1-00A9
|
1362 |
//
|
1363 |
function parseUnicodeDescriptor() {
|
1364 |
-
$ud = $this->MatchReg('/\\G(U\+[0-9a-fA-F?]+)(\-[0-9a-fA-F?]+)?/');
|
1365 |
-
if( $ud ){
|
1366 |
-
return $this->NewObj1('Less_Tree_UnicodeDescriptor', $ud[0]);
|
1367 |
}
|
1368 |
}
|
1369 |
|
1370 |
-
|
1371 |
//
|
1372 |
// JavaScript code to be evaluated
|
1373 |
//
|
1374 |
// `window.location.href`
|
1375 |
//
|
1376 |
-
private function parseEntitiesJavascript(){
|
1377 |
$e = false;
|
1378 |
$j = $this->pos;
|
1379 |
-
if( $this->input[$j] === '~' ){
|
1380 |
$j++;
|
1381 |
$e = true;
|
1382 |
}
|
1383 |
-
if( $this->input[$j] !== '`' ){
|
1384 |
return;
|
1385 |
}
|
1386 |
-
if( $e ){
|
1387 |
-
$this->MatchChar('~');
|
1388 |
}
|
1389 |
-
$str = $this->MatchReg('/\\G`([^`]*)`/');
|
1390 |
-
if( $str ){
|
1391 |
-
return $this->NewObj3('Less_Tree_Javascript', array($str[1], $this->pos, $e));
|
1392 |
}
|
1393 |
}
|
1394 |
|
1395 |
-
|
1396 |
//
|
1397 |
// The variable part of a variable definition. Used in the `rule` parser
|
1398 |
//
|
1399 |
// @fink:
|
1400 |
//
|
1401 |
-
private function parseVariable(){
|
1402 |
-
if ($this->PeekChar('@') && ($name = $this->MatchReg('/\\G(@[\w-]+)\s*:/'))) {
|
1403 |
return $name[1];
|
1404 |
}
|
1405 |
}
|
1406 |
|
1407 |
-
|
1408 |
//
|
1409 |
// The variable part of a variable definition. Used in the `rule` parser
|
1410 |
//
|
1411 |
// @fink();
|
1412 |
//
|
1413 |
-
private function parseRulesetCall(){
|
1414 |
-
|
1415 |
-
|
1416 |
-
return $this->NewObj1('Less_Tree_RulesetCall', $name[1] );
|
1417 |
}
|
1418 |
}
|
1419 |
|
1420 |
-
|
1421 |
//
|
1422 |
// extend syntax - used to extend selectors
|
1423 |
//
|
1424 |
-
function parseExtend($isRule = false){
|
1425 |
-
|
1426 |
$index = $this->pos;
|
1427 |
$extendList = array();
|
1428 |
|
1429 |
-
|
1430 |
-
|
1431 |
|
1432 |
do{
|
1433 |
$option = null;
|
1434 |
$elements = array();
|
1435 |
-
while( true ){
|
1436 |
-
$option = $this->MatchReg('/\\G(all)(?=\s*(\)|,))/');
|
1437 |
-
if( $option ){ break;
|
|
|
1438 |
$e = $this->parseElement();
|
1439 |
-
if( !$e ){ break;
|
|
|
1440 |
$elements[] = $e;
|
1441 |
}
|
1442 |
|
1443 |
-
if( $option ){
|
1444 |
$option = $option[1];
|
1445 |
}
|
1446 |
|
1447 |
-
$extendList[] = $this->NewObj3('Less_Tree_Extend', array( $this->NewObj1('Less_Tree_Selector'
|
1448 |
|
1449 |
-
}while( $this->MatchChar(",") );
|
1450 |
|
1451 |
-
$this->expect('/\\G\)/');
|
1452 |
|
1453 |
-
if( $isRule ){
|
1454 |
-
$this->expect('/\\G;/');
|
1455 |
}
|
1456 |
|
1457 |
return $extendList;
|
1458 |
}
|
1459 |
|
1460 |
-
|
1461 |
//
|
1462 |
// A Mixin call, with an optional argument list
|
1463 |
//
|
@@ -1469,10 +1389,9 @@ class Less_Parser{
|
|
1469 |
// namespaced, but we only support the child and descendant
|
1470 |
// selector for now.
|
1471 |
//
|
1472 |
-
private function parseMixinCall(){
|
1473 |
-
|
1474 |
$char = $this->input[$this->pos];
|
1475 |
-
if( $char !== '.' && $char !== '#' ){
|
1476 |
return;
|
1477 |
}
|
1478 |
|
@@ -1481,110 +1400,105 @@ class Less_Parser{
|
|
1481 |
|
1482 |
$elements = $this->parseMixinCallElements();
|
1483 |
|
1484 |
-
if( $elements ){
|
1485 |
|
1486 |
-
if( $this->MatchChar('(') ){
|
1487 |
-
$returned = $this->parseMixinArgs(true);
|
1488 |
$args = $returned['args'];
|
1489 |
-
$this->expectChar(')');
|
1490 |
-
}else{
|
1491 |
$args = array();
|
1492 |
}
|
1493 |
|
1494 |
$important = $this->parseImportant();
|
1495 |
|
1496 |
-
if( $this->parseEnd() ){
|
1497 |
$this->forget();
|
1498 |
-
return $this->NewObj5('Less_Tree_Mixin_Call', array( $elements, $args, $index, $this->env->currentFileInfo, $important));
|
1499 |
}
|
1500 |
}
|
1501 |
|
1502 |
$this->restore();
|
1503 |
}
|
1504 |
|
1505 |
-
|
1506 |
-
private function parseMixinCallElements(){
|
1507 |
$elements = array();
|
1508 |
$c = null;
|
1509 |
|
1510 |
-
while( true ){
|
1511 |
$elemIndex = $this->pos;
|
1512 |
-
$e = $this->MatchReg('/\\G[#.](?:[\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/');
|
1513 |
-
if( !$e ){
|
1514 |
break;
|
1515 |
}
|
1516 |
-
$elements[] = $this->NewObj4('Less_Tree_Element', array($c, $e[0], $elemIndex, $this->env->currentFileInfo));
|
1517 |
-
$c = $this->MatchChar('>');
|
1518 |
}
|
1519 |
|
1520 |
return $elements;
|
1521 |
}
|
1522 |
|
1523 |
-
|
1524 |
-
|
1525 |
/**
|
1526 |
* @param boolean $isCall
|
1527 |
*/
|
1528 |
-
private function parseMixinArgs( $isCall ){
|
1529 |
$expressions = array();
|
1530 |
$argsSemiColon = array();
|
1531 |
$isSemiColonSeperated = null;
|
1532 |
$argsComma = array();
|
1533 |
$expressionContainsNamed = null;
|
1534 |
$name = null;
|
1535 |
-
$returner = array('args'=>array(), 'variadic'=> false);
|
1536 |
|
1537 |
$this->save();
|
1538 |
|
1539 |
-
while( true ){
|
1540 |
-
if( $isCall ){
|
1541 |
$arg = $this->MatchFuncs( array( 'parseDetachedRuleset','parseExpression' ) );
|
1542 |
} else {
|
1543 |
$this->parseComments();
|
1544 |
-
if( $this->input[ $this->pos ] === '.' && $this->MatchReg('/\\G\.{3}/') ){
|
1545 |
$returner['variadic'] = true;
|
1546 |
-
if( $this->MatchChar(";") && !$isSemiColonSeperated ){
|
1547 |
$isSemiColonSeperated = true;
|
1548 |
}
|
1549 |
|
1550 |
-
if( $isSemiColonSeperated ){
|
1551 |
-
$argsSemiColon[] = array('variadic'=>true);
|
1552 |
-
}else{
|
1553 |
-
$argsComma[] = array('variadic'=>true);
|
1554 |
}
|
1555 |
break;
|
1556 |
}
|
1557 |
-
$arg = $this->MatchFuncs( array('parseEntitiesVariable','parseEntitiesLiteral','parseEntitiesKeyword') );
|
1558 |
}
|
1559 |
|
1560 |
-
if( !$arg ){
|
1561 |
break;
|
1562 |
}
|
1563 |
|
1564 |
-
|
1565 |
$nameLoop = null;
|
1566 |
-
if( $arg instanceof Less_Tree_Expression ){
|
1567 |
$arg->throwAwayComments();
|
1568 |
}
|
1569 |
$value = $arg;
|
1570 |
$val = null;
|
1571 |
|
1572 |
-
if( $isCall ){
|
1573 |
// Variable
|
1574 |
-
if( property_exists($arg,'value') && count($arg->value) == 1 ){
|
1575 |
$val = $arg->value[0];
|
1576 |
}
|
1577 |
} else {
|
1578 |
$val = $arg;
|
1579 |
}
|
1580 |
|
|
|
1581 |
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
if( $isSemiColonSeperated ){
|
1587 |
-
$this->Error('Cannot mix ; and , as delimiter types');
|
1588 |
}
|
1589 |
$expressionContainsNamed = true;
|
1590 |
}
|
@@ -1593,16 +1507,16 @@ class Less_Parser{
|
|
1593 |
// However if we do want to add it, there is nothing blocking it, just don't error
|
1594 |
// and remove isCall dependency below
|
1595 |
$value = null;
|
1596 |
-
if( $isCall ){
|
1597 |
$value = $this->parseDetachedRuleset();
|
1598 |
}
|
1599 |
-
if( !$value ){
|
1600 |
$value = $this->parseExpression();
|
1601 |
}
|
1602 |
|
1603 |
-
if( !$value ){
|
1604 |
-
if( $isCall ){
|
1605 |
-
$this->Error('could not understand value for named argument');
|
1606 |
} else {
|
1607 |
$this->restore();
|
1608 |
$returner['args'] = array();
|
@@ -1610,46 +1524,46 @@ class Less_Parser{
|
|
1610 |
}
|
1611 |
}
|
1612 |
|
1613 |
-
$nameLoop = ($name = $val->name);
|
1614 |
-
}elseif( !$isCall && $this->MatchReg('/\\G\.{3}/') ){
|
1615 |
$returner['variadic'] = true;
|
1616 |
-
if( $this->MatchChar(";") && !$isSemiColonSeperated ){
|
1617 |
$isSemiColonSeperated = true;
|
1618 |
}
|
1619 |
-
if( $isSemiColonSeperated ){
|
1620 |
-
$argsSemiColon[] = array('name'=> $arg->name, 'variadic' => true);
|
1621 |
-
}else{
|
1622 |
-
$argsComma[] = array('name'=> $arg->name, 'variadic' => true);
|
1623 |
}
|
1624 |
break;
|
1625 |
-
}elseif( !$isCall ){
|
1626 |
$name = $nameLoop = $val->name;
|
1627 |
$value = null;
|
1628 |
}
|
1629 |
}
|
1630 |
|
1631 |
-
if( $value ){
|
1632 |
$expressions[] = $value;
|
1633 |
}
|
1634 |
|
1635 |
-
$argsComma[] = array('name'
|
1636 |
|
1637 |
-
if( $this->MatchChar(',') ){
|
1638 |
continue;
|
1639 |
}
|
1640 |
|
1641 |
-
if( $this->MatchChar(';') || $isSemiColonSeperated ){
|
1642 |
|
1643 |
-
if( $expressionContainsNamed ){
|
1644 |
-
$this->Error('Cannot mix ; and , as delimiter types');
|
1645 |
}
|
1646 |
|
1647 |
$isSemiColonSeperated = true;
|
1648 |
|
1649 |
-
if( count($expressions) > 1 ){
|
1650 |
-
$value = $this->NewObj1('Less_Tree_Value', $expressions);
|
1651 |
}
|
1652 |
-
$argsSemiColon[] = array('name'
|
1653 |
|
1654 |
$name = null;
|
1655 |
$expressions = array();
|
@@ -1658,12 +1572,10 @@ class Less_Parser{
|
|
1658 |
}
|
1659 |
|
1660 |
$this->forget();
|
1661 |
-
$returner['args'] = ($isSemiColonSeperated ? $argsSemiColon : $argsComma);
|
1662 |
return $returner;
|
1663 |
}
|
1664 |
|
1665 |
-
|
1666 |
-
|
1667 |
//
|
1668 |
// A Mixin definition, with a list of parameters
|
1669 |
//
|
@@ -1683,52 +1595,50 @@ class Less_Parser{
|
|
1683 |
// Once we've got our params list, and a closing `)`, we parse
|
1684 |
// the `{...}` block.
|
1685 |
//
|
1686 |
-
private function parseMixinDefinition(){
|
1687 |
$cond = null;
|
1688 |
|
1689 |
$char = $this->input[$this->pos];
|
1690 |
-
if( ($char !== '.' && $char !== '#') || ($char === '{' && $this->PeekReg('/\\G[^{]*\}/')) ){
|
1691 |
return;
|
1692 |
}
|
1693 |
|
1694 |
$this->save();
|
1695 |
|
1696 |
-
$match = $this->MatchReg('/\\G([#.](?:[\w-]|\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/');
|
1697 |
-
if( $match ){
|
1698 |
$name = $match[1];
|
1699 |
|
1700 |
$argInfo = $this->parseMixinArgs( false );
|
1701 |
$params = $argInfo['args'];
|
1702 |
$variadic = $argInfo['variadic'];
|
1703 |
|
1704 |
-
|
1705 |
// .mixincall("@{a}");
|
1706 |
// looks a bit like a mixin definition..
|
1707 |
// also
|
1708 |
// .mixincall(@a: {rule: set;});
|
1709 |
// so we have to be nice and restore
|
1710 |
-
if( !$this->MatchChar(')') ){
|
1711 |
$this->furthest = $this->pos;
|
1712 |
$this->restore();
|
1713 |
return;
|
1714 |
}
|
1715 |
|
1716 |
-
|
1717 |
$this->parseComments();
|
1718 |
|
1719 |
-
if ($this->MatchReg('/\\Gwhen/')) { // Guard
|
1720 |
-
$cond = $this->expect('parseConditions', 'Expected conditions');
|
1721 |
}
|
1722 |
|
1723 |
$ruleset = $this->parseBlock();
|
1724 |
|
1725 |
-
if( is_array($ruleset) ){
|
1726 |
$this->forget();
|
1727 |
-
return $this->NewObj5('Less_Tree_Mixin_Definition', array( $name, $params, $ruleset, $cond, $variadic));
|
1728 |
}
|
1729 |
|
1730 |
$this->restore();
|
1731 |
-
}else{
|
1732 |
$this->forget();
|
1733 |
}
|
1734 |
}
|
@@ -1737,9 +1647,8 @@ class Less_Parser{
|
|
1737 |
// Entities are the smallest recognized token,
|
1738 |
// and can be found inside a rule's value.
|
1739 |
//
|
1740 |
-
private function parseEntity(){
|
1741 |
-
|
1742 |
-
return $this->MatchFuncs( array('parseEntitiesLiteral','parseEntitiesVariable','parseEntitiesUrl','parseEntitiesCall','parseEntitiesKeyword','parseEntitiesJavascript','parseComment') );
|
1743 |
}
|
1744 |
|
1745 |
//
|
@@ -1747,8 +1656,8 @@ class Less_Parser{
|
|
1747 |
// because the `block` rule will be expecting it, but we still need to make sure
|
1748 |
// it's there, if ';' was omitted.
|
1749 |
//
|
1750 |
-
private function parseEnd(){
|
1751 |
-
return $this->MatchChar(';') || $this->PeekChar('}');
|
1752 |
}
|
1753 |
|
1754 |
//
|
@@ -1756,27 +1665,25 @@ class Less_Parser{
|
|
1756 |
//
|
1757 |
// alpha(opacity=88)
|
1758 |
//
|
1759 |
-
private function parseAlpha(){
|
1760 |
-
|
1761 |
-
if ( ! $this->MatchReg('/\\G\(opacity=/i')) {
|
1762 |
return;
|
1763 |
}
|
1764 |
|
1765 |
-
$value = $this->MatchReg('/\\G[0-9]+/');
|
1766 |
-
if( $value ){
|
1767 |
$value = $value[0];
|
1768 |
-
}else{
|
1769 |
$value = $this->parseEntitiesVariable();
|
1770 |
-
if( !$value ){
|
1771 |
return;
|
1772 |
}
|
1773 |
}
|
1774 |
|
1775 |
-
$this->expectChar(')');
|
1776 |
-
return $this->NewObj1('Less_Tree_Alpha'
|
1777 |
}
|
1778 |
|
1779 |
-
|
1780 |
//
|
1781 |
// A Selector Element
|
1782 |
//
|
@@ -1789,29 +1696,29 @@ class Less_Parser{
|
|
1789 |
// they are made out of a `Combinator` (see combinator rule),
|
1790 |
// and an element name, such as a tag a class, or `*`.
|
1791 |
//
|
1792 |
-
private function parseElement(){
|
1793 |
$c = $this->parseCombinator();
|
1794 |
$index = $this->pos;
|
1795 |
|
1796 |
-
$e = $this->match( array('/\\G(?:\d+\.\d+|\d+)%/', '/\\G(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/',
|
1797 |
-
'#*', '#&', 'parseAttribute', '/\\G\([^()@]+\)/', '/\\G[\.#](?=@)/', 'parseEntitiesVariableCurly') );
|
1798 |
|
1799 |
-
if( is_null($e) ){
|
1800 |
$this->save();
|
1801 |
-
if( $this->MatchChar('(') ){
|
1802 |
-
if( ($v = $this->parseSelector()) && $this->MatchChar(')') ){
|
1803 |
-
$e = $this->NewObj1('Less_Tree_Paren'
|
1804 |
$this->forget();
|
1805 |
-
}else{
|
1806 |
$this->restore();
|
1807 |
}
|
1808 |
-
}else{
|
1809 |
$this->forget();
|
1810 |
}
|
1811 |
}
|
1812 |
|
1813 |
-
if( !is_null($e) ){
|
1814 |
-
return $this->NewObj4('Less_Tree_Element',array( $c, $e, $index, $this->env->currentFileInfo));
|
1815 |
}
|
1816 |
}
|
1817 |
|
@@ -1823,23 +1730,23 @@ class Less_Parser{
|
|
1823 |
// as it's an empty space. We have to check the previous character
|
1824 |
// in the input, to see if it's a ` ` character.
|
1825 |
//
|
1826 |
-
private function parseCombinator(){
|
1827 |
-
if( $this->pos < $this->input_len ){
|
1828 |
$c = $this->input[$this->pos];
|
1829 |
-
if ($c === '>' || $c === '+' || $c === '~' || $c === '|' || $c === '^' ){
|
1830 |
|
1831 |
$this->pos++;
|
1832 |
-
if( $this->input[$this->pos] === '^' ){
|
1833 |
$c = '^^';
|
1834 |
$this->pos++;
|
1835 |
}
|
1836 |
|
1837 |
-
$this->skipWhitespace(0);
|
1838 |
|
1839 |
return $c;
|
1840 |
}
|
1841 |
|
1842 |
-
if( $this->pos > 0 && $this->isWhitespace(-1) ){
|
1843 |
return ' ';
|
1844 |
}
|
1845 |
}
|
@@ -1849,8 +1756,8 @@ class Less_Parser{
|
|
1849 |
// A CSS selector (see selector below)
|
1850 |
// with less extensions e.g. the ability to extend and guard
|
1851 |
//
|
1852 |
-
private function parseLessSelector(){
|
1853 |
-
return $this->parseSelector(true);
|
1854 |
}
|
1855 |
|
1856 |
//
|
@@ -1861,7 +1768,7 @@ class Less_Parser{
|
|
1861 |
//
|
1862 |
// Selectors are made out of one or more Elements, see above.
|
1863 |
//
|
1864 |
-
private function parseSelector( $isLess = false ){
|
1865 |
$elements = array();
|
1866 |
$extendList = array();
|
1867 |
$condition = null;
|
@@ -1871,127 +1778,126 @@ class Less_Parser{
|
|
1871 |
$c = null;
|
1872 |
$index = $this->pos;
|
1873 |
|
1874 |
-
while( ($isLess && ($extend = $this->parseExtend())) || ($isLess && ($when = $this->MatchReg('/\\Gwhen/') )) || ($e = $this->parseElement()) ){
|
1875 |
-
if( $when ){
|
1876 |
-
$condition = $this->expect('parseConditions', 'expected condition');
|
1877 |
-
}elseif( $condition ){
|
1878 |
-
//error("CSS guard can only be used at the end of selector");
|
1879 |
-
}elseif( $extend ){
|
1880 |
-
$extendList = array_merge($extendList
|
1881 |
-
}else{
|
1882 |
-
//if( count($extendList) ){
|
1883 |
//error("Extend can only be used at the end of selector");
|
1884 |
//}
|
1885 |
-
if( $this->pos < $this->input_len ){
|
1886 |
$c = $this->input[ $this->pos ];
|
1887 |
}
|
1888 |
$elements[] = $e;
|
1889 |
$e = null;
|
1890 |
}
|
1891 |
|
1892 |
-
if( $c === '{' || $c === '}' || $c === ';' || $c === ',' || $c === ')') { break;
|
|
|
1893 |
}
|
1894 |
|
1895 |
-
if( $elements ){
|
1896 |
-
return $this->NewObj5('Less_Tree_Selector',array($elements, $extendList, $condition, $index, $this->env->currentFileInfo));
|
1897 |
}
|
1898 |
-
if( $extendList ) {
|
1899 |
-
$this->Error('Extend must be used to extend a selector, it cannot be used on its own');
|
1900 |
}
|
1901 |
}
|
1902 |
|
1903 |
-
private function parseTag(){
|
1904 |
-
return ( $tag = $this->MatchReg('/\\G[A-Za-z][A-Za-z-]*[0-9]?/') ) ? $tag : $this->MatchChar('*');
|
1905 |
}
|
1906 |
|
1907 |
-
private function parseAttribute(){
|
1908 |
-
|
1909 |
$val = null;
|
1910 |
|
1911 |
-
if( !$this->MatchChar('[') ){
|
1912 |
return;
|
1913 |
}
|
1914 |
|
1915 |
$key = $this->parseEntitiesVariableCurly();
|
1916 |
-
if( !$key ){
|
1917 |
-
$key = $this->expect('/\\G(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\\\.)+/');
|
1918 |
}
|
1919 |
|
1920 |
-
$op = $this->MatchReg('/\\G[|~*$^]?=/');
|
1921 |
-
if( $op ){
|
1922 |
-
$val = $this->match( array('parseEntitiesQuoted','/\\G[0-9]+%/','/\\G[\w-]+/','parseEntitiesVariableCurly') );
|
1923 |
}
|
1924 |
|
1925 |
-
$this->expectChar(']');
|
1926 |
|
1927 |
-
return $this->NewObj3('Less_Tree_Attribute',array( $key, $op === null ? null : $op[0], $val));
|
1928 |
}
|
1929 |
|
1930 |
//
|
1931 |
// The `block` rule is used by `ruleset` and `mixin.definition`.
|
1932 |
// It's a wrapper around the `primary` rule, with added `{}`.
|
1933 |
//
|
1934 |
-
private function parseBlock(){
|
1935 |
-
if( $this->MatchChar('{') ){
|
1936 |
$content = $this->parsePrimary();
|
1937 |
-
if( $this->MatchChar('}') ){
|
1938 |
return $content;
|
1939 |
}
|
1940 |
}
|
1941 |
}
|
1942 |
|
1943 |
-
private function parseBlockRuleset(){
|
1944 |
$block = $this->parseBlock();
|
1945 |
|
1946 |
-
if( $block ){
|
1947 |
-
$block = $this->NewObj2('Less_Tree_Ruleset',array( null, $block));
|
1948 |
}
|
1949 |
|
1950 |
return $block;
|
1951 |
}
|
1952 |
|
1953 |
-
private function parseDetachedRuleset(){
|
1954 |
$blockRuleset = $this->parseBlockRuleset();
|
1955 |
-
if( $blockRuleset ){
|
1956 |
-
return $this->NewObj1('Less_Tree_DetachedRuleset'
|
1957 |
}
|
1958 |
}
|
1959 |
|
1960 |
//
|
1961 |
// div, .class, body > p {...}
|
1962 |
//
|
1963 |
-
private function parseRuleset(){
|
1964 |
$selectors = array();
|
1965 |
|
1966 |
$this->save();
|
1967 |
|
1968 |
-
while( true ){
|
1969 |
$s = $this->parseLessSelector();
|
1970 |
-
if( !$s ){
|
1971 |
break;
|
1972 |
}
|
1973 |
$selectors[] = $s;
|
1974 |
$this->parseComments();
|
1975 |
|
1976 |
-
if( $s->condition && count($selectors) > 1 ){
|
1977 |
-
$this->Error('Guards are only currently allowed on a single selector.');
|
1978 |
}
|
1979 |
|
1980 |
-
if( !$this->MatchChar(',') ){
|
1981 |
break;
|
1982 |
}
|
1983 |
-
if( $s->condition ){
|
1984 |
-
$this->Error('Guards are only currently allowed on a single selector.');
|
1985 |
}
|
1986 |
$this->parseComments();
|
1987 |
}
|
1988 |
|
1989 |
-
|
1990 |
-
if( $selectors ){
|
1991 |
$rules = $this->parseBlock();
|
1992 |
-
if( is_array($rules) ){
|
1993 |
$this->forget();
|
1994 |
-
return $this->NewObj2('Less_Tree_Ruleset',array( $selectors, $rules)); //Less_Environment::$strictImports
|
1995 |
}
|
1996 |
}
|
1997 |
|
@@ -2005,63 +1911,59 @@ class Less_Parser{
|
|
2005 |
* ex: width:100px;
|
2006 |
*
|
2007 |
*/
|
2008 |
-
private function parseNameValue(){
|
2009 |
-
|
2010 |
$index = $this->pos;
|
2011 |
$this->save();
|
2012 |
|
|
|
|
|
|
|
2013 |
|
2014 |
-
|
2015 |
-
|
2016 |
-
if( $match ){
|
2017 |
-
|
2018 |
-
if( $match[4] == '}' ){
|
2019 |
-
$this->pos = $index + strlen($match[0])-1;
|
2020 |
}
|
2021 |
|
2022 |
-
if( $match[3] ){
|
2023 |
$match[2] .= ' !important';
|
2024 |
}
|
2025 |
|
2026 |
-
return $this->NewObj4('Less_Tree_NameValue',array( $match[1], $match[2], $index, $this->env->currentFileInfo));
|
2027 |
}
|
2028 |
|
2029 |
$this->restore();
|
2030 |
}
|
2031 |
|
2032 |
-
|
2033 |
-
private function parseRule( $tryAnonymous = null ){
|
2034 |
-
|
2035 |
$merge = false;
|
2036 |
$startOfRule = $this->pos;
|
2037 |
|
2038 |
$c = $this->input[$this->pos];
|
2039 |
-
if( $c === '.' || $c === '#' || $c === '&' ){
|
2040 |
return;
|
2041 |
}
|
2042 |
|
2043 |
$this->save();
|
2044 |
-
$name = $this->MatchFuncs( array('parseVariable','parseRuleProperty'));
|
2045 |
|
2046 |
-
if( $name ){
|
2047 |
|
2048 |
-
$isVariable = is_string($name);
|
2049 |
|
2050 |
$value = null;
|
2051 |
-
if( $isVariable ){
|
2052 |
$value = $this->parseDetachedRuleset();
|
2053 |
}
|
2054 |
|
2055 |
$important = null;
|
2056 |
-
if( !$value ){
|
2057 |
|
2058 |
// prefer to try to parse first if its a variable or we are compressing
|
2059 |
// but always fallback on the other one
|
2060 |
//if( !$tryAnonymous && is_string($name) && $name[0] === '@' ){
|
2061 |
-
if( !$tryAnonymous && (Less_Parser::$options['compress'] || $isVariable) ){
|
2062 |
-
$value = $this->MatchFuncs( array('parseValue','parseAnonymousValue'));
|
2063 |
-
}else{
|
2064 |
-
$value = $this->MatchFuncs( array('parseAnonymousValue','parseValue'));
|
2065 |
}
|
2066 |
|
2067 |
$important = $this->parseImportant();
|
@@ -2069,35 +1971,33 @@ class Less_Parser{
|
|
2069 |
// a name returned by this.ruleProperty() is always an array of the form:
|
2070 |
// [string-1, ..., string-n, ""] or [string-1, ..., string-n, "+"]
|
2071 |
// where each item is a tree.Keyword or tree.Variable
|
2072 |
-
if( !$isVariable && is_array($name) ){
|
2073 |
-
$nm = array_pop($name);
|
2074 |
-
if( $nm->value ){
|
2075 |
$merge = $nm->value;
|
2076 |
}
|
2077 |
}
|
2078 |
}
|
2079 |
|
2080 |
-
|
2081 |
-
if( $value && $this->parseEnd() ){
|
2082 |
$this->forget();
|
2083 |
-
return $this->NewObj6('Less_Tree_Rule',array( $name, $value, $important, $merge, $startOfRule, $this->env->currentFileInfo));
|
2084 |
-
}else{
|
2085 |
$this->furthest = $this->pos;
|
2086 |
$this->restore();
|
2087 |
-
if( $value && !$tryAnonymous ){
|
2088 |
-
return $this->parseRule(true);
|
2089 |
}
|
2090 |
}
|
2091 |
-
}else{
|
2092 |
$this->forget();
|
2093 |
}
|
2094 |
}
|
2095 |
|
2096 |
-
function parseAnonymousValue(){
|
2097 |
-
|
2098 |
-
|
2099 |
-
$this->
|
2100 |
-
return $this->NewObj1('Less_Tree_Anonymous',$match[1]);
|
2101 |
}
|
2102 |
}
|
2103 |
|
@@ -2111,25 +2011,24 @@ class Less_Parser{
|
|
2111 |
// file-system operation. The function used for importing is
|
2112 |
// stored in `import`, which we pass to the Import constructor.
|
2113 |
//
|
2114 |
-
private function parseImport(){
|
2115 |
-
|
2116 |
$this->save();
|
2117 |
|
2118 |
-
$dir = $this->MatchReg('/\\G@import?\s+/');
|
2119 |
|
2120 |
-
if( $dir ){
|
2121 |
$options = $this->parseImportOptions();
|
2122 |
-
$path = $this->MatchFuncs( array('parseEntitiesQuoted','parseEntitiesUrl'));
|
2123 |
|
2124 |
-
if( $path ){
|
2125 |
$features = $this->parseMediaFeatures();
|
2126 |
-
if( $this->MatchChar(';') ){
|
2127 |
-
if( $features ){
|
2128 |
-
$features = $this->NewObj1('Less_Tree_Value'
|
2129 |
}
|
2130 |
|
2131 |
$this->forget();
|
2132 |
-
return $this->NewObj5('Less_Tree_Import',array( $path, $features, $options, $this->pos, $this->env->currentFileInfo));
|
2133 |
}
|
2134 |
}
|
2135 |
}
|
@@ -2137,19 +2036,18 @@ class Less_Parser{
|
|
2137 |
$this->restore();
|
2138 |
}
|
2139 |
|
2140 |
-
private function parseImportOptions(){
|
2141 |
-
|
2142 |
$options = array();
|
2143 |
|
2144 |
// list of options, surrounded by parens
|
2145 |
-
if( !$this->MatchChar('(') ){
|
2146 |
return $options;
|
2147 |
}
|
2148 |
do{
|
2149 |
$optionName = $this->parseImportOption();
|
2150 |
-
if( $optionName ){
|
2151 |
$value = true;
|
2152 |
-
switch( $optionName ){
|
2153 |
case "css":
|
2154 |
$optionName = "less";
|
2155 |
$value = false;
|
@@ -2160,16 +2058,17 @@ class Less_Parser{
|
|
2160 |
break;
|
2161 |
}
|
2162 |
$options[$optionName] = $value;
|
2163 |
-
if( !$this->MatchChar(',') ){ break;
|
|
|
2164 |
}
|
2165 |
-
}while( $optionName );
|
2166 |
-
$this->expectChar(')');
|
2167 |
return $options;
|
2168 |
}
|
2169 |
|
2170 |
-
private function parseImportOption(){
|
2171 |
-
$opt = $this->MatchReg('/\\G(less|css|multiple|once|inline|reference|optional)/');
|
2172 |
-
if( $opt ){
|
2173 |
return $opt[1];
|
2174 |
}
|
2175 |
}
|
@@ -2178,28 +2077,27 @@ class Less_Parser{
|
|
2178 |
$nodes = array();
|
2179 |
|
2180 |
do{
|
2181 |
-
$e = $this->MatchFuncs(array('parseEntitiesKeyword','parseEntitiesVariable'));
|
2182 |
-
if( $e ){
|
2183 |
$nodes[] = $e;
|
2184 |
-
} elseif ($this->MatchChar('(')) {
|
2185 |
$p = $this->parseProperty();
|
2186 |
$e = $this->parseValue();
|
2187 |
-
if ($this->MatchChar(')')) {
|
2188 |
-
if ($p && $e) {
|
2189 |
-
$r = $this->NewObj7('Less_Tree_Rule', array( $p, $e, null, null, $this->pos, $this->env->currentFileInfo, true));
|
2190 |
-
$nodes[] = $this->NewObj1('Less_Tree_Paren'
|
2191 |
-
} elseif ($e) {
|
2192 |
-
$nodes[] = $this->NewObj1('Less_Tree_Paren'
|
2193 |
} else {
|
2194 |
return null;
|
2195 |
}
|
2196 |
-
} else
|
2197 |
-
return null;
|
2198 |
}
|
2199 |
-
} while ($e);
|
2200 |
|
2201 |
-
if ($nodes) {
|
2202 |
-
return $this->NewObj1('Less_Tree_Expression'
|
2203 |
}
|
2204 |
}
|
2205 |
|
@@ -2208,41 +2106,39 @@ class Less_Parser{
|
|
2208 |
|
2209 |
do{
|
2210 |
$e = $this->parseMediaFeature();
|
2211 |
-
if( $e ){
|
2212 |
$features[] = $e;
|
2213 |
-
if (!$this->MatchChar(',')) break;
|
2214 |
-
}else{
|
2215 |
$e = $this->parseEntitiesVariable();
|
2216 |
-
if( $e ){
|
2217 |
$features[] = $e;
|
2218 |
-
if (!$this->MatchChar(',')) break;
|
2219 |
}
|
2220 |
}
|
2221 |
-
} while ($e);
|
2222 |
|
2223 |
return $features ? $features : null;
|
2224 |
}
|
2225 |
|
2226 |
private function parseMedia() {
|
2227 |
-
if( $this->MatchReg('/\\G@media/') ){
|
2228 |
$features = $this->parseMediaFeatures();
|
2229 |
$rules = $this->parseBlock();
|
2230 |
|
2231 |
-
if( is_array($rules) ){
|
2232 |
-
return $this->NewObj4('Less_Tree_Media',array( $rules, $features, $this->pos, $this->env->currentFileInfo));
|
2233 |
}
|
2234 |
}
|
2235 |
}
|
2236 |
|
2237 |
-
|
2238 |
//
|
2239 |
// A CSS Directive
|
2240 |
//
|
2241 |
// @charset "utf-8";
|
2242 |
//
|
2243 |
-
private function parseDirective(){
|
2244 |
-
|
2245 |
-
if( !$this->PeekChar('@') ){
|
2246 |
return;
|
2247 |
}
|
2248 |
|
@@ -2253,28 +2149,25 @@ class Less_Parser{
|
|
2253 |
$hasExpression = false;
|
2254 |
$hasUnknown = false;
|
2255 |
|
2256 |
-
|
2257 |
-
$value
|
2258 |
-
if( $value ){
|
2259 |
return $value;
|
2260 |
}
|
2261 |
|
2262 |
$this->save();
|
2263 |
|
2264 |
-
$name = $this->MatchReg('/\\G@[a-z-]+/');
|
2265 |
|
2266 |
-
if( !$name ) return;
|
2267 |
$name = $name[0];
|
2268 |
|
2269 |
-
|
2270 |
$nonVendorSpecificName = $name;
|
2271 |
-
$pos = strpos($name,'-', 2);
|
2272 |
-
if( $name[1] == '-' && $pos > 0 ){
|
2273 |
-
$nonVendorSpecificName = "@" . substr($name, $pos + 1);
|
2274 |
}
|
2275 |
|
2276 |
-
|
2277 |
-
switch( $nonVendorSpecificName ){
|
2278 |
/*
|
2279 |
case "@font-face":
|
2280 |
case "@viewport":
|
@@ -2316,37 +2209,36 @@ class Less_Parser{
|
|
2316 |
break;
|
2317 |
}
|
2318 |
|
2319 |
-
if( $hasIdentifier ){
|
2320 |
$value = $this->parseEntity();
|
2321 |
-
if( !$value ){
|
2322 |
-
$this->error("expected " . $name . " identifier");
|
2323 |
}
|
2324 |
-
} else if( $hasExpression ){
|
2325 |
$value = $this->parseExpression();
|
2326 |
-
if( !$value ){
|
2327 |
-
$this->error("expected " . $name. " expression");
|
2328 |
}
|
2329 |
-
} else if ($hasUnknown) {
|
2330 |
|
2331 |
-
$value = $this->MatchReg('/\\G[^{;]+/');
|
2332 |
-
if( $value ){
|
2333 |
-
$value = $this->NewObj1('Less_Tree_Anonymous',trim($value[0]));
|
2334 |
}
|
2335 |
}
|
2336 |
|
2337 |
-
if( $hasBlock ){
|
2338 |
$rules = $this->parseBlockRuleset();
|
2339 |
}
|
2340 |
|
2341 |
-
if( $rules || (!$hasBlock && $value && $this->MatchChar(';'))) {
|
2342 |
$this->forget();
|
2343 |
-
return $this->NewObj5('Less_Tree_Directive',array($name, $value, $rules, $index, $this->env->currentFileInfo));
|
2344 |
}
|
2345 |
|
2346 |
$this->restore();
|
2347 |
}
|
2348 |
|
2349 |
-
|
2350 |
//
|
2351 |
// A Value is a comma-delimited list of Expressions
|
2352 |
//
|
@@ -2355,121 +2247,116 @@ class Less_Parser{
|
|
2355 |
// In a Rule, a Value represents everything after the `:`,
|
2356 |
// and before the `;`.
|
2357 |
//
|
2358 |
-
private function parseValue(){
|
2359 |
$expressions = array();
|
2360 |
|
2361 |
do{
|
2362 |
$e = $this->parseExpression();
|
2363 |
-
if( $e ){
|
2364 |
$expressions[] = $e;
|
2365 |
-
if (
|
2366 |
break;
|
2367 |
}
|
2368 |
}
|
2369 |
-
}while($e);
|
2370 |
|
2371 |
-
if( $expressions ){
|
2372 |
-
return $this->NewObj1('Less_Tree_Value'
|
2373 |
}
|
2374 |
}
|
2375 |
|
2376 |
-
private function parseImportant
|
2377 |
-
if( $this->PeekChar('!') && $this->MatchReg('/\\G! *important/') ){
|
2378 |
return ' !important';
|
2379 |
}
|
2380 |
}
|
2381 |
|
2382 |
-
private function parseSub
|
2383 |
-
|
2384 |
-
if( $this->MatchChar('(') ){
|
2385 |
$a = $this->parseAddition();
|
2386 |
-
if( $a ){
|
2387 |
-
$this->expectChar(')');
|
2388 |
-
return $this->NewObj2('Less_Tree_Expression',array( array($a), true) ); //instead of $e->parens = true so the value is cached
|
2389 |
}
|
2390 |
}
|
2391 |
}
|
2392 |
|
2393 |
-
|
2394 |
/**
|
2395 |
* Parses multiplication operation
|
2396 |
*
|
2397 |
* @return Less_Tree_Operation|null
|
2398 |
*/
|
2399 |
-
function parseMultiplication(){
|
2400 |
-
|
2401 |
$return = $m = $this->parseOperand();
|
2402 |
-
if( $return ){
|
2403 |
-
while( true ){
|
2404 |
|
2405 |
$isSpaced = $this->isWhitespace( -1 );
|
2406 |
|
2407 |
-
if( $this->PeekReg('/\\G\/[*\/]/') ){
|
2408 |
break;
|
2409 |
}
|
2410 |
|
2411 |
-
$op = $this->MatchChar('/');
|
2412 |
-
if( !$op ){
|
2413 |
-
$op = $this->MatchChar('*');
|
2414 |
-
if( !$op ){
|
2415 |
break;
|
2416 |
}
|
2417 |
}
|
2418 |
|
2419 |
$a = $this->parseOperand();
|
2420 |
|
2421 |
-
if(!$a) { break;
|
|
|
2422 |
|
2423 |
$m->parensInOp = true;
|
2424 |
$a->parensInOp = true;
|
2425 |
-
$return = $this->NewObj3('Less_Tree_Operation',array( $op, array( $return, $a ), $isSpaced) );
|
2426 |
}
|
2427 |
}
|
2428 |
return $return;
|
2429 |
|
2430 |
}
|
2431 |
|
2432 |
-
|
2433 |
/**
|
2434 |
* Parses an addition operation
|
2435 |
*
|
2436 |
* @return Less_Tree_Operation|null
|
2437 |
*/
|
2438 |
-
private function parseAddition
|
2439 |
-
|
2440 |
$return = $m = $this->parseMultiplication();
|
2441 |
-
if( $return ){
|
2442 |
-
while( true ){
|
2443 |
|
2444 |
$isSpaced = $this->isWhitespace( -1 );
|
2445 |
|
2446 |
-
$op = $this->MatchReg('/\\G[-+]\s+/');
|
2447 |
-
if( $op ){
|
2448 |
$op = $op[0];
|
2449 |
-
}else{
|
2450 |
-
if( !$isSpaced ){
|
2451 |
-
$op = $this->match(array('#+','#-'));
|
2452 |
}
|
2453 |
-
if( !$op ){
|
2454 |
break;
|
2455 |
}
|
2456 |
}
|
2457 |
|
2458 |
$a = $this->parseMultiplication();
|
2459 |
-
if( !$a ){
|
2460 |
break;
|
2461 |
}
|
2462 |
|
2463 |
$m->parensInOp = true;
|
2464 |
$a->parensInOp = true;
|
2465 |
-
$return = $this->NewObj3('Less_Tree_Operation',array($op, array($return, $a), $isSpaced));
|
2466 |
}
|
2467 |
}
|
2468 |
|
2469 |
return $return;
|
2470 |
}
|
2471 |
|
2472 |
-
|
2473 |
/**
|
2474 |
* Parses the conditions
|
2475 |
*
|
@@ -2478,17 +2365,17 @@ class Less_Parser{
|
|
2478 |
private function parseConditions() {
|
2479 |
$index = $this->pos;
|
2480 |
$return = $a = $this->parseCondition();
|
2481 |
-
if( $a ){
|
2482 |
-
while( true ){
|
2483 |
-
if( !$this->PeekReg('/\\G,\s*(not\s*)?\(/') ||
|
2484 |
break;
|
2485 |
}
|
2486 |
$b = $this->parseCondition();
|
2487 |
-
if( !$b ){
|
2488 |
break;
|
2489 |
}
|
2490 |
|
2491 |
-
$return = $this->NewObj4('Less_Tree_Condition',array('or', $return, $b, $index));
|
2492 |
}
|
2493 |
return $return;
|
2494 |
}
|
@@ -2499,25 +2386,25 @@ class Less_Parser{
|
|
2499 |
$negate = false;
|
2500 |
$c = null;
|
2501 |
|
2502 |
-
if ($this->MatchReg('/\\Gnot/')) $negate = true;
|
2503 |
-
$this->expectChar('(');
|
2504 |
-
$a = $this->MatchFuncs(array('parseAddition','parseEntitiesKeyword','parseEntitiesQuoted'));
|
2505 |
|
2506 |
-
if( $a ){
|
2507 |
-
$op = $this->MatchReg('/\\G(?:>=|<=|=<|[<=>])/');
|
2508 |
-
if( $op ){
|
2509 |
-
$b = $this->MatchFuncs(array('parseAddition','parseEntitiesKeyword','parseEntitiesQuoted'));
|
2510 |
-
if( $b ){
|
2511 |
-
$c = $this->NewObj5('Less_Tree_Condition',array($op[0], $a, $b, $index, $negate));
|
2512 |
} else {
|
2513 |
-
$this->Error('Unexpected expression');
|
2514 |
}
|
2515 |
} else {
|
2516 |
-
$k = $this->NewObj1('Less_Tree_Keyword','true');
|
2517 |
-
$c = $this->NewObj5('Less_Tree_Condition',array('=', $a, $k, $index, $negate));
|
2518 |
}
|
2519 |
-
$this->expectChar(')');
|
2520 |
-
return $this->MatchReg('/\\Gand/') ? $this->NewObj3('Less_Tree_Condition',array('and', $c, $this->parseCondition())) : $c;
|
2521 |
}
|
2522 |
}
|
2523 |
|
@@ -2526,291 +2413,279 @@ class Less_Parser{
|
|
2526 |
* such as a Color, or a Variable
|
2527 |
*
|
2528 |
*/
|
2529 |
-
private function parseOperand
|
2530 |
-
|
2531 |
$negate = false;
|
2532 |
-
$offset = $this->pos+1;
|
2533 |
-
if( $offset >= $this->input_len ){
|
2534 |
return;
|
2535 |
}
|
2536 |
$char = $this->input[$offset];
|
2537 |
-
if( $char === '@' || $char === '(' ){
|
2538 |
-
$negate = $this->MatchChar('-');
|
2539 |
}
|
2540 |
|
2541 |
-
$o = $this->MatchFuncs(array('parseSub','parseEntitiesDimension','parseEntitiesColor','parseEntitiesVariable','parseEntitiesCall'));
|
2542 |
|
2543 |
-
if( $negate ){
|
2544 |
$o->parensInOp = true;
|
2545 |
-
$o = $this->NewObj1('Less_Tree_Negative'
|
2546 |
}
|
2547 |
|
2548 |
return $o;
|
2549 |
}
|
2550 |
|
2551 |
-
|
2552 |
/**
|
2553 |
* Expressions either represent mathematical operations,
|
2554 |
* or white-space delimited Entities.
|
2555 |
*
|
2556 |
* 1px solid black
|
2557 |
-
*
|
2558 |
*
|
2559 |
* @return Less_Tree_Expression|null
|
2560 |
*/
|
2561 |
-
private function parseExpression
|
2562 |
$entities = array();
|
2563 |
|
2564 |
do{
|
2565 |
-
$e = $this->MatchFuncs(array('parseAddition','parseEntity'));
|
2566 |
-
if( $e ){
|
2567 |
$entities[] = $e;
|
2568 |
// operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
|
2569 |
-
if( !$this->PeekReg('/\\G\/[\/*]/') ){
|
2570 |
-
$delim = $this->MatchChar('/');
|
2571 |
-
if( $delim ){
|
2572 |
-
$entities[] = $this->NewObj1('Less_Tree_Anonymous'
|
2573 |
}
|
2574 |
}
|
2575 |
}
|
2576 |
-
}while($e);
|
2577 |
|
2578 |
-
if( $entities ){
|
2579 |
-
return $this->NewObj1('Less_Tree_Expression'
|
2580 |
}
|
2581 |
}
|
2582 |
|
2583 |
-
|
2584 |
/**
|
2585 |
* Parse a property
|
2586 |
* eg: 'min-width', 'orientation', etc
|
2587 |
*
|
2588 |
* @return string
|
2589 |
*/
|
2590 |
-
private function parseProperty
|
2591 |
-
$name = $this->MatchReg('/\\G(\*?-?[_a-zA-Z0-9-]+)\s*:/');
|
2592 |
-
if( $name ){
|
2593 |
return $name[1];
|
2594 |
}
|
2595 |
}
|
2596 |
|
2597 |
-
|
2598 |
/**
|
2599 |
* Parse a rule property
|
2600 |
* eg: 'color', 'width', 'height', etc
|
2601 |
*
|
2602 |
* @return string
|
2603 |
*/
|
2604 |
-
private function parseRuleProperty(){
|
2605 |
$offset = $this->pos;
|
2606 |
$name = array();
|
2607 |
$index = array();
|
2608 |
$length = 0;
|
2609 |
|
|
|
|
|
2610 |
|
2611 |
-
$this->rulePropertyMatch('/\\G(
|
2612 |
-
while( $this->rulePropertyMatch('/\\G((?:[\w-]+)|(?:@\{[\w-]+\}))/', $offset, $length, $index, $name )); // !
|
2613 |
-
|
2614 |
-
if( (count($name) > 1) && $this->rulePropertyMatch('/\\G\s*((?:\+_|\+)?)\s*:/', $offset, $length, $index, $name) ){
|
2615 |
// at last, we have the complete match now. move forward,
|
2616 |
// convert name particles to tree objects and return:
|
2617 |
-
$this->skipWhitespace($length);
|
2618 |
|
2619 |
-
if( $name[0] === '' ){
|
2620 |
-
array_shift($name);
|
2621 |
-
array_shift($index);
|
2622 |
}
|
2623 |
-
foreach($name as $k => $s ){
|
2624 |
-
if( !$s || $s[0] !== '@' ){
|
2625 |
-
$name[$k] = $this->NewObj1('Less_Tree_Keyword'
|
2626 |
-
}else{
|
2627 |
-
$name[$k] = $this->NewObj3('Less_Tree_Variable',array('@' . substr($s,2
|
2628 |
}
|
2629 |
}
|
2630 |
return $name;
|
2631 |
}
|
2632 |
|
2633 |
-
|
2634 |
}
|
2635 |
|
2636 |
-
private function rulePropertyMatch( $re, &$offset, &$length,
|
2637 |
-
preg_match($re, $this->input, $a, 0, $offset);
|
2638 |
-
if( $a ){
|
2639 |
$index[] = $this->pos + $length;
|
2640 |
-
$length += strlen($a[0]);
|
2641 |
-
$offset += strlen($a[0]);
|
2642 |
$name[] = $a[1];
|
2643 |
return true;
|
2644 |
}
|
2645 |
}
|
2646 |
|
2647 |
-
public static function serializeVars( $vars ){
|
2648 |
$s = '';
|
2649 |
|
2650 |
-
foreach($vars as $name => $value){
|
2651 |
-
$s .= (($name[0] === '@') ? '' : '@') . $name .': '. $value . ((substr($value
|
2652 |
}
|
2653 |
|
2654 |
return $s;
|
2655 |
}
|
2656 |
|
2657 |
-
|
2658 |
/**
|
2659 |
* Some versions of php have trouble with method_exists($a,$b) if $a is not an object
|
2660 |
*
|
2661 |
* @param string $b
|
2662 |
*/
|
2663 |
-
public static function is_method($a
|
2664 |
-
return is_object($a) && method_exists($a
|
2665 |
}
|
2666 |
|
2667 |
-
|
2668 |
/**
|
2669 |
* Round numbers similarly to javascript
|
2670 |
* eg: 1.499999 to 1 instead of 2
|
2671 |
*
|
2672 |
*/
|
2673 |
-
public static function round($i, $precision = 0){
|
2674 |
-
|
2675 |
-
$
|
2676 |
-
|
2677 |
-
|
2678 |
-
$
|
2679 |
-
$
|
2680 |
-
|
2681 |
-
|
2682 |
-
|
2683 |
-
return $floor/$precision;
|
2684 |
}
|
2685 |
}
|
2686 |
|
2687 |
-
|
2688 |
/**
|
2689 |
* Create Less_Tree_* objects and optionally generate a cache string
|
2690 |
*
|
2691 |
* @return mixed
|
2692 |
*/
|
2693 |
-
public function NewObj0($class){
|
2694 |
$obj = new $class();
|
2695 |
-
if( $this->CacheEnabled() ){
|
2696 |
$obj->cache_string = ' new '.$class.'()';
|
2697 |
}
|
2698 |
return $obj;
|
2699 |
}
|
2700 |
|
2701 |
-
public function NewObj1($class, $arg){
|
2702 |
$obj = new $class( $arg );
|
2703 |
-
if( $this->CacheEnabled() ){
|
2704 |
-
$obj->cache_string = ' new '.$class.'('.Less_Parser::ArgString($arg).')';
|
2705 |
}
|
2706 |
return $obj;
|
2707 |
}
|
2708 |
|
2709 |
-
public function NewObj2($class, $args){
|
2710 |
$obj = new $class( $args[0], $args[1] );
|
2711 |
-
if( $this->CacheEnabled() ){
|
2712 |
-
$this->ObjCache( $obj, $class, $args);
|
2713 |
}
|
2714 |
return $obj;
|
2715 |
}
|
2716 |
|
2717 |
-
public function NewObj3($class, $args){
|
2718 |
$obj = new $class( $args[0], $args[1], $args[2] );
|
2719 |
-
if( $this->CacheEnabled() ){
|
2720 |
-
$this->ObjCache( $obj, $class, $args);
|
2721 |
}
|
2722 |
return $obj;
|
2723 |
}
|
2724 |
|
2725 |
-
public function NewObj4($class, $args){
|
2726 |
$obj = new $class( $args[0], $args[1], $args[2], $args[3] );
|
2727 |
-
if( $this->CacheEnabled() ){
|
2728 |
-
$this->ObjCache( $obj, $class, $args);
|
2729 |
}
|
2730 |
return $obj;
|
2731 |
}
|
2732 |
|
2733 |
-
public function NewObj5($class, $args){
|
2734 |
$obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4] );
|
2735 |
-
if( $this->CacheEnabled() ){
|
2736 |
-
$this->ObjCache( $obj, $class, $args);
|
2737 |
}
|
2738 |
return $obj;
|
2739 |
}
|
2740 |
|
2741 |
-
public function NewObj6($class, $args){
|
2742 |
$obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4], $args[5] );
|
2743 |
-
if( $this->CacheEnabled() ){
|
2744 |
-
$this->ObjCache( $obj, $class, $args);
|
2745 |
}
|
2746 |
return $obj;
|
2747 |
}
|
2748 |
|
2749 |
-
public function NewObj7($class, $args){
|
2750 |
$obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6] );
|
2751 |
-
if( $this->CacheEnabled() ){
|
2752 |
-
$this->ObjCache( $obj, $class, $args);
|
2753 |
}
|
2754 |
return $obj;
|
2755 |
}
|
2756 |
|
2757 |
-
//caching
|
2758 |
-
public function ObjCache($obj, $class, $args=array()){
|
2759 |
-
$obj->cache_string = ' new '.$class.'('. self::ArgCache($args).')';
|
2760 |
}
|
2761 |
|
2762 |
-
public function ArgCache($args){
|
2763 |
-
return implode(',',array_map( array('Less_Parser','ArgString')
|
2764 |
}
|
2765 |
|
2766 |
-
|
2767 |
/**
|
2768 |
* Convert an argument to a string for use in the parser cache
|
2769 |
*
|
2770 |
* @return string
|
2771 |
*/
|
2772 |
-
public static function ArgString($arg){
|
2773 |
-
|
2774 |
-
$type = gettype($arg);
|
2775 |
|
2776 |
-
if( $type === 'object'){
|
2777 |
$string = $arg->cache_string;
|
2778 |
-
unset($arg->cache_string);
|
2779 |
return $string;
|
2780 |
|
2781 |
-
}elseif( $type === 'array' ){
|
2782 |
$string = ' Array(';
|
2783 |
-
foreach($arg as $k => $a){
|
2784 |
-
$string .= var_export($k,true).' => '.self::ArgString($a).',';
|
2785 |
}
|
2786 |
return $string . ')';
|
2787 |
}
|
2788 |
|
2789 |
-
return var_export($arg,true);
|
2790 |
}
|
2791 |
|
2792 |
-
public function Error($msg){
|
2793 |
-
throw new Less_Exception_Parser($msg, null, $this->furthest, $this->env->currentFileInfo);
|
2794 |
}
|
2795 |
|
2796 |
-
public static function WinPath($path){
|
2797 |
-
return str_replace('\\', '/', $path);
|
2798 |
}
|
2799 |
|
2800 |
-
public static function AbsPath($path, $winPath = false){
|
2801 |
-
if (strpos($path, '//') !== false && preg_match('_^(https?:)?//\\w+(\\.\\w+)+/\\w+_i', $path)) {
|
2802 |
return $winPath ? '' : false;
|
2803 |
} else {
|
2804 |
-
$path = realpath($path);
|
2805 |
-
if ($winPath) {
|
2806 |
-
$path = self::WinPath($path);
|
2807 |
}
|
2808 |
return $path;
|
2809 |
}
|
2810 |
}
|
2811 |
|
2812 |
-
public function CacheEnabled(){
|
2813 |
-
return (Less_Parser::$options['cache_method'] && (Less_Cache::$cache_dir || (Less_Parser::$options['cache_method'] == 'callback')));
|
2814 |
}
|
2815 |
|
2816 |
}
|
1 |
<?php
|
2 |
|
3 |
+
require_once dirname( __FILE__ ).'/Cache.php';
|
4 |
|
5 |
/**
|
6 |
* Class for parsing and compiling less files into css
|
9 |
* @subpackage parser
|
10 |
*
|
11 |
*/
|
12 |
+
class Less_Parser {
|
|
|
13 |
|
14 |
/**
|
15 |
* Default parser options
|
42 |
|
43 |
public static $options = array();
|
44 |
|
|
|
45 |
private $input; // Less input string
|
46 |
private $input_len; // input string length
|
47 |
private $pos; // current index in `input`
|
69 |
*/
|
70 |
public static $contentsMap = array();
|
71 |
|
|
|
72 |
/**
|
73 |
* @param Less_Environment|array|null $env
|
74 |
*/
|
75 |
+
public function __construct( $env = null ) {
|
|
|
76 |
// Top parser on an import tree must be sure there is one "env"
|
77 |
// which will then be passed around by reference.
|
78 |
+
if ( $env instanceof Less_Environment ) {
|
79 |
$this->env = $env;
|
80 |
+
} else {
|
81 |
+
$this->SetOptions( Less_Parser::$default_options );
|
82 |
$this->Reset( $env );
|
83 |
}
|
84 |
|
85 |
// mbstring.func_overload > 1 bugfix
|
86 |
// The encoding value must be set for each source file,
|
87 |
// therefore, to conserve resources and improve the speed of this design is taken here
|
88 |
+
if ( ini_get( 'mbstring.func_overload' ) ) {
|
89 |
+
$this->mb_internal_encoding = ini_get( 'mbstring.internal_encoding' );
|
90 |
+
@ini_set( 'mbstring.internal_encoding', 'ascii' );
|
91 |
}
|
92 |
|
93 |
}
|
94 |
|
|
|
95 |
/**
|
96 |
* Reset the parser state completely
|
97 |
*
|
98 |
*/
|
99 |
+
public function Reset( $options = null ) {
|
100 |
$this->rules = array();
|
101 |
self::$imports = array();
|
102 |
self::$has_extends = false;
|
103 |
self::$imports = array();
|
104 |
self::$contentsMap = array();
|
105 |
|
106 |
+
$this->env = new Less_Environment( $options );
|
107 |
|
108 |
+
// set new options
|
109 |
+
if ( is_array( $options ) ) {
|
110 |
+
$this->SetOptions( Less_Parser::$default_options );
|
111 |
+
$this->SetOptions( $options );
|
112 |
}
|
113 |
|
114 |
$this->env->Init();
|
119 |
* options: import_dirs, cache_dir, cache_method
|
120 |
*
|
121 |
*/
|
122 |
+
public function SetOptions( $options ) {
|
123 |
+
foreach ( $options as $option => $value ) {
|
124 |
+
$this->SetOption( $option, $value );
|
125 |
}
|
126 |
}
|
127 |
|
129 |
* Set one compiler option
|
130 |
*
|
131 |
*/
|
132 |
+
public function SetOption( $option, $value ) {
|
133 |
+
switch ( $option ) {
|
|
|
134 |
|
135 |
case 'import_dirs':
|
136 |
+
$this->SetImportDirs( $value );
|
137 |
return;
|
138 |
|
139 |
case 'cache_dir':
|
140 |
+
if ( is_string( $value ) ) {
|
141 |
+
Less_Cache::SetCacheDir( $value );
|
142 |
Less_Cache::CheckCacheDir();
|
143 |
}
|
144 |
return;
|
150 |
/**
|
151 |
* Registers a new custom function
|
152 |
*
|
153 |
+
* @param string $name function name
|
154 |
+
* @param callable $callback callback
|
155 |
*/
|
156 |
+
public function registerFunction( $name, $callback ) {
|
157 |
$this->env->functions[$name] = $callback;
|
158 |
}
|
159 |
|
160 |
/**
|
161 |
* Removed an already registered function
|
162 |
*
|
163 |
+
* @param string $name function name
|
164 |
*/
|
165 |
+
public function unregisterFunction( $name ) {
|
166 |
+
if ( isset( $this->env->functions[$name] ) )
|
167 |
+
unset( $this->env->functions[$name] );
|
168 |
}
|
169 |
|
|
|
170 |
/**
|
171 |
* Get the current css buffer
|
172 |
*
|
173 |
* @return string
|
174 |
*/
|
175 |
+
public function getCss() {
|
176 |
+
$precision = ini_get( 'precision' );
|
177 |
+
@ini_set( 'precision', 16 );
|
178 |
+
$locale = setlocale( LC_NUMERIC, 0 );
|
179 |
+
setlocale( LC_NUMERIC, "C" );
|
|
|
180 |
|
181 |
try {
|
182 |
|
183 |
+
$root = new Less_Tree_Ruleset( array(), $this->rules );
|
184 |
$root->root = true;
|
185 |
$root->firstRoot = true;
|
186 |
|
187 |
+
$this->PreVisitors( $root );
|
|
|
188 |
|
189 |
self::$has_extends = false;
|
190 |
+
$evaldRoot = $root->compile( $this->env );
|
191 |
|
192 |
+
$this->PostVisitors( $evaldRoot );
|
193 |
|
194 |
+
if ( Less_Parser::$options['sourceMap'] ) {
|
195 |
+
$generator = new Less_SourceMap_Generator( $evaldRoot, Less_Parser::$contentsMap, Less_Parser::$options );
|
|
|
|
|
|
|
196 |
// will also save file
|
197 |
// FIXME: should happen somewhere else?
|
198 |
$css = $generator->generateCSS();
|
199 |
+
} else {
|
200 |
$css = $evaldRoot->toCSS();
|
201 |
}
|
202 |
|
203 |
+
if ( Less_Parser::$options['compress'] ) {
|
204 |
+
$css = preg_replace( '/(^(\s)+)|((\s)+$)/', '', $css );
|
205 |
}
|
206 |
|
207 |
+
} catch ( Exception $exc ) {
|
208 |
// Intentional fall-through so we can reset environment
|
209 |
}
|
210 |
|
211 |
+
// reset php settings
|
212 |
+
@ini_set( 'precision', $precision );
|
213 |
+
setlocale( LC_NUMERIC, $locale );
|
214 |
|
215 |
// If you previously defined $this->mb_internal_encoding
|
216 |
// is required to return the encoding as it was before
|
217 |
+
if ( $this->mb_internal_encoding != '' ) {
|
218 |
+
@ini_set( "mbstring.internal_encoding", $this->mb_internal_encoding );
|
219 |
$this->mb_internal_encoding = '';
|
220 |
}
|
221 |
|
222 |
// Rethrow exception after we handled resetting the environment
|
223 |
+
if ( !empty( $exc ) ) {
|
224 |
throw $exc;
|
225 |
}
|
226 |
|
227 |
return $css;
|
228 |
}
|
229 |
|
230 |
+
public function findValueOf( $varName ) {
|
231 |
+
foreach ( $this->rules as $rule ) {
|
232 |
+
if ( isset( $rule->variable ) && ( $rule->variable == true ) && ( str_replace( "@", "", $rule->name ) == $varName ) ) {
|
233 |
+
return $this->getVariableValue( $rule );
|
|
|
234 |
}
|
235 |
}
|
236 |
return null;
|
243 |
*
|
244 |
* @return array
|
245 |
*/
|
246 |
+
public function getVariables() {
|
|
|
247 |
$variables = array();
|
248 |
|
249 |
$not_variable_type = array(
|
254 |
);
|
255 |
|
256 |
// @TODO run compilation if not runned yet
|
257 |
+
foreach ( $this->rules as $key => $rule ) {
|
258 |
+
if ( in_array( $rule->type, $not_variable_type ) ) {
|
259 |
continue;
|
260 |
}
|
261 |
|
262 |
// Note: it seems rule->type is always Rule when variable = true
|
263 |
+
if ( $rule->type == 'Rule' && $rule->variable ) {
|
264 |
+
$variables[$rule->name] = $this->getVariableValue( $rule );
|
265 |
} else {
|
266 |
+
if ( $rule->type == 'Comment' ) {
|
267 |
+
$variables[] = $this->getVariableValue( $rule );
|
268 |
}
|
269 |
}
|
270 |
}
|
271 |
return $variables;
|
272 |
}
|
273 |
|
274 |
+
public function findVarByName( $var_name ) {
|
275 |
+
foreach ( $this->rules as $rule ) {
|
276 |
+
if ( isset( $rule->variable ) && ( $rule->variable == true ) ) {
|
277 |
+
if ( $rule->name == $var_name ) {
|
278 |
+
return $this->getVariableValue( $rule );
|
|
|
279 |
}
|
280 |
}
|
281 |
}
|
291 |
*
|
292 |
* @return bool|string
|
293 |
*/
|
294 |
+
private function getVariableValue( $var ) {
|
295 |
+
if ( !is_a( $var, 'Less_Tree' ) ) {
|
296 |
+
throw new Exception( 'var is not a Less_Tree object' );
|
|
|
297 |
}
|
298 |
|
299 |
+
switch ( $var->type ) {
|
300 |
case 'Color':
|
301 |
+
return $this->rgb2html( $var->rgb );
|
302 |
case 'Unit':
|
303 |
return $var->value. $var->unit->numerator[0];
|
304 |
case 'Variable':
|
305 |
+
return $this->findVarByName( $var->name );
|
306 |
case 'Keyword':
|
307 |
return $var->value;
|
308 |
case 'Rule':
|
309 |
+
return $this->getVariableValue( $var->value );
|
310 |
case 'Value':
|
311 |
$value = '';
|
312 |
+
foreach ( $var->value as $sub_value ) {
|
313 |
+
$value .= $this->getVariableValue( $sub_value ).' ';
|
314 |
}
|
315 |
return $value;
|
316 |
case 'Quoted':
|
317 |
return $var->quote.$var->value.$var->quote;
|
318 |
case 'Dimension':
|
319 |
$value = $var->value;
|
320 |
+
if ( $var->unit && $var->unit->numerator ) {
|
321 |
$value .= $var->unit->numerator[0];
|
322 |
}
|
323 |
return $value;
|
324 |
case 'Expression':
|
325 |
$value = "";
|
326 |
+
foreach ( $var->value as $item ) {
|
327 |
+
$value .= $this->getVariableValue( $item )." ";
|
328 |
}
|
329 |
return $value;
|
330 |
case 'Operation':
|
331 |
+
throw new Exception( 'getVariables() require Less to be compiled. please use $parser->getCss() before calling getVariables()' );
|
332 |
case 'Comment':
|
333 |
case 'Import':
|
334 |
case 'Ruleset':
|
335 |
default:
|
336 |
+
throw new Exception( "type missing in switch/case getVariableValue for ".$var->type );
|
337 |
}
|
338 |
return false;
|
339 |
}
|
340 |
|
341 |
+
private function rgb2html( $r, $g = -1, $b = -1 ) {
|
342 |
+
if ( is_array( $r ) && sizeof( $r ) == 3 )
|
343 |
+
list( $r, $g, $b ) = $r;
|
|
|
344 |
|
345 |
+
$r = intval( $r ); $g = intval( $g );
|
346 |
+
$b = intval( $b );
|
347 |
|
348 |
+
$r = dechex( $r < 0 ? 0 : ( $r > 255 ? 255 : $r ) );
|
349 |
+
$g = dechex( $g < 0 ? 0 : ( $g > 255 ? 255 : $g ) );
|
350 |
+
$b = dechex( $b < 0 ? 0 : ( $b > 255 ? 255 : $b ) );
|
351 |
|
352 |
+
$color = ( strlen( $r ) < 2 ? '0' : '' ).$r;
|
353 |
+
$color .= ( strlen( $g ) < 2 ? '0' : '' ).$g;
|
354 |
+
$color .= ( strlen( $b ) < 2 ? '0' : '' ).$b;
|
355 |
return '#'.$color;
|
356 |
}
|
357 |
|
359 |
* Run pre-compile visitors
|
360 |
*
|
361 |
*/
|
362 |
+
private function PreVisitors( $root ) {
|
363 |
+
if ( Less_Parser::$options['plugins'] ) {
|
364 |
+
foreach ( Less_Parser::$options['plugins'] as $plugin ) {
|
365 |
+
if ( !empty( $plugin->isPreEvalVisitor ) ) {
|
366 |
+
$plugin->run( $root );
|
|
|
367 |
}
|
368 |
}
|
369 |
}
|
370 |
}
|
371 |
|
|
|
372 |
/**
|
373 |
* Run post-compile visitors
|
374 |
*
|
375 |
*/
|
376 |
+
private function PostVisitors( $evaldRoot ) {
|
|
|
377 |
$visitors = array();
|
378 |
$visitors[] = new Less_Visitor_joinSelector();
|
379 |
+
if ( self::$has_extends ) {
|
380 |
$visitors[] = new Less_Visitor_processExtends();
|
381 |
}
|
382 |
$visitors[] = new Less_Visitor_toCSS();
|
383 |
|
384 |
+
if ( Less_Parser::$options['plugins'] ) {
|
385 |
+
foreach ( Less_Parser::$options['plugins'] as $plugin ) {
|
386 |
+
if ( property_exists( $plugin, 'isPreEvalVisitor' ) && $plugin->isPreEvalVisitor ) {
|
|
|
387 |
continue;
|
388 |
}
|
389 |
|
390 |
+
if ( property_exists( $plugin, 'isPreVisitor' ) && $plugin->isPreVisitor ) {
|
391 |
+
array_unshift( $visitors, $plugin );
|
392 |
+
} else {
|
393 |
$visitors[] = $plugin;
|
394 |
}
|
395 |
}
|
396 |
}
|
397 |
|
398 |
+
for ( $i = 0; $i < count( $visitors ); $i++ ) {
|
399 |
+
$visitors[$i]->run( $evaldRoot );
|
|
|
400 |
}
|
401 |
|
402 |
}
|
403 |
|
|
|
404 |
/**
|
405 |
* Parse a Less string into css
|
406 |
*
|
408 |
* @param string $uri_root The url of the file
|
409 |
* @return Less_Tree_Ruleset|Less_Parser
|
410 |
*/
|
411 |
+
public function parse( $str, $file_uri = null ) {
|
412 |
+
if ( !$file_uri ) {
|
|
|
413 |
$uri_root = '';
|
414 |
$filename = 'anonymous-file-'.Less_Parser::$next_id++.'.less';
|
415 |
+
} else {
|
416 |
+
$file_uri = self::WinPath( $file_uri );
|
417 |
$filename = $file_uri;
|
418 |
+
$uri_root = dirname( $file_uri );
|
419 |
}
|
420 |
|
421 |
$previousFileInfo = $this->env->currentFileInfo;
|
422 |
+
$uri_root = self::WinPath( $uri_root );
|
423 |
+
$this->SetFileInfo( $filename, $uri_root );
|
424 |
|
425 |
$this->input = $str;
|
426 |
$this->_parse();
|
427 |
|
428 |
+
if ( $previousFileInfo ) {
|
429 |
$this->env->currentFileInfo = $previousFileInfo;
|
430 |
}
|
431 |
|
432 |
return $this;
|
433 |
}
|
434 |
|
|
|
435 |
/**
|
436 |
* Parse a Less string from a given file
|
437 |
*
|
441 |
* @param bool $returnRoot Indicates whether the return value should be a css string a root node
|
442 |
* @return Less_Tree_Ruleset|Less_Parser
|
443 |
*/
|
444 |
+
public function parseFile( $filename, $uri_root = '', $returnRoot = false ) {
|
445 |
+
if ( !file_exists( $filename ) ) {
|
446 |
+
$this->Error( sprintf( 'File `%s` not found.', $filename ) );
|
|
|
447 |
}
|
448 |
|
|
|
449 |
// fix uri_root?
|
450 |
// Instead of The mixture of file path for the first argument and directory path for the second argument has bee
|
451 |
+
if ( !$returnRoot && !empty( $uri_root ) && basename( $uri_root ) == basename( $filename ) ) {
|
452 |
+
$uri_root = dirname( $uri_root );
|
453 |
}
|
454 |
|
|
|
455 |
$previousFileInfo = $this->env->currentFileInfo;
|
456 |
|
457 |
+
if ( $filename ) {
|
458 |
+
$filename = self::AbsPath( $filename, true );
|
|
|
459 |
}
|
460 |
+
$uri_root = self::WinPath( $uri_root );
|
461 |
|
462 |
+
$this->SetFileInfo( $filename, $uri_root );
|
463 |
|
464 |
+
self::AddParsedFile( $filename );
|
465 |
|
466 |
+
if ( $returnRoot ) {
|
467 |
$rules = $this->GetRules( $filename );
|
468 |
+
$return = new Less_Tree_Ruleset( array(), $rules );
|
469 |
+
} else {
|
470 |
$this->_parse( $filename );
|
471 |
$return = $this;
|
472 |
}
|
473 |
|
474 |
+
if ( $previousFileInfo ) {
|
475 |
$this->env->currentFileInfo = $previousFileInfo;
|
476 |
}
|
477 |
|
478 |
return $return;
|
479 |
}
|
480 |
|
|
|
481 |
/**
|
482 |
* Allows a user to set variables values
|
483 |
* @param array $vars
|
484 |
* @return Less_Parser
|
485 |
*/
|
486 |
+
public function ModifyVars( $vars ) {
|
|
|
487 |
$this->input = Less_Parser::serializeVars( $vars );
|
488 |
$this->_parse();
|
489 |
|
490 |
return $this;
|
491 |
}
|
492 |
|
|
|
493 |
/**
|
494 |
* @param string $filename
|
495 |
*/
|
496 |
+
public function SetFileInfo( $filename, $uri_root = '' ) {
|
497 |
+
$filename = Less_Environment::normalizePath( $filename );
|
498 |
+
$dirname = preg_replace( '/[^\/\\\\]*$/', '', $filename );
|
|
|
499 |
|
500 |
+
if ( !empty( $uri_root ) ) {
|
501 |
+
$uri_root = rtrim( $uri_root, '/' ).'/';
|
502 |
}
|
503 |
|
504 |
$currentFileInfo = array();
|
505 |
|
506 |
+
// entry info
|
507 |
+
if ( isset( $this->env->currentFileInfo ) ) {
|
508 |
$currentFileInfo['entryPath'] = $this->env->currentFileInfo['entryPath'];
|
509 |
$currentFileInfo['entryUri'] = $this->env->currentFileInfo['entryUri'];
|
510 |
$currentFileInfo['rootpath'] = $this->env->currentFileInfo['rootpath'];
|
511 |
|
512 |
+
} else {
|
513 |
$currentFileInfo['entryPath'] = $dirname;
|
514 |
$currentFileInfo['entryUri'] = $uri_root;
|
515 |
$currentFileInfo['rootpath'] = $dirname;
|
516 |
}
|
517 |
|
518 |
$currentFileInfo['currentDirectory'] = $dirname;
|
519 |
+
$currentFileInfo['currentUri'] = $uri_root.basename( $filename );
|
520 |
$currentFileInfo['filename'] = $filename;
|
521 |
$currentFileInfo['uri_root'] = $uri_root;
|
522 |
|
523 |
+
// inherit reference
|
524 |
+
if ( isset( $this->env->currentFileInfo['reference'] ) && $this->env->currentFileInfo['reference'] ) {
|
|
|
525 |
$currentFileInfo['reference'] = true;
|
526 |
}
|
527 |
|
528 |
$this->env->currentFileInfo = $currentFileInfo;
|
529 |
}
|
530 |
|
|
|
531 |
/**
|
532 |
* @deprecated 1.5.1.2
|
533 |
*
|
534 |
*/
|
535 |
+
public function SetCacheDir( $dir ) {
|
536 |
+
if ( !file_exists( $dir ) ) {
|
537 |
+
if ( mkdir( $dir ) ) {
|
|
|
538 |
return true;
|
539 |
}
|
540 |
+
throw new Less_Exception_Parser( 'Less.php cache directory couldn\'t be created: '.$dir );
|
541 |
|
542 |
+
} elseif ( !is_dir( $dir ) ) {
|
543 |
+
throw new Less_Exception_Parser( 'Less.php cache directory doesn\'t exist: '.$dir );
|
544 |
|
545 |
+
} elseif ( !is_writable( $dir ) ) {
|
546 |
+
throw new Less_Exception_Parser( 'Less.php cache directory isn\'t writable: '.$dir );
|
547 |
|
548 |
+
} else {
|
549 |
+
$dir = self::WinPath( $dir );
|
550 |
+
Less_Cache::$cache_dir = rtrim( $dir, '/' ).'/';
|
551 |
return true;
|
552 |
}
|
553 |
}
|
554 |
|
|
|
555 |
/**
|
556 |
* Set a list of directories or callbacks the parser should use for determining import paths
|
557 |
*
|
558 |
* @param array $dirs
|
559 |
*/
|
560 |
+
public function SetImportDirs( $dirs ) {
|
561 |
Less_Parser::$options['import_dirs'] = array();
|
562 |
|
563 |
+
foreach ( $dirs as $path => $uri_root ) {
|
564 |
|
565 |
+
$path = self::WinPath( $path );
|
566 |
+
if ( !empty( $path ) ) {
|
567 |
+
$path = rtrim( $path, '/' ).'/';
|
568 |
}
|
569 |
|
570 |
+
if ( !is_callable( $uri_root ) ) {
|
571 |
+
$uri_root = self::WinPath( $uri_root );
|
572 |
+
if ( !empty( $uri_root ) ) {
|
573 |
+
$uri_root = rtrim( $uri_root, '/' ).'/';
|
574 |
}
|
575 |
}
|
576 |
|
581 |
/**
|
582 |
* @param string $file_path
|
583 |
*/
|
584 |
+
private function _parse( $file_path = null ) {
|
585 |
+
$this->rules = array_merge( $this->rules, $this->GetRules( $file_path ) );
|
586 |
}
|
587 |
|
|
|
588 |
/**
|
589 |
* Return the results of parsePrimary for $file_path
|
590 |
* Use cache and save cached results if possible
|
591 |
*
|
592 |
* @param string|null $file_path
|
593 |
*/
|
594 |
+
private function GetRules( $file_path ) {
|
595 |
+
$this->SetInput( $file_path );
|
|
|
596 |
|
597 |
$cache_file = $this->CacheFile( $file_path );
|
598 |
+
if ( $cache_file ) {
|
599 |
+
if ( Less_Parser::$options['cache_method'] == 'callback' ) {
|
600 |
+
if ( is_callable( Less_Parser::$options['cache_callback_get'] ) ) {
|
601 |
$cache = call_user_func_array(
|
602 |
Less_Parser::$options['cache_callback_get'],
|
603 |
+
array( $this, $file_path, $cache_file )
|
604 |
);
|
605 |
|
606 |
+
if ( $cache ) {
|
607 |
$this->UnsetInput();
|
608 |
return $cache;
|
609 |
}
|
610 |
}
|
611 |
|
612 |
+
} elseif ( file_exists( $cache_file ) ) {
|
613 |
+
switch ( Less_Parser::$options['cache_method'] ) {
|
614 |
|
615 |
// Using serialize
|
616 |
// Faster but uses more memory
|
617 |
case 'serialize':
|
618 |
+
$cache = unserialize( file_get_contents( $cache_file ) );
|
619 |
+
if ( $cache ) {
|
620 |
+
touch( $cache_file );
|
621 |
$this->UnsetInput();
|
622 |
return $cache;
|
623 |
}
|
624 |
break;
|
625 |
|
|
|
626 |
// Using generated php code
|
627 |
case 'var_export':
|
628 |
case 'php':
|
629 |
$this->UnsetInput();
|
630 |
+
return include $cache_file;
|
631 |
}
|
632 |
}
|
633 |
}
|
634 |
|
635 |
$rules = $this->parsePrimary();
|
636 |
|
637 |
+
if ( $this->pos < $this->input_len ) {
|
638 |
+
throw new Less_Exception_Chunk( $this->input, null, $this->furthest, $this->env->currentFileInfo );
|
639 |
}
|
640 |
|
641 |
$this->UnsetInput();
|
642 |
|
643 |
+
// save the cache
|
644 |
+
if ( $cache_file ) {
|
645 |
+
if ( Less_Parser::$options['cache_method'] == 'callback' ) {
|
646 |
+
if ( is_callable( Less_Parser::$options['cache_callback_set'] ) ) {
|
|
|
647 |
call_user_func_array(
|
648 |
Less_Parser::$options['cache_callback_set'],
|
649 |
+
array( $this, $file_path, $cache_file, $rules )
|
650 |
);
|
651 |
}
|
652 |
|
653 |
+
} else {
|
654 |
+
// msg('write cache file');
|
655 |
+
switch ( Less_Parser::$options['cache_method'] ) {
|
656 |
case 'serialize':
|
657 |
+
file_put_contents( $cache_file, serialize( $rules ) );
|
658 |
break;
|
659 |
case 'php':
|
660 |
+
file_put_contents( $cache_file, '<?php return '.self::ArgString( $rules ).'; ?>' );
|
661 |
break;
|
662 |
case 'var_export':
|
663 |
+
// Requires __set_state()
|
664 |
+
file_put_contents( $cache_file, '<?php return '.var_export( $rules, true ).'; ?>' );
|
665 |
break;
|
666 |
}
|
667 |
|
672 |
return $rules;
|
673 |
}
|
674 |
|
|
|
675 |
/**
|
676 |
* Set up the input buffer
|
677 |
*
|
678 |
*/
|
679 |
+
public function SetInput( $file_path ) {
|
680 |
+
if ( $file_path ) {
|
|
|
681 |
$this->input = file_get_contents( $file_path );
|
682 |
}
|
683 |
|
684 |
$this->pos = $this->furthest = 0;
|
685 |
|
686 |
// Remove potential UTF Byte Order Mark
|
687 |
+
$this->input = preg_replace( '/\\G\xEF\xBB\xBF/', '', $this->input );
|
688 |
+
$this->input_len = strlen( $this->input );
|
689 |
|
690 |
+
if ( Less_Parser::$options['sourceMap'] && $this->env->currentFileInfo ) {
|
|
|
691 |
$uri = $this->env->currentFileInfo['currentUri'];
|
692 |
Less_Parser::$contentsMap[$uri] = $this->input;
|
693 |
}
|
694 |
|
695 |
}
|
696 |
|
|
|
697 |
/**
|
698 |
* Free up some memory
|
699 |
*
|
700 |
*/
|
701 |
+
public function UnsetInput() {
|
702 |
+
unset( $this->input, $this->pos, $this->input_len, $this->furthest );
|
703 |
$this->saveStack = array();
|
704 |
}
|
705 |
|
706 |
+
public function CacheFile( $file_path ) {
|
707 |
+
if ( $file_path && $this->CacheEnabled() ) {
|
708 |
|
709 |
+
$env = get_object_vars( $this->env );
|
710 |
+
unset( $env['frames'] );
|
|
|
|
|
|
|
|
|
711 |
|
712 |
$parts = array();
|
713 |
$parts[] = $file_path;
|
716 |
$parts[] = $env;
|
717 |
$parts[] = Less_Version::cache_version;
|
718 |
$parts[] = Less_Parser::$options['cache_method'];
|
719 |
+
return Less_Cache::$cache_dir . Less_Cache::$prefix . base_convert( sha1( json_encode( $parts ) ), 16, 36 ) . '.lesscache';
|
720 |
}
|
721 |
}
|
722 |
|
723 |
+
static function AddParsedFile( $file ) {
|
|
|
724 |
self::$imports[] = $file;
|
725 |
}
|
726 |
|
727 |
+
static function AllParsedFiles() {
|
728 |
return self::$imports;
|
729 |
}
|
730 |
|
731 |
/**
|
732 |
* @param string $file
|
733 |
*/
|
734 |
+
static function FileParsed( $file ) {
|
735 |
+
return in_array( $file, self::$imports );
|
736 |
}
|
737 |
|
|
|
738 |
function save() {
|
739 |
$this->saveStack[] = $this->pos;
|
740 |
}
|
741 |
|
742 |
private function restore() {
|
743 |
+
$this->pos = array_pop( $this->saveStack );
|
744 |
}
|
745 |
|
746 |
+
private function forget() {
|
747 |
+
array_pop( $this->saveStack );
|
748 |
}
|
749 |
|
750 |
/**
|
754 |
*
|
755 |
* @return bool
|
756 |
*/
|
757 |
+
private function isWhitespace( $offset = 0 ) {
|
758 |
+
return strpos( " \t\n\r\v\f", $this->input[$this->pos + $offset] ) !== false;
|
759 |
}
|
760 |
|
761 |
/**
|
764 |
* @param array $toks
|
765 |
* @return array
|
766 |
*/
|
767 |
+
private function match( $toks ) {
|
|
|
768 |
// The match is confirmed, add the match length to `this::pos`,
|
769 |
// and consume any extra white-space characters (' ' || '\n')
|
770 |
// which come after that. The reason for this is that LeSS's
|
771 |
// grammar is mostly white-space insensitive.
|
772 |
//
|
773 |
|
774 |
+
foreach ( $toks as $tok ) {
|
775 |
|
776 |
$char = $tok[0];
|
777 |
|
778 |
+
if ( $char === '/' ) {
|
779 |
+
$match = $this->MatchReg( $tok );
|
780 |
|
781 |
+
if ( $match ) {
|
782 |
+
return count( $match ) === 1 ? $match[0] : $match;
|
783 |
}
|
784 |
|
785 |
+
} elseif ( $char === '#' ) {
|
786 |
+
$match = $this->MatchChar( $tok[1] );
|
787 |
|
788 |
+
} else {
|
789 |
// Non-terminal, match using a function call
|
790 |
$match = $this->$tok();
|
791 |
|
792 |
}
|
793 |
|
794 |
+
if ( $match ) {
|
795 |
return $match;
|
796 |
}
|
797 |
}
|
802 |
*
|
803 |
* @return string
|
804 |
*/
|
805 |
+
private function MatchFuncs( $toks ) {
|
806 |
+
if ( $this->pos < $this->input_len ) {
|
807 |
+
foreach ( $toks as $tok ) {
|
|
|
808 |
$match = $this->$tok();
|
809 |
+
if ( $match ) {
|
810 |
return $match;
|
811 |
}
|
812 |
}
|
815 |
}
|
816 |
|
817 |
// Match a single character in the input,
|
818 |
+
private function MatchChar( $tok ) {
|
819 |
+
if ( ( $this->pos < $this->input_len ) && ( $this->input[$this->pos] === $tok ) ) {
|
820 |
+
$this->skipWhitespace( 1 );
|
821 |
return $tok;
|
822 |
}
|
823 |
}
|
824 |
|
825 |
// Match a regexp from the current start point
|
826 |
+
private function MatchReg( $tok ) {
|
827 |
+
if ( preg_match( $tok, $this->input, $match, 0, $this->pos ) ) {
|
828 |
+
$this->skipWhitespace( strlen( $match[0] ) );
|
|
|
829 |
return $match;
|
830 |
}
|
831 |
}
|
832 |
|
|
|
833 |
/**
|
834 |
* Same as match(), but don't change the state of the parser,
|
835 |
* just return the match.
|
837 |
* @param string $tok
|
838 |
* @return integer
|
839 |
*/
|
840 |
+
public function PeekReg( $tok ) {
|
841 |
+
return preg_match( $tok, $this->input, $match, 0, $this->pos );
|
842 |
}
|
843 |
|
844 |
/**
|
845 |
* @param string $tok
|
846 |
*/
|
847 |
+
public function PeekChar( $tok ) {
|
848 |
+
// return ($this->input[$this->pos] === $tok );
|
849 |
+
return ( $this->pos < $this->input_len ) && ( $this->input[$this->pos] === $tok );
|
850 |
}
|
851 |
|
|
|
852 |
/**
|
853 |
* @param integer $length
|
854 |
*/
|
855 |
+
public function skipWhitespace( $length ) {
|
|
|
856 |
$this->pos += $length;
|
857 |
|
858 |
+
for ( ; $this->pos < $this->input_len; $this->pos++ ) {
|
859 |
$c = $this->input[$this->pos];
|
860 |
|
861 |
+
if ( ( $c !== "\n" ) && ( $c !== "\r" ) && ( $c !== "\t" ) && ( $c !== ' ' ) ) {
|
862 |
break;
|
863 |
}
|
864 |
}
|
865 |
}
|
866 |
|
|
|
867 |
/**
|
868 |
* @param string $tok
|
869 |
* @param string|null $msg
|
870 |
*/
|
871 |
+
public function expect( $tok, $msg = NULL ) {
|
872 |
+
$result = $this->match( array( $tok ) );
|
873 |
+
if ( !$result ) {
|
874 |
+
$this->Error( $msg ? "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'" : $msg );
|
875 |
} else {
|
876 |
return $result;
|
877 |
}
|
880 |
/**
|
881 |
* @param string $tok
|
882 |
*/
|
883 |
+
public function expectChar( $tok, $msg = null ) {
|
884 |
+
$result = $this->MatchChar( $tok );
|
885 |
+
if ( !$result ) {
|
886 |
$msg = $msg ? $msg : "Expected '" . $tok . "' got '" . $this->input[$this->pos] . "'";
|
887 |
$this->Error( $msg );
|
888 |
+
} else {
|
889 |
return $result;
|
890 |
}
|
891 |
}
|
935 |
// Only at one point is the primary rule not called from the
|
936 |
// block rule: at the root level.
|
937 |
//
|
938 |
+
private function parsePrimary() {
|
939 |
$root = array();
|
940 |
|
941 |
+
while ( true ) {
|
942 |
|
943 |
+
if ( $this->pos >= $this->input_len ) {
|
944 |
break;
|
945 |
}
|
946 |
|
947 |
+
$node = $this->parseExtend( true );
|
948 |
+
if ( $node ) {
|
949 |
+
$root = array_merge( $root, $node );
|
950 |
continue;
|
951 |
}
|
952 |
|
953 |
+
// $node = $this->MatchFuncs( array( 'parseMixinDefinition', 'parseRule', 'parseRuleset', 'parseMixinCall', 'parseComment', 'parseDirective'));
|
954 |
+
$node = $this->MatchFuncs( array( 'parseMixinDefinition', 'parseNameValue', 'parseRule', 'parseRuleset', 'parseMixinCall', 'parseComment', 'parseRulesetCall', 'parseDirective' ) );
|
955 |
|
956 |
+
if ( $node ) {
|
957 |
$root[] = $node;
|
958 |
+
} elseif ( !$this->MatchReg( '/\\G[\s\n;]+/' ) ) {
|
959 |
break;
|
960 |
}
|
961 |
|
962 |
+
if ( $this->PeekChar( '}' ) ) {
|
963 |
break;
|
964 |
}
|
965 |
}
|
967 |
return $root;
|
968 |
}
|
969 |
|
|
|
|
|
970 |
// We create a Comment node for CSS comments `/* */`,
|
971 |
// but keep the LeSS comments `//` silent, by just skipping
|
972 |
// over them.
|
973 |
+
private function parseComment() {
|
974 |
+
if ( $this->input[$this->pos] !== '/' ) {
|
|
|
975 |
return;
|
976 |
}
|
977 |
|
978 |
+
if ( $this->input[$this->pos + 1] === '/' ) {
|
979 |
+
$match = $this->MatchReg( '/\\G\/\/.*/' );
|
980 |
+
return $this->NewObj4( 'Less_Tree_Comment', array( $match[0], true, $this->pos, $this->env->currentFileInfo ) );
|
981 |
}
|
982 |
|
983 |
+
// $comment = $this->MatchReg('/\\G\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/');
|
984 |
+
$comment = $this->MatchReg( '/\\G\/\*(?s).*?\*+\/\n?/' );// not the same as less.js to prevent fatal errors
|
985 |
+
if ( $comment ) {
|
986 |
+
return $this->NewObj4( 'Less_Tree_Comment', array( $comment[0], false, $this->pos, $this->env->currentFileInfo ) );
|
987 |
}
|
988 |
}
|
989 |
|
990 |
+
private function parseComments() {
|
991 |
$comments = array();
|
992 |
|
993 |
+
while ( $this->pos < $this->input_len ) {
|
994 |
$comment = $this->parseComment();
|
995 |
+
if ( !$comment ) {
|
996 |
break;
|
997 |
}
|
998 |
|
1002 |
return $comments;
|
1003 |
}
|
1004 |
|
|
|
|
|
1005 |
//
|
1006 |
// A string, which supports escaping " and '
|
1007 |
//
|
1012 |
$e = false;
|
1013 |
$index = $this->pos;
|
1014 |
|
1015 |
+
if ( $this->input[$this->pos] === '~' ) {
|
1016 |
$j++;
|
1017 |
$e = true; // Escaped strings
|
1018 |
}
|
1019 |
|
1020 |
$char = $this->input[$j];
|
1021 |
+
if ( $char !== '"' && $char !== "'" ) {
|
1022 |
return;
|
1023 |
}
|
1024 |
|
1025 |
+
if ( $e ) {
|
1026 |
+
$this->MatchChar( '~' );
|
1027 |
}
|
1028 |
|
1029 |
+
$matched = $this->MatchQuoted( $char, $j + 1 );
|
1030 |
+
if ( $matched === false ) {
|
|
|
1031 |
return;
|
1032 |
}
|
1033 |
|
1034 |
$quoted = $char.$matched.$char;
|
1035 |
+
return $this->NewObj5( 'Less_Tree_Quoted', array( $quoted, $matched, $e, $index, $this->env->currentFileInfo ) );
|
1036 |
}
|
1037 |
|
|
|
1038 |
/**
|
1039 |
* When PCRE JIT is enabled in php, regular expressions don't work for matching quoted strings
|
1040 |
*
|
1042 |
* $regex = '/\\G"((?:[^"\\\\\r\n]|\\\\.|\\\\\r\n|\\\\[\n\r\f])*)"/';
|
1043 |
*
|
1044 |
*/
|
1045 |
+
private function MatchQuoted( $quote_char, $i ) {
|
|
|
1046 |
$matched = '';
|
1047 |
+
while ( $i < $this->input_len ) {
|
1048 |
$c = $this->input[$i];
|
1049 |
|
1050 |
+
// escaped character
|
1051 |
+
if ( $c === '\\' ) {
|
1052 |
+
$matched .= $c . $this->input[$i + 1];
|
1053 |
$i += 2;
|
1054 |
continue;
|
1055 |
}
|
1056 |
|
1057 |
+
if ( $c === $quote_char ) {
|
1058 |
+
$this->pos = $i + 1;
|
1059 |
+
$this->skipWhitespace( 0 );
|
1060 |
return $matched;
|
1061 |
}
|
1062 |
|
1063 |
+
if ( $c === "\r" || $c === "\n" ) {
|
1064 |
return false;
|
1065 |
}
|
1066 |
|
1071 |
return false;
|
1072 |
}
|
1073 |
|
|
|
1074 |
//
|
1075 |
// A catch-all word, such as:
|
1076 |
//
|
1077 |
// black border-collapse
|
1078 |
//
|
1079 |
+
private function parseEntitiesKeyword() {
|
1080 |
+
// $k = $this->MatchReg('/\\G[_A-Za-z-][_A-Za-z0-9-]*/');
|
1081 |
+
$k = $this->MatchReg( '/\\G%|\\G[_A-Za-z-][_A-Za-z0-9-]*/' );
|
1082 |
+
if ( $k ) {
|
|
|
1083 |
$k = $k[0];
|
1084 |
+
$color = $this->fromKeyword( $k );
|
1085 |
+
if ( $color ) {
|
1086 |
return $color;
|
1087 |
}
|
1088 |
+
return $this->NewObj1( 'Less_Tree_Keyword', $k );
|
1089 |
}
|
1090 |
}
|
1091 |
|
1092 |
// duplicate of Less_Tree_Color::FromKeyword
|
1093 |
+
private function FromKeyword( $keyword ) {
|
1094 |
+
$keyword = strtolower( $keyword );
|
1095 |
|
1096 |
+
if ( Less_Colors::hasOwnProperty( $keyword ) ) {
|
1097 |
// detect named color
|
1098 |
+
return $this->NewObj1( 'Less_Tree_Color', substr( Less_Colors::color( $keyword ), 1 ) );
|
1099 |
}
|
1100 |
|
1101 |
+
if ( $keyword === 'transparent' ) {
|
1102 |
+
return $this->NewObj3( 'Less_Tree_Color', array( array( 0, 0, 0 ), 0, true ) );
|
1103 |
}
|
1104 |
}
|
1105 |
|
1113 |
//
|
1114 |
// The arguments are parsed with the `entities.arguments` parser.
|
1115 |
//
|
1116 |
+
private function parseEntitiesCall() {
|
1117 |
$index = $this->pos;
|
1118 |
|
1119 |
+
if ( !preg_match( '/\\G([\w-]+|%|progid:[\w\.]+)\(/', $this->input, $name, 0, $this->pos ) ) {
|
1120 |
return;
|
1121 |
}
|
1122 |
$name = $name[1];
|
1123 |
+
$nameLC = strtolower( $name );
|
1124 |
|
1125 |
+
if ( $nameLC === 'url' ) {
|
1126 |
return null;
|
1127 |
}
|
1128 |
|
1129 |
+
$this->pos += strlen( $name );
|
1130 |
|
1131 |
+
if ( $nameLC === 'alpha' ) {
|
1132 |
$alpha_ret = $this->parseAlpha();
|
1133 |
+
if ( $alpha_ret ) {
|
1134 |
return $alpha_ret;
|
1135 |
}
|
1136 |
}
|
1137 |
|
1138 |
+
$this->MatchChar( '(' ); // Parse the '(' and consume whitespace.
|
1139 |
|
1140 |
$args = $this->parseEntitiesArguments();
|
1141 |
|
1142 |
+
if ( !$this->MatchChar( ')' ) ) {
|
1143 |
return;
|
1144 |
}
|
1145 |
|
1146 |
+
if ( $name ) {
|
1147 |
+
return $this->NewObj4( 'Less_Tree_Call', array( $name, $args, $index, $this->env->currentFileInfo ) );
|
1148 |
}
|
1149 |
}
|
1150 |
|
1153 |
*
|
1154 |
* @return array
|
1155 |
*/
|
1156 |
+
private function parseEntitiesArguments() {
|
|
|
1157 |
$args = array();
|
1158 |
+
while ( true ) {
|
1159 |
+
$arg = $this->MatchFuncs( array( 'parseEntitiesAssignment','parseExpression' ) );
|
1160 |
+
if ( !$arg ) {
|
1161 |
break;
|
1162 |
}
|
1163 |
|
1164 |
$args[] = $arg;
|
1165 |
+
if ( !$this->MatchChar( ',' ) ) {
|
1166 |
break;
|
1167 |
}
|
1168 |
}
|
1169 |
return $args;
|
1170 |
}
|
1171 |
|
1172 |
+
private function parseEntitiesLiteral() {
|
1173 |
+
return $this->MatchFuncs( array( 'parseEntitiesDimension','parseEntitiesColor','parseEntitiesQuoted','parseUnicodeDescriptor' ) );
|
1174 |
}
|
1175 |
|
1176 |
// Assignments are argument entities for calls.
|
1179 |
// filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* )
|
1180 |
//
|
1181 |
private function parseEntitiesAssignment() {
|
1182 |
+
$key = $this->MatchReg( '/\\G\w+(?=\s?=)/' );
|
1183 |
+
if ( !$key ) {
|
|
|
1184 |
return;
|
1185 |
}
|
1186 |
|
1187 |
+
if ( !$this->MatchChar( '=' ) ) {
|
1188 |
return;
|
1189 |
}
|
1190 |
|
1191 |
$value = $this->parseEntity();
|
1192 |
+
if ( $value ) {
|
1193 |
+
return $this->NewObj2( 'Less_Tree_Assignment', array( $key[0], $value ) );
|
1194 |
}
|
1195 |
}
|
1196 |
|
1201 |
// standard function calls. The difference is that the argument doesn't have
|
1202 |
// to be enclosed within a string, so it can't be parsed as an Expression.
|
1203 |
//
|
1204 |
+
private function parseEntitiesUrl() {
|
1205 |
+
if ( $this->input[$this->pos] !== 'u' || !$this->matchReg( '/\\Gurl\(/' ) ) {
|
|
|
|
|
1206 |
return;
|
1207 |
}
|
1208 |
|
1209 |
+
$value = $this->match( array( 'parseEntitiesQuoted','parseEntitiesVariable','/\\Gdata\:.*?[^\)]+/','/\\G(?:(?:\\\\[\(\)\'"])|[^\(\)\'"])+/' ) );
|
1210 |
+
if ( !$value ) {
|
1211 |
$value = '';
|
1212 |
}
|
1213 |
|
1214 |
+
$this->expectChar( ')' );
|
1215 |
|
1216 |
+
if ( isset( $value->value ) || $value instanceof Less_Tree_Variable ) {
|
1217 |
+
return $this->NewObj2( 'Less_Tree_Url', array( $value, $this->env->currentFileInfo ) );
|
|
|
|
|
|
|
1218 |
}
|
1219 |
|
1220 |
+
return $this->NewObj2( 'Less_Tree_Url', array( $this->NewObj1( 'Less_Tree_Anonymous', $value ), $this->env->currentFileInfo ) );
|
1221 |
}
|
1222 |
|
|
|
1223 |
//
|
1224 |
// A Variable entity, such as `@fink`, in
|
1225 |
//
|
1228 |
// We use a different parser for variable definitions,
|
1229 |
// see `parsers.variable`.
|
1230 |
//
|
1231 |
+
private function parseEntitiesVariable() {
|
1232 |
$index = $this->pos;
|
1233 |
+
if ( $this->PeekChar( '@' ) && ( $name = $this->MatchReg( '/\\G@@?[\w-]+/' ) ) ) {
|
1234 |
+
return $this->NewObj3( 'Less_Tree_Variable', array( $name[0], $index, $this->env->currentFileInfo ) );
|
1235 |
}
|
1236 |
}
|
1237 |
|
|
|
1238 |
// A variable entity using the protective {} e.g. @{var}
|
1239 |
private function parseEntitiesVariableCurly() {
|
1240 |
$index = $this->pos;
|
1241 |
|
1242 |
+
if ( $this->input_len > ( $this->pos + 1 ) && $this->input[$this->pos] === '@' && ( $curly = $this->MatchReg( '/\\G@\{([\w-]+)\}/' ) ) ) {
|
1243 |
+
return $this->NewObj3( 'Less_Tree_Variable', array( '@'.$curly[1], $index, $this->env->currentFileInfo ) );
|
1244 |
}
|
1245 |
}
|
1246 |
|
1251 |
//
|
1252 |
// `rgb` and `hsl` colors are parsed through the `entities.call` parser.
|
1253 |
//
|
1254 |
+
private function parseEntitiesColor() {
|
1255 |
+
if ( $this->PeekChar( '#' ) && ( $rgb = $this->MatchReg( '/\\G#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/' ) ) ) {
|
1256 |
+
return $this->NewObj1( 'Less_Tree_Color', $rgb[1] );
|
1257 |
}
|
1258 |
}
|
1259 |
|
1262 |
//
|
1263 |
// 0.5em 95%
|
1264 |
//
|
1265 |
+
private function parseEntitiesDimension() {
|
1266 |
+
$c = @ord( $this->input[$this->pos] );
|
|
|
1267 |
|
1268 |
+
// Is the first char of the dimension 0-9, '.', '+' or '-'
|
1269 |
+
if ( ( $c > 57 || $c < 43 ) || $c === 47 || $c == 44 ) {
|
1270 |
return;
|
1271 |
}
|
1272 |
|
1273 |
+
$value = $this->MatchReg( '/\\G([+-]?\d*\.?\d+)(%|[a-z]+)?/' );
|
1274 |
+
if ( $value ) {
|
1275 |
|
1276 |
+
if ( isset( $value[2] ) ) {
|
1277 |
+
return $this->NewObj2( 'Less_Tree_Dimension', array( $value[1],$value[2] ) );
|
1278 |
}
|
1279 |
+
return $this->NewObj1( 'Less_Tree_Dimension', $value[1] );
|
1280 |
}
|
1281 |
}
|
1282 |
|
|
|
1283 |
//
|
1284 |
// A unicode descriptor, as is used in unicode-range
|
1285 |
//
|
1286 |
// U+0?? or U+00A1-00A9
|
1287 |
//
|
1288 |
function parseUnicodeDescriptor() {
|
1289 |
+
$ud = $this->MatchReg( '/\\G(U\+[0-9a-fA-F?]+)(\-[0-9a-fA-F?]+)?/' );
|
1290 |
+
if ( $ud ) {
|
1291 |
+
return $this->NewObj1( 'Less_Tree_UnicodeDescriptor', $ud[0] );
|
1292 |
}
|
1293 |
}
|
1294 |
|
|
|
1295 |
//
|
1296 |
// JavaScript code to be evaluated
|
1297 |
//
|
1298 |
// `window.location.href`
|
1299 |
//
|
1300 |
+
private function parseEntitiesJavascript() {
|
1301 |
$e = false;
|
1302 |
$j = $this->pos;
|
1303 |
+
if ( $this->input[$j] === '~' ) {
|
1304 |
$j++;
|
1305 |
$e = true;
|
1306 |
}
|
1307 |
+
if ( $this->input[$j] !== '`' ) {
|
1308 |
return;
|
1309 |
}
|
1310 |
+
if ( $e ) {
|
1311 |
+
$this->MatchChar( '~' );
|
1312 |
}
|
1313 |
+
$str = $this->MatchReg( '/\\G`([^`]*)`/' );
|
1314 |
+
if ( $str ) {
|
1315 |
+
return $this->NewObj3( 'Less_Tree_Javascript', array( $str[1], $this->pos, $e ) );
|
1316 |
}
|
1317 |
}
|
1318 |
|
|
|
1319 |
//
|
1320 |
// The variable part of a variable definition. Used in the `rule` parser
|
1321 |
//
|
1322 |
// @fink:
|
1323 |
//
|
1324 |
+
private function parseVariable() {
|
1325 |
+
if ( $this->PeekChar( '@' ) && ( $name = $this->MatchReg( '/\\G(@[\w-]+)\s*:/' ) ) ) {
|
1326 |
return $name[1];
|
1327 |
}
|
1328 |
}
|
1329 |
|
|
|
1330 |
//
|
1331 |
// The variable part of a variable definition. Used in the `rule` parser
|
1332 |
//
|
1333 |
// @fink();
|
1334 |
//
|
1335 |
+
private function parseRulesetCall() {
|
1336 |
+
if ( $this->input[$this->pos] === '@' && ( $name = $this->MatchReg( '/\\G(@[\w-]+)\s*\(\s*\)\s*;/' ) ) ) {
|
1337 |
+
return $this->NewObj1( 'Less_Tree_RulesetCall', $name[1] );
|
|
|
1338 |
}
|
1339 |
}
|
1340 |
|
|
|
1341 |
//
|
1342 |
// extend syntax - used to extend selectors
|
1343 |
//
|
1344 |
+
function parseExtend( $isRule = false ) {
|
|
|
1345 |
$index = $this->pos;
|
1346 |
$extendList = array();
|
1347 |
|
1348 |
+
if ( !$this->MatchReg( $isRule ? '/\\G&:extend\(/' : '/\\G:extend\(/' ) ) { return;
|
1349 |
+
}
|
1350 |
|
1351 |
do{
|
1352 |
$option = null;
|
1353 |
$elements = array();
|
1354 |
+
while ( true ) {
|
1355 |
+
$option = $this->MatchReg( '/\\G(all)(?=\s*(\)|,))/' );
|
1356 |
+
if ( $option ) { break;
|
1357 |
+
}
|
1358 |
$e = $this->parseElement();
|
1359 |
+
if ( !$e ) { break;
|
1360 |
+
}
|
1361 |
$elements[] = $e;
|
1362 |
}
|
1363 |
|
1364 |
+
if ( $option ) {
|
1365 |
$option = $option[1];
|
1366 |
}
|
1367 |
|
1368 |
+
$extendList[] = $this->NewObj3( 'Less_Tree_Extend', array( $this->NewObj1( 'Less_Tree_Selector', $elements ), $option, $index ) );
|
1369 |
|
1370 |
+
}while ( $this->MatchChar( "," ) );
|
1371 |
|
1372 |
+
$this->expect( '/\\G\)/' );
|
1373 |
|
1374 |
+
if ( $isRule ) {
|
1375 |
+
$this->expect( '/\\G;/' );
|
1376 |
}
|
1377 |
|
1378 |
return $extendList;
|
1379 |
}
|
1380 |
|
|
|
1381 |
//
|
1382 |
// A Mixin call, with an optional argument list
|
1383 |
//
|
1389 |
// namespaced, but we only support the child and descendant
|
1390 |
// selector for now.
|
1391 |
//
|
1392 |
+
private function parseMixinCall() {
|
|
|
1393 |
$char = $this->input[$this->pos];
|
1394 |
+
if ( $char !== '.' && $char !== '#' ) {
|
1395 |
return;
|
1396 |
}
|
1397 |
|
1400 |
|
1401 |
$elements = $this->parseMixinCallElements();
|
1402 |
|
1403 |
+
if ( $elements ) {
|
1404 |
|
1405 |
+
if ( $this->MatchChar( '(' ) ) {
|
1406 |
+
$returned = $this->parseMixinArgs( true );
|
1407 |
$args = $returned['args'];
|
1408 |
+
$this->expectChar( ')' );
|
1409 |
+
} else {
|
1410 |
$args = array();
|
1411 |
}
|
1412 |
|
1413 |
$important = $this->parseImportant();
|
1414 |
|
1415 |
+
if ( $this->parseEnd() ) {
|
1416 |
$this->forget();
|
1417 |
+
return $this->NewObj5( 'Less_Tree_Mixin_Call', array( $elements, $args, $index, $this->env->currentFileInfo, $important ) );
|
1418 |
}
|
1419 |
}
|
1420 |
|
1421 |
$this->restore();
|
1422 |
}
|
1423 |
|
1424 |
+
private function parseMixinCallElements() {
|
|
|
1425 |
$elements = array();
|
1426 |
$c = null;
|
1427 |
|
1428 |
+
while ( true ) {
|
1429 |
$elemIndex = $this->pos;
|
1430 |
+
$e = $this->MatchReg( '/\\G[#.](?:[\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/' );
|
1431 |
+
if ( !$e ) {
|
1432 |
break;
|
1433 |
}
|
1434 |
+
$elements[] = $this->NewObj4( 'Less_Tree_Element', array( $c, $e[0], $elemIndex, $this->env->currentFileInfo ) );
|
1435 |
+
$c = $this->MatchChar( '>' );
|
1436 |
}
|
1437 |
|
1438 |
return $elements;
|
1439 |
}
|
1440 |
|
|
|
|
|
1441 |
/**
|
1442 |
* @param boolean $isCall
|
1443 |
*/
|
1444 |
+
private function parseMixinArgs( $isCall ) {
|
1445 |
$expressions = array();
|
1446 |
$argsSemiColon = array();
|
1447 |
$isSemiColonSeperated = null;
|
1448 |
$argsComma = array();
|
1449 |
$expressionContainsNamed = null;
|
1450 |
$name = null;
|
1451 |
+
$returner = array( 'args' => array(), 'variadic' => false );
|
1452 |
|
1453 |
$this->save();
|
1454 |
|
1455 |
+
while ( true ) {
|
1456 |
+
if ( $isCall ) {
|
1457 |
$arg = $this->MatchFuncs( array( 'parseDetachedRuleset','parseExpression' ) );
|
1458 |
} else {
|
1459 |
$this->parseComments();
|
1460 |
+
if ( $this->input[ $this->pos ] === '.' && $this->MatchReg( '/\\G\.{3}/' ) ) {
|
1461 |
$returner['variadic'] = true;
|
1462 |
+
if ( $this->MatchChar( ";" ) && !$isSemiColonSeperated ) {
|
1463 |
$isSemiColonSeperated = true;
|
1464 |
}
|
1465 |
|
1466 |
+
if ( $isSemiColonSeperated ) {
|
1467 |
+
$argsSemiColon[] = array( 'variadic' => true );
|
1468 |
+
} else {
|
1469 |
+
$argsComma[] = array( 'variadic' => true );
|
1470 |
}
|
1471 |
break;
|
1472 |
}
|
1473 |
+
$arg = $this->MatchFuncs( array( 'parseEntitiesVariable','parseEntitiesLiteral','parseEntitiesKeyword' ) );
|
1474 |
}
|
1475 |
|
1476 |
+
if ( !$arg ) {
|
1477 |
break;
|
1478 |
}
|
1479 |
|
|
|
1480 |
$nameLoop = null;
|
1481 |
+
if ( $arg instanceof Less_Tree_Expression ) {
|
1482 |
$arg->throwAwayComments();
|
1483 |
}
|
1484 |
$value = $arg;
|
1485 |
$val = null;
|
1486 |
|
1487 |
+
if ( $isCall ) {
|
1488 |
// Variable
|
1489 |
+
if ( property_exists( $arg, 'value' ) && count( $arg->value ) == 1 ) {
|
1490 |
$val = $arg->value[0];
|
1491 |
}
|
1492 |
} else {
|
1493 |
$val = $arg;
|
1494 |
}
|
1495 |
|
1496 |
+
if ( $val instanceof Less_Tree_Variable ) {
|
1497 |
|
1498 |
+
if ( $this->MatchChar( ':' ) ) {
|
1499 |
+
if ( $expressions ) {
|
1500 |
+
if ( $isSemiColonSeperated ) {
|
1501 |
+
$this->Error( 'Cannot mix ; and , as delimiter types' );
|
|
|
|
|
1502 |
}
|
1503 |
$expressionContainsNamed = true;
|
1504 |
}
|
1507 |
// However if we do want to add it, there is nothing blocking it, just don't error
|
1508 |
// and remove isCall dependency below
|
1509 |
$value = null;
|
1510 |
+
if ( $isCall ) {
|
1511 |
$value = $this->parseDetachedRuleset();
|
1512 |
}
|
1513 |
+
if ( !$value ) {
|
1514 |
$value = $this->parseExpression();
|
1515 |
}
|
1516 |
|
1517 |
+
if ( !$value ) {
|
1518 |
+
if ( $isCall ) {
|
1519 |
+
$this->Error( 'could not understand value for named argument' );
|
1520 |
} else {
|
1521 |
$this->restore();
|
1522 |
$returner['args'] = array();
|
1524 |
}
|
1525 |
}
|
1526 |
|
1527 |
+
$nameLoop = ( $name = $val->name );
|
1528 |
+
} elseif ( !$isCall && $this->MatchReg( '/\\G\.{3}/' ) ) {
|
1529 |
$returner['variadic'] = true;
|
1530 |
+
if ( $this->MatchChar( ";" ) && !$isSemiColonSeperated ) {
|
1531 |
$isSemiColonSeperated = true;
|
1532 |
}
|
1533 |
+
if ( $isSemiColonSeperated ) {
|
1534 |
+
$argsSemiColon[] = array( 'name' => $arg->name, 'variadic' => true );
|
1535 |
+
} else {
|
1536 |
+
$argsComma[] = array( 'name' => $arg->name, 'variadic' => true );
|
1537 |
}
|
1538 |
break;
|
1539 |
+
} elseif ( !$isCall ) {
|
1540 |
$name = $nameLoop = $val->name;
|
1541 |
$value = null;
|
1542 |
}
|
1543 |
}
|
1544 |
|
1545 |
+
if ( $value ) {
|
1546 |
$expressions[] = $value;
|
1547 |
}
|
1548 |
|
1549 |
+
$argsComma[] = array( 'name' => $nameLoop, 'value' => $value );
|
1550 |
|
1551 |
+
if ( $this->MatchChar( ',' ) ) {
|
1552 |
continue;
|
1553 |
}
|
1554 |
|
1555 |
+
if ( $this->MatchChar( ';' ) || $isSemiColonSeperated ) {
|
1556 |
|
1557 |
+
if ( $expressionContainsNamed ) {
|
1558 |
+
$this->Error( 'Cannot mix ; and , as delimiter types' );
|
1559 |
}
|
1560 |
|
1561 |
$isSemiColonSeperated = true;
|
1562 |
|
1563 |
+
if ( count( $expressions ) > 1 ) {
|
1564 |
+
$value = $this->NewObj1( 'Less_Tree_Value', $expressions );
|
1565 |
}
|
1566 |
+
$argsSemiColon[] = array( 'name' => $name, 'value' => $value );
|
1567 |
|
1568 |
$name = null;
|
1569 |
$expressions = array();
|
1572 |
}
|
1573 |
|
1574 |
$this->forget();
|
1575 |
+
$returner['args'] = ( $isSemiColonSeperated ? $argsSemiColon : $argsComma );
|
1576 |
return $returner;
|
1577 |
}
|
1578 |
|
|
|
|
|
1579 |
//
|
1580 |
// A Mixin definition, with a list of parameters
|
1581 |
//
|
1595 |
// Once we've got our params list, and a closing `)`, we parse
|
1596 |
// the `{...}` block.
|
1597 |
//
|
1598 |
+
private function parseMixinDefinition() {
|
1599 |
$cond = null;
|
1600 |
|
1601 |
$char = $this->input[$this->pos];
|
1602 |
+
if ( ( $char !== '.' && $char !== '#' ) || ( $char === '{' && $this->PeekReg( '/\\G[^{]*\}/' ) ) ) {
|
1603 |
return;
|
1604 |
}
|
1605 |
|
1606 |
$this->save();
|
1607 |
|
1608 |
+
$match = $this->MatchReg( '/\\G([#.](?:[\w-]|\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/' );
|
1609 |
+
if ( $match ) {
|
1610 |
$name = $match[1];
|
1611 |
|
1612 |
$argInfo = $this->parseMixinArgs( false );
|
1613 |
$params = $argInfo['args'];
|
1614 |
$variadic = $argInfo['variadic'];
|
1615 |
|
|
|
1616 |
// .mixincall("@{a}");
|
1617 |
// looks a bit like a mixin definition..
|
1618 |
// also
|
1619 |
// .mixincall(@a: {rule: set;});
|
1620 |
// so we have to be nice and restore
|
1621 |
+
if ( !$this->MatchChar( ')' ) ) {
|
1622 |
$this->furthest = $this->pos;
|
1623 |
$this->restore();
|
1624 |
return;
|
1625 |
}
|
1626 |
|
|
|
1627 |
$this->parseComments();
|
1628 |
|
1629 |
+
if ( $this->MatchReg( '/\\Gwhen/' ) ) { // Guard
|
1630 |
+
$cond = $this->expect( 'parseConditions', 'Expected conditions' );
|
1631 |
}
|
1632 |
|
1633 |
$ruleset = $this->parseBlock();
|
1634 |
|
1635 |
+
if ( is_array( $ruleset ) ) {
|
1636 |
$this->forget();
|
1637 |
+
return $this->NewObj5( 'Less_Tree_Mixin_Definition', array( $name, $params, $ruleset, $cond, $variadic ) );
|
1638 |
}
|
1639 |
|
1640 |
$this->restore();
|
1641 |
+
} else {
|
1642 |
$this->forget();
|
1643 |
}
|
1644 |
}
|
1647 |
// Entities are the smallest recognized token,
|
1648 |
// and can be found inside a rule's value.
|
1649 |
//
|
1650 |
+
private function parseEntity() {
|
1651 |
+
return $this->MatchFuncs( array( 'parseEntitiesLiteral','parseEntitiesVariable','parseEntitiesUrl','parseEntitiesCall','parseEntitiesKeyword','parseEntitiesJavascript','parseComment' ) );
|
|
|
1652 |
}
|
1653 |
|
1654 |
//
|
1656 |
// because the `block` rule will be expecting it, but we still need to make sure
|
1657 |
// it's there, if ';' was omitted.
|
1658 |
//
|
1659 |
+
private function parseEnd() {
|
1660 |
+
return $this->MatchChar( ';' ) || $this->PeekChar( '}' );
|
1661 |
}
|
1662 |
|
1663 |
//
|
1665 |
//
|
1666 |
// alpha(opacity=88)
|
1667 |
//
|
1668 |
+
private function parseAlpha() {
|
1669 |
+
if ( !$this->MatchReg( '/\\G\(opacity=/i' ) ) {
|
|
|
1670 |
return;
|
1671 |
}
|
1672 |
|
1673 |
+
$value = $this->MatchReg( '/\\G[0-9]+/' );
|
1674 |
+
if ( $value ) {
|
1675 |
$value = $value[0];
|
1676 |
+
} else {
|
1677 |
$value = $this->parseEntitiesVariable();
|
1678 |
+
if ( !$value ) {
|
1679 |
return;
|
1680 |
}
|
1681 |
}
|
1682 |
|
1683 |
+
$this->expectChar( ')' );
|
1684 |
+
return $this->NewObj1( 'Less_Tree_Alpha', $value );
|
1685 |
}
|
1686 |
|
|
|
1687 |
//
|
1688 |
// A Selector Element
|
1689 |
//
|
1696 |
// they are made out of a `Combinator` (see combinator rule),
|
1697 |
// and an element name, such as a tag a class, or `*`.
|
1698 |
//
|
1699 |
+
private function parseElement() {
|
1700 |
$c = $this->parseCombinator();
|
1701 |
$index = $this->pos;
|
1702 |
|
1703 |
+
$e = $this->match( array( '/\\G(?:\d+\.\d+|\d+)%/', '/\\G(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/',
|
1704 |
+
'#*', '#&', 'parseAttribute', '/\\G\([^()@]+\)/', '/\\G[\.#](?=@)/', 'parseEntitiesVariableCurly' ) );
|
1705 |
|
1706 |
+
if ( is_null( $e ) ) {
|
1707 |
$this->save();
|
1708 |
+
if ( $this->MatchChar( '(' ) ) {
|
1709 |
+
if ( ( $v = $this->parseSelector() ) && $this->MatchChar( ')' ) ) {
|
1710 |
+
$e = $this->NewObj1( 'Less_Tree_Paren', $v );
|
1711 |
$this->forget();
|
1712 |
+
} else {
|
1713 |
$this->restore();
|
1714 |
}
|
1715 |
+
} else {
|
1716 |
$this->forget();
|
1717 |
}
|
1718 |
}
|
1719 |
|
1720 |
+
if ( !is_null( $e ) ) {
|
1721 |
+
return $this->NewObj4( 'Less_Tree_Element', array( $c, $e, $index, $this->env->currentFileInfo ) );
|
1722 |
}
|
1723 |
}
|
1724 |
|
1730 |
// as it's an empty space. We have to check the previous character
|
1731 |
// in the input, to see if it's a ` ` character.
|
1732 |
//
|
1733 |
+
private function parseCombinator() {
|
1734 |
+
if ( $this->pos < $this->input_len ) {
|
1735 |
$c = $this->input[$this->pos];
|
1736 |
+
if ( $c === '>' || $c === '+' || $c === '~' || $c === '|' || $c === '^' ) {
|
1737 |
|
1738 |
$this->pos++;
|
1739 |
+
if ( $this->input[$this->pos] === '^' ) {
|
1740 |
$c = '^^';
|
1741 |
$this->pos++;
|
1742 |
}
|
1743 |
|
1744 |
+
$this->skipWhitespace( 0 );
|
1745 |
|
1746 |
return $c;
|
1747 |
}
|
1748 |
|
1749 |
+
if ( $this->pos > 0 && $this->isWhitespace( -1 ) ) {
|
1750 |
return ' ';
|
1751 |
}
|
1752 |
}
|
1756 |
// A CSS selector (see selector below)
|
1757 |
// with less extensions e.g. the ability to extend and guard
|
1758 |
//
|
1759 |
+
private function parseLessSelector() {
|
1760 |
+
return $this->parseSelector( true );
|
1761 |
}
|
1762 |
|
1763 |
//
|
1768 |
//
|
1769 |
// Selectors are made out of one or more Elements, see above.
|
1770 |
//
|
1771 |
+
private function parseSelector( $isLess = false ) {
|
1772 |
$elements = array();
|
1773 |
$extendList = array();
|
1774 |
$condition = null;
|
1778 |
$c = null;
|
1779 |
$index = $this->pos;
|
1780 |
|
1781 |
+
while ( ( $isLess && ( $extend = $this->parseExtend() ) ) || ( $isLess && ( $when = $this->MatchReg( '/\\Gwhen/' ) ) ) || ( $e = $this->parseElement() ) ) {
|
1782 |
+
if ( $when ) {
|
1783 |
+
$condition = $this->expect( 'parseConditions', 'expected condition' );
|
1784 |
+
} elseif ( $condition ) {
|
1785 |
+
// error("CSS guard can only be used at the end of selector");
|
1786 |
+
} elseif ( $extend ) {
|
1787 |
+
$extendList = array_merge( $extendList, $extend );
|
1788 |
+
} else {
|
1789 |
+
// if( count($extendList) ){
|
1790 |
//error("Extend can only be used at the end of selector");
|
1791 |
//}
|
1792 |
+
if ( $this->pos < $this->input_len ) {
|
1793 |
$c = $this->input[ $this->pos ];
|
1794 |
}
|
1795 |
$elements[] = $e;
|
1796 |
$e = null;
|
1797 |
}
|
1798 |
|
1799 |
+
if ( $c === '{' || $c === '}' || $c === ';' || $c === ',' || $c === ')' ) { break;
|
1800 |
+
}
|
1801 |
}
|
1802 |
|
1803 |
+
if ( $elements ) {
|
1804 |
+
return $this->NewObj5( 'Less_Tree_Selector', array( $elements, $extendList, $condition, $index, $this->env->currentFileInfo ) );
|
1805 |
}
|
1806 |
+
if ( $extendList ) {
|
1807 |
+
$this->Error( 'Extend must be used to extend a selector, it cannot be used on its own' );
|
1808 |
}
|
1809 |
}
|
1810 |
|
1811 |
+
private function parseTag() {
|
1812 |
+
return ( $tag = $this->MatchReg( '/\\G[A-Za-z][A-Za-z-]*[0-9]?/' ) ) ? $tag : $this->MatchChar( '*' );
|
1813 |
}
|
1814 |
|
1815 |
+
private function parseAttribute() {
|
|
|
1816 |
$val = null;
|
1817 |
|
1818 |
+
if ( !$this->MatchChar( '[' ) ) {
|
1819 |
return;
|
1820 |
}
|
1821 |
|
1822 |
$key = $this->parseEntitiesVariableCurly();
|
1823 |
+
if ( !$key ) {
|
1824 |
+
$key = $this->expect( '/\\G(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\\\.)+/' );
|
1825 |
}
|
1826 |
|
1827 |
+
$op = $this->MatchReg( '/\\G[|~*$^]?=/' );
|
1828 |
+
if ( $op ) {
|
1829 |
+
$val = $this->match( array( 'parseEntitiesQuoted','/\\G[0-9]+%/','/\\G[\w-]+/','parseEntitiesVariableCurly' ) );
|
1830 |
}
|
1831 |
|
1832 |
+
$this->expectChar( ']' );
|
1833 |
|
1834 |
+
return $this->NewObj3( 'Less_Tree_Attribute', array( $key, $op === null ? null : $op[0], $val ) );
|
1835 |
}
|
1836 |
|
1837 |
//
|
1838 |
// The `block` rule is used by `ruleset` and `mixin.definition`.
|
1839 |
// It's a wrapper around the `primary` rule, with added `{}`.
|
1840 |
//
|
1841 |
+
private function parseBlock() {
|
1842 |
+
if ( $this->MatchChar( '{' ) ) {
|
1843 |
$content = $this->parsePrimary();
|
1844 |
+
if ( $this->MatchChar( '}' ) ) {
|
1845 |
return $content;
|
1846 |
}
|
1847 |
}
|
1848 |
}
|
1849 |
|
1850 |
+
private function parseBlockRuleset() {
|
1851 |
$block = $this->parseBlock();
|
1852 |
|
1853 |
+
if ( $block ) {
|
1854 |
+
$block = $this->NewObj2( 'Less_Tree_Ruleset', array( null, $block ) );
|
1855 |
}
|
1856 |
|
1857 |
return $block;
|
1858 |
}
|
1859 |
|
1860 |
+
private function parseDetachedRuleset() {
|
1861 |
$blockRuleset = $this->parseBlockRuleset();
|
1862 |
+
if ( $blockRuleset ) {
|
1863 |
+
return $this->NewObj1( 'Less_Tree_DetachedRuleset', $blockRuleset );
|
1864 |
}
|
1865 |
}
|
1866 |
|
1867 |
//
|
1868 |
// div, .class, body > p {...}
|
1869 |
//
|
1870 |
+
private function parseRuleset() {
|
1871 |
$selectors = array();
|
1872 |
|
1873 |
$this->save();
|
1874 |
|
1875 |
+
while ( true ) {
|
1876 |
$s = $this->parseLessSelector();
|
1877 |
+
if ( !$s ) {
|
1878 |
break;
|
1879 |
}
|
1880 |
$selectors[] = $s;
|
1881 |
$this->parseComments();
|
1882 |
|
1883 |
+
if ( $s->condition && count( $selectors ) > 1 ) {
|
1884 |
+
$this->Error( 'Guards are only currently allowed on a single selector.' );
|
1885 |
}
|
1886 |
|
1887 |
+
if ( !$this->MatchChar( ',' ) ) {
|
1888 |
break;
|
1889 |
}
|
1890 |
+
if ( $s->condition ) {
|
1891 |
+
$this->Error( 'Guards are only currently allowed on a single selector.' );
|
1892 |
}
|
1893 |
$this->parseComments();
|
1894 |
}
|
1895 |
|
1896 |
+
if ( $selectors ) {
|
|
|
1897 |
$rules = $this->parseBlock();
|
1898 |
+
if ( is_array( $rules ) ) {
|
1899 |
$this->forget();
|
1900 |
+
return $this->NewObj2( 'Less_Tree_Ruleset', array( $selectors, $rules ) ); // Less_Environment::$strictImports
|
1901 |
}
|
1902 |
}
|
1903 |
|
1911 |
* ex: width:100px;
|
1912 |
*
|
1913 |
*/
|
1914 |
+
private function parseNameValue() {
|
|
|
1915 |
$index = $this->pos;
|
1916 |
$this->save();
|
1917 |
|
1918 |
+
// $match = $this->MatchReg('/\\G([a-zA-Z\-]+)\s*:\s*((?:\'")?[a-zA-Z0-9\-% \.,!]+?(?:\'")?)\s*([;}])/');
|
1919 |
+
$match = $this->MatchReg( '/\\G([a-zA-Z\-]+)\s*:\s*([\'"]?[#a-zA-Z0-9\-%\.,]+?[\'"]?) *(! *important)?\s*([;}])/' );
|
1920 |
+
if ( $match ) {
|
1921 |
|
1922 |
+
if ( $match[4] == '}' ) {
|
1923 |
+
$this->pos = $index + strlen( $match[0] ) - 1;
|
|
|
|
|
|
|
|
|
1924 |
}
|
1925 |
|
1926 |
+
if ( $match[3] ) {
|
1927 |
$match[2] .= ' !important';
|
1928 |
}
|
1929 |
|
1930 |
+
return $this->NewObj4( 'Less_Tree_NameValue', array( $match[1], $match[2], $index, $this->env->currentFileInfo ) );
|
1931 |
}
|
1932 |
|
1933 |
$this->restore();
|
1934 |
}
|
1935 |
|
1936 |
+
private function parseRule( $tryAnonymous = null ) {
|
|
|
|
|
1937 |
$merge = false;
|
1938 |
$startOfRule = $this->pos;
|
1939 |
|
1940 |
$c = $this->input[$this->pos];
|
1941 |
+
if ( $c === '.' || $c === '#' || $c === '&' ) {
|
1942 |
return;
|
1943 |
}
|
1944 |
|
1945 |
$this->save();
|
1946 |
+
$name = $this->MatchFuncs( array( 'parseVariable','parseRuleProperty' ) );
|
1947 |
|
1948 |
+
if ( $name ) {
|
1949 |
|
1950 |
+
$isVariable = is_string( $name );
|
1951 |
|
1952 |
$value = null;
|
1953 |
+
if ( $isVariable ) {
|
1954 |
$value = $this->parseDetachedRuleset();
|
1955 |
}
|
1956 |
|
1957 |
$important = null;
|
1958 |
+
if ( !$value ) {
|
1959 |
|
1960 |
// prefer to try to parse first if its a variable or we are compressing
|
1961 |
// but always fallback on the other one
|
1962 |
//if( !$tryAnonymous && is_string($name) && $name[0] === '@' ){
|
1963 |
+
if ( !$tryAnonymous && ( Less_Parser::$options['compress'] || $isVariable ) ) {
|
1964 |
+
$value = $this->MatchFuncs( array( 'parseValue','parseAnonymousValue' ) );
|
1965 |
+
} else {
|
1966 |
+
$value = $this->MatchFuncs( array( 'parseAnonymousValue','parseValue' ) );
|
1967 |
}
|
1968 |
|
1969 |
$important = $this->parseImportant();
|
1971 |
// a name returned by this.ruleProperty() is always an array of the form:
|
1972 |
// [string-1, ..., string-n, ""] or [string-1, ..., string-n, "+"]
|
1973 |
// where each item is a tree.Keyword or tree.Variable
|
1974 |
+
if ( !$isVariable && is_array( $name ) ) {
|
1975 |
+
$nm = array_pop( $name );
|
1976 |
+
if ( $nm->value ) {
|
1977 |
$merge = $nm->value;
|
1978 |
}
|
1979 |
}
|
1980 |
}
|
1981 |
|
1982 |
+
if ( $value && $this->parseEnd() ) {
|
|
|
1983 |
$this->forget();
|
1984 |
+
return $this->NewObj6( 'Less_Tree_Rule', array( $name, $value, $important, $merge, $startOfRule, $this->env->currentFileInfo ) );
|
1985 |
+
} else {
|
1986 |
$this->furthest = $this->pos;
|
1987 |
$this->restore();
|
1988 |
+
if ( $value && !$tryAnonymous ) {
|
1989 |
+
return $this->parseRule( true );
|
1990 |
}
|
1991 |
}
|
1992 |
+
} else {
|
1993 |
$this->forget();
|
1994 |
}
|
1995 |
}
|
1996 |
|
1997 |
+
function parseAnonymousValue() {
|
1998 |
+
if ( preg_match( '/\\G([^@+\/\'"*`(;{}-]*);/', $this->input, $match, 0, $this->pos ) ) {
|
1999 |
+
$this->pos += strlen( $match[1] );
|
2000 |
+
return $this->NewObj1( 'Less_Tree_Anonymous', $match[1] );
|
|
|
2001 |
}
|
2002 |
}
|
2003 |
|
2011 |
// file-system operation. The function used for importing is
|
2012 |
// stored in `import`, which we pass to the Import constructor.
|
2013 |
//
|
2014 |
+
private function parseImport() {
|
|
|
2015 |
$this->save();
|
2016 |
|
2017 |
+
$dir = $this->MatchReg( '/\\G@import?\s+/' );
|
2018 |
|
2019 |
+
if ( $dir ) {
|
2020 |
$options = $this->parseImportOptions();
|
2021 |
+
$path = $this->MatchFuncs( array( 'parseEntitiesQuoted','parseEntitiesUrl' ) );
|
2022 |
|
2023 |
+
if ( $path ) {
|
2024 |
$features = $this->parseMediaFeatures();
|
2025 |
+
if ( $this->MatchChar( ';' ) ) {
|
2026 |
+
if ( $features ) {
|
2027 |
+
$features = $this->NewObj1( 'Less_Tree_Value', $features );
|
2028 |
}
|
2029 |
|
2030 |
$this->forget();
|
2031 |
+
return $this->NewObj5( 'Less_Tree_Import', array( $path, $features, $options, $this->pos, $this->env->currentFileInfo ) );
|
2032 |
}
|
2033 |
}
|
2034 |
}
|
2036 |
$this->restore();
|
2037 |
}
|
2038 |
|
2039 |
+
private function parseImportOptions() {
|
|
|
2040 |
$options = array();
|
2041 |
|
2042 |
// list of options, surrounded by parens
|
2043 |
+
if ( !$this->MatchChar( '(' ) ) {
|
2044 |
return $options;
|
2045 |
}
|
2046 |
do{
|
2047 |
$optionName = $this->parseImportOption();
|
2048 |
+
if ( $optionName ) {
|
2049 |
$value = true;
|
2050 |
+
switch ( $optionName ) {
|
2051 |
case "css":
|
2052 |
$optionName = "less";
|
2053 |
$value = false;
|
2058 |
break;
|
2059 |
}
|
2060 |
$options[$optionName] = $value;
|
2061 |
+
if ( !$this->MatchChar( ',' ) ) { break;
|
2062 |
+
}
|
2063 |
}
|
2064 |
+
}while ( $optionName );
|
2065 |
+
$this->expectChar( ')' );
|
2066 |
return $options;
|
2067 |
}
|
2068 |
|
2069 |
+
private function parseImportOption() {
|
2070 |
+
$opt = $this->MatchReg( '/\\G(less|css|multiple|once|inline|reference|optional)/' );
|
2071 |
+
if ( $opt ) {
|
2072 |
return $opt[1];
|
2073 |
}
|
2074 |
}
|
2077 |
$nodes = array();
|
2078 |
|
2079 |
do{
|
2080 |
+
$e = $this->MatchFuncs( array( 'parseEntitiesKeyword','parseEntitiesVariable' ) );
|
2081 |
+
if ( $e ) {
|
2082 |
$nodes[] = $e;
|
2083 |
+
} elseif ( $this->MatchChar( '(' ) ) {
|
2084 |
$p = $this->parseProperty();
|
2085 |
$e = $this->parseValue();
|
2086 |
+
if ( $this->MatchChar( ')' ) ) {
|
2087 |
+
if ( $p && $e ) {
|
2088 |
+
$r = $this->NewObj7( 'Less_Tree_Rule', array( $p, $e, null, null, $this->pos, $this->env->currentFileInfo, true ) );
|
2089 |
+
$nodes[] = $this->NewObj1( 'Less_Tree_Paren', $r );
|
2090 |
+
} elseif ( $e ) {
|
2091 |
+
$nodes[] = $this->NewObj1( 'Less_Tree_Paren', $e );
|
2092 |
} else {
|
2093 |
return null;
|
2094 |
}
|
2095 |
+
} else return null;
|
|
|
2096 |
}
|
2097 |
+
} while ( $e );
|
2098 |
|
2099 |
+
if ( $nodes ) {
|
2100 |
+
return $this->NewObj1( 'Less_Tree_Expression', $nodes );
|
2101 |
}
|
2102 |
}
|
2103 |
|
2106 |
|
2107 |
do{
|
2108 |
$e = $this->parseMediaFeature();
|
2109 |
+
if ( $e ) {
|
2110 |
$features[] = $e;
|
2111 |
+
if ( !$this->MatchChar( ',' ) ) break;
|
2112 |
+
} else {
|
2113 |
$e = $this->parseEntitiesVariable();
|
2114 |
+
if ( $e ) {
|
2115 |
$features[] = $e;
|
2116 |
+
if ( !$this->MatchChar( ',' ) ) break;
|
2117 |
}
|
2118 |
}
|
2119 |
+
} while ( $e );
|
2120 |
|
2121 |
return $features ? $features : null;
|
2122 |
}
|
2123 |
|
2124 |
private function parseMedia() {
|
2125 |
+
if ( $this->MatchReg( '/\\G@media/' ) ) {
|
2126 |
$features = $this->parseMediaFeatures();
|
2127 |
$rules = $this->parseBlock();
|
2128 |
|
2129 |
+
if ( is_array( $rules ) ) {
|
2130 |
+
return $this->NewObj4( 'Less_Tree_Media', array( $rules, $features, $this->pos, $this->env->currentFileInfo ) );
|
2131 |
}
|
2132 |
}
|
2133 |
}
|
2134 |
|
|
|
2135 |
//
|
2136 |
// A CSS Directive
|
2137 |
//
|
2138 |
// @charset "utf-8";
|
2139 |
//
|
2140 |
+
private function parseDirective() {
|
2141 |
+
if ( !$this->PeekChar( '@' ) ) {
|
|
|
2142 |
return;
|
2143 |
}
|
2144 |
|
2149 |
$hasExpression = false;
|
2150 |
$hasUnknown = false;
|
2151 |
|
2152 |
+
$value = $this->MatchFuncs( array( 'parseImport','parseMedia' ) );
|
2153 |
+
if ( $value ) {
|
|
|
2154 |
return $value;
|
2155 |
}
|
2156 |
|
2157 |
$this->save();
|
2158 |
|
2159 |
+
$name = $this->MatchReg( '/\\G@[a-z-]+/' );
|
2160 |
|
2161 |
+
if ( !$name ) return;
|
2162 |
$name = $name[0];
|
2163 |
|
|
|
2164 |
$nonVendorSpecificName = $name;
|
2165 |
+
$pos = strpos( $name, '-', 2 );
|
2166 |
+
if ( $name[1] == '-' && $pos > 0 ) {
|
2167 |
+
$nonVendorSpecificName = "@" . substr( $name, $pos + 1 );
|
2168 |
}
|
2169 |
|
2170 |
+
switch ( $nonVendorSpecificName ) {
|
|
|
2171 |
/*
|
2172 |
case "@font-face":
|
2173 |
case "@viewport":
|
2209 |
break;
|
2210 |
}
|
2211 |
|
2212 |
+
if ( $hasIdentifier ) {
|
2213 |
$value = $this->parseEntity();
|
2214 |
+
if ( !$value ) {
|
2215 |
+
$this->error( "expected " . $name . " identifier" );
|
2216 |
}
|
2217 |
+
} else if ( $hasExpression ) {
|
2218 |
$value = $this->parseExpression();
|
2219 |
+
if ( !$value ) {
|
2220 |
+
$this->error( "expected " . $name. " expression" );
|
2221 |
}
|
2222 |
+
} else if ( $hasUnknown ) {
|
2223 |
|
2224 |
+
$value = $this->MatchReg( '/\\G[^{;]+/' );
|
2225 |
+
if ( $value ) {
|
2226 |
+
$value = $this->NewObj1( 'Less_Tree_Anonymous', trim( $value[0] ) );
|
2227 |
}
|
2228 |
}
|
2229 |
|
2230 |
+
if ( $hasBlock ) {
|
2231 |
$rules = $this->parseBlockRuleset();
|
2232 |
}
|
2233 |
|
2234 |
+
if ( $rules || ( !$hasBlock && $value && $this->MatchChar( ';' ) ) ) {
|
2235 |
$this->forget();
|
2236 |
+
return $this->NewObj5( 'Less_Tree_Directive', array( $name, $value, $rules, $index, $this->env->currentFileInfo ) );
|
2237 |
}
|
2238 |
|
2239 |
$this->restore();
|
2240 |
}
|
2241 |
|
|
|
2242 |
//
|
2243 |
// A Value is a comma-delimited list of Expressions
|
2244 |
//
|
2247 |
// In a Rule, a Value represents everything after the `:`,
|
2248 |
// and before the `;`.
|
2249 |
//
|
2250 |
+
private function parseValue() {
|
2251 |
$expressions = array();
|
2252 |
|
2253 |
do{
|
2254 |
$e = $this->parseExpression();
|
2255 |
+
if ( $e ) {
|
2256 |
$expressions[] = $e;
|
2257 |
+
if ( !$this->MatchChar( ',' ) ) {
|
2258 |
break;
|
2259 |
}
|
2260 |
}
|
2261 |
+
}while ( $e );
|
2262 |
|
2263 |
+
if ( $expressions ) {
|
2264 |
+
return $this->NewObj1( 'Less_Tree_Value', $expressions );
|
2265 |
}
|
2266 |
}
|
2267 |
|
2268 |
+
private function parseImportant() {
|
2269 |
+
if ( $this->PeekChar( '!' ) && $this->MatchReg( '/\\G! *important/' ) ) {
|
2270 |
return ' !important';
|
2271 |
}
|
2272 |
}
|
2273 |
|
2274 |
+
private function parseSub() {
|
2275 |
+
if ( $this->MatchChar( '(' ) ) {
|
|
|
2276 |
$a = $this->parseAddition();
|
2277 |
+
if ( $a ) {
|
2278 |
+
$this->expectChar( ')' );
|
2279 |
+
return $this->NewObj2( 'Less_Tree_Expression', array( array( $a ), true ) ); // instead of $e->parens = true so the value is cached
|
2280 |
}
|
2281 |
}
|
2282 |
}
|
2283 |
|
|
|
2284 |
/**
|
2285 |
* Parses multiplication operation
|
2286 |
*
|
2287 |
* @return Less_Tree_Operation|null
|
2288 |
*/
|
2289 |
+
function parseMultiplication() {
|
|
|
2290 |
$return = $m = $this->parseOperand();
|
2291 |
+
if ( $return ) {
|
2292 |
+
while ( true ) {
|
2293 |
|
2294 |
$isSpaced = $this->isWhitespace( -1 );
|
2295 |
|
2296 |
+
if ( $this->PeekReg( '/\\G\/[*\/]/' ) ) {
|
2297 |
break;
|
2298 |
}
|
2299 |
|
2300 |
+
$op = $this->MatchChar( '/' );
|
2301 |
+
if ( !$op ) {
|
2302 |
+
$op = $this->MatchChar( '*' );
|
2303 |
+
if ( !$op ) {
|
2304 |
break;
|
2305 |
}
|
2306 |
}
|
2307 |
|
2308 |
$a = $this->parseOperand();
|
2309 |
|
2310 |
+
if ( !$a ) { break;
|
2311 |
+
}
|
2312 |
|
2313 |
$m->parensInOp = true;
|
2314 |
$a->parensInOp = true;
|
2315 |
+
$return = $this->NewObj3( 'Less_Tree_Operation', array( $op, array( $return, $a ), $isSpaced ) );
|
2316 |
}
|
2317 |
}
|
2318 |
return $return;
|
2319 |
|
2320 |
}
|
2321 |
|
|
|
2322 |
/**
|
2323 |
* Parses an addition operation
|
2324 |
*
|
2325 |
* @return Less_Tree_Operation|null
|
2326 |
*/
|
2327 |
+
private function parseAddition() {
|
|
|
2328 |
$return = $m = $this->parseMultiplication();
|
2329 |
+
if ( $return ) {
|
2330 |
+
while ( true ) {
|
2331 |
|
2332 |
$isSpaced = $this->isWhitespace( -1 );
|
2333 |
|
2334 |
+
$op = $this->MatchReg( '/\\G[-+]\s+/' );
|
2335 |
+
if ( $op ) {
|
2336 |
$op = $op[0];
|
2337 |
+
} else {
|
2338 |
+
if ( !$isSpaced ) {
|
2339 |
+
$op = $this->match( array( '#+','#-' ) );
|
2340 |
}
|
2341 |
+
if ( !$op ) {
|
2342 |
break;
|
2343 |
}
|
2344 |
}
|
2345 |
|
2346 |
$a = $this->parseMultiplication();
|
2347 |
+
if ( !$a ) {
|
2348 |
break;
|
2349 |
}
|
2350 |
|
2351 |
$m->parensInOp = true;
|
2352 |
$a->parensInOp = true;
|
2353 |
+
$return = $this->NewObj3( 'Less_Tree_Operation', array( $op, array( $return, $a ), $isSpaced ) );
|
2354 |
}
|
2355 |
}
|
2356 |
|
2357 |
return $return;
|
2358 |
}
|
2359 |
|
|
|
2360 |
/**
|
2361 |
* Parses the conditions
|
2362 |
*
|
2365 |
private function parseConditions() {
|
2366 |
$index = $this->pos;
|
2367 |
$return = $a = $this->parseCondition();
|
2368 |
+
if ( $a ) {
|
2369 |
+
while ( true ) {
|
2370 |
+
if ( !$this->PeekReg( '/\\G,\s*(not\s*)?\(/' ) || !$this->MatchChar( ',' ) ) {
|
2371 |
break;
|
2372 |
}
|
2373 |
$b = $this->parseCondition();
|
2374 |
+
if ( !$b ) {
|
2375 |
break;
|
2376 |
}
|
2377 |
|
2378 |
+
$return = $this->NewObj4( 'Less_Tree_Condition', array( 'or', $return, $b, $index ) );
|
2379 |
}
|
2380 |
return $return;
|
2381 |
}
|
2386 |
$negate = false;
|
2387 |
$c = null;
|
2388 |
|
2389 |
+
if ( $this->MatchReg( '/\\Gnot/' ) ) $negate = true;
|
2390 |
+
$this->expectChar( '(' );
|
2391 |
+
$a = $this->MatchFuncs( array( 'parseAddition','parseEntitiesKeyword','parseEntitiesQuoted' ) );
|
2392 |
|
2393 |
+
if ( $a ) {
|
2394 |
+
$op = $this->MatchReg( '/\\G(?:>=|<=|=<|[<=>])/' );
|
2395 |
+
if ( $op ) {
|
2396 |
+
$b = $this->MatchFuncs( array( 'parseAddition','parseEntitiesKeyword','parseEntitiesQuoted' ) );
|
2397 |
+
if ( $b ) {
|
2398 |
+
$c = $this->NewObj5( 'Less_Tree_Condition', array( $op[0], $a, $b, $index, $negate ) );
|
2399 |
} else {
|
2400 |
+
$this->Error( 'Unexpected expression' );
|
2401 |
}
|
2402 |
} else {
|
2403 |
+
$k = $this->NewObj1( 'Less_Tree_Keyword', 'true' );
|
2404 |
+
$c = $this->NewObj5( 'Less_Tree_Condition', array( '=', $a, $k, $index, $negate ) );
|
2405 |
}
|
2406 |
+
$this->expectChar( ')' );
|
2407 |
+
return $this->MatchReg( '/\\Gand/' ) ? $this->NewObj3( 'Less_Tree_Condition', array( 'and', $c, $this->parseCondition() ) ) : $c;
|
2408 |
}
|
2409 |
}
|
2410 |
|
2413 |
* such as a Color, or a Variable
|
2414 |
*
|
2415 |
*/
|
2416 |
+
private function parseOperand() {
|
|
|
2417 |
$negate = false;
|
2418 |
+
$offset = $this->pos + 1;
|
2419 |
+
if ( $offset >= $this->input_len ) {
|
2420 |
return;
|
2421 |
}
|
2422 |
$char = $this->input[$offset];
|
2423 |
+
if ( $char === '@' || $char === '(' ) {
|
2424 |
+
$negate = $this->MatchChar( '-' );
|
2425 |
}
|
2426 |
|
2427 |
+
$o = $this->MatchFuncs( array( 'parseSub','parseEntitiesDimension','parseEntitiesColor','parseEntitiesVariable','parseEntitiesCall' ) );
|
2428 |
|
2429 |
+
if ( $negate ) {
|
2430 |
$o->parensInOp = true;
|
2431 |
+
$o = $this->NewObj1( 'Less_Tree_Negative', $o );
|
2432 |
}
|
2433 |
|
2434 |
return $o;
|
2435 |
}
|
2436 |
|
|
|
2437 |
/**
|
2438 |
* Expressions either represent mathematical operations,
|
2439 |
* or white-space delimited Entities.
|
2440 |
*
|
2441 |
* 1px solid black
|
2442 |
+
* @var * 2
|
2443 |
*
|
2444 |
* @return Less_Tree_Expression|null
|
2445 |
*/
|
2446 |
+
private function parseExpression() {
|
2447 |
$entities = array();
|
2448 |
|
2449 |
do{
|
2450 |
+
$e = $this->MatchFuncs( array( 'parseAddition','parseEntity' ) );
|
2451 |
+
if ( $e ) {
|
2452 |
$entities[] = $e;
|
2453 |
// operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
|
2454 |
+
if ( !$this->PeekReg( '/\\G\/[\/*]/' ) ) {
|
2455 |
+
$delim = $this->MatchChar( '/' );
|
2456 |
+
if ( $delim ) {
|
2457 |
+
$entities[] = $this->NewObj1( 'Less_Tree_Anonymous', $delim );
|
2458 |
}
|
2459 |
}
|
2460 |
}
|
2461 |
+
}while ( $e );
|
2462 |
|
2463 |
+
if ( $entities ) {
|
2464 |
+
return $this->NewObj1( 'Less_Tree_Expression', $entities );
|
2465 |
}
|
2466 |
}
|
2467 |
|
|
|
2468 |
/**
|
2469 |
* Parse a property
|
2470 |
* eg: 'min-width', 'orientation', etc
|
2471 |
*
|
2472 |
* @return string
|
2473 |
*/
|
2474 |
+
private function parseProperty() {
|
2475 |
+
$name = $this->MatchReg( '/\\G(\*?-?[_a-zA-Z0-9-]+)\s*:/' );
|
2476 |
+
if ( $name ) {
|
2477 |
return $name[1];
|
2478 |
}
|
2479 |
}
|
2480 |
|
|
|
2481 |
/**
|
2482 |
* Parse a rule property
|
2483 |
* eg: 'color', 'width', 'height', etc
|
2484 |
*
|
2485 |
* @return string
|
2486 |
*/
|
2487 |
+
private function parseRuleProperty() {
|
2488 |
$offset = $this->pos;
|
2489 |
$name = array();
|
2490 |
$index = array();
|
2491 |
$length = 0;
|
2492 |
|
2493 |
+
$this->rulePropertyMatch( '/\\G(\*?)/', $offset, $length, $index, $name );
|
2494 |
+
while ( $this->rulePropertyMatch( '/\\G((?:[\w-]+)|(?:@\{[\w-]+\}))/', $offset, $length, $index, $name ) ); // !
|
2495 |
|
2496 |
+
if ( ( count( $name ) > 1 ) && $this->rulePropertyMatch( '/\\G\s*((?:\+_|\+)?)\s*:/', $offset, $length, $index, $name ) ) {
|
|
|
|
|
|
|
2497 |
// at last, we have the complete match now. move forward,
|
2498 |
// convert name particles to tree objects and return:
|
2499 |
+
$this->skipWhitespace( $length );
|
2500 |
|
2501 |
+
if ( $name[0] === '' ) {
|
2502 |
+
array_shift( $name );
|
2503 |
+
array_shift( $index );
|
2504 |
}
|
2505 |
+
foreach ( $name as $k => $s ) {
|
2506 |
+
if ( !$s || $s[0] !== '@' ) {
|
2507 |
+
$name[$k] = $this->NewObj1( 'Less_Tree_Keyword', $s );
|
2508 |
+
} else {
|
2509 |
+
$name[$k] = $this->NewObj3( 'Less_Tree_Variable', array( '@' . substr( $s, 2, -1 ), $index[$k], $this->env->currentFileInfo ) );
|
2510 |
}
|
2511 |
}
|
2512 |
return $name;
|
2513 |
}
|
2514 |
|
|
|
2515 |
}
|
2516 |
|
2517 |
+
private function rulePropertyMatch( $re, &$offset, &$length, &$index, &$name ) {
|
2518 |
+
preg_match( $re, $this->input, $a, 0, $offset );
|
2519 |
+
if ( $a ) {
|
2520 |
$index[] = $this->pos + $length;
|
2521 |
+
$length += strlen( $a[0] );
|
2522 |
+
$offset += strlen( $a[0] );
|
2523 |
$name[] = $a[1];
|
2524 |
return true;
|
2525 |
}
|
2526 |
}
|
2527 |
|
2528 |
+
public static function serializeVars( $vars ) {
|
2529 |
$s = '';
|
2530 |
|
2531 |
+
foreach ( $vars as $name => $value ) {
|
2532 |
+
$s .= ( ( $name[0] === '@' ) ? '' : '@' ) . $name .': '. $value . ( ( substr( $value, -1 ) === ';' ) ? '' : ';' );
|
2533 |
}
|
2534 |
|
2535 |
return $s;
|
2536 |
}
|
2537 |
|
|
|
2538 |
/**
|
2539 |
* Some versions of php have trouble with method_exists($a,$b) if $a is not an object
|
2540 |
*
|
2541 |
* @param string $b
|
2542 |
*/
|
2543 |
+
public static function is_method( $a, $b ) {
|
2544 |
+
return is_object( $a ) && method_exists( $a, $b );
|
2545 |
}
|
2546 |
|
|
|
2547 |
/**
|
2548 |
* Round numbers similarly to javascript
|
2549 |
* eg: 1.499999 to 1 instead of 2
|
2550 |
*
|
2551 |
*/
|
2552 |
+
public static function round( $i, $precision = 0 ) {
|
2553 |
+
$precision = pow( 10, $precision );
|
2554 |
+
$i = $i * $precision;
|
2555 |
+
|
2556 |
+
$ceil = ceil( $i );
|
2557 |
+
$floor = floor( $i );
|
2558 |
+
if ( ( $ceil - $i ) <= ( $i - $floor ) ) {
|
2559 |
+
return $ceil / $precision;
|
2560 |
+
} else {
|
2561 |
+
return $floor / $precision;
|
|
|
2562 |
}
|
2563 |
}
|
2564 |
|
|
|
2565 |
/**
|
2566 |
* Create Less_Tree_* objects and optionally generate a cache string
|
2567 |
*
|
2568 |
* @return mixed
|
2569 |
*/
|
2570 |
+
public function NewObj0( $class ) {
|
2571 |
$obj = new $class();
|
2572 |
+
if ( $this->CacheEnabled() ) {
|
2573 |
$obj->cache_string = ' new '.$class.'()';
|
2574 |
}
|
2575 |
return $obj;
|
2576 |
}
|
2577 |
|
2578 |
+
public function NewObj1( $class, $arg ) {
|
2579 |
$obj = new $class( $arg );
|
2580 |
+
if ( $this->CacheEnabled() ) {
|
2581 |
+
$obj->cache_string = ' new '.$class.'('.Less_Parser::ArgString( $arg ).')';
|
2582 |
}
|
2583 |
return $obj;
|
2584 |
}
|
2585 |
|
2586 |
+
public function NewObj2( $class, $args ) {
|
2587 |
$obj = new $class( $args[0], $args[1] );
|
2588 |
+
if ( $this->CacheEnabled() ) {
|
2589 |
+
$this->ObjCache( $obj, $class, $args );
|
2590 |
}
|
2591 |
return $obj;
|
2592 |
}
|
2593 |
|
2594 |
+
public function NewObj3( $class, $args ) {
|
2595 |
$obj = new $class( $args[0], $args[1], $args[2] );
|
2596 |
+
if ( $this->CacheEnabled() ) {
|
2597 |
+
$this->ObjCache( $obj, $class, $args );
|
2598 |
}
|
2599 |
return $obj;
|
2600 |
}
|
2601 |
|
2602 |
+
public function NewObj4( $class, $args ) {
|
2603 |
$obj = new $class( $args[0], $args[1], $args[2], $args[3] );
|
2604 |
+
if ( $this->CacheEnabled() ) {
|
2605 |
+
$this->ObjCache( $obj, $class, $args );
|
2606 |
}
|
2607 |
return $obj;
|
2608 |
}
|
2609 |
|
2610 |
+
public function NewObj5( $class, $args ) {
|
2611 |
$obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4] );
|
2612 |
+
if ( $this->CacheEnabled() ) {
|
2613 |
+
$this->ObjCache( $obj, $class, $args );
|
2614 |
}
|
2615 |
return $obj;
|
2616 |
}
|
2617 |
|
2618 |
+
public function NewObj6( $class, $args ) {
|
2619 |
$obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4], $args[5] );
|
2620 |
+
if ( $this->CacheEnabled() ) {
|
2621 |
+
$this->ObjCache( $obj, $class, $args );
|
2622 |
}
|
2623 |
return $obj;
|
2624 |
}
|
2625 |
|
2626 |
+
public function NewObj7( $class, $args ) {
|
2627 |
$obj = new $class( $args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6] );
|
2628 |
+
if ( $this->CacheEnabled() ) {
|
2629 |
+
$this->ObjCache( $obj, $class, $args );
|
2630 |
}
|
2631 |
return $obj;
|
2632 |
}
|
2633 |
|
2634 |
+
// caching
|
2635 |
+
public function ObjCache( $obj, $class, $args = array() ) {
|
2636 |
+
$obj->cache_string = ' new '.$class.'('. self::ArgCache( $args ).')';
|
2637 |
}
|
2638 |
|
2639 |
+
public function ArgCache( $args ) {
|
2640 |
+
return implode( ',', array_map( array( 'Less_Parser','ArgString' ), $args ) );
|
2641 |
}
|
2642 |
|
|
|
2643 |
/**
|
2644 |
* Convert an argument to a string for use in the parser cache
|
2645 |
*
|
2646 |
* @return string
|
2647 |
*/
|
2648 |
+
public static function ArgString( $arg ) {
|
2649 |
+
$type = gettype( $arg );
|
|
|
2650 |
|
2651 |
+
if ( $type === 'object' ) {
|
2652 |
$string = $arg->cache_string;
|
2653 |
+
unset( $arg->cache_string );
|
2654 |
return $string;
|
2655 |
|
2656 |
+
} elseif ( $type === 'array' ) {
|
2657 |
$string = ' Array(';
|
2658 |
+
foreach ( $arg as $k => $a ) {
|
2659 |
+
$string .= var_export( $k, true ).' => '.self::ArgString( $a ).',';
|
2660 |
}
|
2661 |
return $string . ')';
|
2662 |
}
|
2663 |
|
2664 |
+
return var_export( $arg, true );
|
2665 |
}
|
2666 |
|
2667 |
+
public function Error( $msg ) {
|
2668 |
+
throw new Less_Exception_Parser( $msg, null, $this->furthest, $this->env->currentFileInfo );
|
2669 |
}
|
2670 |
|
2671 |
+
public static function WinPath( $path ) {
|
2672 |
+
return str_replace( '\\', '/', $path );
|
2673 |
}
|
2674 |
|
2675 |
+
public static function AbsPath( $path, $winPath = false ) {
|
2676 |
+
if ( strpos( $path, '//' ) !== false && preg_match( '_^(https?:)?//\\w+(\\.\\w+)+/\\w+_i', $path ) ) {
|
2677 |
return $winPath ? '' : false;
|
2678 |
} else {
|
2679 |
+
$path = realpath( $path );
|
2680 |
+
if ( $winPath ) {
|
2681 |
+
$path = self::WinPath( $path );
|
2682 |
}
|
2683 |
return $path;
|
2684 |
}
|
2685 |
}
|
2686 |
|
2687 |
+
public function CacheEnabled() {
|
2688 |
+
return ( Less_Parser::$options['cache_method'] && ( Less_Cache::$cache_dir || ( Less_Parser::$options['cache_method'] == 'callback' ) ) );
|
2689 |
}
|
2690 |
|
2691 |
}
|
base/inc/lib/Less/SourceMap/Base64VLQ.php
CHANGED
@@ -67,7 +67,7 @@ class Less_SourceMap_Base64VLQ {
|
|
67 |
/**
|
68 |
* Constructor
|
69 |
*/
|
70 |
-
public function __construct(){
|
71 |
// I leave it here for future reference
|
72 |
// foreach(str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/') as $i => $char)
|
73 |
// {
|
@@ -85,8 +85,8 @@ class Less_SourceMap_Base64VLQ {
|
|
85 |
* even on a 64 bit machine.
|
86 |
* @param string $aValue
|
87 |
*/
|
88 |
-
public function toVLQSigned($aValue){
|
89 |
-
return 0xffffffff & ($aValue < 0 ? ((-$aValue) << 1) + 1 : ($aValue << 1) + 0);
|
90 |
}
|
91 |
|
92 |
/**
|
@@ -100,8 +100,8 @@ class Less_SourceMap_Base64VLQ {
|
|
100 |
* even on a 64 bit machine.
|
101 |
* @param integer $aValue
|
102 |
*/
|
103 |
-
public function fromVLQSigned($aValue){
|
104 |
-
return $aValue & 1 ? $this->zeroFill(~$aValue + 2, 1) | (-1 - 0x7fffffff) : $this->zeroFill($aValue, 1);
|
105 |
}
|
106 |
|
107 |
/**
|
@@ -110,18 +110,18 @@ class Less_SourceMap_Base64VLQ {
|
|
110 |
* @param string $aValue The value to encode
|
111 |
* @return string The encoded value
|
112 |
*/
|
113 |
-
public function encode($aValue){
|
114 |
$encoded = '';
|
115 |
-
$vlq = $this->toVLQSigned($aValue);
|
116 |
do
|
117 |
{
|
118 |
$digit = $vlq & $this->mask;
|
119 |
-
$vlq = $this->zeroFill($vlq, $this->shift);
|
120 |
-
if($vlq > 0){
|
121 |
$digit |= $this->continuationBit;
|
122 |
}
|
123 |
-
$encoded .= $this->base64Encode($digit);
|
124 |
-
} while($vlq > 0);
|
125 |
|
126 |
return $encoded;
|
127 |
}
|
@@ -132,17 +132,17 @@ class Less_SourceMap_Base64VLQ {
|
|
132 |
* @param string $encoded The encoded value to decode
|
133 |
* @return integer The decoded value
|
134 |
*/
|
135 |
-
public function decode($encoded){
|
136 |
$vlq = 0;
|
137 |
$i = 0;
|
138 |
do
|
139 |
{
|
140 |
-
$digit = $this->base64Decode($encoded[$i]);
|
141 |
-
$vlq |= ($digit & $this->mask) << ($i * $this->shift);
|
142 |
$i++;
|
143 |
-
} while($digit & $this->continuationBit);
|
144 |
|
145 |
-
return $this->fromVLQSigned($vlq);
|
146 |
}
|
147 |
|
148 |
/**
|
@@ -152,8 +152,8 @@ class Less_SourceMap_Base64VLQ {
|
|
152 |
* @param integer $b number of bits to shift
|
153 |
* @return integer
|
154 |
*/
|
155 |
-
public function zeroFill($a, $b){
|
156 |
-
return ($a >= 0) ? ($a >> $b) : ($a >> $b) & (PHP_INT_MAX >> ($b - 1));
|
157 |
}
|
158 |
|
159 |
/**
|
@@ -163,9 +163,9 @@ class Less_SourceMap_Base64VLQ {
|
|
163 |
* @return string
|
164 |
* @throws Exception If the number is invalid
|
165 |
*/
|
166 |
-
public function base64Encode($number){
|
167 |
-
if($number < 0 || $number > 63){
|
168 |
-
throw new Exception(sprintf('Invalid number "%s" given. Must be between 0 and 63.', $number));
|
169 |
}
|
170 |
return $this->intToCharMap[$number];
|
171 |
}
|
@@ -177,9 +177,9 @@ class Less_SourceMap_Base64VLQ {
|
|
177 |
* @return number
|
178 |
* @throws Exception If the number is invalid
|
179 |
*/
|
180 |
-
public function base64Decode($char){
|
181 |
-
if(!array_key_exists($char, $this->charToIntMap)){
|
182 |
-
throw new Exception(sprintf('Invalid base 64 digit "%s" given.', $char));
|
183 |
}
|
184 |
return $this->charToIntMap[$char];
|
185 |
}
|
67 |
/**
|
68 |
* Constructor
|
69 |
*/
|
70 |
+
public function __construct() {
|
71 |
// I leave it here for future reference
|
72 |
// foreach(str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/') as $i => $char)
|
73 |
// {
|
85 |
* even on a 64 bit machine.
|
86 |
* @param string $aValue
|
87 |
*/
|
88 |
+
public function toVLQSigned( $aValue ) {
|
89 |
+
return 0xffffffff & ( $aValue < 0 ? ( ( -$aValue ) << 1 ) + 1 : ( $aValue << 1 ) + 0 );
|
90 |
}
|
91 |
|
92 |
/**
|
100 |
* even on a 64 bit machine.
|
101 |
* @param integer $aValue
|
102 |
*/
|
103 |
+
public function fromVLQSigned( $aValue ) {
|
104 |
+
return $aValue & 1 ? $this->zeroFill( ~$aValue + 2, 1 ) | ( -1 - 0x7fffffff ) : $this->zeroFill( $aValue, 1 );
|
105 |
}
|
106 |
|
107 |
/**
|
110 |
* @param string $aValue The value to encode
|
111 |
* @return string The encoded value
|
112 |
*/
|
113 |
+
public function encode( $aValue ) {
|
114 |
$encoded = '';
|
115 |
+
$vlq = $this->toVLQSigned( $aValue );
|
116 |
do
|
117 |
{
|
118 |
$digit = $vlq & $this->mask;
|
119 |
+
$vlq = $this->zeroFill( $vlq, $this->shift );
|
120 |
+
if ( $vlq > 0 ) {
|
121 |
$digit |= $this->continuationBit;
|
122 |
}
|
123 |
+
$encoded .= $this->base64Encode( $digit );
|
124 |
+
} while ( $vlq > 0 );
|
125 |
|
126 |
return $encoded;
|
127 |
}
|
132 |
* @param string $encoded The encoded value to decode
|
133 |
* @return integer The decoded value
|
134 |
*/
|
135 |
+
public function decode( $encoded ) {
|
136 |
$vlq = 0;
|
137 |
$i = 0;
|
138 |
do
|
139 |
{
|
140 |
+
$digit = $this->base64Decode( $encoded[$i] );
|
141 |
+
$vlq |= ( $digit & $this->mask ) << ( $i * $this->shift );
|
142 |
$i++;
|
143 |
+
} while ( $digit & $this->continuationBit );
|
144 |
|
145 |
+
return $this->fromVLQSigned( $vlq );
|
146 |
}
|
147 |
|
148 |
/**
|
152 |
* @param integer $b number of bits to shift
|
153 |
* @return integer
|
154 |
*/
|
155 |
+
public function zeroFill( $a, $b ) {
|
156 |
+
return ( $a >= 0 ) ? ( $a >> $b ) : ( $a >> $b ) & ( PHP_INT_MAX >> ( $b - 1 ) );
|
157 |
}
|
158 |
|
159 |
/**
|
163 |
* @return string
|
164 |
* @throws Exception If the number is invalid
|
165 |
*/
|
166 |
+
public function base64Encode( $number ) {
|
167 |
+
if ( $number < 0 || $number > 63 ) {
|
168 |
+
throw new Exception( sprintf( 'Invalid number "%s" given. Must be between 0 and 63.', $number ) );
|
169 |
}
|
170 |
return $this->intToCharMap[$number];
|
171 |
}
|
177 |
* @return number
|
178 |
* @throws Exception If the number is invalid
|
179 |
*/
|
180 |
+
public function base64Decode( $char ) {
|
181 |
+
if ( !array_key_exists( $char, $this->charToIntMap ) ) {
|
182 |
+
throw new Exception( sprintf( 'Invalid base 64 digit "%s" given.', $char ) );
|
183 |
}
|
184 |
return $this->charToIntMap[$char];
|
185 |
}
|
base/inc/lib/Less/SourceMap/Generator.php
CHANGED
@@ -1,365 +1,354 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Source map generator
|
5 |
-
*
|
6 |
-
* @package Less
|
7 |
-
* @subpackage Output
|
8 |
-
*/
|
9 |
-
class Less_SourceMap_Generator extends Less_Configurable {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* What version of source map does the generator generate?
|
13 |
-
*/
|
14 |
-
const VERSION = 3;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Array of default options
|
18 |
-
*
|
19 |
-
* @var array
|
20 |
-
*/
|
21 |
-
protected $defaultOptions = array(
|
22 |
-
// an optional source root, useful for relocating source files
|
23 |
-
// on a server or removing repeated values in the 'sources' entry.
|
24 |
-
// This value is prepended to the individual entries in the 'source' field.
|
25 |
-
'sourceRoot' => '',
|
26 |
-
|
27 |
-
// an optional name of the generated code that this source map is associated with.
|
28 |
-
'sourceMapFilename' => null,
|
29 |
-
|
30 |
-
// url of the map
|
31 |
-
'sourceMapURL' => null,
|
32 |
-
|
33 |
-
// absolute path to a file to write the map to
|
34 |
-
'sourceMapWriteTo' => null,
|
35 |
-
|
36 |
-
// output source contents?
|
37 |
-
'outputSourceFiles' => false,
|
38 |
-
|
39 |
-
// base path for filename normalization
|
40 |
-
'sourceMapRootpath' => '',
|
41 |
-
|
42 |
-
// base path for filename normalization
|
43 |
-
'sourceMapBasepath' => ''
|
44 |
-
);
|
45 |
-
|
46 |
-
/**
|
47 |
-
* The base64 VLQ encoder
|
48 |
-
*
|
49 |
-
* @var Less_SourceMap_Base64VLQ
|
50 |
-
*/
|
51 |
-
protected $encoder;
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Array of mappings
|
55 |
-
*
|
56 |
-
* @var array
|
57 |
-
*/
|
58 |
-
protected $mappings = array();
|
59 |
-
|
60 |
-
/**
|
61 |
-
* The root node
|
62 |
-
*
|
63 |
-
* @var Less_Tree_Ruleset
|
64 |
-
*/
|
65 |
-
protected $root;
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Array of contents map
|
69 |
-
*
|
70 |
-
* @var array
|
71 |
-
*/
|
72 |
-
protected $contentsMap = array();
|
73 |
-
|
74 |
-
/**
|
75 |
-
* File to content map
|
76 |
-
*
|
77 |
-
* @var array
|
78 |
-
*/
|
79 |
-
protected $sources = array();
|
80 |
-
protected $source_keys = array();
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Constructor
|
84 |
-
*
|
85 |
-
* @param Less_Tree_Ruleset $root The root node
|
86 |
-
* @param array $options Array of options
|
87 |
-
*/
|
88 |
-
public function __construct(Less_Tree_Ruleset $root, $contentsMap, $options = array()){
|
89 |
-
$this->root = $root;
|
90 |
-
$this->contentsMap = $contentsMap;
|
91 |
-
$this->encoder = new Less_SourceMap_Base64VLQ();
|
92 |
-
|
93 |
-
$this->SetOptions($options);
|
94 |
-
|
95 |
-
$this->options['sourceMapRootpath'] = $this->fixWindowsPath($this->options['sourceMapRootpath'], true);
|
96 |
-
$this->options['sourceMapBasepath'] = $this->fixWindowsPath($this->options['sourceMapBasepath'], true);
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Generates the CSS
|
101 |
-
*
|
102 |
-
* @return string
|
103 |
-
*/
|
104 |
-
public function generateCSS(){
|
105 |
-
$output = new Less_Output_Mapped($this->contentsMap, $this);
|
106 |
-
|
107 |
-
// catch the output
|
108 |
-
$this->root->genCSS($output);
|
109 |
-
|
110 |
-
|
111 |
-
$
|
112 |
-
$
|
113 |
-
$
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
*
|
139 |
-
*
|
140 |
-
* @param string $
|
141 |
-
* @
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
*
|
160 |
-
*
|
161 |
-
* @
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
$
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
*
|
186 |
-
*
|
187 |
-
* @param integer $
|
188 |
-
* @param integer $
|
189 |
-
* @param
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
'
|
197 |
-
'
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
// An optional
|
223 |
-
$
|
224 |
-
if( $
|
225 |
-
$sourceMap['
|
226 |
-
}
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
$
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
$
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
*
|
342 |
-
*
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
public function fixWindowsPath($path, $addEndSlash = false){
|
356 |
-
$slash = ($addEndSlash) ? '/' : '';
|
357 |
-
if( !empty($path) ){
|
358 |
-
$path = str_replace('\\', '/', $path);
|
359 |
-
$path = rtrim($path,'/') . $slash;
|
360 |
-
}
|
361 |
-
|
362 |
-
return $path;
|
363 |
-
}
|
364 |
-
|
365 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Source map generator
|
5 |
+
*
|
6 |
+
* @package Less
|
7 |
+
* @subpackage Output
|
8 |
+
*/
|
9 |
+
class Less_SourceMap_Generator extends Less_Configurable {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* What version of source map does the generator generate?
|
13 |
+
*/
|
14 |
+
private const VERSION = 3;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Array of default options
|
18 |
+
*
|
19 |
+
* @var array
|
20 |
+
*/
|
21 |
+
protected $defaultOptions = array(
|
22 |
+
// an optional source root, useful for relocating source files
|
23 |
+
// on a server or removing repeated values in the 'sources' entry.
|
24 |
+
// This value is prepended to the individual entries in the 'source' field.
|
25 |
+
'sourceRoot' => '',
|
26 |
+
|
27 |
+
// an optional name of the generated code that this source map is associated with.
|
28 |
+
'sourceMapFilename' => null,
|
29 |
+
|
30 |
+
// url of the map
|
31 |
+
'sourceMapURL' => null,
|
32 |
+
|
33 |
+
// absolute path to a file to write the map to
|
34 |
+
'sourceMapWriteTo' => null,
|
35 |
+
|
36 |
+
// output source contents?
|
37 |
+
'outputSourceFiles' => false,
|
38 |
+
|
39 |
+
// base path for filename normalization
|
40 |
+
'sourceMapRootpath' => '',
|
41 |
+
|
42 |
+
// base path for filename normalization
|
43 |
+
'sourceMapBasepath' => ''
|
44 |
+
);
|
45 |
+
|
46 |
+
/**
|
47 |
+
* The base64 VLQ encoder
|
48 |
+
*
|
49 |
+
* @var Less_SourceMap_Base64VLQ
|
50 |
+
*/
|
51 |
+
protected $encoder;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Array of mappings
|
55 |
+
*
|
56 |
+
* @var array
|
57 |
+
*/
|
58 |
+
protected $mappings = array();
|
59 |
+
|
60 |
+
/**
|
61 |
+
* The root node
|
62 |
+
*
|
63 |
+
* @var Less_Tree_Ruleset
|
64 |
+
*/
|
65 |
+
protected $root;
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Array of contents map
|
69 |
+
*
|
70 |
+
* @var array
|
71 |
+
*/
|
72 |
+
protected $contentsMap = array();
|
73 |
+
|
74 |
+
/**
|
75 |
+
* File to content map
|
76 |
+
*
|
77 |
+
* @var array
|
78 |
+
*/
|
79 |
+
protected $sources = array();
|
80 |
+
protected $source_keys = array();
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Constructor
|
84 |
+
*
|
85 |
+
* @param Less_Tree_Ruleset $root The root node
|
86 |
+
* @param array $options Array of options
|
87 |
+
*/
|
88 |
+
public function __construct( Less_Tree_Ruleset $root, $contentsMap, $options = array() ) {
|
89 |
+
$this->root = $root;
|
90 |
+
$this->contentsMap = $contentsMap;
|
91 |
+
$this->encoder = new Less_SourceMap_Base64VLQ();
|
92 |
+
|
93 |
+
$this->SetOptions( $options );
|
94 |
+
|
95 |
+
$this->options['sourceMapRootpath'] = $this->fixWindowsPath( $this->options['sourceMapRootpath'], true );
|
96 |
+
$this->options['sourceMapBasepath'] = $this->fixWindowsPath( $this->options['sourceMapBasepath'], true );
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Generates the CSS
|
101 |
+
*
|
102 |
+
* @return string
|
103 |
+
*/
|
104 |
+
public function generateCSS() {
|
105 |
+
$output = new Less_Output_Mapped( $this->contentsMap, $this );
|
106 |
+
|
107 |
+
// catch the output
|
108 |
+
$this->root->genCSS( $output );
|
109 |
+
|
110 |
+
$sourceMapUrl = $this->getOption( 'sourceMapURL' );
|
111 |
+
$sourceMapFilename = $this->getOption( 'sourceMapFilename' );
|
112 |
+
$sourceMapContent = $this->generateJson();
|
113 |
+
$sourceMapWriteTo = $this->getOption( 'sourceMapWriteTo' );
|
114 |
+
|
115 |
+
if ( !$sourceMapUrl && $sourceMapFilename ) {
|
116 |
+
$sourceMapUrl = $this->normalizeFilename( $sourceMapFilename );
|
117 |
+
}
|
118 |
+
|
119 |
+
// write map to a file
|
120 |
+
if ( $sourceMapWriteTo ) {
|
121 |
+
$this->saveMap( $sourceMapWriteTo, $sourceMapContent );
|
122 |
+
}
|
123 |
+
|
124 |
+
// inline the map
|
125 |
+
if ( !$sourceMapUrl ) {
|
126 |
+
$sourceMapUrl = sprintf( 'data:application/json,%s', Less_Functions::encodeURIComponent( $sourceMapContent ) );
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( $sourceMapUrl ) {
|
130 |
+
$output->add( sprintf( '/*# sourceMappingURL=%s */', $sourceMapUrl ) );
|
131 |
+
}
|
132 |
+
|
133 |
+
return $output->toString();
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Saves the source map to a file
|
138 |
+
*
|
139 |
+
* @param string $file The absolute path to a file
|
140 |
+
* @param string $content The content to write
|
141 |
+
* @throws Exception If the file could not be saved
|
142 |
+
*/
|
143 |
+
protected function saveMap( $file, $content ) {
|
144 |
+
$dir = dirname( $file );
|
145 |
+
// directory does not exist
|
146 |
+
if ( !is_dir( $dir ) ) {
|
147 |
+
// FIXME: create the dir automatically?
|
148 |
+
throw new Exception( sprintf( 'The directory "%s" does not exist. Cannot save the source map.', $dir ) );
|
149 |
+
}
|
150 |
+
// FIXME: proper saving, with dir write check!
|
151 |
+
if ( file_put_contents( $file, $content ) === false ) {
|
152 |
+
throw new Exception( sprintf( 'Cannot save the source map to "%s"', $file ) );
|
153 |
+
}
|
154 |
+
return true;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Normalizes the filename
|
159 |
+
*
|
160 |
+
* @param string $filename
|
161 |
+
* @return string
|
162 |
+
*/
|
163 |
+
protected function normalizeFilename( $filename ) {
|
164 |
+
$filename = $this->fixWindowsPath( $filename );
|
165 |
+
|
166 |
+
$rootpath = $this->getOption( 'sourceMapRootpath' );
|
167 |
+
$basePath = $this->getOption( 'sourceMapBasepath' );
|
168 |
+
|
169 |
+
// "Trim" the 'sourceMapBasepath' from the output filename.
|
170 |
+
if ( is_string( $basePath ) && strpos( $filename, $basePath ) === 0 ) {
|
171 |
+
$filename = substr( $filename, strlen( $basePath ) );
|
172 |
+
}
|
173 |
+
|
174 |
+
// Remove extra leading path separators.
|
175 |
+
if ( strpos( $filename, '\\' ) === 0 || strpos( $filename, '/' ) === 0 ) {
|
176 |
+
$filename = substr( $filename, 1 );
|
177 |
+
}
|
178 |
+
|
179 |
+
return $rootpath . $filename;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Adds a mapping
|
184 |
+
*
|
185 |
+
* @param integer $generatedLine The line number in generated file
|
186 |
+
* @param integer $generatedColumn The column number in generated file
|
187 |
+
* @param integer $originalLine The line number in original file
|
188 |
+
* @param integer $originalColumn The column number in original file
|
189 |
+
* @param string $sourceFile The original source file
|
190 |
+
*/
|
191 |
+
public function addMapping( $generatedLine, $generatedColumn, $originalLine, $originalColumn, $fileInfo ) {
|
192 |
+
$this->mappings[] = array(
|
193 |
+
'generated_line' => $generatedLine,
|
194 |
+
'generated_column' => $generatedColumn,
|
195 |
+
'original_line' => $originalLine,
|
196 |
+
'original_column' => $originalColumn,
|
197 |
+
'source_file' => $fileInfo['currentUri']
|
198 |
+
);
|
199 |
+
|
200 |
+
$this->sources[$fileInfo['currentUri']] = $fileInfo['filename'];
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Generates the JSON source map
|
205 |
+
*
|
206 |
+
* @return string
|
207 |
+
* @see https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#
|
208 |
+
*/
|
209 |
+
protected function generateJson() {
|
210 |
+
$sourceMap = array();
|
211 |
+
$mappings = $this->generateMappings();
|
212 |
+
|
213 |
+
// File version (always the first entry in the object) and must be a positive integer.
|
214 |
+
$sourceMap['version'] = self::VERSION;
|
215 |
+
|
216 |
+
// An optional name of the generated code that this source map is associated with.
|
217 |
+
$file = $this->getOption( 'sourceMapFilename' );
|
218 |
+
if ( $file ) {
|
219 |
+
$sourceMap['file'] = $file;
|
220 |
+
}
|
221 |
+
|
222 |
+
// An optional source root, useful for relocating source files on a server or removing repeated values in the 'sources' entry. This value is prepended to the individual entries in the 'source' field.
|
223 |
+
$root = $this->getOption( 'sourceRoot' );
|
224 |
+
if ( $root ) {
|
225 |
+
$sourceMap['sourceRoot'] = $root;
|
226 |
+
}
|
227 |
+
|
228 |
+
// A list of original sources used by the 'mappings' entry.
|
229 |
+
$sourceMap['sources'] = array();
|
230 |
+
foreach ( $this->sources as $source_uri => $source_filename ) {
|
231 |
+
$sourceMap['sources'][] = $this->normalizeFilename( $source_filename );
|
232 |
+
}
|
233 |
+
|
234 |
+
// A list of symbol names used by the 'mappings' entry.
|
235 |
+
$sourceMap['names'] = array();
|
236 |
+
|
237 |
+
// A string with the encoded mapping data.
|
238 |
+
$sourceMap['mappings'] = $mappings;
|
239 |
+
|
240 |
+
if ( $this->getOption( 'outputSourceFiles' ) ) {
|
241 |
+
// An optional list of source content, useful when the 'source' can't be hosted.
|
242 |
+
// The contents are listed in the same order as the sources above.
|
243 |
+
// 'null' may be used if some original sources should be retrieved by name.
|
244 |
+
$sourceMap['sourcesContent'] = $this->getSourcesContent();
|
245 |
+
}
|
246 |
+
|
247 |
+
// less.js compat fixes
|
248 |
+
if ( count( $sourceMap['sources'] ) && empty( $sourceMap['sourceRoot'] ) ) {
|
249 |
+
unset( $sourceMap['sourceRoot'] );
|
250 |
+
}
|
251 |
+
|
252 |
+
return json_encode( $sourceMap );
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Returns the sources contents
|
257 |
+
*
|
258 |
+
* @return array|null
|
259 |
+
*/
|
260 |
+
protected function getSourcesContent() {
|
261 |
+
if ( empty( $this->sources ) ) {
|
262 |
+
return;
|
263 |
+
}
|
264 |
+
$content = array();
|
265 |
+
foreach ( $this->sources as $sourceFile ) {
|
266 |
+
$content[] = file_get_contents( $sourceFile );
|
267 |
+
}
|
268 |
+
return $content;
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Generates the mappings string
|
273 |
+
*
|
274 |
+
* @return string
|
275 |
+
*/
|
276 |
+
public function generateMappings() {
|
277 |
+
if ( !count( $this->mappings ) ) {
|
278 |
+
return '';
|
279 |
+
}
|
280 |
+
|
281 |
+
$this->source_keys = array_flip( array_keys( $this->sources ) );
|
282 |
+
|
283 |
+
// group mappings by generated line number.
|
284 |
+
$groupedMap = $groupedMapEncoded = array();
|
285 |
+
foreach ( $this->mappings as $m ) {
|
286 |
+
$groupedMap[$m['generated_line']][] = $m;
|
287 |
+
}
|
288 |
+
ksort( $groupedMap );
|
289 |
+
|
290 |
+
$lastGeneratedLine = $lastOriginalIndex = $lastOriginalLine = $lastOriginalColumn = 0;
|
291 |
+
|
292 |
+
foreach ( $groupedMap as $lineNumber => $line_map ) {
|
293 |
+
while ( ++$lastGeneratedLine < $lineNumber ) {
|
294 |
+
$groupedMapEncoded[] = ';';
|
295 |
+
}
|
296 |
+
|
297 |
+
$lineMapEncoded = array();
|
298 |
+
$lastGeneratedColumn = 0;
|
299 |
+
|
300 |
+
foreach ( $line_map as $m ) {
|
301 |
+
$mapEncoded = $this->encoder->encode( $m['generated_column'] - $lastGeneratedColumn );
|
302 |
+
$lastGeneratedColumn = $m['generated_column'];
|
303 |
+
|
304 |
+
// find the index
|
305 |
+
if ( $m['source_file'] ) {
|
306 |
+
$index = $this->findFileIndex( $m['source_file'] );
|
307 |
+
if ( $index !== false ) {
|
308 |
+
$mapEncoded .= $this->encoder->encode( $index - $lastOriginalIndex );
|
309 |
+
$lastOriginalIndex = $index;
|
310 |
+
|
311 |
+
// lines are stored 0-based in SourceMap spec version 3
|
312 |
+
$mapEncoded .= $this->encoder->encode( $m['original_line'] - 1 - $lastOriginalLine );
|
313 |
+
$lastOriginalLine = $m['original_line'] - 1;
|
314 |
+
|
315 |
+
$mapEncoded .= $this->encoder->encode( $m['original_column'] - $lastOriginalColumn );
|
316 |
+
$lastOriginalColumn = $m['original_column'];
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
$lineMapEncoded[] = $mapEncoded;
|
321 |
+
}
|
322 |
+
|
323 |
+
$groupedMapEncoded[] = implode( ',', $lineMapEncoded ) . ';';
|
324 |
+
}
|
325 |
+
|
326 |
+
return rtrim( implode( $groupedMapEncoded ), ';' );
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Finds the index for the filename
|
331 |
+
*
|
332 |
+
* @param string $filename
|
333 |
+
* @return integer|false
|
334 |
+
*/
|
335 |
+
protected function findFileIndex( $filename ) {
|
336 |
+
return $this->source_keys[$filename];
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* fix windows paths
|
341 |
+
* @param string $path
|
342 |
+
* @return string
|
343 |
+
*/
|
344 |
+
public function fixWindowsPath( $path, $addEndSlash = false ) {
|
345 |
+
$slash = ( $addEndSlash ) ? '/' : '';
|
346 |
+
if ( !empty( $path ) ) {
|
347 |
+
$path = str_replace( '\\', '/', $path );
|
348 |
+
$path = rtrim( $path, '/' ) . $slash;
|
349 |
+
}
|
350 |
+
|
351 |
+
return $path;
|
352 |
+
}
|
353 |
+
|
354 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
base/inc/lib/Less/Tree.php
CHANGED
@@ -6,39 +6,36 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree{
|
10 |
|
11 |
public $cache_string;
|
12 |
|
13 |
-
public function toCSS(){
|
14 |
$output = new Less_Output();
|
15 |
-
$this->genCSS($output);
|
16 |
return $output->toString();
|
17 |
}
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
/**
|
30 |
* @param Less_Tree_Ruleset[] $rules
|
31 |
*/
|
32 |
-
public static function outputRuleset( $output, $rules ){
|
33 |
-
|
34 |
-
$ruleCnt = count($rules);
|
35 |
Less_Environment::$tabLevel++;
|
36 |
|
37 |
-
|
38 |
// Compressed
|
39 |
-
if( Less_Parser::$options['compress'] ){
|
40 |
-
$output->add('{');
|
41 |
-
for( $i = 0; $i < $ruleCnt; $i++ ){
|
42 |
$rules[$i]->genCSS( $output );
|
43 |
}
|
44 |
|
@@ -47,13 +44,12 @@ class Less_Tree{
|
|
47 |
return;
|
48 |
}
|
49 |
|
50 |
-
|
51 |
// Non-compressed
|
52 |
-
$tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation']
|
53 |
$tabRuleStr = $tabSetStr.Less_Parser::$options['indentation'];
|
54 |
|
55 |
$output->add( " {" );
|
56 |
-
for($i = 0; $i < $ruleCnt; $i++ ){
|
57 |
$output->add( $tabRuleStr );
|
58 |
$rules[$i]->genCSS( $output );
|
59 |
}
|
@@ -62,26 +58,24 @@ class Less_Tree{
|
|
62 |
|
63 |
}
|
64 |
|
65 |
-
public function accept($visitor){
|
66 |
-
|
67 |
|
68 |
-
public static function ReferencedArray($rules){
|
69 |
-
foreach($rules as $rule){
|
70 |
-
if( method_exists($rule, 'markReferenced') ){
|
71 |
$rule->markReferenced();
|
72 |
}
|
73 |
}
|
74 |
}
|
75 |
|
76 |
-
|
77 |
/**
|
78 |
* Requires php 5.3+
|
79 |
*/
|
80 |
-
public static function __set_state($args){
|
81 |
-
|
82 |
$class = get_called_class();
|
83 |
-
$obj = new $class(null,null,null,null);
|
84 |
-
foreach($args as $key => $val){
|
85 |
$obj->$key = $val;
|
86 |
}
|
87 |
return $obj;
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree {
|
10 |
|
11 |
public $cache_string;
|
12 |
|
13 |
+
public function toCSS() {
|
14 |
$output = new Less_Output();
|
15 |
+
$this->genCSS( $output );
|
16 |
return $output->toString();
|
17 |
}
|
18 |
|
19 |
+
/**
|
20 |
+
* Generate CSS by adding it to the output object
|
21 |
+
*
|
22 |
+
* @param Less_Output $output The output
|
23 |
+
* @return void
|
24 |
+
*/
|
25 |
+
public function genCSS( $output ) {
|
26 |
+
}
|
|
|
27 |
|
28 |
/**
|
29 |
* @param Less_Tree_Ruleset[] $rules
|
30 |
*/
|
31 |
+
public static function outputRuleset( $output, $rules ) {
|
32 |
+
$ruleCnt = count( $rules );
|
|
|
33 |
Less_Environment::$tabLevel++;
|
34 |
|
|
|
35 |
// Compressed
|
36 |
+
if ( Less_Parser::$options['compress'] ) {
|
37 |
+
$output->add( '{' );
|
38 |
+
for ( $i = 0; $i < $ruleCnt; $i++ ) {
|
39 |
$rules[$i]->genCSS( $output );
|
40 |
}
|
41 |
|
44 |
return;
|
45 |
}
|
46 |
|
|
|
47 |
// Non-compressed
|
48 |
+
$tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation'], Less_Environment::$tabLevel - 1 );
|
49 |
$tabRuleStr = $tabSetStr.Less_Parser::$options['indentation'];
|
50 |
|
51 |
$output->add( " {" );
|
52 |
+
for ( $i = 0; $i < $ruleCnt; $i++ ) {
|
53 |
$output->add( $tabRuleStr );
|
54 |
$rules[$i]->genCSS( $output );
|
55 |
}
|
58 |
|
59 |
}
|
60 |
|
61 |
+
public function accept( $visitor ) {
|
62 |
+
}
|
63 |
|
64 |
+
public static function ReferencedArray( $rules ) {
|
65 |
+
foreach ( $rules as $rule ) {
|
66 |
+
if ( method_exists( $rule, 'markReferenced' ) ) {
|
67 |
$rule->markReferenced();
|
68 |
}
|
69 |
}
|
70 |
}
|
71 |
|
|
|
72 |
/**
|
73 |
* Requires php 5.3+
|
74 |
*/
|
75 |
+
public static function __set_state( $args ) {
|
|
|
76 |
$class = get_called_class();
|
77 |
+
$obj = new $class( null, null, null, null );
|
78 |
+
foreach ( $args as $key => $val ) {
|
79 |
$obj->$key = $val;
|
80 |
}
|
81 |
return $obj;
|
base/inc/lib/Less/Tree/Alpha.php
CHANGED
@@ -6,46 +6,43 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Alpha extends Less_Tree{
|
10 |
public $value;
|
11 |
public $type = 'Alpha';
|
12 |
|
13 |
-
public function __construct($val){
|
14 |
$this->value = $val;
|
15 |
}
|
16 |
|
17 |
-
//function accept( $visitor ){
|
18 |
// $this->value = $visitor->visit( $this->value );
|
19 |
//}
|
20 |
|
21 |
-
public function compile($env){
|
22 |
-
|
23 |
-
|
24 |
-
$this->value = $this->value->compile($env);
|
25 |
}
|
26 |
|
27 |
return $this;
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
public function genCSS( $output ){
|
34 |
-
|
35 |
$output->add( "alpha(opacity=" );
|
36 |
|
37 |
-
if( is_string($this->value) ){
|
38 |
$output->add( $this->value );
|
39 |
-
}else{
|
40 |
-
$this->value->genCSS( $output);
|
41 |
}
|
42 |
|
43 |
$output->add( ')' );
|
44 |
}
|
45 |
|
46 |
-
public function toCSS(){
|
47 |
-
return "alpha(opacity=" . (is_string($this->value) ? $this->value : $this->value->toCSS()) . ")";
|
48 |
}
|
49 |
|
50 |
-
|
51 |
-
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Alpha extends Less_Tree {
|
10 |
public $value;
|
11 |
public $type = 'Alpha';
|
12 |
|
13 |
+
public function __construct( $val ) {
|
14 |
$this->value = $val;
|
15 |
}
|
16 |
|
17 |
+
// function accept( $visitor ){
|
18 |
// $this->value = $visitor->visit( $this->value );
|
19 |
//}
|
20 |
|
21 |
+
public function compile( $env ) {
|
22 |
+
if ( is_object( $this->value ) ) {
|
23 |
+
$this->value = $this->value->compile( $env );
|
|
|
24 |
}
|
25 |
|
26 |
return $this;
|
27 |
}
|
28 |
|
29 |
+
/**
|
30 |
+
* @see Less_Tree::genCSS
|
31 |
+
*/
|
32 |
+
public function genCSS( $output ) {
|
|
|
33 |
$output->add( "alpha(opacity=" );
|
34 |
|
35 |
+
if ( is_string( $this->value ) ) {
|
36 |
$output->add( $this->value );
|
37 |
+
} else {
|
38 |
+
$this->value->genCSS( $output );
|
39 |
}
|
40 |
|
41 |
$output->add( ')' );
|
42 |
}
|
43 |
|
44 |
+
public function toCSS() {
|
45 |
+
return "alpha(opacity=" . ( is_string( $this->value ) ? $this->value : $this->value->toCSS() ) . ")";
|
46 |
}
|
47 |
|
48 |
+
}
|
|
base/inc/lib/Less/Tree/Anonymous.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Anonymous extends Less_Tree{
|
10 |
public $value;
|
11 |
public $quote;
|
12 |
public $index;
|
@@ -18,40 +18,40 @@ class Less_Tree_Anonymous extends Less_Tree{
|
|
18 |
* @param integer $index
|
19 |
* @param boolean $mapLines
|
20 |
*/
|
21 |
-
public function __construct($value, $index = null, $currentFileInfo = null, $mapLines = null ){
|
22 |
$this->value = $value;
|
23 |
$this->index = $index;
|
24 |
$this->mapLines = $mapLines;
|
25 |
$this->currentFileInfo = $currentFileInfo;
|
26 |
}
|
27 |
|
28 |
-
public function compile(){
|
29 |
-
return new Less_Tree_Anonymous($this->value, $this->index, $this->currentFileInfo, $this->mapLines);
|
30 |
}
|
31 |
|
32 |
-
|
33 |
-
if( !is_object($x) ){
|
34 |
return -1;
|
35 |
}
|
36 |
|
37 |
$left = $this->toCSS();
|
38 |
$right = $x->toCSS();
|
39 |
|
40 |
-
if( $left === $right ){
|
41 |
return 0;
|
42 |
}
|
43 |
|
44 |
return $left < $right ? -1 : 1;
|
45 |
}
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
public function genCSS( $output ){
|
51 |
$output->add( $this->value, $this->currentFileInfo, $this->index, $this->mapLines );
|
52 |
}
|
53 |
|
54 |
-
public function toCSS(){
|
55 |
return $this->value;
|
56 |
}
|
57 |
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Anonymous extends Less_Tree {
|
10 |
public $value;
|
11 |
public $quote;
|
12 |
public $index;
|
18 |
* @param integer $index
|
19 |
* @param boolean $mapLines
|
20 |
*/
|
21 |
+
public function __construct( $value, $index = null, $currentFileInfo = null, $mapLines = null ) {
|
22 |
$this->value = $value;
|
23 |
$this->index = $index;
|
24 |
$this->mapLines = $mapLines;
|
25 |
$this->currentFileInfo = $currentFileInfo;
|
26 |
}
|
27 |
|
28 |
+
public function compile() {
|
29 |
+
return new Less_Tree_Anonymous( $this->value, $this->index, $this->currentFileInfo, $this->mapLines );
|
30 |
}
|
31 |
|
32 |
+
public function compare( $x ) {
|
33 |
+
if ( !is_object( $x ) ) {
|
34 |
return -1;
|
35 |
}
|
36 |
|
37 |
$left = $this->toCSS();
|
38 |
$right = $x->toCSS();
|
39 |
|
40 |
+
if ( $left === $right ) {
|
41 |
return 0;
|
42 |
}
|
43 |
|
44 |
return $left < $right ? -1 : 1;
|
45 |
}
|
46 |
|
47 |
+
/**
|
48 |
+
* @see Less_Tree::genCSS
|
49 |
+
*/
|
50 |
+
public function genCSS( $output ) {
|
51 |
$output->add( $this->value, $this->currentFileInfo, $this->index, $this->mapLines );
|
52 |
}
|
53 |
|
54 |
+
public function toCSS() {
|
55 |
return $this->value;
|
56 |
}
|
57 |
|
base/inc/lib/Less/Tree/Assignment.php
CHANGED
@@ -6,34 +6,34 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Assignment extends Less_Tree{
|
10 |
|
11 |
public $key;
|
12 |
public $value;
|
13 |
public $type = 'Assignment';
|
14 |
|
15 |
-
|
16 |
$this->key = $key;
|
17 |
$this->value = $val;
|
18 |
}
|
19 |
|
20 |
-
|
21 |
$this->value = $visitor->visitObj( $this->value );
|
22 |
}
|
23 |
|
24 |
-
public function compile($env) {
|
25 |
-
return new Less_Tree_Assignment( $this->key, $this->value->compile($env));
|
26 |
}
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
public function genCSS( $output ){
|
32 |
$output->add( $this->key . '=' );
|
33 |
$this->value->genCSS( $output );
|
34 |
}
|
35 |
|
36 |
-
public function toCss(){
|
37 |
return $this->key . '=' . $this->value->toCSS();
|
38 |
}
|
39 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Assignment extends Less_Tree {
|
10 |
|
11 |
public $key;
|
12 |
public $value;
|
13 |
public $type = 'Assignment';
|
14 |
|
15 |
+
public function __construct( $key, $val ) {
|
16 |
$this->key = $key;
|
17 |
$this->value = $val;
|
18 |
}
|
19 |
|
20 |
+
public function accept( $visitor ) {
|
21 |
$this->value = $visitor->visitObj( $this->value );
|
22 |
}
|
23 |
|
24 |
+
public function compile( $env ) {
|
25 |
+
return new Less_Tree_Assignment( $this->key, $this->value->compile( $env ) );
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* @see Less_Tree::genCSS
|
30 |
+
*/
|
31 |
+
public function genCSS( $output ) {
|
32 |
$output->add( $this->key . '=' );
|
33 |
$this->value->genCSS( $output );
|
34 |
}
|
35 |
|
36 |
+
public function toCss() {
|
37 |
return $this->key . '=' . $this->value->toCSS();
|
38 |
}
|
39 |
}
|
base/inc/lib/Less/Tree/Attribute.php
CHANGED
@@ -6,49 +6,48 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Attribute extends Less_Tree{
|
10 |
|
11 |
public $key;
|
12 |
public $op;
|
13 |
public $value;
|
14 |
public $type = 'Attribute';
|
15 |
|
16 |
-
|
17 |
$this->key = $key;
|
18 |
$this->op = $op;
|
19 |
$this->value = $value;
|
20 |
}
|
21 |
|
22 |
-
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
$val_obj = is_object($this->value);
|
26 |
-
|
27 |
-
if( !$key_obj && !$val_obj ){
|
28 |
return $this;
|
29 |
}
|
30 |
|
31 |
return new Less_Tree_Attribute(
|
32 |
-
$key_obj ? $this->key->compile($env) : $this->key
|
33 |
$this->op,
|
34 |
-
$val_obj ? $this->value->compile($env) : $this->value);
|
35 |
}
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
$output->add( $this->toCSS() );
|
42 |
}
|
43 |
|
44 |
-
|
45 |
$value = $this->key;
|
46 |
|
47 |
-
if( $this->op ){
|
48 |
$value .= $this->op;
|
49 |
-
$value .= (is_object($this->value) ? $this->value->toCSS() : $this->value);
|
50 |
}
|
51 |
|
52 |
return '[' . $value . ']';
|
53 |
}
|
54 |
-
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Attribute extends Less_Tree {
|
10 |
|
11 |
public $key;
|
12 |
public $op;
|
13 |
public $value;
|
14 |
public $type = 'Attribute';
|
15 |
|
16 |
+
public function __construct( $key, $op, $value ) {
|
17 |
$this->key = $key;
|
18 |
$this->op = $op;
|
19 |
$this->value = $value;
|
20 |
}
|
21 |
|
22 |
+
public function compile( $env ) {
|
23 |
+
$key_obj = is_object( $this->key );
|
24 |
+
$val_obj = is_object( $this->value );
|
25 |
|
26 |
+
if ( !$key_obj && !$val_obj ) {
|
|
|
|
|
|
|
27 |
return $this;
|
28 |
}
|
29 |
|
30 |
return new Less_Tree_Attribute(
|
31 |
+
$key_obj ? $this->key->compile( $env ) : $this->key,
|
32 |
$this->op,
|
33 |
+
$val_obj ? $this->value->compile( $env ) : $this->value );
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* @see Less_Tree::genCSS
|
38 |
+
*/
|
39 |
+
public function genCSS( $output ) {
|
40 |
$output->add( $this->toCSS() );
|
41 |
}
|
42 |
|
43 |
+
public function toCSS() {
|
44 |
$value = $this->key;
|
45 |
|
46 |
+
if ( $this->op ) {
|
47 |
$value .= $this->op;
|
48 |
+
$value .= ( is_object( $this->value ) ? $this->value->toCSS() : $this->value );
|
49 |
}
|
50 |
|
51 |
return '[' . $value . ']';
|
52 |
}
|
53 |
+
}
|
base/inc/lib/Less/Tree/Call.php
CHANGED
@@ -1,52 +1,51 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
/**
|
5 |
* Call
|
6 |
*
|
7 |
* @package Less
|
8 |
* @subpackage tree
|
9 |
*/
|
10 |
-
class Less_Tree_Call extends Less_Tree{
|
11 |
-
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
|
19 |
-
public function __construct($name, $args, $index, $currentFileInfo = null ){
|
20 |
$this->name = $name;
|
21 |
$this->args = $args;
|
22 |
$this->index = $index;
|
23 |
$this->currentFileInfo = $currentFileInfo;
|
24 |
}
|
25 |
|
26 |
-
|
27 |
$this->args = $visitor->visitArray( $this->args );
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
$args = array();
|
44 |
-
foreach($this->args as $a){
|
45 |
-
$args[] = $a->compile($env);
|
46 |
}
|
47 |
|
48 |
-
$nameLC = strtolower($this->name);
|
49 |
-
switch($nameLC){
|
50 |
case '%':
|
51 |
$nameLC = '_percent';
|
52 |
break;
|
@@ -65,47 +64,45 @@ class Less_Tree_Call extends Less_Tree{
|
|
65 |
}
|
66 |
|
67 |
$result = null;
|
68 |
-
if( $nameLC === 'default' ){
|
69 |
$result = Less_Tree_DefaultFunc::compile();
|
70 |
|
71 |
-
}else{
|
72 |
|
73 |
-
if( method_exists('Less_Functions'
|
74 |
try {
|
75 |
|
76 |
-
$func = new Less_Functions($env, $this->currentFileInfo);
|
77 |
-
$result = call_user_func_array( array($func,$nameLC)
|
78 |
|
79 |
-
} catch (Exception $e) {
|
80 |
-
throw new Less_Exception_Compiler('error evaluating function `' . $this->name . '` '.$e->getMessage().' index: '. $this->index);
|
81 |
}
|
82 |
-
} elseif( isset( $env->functions[$nameLC] ) && is_callable( $env->functions[$nameLC] ) ) {
|
83 |
try {
|
84 |
$result = call_user_func_array( $env->functions[$nameLC], $args );
|
85 |
-
} catch (Exception $e) {
|
86 |
-
throw new Less_Exception_Compiler('error evaluating function `' . $this->name . '` '.$e->getMessage().' index: '. $this->index);
|
87 |
}
|
88 |
}
|
89 |
}
|
90 |
|
91 |
-
if( $result !== null ){
|
92 |
return $result;
|
93 |
}
|
94 |
|
95 |
-
|
96 |
return new Less_Tree_Call( $this->name, $args, $this->index, $this->currentFileInfo );
|
97 |
-
|
98 |
-
|
99 |
-
/**
|
100 |
-
* @see Less_Tree::genCSS
|
101 |
-
*/
|
102 |
-
public function genCSS( $output ){
|
103 |
|
|
|
|
|
|
|
|
|
104 |
$output->add( $this->name . '(', $this->currentFileInfo, $this->index );
|
105 |
-
$args_len = count($this->args);
|
106 |
-
for($i = 0; $i < $args_len; $i++ ){
|
107 |
$this->args[$i]->genCSS( $output );
|
108 |
-
if( $i + 1 < $args_len ){
|
109 |
$output->add( ', ' );
|
110 |
}
|
111 |
}
|
@@ -113,9 +110,8 @@ class Less_Tree_Call extends Less_Tree{
|
|
113 |
$output->add( ')' );
|
114 |
}
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
//}
|
120 |
|
121 |
}
|
1 |
<?php
|
2 |
|
|
|
3 |
/**
|
4 |
* Call
|
5 |
*
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Call extends Less_Tree {
|
10 |
+
public $value;
|
11 |
|
12 |
+
public $name;
|
13 |
+
public $args;
|
14 |
+
public $index;
|
15 |
+
public $currentFileInfo;
|
16 |
+
public $type = 'Call';
|
17 |
|
18 |
+
public function __construct( $name, $args, $index, $currentFileInfo = null ) {
|
19 |
$this->name = $name;
|
20 |
$this->args = $args;
|
21 |
$this->index = $index;
|
22 |
$this->currentFileInfo = $currentFileInfo;
|
23 |
}
|
24 |
|
25 |
+
public function accept( $visitor ) {
|
26 |
$this->args = $visitor->visitArray( $this->args );
|
27 |
}
|
28 |
|
29 |
+
//
|
30 |
+
// When evaluating a function call,
|
31 |
+
// we either find the function in `tree.functions` [1],
|
32 |
+
// in which case we call it, passing the evaluated arguments,
|
33 |
+
// or we simply print it out as it appeared originally [2].
|
34 |
+
//
|
35 |
+
// The *functions.js* file contains the built-in functions.
|
36 |
+
//
|
37 |
+
// The reason why we evaluate the arguments, is in the case where
|
38 |
+
// we try to pass a variable to a function, like: `saturate(@color)`.
|
39 |
+
// The function should receive the value, not the variable.
|
40 |
+
//
|
41 |
+
public function compile( $env = null ) {
|
42 |
$args = array();
|
43 |
+
foreach ( $this->args as $a ) {
|
44 |
+
$args[] = $a->compile( $env );
|
45 |
}
|
46 |
|
47 |
+
$nameLC = strtolower( $this->name );
|
48 |
+
switch ( $nameLC ) {
|
49 |
case '%':
|
50 |
$nameLC = '_percent';
|
51 |
break;
|
64 |
}
|
65 |
|
66 |
$result = null;
|
67 |
+
if ( $nameLC === 'default' ) {
|
68 |
$result = Less_Tree_DefaultFunc::compile();
|
69 |
|
70 |
+
} else {
|
71 |
|
72 |
+
if ( method_exists( 'Less_Functions', $nameLC ) ) { // 1.
|
73 |
try {
|
74 |
|
75 |
+
$func = new Less_Functions( $env, $this->currentFileInfo );
|
76 |
+
$result = call_user_func_array( array( $func,$nameLC ), $args );
|
77 |
|
78 |
+
} catch ( Exception $e ) {
|
79 |
+
throw new Less_Exception_Compiler( 'error evaluating function `' . $this->name . '` '.$e->getMessage().' index: '. $this->index );
|
80 |
}
|
81 |
+
} elseif ( isset( $env->functions[$nameLC] ) && is_callable( $env->functions[$nameLC] ) ) {
|
82 |
try {
|
83 |
$result = call_user_func_array( $env->functions[$nameLC], $args );
|
84 |
+
} catch ( Exception $e ) {
|
85 |
+
throw new Less_Exception_Compiler( 'error evaluating function `' . $this->name . '` '.$e->getMessage().' index: '. $this->index );
|
86 |
}
|
87 |
}
|
88 |
}
|
89 |
|
90 |
+
if ( $result !== null ) {
|
91 |
return $result;
|
92 |
}
|
93 |
|
|
|
94 |
return new Less_Tree_Call( $this->name, $args, $this->index, $this->currentFileInfo );
|
95 |
+
}
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
+
/**
|
98 |
+
* @see Less_Tree::genCSS
|
99 |
+
*/
|
100 |
+
public function genCSS( $output ) {
|
101 |
$output->add( $this->name . '(', $this->currentFileInfo, $this->index );
|
102 |
+
$args_len = count( $this->args );
|
103 |
+
for ( $i = 0; $i < $args_len; $i++ ) {
|
104 |
$this->args[$i]->genCSS( $output );
|
105 |
+
if ( $i + 1 < $args_len ) {
|
106 |
$output->add( ', ' );
|
107 |
}
|
108 |
}
|
110 |
$output->add( ')' );
|
111 |
}
|
112 |
|
113 |
+
// public function toCSS(){
|
114 |
+
// return $this->compile()->toCSS();
|
115 |
+
//}
|
|
|
116 |
|
117 |
}
|
base/inc/lib/Less/Tree/Color.php
CHANGED
@@ -6,15 +6,14 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Color extends Less_Tree{
|
10 |
public $rgb;
|
11 |
public $alpha;
|
12 |
public $isTransparentKeyword;
|
13 |
public $type = 'Color';
|
14 |
|
15 |
-
public function __construct($rgb, $a = 1, $isTransparentKeyword = null ){
|
16 |
-
|
17 |
-
if( $isTransparentKeyword ){
|
18 |
$this->rgb = $rgb;
|
19 |
$this->alpha = $a;
|
20 |
$this->isTransparentKeyword = true;
|
@@ -22,32 +21,32 @@ class Less_Tree_Color extends Less_Tree{
|
|
22 |
}
|
23 |
|
24 |
$this->rgb = array();
|
25 |
-
if( is_array($rgb) ){
|
26 |
$this->rgb = $rgb;
|
27 |
-
}else if( strlen($rgb) == 6 ){
|
28 |
-
foreach(str_split($rgb, 2) as $c){
|
29 |
-
$this->rgb[] = hexdec($c);
|
30 |
}
|
31 |
-
}else{
|
32 |
-
foreach(str_split($rgb, 1) as $c){
|
33 |
-
$this->rgb[] = hexdec($c.$c);
|
34 |
}
|
35 |
}
|
36 |
-
$this->alpha = is_numeric($a) ? $a : 1;
|
37 |
}
|
38 |
|
39 |
-
public function compile(){
|
40 |
return $this;
|
41 |
}
|
42 |
|
43 |
-
public function luma(){
|
44 |
$r = $this->rgb[0] / 255;
|
45 |
$g = $this->rgb[1] / 255;
|
46 |
$b = $this->rgb[2] / 255;
|
47 |
|
48 |
-
$r = ($r <= 0.03928) ? $r / 12.92 : pow((($r + 0.055) / 1.055), 2.4);
|
49 |
-
$g = ($g <= 0.03928) ? $g / 12.92 : pow((($g + 0.055) / 1.055), 2.4);
|
50 |
-
$b = ($b <= 0.03928) ? $b / 12.92 : pow((($b + 0.055) / 1.055), 2.4);
|
51 |
|
52 |
return 0.2126 * $r + 0.7152 * $g + 0.0722 * $b;
|
53 |
}
|
@@ -55,42 +54,41 @@ class Less_Tree_Color extends Less_Tree{
|
|
55 |
/**
|
56 |
* @see Less_Tree::genCSS
|
57 |
*/
|
58 |
-
public function genCSS( $output ){
|
59 |
$output->add( $this->toCSS() );
|
60 |
}
|
61 |
|
62 |
-
public function toCSS( $doNotCompress = false ){
|
63 |
$compress = Less_Parser::$options['compress'] && !$doNotCompress;
|
64 |
$alpha = Less_Functions::fround( $this->alpha );
|
65 |
|
66 |
-
|
67 |
//
|
68 |
// If we have some transparency, the only way to represent it
|
69 |
// is via `rgba`. Otherwise, we use the hex representation,
|
70 |
// which has better compatibility with older browsers.
|
71 |
// Values are capped between `0` and `255`, rounded and zero-padded.
|
72 |
//
|
73 |
-
if( $alpha < 1 ){
|
74 |
-
if( ( $alpha === 0 || $alpha === 0.0 ) && isset($this->isTransparentKeyword) && $this->isTransparentKeyword ){
|
75 |
return 'transparent';
|
76 |
}
|
77 |
|
78 |
$values = array();
|
79 |
-
foreach($this->rgb as $c){
|
80 |
-
$values[] = Less_Functions::clamp( round($c), 255);
|
81 |
}
|
82 |
$values[] = $alpha;
|
83 |
|
84 |
-
$glue = ($compress ? ',' : ', ');
|
85 |
-
return "rgba(" . implode($glue, $values) . ")";
|
86 |
-
}else{
|
87 |
|
88 |
$color = $this->toRGB();
|
89 |
|
90 |
-
if( $compress ){
|
91 |
|
92 |
// Convert color to short format
|
93 |
-
if( $color[1] === $color[2] && $color[3] === $color[4] && $color[5] === $color[6]) {
|
94 |
$color = '#'.$color[1] . $color[3] . $color[5];
|
95 |
}
|
96 |
}
|
@@ -109,121 +107,123 @@ class Less_Tree_Color extends Less_Tree{
|
|
109 |
/**
|
110 |
* @param string $op
|
111 |
*/
|
112 |
-
public function operate( $op, $other) {
|
113 |
$rgb = array();
|
114 |
-
$alpha = $this->alpha * (1 - $other->alpha) + $other->alpha;
|
115 |
-
for ($c = 0; $c < 3; $c++) {
|
116 |
-
$rgb[$c] = Less_Functions::operate( $op, $this->rgb[$c], $other->rgb[$c]);
|
117 |
}
|
118 |
-
return new Less_Tree_Color($rgb, $alpha);
|
119 |
}
|
120 |
|
121 |
-
public function toRGB(){
|
122 |
-
return $this->toHex($this->rgb);
|
123 |
}
|
124 |
|
125 |
-
public function toHSL(){
|
126 |
$r = $this->rgb[0] / 255;
|
127 |
$g = $this->rgb[1] / 255;
|
128 |
$b = $this->rgb[2] / 255;
|
129 |
$a = $this->alpha;
|
130 |
|
131 |
-
$max = max($r, $g, $b);
|
132 |
-
$min = min($r, $g, $b);
|
133 |
-
$l = ($max + $min) / 2;
|
134 |
$d = $max - $min;
|
135 |
|
136 |
$h = $s = 0;
|
137 |
-
if( $max !== $min ){
|
138 |
-
$s = $l > 0.5 ? $d / (2 - $max - $min) : $d / ($max + $min);
|
139 |
-
|
140 |
-
switch ($max) {
|
141 |
-
case $r: $h = ($g - $b) / $d + ($g < $b ? 6 : 0);
|
142 |
-
|
143 |
-
case $
|
|
|
|
|
|
|
144 |
}
|
145 |
$h /= 6;
|
146 |
}
|
147 |
-
return array('h' => $h * 360, 's' => $s, 'l' => $l, 'a' => $a );
|
148 |
}
|
149 |
|
150 |
-
//Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
|
151 |
-
|
152 |
$r = $this->rgb[0] / 255;
|
153 |
$g = $this->rgb[1] / 255;
|
154 |
$b = $this->rgb[2] / 255;
|
155 |
$a = $this->alpha;
|
156 |
|
157 |
-
$max = max($r, $g, $b);
|
158 |
-
$min = min($r, $g, $b);
|
159 |
|
160 |
$v = $max;
|
161 |
|
162 |
$d = $max - $min;
|
163 |
-
if ($max === 0) {
|
164 |
$s = 0;
|
165 |
} else {
|
166 |
$s = $d / $max;
|
167 |
}
|
168 |
|
169 |
$h = 0;
|
170 |
-
if( $max !== $min ){
|
171 |
-
switch($max){
|
172 |
-
case $r: $h = ($g - $b) / $d + ($g < $b ? 6 : 0);
|
173 |
-
|
174 |
-
case $
|
|
|
|
|
|
|
175 |
}
|
176 |
$h /= 6;
|
177 |
}
|
178 |
-
return array('h'=> $h * 360, 's'=> $s, 'v'=> $v, 'a' => $a );
|
179 |
}
|
180 |
|
181 |
-
public function toARGB(){
|
182 |
-
$argb = array_merge( (array)
|
183 |
return $this->toHex( $argb );
|
184 |
}
|
185 |
|
186 |
-
public function compare($x){
|
187 |
-
|
188 |
-
if( !property_exists( $x, 'rgb' ) ){
|
189 |
return -1;
|
190 |
}
|
191 |
|
192 |
-
|
193 |
-
return ($x->rgb[0] === $this->rgb[0] &&
|
194 |
$x->rgb[1] === $this->rgb[1] &&
|
195 |
$x->rgb[2] === $this->rgb[2] &&
|
196 |
-
$x->alpha === $this->alpha) ? 0 : -1;
|
197 |
}
|
198 |
|
199 |
-
|
200 |
-
|
201 |
$ret = '#';
|
202 |
-
foreach($v as $c){
|
203 |
-
$c = Less_Functions::clamp( Less_Parser::round($c), 255);
|
204 |
-
if( $c < 16 ){
|
205 |
$ret .= '0';
|
206 |
}
|
207 |
-
$ret .= dechex($c);
|
208 |
}
|
209 |
|
210 |
return $ret;
|
211 |
}
|
212 |
|
213 |
-
|
214 |
/**
|
215 |
* @param string $keyword
|
216 |
*/
|
217 |
-
public static function fromKeyword( $keyword ){
|
218 |
-
$keyword = strtolower($keyword);
|
219 |
|
220 |
-
if( Less_Colors::hasOwnProperty($keyword) ){
|
221 |
// detect named color
|
222 |
-
return new Less_Tree_Color(substr(Less_Colors::color($keyword), 1));
|
223 |
}
|
224 |
|
225 |
-
if( $keyword === 'transparent' ){
|
226 |
-
return new Less_Tree_Color( array(0, 0, 0), 0, true);
|
227 |
}
|
228 |
}
|
229 |
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Color extends Less_Tree {
|
10 |
public $rgb;
|
11 |
public $alpha;
|
12 |
public $isTransparentKeyword;
|
13 |
public $type = 'Color';
|
14 |
|
15 |
+
public function __construct( $rgb, $a = 1, $isTransparentKeyword = null ) {
|
16 |
+
if ( $isTransparentKeyword ) {
|
|
|
17 |
$this->rgb = $rgb;
|
18 |
$this->alpha = $a;
|
19 |
$this->isTransparentKeyword = true;
|
21 |
}
|
22 |
|
23 |
$this->rgb = array();
|
24 |
+
if ( is_array( $rgb ) ) {
|
25 |
$this->rgb = $rgb;
|
26 |
+
} else if ( strlen( $rgb ) == 6 ) {
|
27 |
+
foreach ( str_split( $rgb, 2 ) as $c ) {
|
28 |
+
$this->rgb[] = hexdec( $c );
|
29 |
}
|
30 |
+
} else {
|
31 |
+
foreach ( str_split( $rgb, 1 ) as $c ) {
|
32 |
+
$this->rgb[] = hexdec( $c.$c );
|
33 |
}
|
34 |
}
|
35 |
+
$this->alpha = is_numeric( $a ) ? $a : 1;
|
36 |
}
|
37 |
|
38 |
+
public function compile() {
|
39 |
return $this;
|
40 |
}
|
41 |
|
42 |
+
public function luma() {
|
43 |
$r = $this->rgb[0] / 255;
|
44 |
$g = $this->rgb[1] / 255;
|
45 |
$b = $this->rgb[2] / 255;
|
46 |
|
47 |
+
$r = ( $r <= 0.03928 ) ? $r / 12.92 : pow( ( ( $r + 0.055 ) / 1.055 ), 2.4 );
|
48 |
+
$g = ( $g <= 0.03928 ) ? $g / 12.92 : pow( ( ( $g + 0.055 ) / 1.055 ), 2.4 );
|
49 |
+
$b = ( $b <= 0.03928 ) ? $b / 12.92 : pow( ( ( $b + 0.055 ) / 1.055 ), 2.4 );
|
50 |
|
51 |
return 0.2126 * $r + 0.7152 * $g + 0.0722 * $b;
|
52 |
}
|
54 |
/**
|
55 |
* @see Less_Tree::genCSS
|
56 |
*/
|
57 |
+
public function genCSS( $output ) {
|
58 |
$output->add( $this->toCSS() );
|
59 |
}
|
60 |
|
61 |
+
public function toCSS( $doNotCompress = false ) {
|
62 |
$compress = Less_Parser::$options['compress'] && !$doNotCompress;
|
63 |
$alpha = Less_Functions::fround( $this->alpha );
|
64 |
|
|
|
65 |
//
|
66 |
// If we have some transparency, the only way to represent it
|
67 |
// is via `rgba`. Otherwise, we use the hex representation,
|
68 |
// which has better compatibility with older browsers.
|
69 |
// Values are capped between `0` and `255`, rounded and zero-padded.
|
70 |
//
|
71 |
+
if ( $alpha < 1 ) {
|
72 |
+
if ( ( $alpha === 0 || $alpha === 0.0 ) && isset( $this->isTransparentKeyword ) && $this->isTransparentKeyword ) {
|
73 |
return 'transparent';
|
74 |
}
|
75 |
|
76 |
$values = array();
|
77 |
+
foreach ( $this->rgb as $c ) {
|
78 |
+
$values[] = Less_Functions::clamp( round( $c ), 255 );
|
79 |
}
|
80 |
$values[] = $alpha;
|
81 |
|
82 |
+
$glue = ( $compress ? ',' : ', ' );
|
83 |
+
return "rgba(" . implode( $glue, $values ) . ")";
|
84 |
+
} else {
|
85 |
|
86 |
$color = $this->toRGB();
|
87 |
|
88 |
+
if ( $compress ) {
|
89 |
|
90 |
// Convert color to short format
|
91 |
+
if ( $color[1] === $color[2] && $color[3] === $color[4] && $color[5] === $color[6] ) {
|
92 |
$color = '#'.$color[1] . $color[3] . $color[5];
|
93 |
}
|
94 |
}
|
107 |
/**
|
108 |
* @param string $op
|
109 |
*/
|
110 |
+
public function operate( $op, $other ) {
|
111 |
$rgb = array();
|
112 |
+
$alpha = $this->alpha * ( 1 - $other->alpha ) + $other->alpha;
|
113 |
+
for ( $c = 0; $c < 3; $c++ ) {
|
114 |
+
$rgb[$c] = Less_Functions::operate( $op, $this->rgb[$c], $other->rgb[$c] );
|
115 |
}
|
116 |
+
return new Less_Tree_Color( $rgb, $alpha );
|
117 |
}
|
118 |
|
119 |
+
public function toRGB() {
|
120 |
+
return $this->toHex( $this->rgb );
|
121 |
}
|
122 |
|
123 |
+
public function toHSL() {
|
124 |
$r = $this->rgb[0] / 255;
|
125 |
$g = $this->rgb[1] / 255;
|
126 |
$b = $this->rgb[2] / 255;
|
127 |
$a = $this->alpha;
|
128 |
|
129 |
+
$max = max( $r, $g, $b );
|
130 |
+
$min = min( $r, $g, $b );
|
131 |
+
$l = ( $max + $min ) / 2;
|
132 |
$d = $max - $min;
|
133 |
|
134 |
$h = $s = 0;
|
135 |
+
if ( $max !== $min ) {
|
136 |
+
$s = $l > 0.5 ? $d / ( 2 - $max - $min ) : $d / ( $max + $min );
|
137 |
+
|
138 |
+
switch ( $max ) {
|
139 |
+
case $r: $h = ( $g - $b ) / $d + ( $g < $b ? 6 : 0 );
|
140 |
+
break;
|
141 |
+
case $g: $h = ( $b - $r ) / $d + 2;
|
142 |
+
break;
|
143 |
+
case $b: $h = ( $r - $g ) / $d + 4;
|
144 |
+
break;
|
145 |
}
|
146 |
$h /= 6;
|
147 |
}
|
148 |
+
return array( 'h' => $h * 360, 's' => $s, 'l' => $l, 'a' => $a );
|
149 |
}
|
150 |
|
151 |
+
// Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
|
152 |
+
public function toHSV() {
|
153 |
$r = $this->rgb[0] / 255;
|
154 |
$g = $this->rgb[1] / 255;
|
155 |
$b = $this->rgb[2] / 255;
|
156 |
$a = $this->alpha;
|
157 |
|
158 |
+
$max = max( $r, $g, $b );
|
159 |
+
$min = min( $r, $g, $b );
|
160 |
|
161 |
$v = $max;
|
162 |
|
163 |
$d = $max - $min;
|
164 |
+
if ( $max === 0 ) {
|
165 |
$s = 0;
|
166 |
} else {
|
167 |
$s = $d / $max;
|
168 |
}
|
169 |
|
170 |
$h = 0;
|
171 |
+
if ( $max !== $min ) {
|
172 |
+
switch ( $max ) {
|
173 |
+
case $r: $h = ( $g - $b ) / $d + ( $g < $b ? 6 : 0 );
|
174 |
+
break;
|
175 |
+
case $g: $h = ( $b - $r ) / $d + 2;
|
176 |
+
break;
|
177 |
+
case $b: $h = ( $r - $g ) / $d + 4;
|
178 |
+
break;
|
179 |
}
|
180 |
$h /= 6;
|
181 |
}
|
182 |
+
return array( 'h' => $h * 360, 's' => $s, 'v' => $v, 'a' => $a );
|
183 |
}
|
184 |
|
185 |
+
public function toARGB() {
|
186 |
+
$argb = array_merge( (array)Less_Parser::round( $this->alpha * 255 ), $this->rgb );
|
187 |
return $this->toHex( $argb );
|
188 |
}
|
189 |
|
190 |
+
public function compare( $x ) {
|
191 |
+
if ( !property_exists( $x, 'rgb' ) ) {
|
|
|
192 |
return -1;
|
193 |
}
|
194 |
|
195 |
+
return ( $x->rgb[0] === $this->rgb[0] &&
|
|
|
196 |
$x->rgb[1] === $this->rgb[1] &&
|
197 |
$x->rgb[2] === $this->rgb[2] &&
|
198 |
+
$x->alpha === $this->alpha ) ? 0 : -1;
|
199 |
}
|
200 |
|
201 |
+
public function toHex( $v ) {
|
|
|
202 |
$ret = '#';
|
203 |
+
foreach ( $v as $c ) {
|
204 |
+
$c = Less_Functions::clamp( Less_Parser::round( $c ), 255 );
|
205 |
+
if ( $c < 16 ) {
|
206 |
$ret .= '0';
|
207 |
}
|
208 |
+
$ret .= dechex( $c );
|
209 |
}
|
210 |
|
211 |
return $ret;
|
212 |
}
|
213 |
|
|
|
214 |
/**
|
215 |
* @param string $keyword
|
216 |
*/
|
217 |
+
public static function fromKeyword( $keyword ) {
|
218 |
+
$keyword = strtolower( $keyword );
|
219 |
|
220 |
+
if ( Less_Colors::hasOwnProperty( $keyword ) ) {
|
221 |
// detect named color
|
222 |
+
return new Less_Tree_Color( substr( Less_Colors::color( $keyword ), 1 ) );
|
223 |
}
|
224 |
|
225 |
+
if ( $keyword === 'transparent' ) {
|
226 |
+
return new Less_Tree_Color( array( 0, 0, 0 ), 0, true );
|
227 |
}
|
228 |
}
|
229 |
|
base/inc/lib/Less/Tree/Comment.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Comment extends Less_Tree{
|
10 |
|
11 |
public $value;
|
12 |
public $silent;
|
@@ -14,37 +14,37 @@ class Less_Tree_Comment extends Less_Tree{
|
|
14 |
public $currentFileInfo;
|
15 |
public $type = 'Comment';
|
16 |
|
17 |
-
public function __construct($value, $silent, $index = null, $currentFileInfo = null ){
|
18 |
$this->value = $value;
|
19 |
-
$this->silent =
|
20 |
$this->currentFileInfo = $currentFileInfo;
|
21 |
}
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
public function genCSS( $output ){
|
27 |
-
//if( $this->debugInfo ){
|
28 |
//$output->add( tree.debugInfo($env, $this), $this->currentFileInfo, $this->index);
|
29 |
//}
|
30 |
-
$output->add( trim($this->value) );//TODO shouldn't need to trim, we shouldn't grab the \n
|
31 |
}
|
32 |
|
33 |
-
public function toCSS(){
|
34 |
return Less_Parser::$options['compress'] ? '' : $this->value;
|
35 |
}
|
36 |
|
37 |
-
public function isSilent(){
|
38 |
-
$isReference = ($this->currentFileInfo && isset($this->currentFileInfo['reference']) && (!isset($this->isReferenced) || !$this->isReferenced) );
|
39 |
-
$isCompressed = Less_Parser::$options['compress'] && !preg_match('/^\/\*!/', $this->value);
|
40 |
return $this->silent || $isReference || $isCompressed;
|
41 |
}
|
42 |
|
43 |
-
public function compile(){
|
44 |
return $this;
|
45 |
}
|
46 |
|
47 |
-
public function markReferenced(){
|
48 |
$this->isReferenced = true;
|
49 |
}
|
50 |
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Comment extends Less_Tree {
|
10 |
|
11 |
public $value;
|
12 |
public $silent;
|
14 |
public $currentFileInfo;
|
15 |
public $type = 'Comment';
|
16 |
|
17 |
+
public function __construct( $value, $silent, $index = null, $currentFileInfo = null ) {
|
18 |
$this->value = $value;
|
19 |
+
$this->silent = !!$silent;
|
20 |
$this->currentFileInfo = $currentFileInfo;
|
21 |
}
|
22 |
|
23 |
+
/**
|
24 |
+
* @see Less_Tree::genCSS
|
25 |
+
*/
|
26 |
+
public function genCSS( $output ) {
|
27 |
+
// if( $this->debugInfo ){
|
28 |
//$output->add( tree.debugInfo($env, $this), $this->currentFileInfo, $this->index);
|
29 |
//}
|
30 |
+
$output->add( trim( $this->value ) );// TODO shouldn't need to trim, we shouldn't grab the \n
|
31 |
}
|
32 |
|
33 |
+
public function toCSS() {
|
34 |
return Less_Parser::$options['compress'] ? '' : $this->value;
|
35 |
}
|
36 |
|
37 |
+
public function isSilent() {
|
38 |
+
$isReference = ( $this->currentFileInfo && isset( $this->currentFileInfo['reference'] ) && ( !isset( $this->isReferenced ) || !$this->isReferenced ) );
|
39 |
+
$isCompressed = Less_Parser::$options['compress'] && !preg_match( '/^\/\*!/', $this->value );
|
40 |
return $this->silent || $isReference || $isCompressed;
|
41 |
}
|
42 |
|
43 |
+
public function compile() {
|
44 |
return $this;
|
45 |
}
|
46 |
|
47 |
+
public function markReferenced() {
|
48 |
$this->isReferenced = true;
|
49 |
}
|
50 |
|
base/inc/lib/Less/Tree/Condition.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Condition extends Less_Tree{
|
10 |
|
11 |
public $op;
|
12 |
public $lvalue;
|
@@ -15,24 +15,24 @@ class Less_Tree_Condition extends Less_Tree{
|
|
15 |
public $negate;
|
16 |
public $type = 'Condition';
|
17 |
|
18 |
-
public function __construct($op, $l, $r, $i = 0, $negate = false) {
|
19 |
-
$this->op = trim($op);
|
20 |
$this->lvalue = $l;
|
21 |
$this->rvalue = $r;
|
22 |
$this->index = $i;
|
23 |
$this->negate = $negate;
|
24 |
}
|
25 |
|
26 |
-
public function accept($visitor){
|
27 |
$this->lvalue = $visitor->visitObj( $this->lvalue );
|
28 |
$this->rvalue = $visitor->visitObj( $this->rvalue );
|
29 |
}
|
30 |
|
31 |
-
|
32 |
-
$a = $this->lvalue->compile($env);
|
33 |
-
$b = $this->rvalue->compile($env);
|
34 |
|
35 |
-
switch( $this->op ){
|
36 |
case 'and':
|
37 |
$result = $a && $b;
|
38 |
break;
|
@@ -42,15 +42,15 @@ class Less_Tree_Condition extends Less_Tree{
|
|
42 |
break;
|
43 |
|
44 |
default:
|
45 |
-
if( Less_Parser::is_method($a, 'compare') ){
|
46 |
-
$result = $a->compare($b);
|
47 |
-
}elseif( Less_Parser::is_method($b, 'compare') ){
|
48 |
-
$result = $b->compare($a);
|
49 |
-
}else{
|
50 |
-
throw new Less_Exception_Compiler('Unable to perform comparison', null, $this->index);
|
51 |
}
|
52 |
|
53 |
-
switch ($result) {
|
54 |
case -1:
|
55 |
$result = $this->op === '<' || $this->op === '=<' || $this->op === '<=';
|
56 |
break;
|
@@ -67,6 +67,6 @@ class Less_Tree_Condition extends Less_Tree{
|
|
67 |
}
|
68 |
|
69 |
return $this->negate ? !$result : $result;
|
70 |
-
|
71 |
|
72 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Condition extends Less_Tree {
|
10 |
|
11 |
public $op;
|
12 |
public $lvalue;
|
15 |
public $negate;
|
16 |
public $type = 'Condition';
|
17 |
|
18 |
+
public function __construct( $op, $l, $r, $i = 0, $negate = false ) {
|
19 |
+
$this->op = trim( $op );
|
20 |
$this->lvalue = $l;
|
21 |
$this->rvalue = $r;
|
22 |
$this->index = $i;
|
23 |
$this->negate = $negate;
|
24 |
}
|
25 |
|
26 |
+
public function accept( $visitor ) {
|
27 |
$this->lvalue = $visitor->visitObj( $this->lvalue );
|
28 |
$this->rvalue = $visitor->visitObj( $this->rvalue );
|
29 |
}
|
30 |
|
31 |
+
public function compile( $env ) {
|
32 |
+
$a = $this->lvalue->compile( $env );
|
33 |
+
$b = $this->rvalue->compile( $env );
|
34 |
|
35 |
+
switch ( $this->op ) {
|
36 |
case 'and':
|
37 |
$result = $a && $b;
|
38 |
break;
|
42 |
break;
|
43 |
|
44 |
default:
|
45 |
+
if ( Less_Parser::is_method( $a, 'compare' ) ) {
|
46 |
+
$result = $a->compare( $b );
|
47 |
+
} elseif ( Less_Parser::is_method( $b, 'compare' ) ) {
|
48 |
+
$result = $b->compare( $a );
|
49 |
+
} else {
|
50 |
+
throw new Less_Exception_Compiler( 'Unable to perform comparison', null, $this->index );
|
51 |
}
|
52 |
|
53 |
+
switch ( $result ) {
|
54 |
case -1:
|
55 |
$result = $this->op === '<' || $this->op === '=<' || $this->op === '<=';
|
56 |
break;
|
67 |
}
|
68 |
|
69 |
return $this->negate ? !$result : $result;
|
70 |
+
}
|
71 |
|
72 |
}
|
base/inc/lib/Less/Tree/DefaultFunc.php
CHANGED
@@ -6,29 +6,29 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_DefaultFunc{
|
10 |
|
11 |
static $error_;
|
12 |
static $value_;
|
13 |
|
14 |
-
|
15 |
-
if( self::$error_ ){
|
16 |
-
throw new Exception(self::$error_);
|
17 |
}
|
18 |
-
if( self::$value_ !== null ){
|
19 |
-
return self::$value_ ? new Less_Tree_Keyword('true') : new Less_Tree_Keyword('false');
|
20 |
}
|
21 |
}
|
22 |
|
23 |
-
|
24 |
self::$value_ = $v;
|
25 |
}
|
26 |
|
27 |
-
|
28 |
self::$error_ = $e;
|
29 |
}
|
30 |
|
31 |
-
|
32 |
self::$value_ = self::$error_ = null;
|
33 |
}
|
34 |
-
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_DefaultFunc {
|
10 |
|
11 |
static $error_;
|
12 |
static $value_;
|
13 |
|
14 |
+
public static function compile() {
|
15 |
+
if ( self::$error_ ) {
|
16 |
+
throw new Exception( self::$error_ );
|
17 |
}
|
18 |
+
if ( self::$value_ !== null ) {
|
19 |
+
return self::$value_ ? new Less_Tree_Keyword( 'true' ) : new Less_Tree_Keyword( 'false' );
|
20 |
}
|
21 |
}
|
22 |
|
23 |
+
public static function value( $v ) {
|
24 |
self::$value_ = $v;
|
25 |
}
|
26 |
|
27 |
+
public static function error( $e ) {
|
28 |
self::$error_ = $e;
|
29 |
}
|
30 |
|
31 |
+
public static function reset() {
|
32 |
self::$value_ = self::$error_ = null;
|
33 |
}
|
34 |
+
}
|
base/inc/lib/Less/Tree/DetachedRuleset.php
CHANGED
@@ -6,35 +6,34 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_DetachedRuleset extends Less_Tree{
|
10 |
|
11 |
public $ruleset;
|
12 |
public $frames;
|
13 |
public $type = 'DetachedRuleset';
|
14 |
|
15 |
-
|
16 |
$this->ruleset = $ruleset;
|
17 |
$this->frames = $frames;
|
18 |
}
|
19 |
|
20 |
-
|
21 |
-
$this->ruleset = $visitor->visitObj($this->ruleset);
|
22 |
}
|
23 |
|
24 |
-
|
25 |
-
if( $this->frames ){
|
26 |
$frames = $this->frames;
|
27 |
-
}else{
|
28 |
$frames = $env->frames;
|
29 |
}
|
30 |
-
return new Less_Tree_DetachedRuleset($this->ruleset, $frames);
|
31 |
}
|
32 |
|
33 |
-
|
34 |
-
if( $this->frames ){
|
35 |
-
return $this->ruleset->compile( $env->copyEvalEnv( array_merge($this->frames
|
36 |
}
|
37 |
return $this->ruleset->compile( $env );
|
38 |
}
|
39 |
}
|
40 |
-
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_DetachedRuleset extends Less_Tree {
|
10 |
|
11 |
public $ruleset;
|
12 |
public $frames;
|
13 |
public $type = 'DetachedRuleset';
|
14 |
|
15 |
+
public function __construct( $ruleset, $frames = null ) {
|
16 |
$this->ruleset = $ruleset;
|
17 |
$this->frames = $frames;
|
18 |
}
|
19 |
|
20 |
+
public function accept( $visitor ) {
|
21 |
+
$this->ruleset = $visitor->visitObj( $this->ruleset );
|
22 |
}
|
23 |
|
24 |
+
public function compile( $env ) {
|
25 |
+
if ( $this->frames ) {
|
26 |
$frames = $this->frames;
|
27 |
+
} else {
|
28 |
$frames = $env->frames;
|
29 |
}
|
30 |
+
return new Less_Tree_DetachedRuleset( $this->ruleset, $frames );
|
31 |
}
|
32 |
|
33 |
+
public function callEval( $env ) {
|
34 |
+
if ( $this->frames ) {
|
35 |
+
return $this->ruleset->compile( $env->copyEvalEnv( array_merge( $this->frames, $env->frames ) ) );
|
36 |
}
|
37 |
return $this->ruleset->compile( $env );
|
38 |
}
|
39 |
}
|
|
base/inc/lib/Less/Tree/Dimension.php
CHANGED
@@ -6,64 +6,63 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Dimension extends Less_Tree{
|
10 |
|
11 |
public $value;
|
12 |
public $unit;
|
13 |
public $type = 'Dimension';
|
14 |
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
if( $unit && ($unit instanceof Less_Tree_Unit) ){
|
19 |
$this->unit = $unit;
|
20 |
-
}elseif( $unit ){
|
21 |
-
$this->unit = new Less_Tree_Unit( array($unit) );
|
22 |
-
}else{
|
23 |
-
$this->unit = new Less_Tree_Unit(
|
24 |
}
|
25 |
-
|
26 |
|
27 |
-
|
28 |
$this->unit = $visitor->visitObj( $this->unit );
|
29 |
}
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
public function toColor() {
|
36 |
-
return new Less_Tree_Color(array($this->value, $this->value, $this->value));
|
37 |
-
}
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
public function genCSS( $output ){
|
43 |
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
$value = Less_Functions::fround( $this->value );
|
49 |
$strValue = (string)$value;
|
50 |
|
51 |
-
if( $value !== 0 && $value < 0.000001 && $value > -0.000001 ){
|
52 |
// would be output 1e-6 etc.
|
53 |
-
$strValue = number_format($strValue,10);
|
54 |
-
$strValue = preg_replace('/\.?0+$/','', $strValue);
|
55 |
}
|
56 |
|
57 |
-
if( Less_Parser::$options['compress'] ){
|
58 |
// Zero values doesn't need a unit
|
59 |
-
if( $value === 0 && $this->unit->isLength() ){
|
60 |
$output->add( $strValue );
|
61 |
return $strValue;
|
62 |
}
|
63 |
|
64 |
// Float values doesn't need a leading zero
|
65 |
-
if( $value > 0 && $value < 1 && $strValue[0] === '0' ){
|
66 |
-
$strValue = substr($strValue,1);
|
67 |
}
|
68 |
}
|
69 |
|
@@ -71,73 +70,72 @@ class Less_Tree_Dimension extends Less_Tree{
|
|
71 |
$this->unit->genCSS( $output );
|
72 |
}
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
// In an operation between two Dimensions,
|
79 |
-
// we default to the first Dimension's unit,
|
80 |
-
// so `1px + 2em` will yield `3px`.
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
public function operate( $op, $other){
|
86 |
|
87 |
-
|
|
|
|
|
|
|
|
|
88 |
$unit = clone $this->unit;
|
89 |
|
90 |
-
if( $op === '+' || $op === '-' ){
|
91 |
|
92 |
-
if( !$unit->numerator && !$unit->denominator ){
|
93 |
$unit->numerator = $other->unit->numerator;
|
94 |
$unit->denominator = $other->unit->denominator;
|
95 |
-
}elseif( !$other->unit->numerator && !$other->unit->denominator ){
|
96 |
// do nothing
|
97 |
-
}else{
|
98 |
-
$other = $other->convertTo( $this->unit->usedUnits());
|
99 |
|
100 |
-
if( Less_Parser::$options['strictUnits'] && $other->unit->toString() !== $unit->toCSS() ){
|
101 |
-
throw new Less_Exception_Compiler("Incompatible units. Change the units or use the unit function. Bad units: '" . $unit->toString() . "' and " . $other->unit->toString() . "'.");
|
102 |
}
|
103 |
|
104 |
-
$value = Less_Functions::operate( $op, $this->value, $other->value);
|
105 |
}
|
106 |
-
}elseif( $op === '*' ){
|
107 |
-
$unit->numerator = array_merge($unit->numerator, $other->unit->numerator);
|
108 |
-
$unit->denominator = array_merge($unit->denominator, $other->unit->denominator);
|
109 |
-
sort($unit->numerator);
|
110 |
-
sort($unit->denominator);
|
111 |
$unit->cancel();
|
112 |
-
}elseif( $op === '/' ){
|
113 |
-
$unit->numerator = array_merge($unit->numerator, $other->unit->denominator);
|
114 |
-
$unit->denominator = array_merge($unit->denominator, $other->unit->numerator);
|
115 |
-
sort($unit->numerator);
|
116 |
-
sort($unit->denominator);
|
117 |
$unit->cancel();
|
118 |
}
|
119 |
-
return new Less_Tree_Dimension( $value, $unit);
|
120 |
-
|
121 |
|
122 |
-
public function compare($other) {
|
123 |
-
if ($other instanceof Less_Tree_Dimension) {
|
124 |
|
125 |
-
if( $this->unit->isEmpty() || $other->unit->isEmpty() ){
|
126 |
$a = $this;
|
127 |
$b = $other;
|
128 |
} else {
|
129 |
$a = $this->unify();
|
130 |
$b = $other->unify();
|
131 |
-
if( $a->unit->compare($b->unit) !== 0 ){
|
132 |
return -1;
|
133 |
}
|
134 |
}
|
135 |
$aValue = $a->value;
|
136 |
$bValue = $b->value;
|
137 |
|
138 |
-
if ($bValue > $aValue) {
|
139 |
return -1;
|
140 |
-
} elseif ($bValue < $aValue) {
|
141 |
return 1;
|
142 |
} else {
|
143 |
return 0;
|
@@ -147,48 +145,47 @@ class Less_Tree_Dimension extends Less_Tree{
|
|
147 |
}
|
148 |
}
|
149 |
|
150 |
-
|
151 |
-
return $this->convertTo(array('length'=> 'px', 'duration'=> 's', 'angle' => 'rad' ));
|
152 |
}
|
153 |
|
154 |
-
|
155 |
$value = $this->value;
|
156 |
$unit = clone $this->unit;
|
157 |
|
158 |
-
if( is_string($conversions) ){
|
159 |
$derivedConversions = array();
|
160 |
-
foreach( Less_Tree_UnitConversions::$groups as $i ){
|
161 |
-
if( isset(Less_Tree_UnitConversions::${$i}[$conversions]) ){
|
162 |
-
$derivedConversions = array( $i => $conversions);
|
163 |
}
|
164 |
}
|
165 |
$conversions = $derivedConversions;
|
166 |
}
|
167 |
|
168 |
-
|
169 |
-
foreach($conversions as $groupName => $targetUnit){
|
170 |
$group = Less_Tree_UnitConversions::${$groupName};
|
171 |
|
172 |
-
//numerator
|
173 |
-
foreach($unit->numerator as $i => $atomicUnit){
|
174 |
$atomicUnit = $unit->numerator[$i];
|
175 |
-
if( !isset($group[$atomicUnit]) ){
|
176 |
continue;
|
177 |
}
|
178 |
|
179 |
-
$value = $value * ($group[$atomicUnit] / $group[$targetUnit]);
|
180 |
|
181 |
$unit->numerator[$i] = $targetUnit;
|
182 |
}
|
183 |
|
184 |
-
//denominator
|
185 |
-
foreach($unit->denominator as $i => $atomicUnit){
|
186 |
$atomicUnit = $unit->denominator[$i];
|
187 |
-
if( !isset($group[$atomicUnit]) ){
|
188 |
continue;
|
189 |
}
|
190 |
|
191 |
-
$value = $value / ($group[$atomicUnit] / $group[$targetUnit]);
|
192 |
|
193 |
$unit->denominator[$i] = $targetUnit;
|
194 |
}
|
@@ -196,6 +193,6 @@ class Less_Tree_Dimension extends Less_Tree{
|
|
196 |
|
197 |
$unit->cancel();
|
198 |
|
199 |
-
return new Less_Tree_Dimension( $value, $unit);
|
200 |
-
|
201 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Dimension extends Less_Tree {
|
10 |
|
11 |
public $value;
|
12 |
public $unit;
|
13 |
public $type = 'Dimension';
|
14 |
|
15 |
+
public function __construct( $value, $unit = null ) {
|
16 |
+
$this->value = floatval( $value );
|
17 |
|
18 |
+
if ( $unit && ( $unit instanceof Less_Tree_Unit ) ) {
|
19 |
$this->unit = $unit;
|
20 |
+
} elseif ( $unit ) {
|
21 |
+
$this->unit = new Less_Tree_Unit( array( $unit ) );
|
22 |
+
} else {
|
23 |
+
$this->unit = new Less_Tree_Unit();
|
24 |
}
|
25 |
+
}
|
26 |
|
27 |
+
public function accept( $visitor ) {
|
28 |
$this->unit = $visitor->visitObj( $this->unit );
|
29 |
}
|
30 |
|
31 |
+
public function compile() {
|
32 |
+
return $this;
|
33 |
+
}
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
public function toColor() {
|
36 |
+
return new Less_Tree_Color( array( $this->value, $this->value, $this->value ) );
|
37 |
+
}
|
|
|
38 |
|
39 |
+
/**
|
40 |
+
* @see Less_Tree::genCSS
|
41 |
+
*/
|
42 |
+
public function genCSS( $output ) {
|
43 |
+
if ( Less_Parser::$options['strictUnits'] && !$this->unit->isSingular() ) {
|
44 |
+
throw new Less_Exception_Compiler( "Multiple units in dimension. Correct the units or use the unit function. Bad unit: ".$this->unit->toString() );
|
45 |
}
|
46 |
|
47 |
$value = Less_Functions::fround( $this->value );
|
48 |
$strValue = (string)$value;
|
49 |
|
50 |
+
if ( $value !== 0 && $value < 0.000001 && $value > -0.000001 ) {
|
51 |
// would be output 1e-6 etc.
|
52 |
+
$strValue = number_format( $strValue, 10 );
|
53 |
+
$strValue = preg_replace( '/\.?0+$/', '', $strValue );
|
54 |
}
|
55 |
|
56 |
+
if ( Less_Parser::$options['compress'] ) {
|
57 |
// Zero values doesn't need a unit
|
58 |
+
if ( $value === 0 && $this->unit->isLength() ) {
|
59 |
$output->add( $strValue );
|
60 |
return $strValue;
|
61 |
}
|
62 |
|
63 |
// Float values doesn't need a leading zero
|
64 |
+
if ( $value > 0 && $value < 1 && $strValue[0] === '0' ) {
|
65 |
+
$strValue = substr( $strValue, 1 );
|
66 |
}
|
67 |
}
|
68 |
|
70 |
$this->unit->genCSS( $output );
|
71 |
}
|
72 |
|
73 |
+
public function __toString() {
|
74 |
+
return $this->toCSS();
|
75 |
+
}
|
|
|
|
|
|
|
|
|
76 |
|
77 |
+
// In an operation between two Dimensions,
|
78 |
+
// we default to the first Dimension's unit,
|
79 |
+
// so `1px + 2em` will yield `3px`.
|
|
|
80 |
|
81 |
+
/**
|
82 |
+
* @param string $op
|
83 |
+
*/
|
84 |
+
public function operate( $op, $other ) {
|
85 |
+
$value = Less_Functions::operate( $op, $this->value, $other->value );
|
86 |
$unit = clone $this->unit;
|
87 |
|
88 |
+
if ( $op === '+' || $op === '-' ) {
|
89 |
|
90 |
+
if ( !$unit->numerator && !$unit->denominator ) {
|
91 |
$unit->numerator = $other->unit->numerator;
|
92 |
$unit->denominator = $other->unit->denominator;
|
93 |
+
} elseif ( !$other->unit->numerator && !$other->unit->denominator ) {
|
94 |
// do nothing
|
95 |
+
} else {
|
96 |
+
$other = $other->convertTo( $this->unit->usedUnits() );
|
97 |
|
98 |
+
if ( Less_Parser::$options['strictUnits'] && $other->unit->toString() !== $unit->toCSS() ) {
|
99 |
+
throw new Less_Exception_Compiler( "Incompatible units. Change the units or use the unit function. Bad units: '" . $unit->toString() . "' and " . $other->unit->toString() . "'." );
|
100 |
}
|
101 |
|
102 |
+
$value = Less_Functions::operate( $op, $this->value, $other->value );
|
103 |
}
|
104 |
+
} elseif ( $op === '*' ) {
|
105 |
+
$unit->numerator = array_merge( $unit->numerator, $other->unit->numerator );
|
106 |
+
$unit->denominator = array_merge( $unit->denominator, $other->unit->denominator );
|
107 |
+
sort( $unit->numerator );
|
108 |
+
sort( $unit->denominator );
|
109 |
$unit->cancel();
|
110 |
+
} elseif ( $op === '/' ) {
|
111 |
+
$unit->numerator = array_merge( $unit->numerator, $other->unit->denominator );
|
112 |
+
$unit->denominator = array_merge( $unit->denominator, $other->unit->numerator );
|
113 |
+
sort( $unit->numerator );
|
114 |
+
sort( $unit->denominator );
|
115 |
$unit->cancel();
|
116 |
}
|
117 |
+
return new Less_Tree_Dimension( $value, $unit );
|
118 |
+
}
|
119 |
|
120 |
+
public function compare( $other ) {
|
121 |
+
if ( $other instanceof Less_Tree_Dimension ) {
|
122 |
|
123 |
+
if ( $this->unit->isEmpty() || $other->unit->isEmpty() ) {
|
124 |
$a = $this;
|
125 |
$b = $other;
|
126 |
} else {
|
127 |
$a = $this->unify();
|
128 |
$b = $other->unify();
|
129 |
+
if ( $a->unit->compare( $b->unit ) !== 0 ) {
|
130 |
return -1;
|
131 |
}
|
132 |
}
|
133 |
$aValue = $a->value;
|
134 |
$bValue = $b->value;
|
135 |
|
136 |
+
if ( $bValue > $aValue ) {
|
137 |
return -1;
|
138 |
+
} elseif ( $bValue < $aValue ) {
|
139 |
return 1;
|
140 |
} else {
|
141 |
return 0;
|
145 |
}
|
146 |
}
|
147 |
|
148 |
+
public function unify() {
|
149 |
+
return $this->convertTo( array( 'length' => 'px', 'duration' => 's', 'angle' => 'rad' ) );
|
150 |
}
|
151 |
|
152 |
+
public function convertTo( $conversions ) {
|
153 |
$value = $this->value;
|
154 |
$unit = clone $this->unit;
|
155 |
|
156 |
+
if ( is_string( $conversions ) ) {
|
157 |
$derivedConversions = array();
|
158 |
+
foreach ( Less_Tree_UnitConversions::$groups as $i ) {
|
159 |
+
if ( isset( Less_Tree_UnitConversions::${$i}[$conversions] ) ) {
|
160 |
+
$derivedConversions = array( $i => $conversions );
|
161 |
}
|
162 |
}
|
163 |
$conversions = $derivedConversions;
|
164 |
}
|
165 |
|
166 |
+
foreach ( $conversions as $groupName => $targetUnit ) {
|
|
|
167 |
$group = Less_Tree_UnitConversions::${$groupName};
|
168 |
|
169 |
+
// numerator
|
170 |
+
foreach ( $unit->numerator as $i => $atomicUnit ) {
|
171 |
$atomicUnit = $unit->numerator[$i];
|
172 |
+
if ( !isset( $group[$atomicUnit] ) ) {
|
173 |
continue;
|
174 |
}
|
175 |
|
176 |
+
$value = $value * ( $group[$atomicUnit] / $group[$targetUnit] );
|
177 |
|
178 |
$unit->numerator[$i] = $targetUnit;
|
179 |
}
|
180 |
|
181 |
+
// denominator
|
182 |
+
foreach ( $unit->denominator as $i => $atomicUnit ) {
|
183 |
$atomicUnit = $unit->denominator[$i];
|
184 |
+
if ( !isset( $group[$atomicUnit] ) ) {
|
185 |
continue;
|
186 |
}
|
187 |
|
188 |
+
$value = $value / ( $group[$atomicUnit] / $group[$targetUnit] );
|
189 |
|
190 |
$unit->denominator[$i] = $targetUnit;
|
191 |
}
|
193 |
|
194 |
$unit->cancel();
|
195 |
|
196 |
+
return new Less_Tree_Dimension( $value, $unit );
|
197 |
+
}
|
198 |
}
|
base/inc/lib/Less/Tree/Directive.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Directive extends Less_Tree{
|
10 |
|
11 |
public $name;
|
12 |
public $value;
|
@@ -17,10 +17,10 @@ class Less_Tree_Directive extends Less_Tree{
|
|
17 |
public $debugInfo;
|
18 |
public $type = 'Directive';
|
19 |
|
20 |
-
public function __construct($name, $value = null, $rules = null, $index = null, $currentFileInfo = null, $debugInfo = null ){
|
21 |
$this->name = $name;
|
22 |
$this->value = $value;
|
23 |
-
if( $rules ){
|
24 |
$this->rules = $rules;
|
25 |
$this->rules->allowImports = true;
|
26 |
}
|
@@ -30,70 +30,66 @@ class Less_Tree_Directive extends Less_Tree{
|
|
30 |
$this->debugInfo = $debugInfo;
|
31 |
}
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
if( $this->rules ){
|
36 |
$this->rules = $visitor->visitObj( $this->rules );
|
37 |
}
|
38 |
-
if( $this->value ){
|
39 |
$this->value = $visitor->visitObj( $this->value );
|
40 |
}
|
41 |
}
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
public function genCSS( $output ){
|
48 |
$value = $this->value;
|
49 |
$rules = $this->rules;
|
50 |
$output->add( $this->name, $this->currentFileInfo, $this->index );
|
51 |
-
if( $this->value ){
|
52 |
-
$output->add(' ');
|
53 |
-
$this->value->genCSS($output);
|
54 |
}
|
55 |
-
if( $this->rules ){
|
56 |
-
Less_Tree::outputRuleset( $output, array($this->rules));
|
57 |
} else {
|
58 |
-
$output->add(';');
|
59 |
}
|
60 |
}
|
61 |
|
62 |
-
public function compile($env){
|
63 |
-
|
64 |
$value = $this->value;
|
65 |
$rules = $this->rules;
|
66 |
-
if( $value ){
|
67 |
-
$value = $value->compile($env);
|
68 |
}
|
69 |
|
70 |
-
if( $rules ){
|
71 |
-
$rules = $rules->compile($env);
|
72 |
$rules->root = true;
|
73 |
}
|
74 |
|
75 |
return new Less_Tree_Directive( $this->name, $value, $rules, $this->index, $this->currentFileInfo, $this->debugInfo );
|
76 |
}
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
return $this->rules->variable($name);
|
82 |
}
|
83 |
}
|
84 |
|
85 |
-
public function find($selector){
|
86 |
-
if( $this->rules ){
|
87 |
-
return $this->rules->find($selector, $this);
|
88 |
}
|
89 |
}
|
90 |
|
91 |
-
//rulesets: function () { if (this.rules) return tree.Ruleset.prototype.rulesets.apply(this.rules); },
|
92 |
|
93 |
-
public function markReferenced(){
|
94 |
$this->isReferenced = true;
|
95 |
-
if( $this->rules ){
|
96 |
-
Less_Tree::ReferencedArray($this->rules->rules);
|
97 |
}
|
98 |
}
|
99 |
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Directive extends Less_Tree {
|
10 |
|
11 |
public $name;
|
12 |
public $value;
|
17 |
public $debugInfo;
|
18 |
public $type = 'Directive';
|
19 |
|
20 |
+
public function __construct( $name, $value = null, $rules = null, $index = null, $currentFileInfo = null, $debugInfo = null ) {
|
21 |
$this->name = $name;
|
22 |
$this->value = $value;
|
23 |
+
if ( $rules ) {
|
24 |
$this->rules = $rules;
|
25 |
$this->rules->allowImports = true;
|
26 |
}
|
30 |
$this->debugInfo = $debugInfo;
|
31 |
}
|
32 |
|
33 |
+
public function accept( $visitor ) {
|
34 |
+
if ( $this->rules ) {
|
|
|
35 |
$this->rules = $visitor->visitObj( $this->rules );
|
36 |
}
|
37 |
+
if ( $this->value ) {
|
38 |
$this->value = $visitor->visitObj( $this->value );
|
39 |
}
|
40 |
}
|
41 |
|
42 |
+
/**
|
43 |
+
* @see Less_Tree::genCSS
|
44 |
+
*/
|
45 |
+
public function genCSS( $output ) {
|
|
|
46 |
$value = $this->value;
|
47 |
$rules = $this->rules;
|
48 |
$output->add( $this->name, $this->currentFileInfo, $this->index );
|
49 |
+
if ( $this->value ) {
|
50 |
+
$output->add( ' ' );
|
51 |
+
$this->value->genCSS( $output );
|
52 |
}
|
53 |
+
if ( $this->rules ) {
|
54 |
+
Less_Tree::outputRuleset( $output, array( $this->rules ) );
|
55 |
} else {
|
56 |
+
$output->add( ';' );
|
57 |
}
|
58 |
}
|
59 |
|
60 |
+
public function compile( $env ) {
|
|
|
61 |
$value = $this->value;
|
62 |
$rules = $this->rules;
|
63 |
+
if ( $value ) {
|
64 |
+
$value = $value->compile( $env );
|
65 |
}
|
66 |
|
67 |
+
if ( $rules ) {
|
68 |
+
$rules = $rules->compile( $env );
|
69 |
$rules->root = true;
|
70 |
}
|
71 |
|
72 |
return new Less_Tree_Directive( $this->name, $value, $rules, $this->index, $this->currentFileInfo, $this->debugInfo );
|
73 |
}
|
74 |
|
75 |
+
public function variable( $name ) {
|
76 |
+
if ( $this->rules ) {
|
77 |
+
return $this->rules->variable( $name );
|
|
|
78 |
}
|
79 |
}
|
80 |
|
81 |
+
public function find( $selector ) {
|
82 |
+
if ( $this->rules ) {
|
83 |
+
return $this->rules->find( $selector, $this );
|
84 |
}
|
85 |
}
|
86 |
|
87 |
+
// rulesets: function () { if (this.rules) return tree.Ruleset.prototype.rulesets.apply(this.rules); },
|
88 |
|
89 |
+
public function markReferenced() {
|
90 |
$this->isReferenced = true;
|
91 |
+
if ( $this->rules ) {
|
92 |
+
Less_Tree::ReferencedArray( $this->rules->rules );
|
93 |
}
|
94 |
}
|
95 |
|
base/inc/lib/Less/Tree/Element.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Element extends Less_Tree{
|
10 |
|
11 |
public $combinator = '';
|
12 |
public $value = '';
|
@@ -16,12 +16,11 @@ class Less_Tree_Element extends Less_Tree{
|
|
16 |
|
17 |
public $value_is_object = false;
|
18 |
|
19 |
-
public function __construct($combinator, $value, $index = null, $currentFileInfo = null ){
|
20 |
-
|
21 |
$this->value = $value;
|
22 |
-
$this->value_is_object = is_object($value);
|
23 |
|
24 |
-
if( $combinator ){
|
25 |
$this->combinator = $combinator;
|
26 |
}
|
27 |
|
@@ -29,46 +28,42 @@ class Less_Tree_Element extends Less_Tree{
|
|
29 |
$this->currentFileInfo = $currentFileInfo;
|
30 |
}
|
31 |
|
32 |
-
|
33 |
-
if( $this->value_is_object ){ //object or string
|
34 |
$this->value = $visitor->visitObj( $this->value );
|
35 |
}
|
36 |
}
|
37 |
|
38 |
-
public function compile($env){
|
39 |
-
|
40 |
-
|
41 |
-
return new Less_Tree_Element($this->combinator, ($this->value_is_object ? $this->value->compile($env) : $this->value), $this->index, $this->currentFileInfo );
|
42 |
}
|
43 |
|
44 |
-
if( $this->value_is_object ){
|
45 |
-
$this->value = $this->value->compile($env);
|
46 |
}
|
47 |
|
48 |
return $this;
|
49 |
}
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
public function genCSS( $output ){
|
55 |
$output->add( $this->toCSS(), $this->currentFileInfo, $this->index );
|
56 |
}
|
57 |
|
58 |
-
public function toCSS(){
|
59 |
-
|
60 |
-
if( $this->value_is_object ){
|
61 |
$value = $this->value->toCSS();
|
62 |
-
}else{
|
63 |
$value = $this->value;
|
64 |
}
|
65 |
|
66 |
-
|
67 |
-
if( $value === '' && $this->combinator && $this->combinator === '&' ){
|
68 |
return '';
|
69 |
}
|
70 |
|
71 |
-
|
72 |
return Less_Environment::$_outputMap[$this->combinator] . $value;
|
73 |
}
|
74 |
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Element extends Less_Tree {
|
10 |
|
11 |
public $combinator = '';
|
12 |
public $value = '';
|
16 |
|
17 |
public $value_is_object = false;
|
18 |
|
19 |
+
public function __construct( $combinator, $value, $index = null, $currentFileInfo = null ) {
|
|
|
20 |
$this->value = $value;
|
21 |
+
$this->value_is_object = is_object( $value );
|
22 |
|
23 |
+
if ( $combinator ) {
|
24 |
$this->combinator = $combinator;
|
25 |
}
|
26 |
|
28 |
$this->currentFileInfo = $currentFileInfo;
|
29 |
}
|
30 |
|
31 |
+
public function accept( $visitor ) {
|
32 |
+
if ( $this->value_is_object ) { // object or string
|
33 |
$this->value = $visitor->visitObj( $this->value );
|
34 |
}
|
35 |
}
|
36 |
|
37 |
+
public function compile( $env ) {
|
38 |
+
if ( Less_Environment::$mixin_stack ) {
|
39 |
+
return new Less_Tree_Element( $this->combinator, ( $this->value_is_object ? $this->value->compile( $env ) : $this->value ), $this->index, $this->currentFileInfo );
|
|
|
40 |
}
|
41 |
|
42 |
+
if ( $this->value_is_object ) {
|
43 |
+
$this->value = $this->value->compile( $env );
|
44 |
}
|
45 |
|
46 |
return $this;
|
47 |
}
|
48 |
|
49 |
+
/**
|
50 |
+
* @see Less_Tree::genCSS
|
51 |
+
*/
|
52 |
+
public function genCSS( $output ) {
|
53 |
$output->add( $this->toCSS(), $this->currentFileInfo, $this->index );
|
54 |
}
|
55 |
|
56 |
+
public function toCSS() {
|
57 |
+
if ( $this->value_is_object ) {
|
|
|
58 |
$value = $this->value->toCSS();
|
59 |
+
} else {
|
60 |
$value = $this->value;
|
61 |
}
|
62 |
|
63 |
+
if ( $value === '' && $this->combinator && $this->combinator === '&' ) {
|
|
|
64 |
return '';
|
65 |
}
|
66 |
|
|
|
67 |
return Less_Environment::$_outputMap[$this->combinator] . $value;
|
68 |
}
|
69 |
|
base/inc/lib/Less/Tree/Expression.php
CHANGED
@@ -6,87 +6,85 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Expression extends Less_Tree{
|
10 |
|
11 |
public $value = array();
|
12 |
public $parens = false;
|
13 |
public $parensInOp = false;
|
14 |
public $type = 'Expression';
|
15 |
|
16 |
-
public function __construct( $value, $parens = null ){
|
17 |
$this->value = $value;
|
18 |
$this->parens = $parens;
|
19 |
}
|
20 |
|
21 |
-
|
22 |
$this->value = $visitor->visitArray( $this->value );
|
23 |
}
|
24 |
|
25 |
-
public function compile($env) {
|
26 |
-
|
27 |
$doubleParen = false;
|
28 |
|
29 |
-
if( $this->parens && !$this->parensInOp ){
|
30 |
Less_Environment::$parensStack++;
|
31 |
}
|
32 |
|
33 |
$returnValue = null;
|
34 |
-
if( $this->value ){
|
35 |
|
36 |
-
$count = count($this->value);
|
37 |
|
38 |
-
if( $count > 1 ){
|
39 |
|
40 |
$ret = array();
|
41 |
-
foreach($this->value as $e){
|
42 |
-
$ret[] = $e->compile($env);
|
43 |
}
|
44 |
-
$returnValue = new Less_Tree_Expression($ret);
|
45 |
|
46 |
-
}else{
|
47 |
|
48 |
-
if( ($this->value[0] instanceof Less_Tree_Expression) && $this->value[0]->parens && !$this->value[0]->parensInOp ){
|
49 |
$doubleParen = true;
|
50 |
}
|
51 |
|
52 |
-
$returnValue = $this->value[0]->compile($env);
|
53 |
}
|
54 |
|
55 |
} else {
|
56 |
$returnValue = $this;
|
57 |
}
|
58 |
|
59 |
-
if( $this->parens ){
|
60 |
-
if( !$this->parensInOp ){
|
61 |
Less_Environment::$parensStack--;
|
62 |
|
63 |
-
}elseif( !Less_Environment::isMathOn() && !$doubleParen ){
|
64 |
-
$returnValue = new Less_Tree_Paren($returnValue);
|
65 |
|
66 |
}
|
67 |
}
|
68 |
return $returnValue;
|
69 |
}
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
$val_len = count($this->value);
|
76 |
-
for( $i = 0; $i < $val_len; $i++ ){
|
77 |
$this->value[$i]->genCSS( $output );
|
78 |
-
if( $i + 1 < $val_len ){
|
79 |
$output->add( ' ' );
|
80 |
}
|
81 |
}
|
82 |
}
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
if( is_array($this->value) ){
|
87 |
$new_value = array();
|
88 |
-
foreach($this->value as $v){
|
89 |
-
if( $v instanceof Less_Tree_Comment ){
|
90 |
continue;
|
91 |
}
|
92 |
$new_value[] = $v;
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Expression extends Less_Tree {
|
10 |
|
11 |
public $value = array();
|
12 |
public $parens = false;
|
13 |
public $parensInOp = false;
|
14 |
public $type = 'Expression';
|
15 |
|
16 |
+
public function __construct( $value, $parens = null ) {
|
17 |
$this->value = $value;
|
18 |
$this->parens = $parens;
|
19 |
}
|
20 |
|
21 |
+
public function accept( $visitor ) {
|
22 |
$this->value = $visitor->visitArray( $this->value );
|
23 |
}
|
24 |
|
25 |
+
public function compile( $env ) {
|
|
|
26 |
$doubleParen = false;
|
27 |
|
28 |
+
if ( $this->parens && !$this->parensInOp ) {
|
29 |
Less_Environment::$parensStack++;
|
30 |
}
|
31 |
|
32 |
$returnValue = null;
|
33 |
+
if ( $this->value ) {
|
34 |
|
35 |
+
$count = count( $this->value );
|
36 |
|
37 |
+
if ( $count > 1 ) {
|
38 |
|
39 |
$ret = array();
|
40 |
+
foreach ( $this->value as $e ) {
|
41 |
+
$ret[] = $e->compile( $env );
|
42 |
}
|
43 |
+
$returnValue = new Less_Tree_Expression( $ret );
|
44 |
|
45 |
+
} else {
|
46 |
|
47 |
+
if ( ( $this->value[0] instanceof Less_Tree_Expression ) && $this->value[0]->parens && !$this->value[0]->parensInOp ) {
|
48 |
$doubleParen = true;
|
49 |
}
|
50 |
|
51 |
+
$returnValue = $this->value[0]->compile( $env );
|
52 |
}
|
53 |
|
54 |
} else {
|
55 |
$returnValue = $this;
|
56 |
}
|
57 |
|
58 |
+
if ( $this->parens ) {
|
59 |
+
if ( !$this->parensInOp ) {
|
60 |
Less_Environment::$parensStack--;
|
61 |
|
62 |
+
} elseif ( !Less_Environment::isMathOn() && !$doubleParen ) {
|
63 |
+
$returnValue = new Less_Tree_Paren( $returnValue );
|
64 |
|
65 |
}
|
66 |
}
|
67 |
return $returnValue;
|
68 |
}
|
69 |
|
70 |
+
/**
|
71 |
+
* @see Less_Tree::genCSS
|
72 |
+
*/
|
73 |
+
public function genCSS( $output ) {
|
74 |
+
$val_len = count( $this->value );
|
75 |
+
for ( $i = 0; $i < $val_len; $i++ ) {
|
76 |
$this->value[$i]->genCSS( $output );
|
77 |
+
if ( $i + 1 < $val_len ) {
|
78 |
$output->add( ' ' );
|
79 |
}
|
80 |
}
|
81 |
}
|
82 |
|
83 |
+
public function throwAwayComments() {
|
84 |
+
if ( is_array( $this->value ) ) {
|
|
|
85 |
$new_value = array();
|
86 |
+
foreach ( $this->value as $v ) {
|
87 |
+
if ( $v instanceof Less_Tree_Comment ) {
|
88 |
continue;
|
89 |
}
|
90 |
$new_value[] = $v;
|
base/inc/lib/Less/Tree/Extend.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Extend extends Less_Tree{
|
10 |
|
11 |
public $selector;
|
12 |
public $option;
|
@@ -18,20 +18,19 @@ class Less_Tree_Extend extends Less_Tree{
|
|
18 |
public $type = 'Extend';
|
19 |
public $ruleset;
|
20 |
|
21 |
-
|
22 |
public $object_id;
|
23 |
public $parent_ids = array();
|
24 |
|
25 |
/**
|
26 |
* @param integer $index
|
27 |
*/
|
28 |
-
|
29 |
static $i = 0;
|
30 |
$this->selector = $selector;
|
31 |
$this->option = $option;
|
32 |
$this->index = $index;
|
33 |
|
34 |
-
switch($option){
|
35 |
case "all":
|
36 |
$this->allowBefore = true;
|
37 |
$this->allowAfter = true;
|
@@ -51,32 +50,31 @@ class Less_Tree_Extend extends Less_Tree{
|
|
51 |
);
|
52 |
}
|
53 |
|
54 |
-
|
55 |
$this->selector = $visitor->visitObj( $this->selector );
|
56 |
}
|
57 |
|
58 |
-
|
59 |
Less_Parser::$has_extends = true;
|
60 |
-
$this->selector = $this->selector->compile($env);
|
61 |
return $this;
|
62 |
-
//return new Less_Tree_Extend( $this->selector->compile($env), $this->option, $this->index);
|
63 |
}
|
64 |
|
65 |
-
|
66 |
$selfElements = array();
|
67 |
|
68 |
-
|
69 |
-
for( $i = 0, $selectors_len = count($selectors); $i < $selectors_len; $i++ ){
|
70 |
$selectorElements = $selectors[$i]->elements;
|
71 |
// duplicate the logic in genCSS function inside the selector node.
|
72 |
// future TODO - move both logics into the selector joiner visitor
|
73 |
-
if( $i && $selectorElements && $selectorElements[0]->combinator === "") {
|
74 |
$selectorElements[0]->combinator = ' ';
|
75 |
}
|
76 |
$selfElements = array_merge( $selfElements, $selectors[$i]->elements );
|
77 |
}
|
78 |
|
79 |
-
$this->selfSelectors = array(new Less_Tree_Selector($selfElements));
|
80 |
}
|
81 |
|
82 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Extend extends Less_Tree {
|
10 |
|
11 |
public $selector;
|
12 |
public $option;
|
18 |
public $type = 'Extend';
|
19 |
public $ruleset;
|
20 |
|
|
|
21 |
public $object_id;
|
22 |
public $parent_ids = array();
|
23 |
|
24 |
/**
|
25 |
* @param integer $index
|
26 |
*/
|
27 |
+
public function __construct( $selector, $option, $index ) {
|
28 |
static $i = 0;
|
29 |
$this->selector = $selector;
|
30 |
$this->option = $option;
|
31 |
$this->index = $index;
|
32 |
|
33 |
+
switch ( $option ) {
|
34 |
case "all":
|
35 |
$this->allowBefore = true;
|
36 |
$this->allowAfter = true;
|
50 |
);
|
51 |
}
|
52 |
|
53 |
+
public function accept( $visitor ) {
|
54 |
$this->selector = $visitor->visitObj( $this->selector );
|
55 |
}
|
56 |
|
57 |
+
public function compile( $env ) {
|
58 |
Less_Parser::$has_extends = true;
|
59 |
+
$this->selector = $this->selector->compile( $env );
|
60 |
return $this;
|
61 |
+
// return new Less_Tree_Extend( $this->selector->compile($env), $this->option, $this->index);
|
62 |
}
|
63 |
|
64 |
+
public function findSelfSelectors( $selectors ) {
|
65 |
$selfElements = array();
|
66 |
|
67 |
+
for ( $i = 0, $selectors_len = count( $selectors ); $i < $selectors_len; $i++ ) {
|
|
|
68 |
$selectorElements = $selectors[$i]->elements;
|
69 |
// duplicate the logic in genCSS function inside the selector node.
|
70 |
// future TODO - move both logics into the selector joiner visitor
|
71 |
+
if ( $i && $selectorElements && $selectorElements[0]->combinator === "" ) {
|
72 |
$selectorElements[0]->combinator = ' ';
|
73 |
}
|
74 |
$selfElements = array_merge( $selfElements, $selectors[$i]->elements );
|
75 |
}
|
76 |
|
77 |
+
$this->selfSelectors = array( new Less_Tree_Selector( $selfElements ) );
|
78 |
}
|
79 |
|
80 |
}
|
base/inc/lib/Less/Tree/Import.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* @package Less
|
16 |
* @subpackage tree
|
17 |
*/
|
18 |
-
class Less_Tree_Import extends Less_Tree{
|
19 |
|
20 |
public $options;
|
21 |
public $index;
|
@@ -27,21 +27,21 @@ class Less_Tree_Import extends Less_Tree{
|
|
27 |
public $root;
|
28 |
public $type = 'Import';
|
29 |
|
30 |
-
|
31 |
$this->options = $options;
|
32 |
$this->index = $index;
|
33 |
$this->path = $path;
|
34 |
$this->features = $features;
|
35 |
$this->currentFileInfo = $currentFileInfo;
|
36 |
|
37 |
-
if( is_array($options) ){
|
38 |
-
$this->options += array('inline'=>false);
|
39 |
|
40 |
-
if( isset($this->options['less']) || $this->options['inline'] ){
|
41 |
-
$this->css = !isset($this->options['less']) || !$this->options['less'] || $this->options['inline'];
|
42 |
} else {
|
43 |
$pathValue = $this->getPath();
|
44 |
-
if( $pathValue && preg_match('/css([\?;].*)?$/'
|
45 |
$this->css = true;
|
46 |
}
|
47 |
}
|
@@ -58,28 +58,27 @@ class Less_Tree_Import extends Less_Tree{
|
|
58 |
// ruleset.
|
59 |
//
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
$this->features = $visitor->visitObj($this->features);
|
65 |
}
|
66 |
-
$this->path = $visitor->visitObj($this->path);
|
67 |
|
68 |
-
if( !$this->options['inline'] && $this->root ){
|
69 |
-
$this->root = $visitor->visit($this->root);
|
70 |
}
|
71 |
}
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
if( $this->css ){
|
78 |
|
79 |
$output->add( '@import ', $this->currentFileInfo, $this->index );
|
80 |
|
81 |
$this->path->genCSS( $output );
|
82 |
-
if( $this->features ){
|
83 |
$output->add( ' ' );
|
84 |
$this->features->genCSS( $output );
|
85 |
}
|
@@ -87,10 +86,10 @@ class Less_Tree_Import extends Less_Tree{
|
|
87 |
}
|
88 |
}
|
89 |
|
90 |
-
|
91 |
$features = $this->features ? ' ' . $this->features->toCSS() : '';
|
92 |
|
93 |
-
if ($this->css) {
|
94 |
return "@import " . $this->path->toCSS() . $features . ";\n";
|
95 |
} else {
|
96 |
return "";
|
@@ -100,130 +99,121 @@ class Less_Tree_Import extends Less_Tree{
|
|
100 |
/**
|
101 |
* @return string
|
102 |
*/
|
103 |
-
|
104 |
-
if ($this->path instanceof Less_Tree_Quoted) {
|
105 |
$path = $this->path->value;
|
106 |
-
$path = ( isset($this->css) || preg_match('/(\.[a-z]*$)|([\?;].*)$/'
|
107 |
-
} else if ($this->path instanceof Less_Tree_URL) {
|
108 |
$path = $this->path->value->value;
|
109 |
-
}else{
|
110 |
return null;
|
111 |
}
|
112 |
|
113 |
-
//remove query string and fragment
|
114 |
-
return preg_replace('/[\?#][^\?]*$/',''
|
115 |
}
|
116 |
|
117 |
-
|
118 |
-
return new Less_Tree_Import( $this->path->compile($env), $this->features, $this->options, $this->index, $this->currentFileInfo);
|
119 |
}
|
120 |
|
121 |
-
|
122 |
-
$path = $this->path->compile($env);
|
123 |
$rootpath = '';
|
124 |
-
if( $this->currentFileInfo && $this->currentFileInfo['rootpath'] ){
|
125 |
$rootpath = $this->currentFileInfo['rootpath'];
|
126 |
}
|
127 |
|
128 |
-
|
129 |
-
|
130 |
-
if( $rootpath ){
|
131 |
$pathValue = $path->value;
|
132 |
// Add the base path if the import is relative
|
133 |
-
if( $pathValue && Less_Environment::isPathRelative($pathValue) ){
|
134 |
$path->value = $this->currentFileInfo['uri_root'].$pathValue;
|
135 |
}
|
136 |
}
|
137 |
-
$path->value = Less_Environment::normalizePath($path->value);
|
138 |
}
|
139 |
|
140 |
-
|
141 |
-
|
142 |
return $path;
|
143 |
}
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
$evald = $this->compileForImport($env);
|
148 |
|
149 |
-
//get path & uri
|
150 |
$path_and_uri = null;
|
151 |
-
if( is_callable(Less_Parser::$options['import_callback']) ){
|
152 |
-
$path_and_uri = call_user_func(Less_Parser::$options['import_callback']
|
153 |
}
|
154 |
|
155 |
-
if( !$path_and_uri ){
|
156 |
$path_and_uri = $evald->PathAndUri();
|
157 |
}
|
158 |
|
159 |
-
if( $path_and_uri ){
|
160 |
-
list($full_path, $uri) = $path_and_uri;
|
161 |
-
}else{
|
162 |
$full_path = $uri = $evald->getPath();
|
163 |
}
|
164 |
|
165 |
-
|
166 |
-
|
167 |
-
if( $evald->skip( $full_path, $env) ){
|
168 |
return array();
|
169 |
}
|
170 |
|
171 |
-
if( $this->options['inline'] ){
|
172 |
-
//todo needs to reference css file not import
|
173 |
//$contents = new Less_Tree_Anonymous($this->root, 0, array('filename'=>$this->importedFilename), true );
|
174 |
|
175 |
-
Less_Parser::AddParsedFile($full_path);
|
176 |
-
$contents = new Less_Tree_Anonymous( file_get_contents($full_path), 0, array(), true );
|
177 |
|
178 |
-
if( $this->features ){
|
179 |
-
return new Less_Tree_Media( array($contents), $this->features->value );
|
180 |
}
|
181 |
|
182 |
return array( $contents );
|
183 |
}
|
184 |
|
185 |
// optional (need to be before "CSS" to support optional CSS imports. CSS should be checked only if empty($this->currentFileInfo))
|
186 |
-
if( isset($this->options['optional']) && $this->options['optional'] && !file_exists($full_path) && (!$evald->css || !empty($this->currentFileInfo))) {
|
187 |
return array();
|
188 |
}
|
189 |
|
190 |
-
|
191 |
// css ?
|
192 |
-
if( $evald->css ){
|
193 |
-
$features = ( $evald->features ? $evald->features->compile($env) : null );
|
194 |
-
return new Less_Tree_Import( $this->compilePath( $env), $features, $this->options, $this->index);
|
195 |
}
|
196 |
|
197 |
-
|
198 |
return $this->ParseImport( $full_path, $uri, $env );
|
199 |
}
|
200 |
|
201 |
-
|
202 |
/**
|
203 |
* Using the import directories, get the full absolute path and uri of the import
|
204 |
*
|
205 |
* @param Less_Tree_Import $evald
|
206 |
*/
|
207 |
-
|
208 |
-
|
209 |
$evald_path = $this->getPath();
|
210 |
|
211 |
-
if( $evald_path ){
|
212 |
|
213 |
$import_dirs = array();
|
214 |
|
215 |
-
if( Less_Environment::isPathRelative($evald_path) ){
|
216 |
-
//if the path is relative, the file should be in the current directory
|
217 |
-
if ( $this->currentFileInfo ){
|
218 |
$import_dirs[ $this->currentFileInfo['currentDirectory'] ] = $this->currentFileInfo['uri_root'];
|
219 |
}
|
220 |
|
221 |
-
}else{
|
222 |
-
//otherwise, the file should be relative to the server root
|
223 |
-
if( $this->currentFileInfo ) {
|
224 |
$import_dirs[ $this->currentFileInfo['entryPath'] ] = $this->currentFileInfo['entryUri'];
|
225 |
}
|
226 |
-
//if the user supplied entryPath isn't the actual root
|
227 |
$import_dirs[ $_SERVER['DOCUMENT_ROOT'] ] = '';
|
228 |
|
229 |
}
|
@@ -231,25 +221,24 @@ class Less_Tree_Import extends Less_Tree{
|
|
231 |
// always look in user supplied import directories
|
232 |
$import_dirs = array_merge( $import_dirs, Less_Parser::$options['import_dirs'] );
|
233 |
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
if( is_string($path) ){
|
239 |
$full_path = $path;
|
240 |
return array( $full_path, $uri );
|
241 |
}
|
242 |
-
}elseif( !empty($rootpath) ){
|
243 |
|
244 |
-
$path = rtrim($rootpath,'/\\').'/'.ltrim($evald_path,'/\\');
|
245 |
|
246 |
-
if( file_exists($path) ){
|
247 |
-
$full_path = Less_Environment::normalizePath($path);
|
248 |
-
$uri = Less_Environment::normalizePath(dirname($rooturi.$evald_path));
|
249 |
return array( $full_path, $uri );
|
250 |
-
} elseif( file_exists($path.'.less') ){
|
251 |
-
$full_path = Less_Environment::normalizePath($path.'.less');
|
252 |
-
$uri = Less_Environment::normalizePath(dirname($rooturi.$evald_path.'.less'));
|
253 |
return array( $full_path, $uri );
|
254 |
}
|
255 |
}
|
@@ -257,50 +246,45 @@ class Less_Tree_Import extends Less_Tree{
|
|
257 |
}
|
258 |
}
|
259 |
|
260 |
-
|
261 |
/**
|
262 |
* Parse the import url and return the rules
|
263 |
*
|
264 |
* @return Less_Tree_Media|array
|
265 |
*/
|
266 |
-
|
267 |
-
|
268 |
$import_env = clone $env;
|
269 |
-
if( (isset($this->options['reference']) && $this->options['reference']) || isset($this->currentFileInfo['reference']) ){
|
270 |
$import_env->currentFileInfo['reference'] = true;
|
271 |
}
|
272 |
|
273 |
-
if( (isset($this->options['multiple']) && $this->options['multiple']) ){
|
274 |
$import_env->importMultiple = true;
|
275 |
}
|
276 |
|
277 |
-
$parser = new Less_Parser($import_env);
|
278 |
-
$root = $parser->parseFile($full_path, $uri, true);
|
279 |
-
|
280 |
|
281 |
-
$ruleset = new Less_Tree_Ruleset(array(), $root->rules );
|
282 |
-
$ruleset->evalImports($import_env);
|
283 |
|
284 |
-
return $this->features ? new Less_Tree_Media($ruleset->rules, $this->features->value) : $ruleset->rules;
|
285 |
}
|
286 |
|
287 |
-
|
288 |
/**
|
289 |
* Should the import be skipped?
|
290 |
*
|
291 |
* @return boolean|null
|
292 |
*/
|
293 |
-
private function Skip($path, $env){
|
294 |
-
|
295 |
-
$path = Less_Parser::AbsPath($path, true);
|
296 |
|
297 |
-
if( $path && Less_Parser::FileParsed($path) ){
|
298 |
|
299 |
-
if( isset($this->currentFileInfo['reference']) ){
|
300 |
return true;
|
301 |
}
|
302 |
|
303 |
-
return !isset($this->options['multiple']) && !$env->importMultiple;
|
304 |
}
|
305 |
|
306 |
}
|
15 |
* @package Less
|
16 |
* @subpackage tree
|
17 |
*/
|
18 |
+
class Less_Tree_Import extends Less_Tree {
|
19 |
|
20 |
public $options;
|
21 |
public $index;
|
27 |
public $root;
|
28 |
public $type = 'Import';
|
29 |
|
30 |
+
public function __construct( $path, $features, $options, $index, $currentFileInfo = null ) {
|
31 |
$this->options = $options;
|
32 |
$this->index = $index;
|
33 |
$this->path = $path;
|
34 |
$this->features = $features;
|
35 |
$this->currentFileInfo = $currentFileInfo;
|
36 |
|
37 |
+
if ( is_array( $options ) ) {
|
38 |
+
$this->options += array( 'inline' => false );
|
39 |
|
40 |
+
if ( isset( $this->options['less'] ) || $this->options['inline'] ) {
|
41 |
+
$this->css = !isset( $this->options['less'] ) || !$this->options['less'] || $this->options['inline'];
|
42 |
} else {
|
43 |
$pathValue = $this->getPath();
|
44 |
+
if ( $pathValue && preg_match( '/css([\?;].*)?$/', $pathValue ) ) {
|
45 |
$this->css = true;
|
46 |
}
|
47 |
}
|
58 |
// ruleset.
|
59 |
//
|
60 |
|
61 |
+
public function accept( $visitor ) {
|
62 |
+
if ( $this->features ) {
|
63 |
+
$this->features = $visitor->visitObj( $this->features );
|
|
|
64 |
}
|
65 |
+
$this->path = $visitor->visitObj( $this->path );
|
66 |
|
67 |
+
if ( !$this->options['inline'] && $this->root ) {
|
68 |
+
$this->root = $visitor->visit( $this->root );
|
69 |
}
|
70 |
}
|
71 |
|
72 |
+
/**
|
73 |
+
* @see Less_Tree::genCSS
|
74 |
+
*/
|
75 |
+
public function genCSS( $output ) {
|
76 |
+
if ( $this->css ) {
|
77 |
|
78 |
$output->add( '@import ', $this->currentFileInfo, $this->index );
|
79 |
|
80 |
$this->path->genCSS( $output );
|
81 |
+
if ( $this->features ) {
|
82 |
$output->add( ' ' );
|
83 |
$this->features->genCSS( $output );
|
84 |
}
|
86 |
}
|
87 |
}
|
88 |
|
89 |
+
public function toCSS() {
|
90 |
$features = $this->features ? ' ' . $this->features->toCSS() : '';
|
91 |
|
92 |
+
if ( $this->css ) {
|
93 |
return "@import " . $this->path->toCSS() . $features . ";\n";
|
94 |
} else {
|
95 |
return "";
|
99 |
/**
|
100 |
* @return string
|
101 |
*/
|
102 |
+
public function getPath() {
|
103 |
+
if ( $this->path instanceof Less_Tree_Quoted ) {
|
104 |
$path = $this->path->value;
|
105 |
+
$path = ( isset( $this->css ) || preg_match( '/(\.[a-z]*$)|([\?;].*)$/', $path ) ) ? $path : $path . '.less';
|
106 |
+
} else if ( $this->path instanceof Less_Tree_URL ) {
|
107 |
$path = $this->path->value->value;
|
108 |
+
} else {
|
109 |
return null;
|
110 |
}
|
111 |
|
112 |
+
// remove query string and fragment
|
113 |
+
return preg_replace( '/[\?#][^\?]*$/', '', $path );
|
114 |
}
|
115 |
|
116 |
+
public function compileForImport( $env ) {
|
117 |
+
return new Less_Tree_Import( $this->path->compile( $env ), $this->features, $this->options, $this->index, $this->currentFileInfo );
|
118 |
}
|
119 |
|
120 |
+
public function compilePath( $env ) {
|
121 |
+
$path = $this->path->compile( $env );
|
122 |
$rootpath = '';
|
123 |
+
if ( $this->currentFileInfo && $this->currentFileInfo['rootpath'] ) {
|
124 |
$rootpath = $this->currentFileInfo['rootpath'];
|
125 |
}
|
126 |
|
127 |
+
if ( !( $path instanceof Less_Tree_URL ) ) {
|
128 |
+
if ( $rootpath ) {
|
|
|
129 |
$pathValue = $path->value;
|
130 |
// Add the base path if the import is relative
|
131 |
+
if ( $pathValue && Less_Environment::isPathRelative( $pathValue ) ) {
|
132 |
$path->value = $this->currentFileInfo['uri_root'].$pathValue;
|
133 |
}
|
134 |
}
|
135 |
+
$path->value = Less_Environment::normalizePath( $path->value );
|
136 |
}
|
137 |
|
|
|
|
|
138 |
return $path;
|
139 |
}
|
140 |
|
141 |
+
public function compile( $env ) {
|
142 |
+
$evald = $this->compileForImport( $env );
|
|
|
143 |
|
144 |
+
// get path & uri
|
145 |
$path_and_uri = null;
|
146 |
+
if ( is_callable( Less_Parser::$options['import_callback'] ) ) {
|
147 |
+
$path_and_uri = call_user_func( Less_Parser::$options['import_callback'], $evald );
|
148 |
}
|
149 |
|
150 |
+
if ( !$path_and_uri ) {
|
151 |
$path_and_uri = $evald->PathAndUri();
|
152 |
}
|
153 |
|
154 |
+
if ( $path_and_uri ) {
|
155 |
+
list( $full_path, $uri ) = $path_and_uri;
|
156 |
+
} else {
|
157 |
$full_path = $uri = $evald->getPath();
|
158 |
}
|
159 |
|
160 |
+
// import once
|
161 |
+
if ( $evald->skip( $full_path, $env ) ) {
|
|
|
162 |
return array();
|
163 |
}
|
164 |
|
165 |
+
if ( $this->options['inline'] ) {
|
166 |
+
// todo needs to reference css file not import
|
167 |
//$contents = new Less_Tree_Anonymous($this->root, 0, array('filename'=>$this->importedFilename), true );
|
168 |
|
169 |
+
Less_Parser::AddParsedFile( $full_path );
|
170 |
+
$contents = new Less_Tree_Anonymous( file_get_contents( $full_path ), 0, array(), true );
|
171 |
|
172 |
+
if ( $this->features ) {
|
173 |
+
return new Less_Tree_Media( array( $contents ), $this->features->value );
|
174 |
}
|
175 |
|
176 |
return array( $contents );
|
177 |
}
|
178 |
|
179 |
// optional (need to be before "CSS" to support optional CSS imports. CSS should be checked only if empty($this->currentFileInfo))
|
180 |
+
if ( isset( $this->options['optional'] ) && $this->options['optional'] && !file_exists( $full_path ) && ( !$evald->css || !empty( $this->currentFileInfo ) ) ) {
|
181 |
return array();
|
182 |
}
|
183 |
|
|
|
184 |
// css ?
|
185 |
+
if ( $evald->css ) {
|
186 |
+
$features = ( $evald->features ? $evald->features->compile( $env ) : null );
|
187 |
+
return new Less_Tree_Import( $this->compilePath( $env ), $features, $this->options, $this->index );
|
188 |
}
|
189 |
|
|
|
190 |
return $this->ParseImport( $full_path, $uri, $env );
|
191 |
}
|
192 |
|
|
|
193 |
/**
|
194 |
* Using the import directories, get the full absolute path and uri of the import
|
195 |
*
|
196 |
* @param Less_Tree_Import $evald
|
197 |
*/
|
198 |
+
public function PathAndUri() {
|
|
|
199 |
$evald_path = $this->getPath();
|
200 |
|
201 |
+
if ( $evald_path ) {
|
202 |
|
203 |
$import_dirs = array();
|
204 |
|
205 |
+
if ( Less_Environment::isPathRelative( $evald_path ) ) {
|
206 |
+
// if the path is relative, the file should be in the current directory
|
207 |
+
if ( $this->currentFileInfo ) {
|
208 |
$import_dirs[ $this->currentFileInfo['currentDirectory'] ] = $this->currentFileInfo['uri_root'];
|
209 |
}
|
210 |
|
211 |
+
} else {
|
212 |
+
// otherwise, the file should be relative to the server root
|
213 |
+
if ( $this->currentFileInfo ) {
|
214 |
$import_dirs[ $this->currentFileInfo['entryPath'] ] = $this->currentFileInfo['entryUri'];
|
215 |
}
|
216 |
+
// if the user supplied entryPath isn't the actual root
|
217 |
$import_dirs[ $_SERVER['DOCUMENT_ROOT'] ] = '';
|
218 |
|
219 |
}
|
221 |
// always look in user supplied import directories
|
222 |
$import_dirs = array_merge( $import_dirs, Less_Parser::$options['import_dirs'] );
|
223 |
|
224 |
+
foreach ( $import_dirs as $rootpath => $rooturi ) {
|
225 |
+
if ( is_callable( $rooturi ) ) {
|
226 |
+
list( $path, $uri ) = call_user_func( $rooturi, $evald_path );
|
227 |
+
if ( is_string( $path ) ) {
|
|
|
228 |
$full_path = $path;
|
229 |
return array( $full_path, $uri );
|
230 |
}
|
231 |
+
} elseif ( !empty( $rootpath ) ) {
|
232 |
|
233 |
+
$path = rtrim( $rootpath, '/\\' ).'/'.ltrim( $evald_path, '/\\' );
|
234 |
|
235 |
+
if ( file_exists( $path ) ) {
|
236 |
+
$full_path = Less_Environment::normalizePath( $path );
|
237 |
+
$uri = Less_Environment::normalizePath( dirname( $rooturi.$evald_path ) );
|
238 |
return array( $full_path, $uri );
|
239 |
+
} elseif ( file_exists( $path.'.less' ) ) {
|
240 |
+
$full_path = Less_Environment::normalizePath( $path.'.less' );
|
241 |
+
$uri = Less_Environment::normalizePath( dirname( $rooturi.$evald_path.'.less' ) );
|
242 |
return array( $full_path, $uri );
|
243 |
}
|
244 |
}
|
246 |
}
|
247 |
}
|
248 |
|
|
|
249 |
/**
|
250 |
* Parse the import url and return the rules
|
251 |
*
|
252 |
* @return Less_Tree_Media|array
|
253 |
*/
|
254 |
+
public function ParseImport( $full_path, $uri, $env ) {
|
|
|
255 |
$import_env = clone $env;
|
256 |
+
if ( ( isset( $this->options['reference'] ) && $this->options['reference'] ) || isset( $this->currentFileInfo['reference'] ) ) {
|
257 |
$import_env->currentFileInfo['reference'] = true;
|
258 |
}
|
259 |
|
260 |
+
if ( ( isset( $this->options['multiple'] ) && $this->options['multiple'] ) ) {
|
261 |
$import_env->importMultiple = true;
|
262 |
}
|
263 |
|
264 |
+
$parser = new Less_Parser( $import_env );
|
265 |
+
$root = $parser->parseFile( $full_path, $uri, true );
|
|
|
266 |
|
267 |
+
$ruleset = new Less_Tree_Ruleset( array(), $root->rules );
|
268 |
+
$ruleset->evalImports( $import_env );
|
269 |
|
270 |
+
return $this->features ? new Less_Tree_Media( $ruleset->rules, $this->features->value ) : $ruleset->rules;
|
271 |
}
|
272 |
|
|
|
273 |
/**
|
274 |
* Should the import be skipped?
|
275 |
*
|
276 |
* @return boolean|null
|
277 |
*/
|
278 |
+
private function Skip( $path, $env ) {
|
279 |
+
$path = Less_Parser::AbsPath( $path, true );
|
|
|
280 |
|
281 |
+
if ( $path && Less_Parser::FileParsed( $path ) ) {
|
282 |
|
283 |
+
if ( isset( $this->currentFileInfo['reference'] ) ) {
|
284 |
return true;
|
285 |
}
|
286 |
|
287 |
+
return !isset( $this->options['multiple'] ) && !$env->importMultiple;
|
288 |
}
|
289 |
|
290 |
}
|
base/inc/lib/Less/Tree/Javascript.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Javascript extends Less_Tree{
|
10 |
|
11 |
public $type = 'Javascript';
|
12 |
public $escaped;
|
@@ -17,14 +17,14 @@ class Less_Tree_Javascript extends Less_Tree{
|
|
17 |
* @param boolean $index
|
18 |
* @param boolean $escaped
|
19 |
*/
|
20 |
-
public function __construct($string, $index, $escaped){
|
21 |
$this->escaped = $escaped;
|
22 |
$this->expression = $string;
|
23 |
$this->index = $index;
|
24 |
}
|
25 |
|
26 |
-
public function compile(){
|
27 |
-
return new Less_Tree_Anonymous('/* Sorry, can not do JavaScript evaluation in PHP... :( */');
|
28 |
}
|
29 |
|
30 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Javascript extends Less_Tree {
|
10 |
|
11 |
public $type = 'Javascript';
|
12 |
public $escaped;
|
17 |
* @param boolean $index
|
18 |
* @param boolean $escaped
|
19 |
*/
|
20 |
+
public function __construct( $string, $index, $escaped ) {
|
21 |
$this->escaped = $escaped;
|
22 |
$this->expression = $string;
|
23 |
$this->index = $index;
|
24 |
}
|
25 |
|
26 |
+
public function compile() {
|
27 |
+
return new Less_Tree_Anonymous( '/* Sorry, can not do JavaScript evaluation in PHP... :( */' );
|
28 |
}
|
29 |
|
30 |
}
|
base/inc/lib/Less/Tree/Keyword.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Keyword extends Less_Tree{
|
10 |
|
11 |
public $value;
|
12 |
public $type = 'Keyword';
|
@@ -14,28 +14,27 @@ class Less_Tree_Keyword extends Less_Tree{
|
|
14 |
/**
|
15 |
* @param string $value
|
16 |
*/
|
17 |
-
public function __construct($value){
|
18 |
$this->value = $value;
|
19 |
}
|
20 |
|
21 |
-
public function compile(){
|
22 |
return $this;
|
23 |
}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
public function genCSS( $output ){
|
29 |
-
|
30 |
-
|
31 |
-
throw new Less_Exception_Compiler("Invalid % without number");
|
32 |
}
|
33 |
|
34 |
$output->add( $this->value );
|
35 |
}
|
36 |
|
37 |
-
public function compare($other) {
|
38 |
-
if ($other instanceof Less_Tree_Keyword) {
|
39 |
return $other->value === $this->value ? 0 : 1;
|
40 |
} else {
|
41 |
return -1;
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Keyword extends Less_Tree {
|
10 |
|
11 |
public $value;
|
12 |
public $type = 'Keyword';
|
14 |
/**
|
15 |
* @param string $value
|
16 |
*/
|
17 |
+
public function __construct( $value ) {
|
18 |
$this->value = $value;
|
19 |
}
|
20 |
|
21 |
+
public function compile() {
|
22 |
return $this;
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* @see Less_Tree::genCSS
|
27 |
+
*/
|
28 |
+
public function genCSS( $output ) {
|
29 |
+
if ( $this->value === '%' ) {
|
30 |
+
throw new Less_Exception_Compiler( "Invalid % without number" );
|
|
|
31 |
}
|
32 |
|
33 |
$output->add( $this->value );
|
34 |
}
|
35 |
|
36 |
+
public function compare( $other ) {
|
37 |
+
if ( $other instanceof Less_Tree_Keyword ) {
|
38 |
return $other->value === $this->value ? 0 : 1;
|
39 |
} else {
|
40 |
return -1;
|
base/inc/lib/Less/Tree/Media.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Media extends Less_Tree{
|
10 |
|
11 |
public $features;
|
12 |
public $rules;
|
@@ -15,91 +15,88 @@ class Less_Tree_Media extends Less_Tree{
|
|
15 |
public $isReferenced;
|
16 |
public $type = 'Media';
|
17 |
|
18 |
-
public function __construct($value = array(), $features = array(), $index = null, $currentFileInfo = null ){
|
19 |
-
|
20 |
$this->index = $index;
|
21 |
$this->currentFileInfo = $currentFileInfo;
|
22 |
|
23 |
$selectors = $this->emptySelectors();
|
24 |
|
25 |
-
$this->features = new Less_Tree_Value($features);
|
26 |
|
27 |
-
$this->rules = array(new Less_Tree_Ruleset($selectors, $value));
|
28 |
$this->rules[0]->allowImports = true;
|
29 |
}
|
30 |
|
31 |
-
|
32 |
-
$this->features = $visitor->visitObj($this->features);
|
33 |
-
$this->rules = $visitor->visitArray($this->rules);
|
34 |
}
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
$output->add( '@media ', $this->currentFileInfo, $this->index );
|
42 |
$this->features->genCSS( $output );
|
43 |
-
Less_Tree::outputRuleset( $output, $this->rules);
|
44 |
|
45 |
}
|
46 |
|
47 |
-
public function compile($env) {
|
48 |
-
|
49 |
-
$media = new Less_Tree_Media(array(), array(), $this->index, $this->currentFileInfo );
|
50 |
|
51 |
$strictMathBypass = false;
|
52 |
-
if( Less_Parser::$options['strictMath'] === false) {
|
53 |
$strictMathBypass = true;
|
54 |
Less_Parser::$options['strictMath'] = true;
|
55 |
}
|
56 |
|
57 |
-
$media->features = $this->features->compile($env);
|
58 |
|
59 |
-
if( $strictMathBypass ){
|
60 |
Less_Parser::$options['strictMath'] = false;
|
61 |
}
|
62 |
|
63 |
$env->mediaPath[] = $media;
|
64 |
$env->mediaBlocks[] = $media;
|
65 |
|
66 |
-
array_unshift($env->frames, $this->rules[0]);
|
67 |
-
$media->rules = array($this->rules[0]->compile($env));
|
68 |
-
array_shift($env->frames);
|
69 |
|
70 |
-
array_pop($env->mediaPath);
|
71 |
|
72 |
-
return !$env->mediaPath ? $media->compileTop($env) : $media->compileNested($env);
|
73 |
}
|
74 |
|
75 |
-
public function variable($name) {
|
76 |
-
return $this->rules[0]->variable($name);
|
77 |
}
|
78 |
|
79 |
-
public function find($selector) {
|
80 |
-
return $this->rules[0]->find($selector, $this);
|
81 |
}
|
82 |
|
83 |
-
public function emptySelectors(){
|
84 |
-
$el = new Less_Tree_Element('','&', $this->index, $this->currentFileInfo );
|
85 |
-
$sels = array( new Less_Tree_Selector(array($el), array(), null, $this->index, $this->currentFileInfo) );
|
86 |
$sels[0]->mediaEmpty = true;
|
87 |
-
|
88 |
}
|
89 |
|
90 |
-
public function markReferenced(){
|
91 |
$this->rules[0]->markReferenced();
|
92 |
$this->isReferenced = true;
|
93 |
-
Less_Tree::ReferencedArray($this->rules[0]->rules);
|
94 |
}
|
95 |
|
96 |
// evaltop
|
97 |
-
public function compileTop($env) {
|
98 |
$result = $this;
|
99 |
|
100 |
-
if (count($env->mediaBlocks) > 1) {
|
101 |
$selectors = $this->emptySelectors();
|
102 |
-
$result = new Less_Tree_Ruleset($selectors, $env->mediaBlocks);
|
103 |
$result->multiMedia = true;
|
104 |
}
|
105 |
|
@@ -109,13 +106,13 @@ class Less_Tree_Media extends Less_Tree{
|
|
109 |
return $result;
|
110 |
}
|
111 |
|
112 |
-
public function compileNested($env) {
|
113 |
-
$path = array_merge($env->mediaPath, array($this));
|
114 |
|
115 |
// Extract the media-query conditions separated with `,` (OR).
|
116 |
-
foreach ($path as $key => $p) {
|
117 |
$value = $p->features instanceof Less_Tree_Value ? $p->features->value : $p->features;
|
118 |
-
$path[$key] = is_array($value) ? $value : array($value);
|
119 |
}
|
120 |
|
121 |
// Trace all permutations to generate the resulting media-query.
|
@@ -126,42 +123,40 @@ class Less_Tree_Media extends Less_Tree{
|
|
126 |
// b and c and d
|
127 |
// b and c and e
|
128 |
|
129 |
-
$permuted = $this->permute($path);
|
130 |
$expressions = array();
|
131 |
-
foreach($permuted as $path){
|
132 |
|
133 |
-
for( $i=0, $len=count($path); $i < $len; $i++){
|
134 |
-
$path[$i] = Less_Parser::is_method($path[$i], 'toCSS') ? $path[$i] : new Less_Tree_Anonymous($path[$i]);
|
135 |
}
|
136 |
|
137 |
-
for( $i = count($path) - 1; $i > 0; $i-- ){
|
138 |
-
array_splice($path, $i, 0, array(new Less_Tree_Anonymous('and')));
|
139 |
}
|
140 |
|
141 |
-
$expressions[] = new Less_Tree_Expression($path);
|
142 |
}
|
143 |
-
$this->features = new Less_Tree_Value($expressions);
|
144 |
-
|
145 |
-
|
146 |
|
147 |
// Fake a tree-node that doesn't output anything.
|
148 |
-
return new Less_Tree_Ruleset(array(), array());
|
149 |
}
|
150 |
|
151 |
-
public function permute($arr) {
|
152 |
-
if (!$arr)
|
153 |
return array();
|
154 |
|
155 |
-
if (count($arr) == 1)
|
156 |
return $arr[0];
|
157 |
|
158 |
$result = array();
|
159 |
-
$rest = $this->permute(array_slice($arr, 1));
|
160 |
-
foreach ($rest as $r) {
|
161 |
-
foreach ($arr[0] as $a) {
|
162 |
$result[] = array_merge(
|
163 |
-
is_array($a) ? $a : array($a),
|
164 |
-
is_array($r) ? $r : array($r)
|
165 |
);
|
166 |
}
|
167 |
}
|
@@ -169,11 +164,10 @@ class Less_Tree_Media extends Less_Tree{
|
|
169 |
return $result;
|
170 |
}
|
171 |
|
172 |
-
|
173 |
-
|
174 |
-
if( !$selectors) return;
|
175 |
|
176 |
-
$this->rules = array(new Less_Tree_Ruleset( $selectors, array($this->rules[0])));
|
177 |
}
|
178 |
|
179 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Media extends Less_Tree {
|
10 |
|
11 |
public $features;
|
12 |
public $rules;
|
15 |
public $isReferenced;
|
16 |
public $type = 'Media';
|
17 |
|
18 |
+
public function __construct( $value = array(), $features = array(), $index = null, $currentFileInfo = null ) {
|
|
|
19 |
$this->index = $index;
|
20 |
$this->currentFileInfo = $currentFileInfo;
|
21 |
|
22 |
$selectors = $this->emptySelectors();
|
23 |
|
24 |
+
$this->features = new Less_Tree_Value( $features );
|
25 |
|
26 |
+
$this->rules = array( new Less_Tree_Ruleset( $selectors, $value ) );
|
27 |
$this->rules[0]->allowImports = true;
|
28 |
}
|
29 |
|
30 |
+
public function accept( $visitor ) {
|
31 |
+
$this->features = $visitor->visitObj( $this->features );
|
32 |
+
$this->rules = $visitor->visitArray( $this->rules );
|
33 |
}
|
34 |
|
35 |
+
/**
|
36 |
+
* @see Less_Tree::genCSS
|
37 |
+
*/
|
38 |
+
public function genCSS( $output ) {
|
|
|
39 |
$output->add( '@media ', $this->currentFileInfo, $this->index );
|
40 |
$this->features->genCSS( $output );
|
41 |
+
Less_Tree::outputRuleset( $output, $this->rules );
|
42 |
|
43 |
}
|
44 |
|
45 |
+
public function compile( $env ) {
|
46 |
+
$media = new Less_Tree_Media( array(), array(), $this->index, $this->currentFileInfo );
|
|
|
47 |
|
48 |
$strictMathBypass = false;
|
49 |
+
if ( Less_Parser::$options['strictMath'] === false ) {
|
50 |
$strictMathBypass = true;
|
51 |
Less_Parser::$options['strictMath'] = true;
|
52 |
}
|
53 |
|
54 |
+
$media->features = $this->features->compile( $env );
|
55 |
|
56 |
+
if ( $strictMathBypass ) {
|
57 |
Less_Parser::$options['strictMath'] = false;
|
58 |
}
|
59 |
|
60 |
$env->mediaPath[] = $media;
|
61 |
$env->mediaBlocks[] = $media;
|
62 |
|
63 |
+
array_unshift( $env->frames, $this->rules[0] );
|
64 |
+
$media->rules = array( $this->rules[0]->compile( $env ) );
|
65 |
+
array_shift( $env->frames );
|
66 |
|
67 |
+
array_pop( $env->mediaPath );
|
68 |
|
69 |
+
return !$env->mediaPath ? $media->compileTop( $env ) : $media->compileNested( $env );
|
70 |
}
|
71 |
|
72 |
+
public function variable( $name ) {
|
73 |
+
return $this->rules[0]->variable( $name );
|
74 |
}
|
75 |
|
76 |
+
public function find( $selector ) {
|
77 |
+
return $this->rules[0]->find( $selector, $this );
|
78 |
}
|
79 |
|
80 |
+
public function emptySelectors() {
|
81 |
+
$el = new Less_Tree_Element( '', '&', $this->index, $this->currentFileInfo );
|
82 |
+
$sels = array( new Less_Tree_Selector( array( $el ), array(), null, $this->index, $this->currentFileInfo ) );
|
83 |
$sels[0]->mediaEmpty = true;
|
84 |
+
return $sels;
|
85 |
}
|
86 |
|
87 |
+
public function markReferenced() {
|
88 |
$this->rules[0]->markReferenced();
|
89 |
$this->isReferenced = true;
|
90 |
+
Less_Tree::ReferencedArray( $this->rules[0]->rules );
|
91 |
}
|
92 |
|
93 |
// evaltop
|
94 |
+
public function compileTop( $env ) {
|
95 |
$result = $this;
|
96 |
|
97 |
+
if ( count( $env->mediaBlocks ) > 1 ) {
|
98 |
$selectors = $this->emptySelectors();
|
99 |
+
$result = new Less_Tree_Ruleset( $selectors, $env->mediaBlocks );
|
100 |
$result->multiMedia = true;
|
101 |
}
|
102 |
|
106 |
return $result;
|
107 |
}
|
108 |
|
109 |
+
public function compileNested( $env ) {
|
110 |
+
$path = array_merge( $env->mediaPath, array( $this ) );
|
111 |
|
112 |
// Extract the media-query conditions separated with `,` (OR).
|
113 |
+
foreach ( $path as $key => $p ) {
|
114 |
$value = $p->features instanceof Less_Tree_Value ? $p->features->value : $p->features;
|
115 |
+
$path[$key] = is_array( $value ) ? $value : array( $value );
|
116 |
}
|
117 |
|
118 |
// Trace all permutations to generate the resulting media-query.
|
123 |
// b and c and d
|
124 |
// b and c and e
|
125 |
|
126 |
+
$permuted = $this->permute( $path );
|
127 |
$expressions = array();
|
128 |
+
foreach ( $permuted as $path ) {
|
129 |
|
130 |
+
for ( $i = 0, $len = count( $path ); $i < $len; $i++ ) {
|
131 |
+
$path[$i] = Less_Parser::is_method( $path[$i], 'toCSS' ) ? $path[$i] : new Less_Tree_Anonymous( $path[$i] );
|
132 |
}
|
133 |
|
134 |
+
for ( $i = count( $path ) - 1; $i > 0; $i-- ) {
|
135 |
+
array_splice( $path, $i, 0, array( new Less_Tree_Anonymous( 'and' ) ) );
|
136 |
}
|
137 |
|
138 |
+
$expressions[] = new Less_Tree_Expression( $path );
|
139 |
}
|
140 |
+
$this->features = new Less_Tree_Value( $expressions );
|
|
|
|
|
141 |
|
142 |
// Fake a tree-node that doesn't output anything.
|
143 |
+
return new Less_Tree_Ruleset( array(), array() );
|
144 |
}
|
145 |
|
146 |
+
public function permute( $arr ) {
|
147 |
+
if ( !$arr )
|
148 |
return array();
|
149 |
|
150 |
+
if ( count( $arr ) == 1 )
|
151 |
return $arr[0];
|
152 |
|
153 |
$result = array();
|
154 |
+
$rest = $this->permute( array_slice( $arr, 1 ) );
|
155 |
+
foreach ( $rest as $r ) {
|
156 |
+
foreach ( $arr[0] as $a ) {
|
157 |
$result[] = array_merge(
|
158 |
+
is_array( $a ) ? $a : array( $a ),
|
159 |
+
is_array( $r ) ? $r : array( $r )
|
160 |
);
|
161 |
}
|
162 |
}
|
164 |
return $result;
|
165 |
}
|
166 |
|
167 |
+
public function bubbleSelectors( $selectors ) {
|
168 |
+
if ( !$selectors ) return;
|
|
|
169 |
|
170 |
+
$this->rules = array( new Less_Tree_Ruleset( $selectors, array( $this->rules[0] ) ) );
|
171 |
}
|
172 |
|
173 |
}
|
base/inc/lib/Less/Tree/Mixin/Call.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
-
class Less_Tree_Mixin_Call extends Less_Tree{
|
5 |
|
6 |
public $selector;
|
7 |
public $arguments;
|
@@ -15,22 +14,20 @@ class Less_Tree_Mixin_Call extends Less_Tree{
|
|
15 |
* less.js: tree.mixin.Call
|
16 |
*
|
17 |
*/
|
18 |
-
public function __construct($elements, $args, $index, $currentFileInfo, $important = false){
|
19 |
-
$this->selector = new Less_Tree_Selector($elements);
|
20 |
$this->arguments = $args;
|
21 |
$this->index = $index;
|
22 |
$this->currentFileInfo = $currentFileInfo;
|
23 |
$this->important = $important;
|
24 |
}
|
25 |
|
26 |
-
//function accept($visitor){
|
27 |
// $this->selector = $visitor->visit($this->selector);
|
28 |
// $this->arguments = $visitor->visit($this->arguments);
|
29 |
//}
|
30 |
|
31 |
-
|
32 |
-
public function compile($env){
|
33 |
-
|
34 |
$rules = array();
|
35 |
$match = false;
|
36 |
$isOneFound = false;
|
@@ -39,15 +36,15 @@ class Less_Tree_Mixin_Call extends Less_Tree{
|
|
39 |
$conditionResult = array();
|
40 |
|
41 |
$args = array();
|
42 |
-
foreach($this->arguments as $a){
|
43 |
-
$args[] = array('name'=> $a['name'], 'value' => $a['value']->compile($env) );
|
44 |
}
|
45 |
|
46 |
-
foreach($env->frames as $frame){
|
47 |
|
48 |
-
$mixins = $frame->find($this->selector);
|
49 |
|
50 |
-
if( !$mixins ){
|
51 |
continue;
|
52 |
}
|
53 |
|
@@ -61,32 +58,32 @@ class Less_Tree_Mixin_Call extends Less_Tree{
|
|
61 |
// and build candidate list with corresponding flags. Then, when we know all possible matches,
|
62 |
// we make a final decision.
|
63 |
|
64 |
-
$mixins_len = count($mixins);
|
65 |
-
for( $m = 0; $m < $mixins_len; $m++ ){
|
66 |
$mixin = $mixins[$m];
|
67 |
|
68 |
-
if( $this->IsRecursive( $env, $mixin ) ){
|
69 |
continue;
|
70 |
}
|
71 |
|
72 |
-
if( $mixin->matchArgs($args, $env) ){
|
73 |
|
74 |
-
$candidate = array('mixin' => $mixin, 'group' => $defNone);
|
75 |
|
76 |
-
if( $mixin instanceof Less_Tree_Ruleset ){
|
77 |
|
78 |
-
for( $f = 0; $f < 2; $f++ ){
|
79 |
-
Less_Tree_DefaultFunc::value($f);
|
80 |
-
$conditionResult[$f] = $mixin->matchCondition( $args, $env);
|
81 |
}
|
82 |
-
if( $conditionResult[0] || $conditionResult[1] ){
|
83 |
-
if( $conditionResult[0] != $conditionResult[1] ){
|
84 |
$candidate['group'] = $conditionResult[1] ? $defTrue : $defFalse;
|
85 |
}
|
86 |
|
87 |
$candidates[] = $candidate;
|
88 |
}
|
89 |
-
}else{
|
90 |
$candidates[] = $candidate;
|
91 |
}
|
92 |
|
@@ -96,56 +93,54 @@ class Less_Tree_Mixin_Call extends Less_Tree{
|
|
96 |
|
97 |
Less_Tree_DefaultFunc::reset();
|
98 |
|
99 |
-
|
100 |
-
$
|
101 |
-
for( $m = 0; $m < count($candidates); $m++ ){
|
102 |
$count[ $candidates[$m]['group'] ]++;
|
103 |
}
|
104 |
|
105 |
-
if( $count[$defNone] > 0 ){
|
106 |
$defaultResult = $defFalse;
|
107 |
} else {
|
108 |
$defaultResult = $defTrue;
|
109 |
-
if( ($count[$defTrue] + $count[$defFalse]) > 1 ){
|
110 |
-
throw new Exception( 'Ambiguous use of `default()` found when matching for `' . $this->format($args) . '`' );
|
111 |
}
|
112 |
}
|
113 |
|
|
|
|
|
114 |
|
115 |
-
$
|
116 |
-
$length_1 = ($candidates_length == 1);
|
117 |
-
|
118 |
-
for( $m = 0; $m < $candidates_length; $m++){
|
119 |
$candidate = $candidates[$m]['group'];
|
120 |
-
if( ($candidate === $defNone) || ($candidate === $defaultResult) ){
|
121 |
try{
|
122 |
$mixin = $candidates[$m]['mixin'];
|
123 |
-
if( !($mixin instanceof Less_Tree_Mixin_Definition) ){
|
124 |
-
$mixin = new Less_Tree_Mixin_Definition('', array(), $mixin->rules, null, false);
|
125 |
$mixin->originalRuleset = $mixins[$m]->originalRuleset;
|
126 |
}
|
127 |
-
$rules = array_merge($rules, $mixin->evalCall($env, $args, $this->important)->rules);
|
128 |
-
} catch (Exception $e) {
|
129 |
-
//throw new Less_Exception_Compiler($e->getMessage(), $e->index, null, $this->currentFileInfo['filename']);
|
130 |
-
throw new Less_Exception_Compiler($e->getMessage(), null, null, $this->currentFileInfo);
|
131 |
}
|
132 |
}
|
133 |
}
|
134 |
|
135 |
-
if( $match ){
|
136 |
-
if( !$this->currentFileInfo || !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference'] ){
|
137 |
-
Less_Tree::ReferencedArray($rules);
|
138 |
}
|
139 |
|
140 |
return $rules;
|
141 |
}
|
142 |
}
|
143 |
|
144 |
-
if( $isOneFound ){
|
145 |
-
throw new Less_Exception_Compiler('No matching definition was found for `'.$this->Format( $args ).'`', null, $this->index, $this->currentFileInfo);
|
146 |
|
147 |
-
}else{
|
148 |
-
throw new Less_Exception_Compiler(trim($this->selector->toCSS()) . " is undefined in ".$this->currentFileInfo['filename'], null, $this->index);
|
149 |
}
|
150 |
|
151 |
}
|
@@ -154,41 +149,39 @@ class Less_Tree_Mixin_Call extends Less_Tree{
|
|
154 |
* Format the args for use in exception messages
|
155 |
*
|
156 |
*/
|
157 |
-
private function Format($args){
|
158 |
$message = array();
|
159 |
-
if( $args ){
|
160 |
-
foreach($args as $a){
|
161 |
$argValue = '';
|
162 |
-
if( $a['name'] ){
|
163 |
$argValue .= $a['name'] . ':';
|
164 |
}
|
165 |
-
if( is_object($a['value']) ){
|
166 |
$argValue .= $a['value']->toCSS();
|
167 |
-
}else{
|
168 |
$argValue .= '???';
|
169 |
}
|
170 |
$message[] = $argValue;
|
171 |
}
|
172 |
}
|
173 |
-
return implode(', '
|
174 |
}
|
175 |
|
176 |
-
|
177 |
/**
|
178 |
* Are we in a recursive mixin call?
|
179 |
*
|
180 |
* @return bool
|
181 |
*/
|
182 |
-
private function IsRecursive( $env, $mixin ){
|
183 |
-
|
184 |
-
|
185 |
-
if( !($mixin instanceof Less_Tree_Mixin_Definition) ){
|
186 |
|
187 |
-
if( $mixin === $recur_frame ){
|
188 |
return true;
|
189 |
}
|
190 |
|
191 |
-
if( isset($recur_frame->originalRuleset) && $mixin->ruleset_id === $recur_frame->originalRuleset ){
|
192 |
return true;
|
193 |
}
|
194 |
}
|
@@ -198,5 +191,3 @@ class Less_Tree_Mixin_Call extends Less_Tree{
|
|
198 |
}
|
199 |
|
200 |
}
|
201 |
-
|
202 |
-
|
1 |
<?php
|
2 |
|
3 |
+
class Less_Tree_Mixin_Call extends Less_Tree {
|
|
|
4 |
|
5 |
public $selector;
|
6 |
public $arguments;
|
14 |
* less.js: tree.mixin.Call
|
15 |
*
|
16 |
*/
|
17 |
+
public function __construct( $elements, $args, $index, $currentFileInfo, $important = false ) {
|
18 |
+
$this->selector = new Less_Tree_Selector( $elements );
|
19 |
$this->arguments = $args;
|
20 |
$this->index = $index;
|
21 |
$this->currentFileInfo = $currentFileInfo;
|
22 |
$this->important = $important;
|
23 |
}
|
24 |
|
25 |
+
// function accept($visitor){
|
26 |
// $this->selector = $visitor->visit($this->selector);
|
27 |
// $this->arguments = $visitor->visit($this->arguments);
|
28 |
//}
|
29 |
|
30 |
+
public function compile( $env ) {
|
|
|
|
|
31 |
$rules = array();
|
32 |
$match = false;
|
33 |
$isOneFound = false;
|
36 |
$conditionResult = array();
|
37 |
|
38 |
$args = array();
|
39 |
+
foreach ( $this->arguments as $a ) {
|
40 |
+
$args[] = array( 'name' => $a['name'], 'value' => $a['value']->compile( $env ) );
|
41 |
}
|
42 |
|
43 |
+
foreach ( $env->frames as $frame ) {
|
44 |
|
45 |
+
$mixins = $frame->find( $this->selector );
|
46 |
|
47 |
+
if ( !$mixins ) {
|
48 |
continue;
|
49 |
}
|
50 |
|
58 |
// and build candidate list with corresponding flags. Then, when we know all possible matches,
|
59 |
// we make a final decision.
|
60 |
|
61 |
+
$mixins_len = count( $mixins );
|
62 |
+
for ( $m = 0; $m < $mixins_len; $m++ ) {
|
63 |
$mixin = $mixins[$m];
|
64 |
|
65 |
+
if ( $this->IsRecursive( $env, $mixin ) ) {
|
66 |
continue;
|
67 |
}
|
68 |
|
69 |
+
if ( $mixin->matchArgs( $args, $env ) ) {
|
70 |
|
71 |
+
$candidate = array( 'mixin' => $mixin, 'group' => $defNone );
|
72 |
|
73 |
+
if ( $mixin instanceof Less_Tree_Ruleset ) {
|
74 |
|
75 |
+
for ( $f = 0; $f < 2; $f++ ) {
|
76 |
+
Less_Tree_DefaultFunc::value( $f );
|
77 |
+
$conditionResult[$f] = $mixin->matchCondition( $args, $env );
|
78 |
}
|
79 |
+
if ( $conditionResult[0] || $conditionResult[1] ) {
|
80 |
+
if ( $conditionResult[0] != $conditionResult[1] ) {
|
81 |
$candidate['group'] = $conditionResult[1] ? $defTrue : $defFalse;
|
82 |
}
|
83 |
|
84 |
$candidates[] = $candidate;
|
85 |
}
|
86 |
+
} else {
|
87 |
$candidates[] = $candidate;
|
88 |
}
|
89 |
|
93 |
|
94 |
Less_Tree_DefaultFunc::reset();
|
95 |
|
96 |
+
$count = array( 0, 0, 0 );
|
97 |
+
for ( $m = 0; $m < count( $candidates ); $m++ ) {
|
|
|
98 |
$count[ $candidates[$m]['group'] ]++;
|
99 |
}
|
100 |
|
101 |
+
if ( $count[$defNone] > 0 ) {
|
102 |
$defaultResult = $defFalse;
|
103 |
} else {
|
104 |
$defaultResult = $defTrue;
|
105 |
+
if ( ( $count[$defTrue] + $count[$defFalse] ) > 1 ) {
|
106 |
+
throw new Exception( 'Ambiguous use of `default()` found when matching for `' . $this->format( $args ) . '`' );
|
107 |
}
|
108 |
}
|
109 |
|
110 |
+
$candidates_length = count( $candidates );
|
111 |
+
$length_1 = ( $candidates_length == 1 );
|
112 |
|
113 |
+
for ( $m = 0; $m < $candidates_length; $m++ ) {
|
|
|
|
|
|
|
114 |
$candidate = $candidates[$m]['group'];
|
115 |
+
if ( ( $candidate === $defNone ) || ( $candidate === $defaultResult ) ) {
|
116 |
try{
|
117 |
$mixin = $candidates[$m]['mixin'];
|
118 |
+
if ( !( $mixin instanceof Less_Tree_Mixin_Definition ) ) {
|
119 |
+
$mixin = new Less_Tree_Mixin_Definition( '', array(), $mixin->rules, null, false );
|
120 |
$mixin->originalRuleset = $mixins[$m]->originalRuleset;
|
121 |
}
|
122 |
+
$rules = array_merge( $rules, $mixin->evalCall( $env, $args, $this->important )->rules );
|
123 |
+
} catch ( Exception $e ) {
|
124 |
+
// throw new Less_Exception_Compiler($e->getMessage(), $e->index, null, $this->currentFileInfo['filename']);
|
125 |
+
throw new Less_Exception_Compiler( $e->getMessage(), null, null, $this->currentFileInfo );
|
126 |
}
|
127 |
}
|
128 |
}
|
129 |
|
130 |
+
if ( $match ) {
|
131 |
+
if ( !$this->currentFileInfo || !isset( $this->currentFileInfo['reference'] ) || !$this->currentFileInfo['reference'] ) {
|
132 |
+
Less_Tree::ReferencedArray( $rules );
|
133 |
}
|
134 |
|
135 |
return $rules;
|
136 |
}
|
137 |
}
|
138 |
|
139 |
+
if ( $isOneFound ) {
|
140 |
+
throw new Less_Exception_Compiler( 'No matching definition was found for `'.$this->Format( $args ).'`', null, $this->index, $this->currentFileInfo );
|
141 |
|
142 |
+
} else {
|
143 |
+
throw new Less_Exception_Compiler( trim( $this->selector->toCSS() ) . " is undefined in ".$this->currentFileInfo['filename'], null, $this->index );
|
144 |
}
|
145 |
|
146 |
}
|
149 |
* Format the args for use in exception messages
|
150 |
*
|
151 |
*/
|
152 |
+
private function Format( $args ) {
|
153 |
$message = array();
|
154 |
+
if ( $args ) {
|
155 |
+
foreach ( $args as $a ) {
|
156 |
$argValue = '';
|
157 |
+
if ( $a['name'] ) {
|
158 |
$argValue .= $a['name'] . ':';
|
159 |
}
|
160 |
+
if ( is_object( $a['value'] ) ) {
|
161 |
$argValue .= $a['value']->toCSS();
|
162 |
+
} else {
|
163 |
$argValue .= '???';
|
164 |
}
|
165 |
$message[] = $argValue;
|
166 |
}
|
167 |
}
|
168 |
+
return implode( ', ', $message );
|
169 |
}
|
170 |
|
|
|
171 |
/**
|
172 |
* Are we in a recursive mixin call?
|
173 |
*
|
174 |
* @return bool
|
175 |
*/
|
176 |
+
private function IsRecursive( $env, $mixin ) {
|
177 |
+
foreach ( $env->frames as $recur_frame ) {
|
178 |
+
if ( !( $mixin instanceof Less_Tree_Mixin_Definition ) ) {
|
|
|
179 |
|
180 |
+
if ( $mixin === $recur_frame ) {
|
181 |
return true;
|
182 |
}
|
183 |
|
184 |
+
if ( isset( $recur_frame->originalRuleset ) && $mixin->ruleset_id === $recur_frame->originalRuleset ) {
|
185 |
return true;
|
186 |
}
|
187 |
}
|
191 |
}
|
192 |
|
193 |
}
|
|
|
|
base/inc/lib/Less/Tree/Mixin/Definition.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Less_Tree_Mixin_Definition extends Less_Tree_Ruleset{
|
4 |
public $name;
|
5 |
public $selectors;
|
6 |
public $params;
|
@@ -13,21 +13,20 @@ class Less_Tree_Mixin_Definition extends Less_Tree_Ruleset{
|
|
13 |
public $variadic;
|
14 |
public $type = 'MixinDefinition';
|
15 |
|
16 |
-
|
17 |
// less.js : /lib/less/tree/mixin.js : tree.mixin.Definition
|
18 |
-
public function __construct($name, $params, $rules, $condition, $variadic = false, $frames = array() ){
|
19 |
$this->name = $name;
|
20 |
-
$this->selectors = array(new Less_Tree_Selector(array( new Less_Tree_Element(null, $name))));
|
21 |
|
22 |
$this->params = $params;
|
23 |
$this->condition = $condition;
|
24 |
$this->variadic = $variadic;
|
25 |
$this->rules = $rules;
|
26 |
|
27 |
-
if( $params ){
|
28 |
-
$this->arity = count($params);
|
29 |
-
foreach( $params as $p ){
|
30 |
-
if (!
|
31 |
$this->required++;
|
32 |
}
|
33 |
}
|
@@ -37,144 +36,139 @@ class Less_Tree_Mixin_Definition extends Less_Tree_Ruleset{
|
|
37 |
$this->SetRulesetIndex();
|
38 |
}
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
//function accept( $visitor ){
|
43 |
// $this->params = $visitor->visit($this->params);
|
44 |
// $this->rules = $visitor->visit($this->rules);
|
45 |
// $this->condition = $visitor->visit($this->condition);
|
46 |
//}
|
47 |
|
48 |
-
|
49 |
-
public function toCSS(){
|
50 |
return '';
|
51 |
}
|
52 |
|
53 |
// less.js : /lib/less/tree/mixin.js : tree.mixin.Definition.evalParams
|
54 |
-
public function compileParams($env, $mixinFrames, $args = array()
|
55 |
-
$frame = new Less_Tree_Ruleset(null, array());
|
56 |
$params = $this->params;
|
57 |
$mixinEnv = null;
|
58 |
$argsLength = 0;
|
59 |
|
60 |
-
if( $args ){
|
61 |
-
$argsLength = count($args);
|
62 |
-
for($i = 0; $i < $argsLength; $i++ ){
|
63 |
$arg = $args[$i];
|
64 |
|
65 |
-
if( $arg && $arg['name'] ){
|
66 |
$isNamedFound = false;
|
67 |
|
68 |
-
foreach($params as $j => $param){
|
69 |
-
if( !isset($evaldArguments[$j]) && $arg['name'] === $params[$j]['name']) {
|
70 |
-
$evaldArguments[$j] = $arg['value']->compile($env);
|
71 |
-
array_unshift($frame->rules, new Less_Tree_Rule( $arg['name'], $arg['value']->compile($env) ) );
|
72 |
$isNamedFound = true;
|
73 |
break;
|
74 |
}
|
75 |
}
|
76 |
-
if ($isNamedFound) {
|
77 |
-
array_splice($args, $i, 1);
|
78 |
$i--;
|
79 |
$argsLength--;
|
80 |
continue;
|
81 |
} else {
|
82 |
-
throw new Less_Exception_Compiler("Named argument for " . $this->name .' '.$args[$i]['name'] . ' not found');
|
83 |
}
|
84 |
}
|
85 |
}
|
86 |
}
|
87 |
|
88 |
$argIndex = 0;
|
89 |
-
foreach($params as $i => $param){
|
90 |
|
91 |
-
if ( isset($evaldArguments[$i]) ){ continue;
|
|
|
92 |
|
93 |
$arg = null;
|
94 |
-
if( isset($args[$argIndex]) ){
|
95 |
$arg = $args[$argIndex];
|
96 |
}
|
97 |
|
98 |
-
if (isset($param['name']) && $param['name']) {
|
99 |
|
100 |
-
if( isset($param['variadic']) ){
|
101 |
$varargs = array();
|
102 |
-
for ($j = $argIndex; $j < $argsLength; $j++) {
|
103 |
-
$varargs[] = $args[$j]['value']->compile($env);
|
104 |
}
|
105 |
-
$expression = new Less_Tree_Expression($varargs);
|
106 |
-
array_unshift($frame->rules, new Less_Tree_Rule($param['name'], $expression->compile($env)));
|
107 |
-
}else{
|
108 |
-
$val = ($arg && $arg['value']) ? $arg['value'] : false;
|
109 |
|
110 |
-
if ($val) {
|
111 |
-
$val = $val->compile($env);
|
112 |
-
} else if ( isset($param['value']) ) {
|
113 |
|
114 |
-
if( !$mixinEnv ){
|
115 |
$mixinEnv = new Less_Environment();
|
116 |
-
$mixinEnv->frames = array_merge( array($frame), $mixinFrames);
|
117 |
}
|
118 |
|
119 |
-
$val = $param['value']->compile($mixinEnv);
|
120 |
$frame->resetCache();
|
121 |
} else {
|
122 |
-
throw new Less_Exception_Compiler("Wrong number of arguments for " . $this->name . " (" . $argsLength . ' for ' . $this->arity . ")");
|
123 |
}
|
124 |
|
125 |
-
array_unshift($frame->rules, new Less_Tree_Rule($param['name'], $val));
|
126 |
$evaldArguments[$i] = $val;
|
127 |
}
|
128 |
}
|
129 |
|
130 |
-
if ( isset($param['variadic']) && $args) {
|
131 |
-
for ($j = $argIndex; $j < $argsLength; $j++) {
|
132 |
-
$evaldArguments[$j] = $args[$j]['value']->compile($env);
|
133 |
}
|
134 |
}
|
135 |
$argIndex++;
|
136 |
}
|
137 |
|
138 |
-
ksort($evaldArguments);
|
139 |
-
$evaldArguments = array_values($evaldArguments);
|
140 |
|
141 |
return $frame;
|
142 |
}
|
143 |
|
144 |
-
public function compile($env) {
|
145 |
-
if( $this->frames ){
|
146 |
-
return new Less_Tree_Mixin_Definition($this->name, $this->params, $this->rules, $this->condition, $this->variadic, $this->frames );
|
147 |
}
|
148 |
-
return new Less_Tree_Mixin_Definition($this->name, $this->params, $this->rules, $this->condition, $this->variadic, $env->frames );
|
149 |
}
|
150 |
|
151 |
-
public function evalCall($env, $args = NULL, $important = NULL) {
|
152 |
-
|
153 |
Less_Environment::$mixin_stack++;
|
154 |
|
155 |
$_arguments = array();
|
156 |
|
157 |
-
if( $this->frames ){
|
158 |
-
$mixinFrames = array_merge($this->frames, $env->frames);
|
159 |
-
}else{
|
160 |
$mixinFrames = $env->frames;
|
161 |
}
|
162 |
|
163 |
-
$frame = $this->compileParams($env, $mixinFrames, $args, $_arguments);
|
164 |
|
165 |
-
$ex = new Less_Tree_Expression($_arguments);
|
166 |
-
array_unshift($frame->rules, new Less_Tree_Rule('@arguments', $ex->compile($env)));
|
167 |
|
168 |
-
|
169 |
-
$ruleset = new Less_Tree_Ruleset(null, $this->rules);
|
170 |
$ruleset->originalRuleset = $this->ruleset_id;
|
171 |
|
172 |
-
|
173 |
$ruleSetEnv = new Less_Environment();
|
174 |
-
$ruleSetEnv->frames = array_merge( array($this, $frame), $mixinFrames );
|
175 |
$ruleset = $ruleset->compile( $ruleSetEnv );
|
176 |
|
177 |
-
if( $important ){
|
178 |
$ruleset = $ruleset->makeImportant();
|
179 |
}
|
180 |
|
@@ -183,53 +177,51 @@ class Less_Tree_Mixin_Definition extends Less_Tree_Ruleset{
|
|
183 |
return $ruleset;
|
184 |
}
|
185 |
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
if( !$this->condition ){
|
190 |
return true;
|
191 |
}
|
192 |
|
193 |
// set array to prevent error on array_merge
|
194 |
-
if(!is_array($this->frames)) {
|
195 |
-
|
196 |
-
|
197 |
|
198 |
-
$frame = $this->compileParams($env, array_merge($this->frames
|
199 |
|
200 |
$compile_env = new Less_Environment();
|
201 |
$compile_env->frames = array_merge(
|
202 |
-
array($frame) // the parameter variables
|
203 |
-
|
204 |
-
|
205 |
);
|
206 |
|
207 |
$compile_env->functions = $env->functions;
|
208 |
|
209 |
-
return (bool)$this->condition->compile($compile_env);
|
210 |
}
|
211 |
|
212 |
-
public function matchArgs($args, $env = NULL){
|
213 |
-
$argsLength = count($args);
|
214 |
|
215 |
-
if( !$this->variadic ){
|
216 |
-
if( $argsLength < $this->required ){
|
217 |
return false;
|
218 |
}
|
219 |
-
if( $argsLength > count($this->params) ){
|
220 |
return false;
|
221 |
}
|
222 |
-
}else{
|
223 |
-
if( $argsLength < ($this->required - 1)){
|
224 |
return false;
|
225 |
}
|
226 |
}
|
227 |
|
228 |
-
$len = min($argsLength, $this->arity);
|
229 |
|
230 |
-
for( $i = 0; $i < $len; $i++ ){
|
231 |
-
if( !isset($this->params[$i]['name']) && !isset($this->params[$i]['variadic']) ){
|
232 |
-
if( $args[$i]['value']->compile($env)->toCSS() != $this->params[$i]['value']->compile($env)->toCSS() ){
|
233 |
return false;
|
234 |
}
|
235 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class Less_Tree_Mixin_Definition extends Less_Tree_Ruleset {
|
4 |
public $name;
|
5 |
public $selectors;
|
6 |
public $params;
|
13 |
public $variadic;
|
14 |
public $type = 'MixinDefinition';
|
15 |
|
|
|
16 |
// less.js : /lib/less/tree/mixin.js : tree.mixin.Definition
|
17 |
+
public function __construct( $name, $params, $rules, $condition, $variadic = false, $frames = array() ) {
|
18 |
$this->name = $name;
|
19 |
+
$this->selectors = array( new Less_Tree_Selector( array( new Less_Tree_Element( null, $name ) ) ) );
|
20 |
|
21 |
$this->params = $params;
|
22 |
$this->condition = $condition;
|
23 |
$this->variadic = $variadic;
|
24 |
$this->rules = $rules;
|
25 |
|
26 |
+
if ( $params ) {
|
27 |
+
$this->arity = count( $params );
|
28 |
+
foreach ( $params as $p ) {
|
29 |
+
if ( !isset( $p['name'] ) || ( $p['name'] && !isset( $p['value'] ) ) ) {
|
30 |
$this->required++;
|
31 |
}
|
32 |
}
|
36 |
$this->SetRulesetIndex();
|
37 |
}
|
38 |
|
39 |
+
// function accept( $visitor ){
|
|
|
|
|
40 |
// $this->params = $visitor->visit($this->params);
|
41 |
// $this->rules = $visitor->visit($this->rules);
|
42 |
// $this->condition = $visitor->visit($this->condition);
|
43 |
//}
|
44 |
|
45 |
+
public function toCSS() {
|
|
|
46 |
return '';
|
47 |
}
|
48 |
|
49 |
// less.js : /lib/less/tree/mixin.js : tree.mixin.Definition.evalParams
|
50 |
+
public function compileParams( $env, $mixinFrames, $args = array(), &$evaldArguments = array() ) {
|
51 |
+
$frame = new Less_Tree_Ruleset( null, array() );
|
52 |
$params = $this->params;
|
53 |
$mixinEnv = null;
|
54 |
$argsLength = 0;
|
55 |
|
56 |
+
if ( $args ) {
|
57 |
+
$argsLength = count( $args );
|
58 |
+
for ( $i = 0; $i < $argsLength; $i++ ) {
|
59 |
$arg = $args[$i];
|
60 |
|
61 |
+
if ( $arg && $arg['name'] ) {
|
62 |
$isNamedFound = false;
|
63 |
|
64 |
+
foreach ( $params as $j => $param ) {
|
65 |
+
if ( !isset( $evaldArguments[$j] ) && $arg['name'] === $params[$j]['name'] ) {
|
66 |
+
$evaldArguments[$j] = $arg['value']->compile( $env );
|
67 |
+
array_unshift( $frame->rules, new Less_Tree_Rule( $arg['name'], $arg['value']->compile( $env ) ) );
|
68 |
$isNamedFound = true;
|
69 |
break;
|
70 |
}
|
71 |
}
|
72 |
+
if ( $isNamedFound ) {
|
73 |
+
array_splice( $args, $i, 1 );
|
74 |
$i--;
|
75 |
$argsLength--;
|
76 |
continue;
|
77 |
} else {
|
78 |
+
throw new Less_Exception_Compiler( "Named argument for " . $this->name .' '.$args[$i]['name'] . ' not found' );
|
79 |
}
|
80 |
}
|
81 |
}
|
82 |
}
|
83 |
|
84 |
$argIndex = 0;
|
85 |
+
foreach ( $params as $i => $param ) {
|
86 |
|
87 |
+
if ( isset( $evaldArguments[$i] ) ) { continue;
|
88 |
+
}
|
89 |
|
90 |
$arg = null;
|
91 |
+
if ( isset( $args[$argIndex] ) ) {
|
92 |
$arg = $args[$argIndex];
|
93 |
}
|
94 |
|
95 |
+
if ( isset( $param['name'] ) && $param['name'] ) {
|
96 |
|
97 |
+
if ( isset( $param['variadic'] ) ) {
|
98 |
$varargs = array();
|
99 |
+
for ( $j = $argIndex; $j < $argsLength; $j++ ) {
|
100 |
+
$varargs[] = $args[$j]['value']->compile( $env );
|
101 |
}
|
102 |
+
$expression = new Less_Tree_Expression( $varargs );
|
103 |
+
array_unshift( $frame->rules, new Less_Tree_Rule( $param['name'], $expression->compile( $env ) ) );
|
104 |
+
} else {
|
105 |
+
$val = ( $arg && $arg['value'] ) ? $arg['value'] : false;
|
106 |
|
107 |
+
if ( $val ) {
|
108 |
+
$val = $val->compile( $env );
|
109 |
+
} else if ( isset( $param['value'] ) ) {
|
110 |
|
111 |
+
if ( !$mixinEnv ) {
|
112 |
$mixinEnv = new Less_Environment();
|
113 |
+
$mixinEnv->frames = array_merge( array( $frame ), $mixinFrames );
|
114 |
}
|
115 |
|
116 |
+
$val = $param['value']->compile( $mixinEnv );
|
117 |
$frame->resetCache();
|
118 |
} else {
|
119 |
+
throw new Less_Exception_Compiler( "Wrong number of arguments for " . $this->name . " (" . $argsLength . ' for ' . $this->arity . ")" );
|
120 |
}
|
121 |
|
122 |
+
array_unshift( $frame->rules, new Less_Tree_Rule( $param['name'], $val ) );
|
123 |
$evaldArguments[$i] = $val;
|
124 |
}
|
125 |
}
|
126 |
|
127 |
+
if ( isset( $param['variadic'] ) && $args ) {
|
128 |
+
for ( $j = $argIndex; $j < $argsLength; $j++ ) {
|
129 |
+
$evaldArguments[$j] = $args[$j]['value']->compile( $env );
|
130 |
}
|
131 |
}
|
132 |
$argIndex++;
|
133 |
}
|
134 |
|
135 |
+
ksort( $evaldArguments );
|
136 |
+
$evaldArguments = array_values( $evaldArguments );
|
137 |
|
138 |
return $frame;
|
139 |
}
|
140 |
|
141 |
+
public function compile( $env ) {
|
142 |
+
if ( $this->frames ) {
|
143 |
+
return new Less_Tree_Mixin_Definition( $this->name, $this->params, $this->rules, $this->condition, $this->variadic, $this->frames );
|
144 |
}
|
145 |
+
return new Less_Tree_Mixin_Definition( $this->name, $this->params, $this->rules, $this->condition, $this->variadic, $env->frames );
|
146 |
}
|
147 |
|
148 |
+
public function evalCall( $env, $args = NULL, $important = NULL ) {
|
|
|
149 |
Less_Environment::$mixin_stack++;
|
150 |
|
151 |
$_arguments = array();
|
152 |
|
153 |
+
if ( $this->frames ) {
|
154 |
+
$mixinFrames = array_merge( $this->frames, $env->frames );
|
155 |
+
} else {
|
156 |
$mixinFrames = $env->frames;
|
157 |
}
|
158 |
|
159 |
+
$frame = $this->compileParams( $env, $mixinFrames, $args, $_arguments );
|
160 |
|
161 |
+
$ex = new Less_Tree_Expression( $_arguments );
|
162 |
+
array_unshift( $frame->rules, new Less_Tree_Rule( '@arguments', $ex->compile( $env ) ) );
|
163 |
|
164 |
+
$ruleset = new Less_Tree_Ruleset( null, $this->rules );
|
|
|
165 |
$ruleset->originalRuleset = $this->ruleset_id;
|
166 |
|
|
|
167 |
$ruleSetEnv = new Less_Environment();
|
168 |
+
$ruleSetEnv->frames = array_merge( array( $this, $frame ), $mixinFrames );
|
169 |
$ruleset = $ruleset->compile( $ruleSetEnv );
|
170 |
|
171 |
+
if ( $important ) {
|
172 |
$ruleset = $ruleset->makeImportant();
|
173 |
}
|
174 |
|
177 |
return $ruleset;
|
178 |
}
|
179 |
|
180 |
+
public function matchCondition( $args, $env ) {
|
181 |
+
if ( !$this->condition ) {
|
|
|
|
|
182 |
return true;
|
183 |
}
|
184 |
|
185 |
// set array to prevent error on array_merge
|
186 |
+
if ( !is_array( $this->frames ) ) {
|
187 |
+
$this->frames = array();
|
188 |
+
}
|
189 |
|
190 |
+
$frame = $this->compileParams( $env, array_merge( $this->frames, $env->frames ), $args );
|
191 |
|
192 |
$compile_env = new Less_Environment();
|
193 |
$compile_env->frames = array_merge(
|
194 |
+
array( $frame ), // the parameter variables
|
195 |
+
$this->frames, // the parent namespace/mixin frames
|
196 |
+
$env->frames // the current environment frames
|
197 |
);
|
198 |
|
199 |
$compile_env->functions = $env->functions;
|
200 |
|
201 |
+
return (bool)$this->condition->compile( $compile_env );
|
202 |
}
|
203 |
|
204 |
+
public function matchArgs( $args, $env = NULL ) {
|
205 |
+
$argsLength = count( $args );
|
206 |
|
207 |
+
if ( !$this->variadic ) {
|
208 |
+
if ( $argsLength < $this->required ) {
|
209 |
return false;
|
210 |
}
|
211 |
+
if ( $argsLength > count( $this->params ) ) {
|
212 |
return false;
|
213 |
}
|
214 |
+
} else {
|
215 |
+
if ( $argsLength < ( $this->required - 1 ) ) {
|
216 |
return false;
|
217 |
}
|
218 |
}
|
219 |
|
220 |
+
$len = min( $argsLength, $this->arity );
|
221 |
|
222 |
+
for ( $i = 0; $i < $len; $i++ ) {
|
223 |
+
if ( !isset( $this->params[$i]['name'] ) && !isset( $this->params[$i]['variadic'] ) ) {
|
224 |
+
if ( $args[$i]['value']->compile( $env )->toCSS() != $this->params[$i]['value']->compile( $env )->toCSS() ) {
|
225 |
return false;
|
226 |
}
|
227 |
}
|
base/inc/lib/Less/Tree/NameValue.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
* @package Less
|
11 |
* @subpackage tree
|
12 |
*/
|
13 |
-
class Less_Tree_NameValue extends Less_Tree{
|
14 |
|
15 |
public $name;
|
16 |
public $value;
|
@@ -19,33 +19,31 @@ class Less_Tree_NameValue extends Less_Tree{
|
|
19 |
public $type = 'NameValue';
|
20 |
public $important = '';
|
21 |
|
22 |
-
public function __construct($name, $value = null, $index = null, $currentFileInfo = null ){
|
23 |
$this->name = $name;
|
24 |
$this->value = $value;
|
25 |
$this->index = $index;
|
26 |
$this->currentFileInfo = $currentFileInfo;
|
27 |
}
|
28 |
|
29 |
-
|
30 |
-
|
31 |
$output->add(
|
32 |
$this->name
|
33 |
. Less_Environment::$_outputMap[': ']
|
34 |
. $this->value
|
35 |
. $this->important
|
36 |
-
. (((Less_Environment::$lastRule && Less_Parser::$options['compress'])) ? "" : ";")
|
37 |
-
|
38 |
}
|
39 |
|
40 |
-
public function compile
|
41 |
return $this;
|
42 |
}
|
43 |
|
44 |
-
public function makeImportant(){
|
45 |
-
$new = new Less_Tree_NameValue($this->name, $this->value, $this->index, $this->currentFileInfo);
|
46 |
$new->important = ' !important';
|
47 |
return $new;
|
48 |
}
|
49 |
|
50 |
-
|
51 |
}
|
10 |
* @package Less
|
11 |
* @subpackage tree
|
12 |
*/
|
13 |
+
class Less_Tree_NameValue extends Less_Tree {
|
14 |
|
15 |
public $name;
|
16 |
public $value;
|
19 |
public $type = 'NameValue';
|
20 |
public $important = '';
|
21 |
|
22 |
+
public function __construct( $name, $value = null, $index = null, $currentFileInfo = null ) {
|
23 |
$this->name = $name;
|
24 |
$this->value = $value;
|
25 |
$this->index = $index;
|
26 |
$this->currentFileInfo = $currentFileInfo;
|
27 |
}
|
28 |
|
29 |
+
public function genCSS( $output ) {
|
|
|
30 |
$output->add(
|
31 |
$this->name
|
32 |
. Less_Environment::$_outputMap[': ']
|
33 |
. $this->value
|
34 |
. $this->important
|
35 |
+
. ( ( ( Less_Environment::$lastRule && Less_Parser::$options['compress'] ) ) ? "" : ";" ),
|
36 |
+
$this->currentFileInfo, $this->index );
|
37 |
}
|
38 |
|
39 |
+
public function compile( $env ) {
|
40 |
return $this;
|
41 |
}
|
42 |
|
43 |
+
public function makeImportant() {
|
44 |
+
$new = new Less_Tree_NameValue( $this->name, $this->value, $this->index, $this->currentFileInfo );
|
45 |
$new->important = ' !important';
|
46 |
return $new;
|
47 |
}
|
48 |
|
|
|
49 |
}
|
base/inc/lib/Less/Tree/Negative.php
CHANGED
@@ -6,32 +6,32 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Negative extends Less_Tree{
|
10 |
|
11 |
public $value;
|
12 |
public $type = 'Negative';
|
13 |
|
14 |
-
|
15 |
$this->value = $node;
|
16 |
}
|
17 |
|
18 |
-
//function accept($visitor) {
|
19 |
// $this->value = $visitor->visit($this->value);
|
20 |
//}
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
$output->add( '-' );
|
27 |
$this->value->genCSS( $output );
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
if( Less_Environment::isMathOn() ){
|
32 |
-
$ret = new Less_Tree_Operation('*', array( new Less_Tree_Dimension(-1), $this->value ) );
|
33 |
-
return $ret->compile($env);
|
34 |
}
|
35 |
-
return new Less_Tree_Negative( $this->value->compile($env) );
|
36 |
}
|
37 |
-
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Negative extends Less_Tree {
|
10 |
|
11 |
public $value;
|
12 |
public $type = 'Negative';
|
13 |
|
14 |
+
public function __construct( $node ) {
|
15 |
$this->value = $node;
|
16 |
}
|
17 |
|
18 |
+
// function accept($visitor) {
|
19 |
// $this->value = $visitor->visit($this->value);
|
20 |
//}
|
21 |
|
22 |
+
/**
|
23 |
+
* @see Less_Tree::genCSS
|
24 |
+
*/
|
25 |
+
public function genCSS( $output ) {
|
26 |
$output->add( '-' );
|
27 |
$this->value->genCSS( $output );
|
28 |
}
|
29 |
|
30 |
+
public function compile( $env ) {
|
31 |
+
if ( Less_Environment::isMathOn() ) {
|
32 |
+
$ret = new Less_Tree_Operation( '*', array( new Less_Tree_Dimension( -1 ), $this->value ) );
|
33 |
+
return $ret->compile( $env );
|
34 |
}
|
35 |
+
return new Less_Tree_Negative( $this->value->compile( $env ) );
|
36 |
}
|
37 |
+
}
|
base/inc/lib/Less/Tree/Operation.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Operation extends Less_Tree{
|
10 |
|
11 |
public $op;
|
12 |
public $operands;
|
@@ -16,52 +16,50 @@ class Less_Tree_Operation extends Less_Tree{
|
|
16 |
/**
|
17 |
* @param string $op
|
18 |
*/
|
19 |
-
public function __construct($op, $operands, $isSpaced = false){
|
20 |
-
$this->op = trim($op);
|
21 |
$this->operands = $operands;
|
22 |
$this->isSpaced = $isSpaced;
|
23 |
}
|
24 |
|
25 |
-
|
26 |
-
$this->operands = $visitor->visitArray($this->operands);
|
27 |
}
|
28 |
|
29 |
-
public function compile($env){
|
30 |
-
$a = $this->operands[0]->compile($env);
|
31 |
-
$b = $this->operands[1]->compile($env);
|
32 |
|
|
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
if( $a instanceof Less_Tree_Dimension && $b instanceof Less_Tree_Color ){
|
37 |
$a = $a->toColor();
|
38 |
|
39 |
-
}elseif( $b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color ){
|
40 |
$b = $b->toColor();
|
41 |
|
42 |
}
|
43 |
|
44 |
-
if( !method_exists($a,'operate') ){
|
45 |
-
throw new Less_Exception_Compiler("Operation on an invalid type");
|
46 |
}
|
47 |
|
48 |
-
return $a->operate( $this->op, $b);
|
49 |
}
|
50 |
|
51 |
-
return new Less_Tree_Operation($this->op, array($a, $b), $this->isSpaced );
|
52 |
}
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
public function genCSS( $output ){
|
59 |
$this->operands[0]->genCSS( $output );
|
60 |
-
if( $this->isSpaced ){
|
61 |
$output->add( " " );
|
62 |
}
|
63 |
$output->add( $this->op );
|
64 |
-
if( $this->isSpaced ){
|
65 |
$output->add( ' ' );
|
66 |
}
|
67 |
$this->operands[1]->genCSS( $output );
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Operation extends Less_Tree {
|
10 |
|
11 |
public $op;
|
12 |
public $operands;
|
16 |
/**
|
17 |
* @param string $op
|
18 |
*/
|
19 |
+
public function __construct( $op, $operands, $isSpaced = false ) {
|
20 |
+
$this->op = trim( $op );
|
21 |
$this->operands = $operands;
|
22 |
$this->isSpaced = $isSpaced;
|
23 |
}
|
24 |
|
25 |
+
public function accept( $visitor ) {
|
26 |
+
$this->operands = $visitor->visitArray( $this->operands );
|
27 |
}
|
28 |
|
29 |
+
public function compile( $env ) {
|
30 |
+
$a = $this->operands[0]->compile( $env );
|
31 |
+
$b = $this->operands[1]->compile( $env );
|
32 |
|
33 |
+
if ( Less_Environment::isMathOn() ) {
|
34 |
|
35 |
+
if ( $a instanceof Less_Tree_Dimension && $b instanceof Less_Tree_Color ) {
|
|
|
|
|
36 |
$a = $a->toColor();
|
37 |
|
38 |
+
} elseif ( $b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color ) {
|
39 |
$b = $b->toColor();
|
40 |
|
41 |
}
|
42 |
|
43 |
+
if ( !method_exists( $a, 'operate' ) ) {
|
44 |
+
throw new Less_Exception_Compiler( "Operation on an invalid type" );
|
45 |
}
|
46 |
|
47 |
+
return $a->operate( $this->op, $b );
|
48 |
}
|
49 |
|
50 |
+
return new Less_Tree_Operation( $this->op, array( $a, $b ), $this->isSpaced );
|
51 |
}
|
52 |
|
53 |
+
/**
|
54 |
+
* @see Less_Tree::genCSS
|
55 |
+
*/
|
56 |
+
public function genCSS( $output ) {
|
|
|
57 |
$this->operands[0]->genCSS( $output );
|
58 |
+
if ( $this->isSpaced ) {
|
59 |
$output->add( " " );
|
60 |
}
|
61 |
$output->add( $this->op );
|
62 |
+
if ( $this->isSpaced ) {
|
63 |
$output->add( ' ' );
|
64 |
}
|
65 |
$this->operands[1]->genCSS( $output );
|
base/inc/lib/Less/Tree/Paren.php
CHANGED
@@ -6,30 +6,30 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Paren extends Less_Tree{
|
10 |
|
11 |
public $value;
|
12 |
public $type = 'Paren';
|
13 |
|
14 |
-
public function __construct($value) {
|
15 |
$this->value = $value;
|
16 |
}
|
17 |
|
18 |
-
|
19 |
-
$this->value = $visitor->visitObj($this->value);
|
20 |
}
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
$output->add( '(' );
|
27 |
$this->value->genCSS( $output );
|
28 |
$output->add( ')' );
|
29 |
}
|
30 |
|
31 |
-
public function compile($env) {
|
32 |
-
return new Less_Tree_Paren($this->value->compile($env));
|
33 |
}
|
34 |
|
35 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Paren extends Less_Tree {
|
10 |
|
11 |
public $value;
|
12 |
public $type = 'Paren';
|
13 |
|
14 |
+
public function __construct( $value ) {
|
15 |
$this->value = $value;
|
16 |
}
|
17 |
|
18 |
+
public function accept( $visitor ) {
|
19 |
+
$this->value = $visitor->visitObj( $this->value );
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* @see Less_Tree::genCSS
|
24 |
+
*/
|
25 |
+
public function genCSS( $output ) {
|
26 |
$output->add( '(' );
|
27 |
$this->value->genCSS( $output );
|
28 |
$output->add( ')' );
|
29 |
}
|
30 |
|
31 |
+
public function compile( $env ) {
|
32 |
+
return new Less_Tree_Paren( $this->value->compile( $env ) );
|
33 |
}
|
34 |
|
35 |
}
|
base/inc/lib/Less/Tree/Quoted.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Quoted extends Less_Tree{
|
10 |
public $escaped;
|
11 |
public $value;
|
12 |
public $quote;
|
@@ -17,62 +17,60 @@ class Less_Tree_Quoted extends Less_Tree{
|
|
17 |
/**
|
18 |
* @param string $str
|
19 |
*/
|
20 |
-
public function __construct($str, $content = '', $escaped = false, $index = false, $currentFileInfo = null ){
|
21 |
$this->escaped = $escaped;
|
22 |
$this->value = $content;
|
23 |
-
if( $str ){
|
24 |
$this->quote = $str[0];
|
25 |
}
|
26 |
$this->index = $index;
|
27 |
$this->currentFileInfo = $currentFileInfo;
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
if( !$this->escaped ){
|
35 |
$output->add( $this->quote, $this->currentFileInfo, $this->index );
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
$output->add( $this->quote );
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
public function compile($env){
|
44 |
|
|
|
45 |
$value = $this->value;
|
46 |
-
if( preg_match_all('/`([^`]+)`/', $this->value, $matches) ){
|
47 |
-
foreach($matches as $i => $match){
|
48 |
-
$js = new Less_Tree_JavaScript($matches[1], $this->index, true);
|
49 |
$js = $js->compile()->value;
|
50 |
-
$value = str_replace($matches[0][$i], $js, $value);
|
51 |
}
|
52 |
}
|
53 |
|
54 |
-
if( preg_match_all('/@\{([\w-]+)\}/'
|
55 |
-
foreach($matches[1] as $i => $match){
|
56 |
-
$v = new Less_Tree_Variable('@' . $match, $this->index, $this->currentFileInfo );
|
57 |
-
$v = $v->compile($env);
|
58 |
-
$v = ($v instanceof Less_Tree_Quoted) ? $v->value : $v->toCSS();
|
59 |
-
$value = str_replace($matches[0][$i], $v, $value);
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
return new Less_Tree_Quoted($this->quote . $value . $this->quote, $value, $this->escaped, $this->index, $this->currentFileInfo);
|
64 |
}
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
if( !Less_Parser::is_method($x, 'toCSS') ){
|
69 |
return -1;
|
70 |
}
|
71 |
|
72 |
$left = $this->toCSS();
|
73 |
$right = $x->toCSS();
|
74 |
|
75 |
-
if ($left === $right) {
|
76 |
return 0;
|
77 |
}
|
78 |
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Quoted extends Less_Tree {
|
10 |
public $escaped;
|
11 |
public $value;
|
12 |
public $quote;
|
17 |
/**
|
18 |
* @param string $str
|
19 |
*/
|
20 |
+
public function __construct( $str, $content = '', $escaped = false, $index = false, $currentFileInfo = null ) {
|
21 |
$this->escaped = $escaped;
|
22 |
$this->value = $content;
|
23 |
+
if ( $str ) {
|
24 |
$this->quote = $str[0];
|
25 |
}
|
26 |
$this->index = $index;
|
27 |
$this->currentFileInfo = $currentFileInfo;
|
28 |
}
|
29 |
|
30 |
+
/**
|
31 |
+
* @see Less_Tree::genCSS
|
32 |
+
*/
|
33 |
+
public function genCSS( $output ) {
|
34 |
+
if ( !$this->escaped ) {
|
35 |
$output->add( $this->quote, $this->currentFileInfo, $this->index );
|
36 |
+
}
|
37 |
+
$output->add( $this->value );
|
38 |
+
if ( !$this->escaped ) {
|
39 |
$output->add( $this->quote );
|
40 |
+
}
|
41 |
+
}
|
|
|
|
|
42 |
|
43 |
+
public function compile( $env ) {
|
44 |
$value = $this->value;
|
45 |
+
if ( preg_match_all( '/`([^`]+)`/', $this->value, $matches ) ) {
|
46 |
+
foreach ( $matches as $i => $match ) {
|
47 |
+
$js = new Less_Tree_JavaScript( $matches[1], $this->index, true );
|
48 |
$js = $js->compile()->value;
|
49 |
+
$value = str_replace( $matches[0][$i], $js, $value );
|
50 |
}
|
51 |
}
|
52 |
|
53 |
+
if ( preg_match_all( '/@\{([\w-]+)\}/', $value, $matches ) ) {
|
54 |
+
foreach ( $matches[1] as $i => $match ) {
|
55 |
+
$v = new Less_Tree_Variable( '@' . $match, $this->index, $this->currentFileInfo );
|
56 |
+
$v = $v->compile( $env );
|
57 |
+
$v = ( $v instanceof Less_Tree_Quoted ) ? $v->value : $v->toCSS();
|
58 |
+
$value = str_replace( $matches[0][$i], $v, $value );
|
59 |
}
|
60 |
}
|
61 |
|
62 |
+
return new Less_Tree_Quoted( $this->quote . $value . $this->quote, $value, $this->escaped, $this->index, $this->currentFileInfo );
|
63 |
}
|
64 |
|
65 |
+
public function compare( $x ) {
|
66 |
+
if ( !Less_Parser::is_method( $x, 'toCSS' ) ) {
|
|
|
67 |
return -1;
|
68 |
}
|
69 |
|
70 |
$left = $this->toCSS();
|
71 |
$right = $x->toCSS();
|
72 |
|
73 |
+
if ( $left === $right ) {
|
74 |
return 0;
|
75 |
}
|
76 |
|
base/inc/lib/Less/Tree/Rule.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Rule extends Less_Tree{
|
10 |
|
11 |
public $name;
|
12 |
public $value;
|
@@ -21,73 +21,71 @@ class Less_Tree_Rule extends Less_Tree{
|
|
21 |
/**
|
22 |
* @param string $important
|
23 |
*/
|
24 |
-
public function __construct($name, $value = null, $important = null, $merge = null, $index = null, $currentFileInfo = null,
|
25 |
$this->name = $name;
|
26 |
-
$this->value = ($value instanceof Less_Tree_Value || $value instanceof Less_Tree_Ruleset) ? $value : new Less_Tree_Value(array($value));
|
27 |
-
$this->important = $important ? ' ' . trim($important) : '';
|
28 |
$this->merge = $merge;
|
29 |
$this->index = $index;
|
30 |
$this->currentFileInfo = $currentFileInfo;
|
31 |
$this->inline = $inline;
|
32 |
-
$this->variable = ( is_string($name) && $name[0] === '@');
|
33 |
}
|
34 |
|
35 |
-
|
36 |
$this->value = $visitor->visitObj( $this->value );
|
37 |
}
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
$output->add( $this->name . Less_Environment::$_outputMap[': '], $this->currentFileInfo, $this->index);
|
45 |
try{
|
46 |
-
$this->value->genCSS( $output);
|
47 |
|
48 |
-
}catch( Less_Exception_Parser $e ){
|
49 |
$e->index = $this->index;
|
50 |
$e->currentFile = $this->currentFileInfo;
|
51 |
throw $e;
|
52 |
}
|
53 |
-
$output->add( $this->important . (($this->inline || (Less_Environment::$lastRule && Less_Parser::$options['compress'])) ? "" : ";"), $this->currentFileInfo, $this->index);
|
54 |
}
|
55 |
|
56 |
-
public function compile
|
57 |
-
|
58 |
$name = $this->name;
|
59 |
-
if( is_array($name) ){
|
60 |
// expand 'primitive' name directly to get
|
61 |
// things faster (~10% for benchmark.less):
|
62 |
-
if( count($name) === 1 && $name[0] instanceof Less_Tree_Keyword ){
|
63 |
$name = $name[0]->value;
|
64 |
-
}else{
|
65 |
-
$name = $this->CompileName($env
|
66 |
}
|
67 |
}
|
68 |
|
69 |
$strictMathBypass = Less_Parser::$options['strictMath'];
|
70 |
-
if( $name === "font" && !Less_Parser::$options['strictMath'] ){
|
71 |
Less_Parser::$options['strictMath'] = true;
|
72 |
}
|
73 |
|
74 |
try {
|
75 |
-
$evaldValue = $this->value->compile($env);
|
76 |
|
77 |
-
if( !$this->variable && $evaldValue->type === "DetachedRuleset") {
|
78 |
-
throw new Less_Exception_Compiler("Rulesets cannot be evaluated on a property.", null, $this->index, $this->currentFileInfo);
|
79 |
}
|
80 |
|
81 |
-
if( Less_Environment::$mixin_stack ){
|
82 |
-
$return = new Less_Tree_Rule($name, $evaldValue, $this->important, $this->merge, $this->index, $this->currentFileInfo, $this->inline);
|
83 |
-
}else{
|
84 |
$this->name = $name;
|
85 |
$this->value = $evaldValue;
|
86 |
$return = $this;
|
87 |
}
|
88 |
|
89 |
-
}catch( Less_Exception_Parser $e ){
|
90 |
-
if( !is_numeric($e->index) ){
|
91 |
$e->index = $this->index;
|
92 |
$e->currentFile = $this->currentFileInfo;
|
93 |
}
|
@@ -99,17 +97,16 @@ class Less_Tree_Rule extends Less_Tree{
|
|
99 |
return $return;
|
100 |
}
|
101 |
|
102 |
-
|
103 |
-
public function CompileName( $env, $name ){
|
104 |
$output = new Less_Output();
|
105 |
-
foreach($name as $n){
|
106 |
-
$n->compile($env)->genCSS($output);
|
107 |
}
|
108 |
return $output->toString();
|
109 |
}
|
110 |
|
111 |
-
|
112 |
-
return new Less_Tree_Rule($this->name, $this->value, '!important', $this->merge, $this->index, $this->currentFileInfo, $this->inline);
|
113 |
}
|
114 |
|
115 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Rule extends Less_Tree {
|
10 |
|
11 |
public $name;
|
12 |
public $value;
|
21 |
/**
|
22 |
* @param string $important
|
23 |
*/
|
24 |
+
public function __construct( $name, $value = null, $important = null, $merge = null, $index = null, $currentFileInfo = null, $inline = false ) {
|
25 |
$this->name = $name;
|
26 |
+
$this->value = ( $value instanceof Less_Tree_Value || $value instanceof Less_Tree_Ruleset ) ? $value : new Less_Tree_Value( array( $value ) );
|
27 |
+
$this->important = $important ? ' ' . trim( $important ) : '';
|
28 |
$this->merge = $merge;
|
29 |
$this->index = $index;
|
30 |
$this->currentFileInfo = $currentFileInfo;
|
31 |
$this->inline = $inline;
|
32 |
+
$this->variable = ( is_string( $name ) && $name[0] === '@' );
|
33 |
}
|
34 |
|
35 |
+
public function accept( $visitor ) {
|
36 |
$this->value = $visitor->visitObj( $this->value );
|
37 |
}
|
38 |
|
39 |
+
/**
|
40 |
+
* @see Less_Tree::genCSS
|
41 |
+
*/
|
42 |
+
public function genCSS( $output ) {
|
43 |
+
$output->add( $this->name . Less_Environment::$_outputMap[': '], $this->currentFileInfo, $this->index );
|
|
|
44 |
try{
|
45 |
+
$this->value->genCSS( $output );
|
46 |
|
47 |
+
}catch ( Less_Exception_Parser $e ) {
|
48 |
$e->index = $this->index;
|
49 |
$e->currentFile = $this->currentFileInfo;
|
50 |
throw $e;
|
51 |
}
|
52 |
+
$output->add( $this->important . ( ( $this->inline || ( Less_Environment::$lastRule && Less_Parser::$options['compress'] ) ) ? "" : ";" ), $this->currentFileInfo, $this->index );
|
53 |
}
|
54 |
|
55 |
+
public function compile( $env ) {
|
|
|
56 |
$name = $this->name;
|
57 |
+
if ( is_array( $name ) ) {
|
58 |
// expand 'primitive' name directly to get
|
59 |
// things faster (~10% for benchmark.less):
|
60 |
+
if ( count( $name ) === 1 && $name[0] instanceof Less_Tree_Keyword ) {
|
61 |
$name = $name[0]->value;
|
62 |
+
} else {
|
63 |
+
$name = $this->CompileName( $env, $name );
|
64 |
}
|
65 |
}
|
66 |
|
67 |
$strictMathBypass = Less_Parser::$options['strictMath'];
|
68 |
+
if ( $name === "font" && !Less_Parser::$options['strictMath'] ) {
|
69 |
Less_Parser::$options['strictMath'] = true;
|
70 |
}
|
71 |
|
72 |
try {
|
73 |
+
$evaldValue = $this->value->compile( $env );
|
74 |
|
75 |
+
if ( !$this->variable && $evaldValue->type === "DetachedRuleset" ) {
|
76 |
+
throw new Less_Exception_Compiler( "Rulesets cannot be evaluated on a property.", null, $this->index, $this->currentFileInfo );
|
77 |
}
|
78 |
|
79 |
+
if ( Less_Environment::$mixin_stack ) {
|
80 |
+
$return = new Less_Tree_Rule( $name, $evaldValue, $this->important, $this->merge, $this->index, $this->currentFileInfo, $this->inline );
|
81 |
+
} else {
|
82 |
$this->name = $name;
|
83 |
$this->value = $evaldValue;
|
84 |
$return = $this;
|
85 |
}
|
86 |
|
87 |
+
}catch ( Less_Exception_Parser $e ) {
|
88 |
+
if ( !is_numeric( $e->index ) ) {
|
89 |
$e->index = $this->index;
|
90 |
$e->currentFile = $this->currentFileInfo;
|
91 |
}
|
97 |
return $return;
|
98 |
}
|
99 |
|
100 |
+
public function CompileName( $env, $name ) {
|
|
|
101 |
$output = new Less_Output();
|
102 |
+
foreach ( $name as $n ) {
|
103 |
+
$n->compile( $env )->genCSS( $output );
|
104 |
}
|
105 |
return $output->toString();
|
106 |
}
|
107 |
|
108 |
+
public function makeImportant() {
|
109 |
+
return new Less_Tree_Rule( $this->name, $this->value, '!important', $this->merge, $this->index, $this->currentFileInfo, $this->inline );
|
110 |
}
|
111 |
|
112 |
}
|
base/inc/lib/Less/Tree/Ruleset.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Ruleset extends Less_Tree{
|
10 |
|
11 |
protected $lookups;
|
12 |
public $_variables;
|
@@ -29,20 +29,20 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
29 |
|
30 |
public $first_oelements;
|
31 |
|
32 |
-
public function SetRulesetIndex(){
|
33 |
$this->ruleset_id = Less_Parser::$next_id++;
|
34 |
$this->originalRuleset = $this->ruleset_id;
|
35 |
|
36 |
-
if( $this->selectors ){
|
37 |
-
foreach($this->selectors as $sel){
|
38 |
-
if( $sel->_oelements ){
|
39 |
$this->first_oelements[$sel->_oelements[0]] = true;
|
40 |
}
|
41 |
}
|
42 |
}
|
43 |
}
|
44 |
|
45 |
-
public function __construct($selectors, $rules, $strictImports = null){
|
46 |
$this->selectors = $selectors;
|
47 |
$this->rules = $rules;
|
48 |
$this->lookups = array();
|
@@ -50,83 +50,79 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
50 |
$this->SetRulesetIndex();
|
51 |
}
|
52 |
|
53 |
-
public function accept( $visitor ){
|
54 |
-
if( $this->paths ){
|
55 |
-
$paths_len = count($this->paths);
|
56 |
-
for($i = 0,$paths_len; $i < $paths_len; $i++ ){
|
57 |
-
$this->paths[$i] = $visitor->visitArray($this->paths[$i]);
|
58 |
}
|
59 |
-
}elseif( $this->selectors ){
|
60 |
-
$this->selectors = $visitor->visitArray($this->selectors);
|
61 |
}
|
62 |
|
63 |
-
if( $this->rules ){
|
64 |
-
$this->rules = $visitor->visitArray($this->rules);
|
65 |
}
|
66 |
}
|
67 |
|
68 |
-
public function compile($env){
|
69 |
-
|
70 |
-
$ruleset = $this->PrepareRuleset($env);
|
71 |
-
|
72 |
|
73 |
// Store the frames around mixin definitions,
|
74 |
// so they can be evaluated like closures when the time comes.
|
75 |
-
$rsRuleCnt = count($ruleset->rules);
|
76 |
-
for( $i = 0; $i < $rsRuleCnt; $i++ ){
|
77 |
-
if( $ruleset->rules[$i] instanceof Less_Tree_Mixin_Definition || $ruleset->rules[$i] instanceof Less_Tree_DetachedRuleset ){
|
78 |
-
$ruleset->rules[$i] = $ruleset->rules[$i]->compile($env);
|
79 |
}
|
80 |
}
|
81 |
|
82 |
$mediaBlockCount = 0;
|
83 |
-
if( $env instanceof Less_Environment ){
|
84 |
-
$mediaBlockCount = count($env->mediaBlocks);
|
85 |
}
|
86 |
|
87 |
// Evaluate mixin calls.
|
88 |
$this->EvalMixinCalls( $ruleset, $env, $rsRuleCnt );
|
89 |
|
90 |
-
|
91 |
// Evaluate everything else
|
92 |
-
for( $i=0; $i
|
93 |
-
if(!
|
94 |
-
$ruleset->rules[$i] = $ruleset->rules[$i]->compile($env);
|
95 |
}
|
96 |
}
|
97 |
|
98 |
-
|
99 |
-
for( $i=0; $i
|
100 |
$rule = $ruleset->rules[$i];
|
101 |
|
102 |
-
|
103 |
-
if( $rule instanceof Less_Tree_Ruleset && $rule->selectors && count($rule->selectors) === 1 ){
|
104 |
|
105 |
-
|
106 |
-
if( $rule->selectors[0]->isJustParentSelector() ){
|
107 |
-
array_splice($ruleset->rules
|
108 |
$rsRuleCnt--;
|
109 |
|
110 |
-
for($j = 0; $j < count($rule->rules); $j++ ){
|
111 |
$subRule = $rule->rules[$j];
|
112 |
-
if( !($subRule instanceof Less_Tree_Rule) || !$subRule->variable ){
|
113 |
-
array_splice($ruleset->rules, ++$i, 0, array($subRule));
|
114 |
$rsRuleCnt++;
|
115 |
}
|
116 |
}
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
|
123 |
// Pop the stack
|
124 |
$env->shiftFrame();
|
125 |
|
126 |
-
if ($mediaBlockCount) {
|
127 |
-
$len = count($env->mediaBlocks);
|
128 |
-
for($i = $mediaBlockCount; $i < $len; $i++ ){
|
129 |
-
$env->mediaBlocks[$i]->bubbleSelectors($ruleset->selectors);
|
130 |
}
|
131 |
}
|
132 |
|
@@ -139,69 +135,67 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
139 |
* @param Less_Tree_Ruleset $ruleset
|
140 |
* @param integer $rsRuleCnt
|
141 |
*/
|
142 |
-
private function EvalMixinCalls( $ruleset, $env, &$rsRuleCnt ){
|
143 |
-
for($i=0; $i < $rsRuleCnt; $i++){
|
144 |
$rule = $ruleset->rules[$i];
|
145 |
|
146 |
-
if( $rule instanceof Less_Tree_Mixin_Call ){
|
147 |
-
$rule = $rule->compile($env);
|
148 |
|
149 |
$temp = array();
|
150 |
-
foreach($rule as $r){
|
151 |
-
if( ($r instanceof Less_Tree_Rule) && $r->variable ){
|
152 |
// do not pollute the scope if the variable is
|
153 |
// already there. consider returning false here
|
154 |
// but we need a way to "return" variable from mixins
|
155 |
-
if( !$ruleset->variable($r->name) ){
|
156 |
$temp[] = $r;
|
157 |
}
|
158 |
-
}else{
|
159 |
$temp[] = $r;
|
160 |
}
|
161 |
}
|
162 |
-
$temp_count = count($temp)-1;
|
163 |
-
array_splice($ruleset->rules, $i, 1, $temp);
|
164 |
$rsRuleCnt += $temp_count;
|
165 |
$i += $temp_count;
|
166 |
$ruleset->resetCache();
|
167 |
|
168 |
-
}elseif( $rule instanceof Less_Tree_RulesetCall ){
|
169 |
|
170 |
-
$rule = $rule->compile($env);
|
171 |
$rules = array();
|
172 |
-
foreach($rule->rules as $r){
|
173 |
-
if( ($r instanceof Less_Tree_Rule) && $r->variable ){
|
174 |
continue;
|
175 |
}
|
176 |
$rules[] = $r;
|
177 |
}
|
178 |
|
179 |
-
array_splice($ruleset->rules, $i, 1, $rules);
|
180 |
-
$temp_count = count($rules);
|
181 |
$rsRuleCnt += $temp_count - 1;
|
182 |
-
$i += $temp_count-1;
|
183 |
$ruleset->resetCache();
|
184 |
}
|
185 |
|
186 |
}
|
187 |
}
|
188 |
|
189 |
-
|
190 |
/**
|
191 |
* Compile the selectors and create a new ruleset object for the compile() method
|
192 |
*
|
193 |
*/
|
194 |
-
private function PrepareRuleset($env){
|
195 |
-
|
196 |
$hasOnePassingSelector = false;
|
197 |
$selectors = array();
|
198 |
-
if( $this->selectors ){
|
199 |
-
Less_Tree_DefaultFunc::error("it is currently only allowed in parametric mixin guards,");
|
200 |
|
201 |
-
foreach($this->selectors as $s){
|
202 |
-
$selector = $s->compile($env);
|
203 |
$selectors[] = $selector;
|
204 |
-
if( $selector->evaldCondition ){
|
205 |
$hasOnePassingSelector = true;
|
206 |
}
|
207 |
}
|
@@ -211,13 +205,13 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
211 |
$hasOnePassingSelector = true;
|
212 |
}
|
213 |
|
214 |
-
if( $this->rules && $hasOnePassingSelector ){
|
215 |
$rules = $this->rules;
|
216 |
-
}else{
|
217 |
$rules = array();
|
218 |
}
|
219 |
|
220 |
-
$ruleset = new Less_Tree_Ruleset($selectors, $rules, $this->strictImports);
|
221 |
|
222 |
$ruleset->originalRuleset = $this->ruleset_id;
|
223 |
|
@@ -225,34 +219,31 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
225 |
$ruleset->firstRoot = $this->firstRoot;
|
226 |
$ruleset->allowImports = $this->allowImports;
|
227 |
|
228 |
-
|
229 |
// push the current ruleset to the frames stack
|
230 |
-
$env->unshiftFrame($ruleset);
|
231 |
-
|
232 |
|
233 |
// Evaluate imports
|
234 |
-
if( $ruleset->root || $ruleset->allowImports || !$ruleset->strictImports ){
|
235 |
-
$ruleset->evalImports($env);
|
236 |
}
|
237 |
|
238 |
return $ruleset;
|
239 |
}
|
240 |
|
241 |
-
function evalImports($env) {
|
242 |
-
|
243 |
-
$
|
244 |
-
for($i=0; $i < $rules_len; $i++){
|
245 |
$rule = $this->rules[$i];
|
246 |
|
247 |
-
if( $rule instanceof Less_Tree_Import ){
|
248 |
-
$rules = $rule->compile($env);
|
249 |
-
if( is_array($rules) ){
|
250 |
-
array_splice($this->rules, $i, 1, $rules);
|
251 |
-
$temp_count = count($rules)-1;
|
252 |
$i += $temp_count;
|
253 |
$rules_len += $temp_count;
|
254 |
-
}else{
|
255 |
-
array_splice($this->rules, $i, 1, array($rules));
|
256 |
}
|
257 |
|
258 |
$this->resetCache();
|
@@ -260,67 +251,64 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
260 |
}
|
261 |
}
|
262 |
|
263 |
-
function makeImportant(){
|
264 |
-
|
265 |
$important_rules = array();
|
266 |
-
foreach($this->rules as $rule){
|
267 |
-
if( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_Ruleset || $rule instanceof Less_Tree_NameValue ){
|
268 |
$important_rules[] = $rule->makeImportant();
|
269 |
-
}else{
|
270 |
$important_rules[] = $rule;
|
271 |
}
|
272 |
}
|
273 |
|
274 |
-
return new Less_Tree_Ruleset($this->selectors, $important_rules, $this->strictImports );
|
275 |
}
|
276 |
|
277 |
-
public function matchArgs($args){
|
278 |
return !$args;
|
279 |
}
|
280 |
|
281 |
// lets you call a css selector with a guard
|
282 |
-
public function matchCondition( $args, $env ){
|
283 |
-
$lastSelector = end($this->selectors);
|
284 |
|
285 |
-
if( !$lastSelector->evaldCondition ){
|
286 |
return false;
|
287 |
}
|
288 |
-
if( $lastSelector->condition && !$lastSelector->condition->compile( $env->copyEvalEnv( $env->frames ) ) ){
|
289 |
return false;
|
290 |
}
|
291 |
return true;
|
292 |
}
|
293 |
|
294 |
-
function resetCache(){
|
295 |
$this->_rulesets = null;
|
296 |
$this->_variables = null;
|
297 |
$this->lookups = array();
|
298 |
}
|
299 |
|
300 |
-
public function variables(){
|
301 |
$this->_variables = array();
|
302 |
-
foreach( $this->rules as $r){
|
303 |
-
if ($r instanceof Less_Tree_Rule && $r->variable === true) {
|
304 |
$this->_variables[$r->name] = $r;
|
305 |
}
|
306 |
}
|
307 |
}
|
308 |
|
309 |
-
public function variable($name){
|
310 |
-
|
311 |
-
if( is_null($this->_variables) ){
|
312 |
$this->variables();
|
313 |
}
|
314 |
-
return isset($this->_variables[$name]) ? $this->_variables[$name] : null;
|
315 |
}
|
316 |
|
317 |
-
public function find( $selector, $self = null ){
|
|
|
318 |
|
319 |
-
|
320 |
|
321 |
-
|
322 |
-
|
323 |
-
if( !$self ){
|
324 |
$self = $this->ruleset_id;
|
325 |
}
|
326 |
|
@@ -328,16 +316,16 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
328 |
|
329 |
$first_oelement = $selector->_oelements[0];
|
330 |
|
331 |
-
foreach($this->rules as $rule){
|
332 |
-
if( $rule instanceof Less_Tree_Ruleset && $rule->ruleset_id != $self ){
|
333 |
|
334 |
-
if( isset($rule->first_oelements[$first_oelement]) ){
|
335 |
|
336 |
-
foreach( $rule->selectors as $ruleSelector ){
|
337 |
-
$match = $selector->match($ruleSelector);
|
338 |
-
if( $match ){
|
339 |
-
if( $selector->elements_len > $match ){
|
340 |
-
$this->lookups[$key] = array_merge($this->lookups[$key], $rule->find( new Less_Tree_Selector(array_slice($selector->elements, $match)), $self));
|
341 |
} else {
|
342 |
$this->lookups[$key][] = $rule;
|
343 |
}
|
@@ -352,42 +340,39 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
352 |
return $this->lookups[$key];
|
353 |
}
|
354 |
|
355 |
-
|
356 |
/**
|
357 |
* @see Less_Tree::genCSS
|
358 |
*/
|
359 |
-
public function genCSS( $output ){
|
360 |
-
|
361 |
-
if( !$this->root ){
|
362 |
Less_Environment::$tabLevel++;
|
363 |
}
|
364 |
|
365 |
$tabRuleStr = $tabSetStr = '';
|
366 |
-
if( !Less_Parser::$options['compress'] ){
|
367 |
-
if( Less_Environment::$tabLevel ){
|
368 |
-
$tabRuleStr = "\n".str_repeat( Less_Parser::$options['indentation']
|
369 |
-
$tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation']
|
370 |
-
}else{
|
371 |
$tabSetStr = $tabRuleStr = "\n";
|
372 |
}
|
373 |
}
|
374 |
|
375 |
-
|
376 |
$ruleNodes = array();
|
377 |
$rulesetNodes = array();
|
378 |
-
foreach($this->rules as $rule){
|
379 |
|
380 |
-
$class = get_class($rule);
|
381 |
-
if( ($class === 'Less_Tree_Media') || ($class === 'Less_Tree_Directive') || ($this->root && $class === 'Less_Tree_Comment') || ($class === 'Less_Tree_Ruleset' && $rule->rules) ){
|
382 |
$rulesetNodes[] = $rule;
|
383 |
-
}else{
|
384 |
$ruleNodes[] = $rule;
|
385 |
}
|
386 |
}
|
387 |
|
388 |
// If this is the root node, we don't render
|
389 |
// a selector, or {}.
|
390 |
-
if( !$this->root ){
|
391 |
|
392 |
/*
|
393 |
debugInfo = tree.debugInfo(env, this, tabSetStr);
|
@@ -398,111 +383,108 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
398 |
}
|
399 |
*/
|
400 |
|
401 |
-
$paths_len = count($this->paths);
|
402 |
-
for( $i = 0; $i < $paths_len; $i++ ){
|
403 |
$path = $this->paths[$i];
|
404 |
$firstSelector = true;
|
405 |
|
406 |
-
foreach($path as $p){
|
407 |
$p->genCSS( $output, $firstSelector );
|
408 |
$firstSelector = false;
|
409 |
}
|
410 |
|
411 |
-
if( $i + 1 < $paths_len ){
|
412 |
$output->add( ',' . $tabSetStr );
|
413 |
}
|
414 |
}
|
415 |
|
416 |
-
$output->add( (Less_Parser::$options['compress'] ? '{' : " {") . $tabRuleStr );
|
417 |
}
|
418 |
|
419 |
// Compile rules and rulesets
|
420 |
-
$ruleNodes_len = count($ruleNodes);
|
421 |
-
$rulesetNodes_len = count($rulesetNodes);
|
422 |
-
for( $i = 0; $i < $ruleNodes_len; $i++ ){
|
423 |
$rule = $ruleNodes[$i];
|
424 |
|
425 |
// @page{ directive ends up with root elements inside it, a mix of rules and rulesets
|
426 |
// In this instance we do not know whether it is the last property
|
427 |
-
if( $i + 1 === $ruleNodes_len && (!$this->root || $rulesetNodes_len === 0 || $this->firstRoot ) ){
|
428 |
Less_Environment::$lastRule = true;
|
429 |
}
|
430 |
|
431 |
$rule->genCSS( $output );
|
432 |
|
433 |
-
if( !Less_Environment::$lastRule ){
|
434 |
$output->add( $tabRuleStr );
|
435 |
-
}else{
|
436 |
Less_Environment::$lastRule = false;
|
437 |
}
|
438 |
}
|
439 |
|
440 |
-
if( !$this->root ){
|
441 |
$output->add( $tabSetStr . '}' );
|
442 |
Less_Environment::$tabLevel--;
|
443 |
}
|
444 |
|
445 |
$firstRuleset = true;
|
446 |
-
$space = ($this->root ? $tabRuleStr : $tabSetStr);
|
447 |
-
for( $i = 0; $i < $rulesetNodes_len; $i++ ){
|
448 |
|
449 |
-
if( $ruleNodes_len && $firstRuleset ){
|
450 |
$output->add( $space );
|
451 |
-
}elseif( !$firstRuleset ){
|
452 |
$output->add( $space );
|
453 |
}
|
454 |
$firstRuleset = false;
|
455 |
-
$rulesetNodes[$i]->genCSS( $output);
|
456 |
}
|
457 |
|
458 |
-
if( !Less_Parser::$options['compress'] && $this->firstRoot ){
|
459 |
$output->add( "\n" );
|
460 |
}
|
461 |
|
462 |
}
|
463 |
|
464 |
-
|
465 |
-
|
466 |
-
if( !$this->selectors ){
|
467 |
return;
|
468 |
}
|
469 |
-
foreach($this->selectors as $selector){
|
470 |
$selector->markReferenced();
|
471 |
}
|
472 |
}
|
473 |
|
474 |
-
public function joinSelectors( $context, $selectors ){
|
475 |
$paths = array();
|
476 |
-
if( is_array($selectors) ){
|
477 |
-
foreach($selectors as $selector) {
|
478 |
-
$this->joinSelector( $paths, $context, $selector);
|
479 |
}
|
480 |
}
|
481 |
return $paths;
|
482 |
}
|
483 |
|
484 |
-
public function joinSelector( &$paths, $context, $selector){
|
485 |
-
|
486 |
$hasParentSelector = false;
|
487 |
|
488 |
-
foreach($selector->elements as $el) {
|
489 |
-
if( $el->value === '&') {
|
490 |
$hasParentSelector = true;
|
491 |
}
|
492 |
}
|
493 |
|
494 |
-
if( !$hasParentSelector ){
|
495 |
-
if( $context ){
|
496 |
-
foreach($context as $context_el){
|
497 |
-
$paths[] = array_merge($context_el, array($selector) );
|
498 |
}
|
499 |
-
}else {
|
500 |
-
$paths[] = array($selector);
|
501 |
}
|
502 |
return;
|
503 |
}
|
504 |
|
505 |
-
|
506 |
// The paths are [[Selector]]
|
507 |
// The first list is a list of comma separated selectors
|
508 |
// The inner list is a list of inheritance separated selectors
|
@@ -519,13 +501,12 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
519 |
// the current list of new selectors to add to the path.
|
520 |
// We will build it up. We initiate it with one empty selector as we "multiply" the new selectors
|
521 |
// by the parents
|
522 |
-
$newSelectors = array(array());
|
523 |
-
|
524 |
|
525 |
-
foreach( $selector->elements as $el){
|
526 |
|
527 |
// non parent reference elements just get added
|
528 |
-
if( $el->value !== '&' ){
|
529 |
$currentElements[] = $el;
|
530 |
} else {
|
531 |
// the new list of selectors to add
|
@@ -533,27 +514,27 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
533 |
|
534 |
// merge the current list of non parent selector elements
|
535 |
// on to the current list of selectors to add
|
536 |
-
if( $currentElements ){
|
537 |
-
$this->mergeElementsOnToSelectors( $currentElements, $newSelectors);
|
538 |
}
|
539 |
|
540 |
// loop through our current selectors
|
541 |
-
foreach($newSelectors as $sel){
|
542 |
|
543 |
// if we don't have any parent paths, the & might be in a mixin so that it can be used
|
544 |
// whether there are parents or not
|
545 |
-
if( !$context ){
|
546 |
// the combinator used on el should now be applied to the next element instead so that
|
547 |
// it is not lost
|
548 |
-
if( $sel ){
|
549 |
-
$sel[0]->elements = array_slice($sel[0]->elements,0);
|
550 |
-
$sel[0]->elements[] = new Less_Tree_Element($el->combinator, '', $el->index, $el->currentFileInfo );
|
551 |
}
|
552 |
$selectorsMultiplied[] = $sel;
|
553 |
-
}else {
|
554 |
|
555 |
// and the parent selectors
|
556 |
-
foreach($context as $parentSel){
|
557 |
// We need to put the current selectors
|
558 |
// then join the last selector's elements on to the parents selectors
|
559 |
|
@@ -563,39 +544,38 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
563 |
$afterParentJoin = array();
|
564 |
$newJoinedSelectorEmpty = true;
|
565 |
|
566 |
-
//construct the joined selector - if & is the first thing this will be empty,
|
567 |
// if not newJoinedSelector will be the last set of elements in the selector
|
568 |
-
if( $sel ){
|
569 |
$newSelectorPath = $sel;
|
570 |
-
$lastSelector = array_pop($newSelectorPath);
|
571 |
-
$newJoinedSelector = $selector->createDerived( array_slice($lastSelector->elements,0) );
|
572 |
$newJoinedSelectorEmpty = false;
|
573 |
-
}
|
574 |
-
|
575 |
-
$newJoinedSelector = $selector->createDerived(array());
|
576 |
}
|
577 |
|
578 |
-
//put together the parent selectors after the join
|
579 |
-
if ( count($parentSel) > 1) {
|
580 |
-
$afterParentJoin = array_merge($afterParentJoin, array_slice($parentSel,1) );
|
581 |
}
|
582 |
|
583 |
-
if ( $parentSel ){
|
584 |
$newJoinedSelectorEmpty = false;
|
585 |
|
586 |
// join the elements so far with the first part of the parent
|
587 |
-
$newJoinedSelector->elements[] = new Less_Tree_Element( $el->combinator, $parentSel[0]->elements[0]->value, $el->index, $el->currentFileInfo);
|
588 |
|
589 |
-
$newJoinedSelector->elements = array_merge( $newJoinedSelector->elements, array_slice($parentSel[0]->elements, 1) );
|
590 |
}
|
591 |
|
592 |
-
if (!$newJoinedSelectorEmpty) {
|
593 |
// now add the joined selector
|
594 |
$newSelectorPath[] = $newJoinedSelector;
|
595 |
}
|
596 |
|
597 |
// and the rest of the parent
|
598 |
-
$newSelectorPath = array_merge($newSelectorPath, $afterParentJoin);
|
599 |
|
600 |
// add that to our new set of selectors
|
601 |
$selectorsMultiplied[] = $newSelectorPath;
|
@@ -611,31 +591,29 @@ class Less_Tree_Ruleset extends Less_Tree{
|
|
611 |
|
612 |
// if we have any elements left over (e.g. .a& .b == .b)
|
613 |
// add them on to all the current selectors
|
614 |
-
if( $currentElements ){
|
615 |
-
$this->mergeElementsOnToSelectors($currentElements, $newSelectors);
|
616 |
}
|
617 |
-
foreach( $newSelectors as $new_sel){
|
618 |
-
if( $new_sel ){
|
619 |
$paths[] = $new_sel;
|
620 |
}
|
621 |
}
|
622 |
}
|
623 |
|
624 |
-
function mergeElementsOnToSelectors( $elements, &$selectors){
|
625 |
-
|
626 |
-
|
627 |
-
$selectors[] = array( new Less_Tree_Selector($elements) );
|
628 |
return;
|
629 |
}
|
630 |
|
631 |
-
|
632 |
-
foreach( $selectors as &$sel){
|
633 |
|
634 |
// if the previous thing in sel is a parent this needs to join on to it
|
635 |
-
if( $sel ){
|
636 |
-
$last = count($sel)-1;
|
637 |
-
$sel[$last] = $sel[$last]->createDerived( array_merge($sel[$last]->elements, $elements) );
|
638 |
-
}else{
|
639 |
$sel[] = new Less_Tree_Selector( $elements );
|
640 |
}
|
641 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Ruleset extends Less_Tree {
|
10 |
|
11 |
protected $lookups;
|
12 |
public $_variables;
|
29 |
|
30 |
public $first_oelements;
|
31 |
|
32 |
+
public function SetRulesetIndex() {
|
33 |
$this->ruleset_id = Less_Parser::$next_id++;
|
34 |
$this->originalRuleset = $this->ruleset_id;
|
35 |
|
36 |
+
if ( $this->selectors ) {
|
37 |
+
foreach ( $this->selectors as $sel ) {
|
38 |
+
if ( $sel->_oelements ) {
|
39 |
$this->first_oelements[$sel->_oelements[0]] = true;
|
40 |
}
|
41 |
}
|
42 |
}
|
43 |
}
|
44 |
|
45 |
+
public function __construct( $selectors, $rules, $strictImports = null ) {
|
46 |
$this->selectors = $selectors;
|
47 |
$this->rules = $rules;
|
48 |
$this->lookups = array();
|
50 |
$this->SetRulesetIndex();
|
51 |
}
|
52 |
|
53 |
+
public function accept( $visitor ) {
|
54 |
+
if ( $this->paths ) {
|
55 |
+
$paths_len = count( $this->paths );
|
56 |
+
for ( $i = 0,$paths_len; $i < $paths_len; $i++ ) {
|
57 |
+
$this->paths[$i] = $visitor->visitArray( $this->paths[$i] );
|
58 |
}
|
59 |
+
} elseif ( $this->selectors ) {
|
60 |
+
$this->selectors = $visitor->visitArray( $this->selectors );
|
61 |
}
|
62 |
|
63 |
+
if ( $this->rules ) {
|
64 |
+
$this->rules = $visitor->visitArray( $this->rules );
|
65 |
}
|
66 |
}
|
67 |
|
68 |
+
public function compile( $env ) {
|
69 |
+
$ruleset = $this->PrepareRuleset( $env );
|
|
|
|
|
70 |
|
71 |
// Store the frames around mixin definitions,
|
72 |
// so they can be evaluated like closures when the time comes.
|
73 |
+
$rsRuleCnt = count( $ruleset->rules );
|
74 |
+
for ( $i = 0; $i < $rsRuleCnt; $i++ ) {
|
75 |
+
if ( $ruleset->rules[$i] instanceof Less_Tree_Mixin_Definition || $ruleset->rules[$i] instanceof Less_Tree_DetachedRuleset ) {
|
76 |
+
$ruleset->rules[$i] = $ruleset->rules[$i]->compile( $env );
|
77 |
}
|
78 |
}
|
79 |
|
80 |
$mediaBlockCount = 0;
|
81 |
+
if ( $env instanceof Less_Environment ) {
|
82 |
+
$mediaBlockCount = count( $env->mediaBlocks );
|
83 |
}
|
84 |
|
85 |
// Evaluate mixin calls.
|
86 |
$this->EvalMixinCalls( $ruleset, $env, $rsRuleCnt );
|
87 |
|
|
|
88 |
// Evaluate everything else
|
89 |
+
for ( $i = 0; $i < $rsRuleCnt; $i++ ) {
|
90 |
+
if ( !( $ruleset->rules[$i] instanceof Less_Tree_Mixin_Definition || $ruleset->rules[$i] instanceof Less_Tree_DetachedRuleset ) ) {
|
91 |
+
$ruleset->rules[$i] = $ruleset->rules[$i]->compile( $env );
|
92 |
}
|
93 |
}
|
94 |
|
95 |
+
// Evaluate everything else
|
96 |
+
for ( $i = 0; $i < $rsRuleCnt; $i++ ) {
|
97 |
$rule = $ruleset->rules[$i];
|
98 |
|
99 |
+
// for rulesets, check if it is a css guard and can be removed
|
100 |
+
if ( $rule instanceof Less_Tree_Ruleset && $rule->selectors && count( $rule->selectors ) === 1 ) {
|
101 |
|
102 |
+
// check if it can be folded in (e.g. & where)
|
103 |
+
if ( $rule->selectors[0]->isJustParentSelector() ) {
|
104 |
+
array_splice( $ruleset->rules, $i--, 1 );
|
105 |
$rsRuleCnt--;
|
106 |
|
107 |
+
for ( $j = 0; $j < count( $rule->rules ); $j++ ) {
|
108 |
$subRule = $rule->rules[$j];
|
109 |
+
if ( !( $subRule instanceof Less_Tree_Rule ) || !$subRule->variable ) {
|
110 |
+
array_splice( $ruleset->rules, ++$i, 0, array( $subRule ) );
|
111 |
$rsRuleCnt++;
|
112 |
}
|
113 |
}
|
114 |
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
|
|
118 |
|
119 |
// Pop the stack
|
120 |
$env->shiftFrame();
|
121 |
|
122 |
+
if ( $mediaBlockCount ) {
|
123 |
+
$len = count( $env->mediaBlocks );
|
124 |
+
for ( $i = $mediaBlockCount; $i < $len; $i++ ) {
|
125 |
+
$env->mediaBlocks[$i]->bubbleSelectors( $ruleset->selectors );
|
126 |
}
|
127 |
}
|
128 |
|
135 |
* @param Less_Tree_Ruleset $ruleset
|
136 |
* @param integer $rsRuleCnt
|
137 |
*/
|
138 |
+
private function EvalMixinCalls( $ruleset, $env, &$rsRuleCnt ) {
|
139 |
+
for ( $i = 0; $i < $rsRuleCnt; $i++ ) {
|
140 |
$rule = $ruleset->rules[$i];
|
141 |
|
142 |
+
if ( $rule instanceof Less_Tree_Mixin_Call ) {
|
143 |
+
$rule = $rule->compile( $env );
|
144 |
|
145 |
$temp = array();
|
146 |
+
foreach ( $rule as $r ) {
|
147 |
+
if ( ( $r instanceof Less_Tree_Rule ) && $r->variable ) {
|
148 |
// do not pollute the scope if the variable is
|
149 |
// already there. consider returning false here
|
150 |
// but we need a way to "return" variable from mixins
|
151 |
+
if ( !$ruleset->variable( $r->name ) ) {
|
152 |
$temp[] = $r;
|
153 |
}
|
154 |
+
} else {
|
155 |
$temp[] = $r;
|
156 |
}
|
157 |
}
|
158 |
+
$temp_count = count( $temp ) - 1;
|
159 |
+
array_splice( $ruleset->rules, $i, 1, $temp );
|
160 |
$rsRuleCnt += $temp_count;
|
161 |
$i += $temp_count;
|
162 |
$ruleset->resetCache();
|
163 |
|
164 |
+
} elseif ( $rule instanceof Less_Tree_RulesetCall ) {
|
165 |
|
166 |
+
$rule = $rule->compile( $env );
|
167 |
$rules = array();
|
168 |
+
foreach ( $rule->rules as $r ) {
|
169 |
+
if ( ( $r instanceof Less_Tree_Rule ) && $r->variable ) {
|
170 |
continue;
|
171 |
}
|
172 |
$rules[] = $r;
|
173 |
}
|
174 |
|
175 |
+
array_splice( $ruleset->rules, $i, 1, $rules );
|
176 |
+
$temp_count = count( $rules );
|
177 |
$rsRuleCnt += $temp_count - 1;
|
178 |
+
$i += $temp_count - 1;
|
179 |
$ruleset->resetCache();
|
180 |
}
|
181 |
|
182 |
}
|
183 |
}
|
184 |
|
|
|
185 |
/**
|
186 |
* Compile the selectors and create a new ruleset object for the compile() method
|
187 |
*
|
188 |
*/
|
189 |
+
private function PrepareRuleset( $env ) {
|
|
|
190 |
$hasOnePassingSelector = false;
|
191 |
$selectors = array();
|
192 |
+
if ( $this->selectors ) {
|
193 |
+
Less_Tree_DefaultFunc::error( "it is currently only allowed in parametric mixin guards," );
|
194 |
|
195 |
+
foreach ( $this->selectors as $s ) {
|
196 |
+
$selector = $s->compile( $env );
|
197 |
$selectors[] = $selector;
|
198 |
+
if ( $selector->evaldCondition ) {
|
199 |
$hasOnePassingSelector = true;
|
200 |
}
|
201 |
}
|
205 |
$hasOnePassingSelector = true;
|
206 |
}
|
207 |
|
208 |
+
if ( $this->rules && $hasOnePassingSelector ) {
|
209 |
$rules = $this->rules;
|
210 |
+
} else {
|
211 |
$rules = array();
|
212 |
}
|
213 |
|
214 |
+
$ruleset = new Less_Tree_Ruleset( $selectors, $rules, $this->strictImports );
|
215 |
|
216 |
$ruleset->originalRuleset = $this->ruleset_id;
|
217 |
|
219 |
$ruleset->firstRoot = $this->firstRoot;
|
220 |
$ruleset->allowImports = $this->allowImports;
|
221 |
|
|
|
222 |
// push the current ruleset to the frames stack
|
223 |
+
$env->unshiftFrame( $ruleset );
|
|
|
224 |
|
225 |
// Evaluate imports
|
226 |
+
if ( $ruleset->root || $ruleset->allowImports || !$ruleset->strictImports ) {
|
227 |
+
$ruleset->evalImports( $env );
|
228 |
}
|
229 |
|
230 |
return $ruleset;
|
231 |
}
|
232 |
|
233 |
+
function evalImports( $env ) {
|
234 |
+
$rules_len = count( $this->rules );
|
235 |
+
for ( $i = 0; $i < $rules_len; $i++ ) {
|
|
|
236 |
$rule = $this->rules[$i];
|
237 |
|
238 |
+
if ( $rule instanceof Less_Tree_Import ) {
|
239 |
+
$rules = $rule->compile( $env );
|
240 |
+
if ( is_array( $rules ) ) {
|
241 |
+
array_splice( $this->rules, $i, 1, $rules );
|
242 |
+
$temp_count = count( $rules ) - 1;
|
243 |
$i += $temp_count;
|
244 |
$rules_len += $temp_count;
|
245 |
+
} else {
|
246 |
+
array_splice( $this->rules, $i, 1, array( $rules ) );
|
247 |
}
|
248 |
|
249 |
$this->resetCache();
|
251 |
}
|
252 |
}
|
253 |
|
254 |
+
function makeImportant() {
|
|
|
255 |
$important_rules = array();
|
256 |
+
foreach ( $this->rules as $rule ) {
|
257 |
+
if ( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_Ruleset || $rule instanceof Less_Tree_NameValue ) {
|
258 |
$important_rules[] = $rule->makeImportant();
|
259 |
+
} else {
|
260 |
$important_rules[] = $rule;
|
261 |
}
|
262 |
}
|
263 |
|
264 |
+
return new Less_Tree_Ruleset( $this->selectors, $important_rules, $this->strictImports );
|
265 |
}
|
266 |
|
267 |
+
public function matchArgs( $args ) {
|
268 |
return !$args;
|
269 |
}
|
270 |
|
271 |
// lets you call a css selector with a guard
|
272 |
+
public function matchCondition( $args, $env ) {
|
273 |
+
$lastSelector = end( $this->selectors );
|
274 |
|
275 |
+
if ( !$lastSelector->evaldCondition ) {
|
276 |
return false;
|
277 |
}
|
278 |
+
if ( $lastSelector->condition && !$lastSelector->condition->compile( $env->copyEvalEnv( $env->frames ) ) ) {
|
279 |
return false;
|
280 |
}
|
281 |
return true;
|
282 |
}
|
283 |
|
284 |
+
function resetCache() {
|
285 |
$this->_rulesets = null;
|
286 |
$this->_variables = null;
|
287 |
$this->lookups = array();
|
288 |
}
|
289 |
|
290 |
+
public function variables() {
|
291 |
$this->_variables = array();
|
292 |
+
foreach ( $this->rules as $r ) {
|
293 |
+
if ( $r instanceof Less_Tree_Rule && $r->variable === true ) {
|
294 |
$this->_variables[$r->name] = $r;
|
295 |
}
|
296 |
}
|
297 |
}
|
298 |
|
299 |
+
public function variable( $name ) {
|
300 |
+
if ( is_null( $this->_variables ) ) {
|
|
|
301 |
$this->variables();
|
302 |
}
|
303 |
+
return isset( $this->_variables[$name] ) ? $this->_variables[$name] : null;
|
304 |
}
|
305 |
|
306 |
+
public function find( $selector, $self = null ) {
|
307 |
+
$key = implode( ' ', $selector->_oelements );
|
308 |
|
309 |
+
if ( !isset( $this->lookups[$key] ) ) {
|
310 |
|
311 |
+
if ( !$self ) {
|
|
|
|
|
312 |
$self = $this->ruleset_id;
|
313 |
}
|
314 |
|
316 |
|
317 |
$first_oelement = $selector->_oelements[0];
|
318 |
|
319 |
+
foreach ( $this->rules as $rule ) {
|
320 |
+
if ( $rule instanceof Less_Tree_Ruleset && $rule->ruleset_id != $self ) {
|
321 |
|
322 |
+
if ( isset( $rule->first_oelements[$first_oelement] ) ) {
|
323 |
|
324 |
+
foreach ( $rule->selectors as $ruleSelector ) {
|
325 |
+
$match = $selector->match( $ruleSelector );
|
326 |
+
if ( $match ) {
|
327 |
+
if ( $selector->elements_len > $match ) {
|
328 |
+
$this->lookups[$key] = array_merge( $this->lookups[$key], $rule->find( new Less_Tree_Selector( array_slice( $selector->elements, $match ) ), $self ) );
|
329 |
} else {
|
330 |
$this->lookups[$key][] = $rule;
|
331 |
}
|
340 |
return $this->lookups[$key];
|
341 |
}
|
342 |
|
|
|
343 |
/**
|
344 |
* @see Less_Tree::genCSS
|
345 |
*/
|
346 |
+
public function genCSS( $output ) {
|
347 |
+
if ( !$this->root ) {
|
|
|
348 |
Less_Environment::$tabLevel++;
|
349 |
}
|
350 |
|
351 |
$tabRuleStr = $tabSetStr = '';
|
352 |
+
if ( !Less_Parser::$options['compress'] ) {
|
353 |
+
if ( Less_Environment::$tabLevel ) {
|
354 |
+
$tabRuleStr = "\n".str_repeat( Less_Parser::$options['indentation'], Less_Environment::$tabLevel );
|
355 |
+
$tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation'], Less_Environment::$tabLevel - 1 );
|
356 |
+
} else {
|
357 |
$tabSetStr = $tabRuleStr = "\n";
|
358 |
}
|
359 |
}
|
360 |
|
|
|
361 |
$ruleNodes = array();
|
362 |
$rulesetNodes = array();
|
363 |
+
foreach ( $this->rules as $rule ) {
|
364 |
|
365 |
+
$class = get_class( $rule );
|
366 |
+
if ( ( $class === 'Less_Tree_Media' ) || ( $class === 'Less_Tree_Directive' ) || ( $this->root && $class === 'Less_Tree_Comment' ) || ( $class === 'Less_Tree_Ruleset' && $rule->rules ) ) {
|
367 |
$rulesetNodes[] = $rule;
|
368 |
+
} else {
|
369 |
$ruleNodes[] = $rule;
|
370 |
}
|
371 |
}
|
372 |
|
373 |
// If this is the root node, we don't render
|
374 |
// a selector, or {}.
|
375 |
+
if ( !$this->root ) {
|
376 |
|
377 |
/*
|
378 |
debugInfo = tree.debugInfo(env, this, tabSetStr);
|
383 |
}
|
384 |
*/
|
385 |
|
386 |
+
$paths_len = count( $this->paths );
|
387 |
+
for ( $i = 0; $i < $paths_len; $i++ ) {
|
388 |
$path = $this->paths[$i];
|
389 |
$firstSelector = true;
|
390 |
|
391 |
+
foreach ( $path as $p ) {
|
392 |
$p->genCSS( $output, $firstSelector );
|
393 |
$firstSelector = false;
|
394 |
}
|
395 |
|
396 |
+
if ( $i + 1 < $paths_len ) {
|
397 |
$output->add( ',' . $tabSetStr );
|
398 |
}
|
399 |
}
|
400 |
|
401 |
+
$output->add( ( Less_Parser::$options['compress'] ? '{' : " {" ) . $tabRuleStr );
|
402 |
}
|
403 |
|
404 |
// Compile rules and rulesets
|
405 |
+
$ruleNodes_len = count( $ruleNodes );
|
406 |
+
$rulesetNodes_len = count( $rulesetNodes );
|
407 |
+
for ( $i = 0; $i < $ruleNodes_len; $i++ ) {
|
408 |
$rule = $ruleNodes[$i];
|
409 |
|
410 |
// @page{ directive ends up with root elements inside it, a mix of rules and rulesets
|
411 |
// In this instance we do not know whether it is the last property
|
412 |
+
if ( $i + 1 === $ruleNodes_len && ( !$this->root || $rulesetNodes_len === 0 || $this->firstRoot ) ) {
|
413 |
Less_Environment::$lastRule = true;
|
414 |
}
|
415 |
|
416 |
$rule->genCSS( $output );
|
417 |
|
418 |
+
if ( !Less_Environment::$lastRule ) {
|
419 |
$output->add( $tabRuleStr );
|
420 |
+
} else {
|
421 |
Less_Environment::$lastRule = false;
|
422 |
}
|
423 |
}
|
424 |
|
425 |
+
if ( !$this->root ) {
|
426 |
$output->add( $tabSetStr . '}' );
|
427 |
Less_Environment::$tabLevel--;
|
428 |
}
|
429 |
|
430 |
$firstRuleset = true;
|
431 |
+
$space = ( $this->root ? $tabRuleStr : $tabSetStr );
|
432 |
+
for ( $i = 0; $i < $rulesetNodes_len; $i++ ) {
|
433 |
|
434 |
+
if ( $ruleNodes_len && $firstRuleset ) {
|
435 |
$output->add( $space );
|
436 |
+
} elseif ( !$firstRuleset ) {
|
437 |
$output->add( $space );
|
438 |
}
|
439 |
$firstRuleset = false;
|
440 |
+
$rulesetNodes[$i]->genCSS( $output );
|
441 |
}
|
442 |
|
443 |
+
if ( !Less_Parser::$options['compress'] && $this->firstRoot ) {
|
444 |
$output->add( "\n" );
|
445 |
}
|
446 |
|
447 |
}
|
448 |
|
449 |
+
function markReferenced() {
|
450 |
+
if ( !$this->selectors ) {
|
|
|
451 |
return;
|
452 |
}
|
453 |
+
foreach ( $this->selectors as $selector ) {
|
454 |
$selector->markReferenced();
|
455 |
}
|
456 |
}
|
457 |
|
458 |
+
public function joinSelectors( $context, $selectors ) {
|
459 |
$paths = array();
|
460 |
+
if ( is_array( $selectors ) ) {
|
461 |
+
foreach ( $selectors as $selector ) {
|
462 |
+
$this->joinSelector( $paths, $context, $selector );
|
463 |
}
|
464 |
}
|
465 |
return $paths;
|
466 |
}
|
467 |
|
468 |
+
public function joinSelector( &$paths, $context, $selector ) {
|
|
|
469 |
$hasParentSelector = false;
|
470 |
|
471 |
+
foreach ( $selector->elements as $el ) {
|
472 |
+
if ( $el->value === '&' ) {
|
473 |
$hasParentSelector = true;
|
474 |
}
|
475 |
}
|
476 |
|
477 |
+
if ( !$hasParentSelector ) {
|
478 |
+
if ( $context ) {
|
479 |
+
foreach ( $context as $context_el ) {
|
480 |
+
$paths[] = array_merge( $context_el, array( $selector ) );
|
481 |
}
|
482 |
+
} else {
|
483 |
+
$paths[] = array( $selector );
|
484 |
}
|
485 |
return;
|
486 |
}
|
487 |
|
|
|
488 |
// The paths are [[Selector]]
|
489 |
// The first list is a list of comma separated selectors
|
490 |
// The inner list is a list of inheritance separated selectors
|
501 |
// the current list of new selectors to add to the path.
|
502 |
// We will build it up. We initiate it with one empty selector as we "multiply" the new selectors
|
503 |
// by the parents
|
504 |
+
$newSelectors = array( array() );
|
|
|
505 |
|
506 |
+
foreach ( $selector->elements as $el ) {
|
507 |
|
508 |
// non parent reference elements just get added
|
509 |
+
if ( $el->value !== '&' ) {
|
510 |
$currentElements[] = $el;
|
511 |
} else {
|
512 |
// the new list of selectors to add
|
514 |
|
515 |
// merge the current list of non parent selector elements
|
516 |
// on to the current list of selectors to add
|
517 |
+
if ( $currentElements ) {
|
518 |
+
$this->mergeElementsOnToSelectors( $currentElements, $newSelectors );
|
519 |
}
|
520 |
|
521 |
// loop through our current selectors
|
522 |
+
foreach ( $newSelectors as $sel ) {
|
523 |
|
524 |
// if we don't have any parent paths, the & might be in a mixin so that it can be used
|
525 |
// whether there are parents or not
|
526 |
+
if ( !$context ) {
|
527 |
// the combinator used on el should now be applied to the next element instead so that
|
528 |
// it is not lost
|
529 |
+
if ( $sel ) {
|
530 |
+
$sel[0]->elements = array_slice( $sel[0]->elements, 0 );
|
531 |
+
$sel[0]->elements[] = new Less_Tree_Element( $el->combinator, '', $el->index, $el->currentFileInfo );
|
532 |
}
|
533 |
$selectorsMultiplied[] = $sel;
|
534 |
+
} else {
|
535 |
|
536 |
// and the parent selectors
|
537 |
+
foreach ( $context as $parentSel ) {
|
538 |
// We need to put the current selectors
|
539 |
// then join the last selector's elements on to the parents selectors
|
540 |
|
544 |
$afterParentJoin = array();
|
545 |
$newJoinedSelectorEmpty = true;
|
546 |
|
547 |
+
// construct the joined selector - if & is the first thing this will be empty,
|
548 |
// if not newJoinedSelector will be the last set of elements in the selector
|
549 |
+
if ( $sel ) {
|
550 |
$newSelectorPath = $sel;
|
551 |
+
$lastSelector = array_pop( $newSelectorPath );
|
552 |
+
$newJoinedSelector = $selector->createDerived( array_slice( $lastSelector->elements, 0 ) );
|
553 |
$newJoinedSelectorEmpty = false;
|
554 |
+
} else {
|
555 |
+
$newJoinedSelector = $selector->createDerived( array() );
|
|
|
556 |
}
|
557 |
|
558 |
+
// put together the parent selectors after the join
|
559 |
+
if ( count( $parentSel ) > 1 ) {
|
560 |
+
$afterParentJoin = array_merge( $afterParentJoin, array_slice( $parentSel, 1 ) );
|
561 |
}
|
562 |
|
563 |
+
if ( $parentSel ) {
|
564 |
$newJoinedSelectorEmpty = false;
|
565 |
|
566 |
// join the elements so far with the first part of the parent
|
567 |
+
$newJoinedSelector->elements[] = new Less_Tree_Element( $el->combinator, $parentSel[0]->elements[0]->value, $el->index, $el->currentFileInfo );
|
568 |
|
569 |
+
$newJoinedSelector->elements = array_merge( $newJoinedSelector->elements, array_slice( $parentSel[0]->elements, 1 ) );
|
570 |
}
|
571 |
|
572 |
+
if ( !$newJoinedSelectorEmpty ) {
|
573 |
// now add the joined selector
|
574 |
$newSelectorPath[] = $newJoinedSelector;
|
575 |
}
|
576 |
|
577 |
// and the rest of the parent
|
578 |
+
$newSelectorPath = array_merge( $newSelectorPath, $afterParentJoin );
|
579 |
|
580 |
// add that to our new set of selectors
|
581 |
$selectorsMultiplied[] = $newSelectorPath;
|
591 |
|
592 |
// if we have any elements left over (e.g. .a& .b == .b)
|
593 |
// add them on to all the current selectors
|
594 |
+
if ( $currentElements ) {
|
595 |
+
$this->mergeElementsOnToSelectors( $currentElements, $newSelectors );
|
596 |
}
|
597 |
+
foreach ( $newSelectors as $new_sel ) {
|
598 |
+
if ( $new_sel ) {
|
599 |
$paths[] = $new_sel;
|
600 |
}
|
601 |
}
|
602 |
}
|
603 |
|
604 |
+
function mergeElementsOnToSelectors( $elements, &$selectors ) {
|
605 |
+
if ( !$selectors ) {
|
606 |
+
$selectors[] = array( new Less_Tree_Selector( $elements ) );
|
|
|
607 |
return;
|
608 |
}
|
609 |
|
610 |
+
foreach ( $selectors as &$sel ) {
|
|
|
611 |
|
612 |
// if the previous thing in sel is a parent this needs to join on to it
|
613 |
+
if ( $sel ) {
|
614 |
+
$last = count( $sel ) - 1;
|
615 |
+
$sel[$last] = $sel[$last]->createDerived( array_merge( $sel[$last]->elements, $elements ) );
|
616 |
+
} else {
|
617 |
$sel[] = new Less_Tree_Selector( $elements );
|
618 |
}
|
619 |
}
|
base/inc/lib/Less/Tree/RulesetCall.php
CHANGED
@@ -6,21 +6,21 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_RulesetCall extends Less_Tree{
|
10 |
|
11 |
public $variable;
|
12 |
public $type = "RulesetCall";
|
13 |
|
14 |
-
|
15 |
$this->variable = $variable;
|
16 |
}
|
17 |
|
18 |
-
|
|
|
19 |
|
20 |
-
|
21 |
-
$variable = new Less_Tree_Variable($this->variable);
|
22 |
-
$detachedRuleset = $variable->compile($env);
|
23 |
-
return $detachedRuleset->callEval($env);
|
24 |
}
|
25 |
}
|
26 |
-
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_RulesetCall extends Less_Tree {
|
10 |
|
11 |
public $variable;
|
12 |
public $type = "RulesetCall";
|
13 |
|
14 |
+
public function __construct( $variable ) {
|
15 |
$this->variable = $variable;
|
16 |
}
|
17 |
|
18 |
+
public function accept( $visitor ) {
|
19 |
+
}
|
20 |
|
21 |
+
public function compile( $env ) {
|
22 |
+
$variable = new Less_Tree_Variable( $this->variable );
|
23 |
+
$detachedRuleset = $variable->compile( $env );
|
24 |
+
return $detachedRuleset->callEval( $env );
|
25 |
}
|
26 |
}
|
|
base/inc/lib/Less/Tree/Selector.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Selector extends Less_Tree{
|
10 |
|
11 |
public $elements;
|
12 |
public $condition;
|
@@ -29,50 +29,47 @@ class Less_Tree_Selector extends Less_Tree{
|
|
29 |
/**
|
30 |
* @param boolean $isReferenced
|
31 |
*/
|
32 |
-
public function __construct( $elements, $extendList = array()
|
33 |
-
|
34 |
$this->elements = $elements;
|
35 |
-
$this->elements_len = count($elements);
|
36 |
$this->extendList = $extendList;
|
37 |
$this->condition = $condition;
|
38 |
-
if( $currentFileInfo ){
|
39 |
$this->currentFileInfo = $currentFileInfo;
|
40 |
}
|
41 |
$this->isReferenced = $isReferenced;
|
42 |
-
if( !$condition ){
|
43 |
$this->evaldCondition = true;
|
44 |
}
|
45 |
|
46 |
$this->CacheElements();
|
47 |
}
|
48 |
|
49 |
-
|
50 |
-
$this->elements = $visitor->visitArray($this->elements);
|
51 |
-
$this->extendList = $visitor->visitArray($this->extendList);
|
52 |
-
if( $this->condition ){
|
53 |
-
$this->condition = $visitor->visitObj($this->condition);
|
54 |
}
|
55 |
|
56 |
-
if( $visitor instanceof Less_Visitor_extendFinder ){
|
57 |
$this->CacheElements();
|
58 |
}
|
59 |
}
|
60 |
|
61 |
-
|
62 |
-
$newSelector = new Less_Tree_Selector( $elements, ($extendList ? $extendList : $this->extendList), null, $this->index, $this->currentFileInfo, $this->isReferenced);
|
63 |
$newSelector->evaldCondition = $evaldCondition ? $evaldCondition : $this->evaldCondition;
|
64 |
return $newSelector;
|
65 |
}
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
if( !$other->_oelements || ($this->elements_len < $other->_oelements_len) ){
|
71 |
return 0;
|
72 |
}
|
73 |
|
74 |
-
for( $i = 0; $i < $other->_oelements_len; $i++ ){
|
75 |
-
if( $this->elements[$i]->value !== $other->_oelements[$i]) {
|
76 |
return 0;
|
77 |
}
|
78 |
}
|
@@ -80,93 +77,88 @@ class Less_Tree_Selector extends Less_Tree{
|
|
80 |
return $other->_oelements_len; // return number of matched elements
|
81 |
}
|
82 |
|
83 |
-
|
84 |
-
public function CacheElements(){
|
85 |
-
|
86 |
$this->_oelements = array();
|
87 |
$this->_oelements_assoc = array();
|
88 |
|
89 |
$css = '';
|
90 |
|
91 |
-
foreach($this->elements as $v){
|
92 |
|
93 |
$css .= $v->combinator;
|
94 |
-
if( !$v->value_is_object ){
|
95 |
$css .= $v->value;
|
96 |
continue;
|
97 |
}
|
98 |
|
99 |
-
if( !property_exists($v->value,'value') || !is_string($v->value->value) ){
|
100 |
$this->cacheable = false;
|
101 |
return;
|
102 |
}
|
103 |
$css .= $v->value->value;
|
104 |
}
|
105 |
|
106 |
-
$this->_oelements_len = preg_match_all('/[,&#\.\w-](?:[\w-]|(?:\\\\.))*/', $css, $matches);
|
107 |
-
if( $this->_oelements_len ){
|
108 |
$this->_oelements = $matches[0];
|
109 |
|
110 |
-
if( $this->_oelements[0] === '&' ){
|
111 |
-
array_shift($this->_oelements);
|
112 |
$this->_oelements_len--;
|
113 |
}
|
114 |
|
115 |
-
$this->_oelements_assoc = array_fill_keys($this->_oelements, true);
|
116 |
}
|
117 |
}
|
118 |
|
119 |
-
public function isJustParentSelector(){
|
120 |
return !$this->mediaEmpty &&
|
121 |
-
count($this->elements) === 1 &&
|
122 |
$this->elements[0]->value === '&' &&
|
123 |
-
($this->elements[0]->combinator === ' ' || $this->elements[0]->combinator === '');
|
124 |
}
|
125 |
|
126 |
-
public function compile($env) {
|
127 |
-
|
128 |
$elements = array();
|
129 |
-
foreach($this->elements as $el){
|
130 |
-
$elements[] = $el->compile($env);
|
131 |
}
|
132 |
|
133 |
$extendList = array();
|
134 |
-
foreach($this->extendList as $el){
|
135 |
-
$extendList[] = $el->compile($el);
|
136 |
}
|
137 |
|
138 |
$evaldCondition = false;
|
139 |
-
if( $this->condition ){
|
140 |
-
$evaldCondition = $this->condition->compile($env);
|
141 |
}
|
142 |
|
143 |
return $this->createDerived( $elements, $extendList, $evaldCondition );
|
144 |
}
|
145 |
|
146 |
-
|
147 |
/**
|
148 |
* @see Less_Tree::genCSS
|
149 |
*/
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
$output->add(' ', $this->currentFileInfo, $this->index);
|
154 |
}
|
155 |
|
156 |
-
foreach($this->elements as $element){
|
157 |
$element->genCSS( $output );
|
158 |
}
|
159 |
}
|
160 |
|
161 |
-
|
162 |
$this->isReferenced = true;
|
163 |
}
|
164 |
|
165 |
-
|
166 |
-
return !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference'] || $this->isReferenced;
|
167 |
}
|
168 |
|
169 |
-
|
170 |
return $this->evaldCondition;
|
171 |
}
|
172 |
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Selector extends Less_Tree {
|
10 |
|
11 |
public $elements;
|
12 |
public $condition;
|
29 |
/**
|
30 |
* @param boolean $isReferenced
|
31 |
*/
|
32 |
+
public function __construct( $elements, $extendList = array(), $condition = null, $index = null, $currentFileInfo = null, $isReferenced = null ) {
|
|
|
33 |
$this->elements = $elements;
|
34 |
+
$this->elements_len = count( $elements );
|
35 |
$this->extendList = $extendList;
|
36 |
$this->condition = $condition;
|
37 |
+
if ( $currentFileInfo ) {
|
38 |
$this->currentFileInfo = $currentFileInfo;
|
39 |
}
|
40 |
$this->isReferenced = $isReferenced;
|
41 |
+
if ( !$condition ) {
|
42 |
$this->evaldCondition = true;
|
43 |
}
|
44 |
|
45 |
$this->CacheElements();
|
46 |
}
|
47 |
|
48 |
+
public function accept( $visitor ) {
|
49 |
+
$this->elements = $visitor->visitArray( $this->elements );
|
50 |
+
$this->extendList = $visitor->visitArray( $this->extendList );
|
51 |
+
if ( $this->condition ) {
|
52 |
+
$this->condition = $visitor->visitObj( $this->condition );
|
53 |
}
|
54 |
|
55 |
+
if ( $visitor instanceof Less_Visitor_extendFinder ) {
|
56 |
$this->CacheElements();
|
57 |
}
|
58 |
}
|
59 |
|
60 |
+
public function createDerived( $elements, $extendList = null, $evaldCondition = null ) {
|
61 |
+
$newSelector = new Less_Tree_Selector( $elements, ( $extendList ? $extendList : $this->extendList ), null, $this->index, $this->currentFileInfo, $this->isReferenced );
|
62 |
$newSelector->evaldCondition = $evaldCondition ? $evaldCondition : $this->evaldCondition;
|
63 |
return $newSelector;
|
64 |
}
|
65 |
|
66 |
+
public function match( $other ) {
|
67 |
+
if ( !$other->_oelements || ( $this->elements_len < $other->_oelements_len ) ) {
|
|
|
|
|
68 |
return 0;
|
69 |
}
|
70 |
|
71 |
+
for ( $i = 0; $i < $other->_oelements_len; $i++ ) {
|
72 |
+
if ( $this->elements[$i]->value !== $other->_oelements[$i] ) {
|
73 |
return 0;
|
74 |
}
|
75 |
}
|
77 |
return $other->_oelements_len; // return number of matched elements
|
78 |
}
|
79 |
|
80 |
+
public function CacheElements() {
|
|
|
|
|
81 |
$this->_oelements = array();
|
82 |
$this->_oelements_assoc = array();
|
83 |
|
84 |
$css = '';
|
85 |
|
86 |
+
foreach ( $this->elements as $v ) {
|
87 |
|
88 |
$css .= $v->combinator;
|
89 |
+
if ( !$v->value_is_object ) {
|
90 |
$css .= $v->value;
|
91 |
continue;
|
92 |
}
|
93 |
|
94 |
+
if ( !property_exists( $v->value, 'value' ) || !is_string( $v->value->value ) ) {
|
95 |
$this->cacheable = false;
|
96 |
return;
|
97 |
}
|
98 |
$css .= $v->value->value;
|
99 |
}
|
100 |
|
101 |
+
$this->_oelements_len = preg_match_all( '/[,&#\.\w-](?:[\w-]|(?:\\\\.))*/', $css, $matches );
|
102 |
+
if ( $this->_oelements_len ) {
|
103 |
$this->_oelements = $matches[0];
|
104 |
|
105 |
+
if ( $this->_oelements[0] === '&' ) {
|
106 |
+
array_shift( $this->_oelements );
|
107 |
$this->_oelements_len--;
|
108 |
}
|
109 |
|
110 |
+
$this->_oelements_assoc = array_fill_keys( $this->_oelements, true );
|
111 |
}
|
112 |
}
|
113 |
|
114 |
+
public function isJustParentSelector() {
|
115 |
return !$this->mediaEmpty &&
|
116 |
+
count( $this->elements ) === 1 &&
|
117 |
$this->elements[0]->value === '&' &&
|
118 |
+
( $this->elements[0]->combinator === ' ' || $this->elements[0]->combinator === '' );
|
119 |
}
|
120 |
|
121 |
+
public function compile( $env ) {
|
|
|
122 |
$elements = array();
|
123 |
+
foreach ( $this->elements as $el ) {
|
124 |
+
$elements[] = $el->compile( $env );
|
125 |
}
|
126 |
|
127 |
$extendList = array();
|
128 |
+
foreach ( $this->extendList as $el ) {
|
129 |
+
$extendList[] = $el->compile( $el );
|
130 |
}
|
131 |
|
132 |
$evaldCondition = false;
|
133 |
+
if ( $this->condition ) {
|
134 |
+
$evaldCondition = $this->condition->compile( $env );
|
135 |
}
|
136 |
|
137 |
return $this->createDerived( $elements, $extendList, $evaldCondition );
|
138 |
}
|
139 |
|
|
|
140 |
/**
|
141 |
* @see Less_Tree::genCSS
|
142 |
*/
|
143 |
+
public function genCSS( $output, $firstSelector = true ) {
|
144 |
+
if ( !$firstSelector && $this->elements[0]->combinator === "" ) {
|
145 |
+
$output->add( ' ', $this->currentFileInfo, $this->index );
|
|
|
146 |
}
|
147 |
|
148 |
+
foreach ( $this->elements as $element ) {
|
149 |
$element->genCSS( $output );
|
150 |
}
|
151 |
}
|
152 |
|
153 |
+
public function markReferenced() {
|
154 |
$this->isReferenced = true;
|
155 |
}
|
156 |
|
157 |
+
public function getIsReferenced() {
|
158 |
+
return !isset( $this->currentFileInfo['reference'] ) || !$this->currentFileInfo['reference'] || $this->isReferenced;
|
159 |
}
|
160 |
|
161 |
+
public function getIsOutput() {
|
162 |
return $this->evaldCondition;
|
163 |
}
|
164 |
|
base/inc/lib/Less/Tree/UnicodeDescriptor.php
CHANGED
@@ -6,24 +6,23 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_UnicodeDescriptor extends Less_Tree{
|
10 |
|
11 |
public $value;
|
12 |
public $type = 'UnicodeDescriptor';
|
13 |
|
14 |
-
public function __construct($value){
|
15 |
$this->value = $value;
|
16 |
}
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
public function genCSS( $output ){
|
22 |
$output->add( $this->value );
|
23 |
}
|
24 |
|
25 |
-
public function compile(){
|
26 |
return $this;
|
27 |
}
|
28 |
}
|
29 |
-
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_UnicodeDescriptor extends Less_Tree {
|
10 |
|
11 |
public $value;
|
12 |
public $type = 'UnicodeDescriptor';
|
13 |
|
14 |
+
public function __construct( $value ) {
|
15 |
$this->value = $value;
|
16 |
}
|
17 |
|
18 |
+
/**
|
19 |
+
* @see Less_Tree::genCSS
|
20 |
+
*/
|
21 |
+
public function genCSS( $output ) {
|
22 |
$output->add( $this->value );
|
23 |
}
|
24 |
|
25 |
+
public function compile() {
|
26 |
return $this;
|
27 |
}
|
28 |
}
|
|
base/inc/lib/Less/Tree/Unit.php
CHANGED
@@ -6,93 +6,90 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Unit extends Less_Tree{
|
10 |
|
11 |
var $numerator = array();
|
12 |
var $denominator = array();
|
13 |
public $backupUnit;
|
14 |
public $type = 'Unit';
|
15 |
|
16 |
-
|
17 |
$this->numerator = $numerator;
|
18 |
$this->denominator = $denominator;
|
19 |
$this->backupUnit = $backupUnit;
|
20 |
}
|
21 |
|
22 |
-
|
23 |
}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
if( $this->numerator ){
|
31 |
$output->add( $this->numerator[0] );
|
32 |
-
}elseif( $this->denominator ){
|
33 |
$output->add( $this->denominator[0] );
|
34 |
-
}elseif( !Less_Parser::$options['strictUnits'] && $this->backupUnit ){
|
35 |
$output->add( $this->backupUnit );
|
36 |
-
return
|
37 |
}
|
38 |
}
|
39 |
|
40 |
-
|
41 |
-
$returnStr = implode('*'
|
42 |
-
foreach($this->denominator as $d){
|
43 |
$returnStr .= '/'.$d;
|
44 |
}
|
45 |
return $returnStr;
|
46 |
}
|
47 |
|
48 |
-
|
49 |
return $this->toString();
|
50 |
}
|
51 |
|
52 |
-
|
53 |
/**
|
54 |
* @param Less_Tree_Unit $other
|
55 |
*/
|
56 |
-
|
57 |
return $this->is( $other->toString() ) ? 0 : -1;
|
58 |
}
|
59 |
|
60 |
-
|
61 |
return $this->toString() === $unitString;
|
62 |
}
|
63 |
|
64 |
-
|
65 |
$css = $this->toCSS();
|
66 |
-
return !!preg_match('/px|em|%|in|cm|mm|pc|pt|ex/'
|
67 |
}
|
68 |
|
69 |
-
|
70 |
return isset( Less_Tree_UnitConversions::$angle[$this->toCSS()] );
|
71 |
}
|
72 |
|
73 |
-
|
74 |
return !$this->numerator && !$this->denominator;
|
75 |
}
|
76 |
|
77 |
-
|
78 |
-
return count($this->numerator) <= 1 && !$this->denominator;
|
79 |
}
|
80 |
|
81 |
-
|
82 |
-
public function usedUnits(){
|
83 |
$result = array();
|
84 |
|
85 |
-
foreach(Less_Tree_UnitConversions::$groups as $groupName){
|
86 |
$group = Less_Tree_UnitConversions::${$groupName};
|
87 |
|
88 |
-
foreach($this->numerator as $atomicUnit){
|
89 |
-
if( isset($group[$atomicUnit]) && !isset($result[$groupName]) ){
|
90 |
$result[$groupName] = $atomicUnit;
|
91 |
}
|
92 |
}
|
93 |
|
94 |
-
foreach($this->denominator as $atomicUnit){
|
95 |
-
if( isset($group[$atomicUnit]) && !isset($result[$groupName]) ){
|
96 |
$result[$groupName] = $atomicUnit;
|
97 |
}
|
98 |
}
|
@@ -101,47 +98,45 @@ class Less_Tree_Unit extends Less_Tree{
|
|
101 |
return $result;
|
102 |
}
|
103 |
|
104 |
-
|
105 |
$counter = array();
|
106 |
$backup = null;
|
107 |
|
108 |
-
foreach($this->numerator as $atomicUnit){
|
109 |
-
if( !$backup ){
|
110 |
$backup = $atomicUnit;
|
111 |
}
|
112 |
-
$counter[$atomicUnit] = ( isset($counter[$atomicUnit]) ? $counter[$atomicUnit] : 0) + 1;
|
113 |
}
|
114 |
|
115 |
-
foreach($this->denominator as $atomicUnit){
|
116 |
-
if( !$backup ){
|
117 |
$backup = $atomicUnit;
|
118 |
}
|
119 |
-
$counter[$atomicUnit] = ( isset($counter[$atomicUnit]) ? $counter[$atomicUnit] : 0) - 1;
|
120 |
}
|
121 |
|
122 |
$this->numerator = array();
|
123 |
$this->denominator = array();
|
124 |
|
125 |
-
foreach($counter as $atomicUnit => $count){
|
126 |
-
if( $count > 0 ){
|
127 |
-
for( $i = 0; $i < $count; $i++ ){
|
128 |
$this->numerator[] = $atomicUnit;
|
129 |
}
|
130 |
-
}elseif( $count < 0 ){
|
131 |
-
for( $i = 0; $i < -$count; $i++ ){
|
132 |
$this->denominator[] = $atomicUnit;
|
133 |
}
|
134 |
}
|
135 |
}
|
136 |
|
137 |
-
if( !$this->numerator && !$this->denominator && $backup ){
|
138 |
$this->backupUnit = $backup;
|
139 |
}
|
140 |
|
141 |
-
sort($this->numerator);
|
142 |
-
sort($this->denominator);
|
143 |
}
|
144 |
|
145 |
-
|
146 |
}
|
147 |
-
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Unit extends Less_Tree {
|
10 |
|
11 |
var $numerator = array();
|
12 |
var $denominator = array();
|
13 |
public $backupUnit;
|
14 |
public $type = 'Unit';
|
15 |
|
16 |
+
public function __construct( $numerator = array(), $denominator = array(), $backupUnit = null ) {
|
17 |
$this->numerator = $numerator;
|
18 |
$this->denominator = $denominator;
|
19 |
$this->backupUnit = $backupUnit;
|
20 |
}
|
21 |
|
22 |
+
public function __clone() {
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* @see Less_Tree::genCSS
|
27 |
+
*/
|
28 |
+
public function genCSS( $output ) {
|
29 |
+
if ( $this->numerator ) {
|
|
|
30 |
$output->add( $this->numerator[0] );
|
31 |
+
} elseif ( $this->denominator ) {
|
32 |
$output->add( $this->denominator[0] );
|
33 |
+
} elseif ( !Less_Parser::$options['strictUnits'] && $this->backupUnit ) {
|
34 |
$output->add( $this->backupUnit );
|
35 |
+
return;
|
36 |
}
|
37 |
}
|
38 |
|
39 |
+
public function toString() {
|
40 |
+
$returnStr = implode( '*', $this->numerator );
|
41 |
+
foreach ( $this->denominator as $d ) {
|
42 |
$returnStr .= '/'.$d;
|
43 |
}
|
44 |
return $returnStr;
|
45 |
}
|
46 |
|
47 |
+
public function __toString() {
|
48 |
return $this->toString();
|
49 |
}
|
50 |
|
|
|
51 |
/**
|
52 |
* @param Less_Tree_Unit $other
|
53 |
*/
|
54 |
+
public function compare( $other ) {
|
55 |
return $this->is( $other->toString() ) ? 0 : -1;
|
56 |
}
|
57 |
|
58 |
+
public function is( $unitString ) {
|
59 |
return $this->toString() === $unitString;
|
60 |
}
|
61 |
|
62 |
+
public function isLength() {
|
63 |
$css = $this->toCSS();
|
64 |
+
return !!preg_match( '/px|em|%|in|cm|mm|pc|pt|ex/', $css );
|
65 |
}
|
66 |
|
67 |
+
public function isAngle() {
|
68 |
return isset( Less_Tree_UnitConversions::$angle[$this->toCSS()] );
|
69 |
}
|
70 |
|
71 |
+
public function isEmpty() {
|
72 |
return !$this->numerator && !$this->denominator;
|
73 |
}
|
74 |
|
75 |
+
public function isSingular() {
|
76 |
+
return count( $this->numerator ) <= 1 && !$this->denominator;
|
77 |
}
|
78 |
|
79 |
+
public function usedUnits() {
|
|
|
80 |
$result = array();
|
81 |
|
82 |
+
foreach ( Less_Tree_UnitConversions::$groups as $groupName ) {
|
83 |
$group = Less_Tree_UnitConversions::${$groupName};
|
84 |
|
85 |
+
foreach ( $this->numerator as $atomicUnit ) {
|
86 |
+
if ( isset( $group[$atomicUnit] ) && !isset( $result[$groupName] ) ) {
|
87 |
$result[$groupName] = $atomicUnit;
|
88 |
}
|
89 |
}
|
90 |
|
91 |
+
foreach ( $this->denominator as $atomicUnit ) {
|
92 |
+
if ( isset( $group[$atomicUnit] ) && !isset( $result[$groupName] ) ) {
|
93 |
$result[$groupName] = $atomicUnit;
|
94 |
}
|
95 |
}
|
98 |
return $result;
|
99 |
}
|
100 |
|
101 |
+
public function cancel() {
|
102 |
$counter = array();
|
103 |
$backup = null;
|
104 |
|
105 |
+
foreach ( $this->numerator as $atomicUnit ) {
|
106 |
+
if ( !$backup ) {
|
107 |
$backup = $atomicUnit;
|
108 |
}
|
109 |
+
$counter[$atomicUnit] = ( isset( $counter[$atomicUnit] ) ? $counter[$atomicUnit] : 0 ) + 1;
|
110 |
}
|
111 |
|
112 |
+
foreach ( $this->denominator as $atomicUnit ) {
|
113 |
+
if ( !$backup ) {
|
114 |
$backup = $atomicUnit;
|
115 |
}
|
116 |
+
$counter[$atomicUnit] = ( isset( $counter[$atomicUnit] ) ? $counter[$atomicUnit] : 0 ) - 1;
|
117 |
}
|
118 |
|
119 |
$this->numerator = array();
|
120 |
$this->denominator = array();
|
121 |
|
122 |
+
foreach ( $counter as $atomicUnit => $count ) {
|
123 |
+
if ( $count > 0 ) {
|
124 |
+
for ( $i = 0; $i < $count; $i++ ) {
|
125 |
$this->numerator[] = $atomicUnit;
|
126 |
}
|
127 |
+
} elseif ( $count < 0 ) {
|
128 |
+
for ( $i = 0; $i < -$count; $i++ ) {
|
129 |
$this->denominator[] = $atomicUnit;
|
130 |
}
|
131 |
}
|
132 |
}
|
133 |
|
134 |
+
if ( !$this->numerator && !$this->denominator && $backup ) {
|
135 |
$this->backupUnit = $backup;
|
136 |
}
|
137 |
|
138 |
+
sort( $this->numerator );
|
139 |
+
sort( $this->denominator );
|
140 |
}
|
141 |
|
|
|
142 |
}
|
|
base/inc/lib/Less/Tree/UnitConversions.php
CHANGED
@@ -6,30 +6,30 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_UnitConversions{
|
10 |
|
11 |
-
public static $groups = array('length','duration','angle');
|
12 |
|
13 |
public static $length = array(
|
14 |
-
'm'=> 1,
|
15 |
-
'cm'=> 0.01,
|
16 |
-
'mm'=> 0.001,
|
17 |
-
'in'=> 0.0254,
|
18 |
-
'px'=> 0.000264583, // 0.0254 / 96,
|
19 |
-
'pt'=> 0.000352778, // 0.0254 / 72,
|
20 |
-
'pc'=> 0.004233333, // 0.0254 / 72 * 12
|
21 |
);
|
22 |
|
23 |
public static $duration = array(
|
24 |
-
's'=> 1,
|
25 |
-
'ms'=> 0.001
|
26 |
);
|
27 |
|
28 |
public static $angle = array(
|
29 |
'rad' => 0.1591549430919, // 1/(2*M_PI),
|
30 |
'deg' => 0.002777778, // 1/360,
|
31 |
-
'grad'=> 0.0025, // 1/400,
|
32 |
-
'turn'=> 1
|
33 |
);
|
34 |
|
35 |
-
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_UnitConversions {
|
10 |
|
11 |
+
public static $groups = array( 'length','duration','angle' );
|
12 |
|
13 |
public static $length = array(
|
14 |
+
'm' => 1,
|
15 |
+
'cm' => 0.01,
|
16 |
+
'mm' => 0.001,
|
17 |
+
'in' => 0.0254,
|
18 |
+
'px' => 0.000264583, // 0.0254 / 96,
|
19 |
+
'pt' => 0.000352778, // 0.0254 / 72,
|
20 |
+
'pc' => 0.004233333, // 0.0254 / 72 * 12
|
21 |
);
|
22 |
|
23 |
public static $duration = array(
|
24 |
+
's' => 1,
|
25 |
+
'ms' => 0.001
|
26 |
);
|
27 |
|
28 |
public static $angle = array(
|
29 |
'rad' => 0.1591549430919, // 1/(2*M_PI),
|
30 |
'deg' => 0.002777778, // 1/360,
|
31 |
+
'grad' => 0.0025, // 1/400,
|
32 |
+
'turn' => 1
|
33 |
);
|
34 |
|
35 |
+
}
|
base/inc/lib/Less/Tree/Url.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Url extends Less_Tree{
|
10 |
|
11 |
public $attrs;
|
12 |
public $value;
|
@@ -14,20 +14,20 @@ class Less_Tree_Url extends Less_Tree{
|
|
14 |
public $isEvald;
|
15 |
public $type = 'Url';
|
16 |
|
17 |
-
public function __construct($value, $currentFileInfo = null, $isEvald = null){
|
18 |
$this->value = $value;
|
19 |
$this->currentFileInfo = $currentFileInfo;
|
20 |
$this->isEvald = $isEvald;
|
21 |
}
|
22 |
|
23 |
-
|
24 |
-
$this->value = $visitor->visitObj($this->value);
|
25 |
}
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
$output->add( 'url(' );
|
32 |
$this->value->genCSS( $output );
|
33 |
$output->add( ')' );
|
@@ -36,41 +36,41 @@ class Less_Tree_Url extends Less_Tree{
|
|
36 |
/**
|
37 |
* @param Less_Functions $ctx
|
38 |
*/
|
39 |
-
public function compile($ctx){
|
40 |
-
$val = $this->value->compile($ctx);
|
41 |
|
42 |
-
if( !$this->isEvald ){
|
43 |
// Add the base path if the URL is relative
|
44 |
-
if( Less_Parser::$options['relativeUrls']
|
45 |
&& $this->currentFileInfo
|
46 |
-
&& is_string($val->value)
|
47 |
-
&& Less_Environment::isPathRelative($val->value)
|
48 |
-
){
|
49 |
$rootpath = $this->currentFileInfo['uri_root'];
|
50 |
-
if ( !$val->quote ){
|
51 |
-
$rootpath = preg_replace('/[\(\)\'"\s]/', '\\$1', $rootpath );
|
52 |
}
|
53 |
$val->value = $rootpath . $val->value;
|
54 |
}
|
55 |
|
56 |
-
$val->value = Less_Environment::normalizePath( $val->value);
|
57 |
}
|
58 |
|
59 |
// Add cache buster if enabled
|
60 |
-
if( Less_Parser::$options['urlArgs'] ){
|
61 |
-
if( !preg_match('/^\s*data:/'
|
62 |
-
$delimiter = strpos($val->value,'?') === false ? '?' : '&';
|
63 |
$urlArgs = $delimiter . Less_Parser::$options['urlArgs'];
|
64 |
-
$hash_pos = strpos($val->value,'#');
|
65 |
-
if( $hash_pos !== false ){
|
66 |
-
$val->value = substr_replace($val->value
|
67 |
} else {
|
68 |
$val->value .= $urlArgs;
|
69 |
}
|
70 |
}
|
71 |
}
|
72 |
|
73 |
-
return new Less_Tree_URL($val, $this->currentFileInfo, true);
|
74 |
}
|
75 |
|
76 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Url extends Less_Tree {
|
10 |
|
11 |
public $attrs;
|
12 |
public $value;
|
14 |
public $isEvald;
|
15 |
public $type = 'Url';
|
16 |
|
17 |
+
public function __construct( $value, $currentFileInfo = null, $isEvald = null ) {
|
18 |
$this->value = $value;
|
19 |
$this->currentFileInfo = $currentFileInfo;
|
20 |
$this->isEvald = $isEvald;
|
21 |
}
|
22 |
|
23 |
+
public function accept( $visitor ) {
|
24 |
+
$this->value = $visitor->visitObj( $this->value );
|
25 |
}
|
26 |
|
27 |
+
/**
|
28 |
+
* @see Less_Tree::genCSS
|
29 |
+
*/
|
30 |
+
public function genCSS( $output ) {
|
31 |
$output->add( 'url(' );
|
32 |
$this->value->genCSS( $output );
|
33 |
$output->add( ')' );
|
36 |
/**
|
37 |
* @param Less_Functions $ctx
|
38 |
*/
|
39 |
+
public function compile( $ctx ) {
|
40 |
+
$val = $this->value->compile( $ctx );
|
41 |
|
42 |
+
if ( !$this->isEvald ) {
|
43 |
// Add the base path if the URL is relative
|
44 |
+
if ( Less_Parser::$options['relativeUrls']
|
45 |
&& $this->currentFileInfo
|
46 |
+
&& is_string( $val->value )
|
47 |
+
&& Less_Environment::isPathRelative( $val->value )
|
48 |
+
) {
|
49 |
$rootpath = $this->currentFileInfo['uri_root'];
|
50 |
+
if ( !$val->quote ) {
|
51 |
+
$rootpath = preg_replace( '/[\(\)\'"\s]/', '\\$1', $rootpath );
|
52 |
}
|
53 |
$val->value = $rootpath . $val->value;
|
54 |
}
|
55 |
|
56 |
+
$val->value = Less_Environment::normalizePath( $val->value );
|
57 |
}
|
58 |
|
59 |
// Add cache buster if enabled
|
60 |
+
if ( Less_Parser::$options['urlArgs'] ) {
|
61 |
+
if ( !preg_match( '/^\s*data:/', $val->value ) ) {
|
62 |
+
$delimiter = strpos( $val->value, '?' ) === false ? '?' : '&';
|
63 |
$urlArgs = $delimiter . Less_Parser::$options['urlArgs'];
|
64 |
+
$hash_pos = strpos( $val->value, '#' );
|
65 |
+
if ( $hash_pos !== false ) {
|
66 |
+
$val->value = substr_replace( $val->value, $urlArgs, $hash_pos, 0 );
|
67 |
} else {
|
68 |
$val->value .= $urlArgs;
|
69 |
}
|
70 |
}
|
71 |
}
|
72 |
|
73 |
+
return new Less_Tree_URL( $val, $this->currentFileInfo, true );
|
74 |
}
|
75 |
|
76 |
}
|
base/inc/lib/Less/Tree/Value.php
CHANGED
@@ -6,40 +6,39 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Value extends Less_Tree{
|
10 |
|
11 |
public $type = 'Value';
|
12 |
public $value;
|
13 |
|
14 |
-
public function __construct($value){
|
15 |
$this->value = $value;
|
16 |
}
|
17 |
|
18 |
-
|
19 |
-
$this->value = $visitor->visitArray($this->value);
|
20 |
}
|
21 |
|
22 |
-
public function compile($env){
|
23 |
-
|
24 |
$ret = array();
|
25 |
$i = 0;
|
26 |
-
foreach($this->value as $i => $v){
|
27 |
-
$ret[] = $v->compile($env);
|
28 |
}
|
29 |
-
if( $i > 0 ){
|
30 |
-
return new Less_Tree_Value($ret);
|
31 |
}
|
32 |
return $ret[0];
|
33 |
}
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
function genCSS( $output ){
|
39 |
-
$len = count($this->value);
|
40 |
-
for($i = 0; $i < $len; $i++ ){
|
41 |
$this->value[$i]->genCSS( $output );
|
42 |
-
if( $i+1 < $len ){
|
43 |
$output->add( Less_Environment::$_outputMap[','] );
|
44 |
}
|
45 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Value extends Less_Tree {
|
10 |
|
11 |
public $type = 'Value';
|
12 |
public $value;
|
13 |
|
14 |
+
public function __construct( $value ) {
|
15 |
$this->value = $value;
|
16 |
}
|
17 |
|
18 |
+
public function accept( $visitor ) {
|
19 |
+
$this->value = $visitor->visitArray( $this->value );
|
20 |
}
|
21 |
|
22 |
+
public function compile( $env ) {
|
|
|
23 |
$ret = array();
|
24 |
$i = 0;
|
25 |
+
foreach ( $this->value as $i => $v ) {
|
26 |
+
$ret[] = $v->compile( $env );
|
27 |
}
|
28 |
+
if ( $i > 0 ) {
|
29 |
+
return new Less_Tree_Value( $ret );
|
30 |
}
|
31 |
return $ret[0];
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* @see Less_Tree::genCSS
|
36 |
+
*/
|
37 |
+
function genCSS( $output ) {
|
38 |
+
$len = count( $this->value );
|
39 |
+
for ( $i = 0; $i < $len; $i++ ) {
|
40 |
$this->value[$i]->genCSS( $output );
|
41 |
+
if ( $i + 1 < $len ) {
|
42 |
$output->add( Less_Environment::$_outputMap[','] );
|
43 |
}
|
44 |
}
|
base/inc/lib/Less/Tree/Variable.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
-
class Less_Tree_Variable extends Less_Tree{
|
10 |
|
11 |
public $name;
|
12 |
public $index;
|
@@ -14,39 +14,38 @@ class Less_Tree_Variable extends Less_Tree{
|
|
14 |
public $evaluating = false;
|
15 |
public $type = 'Variable';
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
$this->currentFileInfo = $currentFileInfo;
|
24 |
-
|
25 |
-
|
26 |
-
public function compile($env) {
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
$
|
31 |
-
|
|
|
32 |
$name = $this->name;
|
33 |
}
|
34 |
|
35 |
-
if ($this->evaluating) {
|
36 |
-
throw new Less_Exception_Compiler("Recursive variable definition for " . $name, null, $this->index, $this->currentFileInfo);
|
37 |
}
|
38 |
|
39 |
$this->evaluating = true;
|
40 |
|
41 |
-
foreach($env->frames as $frame){
|
42 |
-
if( $v = $frame->variable($name) ){
|
43 |
-
$r = $v->value->compile($env);
|
44 |
$this->evaluating = false;
|
45 |
return $r;
|
46 |
}
|
47 |
}
|
48 |
|
49 |
-
throw new Less_Exception_Compiler("variable " . $name . " is undefined in file ".$this->currentFileInfo["filename"], null, $this->index, $this->currentFileInfo);
|
50 |
}
|
51 |
|
52 |
}
|
6 |
* @package Less
|
7 |
* @subpackage tree
|
8 |
*/
|
9 |
+
class Less_Tree_Variable extends Less_Tree {
|
10 |
|
11 |
public $name;
|
12 |
public $index;
|
14 |
public $evaluating = false;
|
15 |
public $type = 'Variable';
|
16 |
|
17 |
+
/**
|
18 |
+
* @param string $name
|
19 |
+
*/
|
20 |
+
public function __construct( $name, $index = null, $currentFileInfo = null ) {
|
21 |
+
$this->name = $name;
|
22 |
+
$this->index = $index;
|
23 |
$this->currentFileInfo = $currentFileInfo;
|
24 |
+
}
|
|
|
|
|
25 |
|
26 |
+
public function compile( $env ) {
|
27 |
+
if ( $this->name[1] === '@' ) {
|
28 |
+
$v = new Less_Tree_Variable( substr( $this->name, 1 ), $this->index + 1, $this->currentFileInfo );
|
29 |
+
$name = '@' . $v->compile( $env )->value;
|
30 |
+
} else {
|
31 |
$name = $this->name;
|
32 |
}
|
33 |
|
34 |
+
if ( $this->evaluating ) {
|
35 |
+
throw new Less_Exception_Compiler( "Recursive variable definition for " . $name, null, $this->index, $this->currentFileInfo );
|
36 |
}
|
37 |
|
38 |
$this->evaluating = true;
|
39 |
|
40 |
+
foreach ( $env->frames as $frame ) {
|
41 |
+
if ( $v = $frame->variable( $name ) ) {
|
42 |
+
$r = $v->value->compile( $env );
|
43 |
$this->evaluating = false;
|
44 |
return $r;
|
45 |
}
|
46 |
}
|
47 |
|
48 |
+
throw new Less_Exception_Compiler( "variable " . $name . " is undefined in file ".$this->currentFileInfo["filename"], null, $this->index, $this->currentFileInfo );
|
49 |
}
|
50 |
|
51 |
}
|
base/inc/lib/Less/Version.php
CHANGED
@@ -6,10 +6,10 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage version
|
8 |
*/
|
9 |
-
class Less_Version{
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
}
|
6 |
* @package Less
|
7 |
* @subpackage version
|
8 |
*/
|
9 |
+
class Less_Version {
|
10 |
|
11 |
+
public const version = '3.1.0'; // The current build number of less.php
|
12 |
+
public const less_version = '2.5.3'; // The less.js version that this build should be compatible with
|
13 |
+
public const cache_version = '253'; // The parser cache version
|
14 |
|
15 |
}
|
base/inc/lib/Less/Visitor.php
CHANGED
@@ -6,44 +6,41 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
-
class Less_Visitor{
|
10 |
|
11 |
protected $methods = array();
|
12 |
protected $_visitFnCache = array();
|
13 |
|
14 |
-
public function __construct(){
|
15 |
-
$this->_visitFnCache = get_class_methods(get_class($this));
|
16 |
-
$this->_visitFnCache = array_flip($this->_visitFnCache);
|
17 |
}
|
18 |
|
19 |
-
public function visitObj( $node ){
|
20 |
-
|
21 |
$funcName = 'visit'.$node->type;
|
22 |
-
if( isset($this->_visitFnCache[$funcName]) ){
|
23 |
|
24 |
$visitDeeper = true;
|
25 |
$this->$funcName( $node, $visitDeeper );
|
26 |
|
27 |
-
if( $visitDeeper ){
|
28 |
-
$node->accept($this);
|
29 |
}
|
30 |
|
31 |
$funcName = $funcName . "Out";
|
32 |
-
if( isset($this->_visitFnCache[$funcName]) ){
|
33 |
$this->$funcName( $node );
|
34 |
}
|
35 |
|
36 |
-
}else{
|
37 |
-
$node->accept($this);
|
38 |
}
|
39 |
|
40 |
return $node;
|
41 |
}
|
42 |
|
43 |
-
public function visitArray( $nodes ){
|
44 |
-
|
45 |
-
array_map( array($this,'visitObj'), $nodes);
|
46 |
return $nodes;
|
47 |
}
|
48 |
}
|
49 |
-
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
+
class Less_Visitor {
|
10 |
|
11 |
protected $methods = array();
|
12 |
protected $_visitFnCache = array();
|
13 |
|
14 |
+
public function __construct() {
|
15 |
+
$this->_visitFnCache = get_class_methods( get_class( $this ) );
|
16 |
+
$this->_visitFnCache = array_flip( $this->_visitFnCache );
|
17 |
}
|
18 |
|
19 |
+
public function visitObj( $node ) {
|
|
|
20 |
$funcName = 'visit'.$node->type;
|
21 |
+
if ( isset( $this->_visitFnCache[$funcName] ) ) {
|
22 |
|
23 |
$visitDeeper = true;
|
24 |
$this->$funcName( $node, $visitDeeper );
|
25 |
|
26 |
+
if ( $visitDeeper ) {
|
27 |
+
$node->accept( $this );
|
28 |
}
|
29 |
|
30 |
$funcName = $funcName . "Out";
|
31 |
+
if ( isset( $this->_visitFnCache[$funcName] ) ) {
|
32 |
$this->$funcName( $node );
|
33 |
}
|
34 |
|
35 |
+
} else {
|
36 |
+
$node->accept( $this );
|
37 |
}
|
38 |
|
39 |
return $node;
|
40 |
}
|
41 |
|
42 |
+
public function visitArray( $nodes ) {
|
43 |
+
array_map( array( $this,'visitObj' ), $nodes );
|
|
|
44 |
return $nodes;
|
45 |
}
|
46 |
}
|
|
base/inc/lib/Less/Visitor/extendFinder.php
CHANGED
@@ -6,109 +6,104 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
-
class Less_Visitor_extendFinder extends Less_Visitor{
|
10 |
|
11 |
public $contexts = array();
|
12 |
public $allExtendsStack;
|
13 |
public $foundExtends;
|
14 |
|
15 |
-
public function __construct(){
|
16 |
$this->contexts = array();
|
17 |
-
$this->allExtendsStack = array(array());
|
18 |
parent::__construct();
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
* @param Less_Tree_Ruleset $root
|
23 |
*/
|
24 |
-
|
25 |
-
$root = $this->visitObj($root);
|
26 |
$root->allExtends =& $this->allExtendsStack[0];
|
27 |
return $root;
|
28 |
}
|
29 |
|
30 |
-
|
31 |
$visitDeeper = false;
|
32 |
}
|
33 |
|
34 |
-
|
35 |
$visitDeeper = false;
|
36 |
}
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
if( $rulesetNode->root ){
|
41 |
return;
|
42 |
}
|
43 |
|
44 |
$allSelectorsExtendList = array();
|
45 |
|
46 |
// get &:extend(.a); rules which apply to all selectors in this ruleset
|
47 |
-
if( $rulesetNode->rules ){
|
48 |
-
foreach($rulesetNode->rules as $rule){
|
49 |
-
if( $rule instanceof Less_Tree_Extend ){
|
50 |
$allSelectorsExtendList[] = $rule;
|
51 |
$rulesetNode->extendOnEveryPath = true;
|
52 |
}
|
53 |
}
|
54 |
}
|
55 |
|
56 |
-
|
57 |
// now find every selector and apply the extends that apply to all extends
|
58 |
// and the ones which apply to an individual extend
|
59 |
-
foreach($rulesetNode->paths as $selectorPath){
|
60 |
-
$selector = end($selectorPath);
|
61 |
|
62 |
$j = 0;
|
63 |
-
foreach($selector->extendList as $extend){
|
64 |
-
$this->allExtendsStackPush($rulesetNode, $selectorPath, $extend, $j);
|
65 |
}
|
66 |
-
foreach($allSelectorsExtendList as $extend){
|
67 |
-
$this->allExtendsStackPush($rulesetNode, $selectorPath, $extend, $j);
|
68 |
}
|
69 |
}
|
70 |
|
71 |
$this->contexts[] = $rulesetNode->selectors;
|
72 |
}
|
73 |
|
74 |
-
|
75 |
$this->foundExtends = true;
|
76 |
$extend = clone $extend;
|
77 |
$extend->findSelfSelectors( $selectorPath );
|
78 |
$extend->ruleset = $rulesetNode;
|
79 |
-
if( $j === 0 ){
|
80 |
$extend->firstExtendOnThisSelectorPath = true;
|
81 |
}
|
82 |
|
83 |
-
$end_key = count($this->allExtendsStack)-1;
|
84 |
$this->allExtendsStack[$end_key][] = $extend;
|
85 |
$j++;
|
86 |
}
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
array_pop($this->contexts);
|
92 |
}
|
93 |
}
|
94 |
|
95 |
-
|
96 |
$mediaNode->allExtends = array();
|
97 |
$this->allExtendsStack[] =& $mediaNode->allExtends;
|
98 |
}
|
99 |
|
100 |
-
|
101 |
-
array_pop($this->allExtendsStack);
|
102 |
}
|
103 |
|
104 |
-
|
105 |
$directiveNode->allExtends = array();
|
106 |
$this->allExtendsStack[] =& $directiveNode->allExtends;
|
107 |
}
|
108 |
|
109 |
-
|
110 |
-
array_pop($this->allExtendsStack);
|
111 |
}
|
112 |
}
|
113 |
-
|
114 |
-
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
+
class Less_Visitor_extendFinder extends Less_Visitor {
|
10 |
|
11 |
public $contexts = array();
|
12 |
public $allExtendsStack;
|
13 |
public $foundExtends;
|
14 |
|
15 |
+
public function __construct() {
|
16 |
$this->contexts = array();
|
17 |
+
$this->allExtendsStack = array( array() );
|
18 |
parent::__construct();
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
* @param Less_Tree_Ruleset $root
|
23 |
*/
|
24 |
+
public function run( $root ) {
|
25 |
+
$root = $this->visitObj( $root );
|
26 |
$root->allExtends =& $this->allExtendsStack[0];
|
27 |
return $root;
|
28 |
}
|
29 |
|
30 |
+
public function visitRule( $ruleNode, &$visitDeeper ) {
|
31 |
$visitDeeper = false;
|
32 |
}
|
33 |
|
34 |
+
public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ) {
|
35 |
$visitDeeper = false;
|
36 |
}
|
37 |
|
38 |
+
public function visitRuleset( $rulesetNode ) {
|
39 |
+
if ( $rulesetNode->root ) {
|
|
|
40 |
return;
|
41 |
}
|
42 |
|
43 |
$allSelectorsExtendList = array();
|
44 |
|
45 |
// get &:extend(.a); rules which apply to all selectors in this ruleset
|
46 |
+
if ( $rulesetNode->rules ) {
|
47 |
+
foreach ( $rulesetNode->rules as $rule ) {
|
48 |
+
if ( $rule instanceof Less_Tree_Extend ) {
|
49 |
$allSelectorsExtendList[] = $rule;
|
50 |
$rulesetNode->extendOnEveryPath = true;
|
51 |
}
|
52 |
}
|
53 |
}
|
54 |
|
|
|
55 |
// now find every selector and apply the extends that apply to all extends
|
56 |
// and the ones which apply to an individual extend
|
57 |
+
foreach ( $rulesetNode->paths as $selectorPath ) {
|
58 |
+
$selector = end( $selectorPath ); // $selectorPath[ count($selectorPath)-1];
|
59 |
|
60 |
$j = 0;
|
61 |
+
foreach ( $selector->extendList as $extend ) {
|
62 |
+
$this->allExtendsStackPush( $rulesetNode, $selectorPath, $extend, $j );
|
63 |
}
|
64 |
+
foreach ( $allSelectorsExtendList as $extend ) {
|
65 |
+
$this->allExtendsStackPush( $rulesetNode, $selectorPath, $extend, $j );
|
66 |
}
|
67 |
}
|
68 |
|
69 |
$this->contexts[] = $rulesetNode->selectors;
|
70 |
}
|
71 |
|
72 |
+
public function allExtendsStackPush( $rulesetNode, $selectorPath, $extend, &$j ) {
|
73 |
$this->foundExtends = true;
|
74 |
$extend = clone $extend;
|
75 |
$extend->findSelfSelectors( $selectorPath );
|
76 |
$extend->ruleset = $rulesetNode;
|
77 |
+
if ( $j === 0 ) {
|
78 |
$extend->firstExtendOnThisSelectorPath = true;
|
79 |
}
|
80 |
|
81 |
+
$end_key = count( $this->allExtendsStack ) - 1;
|
82 |
$this->allExtendsStack[$end_key][] = $extend;
|
83 |
$j++;
|
84 |
}
|
85 |
|
86 |
+
public function visitRulesetOut( $rulesetNode ) {
|
87 |
+
if ( !is_object( $rulesetNode ) || !$rulesetNode->root ) {
|
88 |
+
array_pop( $this->contexts );
|
|
|
89 |
}
|
90 |
}
|
91 |
|
92 |
+
public function visitMedia( $mediaNode ) {
|
93 |
$mediaNode->allExtends = array();
|
94 |
$this->allExtendsStack[] =& $mediaNode->allExtends;
|
95 |
}
|
96 |
|
97 |
+
public function visitMediaOut() {
|
98 |
+
array_pop( $this->allExtendsStack );
|
99 |
}
|
100 |
|
101 |
+
public function visitDirective( $directiveNode ) {
|
102 |
$directiveNode->allExtends = array();
|
103 |
$this->allExtendsStack[] =& $directiveNode->allExtends;
|
104 |
}
|
105 |
|
106 |
+
public function visitDirectiveOut() {
|
107 |
+
array_pop( $this->allExtendsStack );
|
108 |
}
|
109 |
}
|
|
|
|
base/inc/lib/Less/Visitor/import.php
CHANGED
@@ -135,5 +135,3 @@ class Less_Visitor_import extends Less_VisitorReplacing{
|
|
135 |
|
136 |
}
|
137 |
*/
|
138 |
-
|
139 |
-
|
135 |
|
136 |
}
|
137 |
*/
|
|
|
|
base/inc/lib/Less/Visitor/joinSelector.php
CHANGED
@@ -6,65 +6,63 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
-
class Less_Visitor_joinSelector extends Less_Visitor{
|
10 |
|
11 |
public $contexts = array( array() );
|
12 |
|
13 |
/**
|
14 |
* @param Less_Tree_Ruleset $root
|
15 |
*/
|
16 |
-
public function run( $root ){
|
17 |
-
return $this->visitObj($root);
|
18 |
}
|
19 |
|
20 |
-
|
21 |
$visitDeeper = false;
|
22 |
}
|
23 |
|
24 |
-
|
25 |
$visitDeeper = false;
|
26 |
}
|
27 |
|
28 |
-
|
29 |
-
|
30 |
$paths = array();
|
31 |
|
32 |
-
if( !$rulesetNode->root ){
|
33 |
$selectors = array();
|
34 |
|
35 |
-
if( $rulesetNode->selectors && $rulesetNode->selectors ){
|
36 |
-
foreach($rulesetNode->selectors as $selector){
|
37 |
-
if( $selector->getIsOutput() ){
|
38 |
$selectors[] = $selector;
|
39 |
}
|
40 |
}
|
41 |
}
|
42 |
|
43 |
-
if( !$selectors ){
|
44 |
$rulesetNode->selectors = null;
|
45 |
$rulesetNode->rules = null;
|
46 |
-
}else{
|
47 |
-
$context = end($this->contexts);
|
48 |
-
$paths = $rulesetNode->joinSelectors( $context, $selectors);
|
49 |
}
|
50 |
|
51 |
$rulesetNode->paths = $paths;
|
52 |
}
|
53 |
|
54 |
-
$this->contexts[] = $paths; //different from less.js. Placed after joinSelectors() so that $this->contexts will get correct $paths
|
55 |
}
|
56 |
|
57 |
-
|
58 |
-
array_pop($this->contexts);
|
59 |
}
|
60 |
|
61 |
-
|
62 |
-
$context = end($this->contexts);
|
63 |
|
64 |
-
if( !count($context) || (is_object($context[0]) && $context[0]->multiMedia) ){
|
65 |
$mediaNode->rules[0]->root = true;
|
66 |
}
|
67 |
}
|
68 |
|
69 |
}
|
70 |
-
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
+
class Less_Visitor_joinSelector extends Less_Visitor {
|
10 |
|
11 |
public $contexts = array( array() );
|
12 |
|
13 |
/**
|
14 |
* @param Less_Tree_Ruleset $root
|
15 |
*/
|
16 |
+
public function run( $root ) {
|
17 |
+
return $this->visitObj( $root );
|
18 |
}
|
19 |
|
20 |
+
public function visitRule( $ruleNode, &$visitDeeper ) {
|
21 |
$visitDeeper = false;
|
22 |
}
|
23 |
|
24 |
+
public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ) {
|
25 |
$visitDeeper = false;
|
26 |
}
|
27 |
|
28 |
+
public function visitRuleset( $rulesetNode ) {
|
|
|
29 |
$paths = array();
|
30 |
|
31 |
+
if ( !$rulesetNode->root ) {
|
32 |
$selectors = array();
|
33 |
|
34 |
+
if ( $rulesetNode->selectors && $rulesetNode->selectors ) {
|
35 |
+
foreach ( $rulesetNode->selectors as $selector ) {
|
36 |
+
if ( $selector->getIsOutput() ) {
|
37 |
$selectors[] = $selector;
|
38 |
}
|
39 |
}
|
40 |
}
|
41 |
|
42 |
+
if ( !$selectors ) {
|
43 |
$rulesetNode->selectors = null;
|
44 |
$rulesetNode->rules = null;
|
45 |
+
} else {
|
46 |
+
$context = end( $this->contexts ); // $context = $this->contexts[ count($this->contexts) - 1];
|
47 |
+
$paths = $rulesetNode->joinSelectors( $context, $selectors );
|
48 |
}
|
49 |
|
50 |
$rulesetNode->paths = $paths;
|
51 |
}
|
52 |
|
53 |
+
$this->contexts[] = $paths; // different from less.js. Placed after joinSelectors() so that $this->contexts will get correct $paths
|
54 |
}
|
55 |
|
56 |
+
public function visitRulesetOut() {
|
57 |
+
array_pop( $this->contexts );
|
58 |
}
|
59 |
|
60 |
+
public function visitMedia( $mediaNode ) {
|
61 |
+
$context = end( $this->contexts ); // $context = $this->contexts[ count($this->contexts) - 1];
|
62 |
|
63 |
+
if ( !count( $context ) || ( is_object( $context[0] ) && $context[0]->multiMedia ) ) {
|
64 |
$mediaNode->rules[0]->root = true;
|
65 |
}
|
66 |
}
|
67 |
|
68 |
}
|
|
base/inc/lib/Less/Visitor/processExtends.php
CHANGED
@@ -6,21 +6,21 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
-
class Less_Visitor_processExtends extends Less_Visitor{
|
10 |
|
11 |
public $allExtendsStack;
|
12 |
|
13 |
/**
|
14 |
* @param Less_Tree_Ruleset $root
|
15 |
*/
|
16 |
-
public function run( $root ){
|
17 |
$extendFinder = new Less_Visitor_extendFinder();
|
18 |
$extendFinder->run( $root );
|
19 |
-
if( !$extendFinder->foundExtends){
|
20 |
return $root;
|
21 |
}
|
22 |
|
23 |
-
$root->allExtends = $this->doExtendChaining( $root->allExtends, $root->allExtends);
|
24 |
|
25 |
$this->allExtendsStack = array();
|
26 |
$this->allExtendsStack[] = &$root->allExtends;
|
@@ -28,7 +28,7 @@ class Less_Visitor_processExtends extends Less_Visitor{
|
|
28 |
return $this->visitObj( $root );
|
29 |
}
|
30 |
|
31 |
-
private function doExtendChaining( $extendsList, $extendsListTarget, $iterationCount = 0){
|
32 |
//
|
33 |
// chaining is different from normal extension.. if we extend an extend then we are not just copying, altering and pasting
|
34 |
// the selector we would do normally, but we are also adding an extend with the same target selector
|
@@ -40,58 +40,55 @@ class Less_Visitor_processExtends extends Less_Visitor{
|
|
40 |
|
41 |
$extendsToAdd = array();
|
42 |
|
43 |
-
|
44 |
-
//loop through comparing every extend with every target extend.
|
45 |
// a target extend is the one on the ruleset we are looking at copy/edit/pasting in place
|
46 |
// e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one
|
47 |
// and the second is the target.
|
48 |
// the separation into two lists allows us to process a subset of chains with a bigger set, as is the
|
49 |
// case when processing media queries
|
50 |
-
for( $extendIndex = 0, $extendsList_len = count($extendsList); $extendIndex < $extendsList_len; $extendIndex++ ){
|
51 |
-
for( $targetExtendIndex = 0; $targetExtendIndex < count($extendsListTarget); $targetExtendIndex++ ){
|
52 |
|
53 |
$extend = $extendsList[$extendIndex];
|
54 |
$targetExtend = $extendsListTarget[$targetExtendIndex];
|
55 |
|
56 |
// Optimisation: Explicit reference, <https://github.com/wikimedia/less.php/pull/14>
|
57 |
-
if( \array_key_exists($targetExtend->object_id, $extend->parent_ids) ){
|
58 |
// ignore circular references
|
59 |
continue;
|
60 |
}
|
61 |
|
62 |
// find a match in the target extends self selector (the bit before :extend)
|
63 |
$selectorPath = array( $targetExtend->selfSelectors[0] );
|
64 |
-
$matches = $this->findMatch( $extend, $selectorPath);
|
65 |
-
|
66 |
|
67 |
-
if( $matches ){
|
68 |
|
69 |
// we found a match, so for each self selector..
|
70 |
-
foreach($extend->selfSelectors as $selfSelector ){
|
71 |
-
|
72 |
|
73 |
// process the extend as usual
|
74 |
-
$newSelector = $this->extendSelector( $matches, $selectorPath, $selfSelector);
|
75 |
|
76 |
// but now we create a new extend from it
|
77 |
-
$newExtend = new Less_Tree_Extend( $targetExtend->selector, $targetExtend->option, 0);
|
78 |
$newExtend->selfSelectors = $newSelector;
|
79 |
|
80 |
// add the extend onto the list of extends for that selector
|
81 |
-
end($newSelector)->extendList = array($newExtend);
|
82 |
-
|
83 |
|
84 |
// record that we need to add it.
|
85 |
$extendsToAdd[] = $newExtend;
|
86 |
$newExtend->ruleset = $targetExtend->ruleset;
|
87 |
|
88 |
-
//remember its parents for circular references
|
89 |
-
$newExtend->parent_ids = array_merge($newExtend->parent_ids
|
90 |
|
91 |
// only process the selector once.. if we have :extend(.a,.b) then multiple
|
92 |
// extends will look at the same selector path, so when extending
|
93 |
// we know that any others will be duplicates in terms of what is added to the css
|
94 |
-
if( $targetExtend->firstExtendOnThisSelectorPath ){
|
95 |
$newExtend->firstExtendOnThisSelectorPath = true;
|
96 |
$targetExtend->ruleset->paths[] = $newSelector;
|
97 |
}
|
@@ -100,94 +97,85 @@ class Less_Visitor_processExtends extends Less_Visitor{
|
|
100 |
}
|
101 |
}
|
102 |
|
103 |
-
if( $extendsToAdd ){
|
104 |
// try to detect circular references to stop a stack overflow.
|
105 |
// may no longer be needed. $this->extendChainCount++;
|
106 |
-
if( $iterationCount > 100) {
|
107 |
|
108 |
try{
|
109 |
$selectorOne = $extendsToAdd[0]->selfSelectors[0]->toCSS();
|
110 |
$selectorTwo = $extendsToAdd[0]->selector->toCSS();
|
111 |
-
}catch(Exception $e){
|
112 |
$selectorOne = "{unable to calculate}";
|
113 |
$selectorTwo = "{unable to calculate}";
|
114 |
}
|
115 |
|
116 |
-
throw new Less_Exception_Parser("extend circular reference detected. One of the circular extends is currently:" . $selectorOne . ":extend(" . $selectorTwo . ")");
|
117 |
}
|
118 |
|
119 |
// now process the new extends on the existing rules so that we can handle a extending b extending c ectending d extending e...
|
120 |
-
$extendsToAdd = $this->doExtendChaining( $extendsToAdd, $extendsListTarget, $iterationCount+1);
|
121 |
}
|
122 |
|
123 |
-
return array_merge($extendsList, $extendsToAdd);
|
124 |
}
|
125 |
|
126 |
-
|
127 |
-
protected function visitRule( $ruleNode, &$visitDeeper ){
|
128 |
$visitDeeper = false;
|
129 |
}
|
130 |
|
131 |
-
protected function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){
|
132 |
$visitDeeper = false;
|
133 |
}
|
134 |
|
135 |
-
protected function visitSelector( $selectorNode, &$visitDeeper ){
|
136 |
$visitDeeper = false;
|
137 |
}
|
138 |
|
139 |
-
protected function visitRuleset($rulesetNode){
|
140 |
-
|
141 |
-
|
142 |
-
if( $rulesetNode->root ){
|
143 |
return;
|
144 |
}
|
145 |
|
146 |
-
$allExtends = end($this->allExtendsStack);
|
147 |
-
$paths_len = count($rulesetNode->paths);
|
148 |
|
149 |
// look at each selector path in the ruleset, find any extend matches and then copy, find and replace
|
150 |
-
foreach($allExtends as $allExtend){
|
151 |
-
for($pathIndex = 0; $pathIndex < $paths_len; $pathIndex++ ){
|
152 |
|
153 |
// extending extends happens initially, before the main pass
|
154 |
-
if( isset($rulesetNode->extendOnEveryPath) && $rulesetNode->extendOnEveryPath ){
|
155 |
continue;
|
156 |
}
|
157 |
|
158 |
$selectorPath = $rulesetNode->paths[$pathIndex];
|
159 |
|
160 |
-
if( end($selectorPath)->extendList ){
|
161 |
continue;
|
162 |
}
|
163 |
|
164 |
-
$this->ExtendMatch( $rulesetNode, $allExtend, $selectorPath);
|
165 |
|
166 |
}
|
167 |
}
|
168 |
}
|
169 |
|
|
|
|
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
if( $matches ){
|
175 |
-
foreach($extend->selfSelectors as $selfSelector ){
|
176 |
-
$rulesetNode->paths[] = $this->extendSelector($matches, $selectorPath, $selfSelector);
|
177 |
}
|
178 |
}
|
179 |
}
|
180 |
|
181 |
-
|
182 |
-
|
183 |
-
private function findMatch($extend, $haystackSelectorPath ){
|
184 |
-
|
185 |
-
|
186 |
-
if( !$this->HasMatches($extend, $haystackSelectorPath) ){
|
187 |
return false;
|
188 |
}
|
189 |
|
190 |
-
|
191 |
//
|
192 |
// look through the haystack selector path to try and find the needle - extend.selector
|
193 |
// returns an array of selector matches that can then be replaced
|
@@ -198,42 +186,39 @@ class Less_Visitor_processExtends extends Less_Visitor{
|
|
198 |
$potentialMatch = null;
|
199 |
$matches = array();
|
200 |
|
201 |
-
|
202 |
-
|
203 |
// loop through the haystack elements
|
204 |
-
$haystack_path_len = count($haystackSelectorPath);
|
205 |
-
for($haystackSelectorIndex = 0; $haystackSelectorIndex < $haystack_path_len; $haystackSelectorIndex++ ){
|
206 |
$hackstackSelector = $haystackSelectorPath[$haystackSelectorIndex];
|
207 |
|
208 |
-
$haystack_elements_len = count($hackstackSelector->elements);
|
209 |
-
for($hackstackElementIndex = 0; $hackstackElementIndex < $haystack_elements_len; $hackstackElementIndex++ ){
|
210 |
|
211 |
$haystackElement = $hackstackSelector->elements[$hackstackElementIndex];
|
212 |
|
213 |
// if we allow elements before our match we can add a potential match every time. otherwise only at the first element.
|
214 |
-
if( $extend->allowBefore || ($haystackSelectorIndex === 0 && $hackstackElementIndex === 0) ){
|
215 |
-
$potentialMatches[] = array('pathIndex'=> $haystackSelectorIndex, 'index'=> $hackstackElementIndex, 'matched'=> 0, 'initialCombinator'=> $haystackElement->combinator);
|
216 |
$potentialMatches_len++;
|
217 |
}
|
218 |
|
219 |
-
for($i = 0; $i < $potentialMatches_len; $i++ ){
|
220 |
|
221 |
$potentialMatch = &$potentialMatches[$i];
|
222 |
$potentialMatch = $this->PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex );
|
223 |
|
224 |
-
|
225 |
// if we are still valid and have finished, test whether we have elements after and whether these are allowed
|
226 |
-
if( $potentialMatch && $potentialMatch['matched'] === $extend->selector->elements_len ){
|
227 |
$potentialMatch['finished'] = true;
|
228 |
|
229 |
-
if( !$extend->allowAfter && ($hackstackElementIndex+1 < $haystack_elements_len || $haystackSelectorIndex+1 < $haystack_path_len) ){
|
230 |
$potentialMatch = null;
|
231 |
}
|
232 |
}
|
233 |
|
234 |
// if null we remove, if not, we are still valid, so either push as a valid match or continue
|
235 |
-
if( $potentialMatch ){
|
236 |
-
if( $potentialMatch['finished'] ){
|
237 |
$potentialMatch['length'] = $extend->selector->elements_len;
|
238 |
$potentialMatch['endPathIndex'] = $haystackSelectorIndex;
|
239 |
$potentialMatch['endPathElementIndex'] = $hackstackElementIndex + 1; // index after end of match
|
@@ -244,7 +229,7 @@ class Less_Visitor_processExtends extends Less_Visitor{
|
|
244 |
continue;
|
245 |
}
|
246 |
|
247 |
-
array_splice($potentialMatches, $i, 1);
|
248 |
$potentialMatches_len--;
|
249 |
$i--;
|
250 |
}
|
@@ -254,24 +239,22 @@ class Less_Visitor_processExtends extends Less_Visitor{
|
|
254 |
return $matches;
|
255 |
}
|
256 |
|
257 |
-
|
258 |
// Before going through all the nested loops, lets check to see if a match is possible
|
259 |
// Reduces Bootstrap 3.1 compile time from ~6.5s to ~5.6s
|
260 |
-
private function HasMatches($extend, $haystackSelectorPath){
|
261 |
-
|
262 |
-
if( !$extend->selector->cacheable ){
|
263 |
return true;
|
264 |
}
|
265 |
|
266 |
$first_el = $extend->selector->_oelements[0];
|
267 |
|
268 |
-
foreach($haystackSelectorPath as $hackstackSelector){
|
269 |
-
if( !$hackstackSelector->cacheable ){
|
270 |
return true;
|
271 |
}
|
272 |
|
273 |
// Optimisation: Explicit reference, <https://github.com/wikimedia/less.php/pull/14>
|
274 |
-
if( \array_key_exists($first_el, $hackstackSelector->_oelements_assoc) ){
|
275 |
return true;
|
276 |
}
|
277 |
}
|
@@ -279,30 +262,27 @@ class Less_Visitor_processExtends extends Less_Visitor{
|
|
279 |
return false;
|
280 |
}
|
281 |
|
282 |
-
|
283 |
/**
|
284 |
* @param integer $hackstackElementIndex
|
285 |
*/
|
286 |
-
private function PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex ){
|
287 |
-
|
288 |
-
|
289 |
-
if( $potentialMatch['matched'] > 0 ){
|
290 |
|
291 |
// selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't
|
292 |
// then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to work out
|
293 |
// what the resulting combinator will be
|
294 |
$targetCombinator = $haystackElement->combinator;
|
295 |
-
if( $targetCombinator === '' && $hackstackElementIndex === 0 ){
|
296 |
$targetCombinator = ' ';
|
297 |
}
|
298 |
|
299 |
-
if( $needleElements[ $potentialMatch['matched'] ]->combinator !== $targetCombinator ){
|
300 |
return null;
|
301 |
}
|
302 |
}
|
303 |
|
304 |
// if we don't match, null our match to indicate failure
|
305 |
-
if( !$this->isElementValuesEqual( $needleElements[$potentialMatch['matched'] ]->value, $haystackElement->value) ){
|
306 |
return null;
|
307 |
}
|
308 |
|
@@ -312,49 +292,45 @@ class Less_Visitor_processExtends extends Less_Visitor{
|
|
312 |
return $potentialMatch;
|
313 |
}
|
314 |
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
if( $elementValue1 === $elementValue2 ){
|
319 |
return true;
|
320 |
}
|
321 |
|
322 |
-
if( is_string($elementValue1) || is_string($elementValue2) ) {
|
323 |
return false;
|
324 |
}
|
325 |
|
326 |
-
if( $elementValue1 instanceof Less_Tree_Attribute ){
|
327 |
return $this->isAttributeValuesEqual( $elementValue1, $elementValue2 );
|
328 |
}
|
329 |
|
330 |
$elementValue1 = $elementValue1->value;
|
331 |
-
if( $elementValue1 instanceof Less_Tree_Selector ){
|
332 |
return $this->isSelectorValuesEqual( $elementValue1, $elementValue2 );
|
333 |
}
|
334 |
|
335 |
return false;
|
336 |
}
|
337 |
|
338 |
-
|
339 |
/**
|
340 |
* @param Less_Tree_Selector $elementValue1
|
341 |
*/
|
342 |
-
private function isSelectorValuesEqual( $elementValue1, $elementValue2 ){
|
343 |
-
|
344 |
$elementValue2 = $elementValue2->value;
|
345 |
-
if( !($elementValue2 instanceof Less_Tree_Selector) || $elementValue1->elements_len !== $elementValue2->elements_len ){
|
346 |
return false;
|
347 |
}
|
348 |
|
349 |
-
for( $i = 0; $i < $elementValue1->elements_len; $i++ ){
|
350 |
|
351 |
-
if( $elementValue1->elements[$i]->combinator !== $elementValue2->elements[$i]->combinator ){
|
352 |
-
if( $i !== 0 || ($elementValue1->elements[$i]->combinator || ' ') !== ($elementValue2->elements[$i]->combinator || ' ') ){
|
353 |
return false;
|
354 |
}
|
355 |
}
|
356 |
|
357 |
-
if( !$this->isElementValuesEqual($elementValue1->elements[$i]->value, $elementValue2->elements[$i]->value) ){
|
358 |
return false;
|
359 |
}
|
360 |
}
|
@@ -362,41 +338,36 @@ class Less_Visitor_processExtends extends Less_Visitor{
|
|
362 |
return true;
|
363 |
}
|
364 |
|
365 |
-
|
366 |
/**
|
367 |
* @param Less_Tree_Attribute $elementValue1
|
368 |
*/
|
369 |
-
private function isAttributeValuesEqual( $elementValue1, $elementValue2 ){
|
370 |
-
|
371 |
-
if( $elementValue1->op !== $elementValue2->op || $elementValue1->key !== $elementValue2->key ){
|
372 |
return false;
|
373 |
}
|
374 |
|
375 |
-
if( !$elementValue1->value || !$elementValue2->value ){
|
376 |
-
if( $elementValue1->value || $elementValue2->value ) {
|
377 |
return false;
|
378 |
}
|
379 |
return true;
|
380 |
}
|
381 |
|
382 |
-
$elementValue1 = ($elementValue1->value->value ? $elementValue1->value->value : $elementValue1->value );
|
383 |
-
$elementValue2 = ($elementValue2->value->value ? $elementValue2->value->value : $elementValue2->value );
|
384 |
|
385 |
return $elementValue1 === $elementValue2;
|
386 |
}
|
387 |
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
//for a set of matches, replace each match with the replacement selector
|
392 |
|
393 |
$currentSelectorPathIndex = 0;
|
394 |
$currentSelectorPathElementIndex = 0;
|
395 |
$path = array();
|
396 |
-
$selectorPath_len = count($selectorPath);
|
397 |
-
|
398 |
-
for($matchIndex = 0, $matches_len = count($matches); $matchIndex < $matches_len; $matchIndex++ ){
|
399 |
|
|
|
400 |
|
401 |
$match = $matches[$matchIndex];
|
402 |
$selector = $selectorPath[ $match['pathIndex'] ];
|
@@ -408,64 +379,63 @@ class Less_Visitor_processExtends extends Less_Visitor{
|
|
408 |
$replacementSelector->elements[0]->currentFileInfo
|
409 |
);
|
410 |
|
411 |
-
if( $match['pathIndex'] > $currentSelectorPathIndex && $currentSelectorPathElementIndex > 0 ){
|
412 |
-
$last_path = end($path);
|
413 |
-
$last_path->elements = array_merge( $last_path->elements, array_slice( $selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex));
|
414 |
$currentSelectorPathElementIndex = 0;
|
415 |
$currentSelectorPathIndex++;
|
416 |
}
|
417 |
|
418 |
$newElements = array_merge(
|
419 |
-
array_slice($selector->elements, $currentSelectorPathElementIndex, ($match['index'] - $currentSelectorPathElementIndex) ) // last parameter of array_slice is different than the last parameter of javascript's slice
|
420 |
-
|
421 |
-
|
422 |
);
|
423 |
|
424 |
-
if( $currentSelectorPathIndex === $match['pathIndex'] && $matchIndex > 0 ){
|
425 |
-
$last_key = count($path)-1;
|
426 |
-
$path[$last_key]->elements = array_merge($path[$last_key]->elements
|
427 |
-
}else{
|
428 |
-
$path = array_merge( $path, array_slice( $selectorPath, $currentSelectorPathIndex, $match['pathIndex'] ));
|
429 |
$path[] = new Less_Tree_Selector( $newElements );
|
430 |
}
|
431 |
|
432 |
$currentSelectorPathIndex = $match['endPathIndex'];
|
433 |
$currentSelectorPathElementIndex = $match['endPathElementIndex'];
|
434 |
-
if( $currentSelectorPathElementIndex >= count($selectorPath[$currentSelectorPathIndex]->elements) ){
|
435 |
$currentSelectorPathElementIndex = 0;
|
436 |
$currentSelectorPathIndex++;
|
437 |
}
|
438 |
}
|
439 |
|
440 |
-
if( $currentSelectorPathIndex < $selectorPath_len && $currentSelectorPathElementIndex > 0 ){
|
441 |
-
$last_path = end($path);
|
442 |
-
$last_path->elements = array_merge( $last_path->elements, array_slice($selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex));
|
443 |
$currentSelectorPathIndex++;
|
444 |
}
|
445 |
|
446 |
$slice_len = $selectorPath_len - $currentSelectorPathIndex;
|
447 |
-
$path = array_merge($path, array_slice($selectorPath, $currentSelectorPathIndex, $slice_len));
|
448 |
|
449 |
return $path;
|
450 |
}
|
451 |
|
452 |
-
|
453 |
-
|
454 |
-
$
|
455 |
-
$this->allExtendsStack[] = $this->doExtendChaining($newAllExtends, $mediaNode->allExtends);
|
456 |
}
|
457 |
|
458 |
-
protected function visitMediaOut(){
|
459 |
array_pop( $this->allExtendsStack );
|
460 |
}
|
461 |
|
462 |
-
protected function visitDirective( $directiveNode ){
|
463 |
-
$newAllExtends = array_merge( $directiveNode->allExtends, end($this->allExtendsStack) );
|
464 |
-
$this->allExtendsStack[] = $this->doExtendChaining($newAllExtends, $directiveNode->allExtends);
|
465 |
}
|
466 |
|
467 |
-
protected function visitDirectiveOut(){
|
468 |
-
array_pop($this->allExtendsStack);
|
469 |
}
|
470 |
|
471 |
}
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
+
class Less_Visitor_processExtends extends Less_Visitor {
|
10 |
|
11 |
public $allExtendsStack;
|
12 |
|
13 |
/**
|
14 |
* @param Less_Tree_Ruleset $root
|
15 |
*/
|
16 |
+
public function run( $root ) {
|
17 |
$extendFinder = new Less_Visitor_extendFinder();
|
18 |
$extendFinder->run( $root );
|
19 |
+
if ( !$extendFinder->foundExtends ) {
|
20 |
return $root;
|
21 |
}
|
22 |
|
23 |
+
$root->allExtends = $this->doExtendChaining( $root->allExtends, $root->allExtends );
|
24 |
|
25 |
$this->allExtendsStack = array();
|
26 |
$this->allExtendsStack[] = &$root->allExtends;
|
28 |
return $this->visitObj( $root );
|
29 |
}
|
30 |
|
31 |
+
private function doExtendChaining( $extendsList, $extendsListTarget, $iterationCount = 0 ) {
|
32 |
//
|
33 |
// chaining is different from normal extension.. if we extend an extend then we are not just copying, altering and pasting
|
34 |
// the selector we would do normally, but we are also adding an extend with the same target selector
|
40 |
|
41 |
$extendsToAdd = array();
|
42 |
|
43 |
+
// loop through comparing every extend with every target extend.
|
|
|
44 |
// a target extend is the one on the ruleset we are looking at copy/edit/pasting in place
|
45 |
// e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one
|
46 |
// and the second is the target.
|
47 |
// the separation into two lists allows us to process a subset of chains with a bigger set, as is the
|
48 |
// case when processing media queries
|
49 |
+
for ( $extendIndex = 0, $extendsList_len = count( $extendsList ); $extendIndex < $extendsList_len; $extendIndex++ ) {
|
50 |
+
for ( $targetExtendIndex = 0; $targetExtendIndex < count( $extendsListTarget ); $targetExtendIndex++ ) {
|
51 |
|
52 |
$extend = $extendsList[$extendIndex];
|
53 |
$targetExtend = $extendsListTarget[$targetExtendIndex];
|
54 |
|
55 |
// Optimisation: Explicit reference, <https://github.com/wikimedia/less.php/pull/14>
|
56 |
+
if ( \array_key_exists( $targetExtend->object_id, $extend->parent_ids ) ) {
|
57 |
// ignore circular references
|
58 |
continue;
|
59 |
}
|
60 |
|
61 |
// find a match in the target extends self selector (the bit before :extend)
|
62 |
$selectorPath = array( $targetExtend->selfSelectors[0] );
|
63 |
+
$matches = $this->findMatch( $extend, $selectorPath );
|
|
|
64 |
|
65 |
+
if ( $matches ) {
|
66 |
|
67 |
// we found a match, so for each self selector..
|
68 |
+
foreach ( $extend->selfSelectors as $selfSelector ) {
|
|
|
69 |
|
70 |
// process the extend as usual
|
71 |
+
$newSelector = $this->extendSelector( $matches, $selectorPath, $selfSelector );
|
72 |
|
73 |
// but now we create a new extend from it
|
74 |
+
$newExtend = new Less_Tree_Extend( $targetExtend->selector, $targetExtend->option, 0 );
|
75 |
$newExtend->selfSelectors = $newSelector;
|
76 |
|
77 |
// add the extend onto the list of extends for that selector
|
78 |
+
end( $newSelector )->extendList = array( $newExtend );
|
79 |
+
// $newSelector[ count($newSelector)-1]->extendList = array($newExtend);
|
80 |
|
81 |
// record that we need to add it.
|
82 |
$extendsToAdd[] = $newExtend;
|
83 |
$newExtend->ruleset = $targetExtend->ruleset;
|
84 |
|
85 |
+
// remember its parents for circular references
|
86 |
+
$newExtend->parent_ids = array_merge( $newExtend->parent_ids, $targetExtend->parent_ids, $extend->parent_ids );
|
87 |
|
88 |
// only process the selector once.. if we have :extend(.a,.b) then multiple
|
89 |
// extends will look at the same selector path, so when extending
|
90 |
// we know that any others will be duplicates in terms of what is added to the css
|
91 |
+
if ( $targetExtend->firstExtendOnThisSelectorPath ) {
|
92 |
$newExtend->firstExtendOnThisSelectorPath = true;
|
93 |
$targetExtend->ruleset->paths[] = $newSelector;
|
94 |
}
|
97 |
}
|
98 |
}
|
99 |
|
100 |
+
if ( $extendsToAdd ) {
|
101 |
// try to detect circular references to stop a stack overflow.
|
102 |
// may no longer be needed. $this->extendChainCount++;
|
103 |
+
if ( $iterationCount > 100 ) {
|
104 |
|
105 |
try{
|
106 |
$selectorOne = $extendsToAdd[0]->selfSelectors[0]->toCSS();
|
107 |
$selectorTwo = $extendsToAdd[0]->selector->toCSS();
|
108 |
+
}catch ( Exception $e ) {
|
109 |
$selectorOne = "{unable to calculate}";
|
110 |
$selectorTwo = "{unable to calculate}";
|
111 |
}
|
112 |
|
113 |
+
throw new Less_Exception_Parser( "extend circular reference detected. One of the circular extends is currently:" . $selectorOne . ":extend(" . $selectorTwo . ")" );
|
114 |
}
|
115 |
|
116 |
// now process the new extends on the existing rules so that we can handle a extending b extending c ectending d extending e...
|
117 |
+
$extendsToAdd = $this->doExtendChaining( $extendsToAdd, $extendsListTarget, $iterationCount + 1 );
|
118 |
}
|
119 |
|
120 |
+
return array_merge( $extendsList, $extendsToAdd );
|
121 |
}
|
122 |
|
123 |
+
protected function visitRule( $ruleNode, &$visitDeeper ) {
|
|
|
124 |
$visitDeeper = false;
|
125 |
}
|
126 |
|
127 |
+
protected function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ) {
|
128 |
$visitDeeper = false;
|
129 |
}
|
130 |
|
131 |
+
protected function visitSelector( $selectorNode, &$visitDeeper ) {
|
132 |
$visitDeeper = false;
|
133 |
}
|
134 |
|
135 |
+
protected function visitRuleset( $rulesetNode ) {
|
136 |
+
if ( $rulesetNode->root ) {
|
|
|
|
|
137 |
return;
|
138 |
}
|
139 |
|
140 |
+
$allExtends = end( $this->allExtendsStack );
|
141 |
+
$paths_len = count( $rulesetNode->paths );
|
142 |
|
143 |
// look at each selector path in the ruleset, find any extend matches and then copy, find and replace
|
144 |
+
foreach ( $allExtends as $allExtend ) {
|
145 |
+
for ( $pathIndex = 0; $pathIndex < $paths_len; $pathIndex++ ) {
|
146 |
|
147 |
// extending extends happens initially, before the main pass
|
148 |
+
if ( isset( $rulesetNode->extendOnEveryPath ) && $rulesetNode->extendOnEveryPath ) {
|
149 |
continue;
|
150 |
}
|
151 |
|
152 |
$selectorPath = $rulesetNode->paths[$pathIndex];
|
153 |
|
154 |
+
if ( end( $selectorPath )->extendList ) {
|
155 |
continue;
|
156 |
}
|
157 |
|
158 |
+
$this->ExtendMatch( $rulesetNode, $allExtend, $selectorPath );
|
159 |
|
160 |
}
|
161 |
}
|
162 |
}
|
163 |
|
164 |
+
private function ExtendMatch( $rulesetNode, $extend, $selectorPath ) {
|
165 |
+
$matches = $this->findMatch( $extend, $selectorPath );
|
166 |
|
167 |
+
if ( $matches ) {
|
168 |
+
foreach ( $extend->selfSelectors as $selfSelector ) {
|
169 |
+
$rulesetNode->paths[] = $this->extendSelector( $matches, $selectorPath, $selfSelector );
|
|
|
|
|
|
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
|
174 |
+
private function findMatch( $extend, $haystackSelectorPath ) {
|
175 |
+
if ( !$this->HasMatches( $extend, $haystackSelectorPath ) ) {
|
|
|
|
|
|
|
|
|
176 |
return false;
|
177 |
}
|
178 |
|
|
|
179 |
//
|
180 |
// look through the haystack selector path to try and find the needle - extend.selector
|
181 |
// returns an array of selector matches that can then be replaced
|
186 |
$potentialMatch = null;
|
187 |
$matches = array();
|
188 |
|
|
|
|
|
189 |
// loop through the haystack elements
|
190 |
+
$haystack_path_len = count( $haystackSelectorPath );
|
191 |
+
for ( $haystackSelectorIndex = 0; $haystackSelectorIndex < $haystack_path_len; $haystackSelectorIndex++ ) {
|
192 |
$hackstackSelector = $haystackSelectorPath[$haystackSelectorIndex];
|
193 |
|
194 |
+
$haystack_elements_len = count( $hackstackSelector->elements );
|
195 |
+
for ( $hackstackElementIndex = 0; $hackstackElementIndex < $haystack_elements_len; $hackstackElementIndex++ ) {
|
196 |
|
197 |
$haystackElement = $hackstackSelector->elements[$hackstackElementIndex];
|
198 |
|
199 |
// if we allow elements before our match we can add a potential match every time. otherwise only at the first element.
|
200 |
+
if ( $extend->allowBefore || ( $haystackSelectorIndex === 0 && $hackstackElementIndex === 0 ) ) {
|
201 |
+
$potentialMatches[] = array( 'pathIndex' => $haystackSelectorIndex, 'index' => $hackstackElementIndex, 'matched' => 0, 'initialCombinator' => $haystackElement->combinator );
|
202 |
$potentialMatches_len++;
|
203 |
}
|
204 |
|
205 |
+
for ( $i = 0; $i < $potentialMatches_len; $i++ ) {
|
206 |
|
207 |
$potentialMatch = &$potentialMatches[$i];
|
208 |
$potentialMatch = $this->PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex );
|
209 |
|
|
|
210 |
// if we are still valid and have finished, test whether we have elements after and whether these are allowed
|
211 |
+
if ( $potentialMatch && $potentialMatch['matched'] === $extend->selector->elements_len ) {
|
212 |
$potentialMatch['finished'] = true;
|
213 |
|
214 |
+
if ( !$extend->allowAfter && ( $hackstackElementIndex + 1 < $haystack_elements_len || $haystackSelectorIndex + 1 < $haystack_path_len ) ) {
|
215 |
$potentialMatch = null;
|
216 |
}
|
217 |
}
|
218 |
|
219 |
// if null we remove, if not, we are still valid, so either push as a valid match or continue
|
220 |
+
if ( $potentialMatch ) {
|
221 |
+
if ( $potentialMatch['finished'] ) {
|
222 |
$potentialMatch['length'] = $extend->selector->elements_len;
|
223 |
$potentialMatch['endPathIndex'] = $haystackSelectorIndex;
|
224 |
$potentialMatch['endPathElementIndex'] = $hackstackElementIndex + 1; // index after end of match
|
229 |
continue;
|
230 |
}
|
231 |
|
232 |
+
array_splice( $potentialMatches, $i, 1 );
|
233 |
$potentialMatches_len--;
|
234 |
$i--;
|
235 |
}
|
239 |
return $matches;
|
240 |
}
|
241 |
|
|
|
242 |
// Before going through all the nested loops, lets check to see if a match is possible
|
243 |
// Reduces Bootstrap 3.1 compile time from ~6.5s to ~5.6s
|
244 |
+
private function HasMatches( $extend, $haystackSelectorPath ) {
|
245 |
+
if ( !$extend->selector->cacheable ) {
|
|
|
246 |
return true;
|
247 |
}
|
248 |
|
249 |
$first_el = $extend->selector->_oelements[0];
|
250 |
|
251 |
+
foreach ( $haystackSelectorPath as $hackstackSelector ) {
|
252 |
+
if ( !$hackstackSelector->cacheable ) {
|
253 |
return true;
|
254 |
}
|
255 |
|
256 |
// Optimisation: Explicit reference, <https://github.com/wikimedia/less.php/pull/14>
|
257 |
+
if ( \array_key_exists( $first_el, $hackstackSelector->_oelements_assoc ) ) {
|
258 |
return true;
|
259 |
}
|
260 |
}
|
262 |
return false;
|
263 |
}
|
264 |
|
|
|
265 |
/**
|
266 |
* @param integer $hackstackElementIndex
|
267 |
*/
|
268 |
+
private function PotentialMatch( $potentialMatch, $needleElements, $haystackElement, $hackstackElementIndex ) {
|
269 |
+
if ( $potentialMatch['matched'] > 0 ) {
|
|
|
|
|
270 |
|
271 |
// selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't
|
272 |
// then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to work out
|
273 |
// what the resulting combinator will be
|
274 |
$targetCombinator = $haystackElement->combinator;
|
275 |
+
if ( $targetCombinator === '' && $hackstackElementIndex === 0 ) {
|
276 |
$targetCombinator = ' ';
|
277 |
}
|
278 |
|
279 |
+
if ( $needleElements[ $potentialMatch['matched'] ]->combinator !== $targetCombinator ) {
|
280 |
return null;
|
281 |
}
|
282 |
}
|
283 |
|
284 |
// if we don't match, null our match to indicate failure
|
285 |
+
if ( !$this->isElementValuesEqual( $needleElements[$potentialMatch['matched'] ]->value, $haystackElement->value ) ) {
|
286 |
return null;
|
287 |
}
|
288 |
|
292 |
return $potentialMatch;
|
293 |
}
|
294 |
|
295 |
+
private function isElementValuesEqual( $elementValue1, $elementValue2 ) {
|
296 |
+
if ( $elementValue1 === $elementValue2 ) {
|
|
|
|
|
297 |
return true;
|
298 |
}
|
299 |
|
300 |
+
if ( is_string( $elementValue1 ) || is_string( $elementValue2 ) ) {
|
301 |
return false;
|
302 |
}
|
303 |
|
304 |
+
if ( $elementValue1 instanceof Less_Tree_Attribute ) {
|
305 |
return $this->isAttributeValuesEqual( $elementValue1, $elementValue2 );
|
306 |
}
|
307 |
|
308 |
$elementValue1 = $elementValue1->value;
|
309 |
+
if ( $elementValue1 instanceof Less_Tree_Selector ) {
|
310 |
return $this->isSelectorValuesEqual( $elementValue1, $elementValue2 );
|
311 |
}
|
312 |
|
313 |
return false;
|
314 |
}
|
315 |
|
|
|
316 |
/**
|
317 |
* @param Less_Tree_Selector $elementValue1
|
318 |
*/
|
319 |
+
private function isSelectorValuesEqual( $elementValue1, $elementValue2 ) {
|
|
|
320 |
$elementValue2 = $elementValue2->value;
|
321 |
+
if ( !( $elementValue2 instanceof Less_Tree_Selector ) || $elementValue1->elements_len !== $elementValue2->elements_len ) {
|
322 |
return false;
|
323 |
}
|
324 |
|
325 |
+
for ( $i = 0; $i < $elementValue1->elements_len; $i++ ) {
|
326 |
|
327 |
+
if ( $elementValue1->elements[$i]->combinator !== $elementValue2->elements[$i]->combinator ) {
|
328 |
+
if ( $i !== 0 || ( $elementValue1->elements[$i]->combinator || ' ' ) !== ( $elementValue2->elements[$i]->combinator || ' ' ) ) {
|
329 |
return false;
|
330 |
}
|
331 |
}
|
332 |
|
333 |
+
if ( !$this->isElementValuesEqual( $elementValue1->elements[$i]->value, $elementValue2->elements[$i]->value ) ) {
|
334 |
return false;
|
335 |
}
|
336 |
}
|
338 |
return true;
|
339 |
}
|
340 |
|
|
|
341 |
/**
|
342 |
* @param Less_Tree_Attribute $elementValue1
|
343 |
*/
|
344 |
+
private function isAttributeValuesEqual( $elementValue1, $elementValue2 ) {
|
345 |
+
if ( $elementValue1->op !== $elementValue2->op || $elementValue1->key !== $elementValue2->key ) {
|
|
|
346 |
return false;
|
347 |
}
|
348 |
|
349 |
+
if ( !$elementValue1->value || !$elementValue2->value ) {
|
350 |
+
if ( $elementValue1->value || $elementValue2->value ) {
|
351 |
return false;
|
352 |
}
|
353 |
return true;
|
354 |
}
|
355 |
|
356 |
+
$elementValue1 = ( $elementValue1->value->value ? $elementValue1->value->value : $elementValue1->value );
|
357 |
+
$elementValue2 = ( $elementValue2->value->value ? $elementValue2->value->value : $elementValue2->value );
|
358 |
|
359 |
return $elementValue1 === $elementValue2;
|
360 |
}
|
361 |
|
362 |
+
private function extendSelector( $matches, $selectorPath, $replacementSelector ) {
|
363 |
+
// for a set of matches, replace each match with the replacement selector
|
|
|
|
|
364 |
|
365 |
$currentSelectorPathIndex = 0;
|
366 |
$currentSelectorPathElementIndex = 0;
|
367 |
$path = array();
|
368 |
+
$selectorPath_len = count( $selectorPath );
|
|
|
|
|
369 |
|
370 |
+
for ( $matchIndex = 0, $matches_len = count( $matches ); $matchIndex < $matches_len; $matchIndex++ ) {
|
371 |
|
372 |
$match = $matches[$matchIndex];
|
373 |
$selector = $selectorPath[ $match['pathIndex'] ];
|
379 |
$replacementSelector->elements[0]->currentFileInfo
|
380 |
);
|
381 |
|
382 |
+
if ( $match['pathIndex'] > $currentSelectorPathIndex && $currentSelectorPathElementIndex > 0 ) {
|
383 |
+
$last_path = end( $path );
|
384 |
+
$last_path->elements = array_merge( $last_path->elements, array_slice( $selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex ) );
|
385 |
$currentSelectorPathElementIndex = 0;
|
386 |
$currentSelectorPathIndex++;
|
387 |
}
|
388 |
|
389 |
$newElements = array_merge(
|
390 |
+
array_slice( $selector->elements, $currentSelectorPathElementIndex, ( $match['index'] - $currentSelectorPathElementIndex ) ), // last parameter of array_slice is different than the last parameter of javascript's slice
|
391 |
+
array( $firstElement ),
|
392 |
+
array_slice( $replacementSelector->elements, 1 )
|
393 |
);
|
394 |
|
395 |
+
if ( $currentSelectorPathIndex === $match['pathIndex'] && $matchIndex > 0 ) {
|
396 |
+
$last_key = count( $path ) - 1;
|
397 |
+
$path[$last_key]->elements = array_merge( $path[$last_key]->elements, $newElements );
|
398 |
+
} else {
|
399 |
+
$path = array_merge( $path, array_slice( $selectorPath, $currentSelectorPathIndex, $match['pathIndex'] ) );
|
400 |
$path[] = new Less_Tree_Selector( $newElements );
|
401 |
}
|
402 |
|
403 |
$currentSelectorPathIndex = $match['endPathIndex'];
|
404 |
$currentSelectorPathElementIndex = $match['endPathElementIndex'];
|
405 |
+
if ( $currentSelectorPathElementIndex >= count( $selectorPath[$currentSelectorPathIndex]->elements ) ) {
|
406 |
$currentSelectorPathElementIndex = 0;
|
407 |
$currentSelectorPathIndex++;
|
408 |
}
|
409 |
}
|
410 |
|
411 |
+
if ( $currentSelectorPathIndex < $selectorPath_len && $currentSelectorPathElementIndex > 0 ) {
|
412 |
+
$last_path = end( $path );
|
413 |
+
$last_path->elements = array_merge( $last_path->elements, array_slice( $selectorPath[$currentSelectorPathIndex]->elements, $currentSelectorPathElementIndex ) );
|
414 |
$currentSelectorPathIndex++;
|
415 |
}
|
416 |
|
417 |
$slice_len = $selectorPath_len - $currentSelectorPathIndex;
|
418 |
+
$path = array_merge( $path, array_slice( $selectorPath, $currentSelectorPathIndex, $slice_len ) );
|
419 |
|
420 |
return $path;
|
421 |
}
|
422 |
|
423 |
+
protected function visitMedia( $mediaNode ) {
|
424 |
+
$newAllExtends = array_merge( $mediaNode->allExtends, end( $this->allExtendsStack ) );
|
425 |
+
$this->allExtendsStack[] = $this->doExtendChaining( $newAllExtends, $mediaNode->allExtends );
|
|
|
426 |
}
|
427 |
|
428 |
+
protected function visitMediaOut() {
|
429 |
array_pop( $this->allExtendsStack );
|
430 |
}
|
431 |
|
432 |
+
protected function visitDirective( $directiveNode ) {
|
433 |
+
$newAllExtends = array_merge( $directiveNode->allExtends, end( $this->allExtendsStack ) );
|
434 |
+
$this->allExtendsStack[] = $this->doExtendChaining( $newAllExtends, $directiveNode->allExtends );
|
435 |
}
|
436 |
|
437 |
+
protected function visitDirectiveOut() {
|
438 |
+
array_pop( $this->allExtendsStack );
|
439 |
}
|
440 |
|
441 |
}
|
base/inc/lib/Less/Visitor/toCSS.php
CHANGED
@@ -6,73 +6,72 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
-
class Less_Visitor_toCSS extends Less_VisitorReplacing{
|
10 |
|
11 |
private $charset;
|
12 |
|
13 |
-
public function __construct(){
|
14 |
parent::__construct();
|
15 |
}
|
16 |
|
17 |
/**
|
18 |
* @param Less_Tree_Ruleset $root
|
19 |
*/
|
20 |
-
public function run( $root ){
|
21 |
-
return $this->visitObj($root);
|
22 |
}
|
23 |
|
24 |
-
public function visitRule( $ruleNode ){
|
25 |
-
if( $ruleNode->variable ){
|
26 |
return array();
|
27 |
}
|
28 |
return $ruleNode;
|
29 |
}
|
30 |
|
31 |
-
public function visitMixinDefinition($mixinNode){
|
32 |
// mixin definitions do not get eval'd - this means they keep state
|
33 |
// so we have to clear that state here so it isn't used if toCSS is called twice
|
34 |
$mixinNode->frames = array();
|
35 |
return array();
|
36 |
}
|
37 |
|
38 |
-
public function visitExtend(){
|
39 |
return array();
|
40 |
}
|
41 |
|
42 |
-
public function visitComment( $commentNode ){
|
43 |
-
if( $commentNode->isSilent() ){
|
44 |
return array();
|
45 |
}
|
46 |
return $commentNode;
|
47 |
}
|
48 |
|
49 |
-
public function visitMedia( $mediaNode, &$visitDeeper ){
|
50 |
-
$mediaNode->accept($this);
|
51 |
$visitDeeper = false;
|
52 |
|
53 |
-
if( !$mediaNode->rules ){
|
54 |
return array();
|
55 |
}
|
56 |
return $mediaNode;
|
57 |
}
|
58 |
|
59 |
-
public function visitDirective( $directiveNode ){
|
60 |
-
if( isset($directiveNode->currentFileInfo['reference']) && (!property_exists($directiveNode,'isReferenced') || !$directiveNode->isReferenced) ){
|
61 |
return array();
|
62 |
}
|
63 |
-
if( $directiveNode->name === '@charset' ){
|
64 |
// Only output the debug info together with subsequent @charset definitions
|
65 |
// a comment (or @media statement) before the actual @charset directive would
|
66 |
// be considered illegal css as it has to be on the first line
|
67 |
-
if( isset($this->charset) && $this->charset ){
|
68 |
|
69 |
-
//if( $directiveNode->debugInfo ){
|
70 |
// $comment = new Less_Tree_Comment('/* ' . str_replace("\n",'',$directiveNode->toCSS())." */\n");
|
71 |
// $comment->debugInfo = $directiveNode->debugInfo;
|
72 |
// return $this->visit($comment);
|
73 |
//}
|
74 |
|
75 |
-
|
76 |
return array();
|
77 |
}
|
78 |
$this->charset = true;
|
@@ -80,109 +79,100 @@ class Less_Visitor_toCSS extends Less_VisitorReplacing{
|
|
80 |
return $directiveNode;
|
81 |
}
|
82 |
|
83 |
-
public function checkPropertiesInRoot( $rulesetNode ){
|
84 |
-
|
85 |
-
if( !$rulesetNode->firstRoot ){
|
86 |
return;
|
87 |
}
|
88 |
|
89 |
-
foreach($rulesetNode->rules as $ruleNode){
|
90 |
-
if( $ruleNode instanceof Less_Tree_Rule && !$ruleNode->variable ){
|
91 |
-
$msg = "properties must be inside selector blocks, they cannot be in the root. Index ".$ruleNode->index.($ruleNode->currentFileInfo ? (' Filename: '.$ruleNode->currentFileInfo['filename']) : null);
|
92 |
-
throw new Less_Exception_Compiler($msg);
|
93 |
}
|
94 |
}
|
95 |
}
|
96 |
|
97 |
-
|
98 |
-
public function visitRuleset( $rulesetNode, &$visitDeeper ){
|
99 |
-
|
100 |
$visitDeeper = false;
|
101 |
|
102 |
$this->checkPropertiesInRoot( $rulesetNode );
|
103 |
|
104 |
-
if( $rulesetNode->root ){
|
105 |
return $this->visitRulesetRoot( $rulesetNode );
|
106 |
}
|
107 |
|
108 |
$rulesets = array();
|
109 |
-
$rulesetNode->paths = $this->visitRulesetPaths($rulesetNode);
|
110 |
-
|
111 |
|
112 |
// Compile rules and rulesets
|
113 |
-
$nodeRuleCnt = $rulesetNode->rules?count($rulesetNode->rules):0;
|
114 |
-
for( $i = 0; $i < $nodeRuleCnt; ){
|
115 |
$rule = $rulesetNode->rules[$i];
|
116 |
|
117 |
-
if( property_exists($rule,'rules') ){
|
118 |
// visit because we are moving them out from being a child
|
119 |
-
$rulesets[] = $this->visitObj($rule);
|
120 |
-
array_splice($rulesetNode->rules
|
121 |
$nodeRuleCnt--;
|
122 |
continue;
|
123 |
}
|
124 |
$i++;
|
125 |
}
|
126 |
|
127 |
-
|
128 |
// accept the visitor to remove rules and refactor itself
|
129 |
// then we can decide now whether we want it or not
|
130 |
-
if( $nodeRuleCnt > 0 ){
|
131 |
-
$rulesetNode->accept($this);
|
132 |
|
133 |
-
if( $rulesetNode->rules ){
|
134 |
|
135 |
-
if( count($rulesetNode->rules) >
|
136 |
$this->_mergeRules( $rulesetNode->rules );
|
137 |
$this->_removeDuplicateRules( $rulesetNode->rules );
|
138 |
}
|
139 |
|
140 |
// now decide whether we keep the ruleset
|
141 |
-
if( $rulesetNode->paths ){
|
142 |
-
//array_unshift($rulesets, $rulesetNode);
|
143 |
-
array_splice($rulesets,0,0,array($rulesetNode));
|
144 |
}
|
145 |
}
|
146 |
|
147 |
}
|
148 |
|
149 |
-
|
150 |
-
if( count($rulesets) === 1 ){
|
151 |
return $rulesets[0];
|
152 |
}
|
153 |
return $rulesets;
|
154 |
}
|
155 |
|
156 |
-
|
157 |
/**
|
158 |
* Helper function for visitiRuleset
|
159 |
*
|
160 |
* return array|Less_Tree_Ruleset
|
161 |
*/
|
162 |
-
private function visitRulesetRoot( $rulesetNode ){
|
163 |
$rulesetNode->accept( $this );
|
164 |
-
if( $rulesetNode->firstRoot || $rulesetNode->rules ){
|
165 |
return $rulesetNode;
|
166 |
}
|
167 |
return array();
|
168 |
}
|
169 |
|
170 |
-
|
171 |
/**
|
172 |
* Helper function for visitRuleset()
|
173 |
*
|
174 |
* @return array
|
175 |
*/
|
176 |
-
private function visitRulesetPaths($rulesetNode){
|
177 |
-
|
178 |
$paths = array();
|
179 |
-
foreach($rulesetNode->paths as $p){
|
180 |
-
if( $p[0]->elements[0]->combinator === ' ' ){
|
181 |
$p[0]->elements[0]->combinator = '';
|
182 |
}
|
183 |
|
184 |
-
foreach($p as $pi){
|
185 |
-
if( $pi->getIsReferenced() && $pi->getIsOutput() ){
|
186 |
$paths[] = $p;
|
187 |
break;
|
188 |
}
|
@@ -192,26 +182,26 @@ class Less_Visitor_toCSS extends Less_VisitorReplacing{
|
|
192 |
return $paths;
|
193 |
}
|
194 |
|
195 |
-
protected function _removeDuplicateRules( &$rules ){
|
196 |
// remove duplicates
|
197 |
$ruleCache = array();
|
198 |
-
for( $i = count($rules)-1; $i >= 0
|
199 |
$rule = $rules[$i];
|
200 |
-
if( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_NameValue ){
|
201 |
|
202 |
-
if( !isset($ruleCache[$rule->name]) ){
|
203 |
$ruleCache[$rule->name] = $rule;
|
204 |
-
}else{
|
205 |
$ruleList =& $ruleCache[$rule->name];
|
206 |
|
207 |
-
if( $ruleList instanceof Less_Tree_Rule || $ruleList instanceof Less_Tree_NameValue ){
|
208 |
$ruleList = $ruleCache[$rule->name] = array( $ruleCache[$rule->name]->toCSS() );
|
209 |
}
|
210 |
|
211 |
$ruleCSS = $rule->toCSS();
|
212 |
-
if( array_search($ruleCSS
|
213 |
-
array_splice($rules
|
214 |
-
}else{
|
215 |
$ruleList[] = $ruleCSS;
|
216 |
}
|
217 |
}
|
@@ -219,26 +209,26 @@ class Less_Visitor_toCSS extends Less_VisitorReplacing{
|
|
219 |
}
|
220 |
}
|
221 |
|
222 |
-
protected function _mergeRules( &$rules ){
|
223 |
$groups = array();
|
224 |
|
225 |
-
//obj($rules);
|
226 |
|
227 |
-
$rules_len = count($rules);
|
228 |
-
for( $i = 0; $i < $rules_len; $i++ ){
|
229 |
$rule = $rules[$i];
|
230 |
|
231 |
-
if( ($rule instanceof Less_Tree_Rule) && $rule->merge ){
|
232 |
|
233 |
$key = $rule->name;
|
234 |
-
if( $rule->important ){
|
235 |
$key .= ',!';
|
236 |
}
|
237 |
|
238 |
-
if( !isset($groups[$key]) ){
|
239 |
$groups[$key] = array();
|
240 |
-
}else{
|
241 |
-
array_splice($rules, $i--, 1);
|
242 |
$rules_len--;
|
243 |
}
|
244 |
|
@@ -246,47 +236,45 @@ class Less_Visitor_toCSS extends Less_VisitorReplacing{
|
|
246 |
}
|
247 |
}
|
248 |
|
|
|
249 |
|
250 |
-
|
251 |
-
|
252 |
-
if( count($parts) > 1 ){
|
253 |
$rule = $parts[0];
|
254 |
$spacedGroups = array();
|
255 |
$lastSpacedGroup = array();
|
256 |
$parts_mapped = array();
|
257 |
-
foreach($parts as $p){
|
258 |
-
if( $p->merge === '+' ){
|
259 |
-
if( $lastSpacedGroup ){
|
260 |
-
$spacedGroups[] = self::toExpression($lastSpacedGroup);
|
261 |
}
|
262 |
$lastSpacedGroup = array();
|
263 |
}
|
264 |
$lastSpacedGroup[] = $p;
|
265 |
}
|
266 |
|
267 |
-
$spacedGroups[] = self::toExpression($lastSpacedGroup);
|
268 |
-
$rule->value = self::toValue($spacedGroups);
|
269 |
}
|
270 |
}
|
271 |
|
272 |
}
|
273 |
|
274 |
-
public static function toExpression($values){
|
275 |
$mapped = array();
|
276 |
-
foreach($values as $p){
|
277 |
$mapped[] = $p->value;
|
278 |
}
|
279 |
return new Less_Tree_Expression( $mapped );
|
280 |
}
|
281 |
|
282 |
-
public static function toValue($values){
|
283 |
-
//return new Less_Tree_Value($values); ??
|
284 |
|
285 |
$mapped = array();
|
286 |
-
foreach($values as $p){
|
287 |
$mapped[] = $p;
|
288 |
}
|
289 |
-
return new Less_Tree_Value($mapped);
|
290 |
}
|
291 |
}
|
292 |
-
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
+
class Less_Visitor_toCSS extends Less_VisitorReplacing {
|
10 |
|
11 |
private $charset;
|
12 |
|
13 |
+
public function __construct() {
|
14 |
parent::__construct();
|
15 |
}
|
16 |
|
17 |
/**
|
18 |
* @param Less_Tree_Ruleset $root
|
19 |
*/
|
20 |
+
public function run( $root ) {
|
21 |
+
return $this->visitObj( $root );
|
22 |
}
|
23 |
|
24 |
+
public function visitRule( $ruleNode ) {
|
25 |
+
if ( $ruleNode->variable ) {
|
26 |
return array();
|
27 |
}
|
28 |
return $ruleNode;
|
29 |
}
|
30 |
|
31 |
+
public function visitMixinDefinition( $mixinNode ) {
|
32 |
// mixin definitions do not get eval'd - this means they keep state
|
33 |
// so we have to clear that state here so it isn't used if toCSS is called twice
|
34 |
$mixinNode->frames = array();
|
35 |
return array();
|
36 |
}
|
37 |
|
38 |
+
public function visitExtend() {
|
39 |
return array();
|
40 |
}
|
41 |
|
42 |
+
public function visitComment( $commentNode ) {
|
43 |
+
if ( $commentNode->isSilent() ) {
|
44 |
return array();
|
45 |
}
|
46 |
return $commentNode;
|
47 |
}
|
48 |
|
49 |
+
public function visitMedia( $mediaNode, &$visitDeeper ) {
|
50 |
+
$mediaNode->accept( $this );
|
51 |
$visitDeeper = false;
|
52 |
|
53 |
+
if ( !$mediaNode->rules ) {
|
54 |
return array();
|
55 |
}
|
56 |
return $mediaNode;
|
57 |
}
|
58 |
|
59 |
+
public function visitDirective( $directiveNode ) {
|
60 |
+
if ( isset( $directiveNode->currentFileInfo['reference'] ) && ( !property_exists( $directiveNode, 'isReferenced' ) || !$directiveNode->isReferenced ) ) {
|
61 |
return array();
|
62 |
}
|
63 |
+
if ( $directiveNode->name === '@charset' ) {
|
64 |
// Only output the debug info together with subsequent @charset definitions
|
65 |
// a comment (or @media statement) before the actual @charset directive would
|
66 |
// be considered illegal css as it has to be on the first line
|
67 |
+
if ( isset( $this->charset ) && $this->charset ) {
|
68 |
|
69 |
+
// if( $directiveNode->debugInfo ){
|
70 |
// $comment = new Less_Tree_Comment('/* ' . str_replace("\n",'',$directiveNode->toCSS())." */\n");
|
71 |
// $comment->debugInfo = $directiveNode->debugInfo;
|
72 |
// return $this->visit($comment);
|
73 |
//}
|
74 |
|
|
|
75 |
return array();
|
76 |
}
|
77 |
$this->charset = true;
|
79 |
return $directiveNode;
|
80 |
}
|
81 |
|
82 |
+
public function checkPropertiesInRoot( $rulesetNode ) {
|
83 |
+
if ( !$rulesetNode->firstRoot ) {
|
|
|
84 |
return;
|
85 |
}
|
86 |
|
87 |
+
foreach ( $rulesetNode->rules as $ruleNode ) {
|
88 |
+
if ( $ruleNode instanceof Less_Tree_Rule && !$ruleNode->variable ) {
|
89 |
+
$msg = "properties must be inside selector blocks, they cannot be in the root. Index ".$ruleNode->index.( $ruleNode->currentFileInfo ? ( ' Filename: '.$ruleNode->currentFileInfo['filename'] ) : null );
|
90 |
+
throw new Less_Exception_Compiler( $msg );
|
91 |
}
|
92 |
}
|
93 |
}
|
94 |
|
95 |
+
public function visitRuleset( $rulesetNode, &$visitDeeper ) {
|
|
|
|
|
96 |
$visitDeeper = false;
|
97 |
|
98 |
$this->checkPropertiesInRoot( $rulesetNode );
|
99 |
|
100 |
+
if ( $rulesetNode->root ) {
|
101 |
return $this->visitRulesetRoot( $rulesetNode );
|
102 |
}
|
103 |
|
104 |
$rulesets = array();
|
105 |
+
$rulesetNode->paths = $this->visitRulesetPaths( $rulesetNode );
|
|
|
106 |
|
107 |
// Compile rules and rulesets
|
108 |
+
$nodeRuleCnt = $rulesetNode->rules ? count( $rulesetNode->rules ) : 0;
|
109 |
+
for ( $i = 0; $i < $nodeRuleCnt; ) {
|
110 |
$rule = $rulesetNode->rules[$i];
|
111 |
|
112 |
+
if ( property_exists( $rule, 'rules' ) ) {
|
113 |
// visit because we are moving them out from being a child
|
114 |
+
$rulesets[] = $this->visitObj( $rule );
|
115 |
+
array_splice( $rulesetNode->rules, $i, 1 );
|
116 |
$nodeRuleCnt--;
|
117 |
continue;
|
118 |
}
|
119 |
$i++;
|
120 |
}
|
121 |
|
|
|
122 |
// accept the visitor to remove rules and refactor itself
|
123 |
// then we can decide now whether we want it or not
|
124 |
+
if ( $nodeRuleCnt > 0 ) {
|
125 |
+
$rulesetNode->accept( $this );
|
126 |
|
127 |
+
if ( $rulesetNode->rules ) {
|
128 |
|
129 |
+
if ( count( $rulesetNode->rules ) > 1 ) {
|
130 |
$this->_mergeRules( $rulesetNode->rules );
|
131 |
$this->_removeDuplicateRules( $rulesetNode->rules );
|
132 |
}
|
133 |
|
134 |
// now decide whether we keep the ruleset
|
135 |
+
if ( $rulesetNode->paths ) {
|
136 |
+
// array_unshift($rulesets, $rulesetNode);
|
137 |
+
array_splice( $rulesets, 0, 0, array( $rulesetNode ) );
|
138 |
}
|
139 |
}
|
140 |
|
141 |
}
|
142 |
|
143 |
+
if ( count( $rulesets ) === 1 ) {
|
|
|
144 |
return $rulesets[0];
|
145 |
}
|
146 |
return $rulesets;
|
147 |
}
|
148 |
|
|
|
149 |
/**
|
150 |
* Helper function for visitiRuleset
|
151 |
*
|
152 |
* return array|Less_Tree_Ruleset
|
153 |
*/
|
154 |
+
private function visitRulesetRoot( $rulesetNode ) {
|
155 |
$rulesetNode->accept( $this );
|
156 |
+
if ( $rulesetNode->firstRoot || $rulesetNode->rules ) {
|
157 |
return $rulesetNode;
|
158 |
}
|
159 |
return array();
|
160 |
}
|
161 |
|
|
|
162 |
/**
|
163 |
* Helper function for visitRuleset()
|
164 |
*
|
165 |
* @return array
|
166 |
*/
|
167 |
+
private function visitRulesetPaths( $rulesetNode ) {
|
|
|
168 |
$paths = array();
|
169 |
+
foreach ( $rulesetNode->paths as $p ) {
|
170 |
+
if ( $p[0]->elements[0]->combinator === ' ' ) {
|
171 |
$p[0]->elements[0]->combinator = '';
|
172 |
}
|
173 |
|
174 |
+
foreach ( $p as $pi ) {
|
175 |
+
if ( $pi->getIsReferenced() && $pi->getIsOutput() ) {
|
176 |
$paths[] = $p;
|
177 |
break;
|
178 |
}
|
182 |
return $paths;
|
183 |
}
|
184 |
|
185 |
+
protected function _removeDuplicateRules( &$rules ) {
|
186 |
// remove duplicates
|
187 |
$ruleCache = array();
|
188 |
+
for ( $i = count( $rules ) - 1; $i >= 0; $i-- ) {
|
189 |
$rule = $rules[$i];
|
190 |
+
if ( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_NameValue ) {
|
191 |
|
192 |
+
if ( !isset( $ruleCache[$rule->name] ) ) {
|
193 |
$ruleCache[$rule->name] = $rule;
|
194 |
+
} else {
|
195 |
$ruleList =& $ruleCache[$rule->name];
|
196 |
|
197 |
+
if ( $ruleList instanceof Less_Tree_Rule || $ruleList instanceof Less_Tree_NameValue ) {
|
198 |
$ruleList = $ruleCache[$rule->name] = array( $ruleCache[$rule->name]->toCSS() );
|
199 |
}
|
200 |
|
201 |
$ruleCSS = $rule->toCSS();
|
202 |
+
if ( array_search( $ruleCSS, $ruleList ) !== false ) {
|
203 |
+
array_splice( $rules, $i, 1 );
|
204 |
+
} else {
|
205 |
$ruleList[] = $ruleCSS;
|
206 |
}
|
207 |
}
|
209 |
}
|
210 |
}
|
211 |
|
212 |
+
protected function _mergeRules( &$rules ) {
|
213 |
$groups = array();
|
214 |
|
215 |
+
// obj($rules);
|
216 |
|
217 |
+
$rules_len = count( $rules );
|
218 |
+
for ( $i = 0; $i < $rules_len; $i++ ) {
|
219 |
$rule = $rules[$i];
|
220 |
|
221 |
+
if ( ( $rule instanceof Less_Tree_Rule ) && $rule->merge ) {
|
222 |
|
223 |
$key = $rule->name;
|
224 |
+
if ( $rule->important ) {
|
225 |
$key .= ',!';
|
226 |
}
|
227 |
|
228 |
+
if ( !isset( $groups[$key] ) ) {
|
229 |
$groups[$key] = array();
|
230 |
+
} else {
|
231 |
+
array_splice( $rules, $i--, 1 );
|
232 |
$rules_len--;
|
233 |
}
|
234 |
|
236 |
}
|
237 |
}
|
238 |
|
239 |
+
foreach ( $groups as $parts ) {
|
240 |
|
241 |
+
if ( count( $parts ) > 1 ) {
|
|
|
|
|
242 |
$rule = $parts[0];
|
243 |
$spacedGroups = array();
|
244 |
$lastSpacedGroup = array();
|
245 |
$parts_mapped = array();
|
246 |
+
foreach ( $parts as $p ) {
|
247 |
+
if ( $p->merge === '+' ) {
|
248 |
+
if ( $lastSpacedGroup ) {
|
249 |
+
$spacedGroups[] = self::toExpression( $lastSpacedGroup );
|
250 |
}
|
251 |
$lastSpacedGroup = array();
|
252 |
}
|
253 |
$lastSpacedGroup[] = $p;
|
254 |
}
|
255 |
|
256 |
+
$spacedGroups[] = self::toExpression( $lastSpacedGroup );
|
257 |
+
$rule->value = self::toValue( $spacedGroups );
|
258 |
}
|
259 |
}
|
260 |
|
261 |
}
|
262 |
|
263 |
+
public static function toExpression( $values ) {
|
264 |
$mapped = array();
|
265 |
+
foreach ( $values as $p ) {
|
266 |
$mapped[] = $p->value;
|
267 |
}
|
268 |
return new Less_Tree_Expression( $mapped );
|
269 |
}
|
270 |
|
271 |
+
public static function toValue( $values ) {
|
272 |
+
// return new Less_Tree_Value($values); ??
|
273 |
|
274 |
$mapped = array();
|
275 |
+
foreach ( $values as $p ) {
|
276 |
$mapped[] = $p;
|
277 |
}
|
278 |
+
return new Less_Tree_Value( $mapped );
|
279 |
}
|
280 |
}
|
|
base/inc/lib/Less/VisitorReplacing.php
CHANGED
@@ -6,43 +6,41 @@
|
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
-
class Less_VisitorReplacing extends Less_Visitor{
|
10 |
-
|
11 |
-
public function visitObj( $node ){
|
12 |
|
|
|
13 |
$funcName = 'visit'.$node->type;
|
14 |
-
if( isset($this->_visitFnCache[$funcName]) ){
|
15 |
|
16 |
$visitDeeper = true;
|
17 |
$node = $this->$funcName( $node, $visitDeeper );
|
18 |
|
19 |
-
if( $node ){
|
20 |
-
if( $visitDeeper && is_object($node) ){
|
21 |
-
$node->accept($this);
|
22 |
}
|
23 |
|
24 |
$funcName = $funcName . "Out";
|
25 |
-
if( isset($this->_visitFnCache[$funcName]) ){
|
26 |
$this->$funcName( $node );
|
27 |
}
|
28 |
}
|
29 |
|
30 |
-
}else{
|
31 |
-
$node->accept($this);
|
32 |
}
|
33 |
|
34 |
return $node;
|
35 |
}
|
36 |
|
37 |
-
public function visitArray( $nodes ){
|
38 |
-
|
39 |
$newNodes = array();
|
40 |
-
foreach($nodes as $node){
|
41 |
-
$evald = $this->visitObj($node);
|
42 |
-
if( $evald ){
|
43 |
-
if( is_array($evald) ){
|
44 |
-
self::flatten($evald
|
45 |
-
}else{
|
46 |
$newNodes[] = $evald;
|
47 |
}
|
48 |
}
|
@@ -50,18 +48,17 @@ class Less_VisitorReplacing extends Less_Visitor{
|
|
50 |
return $newNodes;
|
51 |
}
|
52 |
|
53 |
-
public function flatten( $arr, &$out ){
|
54 |
-
|
55 |
-
|
56 |
-
if( !is_array($item) ){
|
57 |
$out[] = $item;
|
58 |
continue;
|
59 |
}
|
60 |
|
61 |
-
foreach($item as $nestedItem){
|
62 |
-
if( is_array($nestedItem) ){
|
63 |
-
self::flatten( $nestedItem, $out);
|
64 |
-
}else{
|
65 |
$out[] = $nestedItem;
|
66 |
}
|
67 |
}
|
@@ -71,5 +68,3 @@ class Less_VisitorReplacing extends Less_Visitor{
|
|
71 |
}
|
72 |
|
73 |
}
|
74 |
-
|
75 |
-
|
6 |
* @package Less
|
7 |
* @subpackage visitor
|
8 |
*/
|
9 |
+
class Less_VisitorReplacing extends Less_Visitor {
|
|
|
|
|
10 |
|
11 |
+
public function visitObj( $node ) {
|
12 |
$funcName = 'visit'.$node->type;
|
13 |
+
if ( isset( $this->_visitFnCache[$funcName] ) ) {
|
14 |
|
15 |
$visitDeeper = true;
|
16 |
$node = $this->$funcName( $node, $visitDeeper );
|
17 |
|
18 |
+
if ( $node ) {
|
19 |
+
if ( $visitDeeper && is_object( $node ) ) {
|
20 |
+
$node->accept( $this );
|
21 |
}
|
22 |
|
23 |
$funcName = $funcName . "Out";
|
24 |
+
if ( isset( $this->_visitFnCache[$funcName] ) ) {
|
25 |
$this->$funcName( $node );
|
26 |
}
|
27 |
}
|
28 |
|
29 |
+
} else {
|
30 |
+
$node->accept( $this );
|
31 |
}
|
32 |
|
33 |
return $node;
|
34 |
}
|
35 |
|
36 |
+
public function visitArray( $nodes ) {
|
|
|
37 |
$newNodes = array();
|
38 |
+
foreach ( $nodes as $node ) {
|
39 |
+
$evald = $this->visitObj( $node );
|
40 |
+
if ( $evald ) {
|
41 |
+
if ( is_array( $evald ) ) {
|
42 |
+
self::flatten( $evald, $newNodes );
|
43 |
+
} else {
|
44 |
$newNodes[] = $evald;
|
45 |
}
|
46 |
}
|
48 |
return $newNodes;
|
49 |
}
|
50 |
|
51 |
+
public function flatten( $arr, &$out ) {
|
52 |
+
foreach ( $arr as $item ) {
|
53 |
+
if ( !is_array( $item ) ) {
|
|
|
54 |
$out[] = $item;
|
55 |
continue;
|
56 |
}
|
57 |
|
58 |
+
foreach ( $item as $nestedItem ) {
|
59 |
+
if ( is_array( $nestedItem ) ) {
|
60 |
+
self::flatten( $nestedItem, $out );
|
61 |
+
} else {
|
62 |
$out[] = $nestedItem;
|
63 |
}
|
64 |
}
|
68 |
}
|
69 |
|
70 |
}
|
|
|
|
base/inc/widgets/base-slider.class.php
CHANGED
@@ -334,7 +334,7 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
|
|
334 |
'class' => array( 'sow-slider-image-overlay', 'sow-slider-image-' . $background['image-sizing'] ),
|
335 |
'style' => array(
|
336 |
'background-image: url(' . $background['image'] . ')',
|
337 |
-
'opacity: ' .
|
338 |
)
|
339 |
);
|
340 |
$overlay_attributes = apply_filters( 'siteorigin_widgets_slider_overlay_attributes', $overlay_attributes, $frame, $background );
|
334 |
'class' => array( 'sow-slider-image-overlay', 'sow-slider-image-' . $background['image-sizing'] ),
|
335 |
'style' => array(
|
336 |
'background-image: url(' . $background['image'] . ')',
|
337 |
+
'opacity: ' . (float) $background['opacity'],
|
338 |
)
|
339 |
);
|
340 |
$overlay_attributes = apply_filters( 'siteorigin_widgets_slider_overlay_attributes', $overlay_attributes, $frame, $background );
|
base/js/admin.js
CHANGED
@@ -282,7 +282,10 @@ var sowbForms = window.sowbForms || {};
|
|
282 |
|
283 |
///////////////////////////////////////
|
284 |
// Handle the sections
|
285 |
-
var expandContainer = function () {
|
|
|
|
|
|
|
286 |
$(this).toggleClass('siteorigin-widget-section-visible');
|
287 |
$(this).parent().find('> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section')
|
288 |
.slideToggle('fast', function () {
|
@@ -295,8 +298,10 @@ var sowbForms = window.sowbForms || {};
|
|
295 |
}
|
296 |
} );
|
297 |
};
|
298 |
-
$fields.filter( '.siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section' ).find( '> label' )
|
299 |
-
|
|
|
|
|
300 |
|
301 |
///////////////////////////////////////
|
302 |
// Handle the slider fields
|
@@ -357,6 +362,7 @@ var sowbForms = window.sowbForms || {};
|
|
357 |
.addClass('post')
|
358 |
.html(data[i].label + '<span>(' + data[i].type + ')</span>')
|
359 |
.data(data[i])
|
|
|
360 |
);
|
361 |
}
|
362 |
$ul.removeClass('loading');
|
@@ -367,7 +373,6 @@ var sowbForms = window.sowbForms || {};
|
|
367 |
// Toggle display of the existing content
|
368 |
$$.find( '.select-content-button, .button-close' ).on( 'click', function( e ) {
|
369 |
e.preventDefault();
|
370 |
-
|
371 |
$(this).trigger( 'blur' );
|
372 |
var $s = $$.find('.existing-content-selector');
|
373 |
$s.toggle();
|
@@ -379,8 +384,13 @@ var sowbForms = window.sowbForms || {};
|
|
379 |
});
|
380 |
|
381 |
// Clicking on one of the url items
|
382 |
-
$$.on('click', '.posts li', function
|
383 |
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
384 |
var $li = $(this);
|
385 |
$$.find('input.siteorigin-widget-input').val('post: ' + $li.data('value'));
|
386 |
$$.trigger( 'change' );
|
@@ -453,6 +463,21 @@ var sowbForms = window.sowbForms || {};
|
|
453 |
}
|
454 |
|
455 |
var val = $$.is('[type="checkbox"]') ? $$.is(':checked') : $$.val();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
// Return an array that has the new states added to the array
|
457 |
return $.extend(currentStates, sowEmitters[emitter.callback](val, emitter.args));
|
458 |
};
|
@@ -550,8 +575,10 @@ var sowbForms = window.sowbForms || {};
|
|
550 |
$(this).css('visibility', 'visible');
|
551 |
});
|
552 |
modal.find( 'form' ).trigger( 'submit' );
|
553 |
-
|
554 |
-
|
|
|
|
|
555 |
modal.remove();
|
556 |
});
|
557 |
});
|
@@ -655,8 +682,13 @@ var sowbForms = window.sowbForms || {};
|
|
655 |
});
|
656 |
$items.trigger('updateFieldPositions');
|
657 |
|
658 |
-
$el.find( '> .siteorigin-widget-field-repeater-add' ).disableSelection().on( 'click', function(
|
659 |
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
660 |
$el.closest('.siteorigin-widget-field-repeater')
|
661 |
.sowAddRepeaterItem()
|
662 |
.find('> .siteorigin-widget-field-repeater-items').slideDown('fast', function () {
|
@@ -704,15 +736,15 @@ var sowbForms = window.sowbForms || {};
|
|
704 |
var readonly = typeof $el.attr('readonly') !== 'undefined';
|
705 |
var item = $( '<div class="siteorigin-widget-field-repeater-item ui-draggable"></div>' )
|
706 |
.append(
|
707 |
-
$( '<div class="siteorigin-widget-field-repeater-item-top"
|
708 |
.append(
|
709 |
-
$( '<div class="siteorigin-widget-field-expand"
|
710 |
)
|
711 |
.append(
|
712 |
-
readonly ? '' : $( '<div class="siteorigin-widget-field-copy"
|
713 |
)
|
714 |
.append(
|
715 |
-
readonly ? '' : $( '<div class="siteorigin-widget-field-remove"
|
716 |
)
|
717 |
.append( $( '<h4></h4>' ).html( $el.data( 'item-name' ) ) )
|
718 |
)
|
@@ -779,10 +811,15 @@ var sowbForms = window.sowbForms || {};
|
|
779 |
$el.bind(eventName, updateLabel);
|
780 |
}
|
781 |
|
782 |
-
itemTop.on( 'click', function( e ) {
|
783 |
if (e.target.className === "siteorigin-widget-field-remove" || e.target.className === "siteorigin-widget-field-copy") {
|
784 |
return;
|
785 |
}
|
|
|
|
|
|
|
|
|
|
|
786 |
e.preventDefault();
|
787 |
$(this).closest('.siteorigin-widget-field-repeater-item').find('.siteorigin-widget-field-repeater-item-form').eq(0).slideToggle('fast', function () {
|
788 |
$( window ).trigger( 'resize' );
|
@@ -803,9 +840,13 @@ var sowbForms = window.sowbForms || {};
|
|
803 |
}
|
804 |
});
|
805 |
});
|
806 |
-
|
807 |
-
itemTop.find( '.siteorigin-widget-field-remove' ).on( 'click', function( e, params ) {
|
808 |
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
809 |
var $s = $( this ).closest( '.siteorigin-widget-field-repeater-items' );
|
810 |
var $item = $( this ).closest( '.siteorigin-widget-field-repeater-item' );
|
811 |
var removeItem = function () {
|
@@ -820,8 +861,13 @@ var sowbForms = window.sowbForms || {};
|
|
820 |
$item.slideUp('fast', removeItem );
|
821 |
}
|
822 |
});
|
823 |
-
itemTop.find( '.siteorigin-widget-field-copy' ).on( 'click', function( e ) {
|
824 |
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
825 |
var $form = $(this).closest('.siteorigin-widget-form-main');
|
826 |
var $item = $(this).closest('.siteorigin-widget-field-repeater-item');
|
827 |
var $copyItem = $item.clone();
|
@@ -839,8 +885,13 @@ var sowbForms = window.sowbForms || {};
|
|
839 |
$inputElement.parent().empty().append($inputElement);
|
840 |
$inputElement.css('display', '');
|
841 |
var curEd = tinymce.get(id);
|
842 |
-
if (curEd) {
|
843 |
-
|
|
|
|
|
|
|
|
|
|
|
844 |
}
|
845 |
}
|
846 |
// Color field :/
|
@@ -1130,6 +1181,15 @@ var sowbForms = window.sowbForms || {};
|
|
1130 |
return data;
|
1131 |
};
|
1132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1133 |
|
1134 |
/**
|
1135 |
* Sets all the widget form fields in the given container with the given data values.
|
@@ -1313,13 +1373,17 @@ var sowbForms = window.sowbForms || {};
|
|
1313 |
if ( button.classes && button.classes.length ) {
|
1314 |
buttonClasses = ' ' + button.classes.join( ' ' );
|
1315 |
}
|
1316 |
-
var $button = $( '<a class="button button-small' + buttonClasses + '">' + button.label + '</a>' );
|
1317 |
|
1318 |
if ( button.url ) {
|
1319 |
$button.attr( 'href', button.url );
|
1320 |
}
|
1321 |
if ( button.callback ) {
|
1322 |
-
$button.on( 'click', function () {
|
|
|
|
|
|
|
|
|
1323 |
button.callback( $notice );
|
1324 |
});
|
1325 |
}
|
282 |
|
283 |
///////////////////////////////////////
|
284 |
// Handle the sections
|
285 |
+
var expandContainer = function ( e ) {
|
286 |
+
if ( e.type == 'keyup' && ! sowbForms.isEnter( e ) ) {
|
287 |
+
return;
|
288 |
+
}
|
289 |
$(this).toggleClass('siteorigin-widget-section-visible');
|
290 |
$(this).parent().find('> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section')
|
291 |
.slideToggle('fast', function () {
|
298 |
}
|
299 |
} );
|
300 |
};
|
301 |
+
$fields.filter( '.siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section' ).find( '> label' )
|
302 |
+
.on( 'click keyup', expandContainer )
|
303 |
+
.attr( 'tabinex', 0 );
|
304 |
+
$fields.filter( '.siteorigin-widget-field-type-posts' ).find( '.posts-container-label-wrapper' ).on( 'click keyup', expandContainer );
|
305 |
|
306 |
///////////////////////////////////////
|
307 |
// Handle the slider fields
|
362 |
.addClass('post')
|
363 |
.html(data[i].label + '<span>(' + data[i].type + ')</span>')
|
364 |
.data(data[i])
|
365 |
+
.attr( 'tabindex', 0 )
|
366 |
);
|
367 |
}
|
368 |
$ul.removeClass('loading');
|
373 |
// Toggle display of the existing content
|
374 |
$$.find( '.select-content-button, .button-close' ).on( 'click', function( e ) {
|
375 |
e.preventDefault();
|
|
|
376 |
$(this).trigger( 'blur' );
|
377 |
var $s = $$.find('.existing-content-selector');
|
378 |
$s.toggle();
|
384 |
});
|
385 |
|
386 |
// Clicking on one of the url items
|
387 |
+
$$.on( 'click keyup', '.posts li', function( e ) {
|
388 |
e.preventDefault();
|
389 |
+
|
390 |
+
if ( e.type == 'keyup' && ! sowbForms.isEnter( e ) ) {
|
391 |
+
return;
|
392 |
+
}
|
393 |
+
|
394 |
var $li = $(this);
|
395 |
$$.find('input.siteorigin-widget-input').val('post: ' + $li.data('value'));
|
396 |
$$.trigger( 'change' );
|
463 |
}
|
464 |
|
465 |
var val = $$.is('[type="checkbox"]') ? $$.is(':checked') : $$.val();
|
466 |
+
|
467 |
+
// Media form fields can have an external field set so we need to check that field slightly differently.
|
468 |
+
if ( $$.parent().hasClass( 'siteorigin-widget-field-type-media' ) && emitter.callback == 'conditional' ) {
|
469 |
+
// If we're checking for a value,and the main field is empty,
|
470 |
+
// fallback to the external field value. This also works in reverse.
|
471 |
+
if ( ! val ) {
|
472 |
+
val = $$.hasClass( 'media-fallback-external' ) ? $$.prev().val() : fallbackField = $$.next().val();
|
473 |
+
}
|
474 |
+
|
475 |
+
// Override value if media value is set to 0 to prevent unintentional conditional passing.
|
476 |
+
if ( val == 0 ) {
|
477 |
+
val = '';
|
478 |
+
}
|
479 |
+
}
|
480 |
+
|
481 |
// Return an array that has the new states added to the array
|
482 |
return $.extend(currentStates, sowEmitters[emitter.callback](val, emitter.args));
|
483 |
};
|
575 |
$(this).css('visibility', 'visible');
|
576 |
});
|
577 |
modal.find( 'form' ).trigger( 'submit' );
|
578 |
+
modal.find('.close').on( 'click keyup', function (e) {
|
579 |
+
if ( e.type == 'keyup' && ! sowbForms.isEnter( e ) ) {
|
580 |
+
return;
|
581 |
+
}
|
582 |
modal.remove();
|
583 |
});
|
584 |
});
|
682 |
});
|
683 |
$items.trigger('updateFieldPositions');
|
684 |
|
685 |
+
$el.find( '> .siteorigin-widget-field-repeater-add' ).disableSelection().on( 'click keyup', function(e) {
|
686 |
e.preventDefault();
|
687 |
+
|
688 |
+
if ( e.type == 'keyup' && ! sowbForms.isEnter( e ) ) {
|
689 |
+
return;
|
690 |
+
}
|
691 |
+
|
692 |
$el.closest('.siteorigin-widget-field-repeater')
|
693 |
.sowAddRepeaterItem()
|
694 |
.find('> .siteorigin-widget-field-repeater-items').slideDown('fast', function () {
|
736 |
var readonly = typeof $el.attr('readonly') !== 'undefined';
|
737 |
var item = $( '<div class="siteorigin-widget-field-repeater-item ui-draggable"></div>' )
|
738 |
.append(
|
739 |
+
$( '<div class="siteorigin-widget-field-repeater-item-top" tabindex="0" />' )
|
740 |
.append(
|
741 |
+
$( '<div class="siteorigin-widget-field-expand" tabindex="0" />' )
|
742 |
)
|
743 |
.append(
|
744 |
+
readonly ? '' : $( '<div class="siteorigin-widget-field-copy" tabindex="0" />' )
|
745 |
)
|
746 |
.append(
|
747 |
+
readonly ? '' : $( '<div class="siteorigin-widget-field-remove" tabindex="0" />' )
|
748 |
)
|
749 |
.append( $( '<h4></h4>' ).html( $el.data( 'item-name' ) ) )
|
750 |
)
|
811 |
$el.bind(eventName, updateLabel);
|
812 |
}
|
813 |
|
814 |
+
itemTop.on( 'click keyup', function( e ) {
|
815 |
if (e.target.className === "siteorigin-widget-field-remove" || e.target.className === "siteorigin-widget-field-copy") {
|
816 |
return;
|
817 |
}
|
818 |
+
|
819 |
+
if ( e.type == 'keyup' && ! sowbForms.isEnter( e ) ) {
|
820 |
+
return;
|
821 |
+
}
|
822 |
+
|
823 |
e.preventDefault();
|
824 |
$(this).closest('.siteorigin-widget-field-repeater-item').find('.siteorigin-widget-field-repeater-item-form').eq(0).slideToggle('fast', function () {
|
825 |
$( window ).trigger( 'resize' );
|
840 |
}
|
841 |
});
|
842 |
});
|
843 |
+
itemTop.find( '.siteorigin-widget-field-remove' ).on( 'click keyup', function( e, params ) {
|
|
|
844 |
e.preventDefault();
|
845 |
+
|
846 |
+
if ( e.type == 'keyup' && ! sowbForms.isEnter( e ) ) {
|
847 |
+
return;
|
848 |
+
}
|
849 |
+
|
850 |
var $s = $( this ).closest( '.siteorigin-widget-field-repeater-items' );
|
851 |
var $item = $( this ).closest( '.siteorigin-widget-field-repeater-item' );
|
852 |
var removeItem = function () {
|
861 |
$item.slideUp('fast', removeItem );
|
862 |
}
|
863 |
});
|
864 |
+
itemTop.find( '.siteorigin-widget-field-copy' ).on( 'click keyup', function( e ) {
|
865 |
e.preventDefault();
|
866 |
+
|
867 |
+
if ( e.type == 'keyup' && ! sowbForms.isEnter( e ) ) {
|
868 |
+
return;
|
869 |
+
}
|
870 |
+
|
871 |
var $form = $(this).closest('.siteorigin-widget-form-main');
|
872 |
var $item = $(this).closest('.siteorigin-widget-field-repeater-item');
|
873 |
var $copyItem = $item.clone();
|
885 |
$inputElement.parent().empty().append($inputElement);
|
886 |
$inputElement.css('display', '');
|
887 |
var curEd = tinymce.get(id);
|
888 |
+
if ( curEd ) {
|
889 |
+
var contentVal = curEd.getContent();
|
890 |
+
if ( ! _.isEmpty( contentVal ) ) {
|
891 |
+
$inputElement.val( contentVal );
|
892 |
+
} else if ( contentVal.search( '<' ) !== -1 && contentVal.search( '>' ) === -1) {
|
893 |
+
$textarea.val( contentVal.replace( /</g, '' ) );
|
894 |
+
}
|
895 |
}
|
896 |
}
|
897 |
// Color field :/
|
1181 |
return data;
|
1182 |
};
|
1183 |
|
1184 |
+
sowbForms.isEnter = function( e, triggerClick = false ) {
|
1185 |
+
if ( e.which == 13 ) {
|
1186 |
+
if ( triggerClick ) {
|
1187 |
+
$( e.target ).trigger( 'click' );
|
1188 |
+
} else {
|
1189 |
+
return true;
|
1190 |
+
}
|
1191 |
+
}
|
1192 |
+
};
|
1193 |
|
1194 |
/**
|
1195 |
* Sets all the widget form fields in the given container with the given data values.
|
1373 |
if ( button.classes && button.classes.length ) {
|
1374 |
buttonClasses = ' ' + button.classes.join( ' ' );
|
1375 |
}
|
1376 |
+
var $button = $( '<a class="button button-small' + buttonClasses + '" tabindex="0">' + button.label + '</a>' );
|
1377 |
|
1378 |
if ( button.url ) {
|
1379 |
$button.attr( 'href', button.url );
|
1380 |
}
|
1381 |
if ( button.callback ) {
|
1382 |
+
$button.on( 'click keyup', function ( e ) {
|
1383 |
+
if ( e.type == 'keyup' && ! sowbForms.isEnter( e ) ) {
|
1384 |
+
return;
|
1385 |
+
}
|
1386 |
+
|
1387 |
button.callback( $notice );
|
1388 |
});
|
1389 |
}
|
base/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each((function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",(function(i,t,r){n.find("[data-state-handler]").each((function(){var i,n,s,o,d,l,g=e(this),f=e.extend({},g.data("state-handler"),a?g.data("state-handler-initial"):{});if(0===Object.keys(f).length)return!0;var c={},p=sowbForms.getContainerFieldId(g,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==p){var u={};for(var w in f)u[w.replace("{$repeater}",p)]=f[w];f=u}var m=sowbForms.getContainerFieldId(g,"widget",".siteorigin-widget-widget");if(!1!==m){var v={};for(var h in f){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/);v[b&&b.length&&void 0===b[1]?b[2]+"_"+m+"["+b[3]+"]":"_else["+b[1]+"_"+m+"]"]=f[h]}f=v}for(var y in f)if(d=!1,null!==(i=y.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/))){if(n={group:"default",name:"",multi:!1},void 0!==i[2]?(n.group=i[1],n.name=i[3]):n.name=i[0],n.multi=void 0!==i[4],"_else"===n.group)n.group=n.name,n.name="",d=n.group===t&&void 0===c[n.group];else{l=n.name.split(",").map((function(e){return e.trim()}));for(var F=0;F<l.length&&!(d=n.group===t&&l[F]===r);F++);}if(d){s=f[y],n.multi||(s=[s]);for(F=0;F<s.length;F++){var k=!1;if((o=void 0!==s[F][1]&&Boolean(s[F][1])?g.find(s[F][1]):g).prop("style").length&&("show"==s[F][0]?(o.fadeIn("fast"),k=!0):"hide"==s[F][0]&&(o.fadeOut("fast"),k=!0)),k||o[s[F][0]].apply(o,void 0!==s[F][2]?s[F][2]:[]),o.is(".siteorigin-widget-field:visible"))if(o.is(".siteorigin-widget-field-type-section"))o.find("> .siteorigin-widget-section > .siteorigin-widget-field").trigger("sowsetupformfield");else o.trigger("sowsetupformfield")}c[n.group]=!0}}}))})),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");if(d.find(".dashicons-dismiss").on("click",(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",(function(){d.remove()}))})),!n.data("backupDisabled")){var l=n.find("> .siteorigin-widgets-form-id").val(),g=n.find("> .siteorigin-widgets-form-timestamp"),f=parseInt(g.val()||0),c=JSON.parse(sessionStorage.getItem(l));c&&(c._sow_form_timestamp>f?sowbForms.displayNotice(n,soWidgets.backup.newerVersion,soWidgets.backup.replaceWarning,[{label:soWidgets.backup.restore,callback:function(e){sowbForms.setWidgetFormValues(r,c),e.slideUp("fast",(function(){e.remove()}))}},{label:soWidgets.backup.dismiss,callback:function(e){e.slideUp("fast",(function(){sessionStorage.removeItem(l),e.remove()}))}}]):sessionStorage.removeItem(l)),n.on("change",(function(){g.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))}))}}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var p=n.find("> .siteorigin-widget-field");p.find("> .siteorigin-widget-section").sowSetupForm();var u=p.find("> .siteorigin-widget-widget");u.find("> .siteorigin-widget-section").sowSetupForm(),u.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),p.find(".siteorigin-widget-input").each((function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))})),p.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),p.find("> .siteorigin-widget-input-color").each((function(){var i=e(this),t={change:function(i,t){setTimeout((function(){e(i.target).trigger("change")}),100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)}));var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",(function(){(e(window).trigger("resize"),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible"))&&e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}))};p.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").on("click",w),p.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").on("click",w),p.filter(".siteorigin-widget-field-type-slider").each((function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseFloat(t.attr("max")),min:parseFloat(t.attr("min")),step:parseFloat(t.attr("step")),value:parseFloat(t.val()),slide:function(e,r){t.val(parseFloat(r.value)),t.trigger("change"),i.find(".siteorigin-widget-slider-value").html(r.value)}}),t.on("change",(function(e,i){i&&i.silent||r.slider("value",parseFloat(t.val()))}))})),p.filter(".siteorigin-widget-field-type-link").each((function(){var i=e(this),t=function(){var t=i.find(".content-text-search"),r=t.val(),n=t.data("postTypes"),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:r,postTypes:n},(function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label=" "),a.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));a.removeClass("loading")}))};i.find(".select-content-button, .button-close").on("click",(function(r){r.preventDefault(),e(this).trigger("blur");var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&t()})),i.on("click",".posts li",(function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.trigger("change"),i.find(".existing-content-selector").toggle()}));var r=null;i.find(".content-text-search").on("keyup",(function(){null!==r&&clearTimeout(r),r=setTimeout((function(){t()}),500)}))})),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&p.filter(".siteorigin-widget-field-type-builder").each((function(){e(this).find("> .siteorigin-page-builder-field").each((function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})}))}));var m=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;if(i.is('[type="radio"]')&&!i.is(":checked"))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map((function(e){return e.replace("{$repeater}",n)})));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map((function(e){return e="conditional"===t.callback?e.replace(/(.*)(\[.*)/,"$1_"+a+"$2"):e+"_"+a})));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))},a={default:""};void 0===t.length&&(t=[t]);for(var s=0;s<t.length;s++)a=n(t[s],a);var o=r.data("states");for(var d in void 0===o&&(o={default:""}),a)void 0!==o[d]&&a[d]===o[d]||(o[d]=a[d],r.trigger("sowstatechange",[d,a[d]]));r.data("states",o)}};p.filter("[data-state-emitter]").each((function(){var i=e(this).find(".siteorigin-widget-input");i.on("keyup change",m),i.each((function(){var i=e(this);i.is(":radio")?i.is(":checked")&&m.call(i[0]):m.call(i[0])}))})),n.trigger("sowsetupform",p).data("sow-form-setup",!0),p.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",(function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")})),a=!1}))},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").on("click",(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",(function(){e(this).css("visibility","visible")})),n.find("form").trigger("submit"),n.find(".close").on("click",(function(){n.remove()}))}))},e.fn.sowSetupRepeater=function(){return e(this).each((function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.bind("updateFieldPositions",(function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each((function(i,t){e(t).find(".siteorigin-widget-input").each((function(t,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)}))})),i.find(".siteorigin-widget-input").each((function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}})),i.data("initialSetup")||(i.find(".siteorigin-widget-input").each((function(i,t){var r=e(t);r.prop("checked",r.prop("defaultChecked"))})),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n+"px"),i.css("overflow","auto")}else i.css("max-height","").css("overflow","")})),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions"),r.trigger("change")},sortstop:function(i,t){t.item.is(".siteorigin-widget-field-repeater-item")?t.item.find("> .siteorigin-widget-field-repeater-item-form").each((function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")})):t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield");r.trigger("change")}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().on("click",(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",(function(){e(window).trigger("resize")}))})),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").on("click",(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",(function(){e(window).trigger("resize")}))}))}))},e.fn.sowAddRepeaterItem=function(){return e(this).each((function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[data-name]").each((function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))}));var s="";a.find("> .siteorigin-widget-field").each((function(i,t){var r=t.outerHTML;e(t).is(".siteorigin-widget-field-type-repeater")||(r=r.replace(/_id_/g,n)),s+=r}));var o=void 0!==r.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable"></div>').append(e('<div class="siteorigin-widget-field-repeater-item-top"></div>').append(e('<div class="siteorigin-widget-field-expand"></div>')).append(o?"":e('<div class="siteorigin-widget-field-copy"></div>')).append(o?"":e('<div class="siteorigin-widget-field-remove"></div>')).append(e("<h4></h4>").html(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form"></div>').html(s));r.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",(function(){e(window).trigger("resize")})),r.trigger("change")}))},e.fn.sowRemoveRepeaterItem=function(){return e(this).each((function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(t).trigger("change")}))},e.fn.sowSetupRepeaterItems=function(){return e(this).each((function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label"),o=r.parents(".siteorigin-widget-field-repeater").data("item-name");if(s&&(s.hasOwnProperty("selector")||s.hasOwnProperty("selectorArray"))){var d=function(){var e,i,t;if(s.hasOwnProperty("selectorArray"))for(var n=0;n<s.selectorArray.length&&(e=(t=s.selectorArray[n]).hasOwnProperty("valueMethod")&&t.valueMethod?t.valueMethod:"val",!(i=r.find(t.selector)[e]()));n++);else e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.find(s.selector)[e]();i?(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i)):a.find("h4").text(o)};d();var l=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";r.bind(l,d)}a.on("click",(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",(function(){e(window).trigger("resize"),e(this).is(":visible")?(e(this).trigger("slideToggleOpenComplete"),e(this).find(".siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field,> .siteorigin-widget-field").each((function(i,t){var r=e(t);r.is(":visible")&&r.trigger("sowsetupformfield")}))):e(this).trigger("slideToggleCloseComplete")})))})),a.find(".siteorigin-widget-field-remove").on("click",(function(i,t){i.preventDefault();var r=e(this).closest(".siteorigin-widget-field-repeater-items"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),s=function(){a.remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(window).trigger("resize"),n.trigger("change")};t&&t.silent?s():confirm(soWidgets.sure)&&a.slideUp("fast",s)})),a.find(".siteorigin-widget-field-copy").on("click",(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each((function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var g=tinymce.get(s);g&&i.val(g.getContent())}else if(i.is(".wp-color-picker")){var f=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");f.remove(),c.append(i.remove())}else{var p=s?n.find("#"+s):n.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(s){var u,w;if(i.is('[type="radio"]')){u=s.replace(/-\d+-\d+$/,"");var m=s.replace(/-\d+$/,"");if(!d[u]){var v={};d[u]=t.find(".siteorigin-widget-input[id^="+u+"]").not("[id*=_id_]").filter((function(i,t){var r=e(t).attr("name");return!v[r]&&(v[r]=!0,!0)})).length+1}var h=u+"-"+d[u];w=h+s.match(/-\d+$/)[0],a.find("label[for="+m+"]").attr("for",h)}else F=new RegExp("-\\d+$"),u=s.replace(F,""),d[u]||(d[u]=t.find(".siteorigin-widget-input[id^="+u+"]").not("[id*=_id_]").length+1),w=u+"-"+d[u]++;if(i.is(".wp-editor-area")&&(w+=Math.floor(1e3*Math.random()),i.data("tinymce-id",w)),i.attr("id",w),i.is(".wp-editor-area")){var b=i.closest(".siteorigin-widget-tinymce-container"),y=b.data("media-buttons");if(y&&y.html){var F=new RegExp(s,"g");y.html=y.html.replace(F,w),b.data("media-buttons",y)}}a.find("label[for="+s+"]").attr("for",w),a.find("[id*="+s+"]").each((function(){var i=e(this).attr("id").replace(s,w);e(this).attr("id",i)})),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var k=n.parents(".siteorigin-widget-field-repeater").length,_=e("body");(_.hasClass("wp-customizer")||_.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(k+=1);var C=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(k-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",C),i.data("original-name",C)})),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",(function(){e(window).trigger("resize")})),r.trigger("change")})),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}}))},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1].split("]["),a=n.length?r:null;n.length;)a=a[n.shift()];return a[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},(function(e){window.sowVars[t]=e,r(window.sowVars[t][i])})):r(window.sowVars[t][i])},sowbForms.getWidgetIdBase=function(e){return e.data("id-base")},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each((function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;var n=(r=r[1]).split("][");n=n.map((function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e}));var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var d=null;"undefined"!=typeof tinyMCE&&(d=tinyMCE.get(i.attr("id"))),s=null===d||"function"!=typeof d.getContent||d.isHidden()?i.val():d.getContent()}else if("SELECT"===i.prop("tagName")){var l=i.find("option:selected");1===l.length?s=i.find("option:selected").val():l.length>1&&(s=_.map(i.find("option:selected"),(function(i,t){return e(i).val()})))}else s=i.val();for(var g=0;g<n.length;g++)g===n.length-1?""===n[g]?a.push(s):a[n[g]]=s:(_.isUndefined(a[n[g]])&&(_.isNumber(n[g+1])||""===n[g+1]?a[n[g]]=[]:a[n[g]]={}),a=a[n[g]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}})),t},sowbForms.setWidgetFormValues=function(i,t,r,n){r=r||!1,n=void 0!==n&&n||void 0===n;var a=0,s=function(i,t){10!=++a?(i.find("> .siteorigin-widget-field-type-repeater,> .siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field-type-repeater").each((function(i,n){var a=e(this),o=a.find("> .siteorigin-widget-field-repeater"),d=o.data("repeaterName"),l=t.hasOwnProperty(d)?t[d]:null;if(a.parent().is(".siteorigin-widget-section")){var g=o.data("element-name");g=g.replace(/\[#.*?#\]/g,"");for(var f=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(g)[1].split("]["),c=f.length?t:null;f.length;){var p=f.shift();c=c.hasOwnProperty(p)?c[p]:c}l=c}if(l&&Array.isArray(l)){var u=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),w=l.length,m=u.length;if(w>m)for(var v=0;v<w-m;v++)o.find("> .siteorigin-widget-field-repeater-add").trigger("click");else if(!r&&w<m)for(var h=w;h<m;h++){e(u.eq(h)).find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}u=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var b=0;b<u.length;b++)u.eq(b).find("> .siteorigin-widget-field-repeater-item-form"),s(u.eq(b).find("> .siteorigin-widget-field-repeater-item-form"),l[b])}})),--a):--a};s(i,t),i.find("*[name]").each((function(){var i=e(this),a=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(null==a)return!0;var s=(a=a[1]).split("][");s=s.map((function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e}));for(var o,d=t,l=0;l<s.length;l++){if(!d.hasOwnProperty(s[l])){if(r)return!0;break}l===s.length-1?o=d[s[l]]:d=d[s[l]]}if("checkbox"===i.attr("type"))i.prop("checked",o);else if("radio"===i.attr("type"))i.prop("checked",o===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var g=null;"undefined"!=typeof tinyMCE&&(g=tinyMCE.get(i.attr("id"))),null!==g&&"function"==typeof g.setContent&&!g.isHidden()&&i.parent().is(":visible")?g.initialized?g.setContent(o):g.on("init",(function(){g.setContent(o)})):i.val(o)}else if(i.is(".panels-data")){i.val(o);var f=i.data("builder");f&&f.setDataField(i)}else i.val(o);n&&(i.trigger("change"),this.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0})))}))},sowbForms.displayNotice=function(i,t,r,n,a){var s=e('<div class="siteorigin-widget-form-notification"></div>');t&&s.append("<span>"+t+"</span>"),n&&n.length&&n.forEach((function(i){var t="";i.classes&&i.classes.length&&(t=" "+i.classes.join(" "));var r=e('<a class="button button-small'+t+'">'+i.label+"</a>");i.url&&r.attr("href",i.url),i.callback&&r.on("click",(function(){i.callback(s)})),s.append(r)})),r&&s.append("<div><small>"+r+"</small></div>"),a?a.before(s):i.prepend(s)},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",(function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout((function(){i.sowSetupForm()}),200)}));var i=e("body");i.hasClass("wp-customizer")&&e(document).on("widget-added",(function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()})),i.hasClass("block-editor-page")&&e(document).on("panels_setup_preview",(function(){window.hasOwnProperty("sowb")&&e(sowb).trigger("setup_widgets",{preview:!0})})),e(document).on("open_dialog",(function(e,i){i.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")&&i.$el.find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")})),e((function(){e(document).trigger("sowadminloaded")}))}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$").exec(e);if(null===t)return!1;var r="",n="default";return void 0!==t[3]?(n=t[1],r=t[3]):r=t[1],{match:t[4].trim(),group:n,state:r}},_checker:function(e,i,t,r){var n,a={};void 0===i.length&&(i=[i]);for(var s=0;s<i.length;s++)!1!==(n=sowEmitters._match(i[s],t))&&("_true"===n.match||r(e,i,n.match))&&(a[n.group]=n.state);return a},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",(function(val,args,match){return eval(match)}))},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",(function(e,i,t){return-1!==t.split(",").map((function(e){return e.trim()})).indexOf(e)}))}};window.sowbForms=sowbForms;
|
1 |
+
var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each((function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",(function(i,t,r){n.find("[data-state-handler]").each((function(){var i,n,s,o,d,l,g=e(this),f=e.extend({},g.data("state-handler"),a?g.data("state-handler-initial"):{});if(0===Object.keys(f).length)return!0;var p={},c=sowbForms.getContainerFieldId(g,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==c){var u={};for(var w in f)u[w.replace("{$repeater}",c)]=f[w];f=u}var m=sowbForms.getContainerFieldId(g,"widget",".siteorigin-widget-widget");if(!1!==m){var v={};for(var h in f){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/);v[b&&b.length&&void 0===b[1]?b[2]+"_"+m+"["+b[3]+"]":"_else["+b[1]+"_"+m+"]"]=f[h]}f=v}for(var y in f)if(d=!1,null!==(i=y.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/))){if(n={group:"default",name:"",multi:!1},void 0!==i[2]?(n.group=i[1],n.name=i[3]):n.name=i[0],n.multi=void 0!==i[4],"_else"===n.group)n.group=n.name,n.name="",d=n.group===t&&void 0===p[n.group];else{l=n.name.split(",").map((function(e){return e.trim()}));for(var k=0;k<l.length&&!(d=n.group===t&&l[k]===r);k++);}if(d){s=f[y],n.multi||(s=[s]);for(k=0;k<s.length;k++){var F=!1;if((o=void 0!==s[k][1]&&Boolean(s[k][1])?g.find(s[k][1]):g).prop("style").length&&("show"==s[k][0]?(o.fadeIn("fast"),F=!0):"hide"==s[k][0]&&(o.fadeOut("fast"),F=!0)),F||o[s[k][0]].apply(o,void 0!==s[k][2]?s[k][2]:[]),o.is(".siteorigin-widget-field:visible"))if(o.is(".siteorigin-widget-field-type-section"))o.find("> .siteorigin-widget-section > .siteorigin-widget-field").trigger("sowsetupformfield");else o.trigger("sowsetupformfield")}p[n.group]=!0}}}))})),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");if(d.find(".dashicons-dismiss").on("click",(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",(function(){d.remove()}))})),!n.data("backupDisabled")){var l=n.find("> .siteorigin-widgets-form-id").val(),g=n.find("> .siteorigin-widgets-form-timestamp"),f=parseInt(g.val()||0),p=JSON.parse(sessionStorage.getItem(l));p&&(p._sow_form_timestamp>f?sowbForms.displayNotice(n,soWidgets.backup.newerVersion,soWidgets.backup.replaceWarning,[{label:soWidgets.backup.restore,callback:function(e){sowbForms.setWidgetFormValues(r,p),e.slideUp("fast",(function(){e.remove()}))}},{label:soWidgets.backup.dismiss,callback:function(e){e.slideUp("fast",(function(){sessionStorage.removeItem(l),e.remove()}))}}]):sessionStorage.removeItem(l)),n.on("change",(function(){g.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))}))}}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var c=n.find("> .siteorigin-widget-field");c.find("> .siteorigin-widget-section").sowSetupForm();var u=c.find("> .siteorigin-widget-widget");u.find("> .siteorigin-widget-section").sowSetupForm(),u.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),c.find(".siteorigin-widget-input").each((function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))})),c.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),c.find("> .siteorigin-widget-input-color").each((function(){var i=e(this),t={change:function(i,t){setTimeout((function(){e(i.target).trigger("change")}),100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)}));var w=function(i){("keyup"!=i.type||sowbForms.isEnter(i))&&(e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",(function(){(e(window).trigger("resize"),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible"))&&e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")})))};c.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").on("click keyup",w).attr("tabinex",0),c.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").on("click keyup",w),c.filter(".siteorigin-widget-field-type-slider").each((function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseFloat(t.attr("max")),min:parseFloat(t.attr("min")),step:parseFloat(t.attr("step")),value:parseFloat(t.val()),slide:function(e,r){t.val(parseFloat(r.value)),t.trigger("change"),i.find(".siteorigin-widget-slider-value").html(r.value)}}),t.on("change",(function(e,i){i&&i.silent||r.slider("value",parseFloat(t.val()))}))})),c.filter(".siteorigin-widget-field-type-link").each((function(){var i=e(this),t=function(){var t=i.find(".content-text-search"),r=t.val(),n=t.data("postTypes"),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:r,postTypes:n},(function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label=" "),a.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]).attr("tabindex",0));a.removeClass("loading")}))};i.find(".select-content-button, .button-close").on("click",(function(r){r.preventDefault(),e(this).trigger("blur");var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&t()})),i.on("click keyup",".posts li",(function(t){if(t.preventDefault(),"keyup"!=t.type||sowbForms.isEnter(t)){var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.trigger("change"),i.find(".existing-content-selector").toggle()}}));var r=null;i.find(".content-text-search").on("keyup",(function(){null!==r&&clearTimeout(r),r=setTimeout((function(){t()}),500)}))})),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&c.filter(".siteorigin-widget-field-type-builder").each((function(){e(this).find("> .siteorigin-page-builder-field").each((function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})}))}));var m=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;if(i.is('[type="radio"]')&&!i.is(":checked"))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map((function(e){return e.replace("{$repeater}",n)})));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map((function(e){return e="conditional"===t.callback?e.replace(/(.*)(\[.*)/,"$1_"+a+"$2"):e+"_"+a})));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return i.parent().hasClass("siteorigin-widget-field-type-media")&&"conditional"==t.callback&&(s||(s=i.hasClass("media-fallback-external")?i.prev().val():fallbackField=i.next().val()),0==s&&(s="")),e.extend(r,sowEmitters[t.callback](s,t.args))},a={default:""};void 0===t.length&&(t=[t]);for(var s=0;s<t.length;s++)a=n(t[s],a);var o=r.data("states");for(var d in void 0===o&&(o={default:""}),a)void 0!==o[d]&&a[d]===o[d]||(o[d]=a[d],r.trigger("sowstatechange",[d,a[d]]));r.data("states",o)}};c.filter("[data-state-emitter]").each((function(){var i=e(this).find(".siteorigin-widget-input");i.on("keyup change",m),i.each((function(){var i=e(this);i.is(":radio")?i.is(":checked")&&m.call(i[0]):m.call(i[0])}))})),n.trigger("sowsetupform",c).data("sow-form-setup",!0),c.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",(function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")})),a=!1}))},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").on("click",(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",(function(){e(this).css("visibility","visible")})),n.find("form").trigger("submit"),n.find(".close").on("click keyup",(function(e){("keyup"!=e.type||sowbForms.isEnter(e))&&n.remove()}))}))},e.fn.sowSetupRepeater=function(){return e(this).each((function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.bind("updateFieldPositions",(function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each((function(i,t){e(t).find(".siteorigin-widget-input").each((function(t,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)}))})),i.find(".siteorigin-widget-input").each((function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}})),i.data("initialSetup")||(i.find(".siteorigin-widget-input").each((function(i,t){var r=e(t);r.prop("checked",r.prop("defaultChecked"))})),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n+"px"),i.css("overflow","auto")}else i.css("max-height","").css("overflow","")})),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions"),r.trigger("change")},sortstop:function(i,t){t.item.is(".siteorigin-widget-field-repeater-item")?t.item.find("> .siteorigin-widget-field-repeater-item-form").each((function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")})):t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield");r.trigger("change")}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().on("click keyup",(function(i){i.preventDefault(),("keyup"!=i.type||sowbForms.isEnter(i))&&r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",(function(){e(window).trigger("resize")}))})),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").on("click",(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",(function(){e(window).trigger("resize")}))}))}))},e.fn.sowAddRepeaterItem=function(){return e(this).each((function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[data-name]").each((function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))}));var s="";a.find("> .siteorigin-widget-field").each((function(i,t){var r=t.outerHTML;e(t).is(".siteorigin-widget-field-type-repeater")||(r=r.replace(/_id_/g,n)),s+=r}));var o=void 0!==r.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable"></div>').append(e('<div class="siteorigin-widget-field-repeater-item-top" tabindex="0" />').append(e('<div class="siteorigin-widget-field-expand" tabindex="0" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" tabindex="0" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" tabindex="0" />')).append(e("<h4></h4>").html(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form"></div>').html(s));r.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",(function(){e(window).trigger("resize")})),r.trigger("change")}))},e.fn.sowRemoveRepeaterItem=function(){return e(this).each((function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(t).trigger("change")}))},e.fn.sowSetupRepeaterItems=function(){return e(this).each((function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label"),o=r.parents(".siteorigin-widget-field-repeater").data("item-name");if(s&&(s.hasOwnProperty("selector")||s.hasOwnProperty("selectorArray"))){var d=function(){var e,i,t;if(s.hasOwnProperty("selectorArray"))for(var n=0;n<s.selectorArray.length&&(e=(t=s.selectorArray[n]).hasOwnProperty("valueMethod")&&t.valueMethod?t.valueMethod:"val",!(i=r.find(t.selector)[e]()));n++);else e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.find(s.selector)[e]();i?(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i)):a.find("h4").text(o)};d();var l=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";r.bind(l,d)}a.on("click keyup",(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&("keyup"!=i.type||sowbForms.isEnter(i))&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",(function(){e(window).trigger("resize"),e(this).is(":visible")?(e(this).trigger("slideToggleOpenComplete"),e(this).find(".siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field,> .siteorigin-widget-field").each((function(i,t){var r=e(t);r.is(":visible")&&r.trigger("sowsetupformfield")}))):e(this).trigger("slideToggleCloseComplete")})))})),a.find(".siteorigin-widget-field-remove").on("click keyup",(function(i,t){if(i.preventDefault(),"keyup"!=i.type||sowbForms.isEnter(i)){var r=e(this).closest(".siteorigin-widget-field-repeater-items"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),s=function(){a.remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(window).trigger("resize"),n.trigger("change")};t&&t.silent?s():confirm(soWidgets.sure)&&a.slideUp("fast",s)}})),a.find(".siteorigin-widget-field-copy").on("click keyup",(function(i){if(i.preventDefault(),"keyup"!=i.type||sowbForms.isEnter(i)){var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each((function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var g=tinymce.get(s);if(g){var f=g.getContent();_.isEmpty(f)?-1!==f.search("<")&&-1===f.search(">")&&$textarea.val(f.replace(/</g,"")):i.val(f)}}else if(i.is(".wp-color-picker")){var p=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");p.remove(),c.append(i.remove())}else{var u=s?n.find("#"+s):n.find('[name="'+l+'"]');u.length&&null!=u.val()&&i.val(u.val())}if(s){var w,m;if(i.is('[type="radio"]')){w=s.replace(/-\d+-\d+$/,"");var v=s.replace(/-\d+$/,"");if(!d[w]){var h={};d[w]=t.find(".siteorigin-widget-input[id^="+w+"]").not("[id*=_id_]").filter((function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)})).length+1}var b=w+"-"+d[w];m=b+s.match(/-\d+$/)[0],a.find("label[for="+v+"]").attr("for",b)}else F=new RegExp("-\\d+$"),w=s.replace(F,""),d[w]||(d[w]=t.find(".siteorigin-widget-input[id^="+w+"]").not("[id*=_id_]").length+1),m=w+"-"+d[w]++;if(i.is(".wp-editor-area")&&(m+=Math.floor(1e3*Math.random()),i.data("tinymce-id",m)),i.attr("id",m),i.is(".wp-editor-area")){var y=i.closest(".siteorigin-widget-tinymce-container"),k=y.data("media-buttons");if(k&&k.html){var F=new RegExp(s,"g");k.html=k.html.replace(F,m),y.data("media-buttons",k)}}a.find("label[for="+s+"]").attr("for",m),a.find("[id*="+s+"]").each((function(){var i=e(this).attr("id").replace(s,m);e(this).attr("id",i)})),"undefined"!=typeof tinymce&&tinymce.get(m)&&tinymce.get(m).remove()}var x=n.parents(".siteorigin-widget-field-repeater").length,C=e("body");(C.hasClass("wp-customizer")||C.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(x+=1);var E=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(x-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",E),i.data("original-name",E)})),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",(function(){e(window).trigger("resize")})),r.trigger("change")}})),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}}))},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1].split("]["),a=n.length?r:null;n.length;)a=a[n.shift()];return a[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},(function(e){window.sowVars[t]=e,r(window.sowVars[t][i])})):r(window.sowVars[t][i])},sowbForms.getWidgetIdBase=function(e){return e.data("id-base")},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each((function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;var n=(r=r[1]).split("][");n=n.map((function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e}));var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var d=null;"undefined"!=typeof tinyMCE&&(d=tinyMCE.get(i.attr("id"))),s=null===d||"function"!=typeof d.getContent||d.isHidden()?i.val():d.getContent()}else if("SELECT"===i.prop("tagName")){var l=i.find("option:selected");1===l.length?s=i.find("option:selected").val():l.length>1&&(s=_.map(i.find("option:selected"),(function(i,t){return e(i).val()})))}else s=i.val();for(var g=0;g<n.length;g++)g===n.length-1?""===n[g]?a.push(s):a[n[g]]=s:(_.isUndefined(a[n[g]])&&(_.isNumber(n[g+1])||""===n[g+1]?a[n[g]]=[]:a[n[g]]={}),a=a[n[g]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}})),t},sowbForms.isEnter=function(i,t=!1){if(13==i.which){if(!t)return!0;e(i.target).trigger("click")}},sowbForms.setWidgetFormValues=function(i,t,r,n){r=r||!1,n=void 0!==n&&n||void 0===n;var a=0,s=function(i,t){10!=++a?(i.find("> .siteorigin-widget-field-type-repeater,> .siteorigin-widget-field-type-section > .siteorigin-widget-section > .siteorigin-widget-field-type-repeater").each((function(i,n){var a=e(this),o=a.find("> .siteorigin-widget-field-repeater"),d=o.data("repeaterName"),l=t.hasOwnProperty(d)?t[d]:null;if(a.parent().is(".siteorigin-widget-section")){var g=o.data("element-name");g=g.replace(/\[#.*?#\]/g,"");for(var f=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(g)[1].split("]["),p=f.length?t:null;f.length;){var c=f.shift();p=p.hasOwnProperty(c)?p[c]:p}l=p}if(l&&Array.isArray(l)){var u=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),w=l.length,m=u.length;if(w>m)for(var v=0;v<w-m;v++)o.find("> .siteorigin-widget-field-repeater-add").trigger("click");else if(!r&&w<m)for(var h=w;h<m;h++){e(u.eq(h)).find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}u=o.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var b=0;b<u.length;b++)u.eq(b).find("> .siteorigin-widget-field-repeater-item-form"),s(u.eq(b).find("> .siteorigin-widget-field-repeater-item-form"),l[b])}})),--a):--a};s(i,t),i.find("*[name]").each((function(){var i=e(this),a=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(null==a)return!0;var s=(a=a[1]).split("][");s=s.map((function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e}));for(var o,d=t,l=0;l<s.length;l++){if(!d.hasOwnProperty(s[l])){if(r)return!0;break}l===s.length-1?o=d[s[l]]:d=d[s[l]]}if("checkbox"===i.attr("type"))i.prop("checked",o);else if("radio"===i.attr("type"))i.prop("checked",o===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var g=null;"undefined"!=typeof tinyMCE&&(g=tinyMCE.get(i.attr("id"))),null!==g&&"function"==typeof g.setContent&&!g.isHidden()&&i.parent().is(":visible")?g.initialized?g.setContent(o):g.on("init",(function(){g.setContent(o)})):i.val(o)}else if(i.is(".panels-data")){i.val(o);var f=i.data("builder");f&&f.setDataField(i)}else i.val(o);n&&(i.trigger("change"),this.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0})))}))},sowbForms.displayNotice=function(i,t,r,n,a){var s=e('<div class="siteorigin-widget-form-notification"></div>');t&&s.append("<span>"+t+"</span>"),n&&n.length&&n.forEach((function(i){var t="";i.classes&&i.classes.length&&(t=" "+i.classes.join(" "));var r=e('<a class="button button-small'+t+'" tabindex="0">'+i.label+"</a>");i.url&&r.attr("href",i.url),i.callback&&r.on("click keyup",(function(e){("keyup"!=e.type||sowbForms.isEnter(e))&&i.callback(s)})),s.append(r)})),r&&s.append("<div><small>"+r+"</small></div>"),a?a.before(s):i.prepend(s)},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",(function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout((function(){i.sowSetupForm()}),200)}));var i=e("body");i.hasClass("wp-customizer")&&e(document).on("widget-added",(function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()})),i.hasClass("block-editor-page")&&e(document).on("panels_setup_preview",(function(){window.hasOwnProperty("sowb")&&e(sowb).trigger("setup_widgets",{preview:!0})})),e(document).on("open_dialog",(function(e,i){i.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")&&i.$el.find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")})),e((function(){e(document).trigger("sowadminloaded")}))}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$").exec(e);if(null===t)return!1;var r="",n="default";return void 0!==t[3]?(n=t[1],r=t[3]):r=t[1],{match:t[4].trim(),group:n,state:r}},_checker:function(e,i,t,r){var n,a={};void 0===i.length&&(i=[i]);for(var s=0;s<i.length;s++)!1!==(n=sowEmitters._match(i[s],t))&&("_true"===n.match||r(e,i,n.match))&&(a[n.group]=n.state);return a},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",(function(val,args,match){return eval(match)}))},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",(function(e,i,t){return-1!==t.split(",").map((function(e){return e.trim()})).indexOf(e)}))}};window.sowbForms=sowbForms;
|
base/siteorigin-widget.class.php
CHANGED
@@ -666,7 +666,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
|
|
666 |
|
667 |
<div class="so-widgets-toolbar">
|
668 |
<h3><?php _e( 'Widget Preview', 'so-widgets-bundle' ) ?></h3>
|
669 |
-
<div class="close"><span class="dashicons dashicons-arrow-left-alt2"></span></div>
|
670 |
</div>
|
671 |
|
672 |
<div class="so-widgets-dialog-frame">
|
666 |
|
667 |
<div class="so-widgets-toolbar">
|
668 |
<h3><?php _e( 'Widget Preview', 'so-widgets-bundle' ) ?></h3>
|
669 |
+
<div class="close" tabindex="0"><span class="dashicons dashicons-arrow-left-alt2"></span></div>
|
670 |
</div>
|
671 |
|
672 |
<div class="so-widgets-dialog-frame">
|
compat/block-editor/widget-block.js
CHANGED
@@ -44,7 +44,10 @@
|
|
44 |
},
|
45 |
widgetData: {
|
46 |
type: 'object',
|
47 |
-
}
|
|
|
|
|
|
|
48 |
},
|
49 |
|
50 |
edit: withState( {
|
@@ -217,6 +220,7 @@
|
|
217 |
props.attributes.widgetClass &&
|
218 |
props.attributes.widgetData;
|
219 |
if ( loadWidgetPreview ) {
|
|
|
220 |
jQuery.post( {
|
221 |
url: sowbBlockEditorAdmin.restUrl + 'sowb/v1/widgets/previews',
|
222 |
beforeSend: function ( xhr ) {
|
@@ -232,6 +236,8 @@
|
|
232 |
widgetPreviewHtml: widgetPreview,
|
233 |
previewInitialized: false,
|
234 |
} );
|
|
|
|
|
235 |
} )
|
236 |
.fail( function ( response ) {
|
237 |
|
@@ -294,9 +300,13 @@
|
|
294 |
}
|
295 |
} ),
|
296 |
|
297 |
-
save: function () {
|
298 |
-
|
299 |
-
|
|
|
|
|
|
|
|
|
300 |
}
|
301 |
} );
|
302 |
} )( window.wp.editor, window.wp.blocks, window.wp.i18n, window.wp.element, window.wp.components, window.wp.compose, window.wp.blockEditor );
|
44 |
},
|
45 |
widgetData: {
|
46 |
type: 'object',
|
47 |
+
},
|
48 |
+
widgetHtml: {
|
49 |
+
type: 'string',
|
50 |
+
},
|
51 |
},
|
52 |
|
53 |
edit: withState( {
|
220 |
props.attributes.widgetClass &&
|
221 |
props.attributes.widgetData;
|
222 |
if ( loadWidgetPreview ) {
|
223 |
+
props.setAttributes( { widgetHtml: null } );
|
224 |
jQuery.post( {
|
225 |
url: sowbBlockEditorAdmin.restUrl + 'sowb/v1/widgets/previews',
|
226 |
beforeSend: function ( xhr ) {
|
236 |
widgetPreviewHtml: widgetPreview,
|
237 |
previewInitialized: false,
|
238 |
} );
|
239 |
+
|
240 |
+
props.setAttributes( { widgetHtml: widgetPreview } );
|
241 |
} )
|
242 |
.fail( function ( response ) {
|
243 |
|
300 |
}
|
301 |
} ),
|
302 |
|
303 |
+
save: function ( context ) {
|
304 |
+
if ( context.attributes == 'object' && context.attributes.hasOwnProperty( 'widgetHtml' ) ) {
|
305 |
+
return React.createElement( wp.element.RawHTML, null, attributes.widgetHtml );
|
306 |
+
} else {
|
307 |
+
// Fallback to PHP Render.
|
308 |
+
return null;
|
309 |
+
}
|
310 |
}
|
311 |
} );
|
312 |
} )( window.wp.editor, window.wp.blocks, window.wp.i18n, window.wp.element, window.wp.components, window.wp.compose, window.wp.blockEditor );
|
compat/block-editor/widget-block.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e,t,i,o,
|
1 |
+
!function(e,t,i,n,o,s,d){var r=n.createElement,a=t.registerBlockType,l=d.BlockControls,w=o.SelectControl,g=s.withState,c=o.Toolbar,u=o.ToolbarButton,m=o.Placeholder,b=o.Spinner,p=i.__;a("sowb/widget-block",{title:p("SiteOrigin Widget","so-widgets-bundle"),description:p("Select a SiteOrigin widget from the dropdown.","so-widgets-bundle"),icon:function(){return r("span",{className:"widget-icon so-widget-icon so-block-editor-icon"})},category:"widgets",keywords:[sowbBlockEditorAdmin.widgets.reduce((function(e,t){return e.length>0&&(e+=","),e+t.name}),"")],supports:{html:!1},attributes:{widgetClass:{type:"string"},widgetData:{type:"object"},widgetHtml:{type:"string"}},edit:g({editing:!1,formInitialized:!1,previewInitialized:!1,widgetFormHtml:"",widgetSettingsChanged:!1,widgetPreviewHtml:""})((function(e){function t(){e.setState({editing:!1,previewInitialized:!1})}if(!e.editing&&e.attributes.widgetClass&&e.attributes.widgetData){var i=!e.loadingWidgets&&!e.editing&&!e.widgetPreviewHtml&&e.attributes.widgetClass&&e.attributes.widgetData;i&&(e.setAttributes({widgetHtml:null}),jQuery.post({url:sowbBlockEditorAdmin.restUrl+"sowb/v1/widgets/previews",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbBlockEditorAdmin.nonce)},data:{widgetClass:e.attributes.widgetClass,widgetData:e.attributes.widgetData||{}}}).done((function(t){e.setState({widgetPreviewHtml:t,previewInitialized:!1}),e.setAttributes({widgetHtml:t})})).fail((function(t){var i="";t.hasOwnProperty("responseJSON")?i=t.responseJSON.message:t.hasOwnProperty("responseText")&&(i=t.responseText),e.setState({widgetPreviewHtml:"<div>"+i+"</div>"})})));var n=e.widgetPreviewHtml?e.widgetPreviewHtml:"";return[r(l,{key:"controls"},r(c,{label:p("Preview widget.","so-widgets-bundle")},r(u,{className:"components-icon-button components-toolbar__control",label:p("Edit widget.","so-widgets-bundle"),onClick:function(){e.setState({editing:!0,formInitialized:!1})},icon:"edit"}))),r("div",{key:"preview",className:"so-widget-preview-container"},i?r("div",{className:"so-widgets-spinner-container"},r("span",null,r(b))):r("div",{dangerouslySetInnerHTML:{__html:n},ref:function(){e.previewInitialized||(jQuery(window.sowb).trigger("setup_widgets",{preview:!0}),e.setState({previewInitialized:!0}))}}))]}var o=[];sowbBlockEditorAdmin.widgets&&(o=sowbBlockEditorAdmin.widgets.map((function(e){return{value:e.class,label:e.name}}))).unshift({value:"",label:p("Select widget type","so-widgets-bundle")});var s=e.attributes.widgetClass&&!e.widgetFormHtml;s&&jQuery.post({url:sowbBlockEditorAdmin.restUrl+"sowb/v1/widgets/forms",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",sowbBlockEditorAdmin.nonce)},data:{widgetClass:e.attributes.widgetClass,widgetData:e.attributes.widgetData}}).done((function(t){e.setState({widgetFormHtml:t})})).fail((function(t){var i="";t.hasOwnProperty("responseJSON")?i=t.responseJSON.message:t.hasOwnProperty("responseText")&&(i=t.responseText),e.setState({widgetFormHtml:"<div>"+i+"</div>"})}));var d=e.widgetFormHtml?e.widgetFormHtml:"";return[!!d&&r(l,{key:"controls"},r(c,{label:p("Preview widget.","so-widgets-bundle")},r(u,{className:"components-icon-button components-toolbar__control",label:p("Preview widget.","so-widgets-bundle"),onClick:t,icon:"visibility"}))),r(m,{key:"placeholder",className:"so-widget-placeholder",label:p("SiteOrigin Widget","so-widgets-bundle"),instructions:p("Select the type of widget you want to use:","so-widgets-bundle")},e.loadingWidgets||s?r(b):r("div",{className:"so-widget-block-container"},r(w,{options:o,value:e.attributes.widgetClass,onChange:function(t){if(""!==t){if(e.widgetSettingsChanged&&!confirm(sowbBlockEditorAdmin.confirmChangeWidget))return!1;e.setAttributes({widgetClass:t,widgetData:null}),e.setState({editing:!0,widgetFormHtml:null,formInitialized:!1,widgetSettingsChanged:!1,widgetPreviewHtml:null,previewInitialized:!1})}}}),r("div",{className:"so-widget-block-form-container",dangerouslySetInnerHTML:{__html:d},ref:function(i){var n=jQuery(i).find(".siteorigin-widget-form-main");n.length>0&&!e.formInitialized&&(n.siblings(".siteorigin-widget-preview").find("> a").on("click",(function(e){e.stopImmediatePropagation(),t()})),n.data("backupDisabled",!0),n.sowSetupForm(),e.attributes.widgetData?sowbForms.setWidgetFormValues(n,e.attributes.widgetData):e.setAttributes({widgetData:sowbForms.getWidgetFormValues(n)}),n.on("change",(function(){e.setAttributes({widgetData:sowbForms.getWidgetFormValues(n)}),e.setState({widgetSettingsChanged:!0,widgetPreviewHtml:null,previewInitialized:!1})})),e.setState({formInitialized:!0}))}})))]})),save:function(e){return"object"==e.attributes&&e.attributes.hasOwnProperty("widgetHtml")?React.createElement(wp.element.RawHTML,null,attributes.widgetHtml):null}})}(window.wp.editor,window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.compose,window.wp.blockEditor);
|
compat/block-editor/widget-block.php
CHANGED
@@ -119,14 +119,22 @@ class SiteOrigin_Widgets_Bundle_Widget_Block {
|
|
119 |
$GLOBALS['SITEORIGIN_WIDGET_BLOCK_RENDER'] = true;
|
120 |
add_filter( 'siteorigin_widgets_wrapper_classes_' . $widget->id_base, $add_custom_class_name );
|
121 |
ob_start();
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
$rendered_widget = ob_get_clean();
|
131 |
remove_filter( 'siteorigin_widgets_wrapper_classes_' . $widget->id_base, $add_custom_class_name );
|
132 |
unset( $GLOBALS['SITEORIGIN_WIDGET_BLOCK_RENDER'] );
|
119 |
$GLOBALS['SITEORIGIN_WIDGET_BLOCK_RENDER'] = true;
|
120 |
add_filter( 'siteorigin_widgets_wrapper_classes_' . $widget->id_base, $add_custom_class_name );
|
121 |
ob_start();
|
122 |
+
|
123 |
+
if ( empty( $attributes['widgetHtml'] ) ) {
|
124 |
+
/* @var $widget SiteOrigin_Widget */
|
125 |
+
$instance = $widget->update( $instance, $instance );
|
126 |
+
$widget->widget( array(
|
127 |
+
'before_widget' => '',
|
128 |
+
'after_widget' => '',
|
129 |
+
'before_title' => '<h3 class="widget-title">',
|
130 |
+
'after_title' => '</h3>',
|
131 |
+
), $instance );
|
132 |
+
} else {
|
133 |
+
$widget->generate_and_enqueue_instance_styles( $instance );
|
134 |
+
$widget->enqueue_frontend_scripts( $instance );
|
135 |
+
echo $attributes['widgetHtml'];
|
136 |
+
}
|
137 |
+
|
138 |
$rendered_widget = ob_get_clean();
|
139 |
remove_filter( 'siteorigin_widgets_wrapper_classes_' . $widget->id_base, $add_custom_class_name );
|
140 |
unset( $GLOBALS['SITEORIGIN_WIDGET_BLOCK_RENDER'] );
|
icons/fontawesome/filter.php
CHANGED
@@ -11,7 +11,6 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
11 |
'address-card' => array( 'unicode' => '', 'styles' => array( 'sow-fas', 'sow-far' ), ),
|
12 |
'adjust' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
13 |
'adn' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
14 |
-
'adobe' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
15 |
'adversal' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
16 |
'affiliatetheme' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
17 |
'air-freshener' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
@@ -275,6 +274,7 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
275 |
'cloud-sun' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
276 |
'cloud-sun-rain' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
277 |
'cloud-upload-alt' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
|
|
278 |
'cloudscale' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
279 |
'cloudsmith' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
280 |
'cloudversify' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
@@ -606,6 +606,7 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
606 |
'grip-vertical' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
607 |
'gripfire' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
608 |
'grunt' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
|
|
609 |
'guitar' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
610 |
'gulp' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
611 |
'h-square' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
@@ -664,6 +665,7 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
664 |
'hips' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
665 |
'hire-a-helper' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
666 |
'history' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
|
|
667 |
'hockey-puck' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
668 |
'holly-berry' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
669 |
'home' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
@@ -707,8 +709,10 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
707 |
'infinity' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
708 |
'info' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
709 |
'info-circle' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
|
|
710 |
'instagram' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
711 |
'instagram-square' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
|
|
712 |
'intercom' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
713 |
'internet-explorer' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
714 |
'invision' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
@@ -882,6 +886,7 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
882 |
'nutritionix' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
883 |
'object-group' => array( 'unicode' => '', 'styles' => array( 'sow-fas', 'sow-far' ), ),
|
884 |
'object-ungroup' => array( 'unicode' => '', 'styles' => array( 'sow-fas', 'sow-far' ), ),
|
|
|
885 |
'odnoklassniki' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
886 |
'odnoklassniki-square' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
887 |
'oil-can' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
@@ -928,6 +933,7 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
928 |
'people-arrows' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
929 |
'people-carry' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
930 |
'pepper-hot' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
|
|
931 |
'percent' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
932 |
'percentage' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
933 |
'periscope' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
@@ -1318,6 +1324,7 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
1318 |
'umbraco' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1319 |
'umbrella' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1320 |
'umbrella-beach' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
|
|
1321 |
'underline' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1322 |
'undo' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1323 |
'undo-alt' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
@@ -1369,6 +1376,8 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
1369 |
'venus' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1370 |
'venus-double' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1371 |
'venus-mars' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
|
|
|
|
1372 |
'viacoin' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1373 |
'viadeo' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1374 |
'viadeo-square' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
@@ -1399,6 +1408,7 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
1399 |
'walking' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1400 |
'wallet' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1401 |
'warehouse' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
|
|
1402 |
'water' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1403 |
'wave-square' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1404 |
'waze' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
@@ -1424,6 +1434,7 @@ function siteorigin_widgets_icons_fontawesome_filter( $icons ){
|
|
1424 |
'wine-glass-alt' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1425 |
'wix' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1426 |
'wizards-of-the-coast' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
|
|
1427 |
'wolf-pack-battalion' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1428 |
'won-sign' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1429 |
'wordpress' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
11 |
'address-card' => array( 'unicode' => '', 'styles' => array( 'sow-fas', 'sow-far' ), ),
|
12 |
'adjust' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
13 |
'adn' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
|
|
14 |
'adversal' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
15 |
'affiliatetheme' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
16 |
'air-freshener' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
274 |
'cloud-sun' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
275 |
'cloud-sun-rain' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
276 |
'cloud-upload-alt' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
277 |
+
'cloudflare' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
278 |
'cloudscale' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
279 |
'cloudsmith' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
280 |
'cloudversify' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
606 |
'grip-vertical' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
607 |
'gripfire' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
608 |
'grunt' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
609 |
+
'guilded' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
610 |
'guitar' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
611 |
'gulp' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
612 |
'h-square' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
665 |
'hips' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
666 |
'hire-a-helper' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
667 |
'history' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
668 |
+
'hive' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
669 |
'hockey-puck' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
670 |
'holly-berry' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
671 |
'home' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
709 |
'infinity' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
710 |
'info' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
711 |
'info-circle' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
712 |
+
'innosoft' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
713 |
'instagram' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
714 |
'instagram-square' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
715 |
+
'instalod' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
716 |
'intercom' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
717 |
'internet-explorer' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
718 |
'invision' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
886 |
'nutritionix' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
887 |
'object-group' => array( 'unicode' => '', 'styles' => array( 'sow-fas', 'sow-far' ), ),
|
888 |
'object-ungroup' => array( 'unicode' => '', 'styles' => array( 'sow-fas', 'sow-far' ), ),
|
889 |
+
'octopus-deploy' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
890 |
'odnoklassniki' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
891 |
'odnoklassniki-square' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
892 |
'oil-can' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
933 |
'people-arrows' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
934 |
'people-carry' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
935 |
'pepper-hot' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
936 |
+
'perbyte' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
937 |
'percent' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
938 |
'percentage' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
939 |
'periscope' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1324 |
'umbraco' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1325 |
'umbrella' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1326 |
'umbrella-beach' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1327 |
+
'uncharted' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1328 |
'underline' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1329 |
'undo' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1330 |
'undo-alt' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1376 |
'venus' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1377 |
'venus-double' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1378 |
'venus-mars' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1379 |
+
'vest' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1380 |
+
'vest-patches' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1381 |
'viacoin' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1382 |
'viadeo' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1383 |
'viadeo-square' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1408 |
'walking' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1409 |
'wallet' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1410 |
'warehouse' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1411 |
+
'watchman-monitoring' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1412 |
'water' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1413 |
'wave-square' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1414 |
'waze' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1434 |
'wine-glass-alt' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1435 |
'wix' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1436 |
'wizards-of-the-coast' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1437 |
+
'wodu' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1438 |
'wolf-pack-battalion' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
1439 |
'won-sign' => array( 'unicode' => '', 'styles' => array( 'sow-fas' ), ),
|
1440 |
'wordpress' => array( 'unicode' => '', 'styles' => array( 'sow-fab' ), ),
|
icons/fontawesome/style.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*!
|
2 |
-
* Font Awesome Free 5.
|
3 |
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
4 |
*/
|
5 |
|
1 |
/*!
|
2 |
+
* Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
|
3 |
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
4 |
*/
|
5 |
|
icons/fontawesome/webfonts/fa-brands-400.eot
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-brands-400.svg
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?xml version="1.0" standalone="no"?>
|
2 |
-
<!--
|
3 |
-
Font Awesome Free 5.14.0 by @fontawesome - https://fontawesome.com
|
4 |
-
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
5 |
-
-->
|
6 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
7 |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
|
8 |
<metadata>
|
9 |
-
Created by FontForge 20200314 at
|
10 |
By Robert Madole
|
11 |
Copyright (c) Font Awesome
|
12 |
</metadata>
|
13 |
-
|
14 |
<font id="FontAwesome5Brands-Regular" horiz-adv-x="448" >
|
15 |
<font-face
|
16 |
font-family="Font Awesome 5 Brands Regular"
|
@@ -160,6 +156,79 @@ c-0.00292969 -0.337891 -0.00488281 -0.676758 -0.00488281 -1.01562c0 -7.25977 0.6
|
|
160 |
c0.00878906 0 0.140625 -0.0732422 0.149414 -0.0732422v-87.3799z" />
|
161 |
<glyph glyph-name="unsplash" unicode=""
|
162 |
d="M448 217.83v-249.83h-448v249.83h141.13v-124.92h165.74v124.92h141.13zM306.87 416v-124.91h-165.74v124.91h165.74z" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
<glyph glyph-name="twitter-square" unicode=""
|
164 |
d="M400 416c26.5 0 48 -21.5 48 -48v-352c0 -26.5 -21.5 -48 -48 -48h-352c-26.5 0 -48 21.5 -48 48v352c0 26.5 21.5 48 48 48h352zM351.1 257.2c12.8008 9.2998 24 20.8994 32.9004 34c-11.7998 -5.10059 -24.5996 -8.7998 -37.7998 -10.2002
|
165 |
c13.5996 8.09961 23.8994 20.9004 28.7998 36.0996c-12.5996 -7.5 -26.7998 -13 -41.5996 -15.7998c-12 12.7998 -29 20.7002 -47.9004 20.7002c-40 0 -73.2998 -36.0996 -64 -80.5996c-54.4004 2.7998 -102.9 28.7998 -135.2 68.5996
|
@@ -1228,15 +1297,17 @@ c-4.2998 22.5 -31.4004 20.9004 -49 20.9004h-24.6006v-127.8zM382.5 157.4v36c0 17.
|
|
1228 |
c5.69922 -6.7998 11.8994 -9.7998 20.8994 -9.7998c19.7998 0 22.2002 15.2002 22.2002 30.9004zM265 218.1v-49.2998c0 -9.7002 1.90039 -18.7002 -10.2998 -18.3994v83.6992c11.8994 0 10.2998 -6.2998 10.2998 -16zM350.5 192v-32.7002
|
1229 |
c0 -5.39941 1.59961 -14.3994 -6.2002 -14.3994c-1.59961 0 -3 0.799805 -3.7998 2.39941c-2.2002 5.10059 -1.09961 44.1006 -1.09961 44.7002c0 3.7998 -1.10059 12.7002 4.89941 12.7002c7.2998 0 6.2002 -7.2998 6.2002 -12.7002z" />
|
1230 |
<glyph glyph-name="ravelry" unicode="" horiz-adv-x="512"
|
1231 |
-
d="
|
1232 |
-
c-
|
1233 |
-
c-
|
1234 |
-
|
1235 |
-
c-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
|
|
|
|
1240 |
<glyph glyph-name="sellcast" unicode=""
|
1241 |
d="M353.4 416c52.0996 0 94.6992 -42.5996 94.6992 -94.5996v-258.801c0 -52 -42.5996 -94.5996 -94.6992 -94.5996h-258.7c-52.1006 0 -94.7002 42.5996 -94.7002 94.7002v258.7c0 52 42.5996 94.5996 94.7002 94.5996h258.7zM303.4 99.5996
|
1242 |
c27.8994 48.2002 11.1992 110.5 -37.2002 138.5c-18.6006 10.8008 0.0996094 -0.0996094 -18.5 10.7002c-25 14.4004 -46.2002 -23.2998 -21.6006 -37.5c18 -10.2002 0.800781 -0.399414 18.6006 -10.5996c27.5996 -16 37.2002 -51.7998 21.2998 -79.4004
|
@@ -1917,13 +1988,21 @@ c-42.5 0 -47.3994 -14.8008 -47.3994 -25.9004c0 -13.4004 5.7998 -17.2998 63.2002
|
|
1917 |
<glyph glyph-name="npm" unicode="" horiz-adv-x="576"
|
1918 |
d="M288 160h-32v64h32v-64zM576 288v-192h-288v-32h-128v32h-160v192h576zM160 256h-128v-128h64v96h32v-96h32v128zM320 256h-128v-160h64v32h64v128zM544 256h-192v-128h64v96h32v-96h32v96h32v-96h32v128z" />
|
1919 |
<glyph glyph-name="ns8" unicode="" horiz-adv-x="640"
|
1920 |
-
d="
|
1921 |
-
c-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
c-
|
1926 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1927 |
<glyph glyph-name="nutritionix" unicode="" horiz-adv-x="400"
|
1928 |
d="M88 439.9c0 0 133.4 8.19922 121 -104.4c0 0 19.0996 74.9004 103 40.5996c0 0 -17.7002 -74 -88 -56c0 0 14.5996 54.6006 66.0996 56.6006c0 0 -39.8994 10.2998 -82.0996 -48.7998c0 0 -19.7998 94.5 -93.5996 99.6992c0 0 75.1992 -19.3994 77.5996 -107.5
|
1929 |
c0 -0.0996094 -106.4 -7 -104 119.801zM400 124.3c0 -48.5 -9.7002 -95.2998 -32 -132.3c-42.2002 -30.9004 -105 -48 -168 -48c-62.9004 0 -125.8 17.0996 -168 48c-22.2998 37 -32 83.7998 -32 132.3c0 48.4004 17.7002 94.7002 40 131.7
|
@@ -2025,13 +2104,16 @@ d="M281.2 169.8l-197.9 -57.2002l-28.5996 98.6006l188.2 54.0996c52.6992 15.2998 6
|
|
2025 |
c-46 0 -89.5 12.7002 -126.3 34.7002l-23 80.2002l286.8 -37.3008l48.0996 13.3008l-9.69922 34.1992l-220.4 27.1006l92.5996 26.5996c30.2002 8.7002 42 15.7998 61.4004 33.2002c24.5 23 31.7002 45.5 23.5 73.5996l-10.7002 37.8008
|
2026 |
c-8.7002 30.1992 -25.0996 49.0996 -61.3994 55.1992c-25.1006 3.5 -44.5 2 -79.3008 -8.19922l-221.899 -63.9004c26 108.8 124.2 189.5 241.3 189.5zM38.2998 59.4004c-24 38.3994 -38.2998 83.2998 -38.2998 131.8z" />
|
2027 |
<glyph glyph-name="rocketchat" unicode="" horiz-adv-x="576"
|
2028 |
-
d="
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
c-
|
2033 |
-
c-
|
2034 |
-
|
|
|
|
|
|
|
2035 |
<glyph glyph-name="rockrms" unicode="" horiz-adv-x="496"
|
2036 |
d="M248 440c137 0 248 -111 248 -248s-111 -248 -248 -248s-248 111 -248 248s111 248 248 248zM405.4 20.5l-101.5 118.9s73.5996 0.199219 74.1992 0.199219c29.6006 -1.09961 46.6006 33.3008 27.6006 56.1006l-157.7 185.1c-13.2002 17.2998 -40.0996 18.4004 -54.5 0
|
2037 |
l-147.1 -172.5h90l84.2998 98.9004l84.5996 -99.2998h-75.2998c-30.5 0 -44.5 -35.7002 -26.5996 -56.1006l112 -131.3h90z" />
|
@@ -3286,8 +3368,6 @@ c0 -0.0498047 -0.00195312 -0.0986328 -0.00585938 -0.147461v-0.799805c0.00195312
|
|
3286 |
v-25.7998h16.1006c0.0380859 0.00195312 0.0742188 0.00488281 0.113281 0.00488281c1.04297 0 1.88965 -0.847656 1.88965 -1.89062c0 -0.0380859 -0.000976562 -0.0761719 -0.00292969 -0.114258v-0.800781
|
3287 |
c0.00195312 -0.0380859 0.00488281 -0.0742188 0.00488281 -0.113281c0 -1.04297 -0.847656 -1.88965 -1.89062 -1.88965c-0.0380859 0 -0.0761719 0.000976562 -0.114258 0.00292969h-16.1006v-26.6992h19.4004zM288.301 262.799l2.2998 -6.7998l7.10059 -0.0996094
|
3288 |
l-5.7002 -4.30078l2.09961 -6.7998l-5.7998 4.10059l-5.7998 -4.10059l2.09961 6.7998l-5.69922 4.30078l7.09961 0.0996094z" />
|
3289 |
-
<glyph glyph-name="adobe" unicode="" horiz-adv-x="512"
|
3290 |
-
d="M315.5 384h170.9v-384zM196.5 384l-170.9 -384v384h170.9zM256 241.9l107.5 -241.9h-73l-30.7002 76.7998h-78.7002z" />
|
3291 |
<glyph glyph-name="artstation" unicode="" horiz-adv-x="512"
|
3292 |
d="M2 70.5996h315.1l59.2002 -102.6h-285.399c-0.00488281 0 0.0205078 -0.0498047 0.015625 -0.0498047c-20.0742 0 -37.4736 11.5439 -45.916 28.3496zM501.8 98c19 -29.4004 -0.0996094 -55.9004 -2 -59.0996l-40.7002 -70.5l-257.3 447.6h88.4004
|
3293 |
c0.00390625 0 -0.0234375 0.0527344 -0.0195312 0.0527344c19.6797 0 36.79 -11.0879 45.4189 -27.3525zM275 143.5h-231l115.5 200z" />
|
1 |
<?xml version="1.0" standalone="no"?>
|
|
|
|
|
|
|
|
|
2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3 |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
|
4 |
<metadata>
|
5 |
+
Created by FontForge 20200314 at Mon Oct 5 09:49:14 2020
|
6 |
By Robert Madole
|
7 |
Copyright (c) Font Awesome
|
8 |
</metadata>
|
9 |
+
<!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><defs>
|
10 |
<font id="FontAwesome5Brands-Regular" horiz-adv-x="448" >
|
11 |
<font-face
|
12 |
font-family="Font Awesome 5 Brands Regular"
|
156 |
c0.00878906 0 0.140625 -0.0732422 0.149414 -0.0732422v-87.3799z" />
|
157 |
<glyph glyph-name="unsplash" unicode=""
|
158 |
d="M448 217.83v-249.83h-448v249.83h141.13v-124.92h165.74v124.92h141.13zM306.87 416v-124.91h-165.74v124.91h165.74z" />
|
159 |
+
<glyph glyph-name="cloudflare" unicode="" horiz-adv-x="640"
|
160 |
+
d="M407.906 128.087c12.1836 -0.574219 22.2178 -5.50977 28.2334 -13.9023c6.54883 -9.09961 8 -21.5 4.10059 -34.8994l-3.27344 -11.2656c-0.681641 -2.28125 -2.7793 -3.95508 -5.27051 -4c-0.0419922 -0.000976562 -0.0791016 -0.0195312 -0.12207 -0.0195312
|
161 |
+
l-426.101 0.0507812c-2.26172 0.00878906 -4.13379 1.69238 -4.44434 3.87109c-0.676758 4.58691 -1.02637 9.18457 -1.0293 13.958c0 52.3926 41.9238 95.0137 94.2002 96.5303c-1.37402 5.39062 -2.05469 10.9785 -2.05469 16.7939
|
162 |
+
c0 37.5967 30.5234 68.1201 68.1201 68.1201c15.3838 0 29.583 -5.11035 40.9912 -13.7246c20.542 59.582 77.085 102.308 143.607 102.308c72.1562 0 132.629 -50.417 148.085 -117.914c0.107422 -0.513672 0.164062 -1.03906 0.164062 -1.58398v-0.046875
|
163 |
+
c0 -0.0332031 -0.00292969 -0.0683594 -0.00292969 -0.101562c0 -0.998047 -0.18457 -1.9541 -0.521484 -2.83496l-13.2861 -34.542c-10.4756 -27.21 -40.3906 -49.5234 -68.0215 -50.7842l-232.94 -2.93555c-2.48145 -0.173828 -4.5625 -1.82227 -5.36035 -4.07617
|
164 |
+
c-0.178711 -0.493164 -0.275391 -1.03223 -0.275391 -1.58691c0 -0.945312 0.283203 -1.8252 0.768555 -2.55957c0.8125 -1.14258 2.13379 -1.89355 3.63281 -1.92676zM513.856 226.9c69.668 0 126.144 -56.2002 126.147 -125.533
|
165 |
+
c0 -0.0458984 -0.0175781 -0.0644531 -0.0175781 -0.110352c0 -11.7441 -1.62598 -23.1123 -4.66406 -33.8896c-0.571289 -1.94629 -2.37012 -3.37012 -4.5 -3.37012h-0.0390625h-175.91c-0.0478516 0 -0.0898438 0.0166016 -0.135742 0.0166016
|
166 |
+
c-1.44727 0.0595703 -2.60449 1.25391 -2.60449 2.71484c0 0.339844 0.0634766 0.666016 0.176758 0.96582l3.69531 9.60547c10.4766 27.21 40.3916 49.5146 68.1455 50.7842l51.125 2.93945c2.47559 0.179688 4.55078 1.82617 5.35059 4.07422
|
167 |
+
c0.177734 0.492188 0.274414 1.03027 0.274414 1.58301c0 0.957031 -0.291016 1.84766 -0.788086 2.58594c-0.785156 1.11035 -2.06152 1.84375 -3.51074 1.89453l-49.1992 2.93848c-12.1846 0.577148 -22.2188 5.5 -28.2383 13.9004
|
168 |
+
c-6.54883 9.10352 -8 21.4902 -4.09961 34.8896l9.07617 31.1934c0.447266 1.45508 1.75391 2.53613 3.32422 2.65332c2.12012 0.101562 4.25 0.164062 6.3916 0.164062z" />
|
169 |
+
<glyph glyph-name="guilded" unicode=""
|
170 |
+
d="M443.427 384c0.00195312 -0.518555 0.0253906 -0.367188 0.0253906 -0.885742c0 -29.1934 -2.00293 -57.9229 -5.87891 -86.0576h-336.147s0.366211 -52.0498 27.0918 -105.883c27.458 -51.8174 65.3164 -85.1025 96.5488 -98.3623
|
171 |
+
c32.2695 15.082 63.4434 41.2695 80.4561 69.4824h-88.5898c-22.9229 18.998 -40.96 50.5146 -45.0996 86.9443h259.889c-12.8154 -58.5713 -40.0088 -111.838 -65.916 -145.762c-35.8154 -46.7773 -84.2695 -82.8105 -140.55 -103.477
|
172 |
+
c-1.25586 0 -113.21 33.8652 -177.267 161.642c-21.2266 42.2988 -43.418 119.099 -43.418 222.358h438.855z" />
|
173 |
+
<glyph glyph-name="hive" unicode="" horiz-adv-x="512"
|
174 |
+
d="M260.353 193.122c0.191406 -0.329102 0.300781 -0.716797 0.300781 -1.12402c0 -0.404297 -0.107422 -0.783203 -0.294922 -1.11133l-127.412 -221.777c-0.380859 -0.666992 -1.09473 -1.11621 -1.91602 -1.11621c-0.818359 0 -1.53223 0.445312 -1.91406 1.10645
|
175 |
+
l-128.816 221.778c-0.189453 0.328125 -0.297852 0.713867 -0.297852 1.12012s0.108398 0.787109 0.297852 1.11523l127.409 221.777c0.380859 0.666016 1.09473 1.11523 1.91602 1.11523c0.817383 0 1.53125 -0.445312 1.91309 -1.10547zM299.431 218.835l-110.624 193.824
|
176 |
+
c-0.189453 0.327148 -0.298828 0.709961 -0.298828 1.11523c0 1.21973 0.983398 2.21094 2.19922 2.22559h66.5078c0.81543 -0.00195312 1.52539 -0.447266 1.90039 -1.11133l110.625 -193.823c0.189453 -0.328125 0.298828 -0.709961 0.298828 -1.11523
|
177 |
+
c0 -1.21973 -0.983398 -2.21191 -2.19922 -2.22656h-66.5088c-0.81543 0.00292969 -1.52441 0.448242 -1.90039 1.11133zM511.7 193.114c0.1875 -0.328125 0.294922 -0.711914 0.294922 -1.11621c0 -0.405273 -0.107422 -0.78418 -0.294922 -1.1123l-126.808 -221.773
|
178 |
+
c-0.376953 -0.664062 -1.08887 -1.11035 -1.90527 -1.1123h-66.6006c-1.21875 0.0117188 -2.20312 1.00684 -2.20312 2.22852c0 0.404297 0.108398 0.78418 0.297852 1.11133l126.171 220.66l-126.168 220.66c-0.189453 0.327148 -0.298828 0.708984 -0.298828 1.11426
|
179 |
+
c0 1.2207 0.985352 2.21387 2.2041 2.22559h66.6006c0.818359 -0.000976562 1.53125 -0.447266 1.91016 -1.1123zM366.016 163.083c1.2168 -0.0136719 2.19922 -1.00879 2.19922 -2.22852c0 -0.405273 -0.108398 -0.785156 -0.297852 -1.1123l-108.8 -190.631
|
180 |
+
c-0.375 -0.664062 -1.08496 -1.10938 -1.90039 -1.11133h-66.5088c-1.21582 0.0146484 -2.19824 1.00879 -2.19824 2.22852c0 0.405273 0.108398 0.785156 0.297852 1.1123l108.801 190.631c0.374023 0.664062 1.08398 1.10938 1.89941 1.11133h66.5078z" />
|
181 |
+
<glyph glyph-name="innosoft" unicode=""
|
182 |
+
d="M422.559 288.29l0.00292969 -190.955c0.0253906 -12.4102 -5.87793 -22.8965 -16.623 -29.5283l-164.527 -94.9951c-5.08008 -3.04102 -11.0938 -4.79004 -17.4404 -4.79004c-6.11523 0 -11.8545 1.62402 -16.8096 4.46387l-118.794 68.583l247.049 142.627v-56
|
183 |
+
l-150.051 -86.627l32.7227 -18.9004c1.74805 -0.97168 3.78613 -1.52441 5.92676 -1.52441c2.18457 0 4.23633 0.576172 6.01074 1.58691l138.111 79.7441c3.54883 2.08008 5.91992 5.92578 5.91992 10.332v0.0361328v138.281l-308.407 -178.066
|
184 |
+
c-3.94629 -2.25293 -8.57129 -3.54102 -13.4365 -3.54102c-4.83301 0 -9.37207 1.27051 -13.2998 3.49609c-8.39453 4.75586 -13.3037 13.293 -13.4736 23.4287v191.5c0.518555 12.7334 6.65527 23.0039 17.2891 29.124l164.601 95.0254
|
185 |
+
c11.5 5.98535 22.8076 5.85938 33.7998 -0.269531l118.513 -68.4072l-247.061 -142.637v56l150.062 86.6367l-32.6553 18.8525c-1.76367 0.998047 -3.82715 1.56738 -5.99609 1.56738c-2.15137 0 -4.17285 -0.55957 -5.92578 -1.54199l-138.076 -79.7129
|
186 |
+
c-3.60352 -2.04785 -6.02734 -5.90723 -6.04688 -10.3398v-138.387l308.539 178.142c3.88281 2.24414 8.44531 3.5293 13.25 3.5293c4.70801 0 9.13086 -1.23438 12.9609 -3.39648c8.16406 -4.63184 13.6914 -13.3291 13.8652 -23.3369z" />
|
187 |
+
<glyph glyph-name="instalod" unicode="" horiz-adv-x="512"
|
188 |
+
d="M153.384 -32l50.8447 146.789l298.325 57.4463l-115.44 -204.235h-233.729zM504.726 207.922l-144.495 -27.8223l-204.562 235.9h231.444zM124.386 399.191l101.241 -116.752l-102.391 -295.594l-115.962 205.154z" />
|
189 |
+
<glyph glyph-name="octopus-deploy" unicode="" horiz-adv-x="512"
|
190 |
+
d="M455.6 98.7998c12.4395 -10.5996 42.6348 -26.4775 42.5244 -45.2666c-0.15332 -24.6084 -48.4248 5.24121 -53.8184 9.51953c6.13965 -10.7275 66.998 -74.1787 28.2627 -78.6943c-35.6562 -4.1582 -67.1406 45.6416 -88.5615 67.0225
|
191 |
+
c-36 35.9082 -29.7373 -43.5332 -29.8994 -59.9443c-0.257812 -25.9082 -18.5586 -78.4209 -51.4121 -44.2207c-27.1387 28.2314 -16.873 73.2607 -35.7383 104.622c-20.6641 34.3535 -55.0361 -34.3535 -63.627 -46.9258
|
192 |
+
c-9.59668 -14.042 -57.6094 -82.041 -76.709 -45.8125c-15.499 29.4004 9.2793 75.5127 21.4629 102.103c-4.44336 -9.65723 -35.9297 -23.9414 -45.1299 -28.5879c-20.7871 -10.4971 -41.8867 -16.7256 -65.2646 -15.0449
|
193 |
+
c-27.8916 2.00098 -38.3789 11.6572 8.42773 41.8574c38.5615 24.8389 83.8613 67.4209 66.6621 117.582c-9.37305 27.3301 -22.3574 50.7568 -24.0898 80.2998c-0.209961 3.56152 -0.25 7.08008 -0.25 10.6924c0 22.0957 3.9707 43.2715 11.2373 62.8516
|
194 |
+
c34.5752 92.8066 137.363 136.747 230.253 108.848c86.0371 -25.8398 145.23 -125.74 109.575 -212.79c-20.5752 -50.2334 -29.7959 -89.0205 16.0947 -128.11z" />
|
195 |
+
<glyph glyph-name="perbyte" unicode=""
|
196 |
+
d="M305.314 163.422c15.9307 0.000976562 28.5732 -4.5 37.9277 -13.5059s14.0322 -20.7842 14.0322 -35.335c0 -14.8936 -4.58984 -26.9307 -13.7705 -36.1113c-9.17969 -9.17969 -21.9111 -13.7695 -38.1934 -13.7695h-58.7109v98.7217h58.7148zM149.435 319.301
|
197 |
+
c15.9346 0.00488281 28.5791 -4.49609 37.9316 -13.5039s14.0283 -20.7871 14.0283 -35.3379c0 -14.8896 -4.58984 -26.9258 -13.7695 -36.1084c-9.17969 -9.18164 -21.9102 -13.7725 -38.1904 -13.7725h-58.7109v98.7227h58.7109zM366.648 416.002
|
198 |
+
c22.4385 -0.0253906 41.5996 -7.98145 57.4854 -23.8672s23.8418 -35.0479 23.8672 -57.4854v-285.296c-0.0253906 -22.4375 -7.98145 -41.5996 -23.8672 -57.4854s-35.0479 -23.8418 -57.4854 -23.8672h-285.295c-22.4385 0.0253906 -41.6006 7.98145 -57.4863 23.8672
|
199 |
+
s-23.8418 35.0479 -23.8672 57.4863v285.296c0.0253906 22.4375 7.98145 41.5996 23.8672 57.4854s35.0479 23.8408 57.4863 23.8662h285.295zM430.282 49.3535l-0.000976562 285.296c-0.0195312 17.5518 -6.24219 32.54 -18.668 44.9658s-27.4141 18.6484 -44.9648 18.668
|
200 |
+
h-285.295c-17.5508 -0.0195312 -32.5391 -6.24219 -44.9648 -18.668s-18.6484 -27.4141 -18.668 -44.9658v-285.296c0.0195312 -17.5508 6.24219 -32.5391 18.668 -44.9648s27.4141 -18.6484 44.9648 -18.668h285.295c17.5518 0.0195312 32.54 6.24219 44.9658 18.668
|
201 |
+
s18.6484 27.4141 18.668 44.9648zM305.313 319.301c15.9307 0.00488281 28.5732 -4.49609 37.9277 -13.5039s14.0322 -20.7871 14.0322 -35.3379c0 -14.8896 -4.58984 -26.9258 -13.7705 -36.1084c-9.17969 -9.18164 -21.9111 -13.7725 -38.1934 -13.7725h-58.7109v98.7227
|
202 |
+
h58.7148z" />
|
203 |
+
<glyph glyph-name="uncharted" unicode=""
|
204 |
+
d="M171.73 215.187c-0.0605469 -0.00195312 -0.12207 -0.000976562 -0.183594 -0.000976562c-0.673828 0 -1.3125 0.148438 -1.88672 0.414062l-115.933 67.9004v-85.2891c-0.0830078 -2.71289 -1.16895 -5.18555 -2.89941 -7.03906
|
205 |
+
c-1.6748 -1.54297 -3.91113 -2.4873 -6.36621 -2.4873c-0.0859375 0 -0.172852 0.000976562 -0.258789 0.00390625c-0.146484 -0.0078125 -0.296875 -0.00585938 -0.444336 -0.00585938c-1.65332 0 -3.2002 0.455078 -4.52344 1.24707l-22.3584 12.835
|
206 |
+
c-2.9541 1.50684 -4.9707 4.57031 -4.9707 8.1123c0 0.0566406 0.000976562 0.112305 0.00195312 0.168945v115.107c0.118164 3.54102 2.08105 6.61523 4.96875 8.28027l100.2 57.9668c1.40625 0.787109 3.04688 1.23535 4.77148 1.23535s3.3457 -0.448242 4.75098 -1.23535
|
207 |
+
l22.3584 -12.8389c2.9541 -1.50586 4.96973 -4.56934 4.96973 -8.11035c0 -0.0566406 -0.000976562 -0.113281 -0.00195312 -0.169922c-0.117188 -3.54199 -2.08008 -6.61523 -4.96777 -8.28125l-74.5293 -43.4727l116.757 -68.3184
|
208 |
+
c1.16016 -0.680664 1.96191 -1.89941 2.07129 -3.31152c0 -1.65723 -0.414062 -3.31348 -1.65723 -4.1416c-7.34473 -6.5459 -12.6475 -15.3301 -14.8994 -25.2559c-0.810547 -1.94629 -2.72949 -3.31348 -4.96777 -3.31348h-0.00195312zM323.272 70.2695
|
209 |
+
c4.96777 0 9.52734 -4.55469 10.3506 -9.1084v-26.085c-0.117188 -3.54199 -2.08105 -6.61523 -4.96777 -8.28125l-100.2 -57.5527c-1.48633 -0.772461 -3.18359 -1.22363 -4.96875 -1.24219c-0.146484 -0.00683594 -0.296875 -0.00488281 -0.444336 -0.00488281
|
210 |
+
c-1.65332 0 -3.2002 0.455078 -4.52441 1.24707l-100.199 57.5527c-2.95508 1.50586 -4.9707 4.56934 -4.9707 8.11035c0 0.0576172 0 0.114258 0.000976562 0.170898v26.085c0.0585938 5.22852 4.29492 9.46484 9.52344 9.52246
|
211 |
+
c0.146484 0.0078125 0.296875 0.00585938 0.444336 0.00585938c1.65332 0 3.20117 -0.456055 4.52441 -1.24707l74.5293 -43.0615v133.323c0.0615234 2.62891 2.21387 4.74609 4.85742 4.74609c0.469727 0 0.922852 -0.0673828 1.35254 -0.191406
|
212 |
+
c4.39453 -1.18066 8.99414 -1.80664 13.7588 -1.80664c5.29102 0 10.4023 0.776367 15.2256 2.2207c3.31055 1.24512 6.21094 -1.65527 6.21094 -4.55469v-134.152l74.5273 43.0625c1.50684 0.730469 3.2002 1.17383 4.96973 1.24121zM286.007 370
|
213 |
+
c-12.6943 0 -23 10.3057 -23 23s10.3057 23 23 23s23 -10.3057 23 -23s-10.3057 -23 -23 -23zM349.634 380.086c12.6943 0 23 -10.3057 23 -23s-10.3057 -23 -23 -23c-12.6934 0 -23 10.3057 -23 23s10.3066 23 23 23zM412.816 296.4c-12.6943 0 -23 10.3057 -23 23
|
214 |
+
c0 12.6934 10.3057 23 23 23c12.6934 0 23 -10.3066 23 -23c0 -12.6943 -10.3066 -23 -23 -23zM349.634 305.6c12.6943 0 23 -10.3057 23 -23c0 -12.6934 -10.3057 -23 -23 -23c-12.6934 0 -23 10.3066 -23 23c0 12.6943 10.3066 23 23 23zM286.007 222.356
|
215 |
+
c-12.6943 0 -23 10.3018 -23 22.9951v0.00488281c0 12.6934 10.3057 23 23 23s23 -10.3066 23 -23c0 -12.6943 -10.3057 -23 -23 -23zM223.933 185.998c-12.6934 0 -23 10.3018 -23 22.9961v0.00390625c0 12.6943 10.3066 23 23 23c12.6943 0 23 -10.3057 23 -23
|
216 |
+
s-10.3057 -23 -23 -23zM412.816 268.356c12.6924 0 22.9971 -10.3086 23 -23c0 -12.6943 -10.3066 -23 -23 -23c-12.6943 0 -23 10.3057 -23 23c0 12.6934 10.3057 23 23 23zM412.816 196.084c12.6924 0 22.9971 -10.3076 23 -23c0 -12.6943 -10.3066 -23 -23 -23
|
217 |
+
c-12.6943 0 -23 10.3057 -23 23s10.3057 23 23 23z" />
|
218 |
+
<glyph glyph-name="watchman-monitoring" unicode="" horiz-adv-x="512"
|
219 |
+
d="M256 432c132.548 0 240 -107.452 240 -240s-107.452 -240 -240 -240s-240 107.452 -240 240s107.452 240 240 240zM121.69 18.8779l27.6846 204.861l-9.46777 7.39941c-2.98242 2.34082 -4.89062 5.9668 -4.89062 10.0479
|
220 |
+
c0 0.100586 0.000976562 0.201172 0.00292969 0.301758c0 7.04883 0.144531 19.5488 0.144531 19.5488l13.9434 2.0127l0.120117 10.9668l-102.899 -17.8945c-6.20508 -20.251 -9.58691 -41.7412 -9.58691 -64.0137v-0.108398c0 -70.3223 33.3145 -132.972 84.9492 -173.122
|
221 |
+
zM227.382 302.148l0.0400391 -3.61816l193.512 37.7002c-40.1152 46.0273 -99.1426 75.0244 -164.934 75.0244c-74.4863 0 -140.374 -37.3623 -180.018 -94.2998l73.5068 -19.1758l0.0478516 4.36914l-8.48145 7.61719s-6.93359 5.38086 0.144531 9.34473
|
222 |
+
c7.18652 4.02539 39.5283 34.5 39.5283 34.5c7.20312 7.34668 10.1123 5.47656 15.4609 0c0 0 32.3418 -30.4766 39.5293 -34.5c7.07715 -3.96387 0.143555 -9.34473 0.143555 -9.34473zM261.445 -27.1211c118.386 2.90918 213.813 100.047 213.813 219.121
|
223 |
+
c-0.0107422 17.2881 -2.04297 33.9951 -5.85059 50.1299l-241.711 31.3916l0.116211 -10.4746l13.9424 -2.0127s0.144531 -12.5049 0.144531 -19.5488c0.00195312 -0.100586 0.0126953 -0.19043 0.0126953 -0.290039c0 -4.08203 -1.91797 -7.71973 -4.90137 -10.0596
|
224 |
+
l-9.4668 -7.39941z" />
|
225 |
+
<glyph glyph-name="wodu" unicode="" horiz-adv-x="640"
|
226 |
+
d="M178.414 108.294h-37.3145l-28.9336 116.231h-0.477539l-28.4609 -116.231h-38.0273l-45.2002 170.76h37.5479l27.0264 -116.23h0.477539l29.6553 116.23h35.1572l29.1777 -117.667h0.479492l27.9785 117.667h36.8311zM271.4 235.287
|
227 |
+
c38.9834 0 64.0996 -25.8281 64.0996 -65.291c0 -39.2217 -25.1113 -65.0498 -64.0996 -65.0498c-38.7432 0 -63.8555 25.8281 -63.8555 65.0498c0.00195312 39.4629 25.1143 65.291 63.8555 65.291zM271.4 130.534c23.1992 0 30.1328 19.8516 30.1328 39.4619
|
228 |
+
c0 19.8516 -6.93457 39.7002 -30.1328 39.7002c-27.7002 0 -29.8945 -19.8506 -29.8945 -39.7002c0.00195312 -19.6104 6.9375 -39.4619 29.8945 -39.4619zM435.084 124.078h-0.477539c-7.89355 -13.3926 -21.7656 -19.1318 -37.5488 -19.1318
|
229 |
+
c-37.3096 0 -55.4844 32.0449 -55.4844 66.2461c0 33.2422 18.415 64.0947 54.7666 64.0947c14.5889 0 28.9385 -6.21777 36.8311 -18.416h0.240234v62.1826h33.96v-170.76h-32.2871v15.7842zM405.428 209.7c-22.2393 0 -29.8936 -19.1338 -29.8936 -39.4629
|
230 |
+
c0 -19.3711 8.84766 -39.7002 29.8936 -39.7002c22.4824 0 29.1787 19.6133 29.1787 39.9395c0 20.0879 -7.1748 39.2236 -29.1787 39.2236zM592.96 108.294h-32.2871v17.2188h-0.717773c-8.60938 -13.8701 -23.4365 -20.5664 -37.7861 -20.5664
|
231 |
+
c-36.1133 0 -45.2002 20.3281 -45.2002 50.9404v76.0527h33.959v-69.8398c0 -20.3281 5.97949 -30.3721 21.7656 -30.3721c18.415 0 26.3057 10.2832 26.3057 35.3936v64.8184h33.9609v-123.646zM602.453 145.124h37.5469v-36.8301h-37.5469v36.8301z" />
|
232 |
<glyph glyph-name="twitter-square" unicode=""
|
233 |
d="M400 416c26.5 0 48 -21.5 48 -48v-352c0 -26.5 -21.5 -48 -48 -48h-352c-26.5 0 -48 21.5 -48 48v352c0 26.5 21.5 48 48 48h352zM351.1 257.2c12.8008 9.2998 24 20.8994 32.9004 34c-11.7998 -5.10059 -24.5996 -8.7998 -37.7998 -10.2002
|
234 |
c13.5996 8.09961 23.8994 20.9004 28.7998 36.0996c-12.5996 -7.5 -26.7998 -13 -41.5996 -15.7998c-12 12.7998 -29 20.7002 -47.9004 20.7002c-40 0 -73.2998 -36.0996 -64 -80.5996c-54.4004 2.7998 -102.9 28.7998 -135.2 68.5996
|
1297 |
c5.69922 -6.7998 11.8994 -9.7998 20.8994 -9.7998c19.7998 0 22.2002 15.2002 22.2002 30.9004zM265 218.1v-49.2998c0 -9.7002 1.90039 -18.7002 -10.2998 -18.3994v83.6992c11.8994 0 10.2998 -6.2998 10.2998 -16zM350.5 192v-32.7002
|
1298 |
c0 -5.39941 1.59961 -14.3994 -6.2002 -14.3994c-1.59961 0 -3 0.799805 -3.7998 2.39941c-2.2002 5.10059 -1.09961 44.1006 -1.09961 44.7002c0 3.7998 -1.10059 12.7002 4.89941 12.7002c7.2998 0 6.2002 -7.2998 6.2002 -12.7002z" />
|
1299 |
<glyph glyph-name="ravelry" unicode="" horiz-adv-x="512"
|
1300 |
+
d="M498.252 213.777c0.129883 -0.613281 0.322266 -1.21777 0.561523 -1.78223v-37.0557c-0.194336 -0.300781 -0.516602 -0.583008 -0.552734 -0.900391c-0.619141 -5.36426 -0.837891 -10.8076 -1.87012 -16.0869c-2.06934 -10.6074 -4.15723 -21.2393 -7.0166 -31.6523
|
1301 |
+
c-4.94531 -18.0205 -12.7578 -34.8809 -22.2998 -50.9258c-8.94336 -15.126 -19.4043 -28.9668 -31.4268 -41.6387c-3.74609 -3.92188 -7.54688 -7.80078 -11.5107 -11.5c-5.31152 -4.95703 -10.5146 -10.1094 -16.2998 -14.457
|
1302 |
+
c-9.3418 -7.02344 -18.9883 -13.6533 -28.7373 -20.1006c-15.083 -9.81543 -31.6211 -17.9053 -48.9512 -23.8174c-15.3828 -5.38281 -31.1533 -9.38574 -47.4893 -10.7178c-2.52734 -0.206055 -5.02051 -0.753906 -7.52734 -1.14258h-32.2891
|
1303 |
+
c-0.358398 0.245117 -0.762695 0.436523 -1.18945 0.55957c-6.1377 0.620117 -12.3418 0.863281 -18.4121 1.87305c-13.8301 2.22949 -27.5977 5.58398 -40.6416 9.83496c-19.5498 6.43359 -38.4463 15.0176 -55.8994 25.2773
|
1304 |
+
c-15.0488 8.79004 -28.9365 18.9688 -41.7871 30.5859c-9.6875 8.70605 -18.3936 18.0898 -26.3584 28.416c-9.38184 12.1963 -17.4385 25.4316 -24 39.5283c-7.5918 16.6592 -13.3467 34.7812 -16.7295 53.2998c-2.35547 13.1611 -3.85059 26.5459 -4.4248 40.2402
|
1305 |
+
c-0.136719 3.0332 -0.209961 5.74121 -0.209961 8.80859c0 9.05566 0.599609 17.9717 1.76172 26.7119c1.52637 11.874 4.15625 23.6367 7.69043 34.7588c5.05762 15.7021 12.0283 30.7871 20.4941 44.6006c9.58203 15.9961 20.7793 30.6025 33.6484 43.9502
|
1306 |
+
c9.55469 9.83496 19.7539 19.0605 29.9268 28.2676c5.70605 5.1582 11.8066 9.9082 17.9736 14.5186c12.0029 9.04004 24.6963 17.1025 38.0801 24.1572c12.5137 6.63281 25.9795 12.1963 39.7686 16.3555c10.9453 3.41016 22.5254 5.84375 34.2559 7.09961
|
1307 |
+
c2.42773 0.225586 4.82617 0.761719 7.23633 1.15039c10.7627 -0.00195312 21.5254 0 32.2881 0.00585938c0.299805 -0.195312 0.583984 -0.516602 0.899414 -0.552734c6.87793 -0.81543 13.8467 -1.16797 20.627 -2.48242
|
1308 |
+
c11.2432 -2.18359 22.4971 -4.51465 33.5156 -7.61523c19.999 -5.78125 39.2266 -14.2031 56.7227 -24.668c17.2832 -10.0947 32.9639 -22.1357 47.1133 -36.1152c6.71973 -6.90527 12.9209 -14.0508 18.8174 -21.6895c13.4639 -16.959 24.0283 -36.4561 30.874 -57.5
|
1309 |
+
c3.88867 -11.8086 7.16211 -24.2148 9.62207 -36.5996c2.0459 -10.1748 2.53809 -20.6602 3.74609 -31zM337.135 214.927l0.00488281 67.2695c-35.2686 0 -53.1152 -9.36719 -62.04 -36.1895v31.9316h-73.5176v-190.738h73.5127v93.667
|
1310 |
+
c0 22.1396 6.37012 37.04 33.5703 37.04c11.8984 0 28.4697 -2.98047 28.4697 -2.98047z" />
|
1311 |
<glyph glyph-name="sellcast" unicode=""
|
1312 |
d="M353.4 416c52.0996 0 94.6992 -42.5996 94.6992 -94.5996v-258.801c0 -52 -42.5996 -94.5996 -94.6992 -94.5996h-258.7c-52.1006 0 -94.7002 42.5996 -94.7002 94.7002v258.7c0 52 42.5996 94.5996 94.7002 94.5996h258.7zM303.4 99.5996
|
1313 |
c27.8994 48.2002 11.1992 110.5 -37.2002 138.5c-18.6006 10.8008 0.0996094 -0.0996094 -18.5 10.7002c-25 14.4004 -46.2002 -23.2998 -21.6006 -37.5c18 -10.2002 0.800781 -0.399414 18.6006 -10.5996c27.5996 -16 37.2002 -51.7998 21.2998 -79.4004
|
1988 |
<glyph glyph-name="npm" unicode="" horiz-adv-x="576"
|
1989 |
d="M288 160h-32v64h32v-64zM576 288v-192h-288v-32h-128v32h-160v192h576zM160 256h-128v-128h64v96h32v-96h32v128zM320 256h-128v-160h64v32h64v128zM544 256h-192v-128h64v96h32v-96h32v96h32v-96h32v128z" />
|
1990 |
<glyph glyph-name="ns8" unicode="" horiz-adv-x="640"
|
1991 |
+
d="M104.324 178.828v26.1777h26.0664v-26.1777h-26.0664zM156.79 205.006h-26.3428v26.1777c-0.124023 7.05762 -5.8916 12.748 -12.9785 12.748c-7.08594 0 -12.8535 -5.69043 -12.9775 -12.748v-0.166016h-26.4004v0.166016
|
1992 |
+
c-0.000976562 0.119141 -0.000976562 0.220703 -0.000976562 0.339844c0 21.7041 17.6211 39.3242 39.3242 39.3242c21.5039 0 38.999 -17.2959 39.3213 -38.7227v-0.941406zM209.146 179.16v26.0117h26.3438v-26.0117
|
1993 |
+
c0 -0.0371094 -0.000976562 -0.0722656 -0.000976562 -0.109375c0 -64.7373 -52.5439 -117.3 -117.274 -117.331h-0.774414c-0.0380859 0 -0.0732422 0.000976562 -0.110352 0.000976562c-64.7373 0 -117.299 52.543 -117.33 117.273v0.166016h26.3369
|
1994 |
+
c0 -50.2793 40.8203 -91.1006 91.0996 -91.1006h0.609375c50.2793 0 91.1006 40.8213 91.1006 91.1006zM51.9131 179.16v25.96h-26.291v25.3994c0 50.6445 41.1162 91.7617 91.7607 91.7617s91.7607 -41.1172 91.7607 -91.7617v-25.293h-26.3438v25.293v0.200195
|
1995 |
+
c0 36.1055 -29.3135 65.4199 -65.4199 65.4199c-35.7656 0 -64.8672 -28.7646 -65.4121 -64.4023v-26.6201h26.2891v-25.957c0.356445 -21.2305 17.7031 -38.3564 39.0176 -38.3564s38.6611 17.126 39.0176 38.3564h26.3438
|
1996 |
+
c-0.140625 -35.9551 -29.374 -65.1016 -65.3613 -65.1016s-65.2207 29.1465 -65.3613 65.1016zM470.313 250.333c-11.3467 0 -20.8633 -4.75977 -24.2402 -12.1172v-8.41211c2.21875 -4.53809 6.30859 -7.69238 12.6191 -9.62988
|
1997 |
+
c4.75879 -1.37891 9.76562 -2.3623 14.832 -2.87793c6.36426 -0.827148 13.0068 -1.71484 20.6992 -4.42676c13.7256 -4.59375 24.0742 -13.2275 28.9443 -24.2412l0.166016 -0.664062l-0.166016 -25.8994c-7.69238 -17.0479 -28.668 -28.4473 -52.2998 -28.4473
|
1998 |
+
c-25.6797 0 -47.374 12.6182 -55.2891 32.0439l-0.552734 1.43848l23.0205 11.5078l0.719727 -1.49414c5.97754 -12.1211 17.5996 -19.0391 31.9336 -19.0391c12.0098 0 22.083 4.81445 25.791 12.3418v9.85059c-2.37988 4.59473 -6.47656 7.75098 -12.8398 9.85156
|
1999 |
+
c-5.20312 1.71582 -10.3506 2.37988 -15.8291 3.09961c-6.78809 0.675781 -13.4814 2.04199 -19.8135 3.98438c-14.1123 4.87109 -23.9678 13.2275 -28.668 24.2412c-0.158203 0.949219 -0.123047 -2.02637 0 24.8496c7.36133 17.0469 27.8379 28.4473 50.9727 28.4473
|
2000 |
+
c24.9062 0 45.3818 -12.0098 53.4062 -31.2705l0.609375 -1.43848l-23.2451 -11.5117l-0.71875 1.5498c-5.47949 11.6221 -16.3818 18.2637 -30.0518 18.2637zM287.568 136.656v68.3994h26.0664v-68.3994h-26.0664zM639.834 189.956l0.166016 -0.722656l-0.166016 -28.8906
|
2001 |
+
c-7.52734 -15.9941 -27.8916 -26.7305 -50.584 -26.7305s-43.0029 10.7363 -50.585 26.7305l-0.166016 0.720703l0.166016 28.8887c2.93262 6.25391 8.24121 12.0137 15.4414 16.7139c-5.57422 3.90332 -10.0391 9.14453 -13.0068 15.3311l-0.166016 0.664062
|
2002 |
+
l0.166016 25.3467c7.36133 15.9922 26.7334 26.7324 48.1504 26.7324s40.7881 -10.7402 48.1504 -26.7295l0.166016 -0.664062l-0.166016 -25.3467c-2.90137 -6.22852 -7.38379 -11.4873 -13.0078 -15.3301c7.1416 -4.7041 12.5088 -10.46 15.4414 -16.7139z
|
2003 |
+
M566.614 240.762v-13.7246c3.48535 -6.19922 12.5068 -10.3486 22.5801 -10.3486c10.0723 0 19.0938 4.14844 22.6357 10.3486v13.7246c-3.59766 6.31055 -12.6191 10.5166 -22.6357 10.5166c-10.0176 0 -18.9805 -4.20605 -22.5801 -10.5166zM613.933 168.593v16.1572
|
2004 |
+
c-3.76367 6.36523 -13.3379 10.5146 -24.6826 10.5146c-11.1836 0 -20.9756 -4.20605 -24.6836 -10.5146v-16.1572c3.70801 -6.52734 13.5586 -10.8994 24.6836 -10.8994c11.3447 0 20.9189 4.25879 24.6826 10.8994zM376.4 182.038v89.7129h25.8994v-135.095h-25.6777
|
2005 |
+
l-62.5391 94.085v0.386719h-26.5098v40.623h29z" />
|
2006 |
<glyph glyph-name="nutritionix" unicode="" horiz-adv-x="400"
|
2007 |
d="M88 439.9c0 0 133.4 8.19922 121 -104.4c0 0 19.0996 74.9004 103 40.5996c0 0 -17.7002 -74 -88 -56c0 0 14.5996 54.6006 66.0996 56.6006c0 0 -39.8994 10.2998 -82.0996 -48.7998c0 0 -19.7998 94.5 -93.5996 99.6992c0 0 75.1992 -19.3994 77.5996 -107.5
|
2008 |
c0 -0.0996094 -106.4 -7 -104 119.801zM400 124.3c0 -48.5 -9.7002 -95.2998 -32 -132.3c-42.2002 -30.9004 -105 -48 -168 -48c-62.9004 0 -125.8 17.0996 -168 48c-22.2998 37 -32 83.7998 -32 132.3c0 48.4004 17.7002 94.7002 40 131.7
|
2104 |
c-46 0 -89.5 12.7002 -126.3 34.7002l-23 80.2002l286.8 -37.3008l48.0996 13.3008l-9.69922 34.1992l-220.4 27.1006l92.5996 26.5996c30.2002 8.7002 42 15.7998 61.4004 33.2002c24.5 23 31.7002 45.5 23.5 73.5996l-10.7002 37.8008
|
2105 |
c-8.7002 30.1992 -25.0996 49.0996 -61.3994 55.1992c-25.1006 3.5 -44.5 2 -79.3008 -8.19922l-221.899 -63.9004c26 108.8 124.2 189.5 241.3 189.5zM38.2998 59.4004c-24 38.3994 -38.2998 83.2998 -38.2998 131.8z" />
|
2106 |
<glyph glyph-name="rocketchat" unicode="" horiz-adv-x="576"
|
2107 |
+
d="M284.046 223.2c0.0341797 0 0.0664062 -0.00195312 0.100586 -0.00195312c18.8496 0 34.1592 -15.2754 34.2168 -34.1113c0 -18.8281 -15.2822 -34.1143 -34.1104 -34.1143s-34.1143 15.2861 -34.1143 34.1143c0 18.7588 15.1748 34.002 33.9072 34.1133zM173.596 223.2
|
2108 |
+
c0.0332031 0 0.0673828 -0.00195312 0.100586 -0.00195312c18.8496 0 34.1592 -15.2754 34.2168 -34.1113c0 -18.8281 -15.2822 -34.1143 -34.1104 -34.1143s-34.1143 15.2861 -34.1143 34.1143c0 18.7588 15.1748 34.002 33.9072 34.1133zM394.519 223.2
|
2109 |
+
c0.0351562 0 0.0683594 -0.00195312 0.102539 -0.00195312c18.8496 0 34.1592 -15.2754 34.2148 -34.1113c0 -18.8281 -15.2822 -34.1143 -34.1104 -34.1143s-34.1133 15.2861 -34.1133 34.1143c0 18.7588 15.1738 34.002 33.9062 34.1133zM548.326 278.519
|
2110 |
+
c17.3076 -26.9443 26.0674 -55.9189 26.0898 -86.9395c0 -30.209 -8.76074 -59.2021 -26.0703 -86.125c-15.5342 -24.1934 -37.3076 -45.5703 -64.6787 -63.6191c-52.8672 -34.8164 -122.354 -53.9746 -195.667 -53.9746
|
2111 |
+
c-0.150391 -0.000976562 0.0664062 -0.00585938 -0.0830078 -0.00585938c-24.5488 0 -48.5908 2.18359 -71.9443 6.36621c-14.8564 -14.2842 -31.3604 -26.5059 -49.5098 -36.5889c-66.7744 -33.3467 -125.6 -20.9092 -155.324 -10.2002
|
2112 |
+
c-5.54492 1.96289 -9.51758 7.25488 -9.51758 13.4697c0 3.82715 1.50879 7.30469 3.96289 9.87109c20.9619 21.6748 55.6416 64.5342 47.1162 103.49c-33.1426 33.9004 -51.1123 74.7764 -51.1123 118.148c0 42.5605 17.9697 83.4365 51.1123 117.337
|
2113 |
+
c8.52148 38.9521 -26.1582 81.7939 -47.1201 103.47c-2.45996 2.56738 -3.97656 6.0498 -3.97656 9.88281c0 6.21973 3.98047 11.5156 9.53125 13.4785c29.7246 10.71 88.5488 23.1211 155.302 -10.2109c18.1504 -10.0811 34.6553 -22.3027 49.5107 -36.5879
|
2114 |
+
c23.3457 4.18066 47.0137 6.35742 71.5547 6.35742c0.15918 0 0.318359 -0.000976562 0.476562 -0.000976562c73.293 0 142.78 -19.1826 195.666 -54c27.3711 -18.0479 49.1465 -39.4453 64.6816 -63.6182zM284.987 38.0996c128.612 0 232.866 67.376 232.866 150.487
|
2115 |
+
c0 83.0957 -104.274 150.469 -232.866 150.469c-128.593 0 -232.847 -67.3691 -232.847 -150.469c0 -36.2002 19.7861 -69.4375 52.7783 -95.4004c9.28809 -29.5986 3.84668 -62.958 -16.3252 -100.078c-0.960938 -1.79297 -1.8584 -3.58496 -2.8418 -5.35645
|
2116 |
+
c18.6367 1.63574 36.5557 6.875 52.5225 14.8701c13.5889 7.65625 25.9609 16.8633 37.1377 27.585l20.1289 19.3926c28.2617 -7.47852 57.8037 -11.501 88.4033 -11.501c0.347656 0 0.695312 0 1.04297 0.000976562z" />
|
2117 |
<glyph glyph-name="rockrms" unicode="" horiz-adv-x="496"
|
2118 |
d="M248 440c137 0 248 -111 248 -248s-111 -248 -248 -248s-248 111 -248 248s111 248 248 248zM405.4 20.5l-101.5 118.9s73.5996 0.199219 74.1992 0.199219c29.6006 -1.09961 46.6006 33.3008 27.6006 56.1006l-157.7 185.1c-13.2002 17.2998 -40.0996 18.4004 -54.5 0
|
2119 |
l-147.1 -172.5h90l84.2998 98.9004l84.5996 -99.2998h-75.2998c-30.5 0 -44.5 -35.7002 -26.5996 -56.1006l112 -131.3h90z" />
|
3368 |
v-25.7998h16.1006c0.0380859 0.00195312 0.0742188 0.00488281 0.113281 0.00488281c1.04297 0 1.88965 -0.847656 1.88965 -1.89062c0 -0.0380859 -0.000976562 -0.0761719 -0.00292969 -0.114258v-0.800781
|
3369 |
c0.00195312 -0.0380859 0.00488281 -0.0742188 0.00488281 -0.113281c0 -1.04297 -0.847656 -1.88965 -1.89062 -1.88965c-0.0380859 0 -0.0761719 0.000976562 -0.114258 0.00292969h-16.1006v-26.6992h19.4004zM288.301 262.799l2.2998 -6.7998l7.10059 -0.0996094
|
3370 |
l-5.7002 -4.30078l2.09961 -6.7998l-5.7998 4.10059l-5.7998 -4.10059l2.09961 6.7998l-5.69922 4.30078l7.09961 0.0996094z" />
|
|
|
|
|
3371 |
<glyph glyph-name="artstation" unicode="" horiz-adv-x="512"
|
3372 |
d="M2 70.5996h315.1l59.2002 -102.6h-285.399c-0.00488281 0 0.0205078 -0.0498047 0.015625 -0.0498047c-20.0742 0 -37.4736 11.5439 -45.916 28.3496zM501.8 98c19 -29.4004 -0.0996094 -55.9004 -2 -59.0996l-40.7002 -70.5l-257.3 447.6h88.4004
|
3373 |
c0.00390625 0 -0.0234375 0.0527344 -0.0195312 0.0527344c19.6797 0 36.79 -11.0879 45.4189 -27.3525zM275 143.5h-231l115.5 200z" />
|
icons/fontawesome/webfonts/fa-brands-400.ttf
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-brands-400.woff
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-brands-400.woff2
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-regular-400.eot
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-regular-400.svg
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?xml version="1.0" standalone="no"?>
|
2 |
-
<!--
|
3 |
-
Font Awesome Free 5.14.0 by @fontawesome - https://fontawesome.com
|
4 |
-
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
5 |
-
-->
|
6 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
7 |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
|
8 |
<metadata>
|
9 |
-
Created by FontForge 20200314 at
|
10 |
By Robert Madole
|
11 |
Copyright (c) Font Awesome
|
12 |
</metadata>
|
13 |
-
|
14 |
<font id="FontAwesome5Free-Regular" horiz-adv-x="512" >
|
15 |
<font-face
|
16 |
font-family="Font Awesome 5 Free Regular"
|
1 |
<?xml version="1.0" standalone="no"?>
|
|
|
|
|
|
|
|
|
2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3 |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
|
4 |
<metadata>
|
5 |
+
Created by FontForge 20200314 at Mon Oct 5 09:49:13 2020
|
6 |
By Robert Madole
|
7 |
Copyright (c) Font Awesome
|
8 |
</metadata>
|
9 |
+
<!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><defs>
|
10 |
<font id="FontAwesome5Free-Regular" horiz-adv-x="512" >
|
11 |
<font-face
|
12 |
font-family="Font Awesome 5 Free Regular"
|
icons/fontawesome/webfonts/fa-regular-400.ttf
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-regular-400.woff
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-regular-400.woff2
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-solid-900.eot
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-solid-900.svg
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?xml version="1.0" standalone="no"?>
|
2 |
-
<!--
|
3 |
-
Font Awesome Free 5.14.0 by @fontawesome - https://fontawesome.com
|
4 |
-
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
5 |
-
-->
|
6 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
7 |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
|
8 |
<metadata>
|
9 |
-
Created by FontForge 20200314 at
|
10 |
By Robert Madole
|
11 |
Copyright (c) Font Awesome
|
12 |
</metadata>
|
13 |
-
|
14 |
<font id="FontAwesome5Free-Solid" horiz-adv-x="512" >
|
15 |
<font-face
|
16 |
font-family="Font Awesome 5 Free Solid"
|
@@ -311,6 +307,23 @@ s9.55762 21.3301 21.3301 21.3301h16.1602c38.0195 0 57.0498 45.96 30.1699 72.8398
|
|
311 |
c26.8398 -26.8799 72.8398 -7.83008 72.8398 30.1699v16.1602c0 11.7725 9.55762 21.3301 21.3301 21.3301s21.3301 -9.55762 21.3301 -21.3301v-16.1602c0 -38.0195 45.96 -57.0498 72.8398 -30.1699l11.4297 11.4297c3.85742 3.83301 9.17578 6.19531 15.0361 6.19531
|
312 |
c11.7725 0 21.3301 -9.55762 21.3301 -21.3291c0 -5.85938 -2.36621 -11.1689 -6.19629 -15.0254l-11.4297 -11.4404c-26.8799 -26.8398 -7.83008 -72.8398 30.1699 -72.8398h16.1602c11.7725 0 21.3301 -9.55762 21.3301 -21.3301s-9.55762 -21.3301 -21.3301 -21.3301
|
313 |
h-16.1602zM160 256c17.6611 0 32 14.3389 32 32s-14.3389 32 -32 32s-32 -14.3389 -32 -32s14.3389 -32 32 -32zM240 224c8.83105 0 16 7.16895 16 16s-7.16895 16 -16 16s-16 -7.16895 -16 -16s7.16895 -16 16 -16z" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
<glyph glyph-name="glass-martini" unicode=""
|
315 |
d="M502.05 390.4l-214.05 -214.04v-192.36h56c22.0898 0 40 -17.9102 40 -40c0 -4.41992 -3.58008 -8 -8 -8h-240c-4.41992 0 -8 3.58008 -8 8c0 22.0898 17.9102 40 40 40h56v192.36l-214.05 214.04c-21.25 21.2598 -6.2002 57.5996 23.8496 57.5996h444.4
|
316 |
c30.0498 0 45.0996 -36.3398 23.8496 -57.5996z" />
|
1 |
<?xml version="1.0" standalone="no"?>
|
|
|
|
|
|
|
|
|
2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3 |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
|
4 |
<metadata>
|
5 |
+
Created by FontForge 20200314 at Mon Oct 5 09:49:14 2020
|
6 |
By Robert Madole
|
7 |
Copyright (c) Font Awesome
|
8 |
</metadata>
|
9 |
+
<!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><defs>
|
10 |
<font id="FontAwesome5Free-Solid" horiz-adv-x="512" >
|
11 |
<font-face
|
12 |
font-family="Font Awesome 5 Free Solid"
|
307 |
c26.8398 -26.8799 72.8398 -7.83008 72.8398 30.1699v16.1602c0 11.7725 9.55762 21.3301 21.3301 21.3301s21.3301 -9.55762 21.3301 -21.3301v-16.1602c0 -38.0195 45.96 -57.0498 72.8398 -30.1699l11.4297 11.4297c3.85742 3.83301 9.17578 6.19531 15.0361 6.19531
|
308 |
c11.7725 0 21.3301 -9.55762 21.3301 -21.3291c0 -5.85938 -2.36621 -11.1689 -6.19629 -15.0254l-11.4297 -11.4404c-26.8799 -26.8398 -7.83008 -72.8398 30.1699 -72.8398h16.1602c11.7725 0 21.3301 -9.55762 21.3301 -21.3301s-9.55762 -21.3301 -21.3301 -21.3301
|
309 |
h-16.1602zM160 256c17.6611 0 32 14.3389 32 32s-14.3389 32 -32 32s-32 -14.3389 -32 -32s14.3389 -32 32 -32zM240 224c8.83105 0 16 7.16895 16 16s-7.16895 16 -16 16s-16 -7.16895 -16 -16s7.16895 -16 16 -16z" />
|
310 |
+
<glyph glyph-name="vest" unicode="" horiz-adv-x="448"
|
311 |
+
d="M437.252 208.123c6.76562 -10.1484 10.748 -22.3994 10.748 -35.5v-204.623c0 -17.6611 -14.3389 -32 -32 -32h-192v224l73.8115 221.438c-21.7695 -12.3281 -47.0635 -19.5205 -73.8115 -19.6729c-26.748 0.150391 -52.042 7.34277 -73.8115 19.6699l56.9463 -170.836
|
312 |
+
l-13.4922 -40.4805c-1.05957 -3.17969 -1.64258 -6.58496 -1.64258 -10.1191v-224h-160c-17.6611 0 -32 14.3389 -32 32v204.623c0 13.1006 3.98242 25.3516 10.748 35.5l53.252 79.877v128c0 17.6611 14.3389 32 32 32h32
|
313 |
+
c4.91211 -0.00195312 9.50586 -1.49512 13.3115 -4.03125l25 -16.6719c16.4814 -11.0186 36.4971 -17.4463 57.793 -17.4463s41.1025 6.42773 57.584 17.4463l25 16.6719c3.80566 2.53613 8.39941 4.0293 13.3115 4.03125h32c17.6611 0 32 -14.3389 32 -32v-128z
|
314 |
+
M131.312 76.6885c2.78125 2.87891 4.48828 6.80078 4.48828 11.1152c0 8.83105 -7.16992 16 -16 16c-4.31445 0 -8.23242 -1.71094 -11.1113 -4.49219l-48 -48c-2.78125 -2.87891 -4.48828 -6.80078 -4.48828 -11.1152c0 -8.83105 7.16992 -16 16 -16
|
315 |
+
c4.31445 0 8.23242 1.71094 11.1113 4.49219zM387.312 28.6885c2.89746 2.89453 4.69043 6.89844 4.69043 11.3135s-1.79297 8.41504 -4.69043 11.3096l-48 48c-2.87891 2.78125 -6.80078 4.48828 -11.1152 4.48828c-8.83105 0 -16 -7.16992 -16 -16
|
316 |
+
c0 -4.31445 1.71094 -8.23242 4.49219 -11.1113l48 -48c2.89453 -2.89746 6.89844 -4.69043 11.3135 -4.69043s8.41504 1.79297 11.3096 4.69043z" />
|
317 |
+
<glyph glyph-name="vest-patches" unicode="" horiz-adv-x="448"
|
318 |
+
d="M437.252 208.123c6.76562 -10.1484 10.748 -22.3994 10.748 -35.5v-204.623c0 -17.6611 -14.3389 -32 -32 -32h-192v224l73.8105 221.434c-21.7705 -12.3252 -47.0635 -19.5156 -73.8105 -19.668c-26.7471 0.154297 -52.041 7.34668 -73.8115 19.6738l56.9463 -170.84
|
319 |
+
l-13.4922 -40.4805c-1.05957 -3.17969 -1.64258 -6.58496 -1.64258 -10.1191v-224h-160c-17.6611 0 -32 14.3389 -32 32v204.623c0 13.1006 3.98242 25.3516 10.748 35.5l53.252 79.877v128c0 17.6611 14.3389 32 32 32h32l0.0283203 -0.0146484
|
320 |
+
c4.91113 0 9.47949 -1.47949 13.2832 -4.0166l25 -16.6719c16.4814 -11.0186 36.4971 -17.4463 57.793 -17.4463s41.1025 6.42773 57.584 17.4463l25 16.6719c3.80371 2.53711 8.39551 4.03125 13.3066 4.03125h0.00488281h32c17.6611 0 32 -14.3389 32 -32v-128z
|
321 |
+
M63.5 175.516l15.5156 -15.5156l-15.5156 -15.5156c-2.12402 -2.16699 -3.43066 -5.1377 -3.43066 -8.4082c0 -6.62891 5.38086 -12.0107 12.0098 -12.0107c3.2793 0 6.25293 1.31738 8.4209 3.4502l15.5 15.5l15.5 -15.5
|
322 |
+
c2.16797 -2.13281 5.14551 -3.44629 8.42383 -3.44629c6.62891 0 12.0107 5.38184 12.0107 12.0098c0 3.27051 -1.31055 6.23828 -3.43457 8.40527l-15.5156 15.5156l15.5156 15.5156c2.12402 2.16699 3.43066 5.1377 3.43066 8.4082
|
323 |
+
c0 6.62891 -5.38086 12.0107 -12.0098 12.0107c-3.2793 0 -6.25293 -1.31738 -8.4209 -3.4502l-15.5 -15.5l-15.5 15.5c-2.16797 2.13281 -5.14551 3.44629 -8.42383 3.44629c-6.62891 0 -12.0107 -5.38184 -12.0107 -12.0098c0 -3.27051 1.31055 -6.23828 3.43457 -8.40527
|
324 |
+
zM96 -8c22.0762 0 40 17.9238 40 40s-17.9238 40 -40 40s-40 -17.9238 -40 -40s17.9238 -40 40 -40zM359.227 112.215c13.6875 0.0966797 24.7734 11.2139 24.7734 24.9229c0 0.757812 -0.0341797 1.50684 -0.0996094 2.24707
|
325 |
+
c-1.16406 12.8008 -12.5742 22.1113 -25.4004 22.0762l-5.05078 -0.0371094l0.0371094 5.05762c0.0722656 12.7998 -9.26758 24.2568 -22.0566 25.4189c-0.742188 0.0664062 -1.46973 0.0947266 -2.22949 0.0947266c-13.7012 0 -24.8418 -11.0527 -24.9854 -24.7207
|
326 |
+
l-0.214844 -48.5742c0 -0.00976562 -0.000976562 -0.0195312 -0.000976562 -0.0292969c0 -3.68164 2.98926 -6.6709 6.6709 -6.6709h0.0302734z" />
|
327 |
<glyph glyph-name="glass-martini" unicode=""
|
328 |
d="M502.05 390.4l-214.05 -214.04v-192.36h56c22.0898 0 40 -17.9102 40 -40c0 -4.41992 -3.58008 -8 -8 -8h-240c-4.41992 0 -8 3.58008 -8 8c0 22.0898 17.9102 40 40 40h56v192.36l-214.05 214.04c-21.25 21.2598 -6.2002 57.5996 23.8496 57.5996h444.4
|
329 |
c30.0498 0 45.0996 -36.3398 23.8496 -57.5996z" />
|
icons/fontawesome/webfonts/fa-solid-900.ttf
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-solid-900.woff
CHANGED
Binary file
|
icons/fontawesome/webfonts/fa-solid-900.woff2
CHANGED
Binary file
|
js/sow.google-map.js
CHANGED
@@ -184,15 +184,15 @@ sowb.SiteOriginGoogleMap = function($) {
|
|
184 |
}
|
185 |
var geocodeMarker = function ( mrkr ) {
|
186 |
|
187 |
-
var customIcon = mrkr.
|
188 |
var markerInfo = mrkr.hasOwnProperty( 'info' ) ? mrkr.info : null;
|
189 |
-
var infoMaxWidth = mrkr.hasOwnProperty( '
|
190 |
return this.getLocation( mrkr.place ).done( function ( location ) {
|
191 |
var mrkerIcon = options.markerIcon;
|
192 |
if ( customIcon ) {
|
193 |
mrkerIcon = customIcon;
|
194 |
}
|
195 |
-
|
196 |
var marker = new google.maps.Marker( {
|
197 |
position: location,
|
198 |
map: map,
|
184 |
}
|
185 |
var geocodeMarker = function ( mrkr ) {
|
186 |
|
187 |
+
var customIcon = mrkr.customMarkerIcon;
|
188 |
var markerInfo = mrkr.hasOwnProperty( 'info' ) ? mrkr.info : null;
|
189 |
+
var infoMaxWidth = mrkr.hasOwnProperty( 'infoMaxWidth' ) ? mrkr.infoMaxWidth : null;
|
190 |
return this.getLocation( mrkr.place ).done( function ( location ) {
|
191 |
var mrkerIcon = options.markerIcon;
|
192 |
if ( customIcon ) {
|
193 |
mrkerIcon = customIcon;
|
194 |
}
|
195 |
+
|
196 |
var marker = new google.maps.Marker( {
|
197 |
position: location,
|
198 |
map: map,
|
js/sow.google-map.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(jQuery).initMaps()}window.sowb=window.sowb||{},sowb.SiteOriginGoogleMapInstances=[],sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(e,o,t){var i=Number(t.zoom);i||(i=14),window.matchMedia("(max-width: "+t.breakpoint+"px)").matches&&(i=t.mobileZoom);var n,a={zoom:i,gestureHandling:t.gestureHandling,disableDefaultUI:t.disableUi,zoomControl:t.zoomControl,panControl:t.panControl,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.SATELLITE,"user_map_style"]}},s=new google.maps.Map(e,a),r={name:t.mapName},l=t.mapStyles;if(l){var p=new google.maps.StyledMapType(l,r);s.mapTypes.set("user_map_style",p),s.setMapTypeId("user_map_style")}(t.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:o,map:s,draggable:t.markersDraggable,icon:t.markerIcon,title:""}),s.centerMarker=this.centerMarker),t.keepCentered)&&(google.maps.event.addDomListener(s,"idle",(function(){n=s.getCenter()})),google.maps.event.addDomListener(window,"resize",(function(){s.setCenter(n)})));this.linkAutocompleteField(t.autocomplete,t.autocompleteElement,s,t),this.showMarkers(t.markerPositions,s,t),this.showDirections(t.directions,s,t),sowb.SiteOriginGoogleMapInstances.push(s)},linkAutocompleteField:function(o,t,i,n){if(o&&t){var a=function(e){this.inputAddress!==e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",(function(e){"13"===(e.keyCode||e.which)&&e.preventDefault()})),s.on("focusin",function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver((function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),n=t+(i?", "+i:"");n&&a(n)}));this.resultsObserver.observe(o,{attributes:!0,childList:!0,characterData:!0})}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t===google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",(function(e){r(e.latLng)})),this.centerMarker.addListener("dragend",(function(e){r(e.latLng)}))}},showMarkers:function(e,o,t){if(e&&e.length){this.infoWindows=[];for(var i=[],n=0;n<e.length;n++){var a=parseInt(n/10);i.length===a&&(i[a]=[]),i[a][n%10]=e[n]}var s=function(e){var i=e.
|
1 |
+
function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(jQuery).initMaps()}window.sowb=window.sowb||{},sowb.SiteOriginGoogleMapInstances=[],sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(e,o,t){var i=Number(t.zoom);i||(i=14),window.matchMedia("(max-width: "+t.breakpoint+"px)").matches&&(i=t.mobileZoom);var n,a={zoom:i,gestureHandling:t.gestureHandling,disableDefaultUI:t.disableUi,zoomControl:t.zoomControl,panControl:t.panControl,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.SATELLITE,"user_map_style"]}},s=new google.maps.Map(e,a),r={name:t.mapName},l=t.mapStyles;if(l){var p=new google.maps.StyledMapType(l,r);s.mapTypes.set("user_map_style",p),s.setMapTypeId("user_map_style")}(t.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:o,map:s,draggable:t.markersDraggable,icon:t.markerIcon,title:""}),s.centerMarker=this.centerMarker),t.keepCentered)&&(google.maps.event.addDomListener(s,"idle",(function(){n=s.getCenter()})),google.maps.event.addDomListener(window,"resize",(function(){s.setCenter(n)})));this.linkAutocompleteField(t.autocomplete,t.autocompleteElement,s,t),this.showMarkers(t.markerPositions,s,t),this.showDirections(t.directions,s,t),sowb.SiteOriginGoogleMapInstances.push(s)},linkAutocompleteField:function(o,t,i,n){if(o&&t){var a=function(e){this.inputAddress!==e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",(function(e){"13"===(e.keyCode||e.which)&&e.preventDefault()})),s.on("focusin",function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver((function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),n=t+(i?", "+i:"");n&&a(n)}));this.resultsObserver.observe(o,{attributes:!0,childList:!0,characterData:!0})}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t===google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",(function(e){r(e.latLng)})),this.centerMarker.addListener("dragend",(function(e){r(e.latLng)}))}},showMarkers:function(e,o,t){if(e&&e.length){this.infoWindows=[];for(var i=[],n=0;n<e.length;n++){var a=parseInt(n/10);i.length===a&&(i[a]=[]),i[a][n%10]=e[n]}var s=function(e){var i=e.customMarkerIcon,n=e.hasOwnProperty("info")?e.info:null,a=e.hasOwnProperty("infoMaxWidth")?e.infoMaxWidth:null;return this.getLocation(e.place).done(function(e){var s=t.markerIcon;i&&(s=i);var r=new google.maps.Marker({position:e,map:o,draggable:t.markersDraggable,icon:s,title:""});if(n){var l={content:n};a&&(l.maxWidth=a);var p=t.markerInfoDisplay;l.disableAutoPan="always"===p;var c=new google.maps.InfoWindow(l);this.infoWindows.push(c);var d=p;"always"===p&&(d="click",c.open(o,r)),r.addListener(d,function(){c.open(o,r),"always"===p||t.markerInfoMultiple||this.infoWindows.forEach((function(e){e!==c&&e.close()}))}.bind(this)),"mouseover"===p&&r.addListener("mouseout",(function(){setTimeout((function(){c.close()}),100)}))}}.bind(this)).fail((function(e){r=e===google.maps.GeocoderStatus.OVER_QUERY_LIMIT,console.log(e)}))}.bind(this),r=!1,l=function(e,o){for(var t=0,i=0;i<e.length&&!r;i++)s(e[i]).then((function(){++t===e.length&&o.length&&l(o.shift(),o)}))}.bind(this);l(i.shift(),i)}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map((function(e){e.stopover=Boolean(e.stopover)}));var t=new google.maps.DirectionsRenderer;t.setMap(o),(new google.maps.DirectionsService).route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},(function(o,i){i===google.maps.DirectionsStatus.OK&&(t.setOptions({preserveViewport:e.preserveViewport}),t.setDirections(o))}))}},initMaps:function(){var o=e(".sow-google-map-autocomplete"),t=new e.Deferred;0===o.length?t.resolve():o.each(function(o,i){if(void 0!==google.maps.places){var n=new google.maps.places.Autocomplete(i),a=e(i).siblings(".sow-google-map-canvas");if(a.length>0){var s=a.data("options");s.autocomplete=n,s.autocompleteElement=i,this.getLocation(s.address).done(function(e){this.showMap(a.get(0),e,s),a.data("initialized",!0),t.resolve()}.bind(this)).fail((function(){a.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>"),t.reject()}))}}else t.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.')}.bind(this)),t.always(function(){e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("initialized"))return!0;var n=i.data("options"),a=n.address;if(!a){var s=n.markerPositions;s&&s.length&&(a=s[0].place)}this.getLocation(a).done(function(e){this.showMap(i.get(0),e,n),i.data("initialized",!0)}.bind(this)).fail((function(){i.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>")}))}.bind(this))}.bind(this)).fail((function(e){console.log(e)})).done((function(){e(sowb).trigger("maps_loaded")}))},getGeocoder:function(){return this._geocoder||(this._geocoder=new google.maps.Geocoder),this._geocoder},getLocation:function(o){var t,i=new e.Deferred,n={address:o};if(o&&o.indexOf(",")>-1){var a=o.replace(/[\(\)]/g,"").split(",");a&&2===a.length&&(t=new google.maps.LatLng(a[0],a[1]),isNaN(t.lat())||isNaN(t.lng())||(n={location:{lat:t.lat(),lng:t.lng()}}))}if(n.hasOwnProperty("location"))i.resolve(n.location);else if(n.hasOwnProperty("address")){if(!n.address){var s=parseInt(Math.random()*this.DEFAULT_LOCATIONS.length);n.address=this.DEFAULT_LOCATIONS[s]}var r=0,l=function(e,o){o===google.maps.GeocoderStatus.OK?i.resolve(e[0].geometry.location):o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?++r<3?setTimeout(function(){this.getGeocoder().geocode.call(this,n,l)}.bind(this),1e3):i.reject(o):o!==google.maps.GeocoderStatus.ZERO_RESULTS&&o!==google.maps.GeocoderStatus.OVER_DAILY_LIMIT||i.reject(o)}.bind(this);this.getGeocoder().geocode(n,l)}return i}}},jQuery((function(e){sowb.setupGoogleMaps=function(){var o,t=[],i=e(".sow-google-map-canvas");if(i.length){i.each((function(i,n){var a=e(n);if(!a.parent().is(":visible")||a.data("apiInitialized"))return a;var s=a.data("options");s&&(void 0!==s.libraries&&null!==s.libraries&&(t=t.concat(s.libraries)),!o&&s.apiKey&&(o=s.apiKey)),a.data("apiInitialized",!0)}));var n=void 0!==window.google&&void 0!==window.google.maps;if(sowb.mapsApiInitialized)var a=setTimeout((function(){n&&(clearTimeout(a),soGoogleMapInitialize())}),100);else{o||(console.warn("SiteOrigin Google Maps: Could not find API key. Google Maps API key is required."),o="");var s="https://maps.googleapis.com/maps/api/js?key="+o+"&callback=soGoogleMapInitialize";if(t&&t.length&&(s+="&libraries="+t.join(",")),window.console&&window.console.error){var r=window.console.error;sowb.onLoadMapsApiError=function(o){var t;"string"==typeof o&&(t=o.match(/^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/)),t&&t.length&&t[0]&&e(".sow-google-map-canvas").each((function(o,t){var i=e(t);if(i.data("fallbackImage")){var n=i.data("fallbackImage");n.hasOwnProperty("img")&&i.append(n.img)}})),r.apply(window.console,arguments)},window.console.error=sowb.onLoadMapsApiError}soWidgetsGoogleMap.map_consent?e(".sow-google-map-consent button").on("click",(function(){e(".sow-google-map-consent").remove(),e(".sow-google-map-canvas").show(),e("body").append('<script async type="text/javascript" src="'+s+'">'),sowb.mapsApiInitialized=!0})):(e("body").append('<script async type="text/javascript" src="'+s+'">'),sowb.mapsApiInitialized=!0)}}},sowb.setupGoogleMaps(),e(sowb).on("setup_widgets",sowb.setupGoogleMaps)}));
|
lang/so-widgets-bundle.pot
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the same license as the so-widgets-bundle package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
@@ -36,7 +36,7 @@ msgstr ""
|
|
36 |
msgid "https://siteorigin.com/widgets-bundle/"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: so-widgets-bundle.php:340, so-widgets-bundle.php:364, so-widgets-bundle.php:377, so-widgets-bundle.php:407, so-widgets-bundle.php:418, so-widgets-bundle.php:
|
40 |
msgid "Invalid request."
|
41 |
msgstr ""
|
42 |
|
@@ -44,31 +44,31 @@ msgstr ""
|
|
44 |
msgid "Insufficient permissions."
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: so-widgets-bundle.php:347, so-widgets-bundle.php:
|
48 |
msgid "Invalid post."
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: so-widgets-bundle.php:
|
52 |
msgid "SiteOrigin Widgets"
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: so-widgets-bundle.php:
|
56 |
msgid "%s was %s"
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: so-widgets-bundle.php:
|
60 |
msgid "Activated"
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: so-widgets-bundle.php:
|
64 |
msgid "Deactivated"
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: so-widgets-bundle.php:
|
68 |
msgid "Manage Widgets"
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: so-widgets-bundle.php:
|
72 |
msgid "Support"
|
73 |
msgstr ""
|
74 |
|
@@ -228,7 +228,7 @@ msgstr ""
|
|
228 |
msgid "Clear"
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: compat/beaver-builder/beaver-builder.php:68, widgets/google-map/google-map.php:290, widgets/image/image.php:
|
232 |
msgid "Default"
|
233 |
msgstr ""
|
234 |
|
@@ -252,7 +252,7 @@ msgstr ""
|
|
252 |
msgid "You need to select a widget type before you'll see anything here. :)"
|
253 |
msgstr ""
|
254 |
|
255 |
-
#: compat/block-editor/widget-block.php:
|
256 |
msgid "Invalid widget class %s. Please make sure the widget has been activated in %sSiteOrigin Widgets%s."
|
257 |
msgstr ""
|
258 |
|
@@ -264,15 +264,15 @@ msgstr ""
|
|
264 |
msgid "Allows you to add any active SiteOrigin Widgets Bundle widgets."
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: icons/fontawesome/filter.php:
|
268 |
msgid "Regular"
|
269 |
msgstr ""
|
270 |
|
271 |
-
#: icons/fontawesome/filter.php:
|
272 |
msgid "Solid"
|
273 |
msgstr ""
|
274 |
|
275 |
-
#: icons/fontawesome/filter.php:
|
276 |
msgid "Brands"
|
277 |
msgstr ""
|
278 |
|
@@ -292,7 +292,7 @@ msgstr ""
|
|
292 |
msgid "When opening the panel, scroll the user to the top of the panel."
|
293 |
msgstr ""
|
294 |
|
295 |
-
#: widgets/accordion/accordion.php:71, widgets/accordion/accordion.php:84, widgets/contact/contact.php:48, widgets/cta/cta.php:64, widgets/editor/editor.php:35, widgets/features/features.php:136, widgets/icon/icon.php:68, widgets/post-carousel/post-carousel.php:
|
296 |
msgid "Title"
|
297 |
msgstr ""
|
298 |
|
@@ -324,7 +324,7 @@ msgstr ""
|
|
324 |
msgid "Closed"
|
325 |
msgstr ""
|
326 |
|
327 |
-
#: widgets/accordion/accordion.php:110, widgets/contact/contact.php:
|
328 |
msgid "Design"
|
329 |
msgstr ""
|
330 |
|
@@ -332,7 +332,7 @@ msgstr ""
|
|
332 |
msgid "Headings"
|
333 |
msgstr ""
|
334 |
|
335 |
-
#: widgets/accordion/accordion.php:120, widgets/accordion/accordion.php:158, widgets/contact/contact.php:
|
336 |
msgid "Background color"
|
337 |
msgstr ""
|
338 |
|
@@ -348,7 +348,7 @@ msgstr ""
|
|
348 |
msgid "Title hover color"
|
349 |
msgstr ""
|
350 |
|
351 |
-
#: widgets/accordion/accordion.php:139, widgets/accordion/accordion.php:167, widgets/contact/contact.php:
|
352 |
msgid "Border color"
|
353 |
msgstr ""
|
354 |
|
@@ -356,7 +356,7 @@ msgstr ""
|
|
356 |
msgid "Border hover color"
|
357 |
msgstr ""
|
358 |
|
359 |
-
#: widgets/accordion/accordion.php:147, widgets/accordion/accordion.php:171, widgets/contact/contact.php:
|
360 |
msgid "Border width"
|
361 |
msgstr ""
|
362 |
|
@@ -384,219 +384,219 @@ msgstr ""
|
|
384 |
msgid "Button text"
|
385 |
msgstr ""
|
386 |
|
387 |
-
#: widgets/button/button.php:51, widgets/google-map/google-map.php:103, widgets/headline/headline.php:47, widgets/headline/headline.php:118, widgets/hero/hero.php:128, widgets/icon/icon.php:57, widgets/image/image.php:
|
388 |
msgid "Destination URL"
|
389 |
msgstr ""
|
390 |
|
391 |
-
#: widgets/button/button.php:
|
392 |
msgid "Open in a new window"
|
393 |
msgstr ""
|
394 |
|
395 |
-
#: widgets/button/button.php:
|
396 |
msgid "Download"
|
397 |
msgstr ""
|
398 |
|
399 |
-
#: widgets/button/button.php:
|
400 |
msgid "The button destination URL will be downloaded when a user clicks on the button."
|
401 |
msgstr ""
|
402 |
|
403 |
-
#: widgets/button/button.php:
|
404 |
msgid "Icon"
|
405 |
msgstr ""
|
406 |
|
407 |
-
#: widgets/button/button.php:
|
408 |
msgid "Icon color"
|
409 |
msgstr ""
|
410 |
|
411 |
-
#: widgets/button/button.php:
|
412 |
msgid "Image icon"
|
413 |
msgstr ""
|
414 |
|
415 |
-
#: widgets/button/button.php:
|
416 |
msgid "Replaces the icon with your own image icon."
|
417 |
msgstr ""
|
418 |
|
419 |
-
#: widgets/button/button.php:
|
420 |
msgid "Icon Placement"
|
421 |
msgstr ""
|
422 |
|
423 |
-
#: widgets/button/button.php:
|
424 |
msgid "Top"
|
425 |
msgstr ""
|
426 |
|
427 |
-
#: widgets/button/button.php:
|
428 |
msgid "Right"
|
429 |
msgstr ""
|
430 |
|
431 |
-
#: widgets/button/button.php:
|
432 |
msgid "Bottom"
|
433 |
msgstr ""
|
434 |
|
435 |
-
#: widgets/button/button.php:
|
436 |
msgid "Left"
|
437 |
msgstr ""
|
438 |
|
439 |
-
#: widgets/button/button.php:
|
440 |
msgid "Design and layout"
|
441 |
msgstr ""
|
442 |
|
443 |
-
#: widgets/button/button.php:
|
444 |
msgid "Width"
|
445 |
msgstr ""
|
446 |
|
447 |
-
#: widgets/button/button.php:
|
448 |
msgid "Leave blank to let the button resize according to content."
|
449 |
msgstr ""
|
450 |
|
451 |
-
#: widgets/button/button.php:
|
452 |
msgid "Align"
|
453 |
msgstr ""
|
454 |
|
455 |
-
#: widgets/button/button.php:
|
456 |
msgid "Center"
|
457 |
msgstr ""
|
458 |
|
459 |
-
#: widgets/button/button.php:
|
460 |
msgid "Justify"
|
461 |
msgstr ""
|
462 |
|
463 |
-
#: widgets/button/button.php:
|
464 |
msgid "Button theme"
|
465 |
msgstr ""
|
466 |
|
467 |
-
#: widgets/button/button.php:
|
468 |
msgid "Atom"
|
469 |
msgstr ""
|
470 |
|
471 |
-
#: widgets/button/button.php:
|
472 |
msgid "Flat"
|
473 |
msgstr ""
|
474 |
|
475 |
-
#: widgets/button/button.php:
|
476 |
msgid "Wire"
|
477 |
msgstr ""
|
478 |
|
479 |
-
#: widgets/button/button.php:
|
480 |
msgid "Button color"
|
481 |
msgstr ""
|
482 |
|
483 |
-
#: widgets/button/button.php:
|
484 |
msgid "Text color"
|
485 |
msgstr ""
|
486 |
|
487 |
-
#: widgets/button/button.php:
|
488 |
msgid "Use hover effects"
|
489 |
msgstr ""
|
490 |
|
491 |
-
#: widgets/button/button.php:
|
492 |
msgid "Hover background color"
|
493 |
msgstr ""
|
494 |
|
495 |
-
#: widgets/button/button.php:
|
496 |
msgid "Hover text color"
|
497 |
msgstr ""
|
498 |
|
499 |
-
#: widgets/button/button.php:
|
500 |
msgid "Font"
|
501 |
msgstr ""
|
502 |
|
503 |
-
#: widgets/button/button.php:
|
504 |
msgid "Font size"
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: widgets/button/button.php:
|
508 |
msgid "Normal"
|
509 |
msgstr ""
|
510 |
|
511 |
-
#: widgets/button/button.php:
|
512 |
msgid "Medium"
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: widgets/button/button.php:
|
516 |
msgid "Large"
|
517 |
msgstr ""
|
518 |
|
519 |
-
#: widgets/button/button.php:
|
520 |
msgid "Extra large"
|
521 |
msgstr ""
|
522 |
|
523 |
-
#: widgets/button/button.php:
|
524 |
msgid "Rounding"
|
525 |
msgstr ""
|
526 |
|
527 |
-
#: widgets/button/button.php:
|
528 |
msgid "None"
|
529 |
msgstr ""
|
530 |
|
531 |
-
#: widgets/button/button.php:
|
532 |
msgid "Slightly rounded"
|
533 |
msgstr ""
|
534 |
|
535 |
-
#: widgets/button/button.php:
|
536 |
msgid "Very rounded"
|
537 |
msgstr ""
|
538 |
|
539 |
-
#: widgets/button/button.php:
|
540 |
msgid "Completely rounded"
|
541 |
msgstr ""
|
542 |
|
543 |
-
#: widgets/button/button.php:
|
544 |
msgid "Padding"
|
545 |
msgstr ""
|
546 |
|
547 |
-
#: widgets/button/button.php:
|
548 |
msgid "Low"
|
549 |
msgstr ""
|
550 |
|
551 |
-
#: widgets/button/button.php:
|
552 |
msgid "High"
|
553 |
msgstr ""
|
554 |
|
555 |
-
#: widgets/button/button.php:
|
556 |
msgid "Very high"
|
557 |
msgstr ""
|
558 |
|
559 |
-
#: widgets/button/button.php:
|
560 |
msgid "Other attributes and SEO"
|
561 |
msgstr ""
|
562 |
|
563 |
-
#: widgets/button/button.php:
|
564 |
msgid "Button ID"
|
565 |
msgstr ""
|
566 |
|
567 |
-
#: widgets/button/button.php:
|
568 |
msgid "An ID attribute allows you to target this button in Javascript."
|
569 |
msgstr ""
|
570 |
|
571 |
-
#: widgets/button/button.php:
|
572 |
msgid "Button Classes"
|
573 |
msgstr ""
|
574 |
|
575 |
-
#: widgets/button/button.php:
|
576 |
msgid "Additional CSS classes added to the button link."
|
577 |
msgstr ""
|
578 |
|
579 |
-
#: widgets/button/button.php:
|
580 |
msgid "Title attribute"
|
581 |
msgstr ""
|
582 |
|
583 |
-
#: widgets/button/button.php:
|
584 |
msgid "Adds a title attribute to the button link."
|
585 |
msgstr ""
|
586 |
|
587 |
-
#: widgets/button/button.php:
|
588 |
msgid "Onclick"
|
589 |
msgstr ""
|
590 |
|
591 |
-
#: widgets/button/button.php:
|
592 |
msgid "Run this Javascript when the button is clicked. Ideal for tracking."
|
593 |
msgstr ""
|
594 |
|
595 |
-
#: widgets/button/button.php:
|
596 |
msgid "Rel attribute"
|
597 |
msgstr ""
|
598 |
|
599 |
-
#: widgets/button/button.php:
|
600 |
msgid "Adds a rel attribute to the button link."
|
601 |
msgstr ""
|
602 |
|
@@ -692,7 +692,7 @@ msgstr ""
|
|
692 |
msgid "List in contact emails, the IP address of the form sender."
|
693 |
msgstr ""
|
694 |
|
695 |
-
#: widgets/contact/contact.php:137, widgets/contact/contact.php:
|
696 |
msgid "Fields"
|
697 |
msgstr ""
|
698 |
|
@@ -720,7 +720,7 @@ msgstr ""
|
|
720 |
msgid "Phone Number"
|
721 |
msgstr ""
|
722 |
|
723 |
-
#: widgets/contact/contact.php:152, widgets/contact/contact.php:
|
724 |
msgid "Subject"
|
725 |
msgstr ""
|
726 |
|
@@ -760,7 +760,7 @@ msgstr ""
|
|
760 |
msgid "Required Field"
|
761 |
msgstr ""
|
762 |
|
763 |
-
#: widgets/contact/contact.php:182, widgets/contact/contact.php:
|
764 |
msgid "Required field"
|
765 |
msgstr ""
|
766 |
|
@@ -776,343 +776,343 @@ msgstr ""
|
|
776 |
msgid "Error message to display if this field is missing."
|
777 |
msgstr ""
|
778 |
|
779 |
-
#: widgets/contact/contact.php:
|
780 |
msgid "Options"
|
781 |
msgstr ""
|
782 |
|
783 |
-
#: widgets/contact/contact.php:
|
784 |
msgid "Option"
|
785 |
msgstr ""
|
786 |
|
787 |
-
#: widgets/contact/contact.php:
|
788 |
msgid "Value"
|
789 |
msgstr ""
|
790 |
|
791 |
-
#: widgets/contact/contact.php:
|
792 |
msgid "Spam Protection"
|
793 |
msgstr ""
|
794 |
|
795 |
-
#: widgets/contact/contact.php:
|
796 |
msgid "reCAPTCHA v2"
|
797 |
msgstr ""
|
798 |
|
799 |
-
#: widgets/contact/contact.php:
|
800 |
msgid "Use reCAPTCHA v2"
|
801 |
msgstr ""
|
802 |
|
803 |
-
#: widgets/contact/contact.php:
|
804 |
msgid "Please make sure you register a new reCAPTCHA v2 key %shere%s."
|
805 |
msgstr ""
|
806 |
|
807 |
-
#: widgets/contact/contact.php:
|
808 |
msgid "reCAPTCHA v2 Site Key"
|
809 |
msgstr ""
|
810 |
|
811 |
-
#: widgets/contact/contact.php:
|
812 |
msgid "reCAPTCHA v2 Secret Key"
|
813 |
msgstr ""
|
814 |
|
815 |
-
#: widgets/contact/contact.php:
|
816 |
msgid "Theme"
|
817 |
msgstr ""
|
818 |
|
819 |
-
#: widgets/contact/contact.php:
|
820 |
msgid "Light"
|
821 |
msgstr ""
|
822 |
|
823 |
-
#: widgets/contact/contact.php:
|
824 |
msgid "Dark"
|
825 |
msgstr ""
|
826 |
|
827 |
-
#: widgets/contact/contact.php:
|
828 |
msgid "Challenge type"
|
829 |
msgstr ""
|
830 |
|
831 |
-
#: widgets/contact/contact.php:
|
832 |
msgid "Image"
|
833 |
msgstr ""
|
834 |
|
835 |
-
#: widgets/contact/contact.php:
|
836 |
msgid "Audio"
|
837 |
msgstr ""
|
838 |
|
839 |
-
#: widgets/contact/contact.php:
|
840 |
msgid "Size"
|
841 |
msgstr ""
|
842 |
|
843 |
-
#: widgets/contact/contact.php:
|
844 |
msgid "Compact"
|
845 |
msgstr ""
|
846 |
|
847 |
-
#: widgets/contact/contact.php:
|
848 |
msgid "Akismet"
|
849 |
msgstr ""
|
850 |
|
851 |
-
#: widgets/contact/contact.php:
|
852 |
msgid "Use Akismet filtering"
|
853 |
msgstr ""
|
854 |
|
855 |
-
#: widgets/contact/contact.php:
|
856 |
msgid "Spam action"
|
857 |
msgstr ""
|
858 |
|
859 |
-
#: widgets/contact/contact.php:
|
860 |
msgid "Show error message"
|
861 |
msgstr ""
|
862 |
|
863 |
-
#: widgets/contact/contact.php:
|
864 |
msgid "Tag as spam in subject"
|
865 |
msgstr ""
|
866 |
|
867 |
-
#: widgets/contact/contact.php:
|
868 |
msgid "How to handle submissions that are identified as spam."
|
869 |
msgstr ""
|
870 |
|
871 |
-
#: widgets/contact/contact.php:
|
872 |
msgid "Container"
|
873 |
msgstr ""
|
874 |
|
875 |
-
#: widgets/contact/contact.php:
|
876 |
msgid "Border style"
|
877 |
msgstr ""
|
878 |
|
879 |
-
#: widgets/contact/contact.php:
|
880 |
msgid "Hidden"
|
881 |
msgstr ""
|
882 |
|
883 |
-
#: widgets/contact/contact.php:
|
884 |
msgid "Dotted"
|
885 |
msgstr ""
|
886 |
|
887 |
-
#: widgets/contact/contact.php:
|
888 |
msgid "Dashed"
|
889 |
msgstr ""
|
890 |
|
891 |
-
#: widgets/contact/contact.php:
|
892 |
msgid "Double"
|
893 |
msgstr ""
|
894 |
|
895 |
-
#: widgets/contact/contact.php:
|
896 |
msgid "Groove"
|
897 |
msgstr ""
|
898 |
|
899 |
-
#: widgets/contact/contact.php:
|
900 |
msgid "Ridge"
|
901 |
msgstr ""
|
902 |
|
903 |
-
#: widgets/contact/contact.php:
|
904 |
msgid "Inset"
|
905 |
msgstr ""
|
906 |
|
907 |
-
#: widgets/contact/contact.php:
|
908 |
msgid "Outset"
|
909 |
msgstr ""
|
910 |
|
911 |
-
#: widgets/contact/contact.php:
|
912 |
msgid "Field labels"
|
913 |
msgstr ""
|
914 |
|
915 |
-
#: widgets/contact/contact.php:
|
916 |
msgid "Color"
|
917 |
msgstr ""
|
918 |
|
919 |
-
#: widgets/contact/contact.php:
|
920 |
msgid "Position"
|
921 |
msgstr ""
|
922 |
|
923 |
-
#: widgets/contact/contact.php:
|
924 |
msgid "Above"
|
925 |
msgstr ""
|
926 |
|
927 |
-
#: widgets/contact/contact.php:
|
928 |
msgid "Below"
|
929 |
msgstr ""
|
930 |
|
931 |
-
#: widgets/contact/contact.php:
|
932 |
msgid "Inside"
|
933 |
msgstr ""
|
934 |
|
935 |
-
#: widgets/contact/contact.php:
|
936 |
msgid "Margin"
|
937 |
msgstr ""
|
938 |
|
939 |
-
#: widgets/contact/contact.php:
|
940 |
msgid "Max width"
|
941 |
msgstr ""
|
942 |
|
943 |
-
#: widgets/contact/contact.php:
|
944 |
msgid "Height"
|
945 |
msgstr ""
|
946 |
|
947 |
-
#: widgets/contact/contact.php:
|
948 |
msgid "Text area height"
|
949 |
msgstr ""
|
950 |
|
951 |
-
#: widgets/contact/contact.php:
|
952 |
msgid "Background"
|
953 |
msgstr ""
|
954 |
|
955 |
-
#: widgets/contact/contact.php:
|
956 |
msgid " Border style"
|
957 |
msgstr ""
|
958 |
|
959 |
-
#: widgets/contact/contact.php:
|
960 |
msgid "Border rounding"
|
961 |
msgstr ""
|
962 |
|
963 |
-
#: widgets/contact/contact.php:
|
964 |
msgid "Field descriptions"
|
965 |
msgstr ""
|
966 |
|
967 |
-
#: widgets/contact/contact.php:
|
968 |
msgid "Style"
|
969 |
msgstr ""
|
970 |
|
971 |
-
#: widgets/contact/contact.php:
|
972 |
msgid "Italic"
|
973 |
msgstr ""
|
974 |
|
975 |
-
#: widgets/contact/contact.php:
|
976 |
msgid "Error messages"
|
977 |
msgstr ""
|
978 |
|
979 |
-
#: widgets/contact/contact.php:
|
980 |
msgid "Error background color"
|
981 |
msgstr ""
|
982 |
|
983 |
-
#: widgets/contact/contact.php:
|
984 |
msgid "Error border color"
|
985 |
msgstr ""
|
986 |
|
987 |
-
#: widgets/contact/contact.php:
|
988 |
msgid "Error text color"
|
989 |
msgstr ""
|
990 |
|
991 |
-
#: widgets/contact/contact.php:
|
992 |
msgid "Error padding"
|
993 |
msgstr ""
|
994 |
|
995 |
-
#: widgets/contact/contact.php:
|
996 |
msgid "Error margin"
|
997 |
msgstr ""
|
998 |
|
999 |
-
#: widgets/contact/contact.php:
|
1000 |
msgid "Submit button"
|
1001 |
msgstr ""
|
1002 |
|
1003 |
-
#: widgets/contact/contact.php:
|
1004 |
msgid "Style submit button"
|
1005 |
msgstr ""
|
1006 |
|
1007 |
-
#: widgets/contact/contact.php:
|
1008 |
msgid "Style the button or leave it with default theme styling."
|
1009 |
msgstr ""
|
1010 |
|
1011 |
-
#: widgets/contact/contact.php:
|
1012 |
msgid "Gradient intensity"
|
1013 |
msgstr ""
|
1014 |
|
1015 |
-
#: widgets/contact/contact.php:
|
1016 |
msgid "Font weight"
|
1017 |
msgstr ""
|
1018 |
|
1019 |
-
#: widgets/contact/contact.php:
|
1020 |
msgid "Semi-bold"
|
1021 |
msgstr ""
|
1022 |
|
1023 |
-
#: widgets/contact/contact.php:
|
1024 |
msgid "Bold"
|
1025 |
msgstr ""
|
1026 |
|
1027 |
-
#: widgets/contact/contact.php:
|
1028 |
msgid "Inset highlight"
|
1029 |
msgstr ""
|
1030 |
|
1031 |
-
#: widgets/contact/contact.php:
|
1032 |
msgid "The white highlight at the bottom of the button"
|
1033 |
msgstr ""
|
1034 |
|
1035 |
-
#: widgets/contact/contact.php:
|
1036 |
msgid "Input focus"
|
1037 |
msgstr ""
|
1038 |
|
1039 |
-
#: widgets/contact/contact.php:
|
1040 |
msgid "Get more form fields for the Contact Form Widget in %s"
|
1041 |
msgstr ""
|
1042 |
|
1043 |
-
#: widgets/contact/contact.php:
|
1044 |
msgid "SiteOrigin Premium"
|
1045 |
msgstr ""
|
1046 |
|
1047 |
-
#: widgets/contact/contact.php:
|
1048 |
msgid "Your Name"
|
1049 |
msgstr ""
|
1050 |
|
1051 |
-
#: widgets/contact/contact.php:
|
1052 |
msgid "Please enter your name"
|
1053 |
msgstr ""
|
1054 |
|
1055 |
-
#: widgets/contact/contact.php:
|
1056 |
msgid "Your Email"
|
1057 |
msgstr ""
|
1058 |
|
1059 |
-
#: widgets/contact/contact.php:
|
1060 |
msgid "Please enter a valid email address"
|
1061 |
msgstr ""
|
1062 |
|
1063 |
-
#: widgets/contact/contact.php:
|
1064 |
msgid "Please enter a subject"
|
1065 |
msgstr ""
|
1066 |
|
1067 |
-
#: widgets/contact/contact.php:
|
1068 |
msgid "Message"
|
1069 |
msgstr ""
|
1070 |
|
1071 |
-
#: widgets/contact/contact.php:
|
1072 |
msgid "Please write something"
|
1073 |
msgstr ""
|
1074 |
|
1075 |
-
#: widgets/contact/contact.php:
|
1076 |
msgid "Responsive Breakpoint"
|
1077 |
msgstr ""
|
1078 |
|
1079 |
-
#: widgets/contact/contact.php:
|
1080 |
msgid "This setting controls when the field max width will be disabled. The default value is 780px"
|
1081 |
msgstr ""
|
1082 |
|
1083 |
-
#: widgets/contact/contact.php:
|
1084 |
msgid "Invalid email address."
|
1085 |
msgstr ""
|
1086 |
|
1087 |
-
#: widgets/contact/contact.php:
|
1088 |
msgid "Invalid phone number. It should contain at least three digits."
|
1089 |
msgstr ""
|
1090 |
|
1091 |
-
#: widgets/contact/contact.php:
|
1092 |
msgid "Error sending email, please try again later."
|
1093 |
msgstr ""
|
1094 |
|
1095 |
-
#: widgets/contact/contact.php:
|
1096 |
msgid "A valid email is required"
|
1097 |
msgstr ""
|
1098 |
|
1099 |
-
#: widgets/contact/contact.php:
|
1100 |
msgid "The email address is invalid"
|
1101 |
msgstr ""
|
1102 |
|
1103 |
-
#: widgets/contact/contact.php:
|
1104 |
msgid "Missing subject"
|
1105 |
msgstr ""
|
1106 |
|
1107 |
-
#: widgets/contact/contact.php:
|
1108 |
msgid "Error validating your Captcha response."
|
1109 |
msgstr ""
|
1110 |
|
1111 |
-
#: widgets/contact/contact.php:
|
1112 |
msgid "Unfortunately our system identified your message as spam."
|
1113 |
msgstr ""
|
1114 |
|
1115 |
-
#: widgets/contact/contact.php:
|
1116 |
msgctxt "The name of who sent this email"
|
1117 |
msgid "From"
|
1118 |
msgstr ""
|
@@ -1141,7 +1141,7 @@ msgstr ""
|
|
1141 |
msgid "Button align"
|
1142 |
msgstr ""
|
1143 |
|
1144 |
-
#: widgets/cta/cta.php:112, widgets/hero/hero.php:68, widgets/hero/hero.php:80
|
1145 |
msgid "Button"
|
1146 |
msgstr ""
|
1147 |
|
@@ -1161,7 +1161,7 @@ msgstr ""
|
|
1161 |
msgid "Enable the \"Automatically add paragraphs\" setting by default."
|
1162 |
msgstr ""
|
1163 |
|
1164 |
-
#: widgets/editor/editor.php:
|
1165 |
msgid "Use Google Fonts right inside the Editor Widget using %sSiteOrigin Premium%s"
|
1166 |
msgstr ""
|
1167 |
|
@@ -1205,7 +1205,7 @@ msgstr ""
|
|
1205 |
msgid "Icon image size"
|
1206 |
msgstr ""
|
1207 |
|
1208 |
-
#: widgets/features/features.php:109, widgets/image/image.php:
|
1209 |
msgid "Title text"
|
1210 |
msgstr ""
|
1211 |
|
@@ -1709,26 +1709,46 @@ msgid ""
|
|
1709 |
msgstr ""
|
1710 |
|
1711 |
#: widgets/google-map/google-map.php:493
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1712 |
msgid "Responsive breakpoint"
|
1713 |
msgstr ""
|
1714 |
|
1715 |
-
#: widgets/google-map/google-map.php:
|
1716 |
msgid "This setting controls when the map will use the mobile zoom. This breakpoint will only be used if a mobile zoom is set in the SiteOrigin Google Maps settings. The default value is 780px"
|
1717 |
msgstr ""
|
1718 |
|
1719 |
-
#: widgets/google-map/google-map.php:
|
1720 |
msgid "There were no results for the place you entered. Please try another."
|
1721 |
msgstr ""
|
1722 |
|
1723 |
-
#: widgets/google-map/google-map.php:
|
1724 |
msgid "Custom Map"
|
1725 |
msgstr ""
|
1726 |
|
1727 |
-
#: widgets/google-map/google-map.php:
|
1728 |
msgid "Get additional map consent design settings with %sSiteOrigin Premium%s"
|
1729 |
msgstr ""
|
1730 |
|
1731 |
-
#: widgets/google-map/google-map.php:
|
1732 |
msgid "Get a curated list of predefined map styles with %sSiteOrigin Premium%s"
|
1733 |
msgstr ""
|
1734 |
|
@@ -1876,7 +1896,7 @@ msgstr ""
|
|
1876 |
msgid "Design and Layout"
|
1877 |
msgstr ""
|
1878 |
|
1879 |
-
#: widgets/hero/hero.php:171, widgets/layout-slider/layout-slider.php:138
|
1880 |
msgid "Responsive Height"
|
1881 |
msgstr ""
|
1882 |
|
@@ -1976,43 +1996,43 @@ msgstr ""
|
|
1976 |
msgid "Image file"
|
1977 |
msgstr ""
|
1978 |
|
1979 |
-
#: widgets/image/image.php:
|
1980 |
msgid "Image alignment"
|
1981 |
msgstr ""
|
1982 |
|
1983 |
-
#: widgets/image/image.php:
|
1984 |
msgid "Title alignment"
|
1985 |
msgstr ""
|
1986 |
|
1987 |
-
#: widgets/image/image.php:
|
1988 |
msgid "Title position"
|
1989 |
msgstr ""
|
1990 |
|
1991 |
-
#: widgets/image/image.php:
|
1992 |
msgid "Alt text"
|
1993 |
msgstr ""
|
1994 |
|
1995 |
-
#: widgets/image/image.php:
|
1996 |
msgid "Open in new window"
|
1997 |
msgstr ""
|
1998 |
|
1999 |
-
#: widgets/image/image.php:
|
2000 |
msgid "Bound"
|
2001 |
msgstr ""
|
2002 |
|
2003 |
-
#: widgets/image/image.php:
|
2004 |
msgid "Make sure the image doesn't extend beyond its container."
|
2005 |
msgstr ""
|
2006 |
|
2007 |
-
#: widgets/image/image.php:
|
2008 |
msgid "Full Width"
|
2009 |
msgstr ""
|
2010 |
|
2011 |
-
#: widgets/image/image.php:
|
2012 |
msgid "Resize image to fit its container."
|
2013 |
msgstr ""
|
2014 |
|
2015 |
-
#: widgets/image/image.php:
|
2016 |
msgid "Add a Lightbox to your images with %sSiteOrigin Premium%s"
|
2017 |
msgstr ""
|
2018 |
|
@@ -2084,127 +2104,131 @@ msgstr ""
|
|
2084 |
msgid "This widget requires Page Builder."
|
2085 |
msgstr ""
|
2086 |
|
2087 |
-
#: widgets/post-carousel/post-carousel.php:4, widgets/post-carousel/post-carousel.php:
|
2088 |
msgid "Gives you a widget to display your posts as a carousel."
|
2089 |
msgstr ""
|
2090 |
|
2091 |
-
#: widgets/post-carousel/post-carousel.php:
|
2092 |
msgid "SiteOrigin Post Carousel"
|
2093 |
msgstr ""
|
2094 |
|
2095 |
-
#: widgets/post-carousel/post-carousel.php:
|
2096 |
msgid "Default Thumbnail"
|
2097 |
msgstr ""
|
2098 |
|
2099 |
-
#: widgets/post-carousel/post-carousel.php:
|
2100 |
msgid "Choose Thumbnail"
|
2101 |
msgstr ""
|
2102 |
|
2103 |
-
#: widgets/post-carousel/post-carousel.php:
|
2104 |
msgid "Set Thumbnail"
|
2105 |
msgstr ""
|
2106 |
|
2107 |
-
#: widgets/post-carousel/post-carousel.php:
|
2108 |
msgid "Featured Image size"
|
2109 |
msgstr ""
|
2110 |
|
2111 |
-
#: widgets/post-carousel/post-carousel.php:
|
2112 |
msgid "Link target"
|
2113 |
msgstr ""
|
2114 |
|
2115 |
-
#: widgets/post-carousel/post-carousel.php:
|
2116 |
msgid "Choose where to open each carousel item."
|
2117 |
msgstr ""
|
2118 |
|
2119 |
-
#: widgets/post-carousel/post-carousel.php:
|
2120 |
msgid "Same window "
|
2121 |
msgstr ""
|
2122 |
|
2123 |
-
#: widgets/post-carousel/post-carousel.php:
|
2124 |
msgid "New window "
|
2125 |
msgstr ""
|
2126 |
|
2127 |
-
#: widgets/post-carousel/post-carousel.php:
|
2128 |
msgid "Loop posts"
|
2129 |
msgstr ""
|
2130 |
|
2131 |
-
#: widgets/post-carousel/post-carousel.php:
|
2132 |
msgid "Automatically return to the first post after the last post."
|
2133 |
msgstr ""
|
2134 |
|
2135 |
-
#: widgets/post-carousel/post-carousel.php:
|
2136 |
msgid "Posts query"
|
2137 |
msgstr ""
|
2138 |
|
2139 |
-
#: widgets/post-carousel/post-carousel.php:
|
2140 |
msgid "Posts per load"
|
2141 |
msgstr ""
|
2142 |
|
2143 |
-
#: widgets/post-carousel/post-carousel.php:
|
2144 |
msgid "Set the number of posts preloaded in the background when clicking next. The default is 10."
|
2145 |
msgstr ""
|
2146 |
|
2147 |
-
#: widgets/post-carousel/post-carousel.php:
|
2148 |
msgid "Thumbnail overlay hover color"
|
2149 |
msgstr ""
|
2150 |
|
2151 |
-
#: widgets/post-carousel/post-carousel.php:
|
|
|
|
|
|
|
|
|
2152 |
msgid "Navigation arrow color"
|
2153 |
msgstr ""
|
2154 |
|
2155 |
-
#: widgets/post-carousel/post-carousel.php:
|
2156 |
msgid "Navigation arrow hover color"
|
2157 |
msgstr ""
|
2158 |
|
2159 |
-
#: widgets/post-carousel/post-carousel.php:
|
2160 |
msgid "Navigation background"
|
2161 |
msgstr ""
|
2162 |
|
2163 |
-
#: widgets/post-carousel/post-carousel.php:
|
2164 |
msgid "Navigation hover background"
|
2165 |
msgstr ""
|
2166 |
|
2167 |
-
#: widgets/post-carousel/post-carousel.php:
|
2168 |
msgid "Responsive"
|
2169 |
msgstr ""
|
2170 |
|
2171 |
-
#: widgets/post-carousel/post-carousel.php:
|
2172 |
msgid "Desktop"
|
2173 |
msgstr ""
|
2174 |
|
2175 |
-
#: widgets/post-carousel/post-carousel.php:
|
2176 |
msgid "Slides to scroll"
|
2177 |
msgstr ""
|
2178 |
|
2179 |
-
#: widgets/post-carousel/post-carousel.php:
|
2180 |
msgid "Set the number of slides to scroll per navigation click or swipe on desktop."
|
2181 |
msgstr ""
|
2182 |
|
2183 |
-
#: widgets/post-carousel/post-carousel.php:
|
2184 |
msgid "Tablet"
|
2185 |
msgstr ""
|
2186 |
|
2187 |
-
#: widgets/post-carousel/post-carousel.php:
|
2188 |
msgid "Landscape"
|
2189 |
msgstr ""
|
2190 |
|
2191 |
-
#: widgets/post-carousel/post-carousel.php:
|
2192 |
msgid "Breakpoint"
|
2193 |
msgstr ""
|
2194 |
|
2195 |
-
#: widgets/post-carousel/post-carousel.php:
|
2196 |
msgid "Set the number of slides to scroll per navigation click or swipe on tablet devices."
|
2197 |
msgstr ""
|
2198 |
|
2199 |
-
#: widgets/post-carousel/post-carousel.php:
|
2200 |
msgid "Portrait"
|
2201 |
msgstr ""
|
2202 |
|
2203 |
-
#: widgets/post-carousel/post-carousel.php:
|
2204 |
msgid "Mobile"
|
2205 |
msgstr ""
|
2206 |
|
2207 |
-
#: widgets/post-carousel/post-carousel.php:
|
2208 |
msgid " Set the number of slides to scroll per navigation click or swipe on mobile devices."
|
2209 |
msgstr ""
|
2210 |
|
@@ -2388,11 +2412,11 @@ msgstr ""
|
|
2388 |
msgid "Foreground image"
|
2389 |
msgstr ""
|
2390 |
|
2391 |
-
#: widgets/slider/slider.php:
|
2392 |
msgid "Controls"
|
2393 |
msgstr ""
|
2394 |
|
2395 |
-
#: widgets/slider/slider.php:
|
2396 |
msgid "Add a Lightbox to your image slides with %sSiteOrigin Premium%s"
|
2397 |
msgstr ""
|
2398 |
|
@@ -2649,18 +2673,22 @@ msgid "Autoplay"
|
|
2649 |
msgstr ""
|
2650 |
|
2651 |
#: widgets/video/video.php:106
|
|
|
|
|
|
|
|
|
2652 |
msgid "Use oEmbed"
|
2653 |
msgstr ""
|
2654 |
|
2655 |
-
#: widgets/video/video.php:
|
2656 |
msgid "Always use the embedded video rather than the MediaElement player."
|
2657 |
msgstr ""
|
2658 |
|
2659 |
-
#: widgets/video/video.php:
|
2660 |
msgid "Show related videos."
|
2661 |
msgstr ""
|
2662 |
|
2663 |
-
#: widgets/video/video.php:
|
2664 |
msgid "If the external host supports it."
|
2665 |
msgstr ""
|
2666 |
|
@@ -2668,7 +2696,7 @@ msgstr ""
|
|
2668 |
msgid "Search"
|
2669 |
msgstr ""
|
2670 |
|
2671 |
-
#: base/inc/fields/autocomplete.class.php:
|
2672 |
msgid "Close"
|
2673 |
msgstr ""
|
2674 |
|
@@ -2737,19 +2765,23 @@ msgstr ""
|
|
2737 |
msgid "Remove"
|
2738 |
msgstr ""
|
2739 |
|
2740 |
-
#: base/inc/fields/image-size.class.php:
|
2741 |
msgid "Full"
|
2742 |
msgstr ""
|
2743 |
|
2744 |
-
#: base/inc/fields/image-size.class.php:
|
2745 |
msgid "Thumbnail (Theme-defined)"
|
2746 |
msgstr ""
|
2747 |
|
2748 |
-
#: base/inc/fields/
|
|
|
|
|
|
|
|
|
2749 |
msgid "Select Content"
|
2750 |
msgstr ""
|
2751 |
|
2752 |
-
#: base/inc/fields/link.class.php:
|
2753 |
msgid "Search Content"
|
2754 |
msgstr ""
|
2755 |
|
@@ -3194,126 +3226,130 @@ msgid "deviantArt"
|
|
3194 |
msgstr ""
|
3195 |
|
3196 |
#: widgets/social-media-buttons/data/networks.php:152
|
3197 |
-
msgid "
|
3198 |
msgstr ""
|
3199 |
|
3200 |
#: widgets/social-media-buttons/data/networks.php:158
|
3201 |
-
msgid "
|
3202 |
msgstr ""
|
3203 |
|
3204 |
#: widgets/social-media-buttons/data/networks.php:164
|
3205 |
-
msgid "
|
3206 |
msgstr ""
|
3207 |
|
3208 |
#: widgets/social-media-buttons/data/networks.php:170
|
3209 |
-
msgid "
|
3210 |
msgstr ""
|
3211 |
|
3212 |
#: widgets/social-media-buttons/data/networks.php:176
|
3213 |
-
msgid "
|
3214 |
msgstr ""
|
3215 |
|
3216 |
#: widgets/social-media-buttons/data/networks.php:182
|
3217 |
-
msgid "
|
3218 |
msgstr ""
|
3219 |
|
3220 |
#: widgets/social-media-buttons/data/networks.php:188
|
3221 |
-
msgid "
|
3222 |
msgstr ""
|
3223 |
|
3224 |
#: widgets/social-media-buttons/data/networks.php:194
|
3225 |
-
msgid "
|
3226 |
msgstr ""
|
3227 |
|
3228 |
#: widgets/social-media-buttons/data/networks.php:200
|
3229 |
-
msgid "
|
3230 |
msgstr ""
|
3231 |
|
3232 |
#: widgets/social-media-buttons/data/networks.php:206
|
3233 |
-
msgid "
|
3234 |
msgstr ""
|
3235 |
|
3236 |
#: widgets/social-media-buttons/data/networks.php:212
|
3237 |
-
msgid "
|
3238 |
msgstr ""
|
3239 |
|
3240 |
#: widgets/social-media-buttons/data/networks.php:218
|
3241 |
-
msgid "
|
3242 |
msgstr ""
|
3243 |
|
3244 |
#: widgets/social-media-buttons/data/networks.php:224
|
3245 |
-
msgid "
|
3246 |
msgstr ""
|
3247 |
|
3248 |
#: widgets/social-media-buttons/data/networks.php:230
|
3249 |
-
msgid "
|
3250 |
msgstr ""
|
3251 |
|
3252 |
#: widgets/social-media-buttons/data/networks.php:236
|
3253 |
-
msgid "
|
3254 |
msgstr ""
|
3255 |
|
3256 |
#: widgets/social-media-buttons/data/networks.php:242
|
3257 |
-
msgid "Stack
|
3258 |
msgstr ""
|
3259 |
|
3260 |
#: widgets/social-media-buttons/data/networks.php:248
|
3261 |
-
msgid "
|
3262 |
msgstr ""
|
3263 |
|
3264 |
#: widgets/social-media-buttons/data/networks.php:254
|
3265 |
-
msgid "
|
3266 |
msgstr ""
|
3267 |
|
3268 |
#: widgets/social-media-buttons/data/networks.php:260
|
3269 |
-
msgid "
|
3270 |
msgstr ""
|
3271 |
|
3272 |
#: widgets/social-media-buttons/data/networks.php:266
|
3273 |
-
msgid "
|
3274 |
msgstr ""
|
3275 |
|
3276 |
#: widgets/social-media-buttons/data/networks.php:272
|
3277 |
-
msgid "
|
3278 |
msgstr ""
|
3279 |
|
3280 |
#: widgets/social-media-buttons/data/networks.php:278
|
3281 |
-
msgid "
|
3282 |
msgstr ""
|
3283 |
|
3284 |
#: widgets/social-media-buttons/data/networks.php:284
|
3285 |
-
msgid "
|
3286 |
msgstr ""
|
3287 |
|
3288 |
#: widgets/social-media-buttons/data/networks.php:290
|
3289 |
-
msgid "
|
3290 |
msgstr ""
|
3291 |
|
3292 |
#: widgets/social-media-buttons/data/networks.php:296
|
3293 |
-
msgid "
|
3294 |
msgstr ""
|
3295 |
|
3296 |
#: widgets/social-media-buttons/data/networks.php:302
|
3297 |
-
msgid "
|
3298 |
msgstr ""
|
3299 |
|
3300 |
#: widgets/social-media-buttons/data/networks.php:308
|
3301 |
-
msgid "
|
3302 |
msgstr ""
|
3303 |
|
3304 |
#: widgets/social-media-buttons/data/networks.php:314
|
3305 |
-
msgid "
|
3306 |
msgstr ""
|
3307 |
|
3308 |
#: widgets/social-media-buttons/data/networks.php:320
|
3309 |
-
msgid "
|
3310 |
msgstr ""
|
3311 |
|
3312 |
#: widgets/social-media-buttons/data/networks.php:326
|
3313 |
-
msgid "
|
3314 |
msgstr ""
|
3315 |
|
3316 |
#: widgets/social-media-buttons/data/networks.php:332
|
|
|
|
|
|
|
|
|
3317 |
msgid "YouTube"
|
3318 |
msgstr ""
|
3319 |
|
1 |
+
# Copyright (C) 2021 so-widgets-bundle
|
2 |
# This file is distributed under the same license as the so-widgets-bundle package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
36 |
msgid "https://siteorigin.com/widgets-bundle/"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: so-widgets-bundle.php:340, so-widgets-bundle.php:364, so-widgets-bundle.php:377, so-widgets-bundle.php:407, so-widgets-bundle.php:418, so-widgets-bundle.php:485, so-widgets-bundle.php:496, base/base.php:51, base/base.php:55, base/inc/actions.php:11, base/inc/actions.php:77, base/inc/actions.php:121, base/inc/actions.php:157, base/inc/actions.php:170, base/inc/actions.php:174, base/inc/actions.php:265, base/inc/actions.php:268
|
40 |
msgid "Invalid request."
|
41 |
msgstr ""
|
42 |
|
44 |
msgid "Insufficient permissions."
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: so-widgets-bundle.php:347, so-widgets-bundle.php:491, base/inc/actions.php:23
|
48 |
msgid "Invalid post."
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: so-widgets-bundle.php:435, so-widgets-bundle.php:436, compat/visual-composer/visual-composer.php:40
|
52 |
msgid "SiteOrigin Widgets"
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: so-widgets-bundle.php:461
|
56 |
msgid "%s was %s"
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: so-widgets-bundle.php:463
|
60 |
msgid "Activated"
|
61 |
msgstr ""
|
62 |
|
63 |
+
#: so-widgets-bundle.php:463
|
64 |
msgid "Deactivated"
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: so-widgets-bundle.php:726
|
68 |
msgid "Manage Widgets"
|
69 |
msgstr ""
|
70 |
|
71 |
+
#: so-widgets-bundle.php:727
|
72 |
msgid "Support"
|
73 |
msgstr ""
|
74 |
|
228 |
msgid "Clear"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: compat/beaver-builder/beaver-builder.php:68, widgets/google-map/google-map.php:290, widgets/image/image.php:48, widgets/image/image.php:60, base/inc/fields/posts.class.php:130
|
232 |
msgid "Default"
|
233 |
msgstr ""
|
234 |
|
252 |
msgid "You need to select a widget type before you'll see anything here. :)"
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: compat/block-editor/widget-block.php:144
|
256 |
msgid "Invalid widget class %s. Please make sure the widget has been activated in %sSiteOrigin Widgets%s."
|
257 |
msgstr ""
|
258 |
|
264 |
msgid "Allows you to add any active SiteOrigin Widgets Bundle widgets."
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: icons/fontawesome/filter.php:1471
|
268 |
msgid "Regular"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: icons/fontawesome/filter.php:1472, widgets/contact/contact.php:364, widgets/contact/contact.php:486, widgets/contact/contact.php:594, widgets/contact/contact.php:672, widgets/headline/headline.php:189
|
272 |
msgid "Solid"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: icons/fontawesome/filter.php:1473
|
276 |
msgid "Brands"
|
277 |
msgstr ""
|
278 |
|
292 |
msgid "When opening the panel, scroll the user to the top of the panel."
|
293 |
msgstr ""
|
294 |
|
295 |
+
#: widgets/accordion/accordion.php:71, widgets/accordion/accordion.php:84, widgets/contact/contact.php:48, widgets/cta/cta.php:64, widgets/editor/editor.php:35, widgets/features/features.php:136, widgets/icon/icon.php:68, widgets/post-carousel/post-carousel.php:159, widgets/price-table/price-table.php:42, widgets/price-table/price-table.php:61, widgets/simple-masonry/simple-masonry.php:44, widgets/simple-masonry/simple-masonry.php:85, widgets/social-media-buttons/social-media-buttons.php:54, widgets/tabs/tabs.php:71, widgets/tabs/tabs.php:84, widgets/taxonomy/taxonomy.php:34, widgets/testimonial/testimonial.php:41, widgets/video/video.php:33, base/inc/fields/posts.class.php:97
|
296 |
msgid "Title"
|
297 |
msgstr ""
|
298 |
|
324 |
msgid "Closed"
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: widgets/accordion/accordion.php:110, widgets/contact/contact.php:327, widgets/cta/cta.php:74, widgets/post-carousel/post-carousel.php:207, widgets/slider/slider.php:121, widgets/tabs/tabs.php:100, widgets/testimonial/testimonial.php:184
|
328 |
msgid "Design"
|
329 |
msgstr ""
|
330 |
|
332 |
msgid "Headings"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: widgets/accordion/accordion.php:120, widgets/accordion/accordion.php:158, widgets/contact/contact.php:337, widgets/contact/contact.php:575, widgets/cta/cta.php:78, widgets/hero/hero.php:122, widgets/layout-slider/layout-slider.php:90, widgets/social-media-buttons/social-media-buttons.php:86, widgets/tabs/tabs.php:110, widgets/tabs/tabs.php:130, widgets/tabs/tabs.php:174
|
336 |
msgid "Background color"
|
337 |
msgstr ""
|
338 |
|
348 |
msgid "Title hover color"
|
349 |
msgstr ""
|
350 |
|
351 |
+
#: widgets/accordion/accordion.php:139, widgets/accordion/accordion.php:167, widgets/contact/contact.php:347, widgets/contact/contact.php:469, widgets/contact/contact.php:585, widgets/cta/cta.php:82, widgets/tabs/tabs.php:115, widgets/tabs/tabs.php:149, widgets/tabs/tabs.php:183
|
352 |
msgid "Border color"
|
353 |
msgstr ""
|
354 |
|
356 |
msgid "Border hover color"
|
357 |
msgstr ""
|
358 |
|
359 |
+
#: widgets/accordion/accordion.php:147, widgets/accordion/accordion.php:171, widgets/contact/contact.php:352, widgets/contact/contact.php:474, widgets/contact/contact.php:601, widgets/tabs/tabs.php:119, widgets/tabs/tabs.php:159, widgets/tabs/tabs.php:187
|
360 |
msgid "Border width"
|
361 |
msgstr ""
|
362 |
|
384 |
msgid "Button text"
|
385 |
msgstr ""
|
386 |
|
387 |
+
#: widgets/button/button.php:51, widgets/google-map/google-map.php:103, widgets/headline/headline.php:47, widgets/headline/headline.php:118, widgets/hero/hero.php:128, widgets/icon/icon.php:57, widgets/image/image.php:90, widgets/layout-slider/layout-slider.php:96, widgets/simple-masonry/simple-masonry.php:89, widgets/slider/slider.php:103
|
388 |
msgid "Destination URL"
|
389 |
msgstr ""
|
390 |
|
391 |
+
#: widgets/button/button.php:58, widgets/google-map/google-map.php:114, widgets/headline/headline.php:52, widgets/headline/headline.php:123, widgets/icon/icon.php:63, widgets/simple-masonry/simple-masonry.php:94, widgets/social-media-buttons/social-media-buttons.php:97, widgets/taxonomy/taxonomy.php:65, widgets/testimonial/testimonial.php:94
|
392 |
msgid "Open in a new window"
|
393 |
msgstr ""
|
394 |
|
395 |
+
#: widgets/button/button.php:64
|
396 |
msgid "Download"
|
397 |
msgstr ""
|
398 |
|
399 |
+
#: widgets/button/button.php:65
|
400 |
msgid "The button destination URL will be downloaded when a user clicks on the button."
|
401 |
msgstr ""
|
402 |
|
403 |
+
#: widgets/button/button.php:70, widgets/button/button.php:74, widgets/features/features.php:78, widgets/icon/icon.php:31, widgets/price-table/price-table.php:119
|
404 |
msgid "Icon"
|
405 |
msgstr ""
|
406 |
|
407 |
+
#: widgets/button/button.php:79, widgets/features/features.php:88, widgets/price-table/price-table.php:123, widgets/social-media-buttons/social-media-buttons.php:82
|
408 |
msgid "Icon color"
|
409 |
msgstr ""
|
410 |
|
411 |
+
#: widgets/button/button.php:84
|
412 |
msgid "Image icon"
|
413 |
msgstr ""
|
414 |
|
415 |
+
#: widgets/button/button.php:85
|
416 |
msgid "Replaces the icon with your own image icon."
|
417 |
msgstr ""
|
418 |
|
419 |
+
#: widgets/button/button.php:90
|
420 |
msgid "Icon Placement"
|
421 |
msgstr ""
|
422 |
|
423 |
+
#: widgets/button/button.php:93, widgets/features/features.php:66
|
424 |
msgid "Top"
|
425 |
msgstr ""
|
426 |
|
427 |
+
#: widgets/button/button.php:94, widgets/button/button.php:120, widgets/contact/contact.php:402, widgets/contact/contact.php:417, widgets/contact/contact.php:646, widgets/cta/cta.php:103, widgets/features/features.php:67, widgets/headline/headline.php:92, widgets/headline/headline.php:163, widgets/headline/headline.php:218, widgets/icon/icon.php:50, widgets/image/image.php:50, widgets/image/image.php:62, widgets/simple-masonry/simple-masonry.php:216, widgets/social-media-buttons/social-media-buttons.php:153, widgets/social-media-buttons/social-media-buttons.php:164, widgets/testimonial/testimonial.php:256
|
428 |
msgid "Right"
|
429 |
msgstr ""
|
430 |
|
431 |
+
#: widgets/button/button.php:95, widgets/features/features.php:68
|
432 |
msgid "Bottom"
|
433 |
msgstr ""
|
434 |
|
435 |
+
#: widgets/button/button.php:96, widgets/button/button.php:119, widgets/contact/contact.php:401, widgets/contact/contact.php:416, widgets/contact/contact.php:645, widgets/cta/cta.php:102, widgets/features/features.php:69, widgets/headline/headline.php:91, widgets/headline/headline.php:162, widgets/headline/headline.php:217, widgets/icon/icon.php:49, widgets/image/image.php:49, widgets/image/image.php:61, widgets/simple-masonry/simple-masonry.php:215, widgets/social-media-buttons/social-media-buttons.php:152, widgets/social-media-buttons/social-media-buttons.php:163, widgets/testimonial/testimonial.php:255
|
436 |
msgid "Left"
|
437 |
msgstr ""
|
438 |
|
439 |
+
#: widgets/button/button.php:104, widgets/social-media-buttons/social-media-buttons.php:92
|
440 |
msgid "Design and layout"
|
441 |
msgstr ""
|
442 |
|
443 |
+
#: widgets/button/button.php:110, widgets/contact/contact.php:408, widgets/contact/contact.php:638, widgets/contact/contact.php:689, widgets/google-map/google-map.php:94, base/inc/fields/image-size.class.php:57
|
444 |
msgid "Width"
|
445 |
msgstr ""
|
446 |
|
447 |
+
#: widgets/button/button.php:111
|
448 |
msgid "Leave blank to let the button resize according to content."
|
449 |
msgstr ""
|
450 |
|
451 |
+
#: widgets/button/button.php:116, widgets/contact/contact.php:413, widgets/contact/contact.php:642, widgets/social-media-buttons/social-media-buttons.php:149
|
452 |
msgid "Align"
|
453 |
msgstr ""
|
454 |
|
455 |
+
#: widgets/button/button.php:121, widgets/contact/contact.php:418, widgets/contact/contact.php:647, widgets/headline/headline.php:90, widgets/headline/headline.php:161, widgets/headline/headline.php:216, widgets/icon/icon.php:48, widgets/image/image.php:51, widgets/image/image.php:63, widgets/social-media-buttons/social-media-buttons.php:154, widgets/social-media-buttons/social-media-buttons.php:165
|
456 |
msgid "Center"
|
457 |
msgstr ""
|
458 |
|
459 |
+
#: widgets/button/button.php:122, widgets/contact/contact.php:419, widgets/headline/headline.php:93, widgets/headline/headline.php:164, widgets/social-media-buttons/social-media-buttons.php:155, widgets/social-media-buttons/social-media-buttons.php:166
|
460 |
msgid "Justify"
|
461 |
msgstr ""
|
462 |
|
463 |
+
#: widgets/button/button.php:128, widgets/social-media-buttons/social-media-buttons.php:102
|
464 |
msgid "Button theme"
|
465 |
msgstr ""
|
466 |
|
467 |
+
#: widgets/button/button.php:131, widgets/price-table/price-table.php:134, widgets/social-media-buttons/social-media-buttons.php:105
|
468 |
msgid "Atom"
|
469 |
msgstr ""
|
470 |
|
471 |
+
#: widgets/button/button.php:132, widgets/social-media-buttons/social-media-buttons.php:106
|
472 |
msgid "Flat"
|
473 |
msgstr ""
|
474 |
|
475 |
+
#: widgets/button/button.php:133, widgets/social-media-buttons/social-media-buttons.php:107
|
476 |
msgid "Wire"
|
477 |
msgstr ""
|
478 |
|
479 |
+
#: widgets/button/button.php:140, widgets/price-table/price-table.php:150
|
480 |
msgid "Button color"
|
481 |
msgstr ""
|
482 |
|
483 |
+
#: widgets/button/button.php:145, widgets/contact/contact.php:440, widgets/contact/contact.php:613, widgets/hero/hero.php:261, widgets/layout-slider/layout-slider.php:206, widgets/testimonial/testimonial.php:227
|
484 |
msgid "Text color"
|
485 |
msgstr ""
|
486 |
|
487 |
+
#: widgets/button/button.php:151, widgets/social-media-buttons/social-media-buttons.php:112
|
488 |
msgid "Use hover effects"
|
489 |
msgstr ""
|
490 |
|
491 |
+
#: widgets/button/button.php:163
|
492 |
msgid "Hover background color"
|
493 |
msgstr ""
|
494 |
|
495 |
+
#: widgets/button/button.php:172
|
496 |
msgid "Hover text color"
|
497 |
msgstr ""
|
498 |
|
499 |
+
#: widgets/button/button.php:182, widgets/contact/contact.php:381, widgets/contact/contact.php:431, widgets/features/features.php:141, widgets/features/features.php:162, widgets/features/features.php:183, widgets/headline/headline.php:78, widgets/headline/headline.php:149
|
500 |
msgid "Font"
|
501 |
msgstr ""
|
502 |
|
503 |
+
#: widgets/button/button.php:188, widgets/contact/contact.php:386, widgets/contact/contact.php:436, widgets/contact/contact.php:618
|
504 |
msgid "Font size"
|
505 |
msgstr ""
|
506 |
|
507 |
+
#: widgets/button/button.php:190, widgets/contact/contact.php:290, widgets/contact/contact.php:524, widgets/contact/contact.php:626, widgets/social-media-buttons/social-media-buttons.php:119
|
508 |
msgid "Normal"
|
509 |
msgstr ""
|
510 |
|
511 |
+
#: widgets/button/button.php:191, widgets/button/button.php:215, widgets/social-media-buttons/social-media-buttons.php:120, widgets/social-media-buttons/social-media-buttons.php:142, widgets/social-media-buttons/social-media-buttons.php:175, base/inc/widgets/base-slider.class.php:106
|
512 |
msgid "Medium"
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: widgets/button/button.php:192, widgets/social-media-buttons/social-media-buttons.php:121
|
516 |
msgid "Large"
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: widgets/button/button.php:193, widgets/social-media-buttons/social-media-buttons.php:122
|
520 |
msgid "Extra large"
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: widgets/button/button.php:199, widgets/social-media-buttons/social-media-buttons.php:127
|
524 |
msgid "Rounding"
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: widgets/button/button.php:202, widgets/contact/contact.php:360, widgets/contact/contact.php:482, widgets/contact/contact.php:593, widgets/contact/contact.php:678, widgets/google-map/google-map.php:158, widgets/headline/headline.php:188, widgets/social-media-buttons/social-media-buttons.php:130
|
528 |
msgid "None"
|
529 |
msgstr ""
|
530 |
|
531 |
+
#: widgets/button/button.php:203, widgets/social-media-buttons/social-media-buttons.php:131
|
532 |
msgid "Slightly rounded"
|
533 |
msgstr ""
|
534 |
|
535 |
+
#: widgets/button/button.php:204, widgets/social-media-buttons/social-media-buttons.php:132
|
536 |
msgid "Very rounded"
|
537 |
msgstr ""
|
538 |
|
539 |
+
#: widgets/button/button.php:205, widgets/social-media-buttons/social-media-buttons.php:133
|
540 |
msgid "Completely rounded"
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: widgets/button/button.php:211, widgets/contact/contact.php:342, widgets/contact/contact.php:448, widgets/contact/contact.php:633, widgets/social-media-buttons/social-media-buttons.php:138, widgets/testimonial/testimonial.php:235
|
544 |
msgid "Padding"
|
545 |
msgstr ""
|
546 |
|
547 |
+
#: widgets/button/button.php:214, widgets/social-media-buttons/social-media-buttons.php:141, widgets/social-media-buttons/social-media-buttons.php:174
|
548 |
msgid "Low"
|
549 |
msgstr ""
|
550 |
|
551 |
+
#: widgets/button/button.php:216, widgets/social-media-buttons/social-media-buttons.php:143, widgets/social-media-buttons/social-media-buttons.php:176
|
552 |
msgid "High"
|
553 |
msgstr ""
|
554 |
|
555 |
+
#: widgets/button/button.php:217, widgets/social-media-buttons/social-media-buttons.php:144, widgets/social-media-buttons/social-media-buttons.php:177
|
556 |
msgid "Very high"
|
557 |
msgstr ""
|
558 |
|
559 |
+
#: widgets/button/button.php:226
|
560 |
msgid "Other attributes and SEO"
|
561 |
msgstr ""
|
562 |
|
563 |
+
#: widgets/button/button.php:231, widgets/contact/contact.php:97
|
564 |
msgid "Button ID"
|
565 |
msgstr ""
|
566 |
|
567 |
+
#: widgets/button/button.php:232
|
568 |
msgid "An ID attribute allows you to target this button in Javascript."
|
569 |
msgstr ""
|
570 |
|
571 |
+
#: widgets/button/button.php:237
|
572 |
msgid "Button Classes"
|
573 |
msgstr ""
|
574 |
|
575 |
+
#: widgets/button/button.php:238
|
576 |
msgid "Additional CSS classes added to the button link."
|
577 |
msgstr ""
|
578 |
|
579 |
+
#: widgets/button/button.php:243
|
580 |
msgid "Title attribute"
|
581 |
msgstr ""
|
582 |
|
583 |
+
#: widgets/button/button.php:244
|
584 |
msgid "Adds a title attribute to the button link."
|
585 |
msgstr ""
|
586 |
|
587 |
+
#: widgets/button/button.php:249, widgets/contact/contact.php:102
|
588 |
msgid "Onclick"
|
589 |
msgstr ""
|
590 |
|
591 |
+
#: widgets/button/button.php:250
|
592 |
msgid "Run this Javascript when the button is clicked. Ideal for tracking."
|
593 |
msgstr ""
|
594 |
|
595 |
+
#: widgets/button/button.php:255
|
596 |
msgid "Rel attribute"
|
597 |
msgstr ""
|
598 |
|
599 |
+
#: widgets/button/button.php:256
|
600 |
msgid "Adds a rel attribute to the button link."
|
601 |
msgstr ""
|
602 |
|
692 |
msgid "List in contact emails, the IP address of the form sender."
|
693 |
msgstr ""
|
694 |
|
695 |
+
#: widgets/contact/contact.php:137, widgets/contact/contact.php:427
|
696 |
msgid "Fields"
|
697 |
msgstr ""
|
698 |
|
720 |
msgid "Phone Number"
|
721 |
msgstr ""
|
722 |
|
723 |
+
#: widgets/contact/contact.php:152, widgets/contact/contact.php:754
|
724 |
msgid "Subject"
|
725 |
msgstr ""
|
726 |
|
760 |
msgid "Required Field"
|
761 |
msgstr ""
|
762 |
|
763 |
+
#: widgets/contact/contact.php:182, widgets/contact/contact.php:189, widgets/contact/contact.php:1071
|
764 |
msgid "Required field"
|
765 |
msgstr ""
|
766 |
|
776 |
msgid "Error message to display if this field is missing."
|
777 |
msgstr ""
|
778 |
|
779 |
+
#: widgets/contact/contact.php:197
|
780 |
msgid "Options"
|
781 |
msgstr ""
|
782 |
|
783 |
+
#: widgets/contact/contact.php:198
|
784 |
msgid "Option"
|
785 |
msgstr ""
|
786 |
|
787 |
+
#: widgets/contact/contact.php:203
|
788 |
msgid "Value"
|
789 |
msgstr ""
|
790 |
|
791 |
+
#: widgets/contact/contact.php:218
|
792 |
msgid "Spam Protection"
|
793 |
msgstr ""
|
794 |
|
795 |
+
#: widgets/contact/contact.php:224
|
796 |
msgid "reCAPTCHA v2"
|
797 |
msgstr ""
|
798 |
|
799 |
+
#: widgets/contact/contact.php:228
|
800 |
msgid "Use reCAPTCHA v2"
|
801 |
msgstr ""
|
802 |
|
803 |
+
#: widgets/contact/contact.php:231
|
804 |
msgid "Please make sure you register a new reCAPTCHA v2 key %shere%s."
|
805 |
msgstr ""
|
806 |
|
807 |
+
#: widgets/contact/contact.php:245
|
808 |
msgid "reCAPTCHA v2 Site Key"
|
809 |
msgstr ""
|
810 |
|
811 |
+
#: widgets/contact/contact.php:253
|
812 |
msgid "reCAPTCHA v2 Secret Key"
|
813 |
msgstr ""
|
814 |
|
815 |
+
#: widgets/contact/contact.php:261
|
816 |
msgid "Theme"
|
817 |
msgstr ""
|
818 |
|
819 |
+
#: widgets/contact/contact.php:264
|
820 |
msgid "Light"
|
821 |
msgstr ""
|
822 |
|
823 |
+
#: widgets/contact/contact.php:265
|
824 |
msgid "Dark"
|
825 |
msgstr ""
|
826 |
|
827 |
+
#: widgets/contact/contact.php:274
|
828 |
msgid "Challenge type"
|
829 |
msgstr ""
|
830 |
|
831 |
+
#: widgets/contact/contact.php:277, widgets/image-grid/image-grid.php:53, widgets/image-grid/image-grid.php:69, widgets/price-table/price-table.php:70, widgets/simple-masonry/simple-masonry.php:64, widgets/testimonial/testimonial.php:72, widgets/testimonial/testimonial.php:189
|
832 |
msgid "Image"
|
833 |
msgstr ""
|
834 |
|
835 |
+
#: widgets/contact/contact.php:278
|
836 |
msgid "Audio"
|
837 |
msgstr ""
|
838 |
|
839 |
+
#: widgets/contact/contact.php:287, widgets/contact/contact.php:510, widgets/features/features.php:146, widgets/features/features.php:167, widgets/features/features.php:188, widgets/icon/icon.php:41
|
840 |
msgid "Size"
|
841 |
msgstr ""
|
842 |
|
843 |
+
#: widgets/contact/contact.php:291
|
844 |
msgid "Compact"
|
845 |
msgstr ""
|
846 |
|
847 |
+
#: widgets/contact/contact.php:303
|
848 |
msgid "Akismet"
|
849 |
msgstr ""
|
850 |
|
851 |
+
#: widgets/contact/contact.php:307
|
852 |
msgid "Use Akismet filtering"
|
853 |
msgstr ""
|
854 |
|
855 |
+
#: widgets/contact/contact.php:312
|
856 |
msgid "Spam action"
|
857 |
msgstr ""
|
858 |
|
859 |
+
#: widgets/contact/contact.php:314
|
860 |
msgid "Show error message"
|
861 |
msgstr ""
|
862 |
|
863 |
+
#: widgets/contact/contact.php:315
|
864 |
msgid "Tag as spam in subject"
|
865 |
msgstr ""
|
866 |
|
867 |
+
#: widgets/contact/contact.php:317
|
868 |
msgid "How to handle submissions that are identified as spam."
|
869 |
msgstr ""
|
870 |
|
871 |
+
#: widgets/contact/contact.php:333
|
872 |
msgid "Container"
|
873 |
msgstr ""
|
874 |
|
875 |
+
#: widgets/contact/contact.php:357, widgets/contact/contact.php:590
|
876 |
msgid "Border style"
|
877 |
msgstr ""
|
878 |
|
879 |
+
#: widgets/contact/contact.php:361, widgets/contact/contact.php:483, widgets/contact/contact.php:679, widgets/image/image.php:77
|
880 |
msgid "Hidden"
|
881 |
msgstr ""
|
882 |
|
883 |
+
#: widgets/contact/contact.php:362, widgets/contact/contact.php:484, widgets/contact/contact.php:595, widgets/contact/contact.php:670, widgets/headline/headline.php:190
|
884 |
msgid "Dotted"
|
885 |
msgstr ""
|
886 |
|
887 |
+
#: widgets/contact/contact.php:363, widgets/contact/contact.php:485, widgets/contact/contact.php:596, widgets/contact/contact.php:671, widgets/headline/headline.php:191
|
888 |
msgid "Dashed"
|
889 |
msgstr ""
|
890 |
|
891 |
+
#: widgets/contact/contact.php:365, widgets/contact/contact.php:487, widgets/contact/contact.php:673, widgets/headline/headline.php:192
|
892 |
msgid "Double"
|
893 |
msgstr ""
|
894 |
|
895 |
+
#: widgets/contact/contact.php:366, widgets/contact/contact.php:488, widgets/contact/contact.php:674, widgets/headline/headline.php:193
|
896 |
msgid "Groove"
|
897 |
msgstr ""
|
898 |
|
899 |
+
#: widgets/contact/contact.php:367, widgets/contact/contact.php:489, widgets/contact/contact.php:675, widgets/headline/headline.php:194
|
900 |
msgid "Ridge"
|
901 |
msgstr ""
|
902 |
|
903 |
+
#: widgets/contact/contact.php:368, widgets/contact/contact.php:490, widgets/contact/contact.php:676, widgets/headline/headline.php:195
|
904 |
msgid "Inset"
|
905 |
msgstr ""
|
906 |
|
907 |
+
#: widgets/contact/contact.php:369, widgets/contact/contact.php:491, widgets/contact/contact.php:677, widgets/headline/headline.php:196
|
908 |
msgid "Outset"
|
909 |
msgstr ""
|
910 |
|
911 |
+
#: widgets/contact/contact.php:377
|
912 |
msgid "Field labels"
|
913 |
msgstr ""
|
914 |
|
915 |
+
#: widgets/contact/contact.php:391, widgets/contact/contact.php:515, widgets/contact/contact.php:684, widgets/features/features.php:150, widgets/features/features.php:171, widgets/features/features.php:192, widgets/google-map/google-map.php:368, widgets/headline/headline.php:70, widgets/headline/headline.php:141, widgets/headline/headline.php:201, widgets/icon/icon.php:36, widgets/taxonomy/taxonomy.php:56
|
916 |
msgid "Color"
|
917 |
msgstr ""
|
918 |
|
919 |
+
#: widgets/contact/contact.php:396
|
920 |
msgid "Position"
|
921 |
msgstr ""
|
922 |
|
923 |
+
#: widgets/contact/contact.php:399, widgets/image/image.php:78
|
924 |
msgid "Above"
|
925 |
msgstr ""
|
926 |
|
927 |
+
#: widgets/contact/contact.php:400, widgets/image/image.php:79
|
928 |
msgid "Below"
|
929 |
msgstr ""
|
930 |
|
931 |
+
#: widgets/contact/contact.php:403
|
932 |
msgid "Inside"
|
933 |
msgstr ""
|
934 |
|
935 |
+
#: widgets/contact/contact.php:444, widgets/social-media-buttons/social-media-buttons.php:171
|
936 |
msgid "Margin"
|
937 |
msgstr ""
|
938 |
|
939 |
+
#: widgets/contact/contact.php:452
|
940 |
msgid "Max width"
|
941 |
msgstr ""
|
942 |
|
943 |
+
#: widgets/contact/contact.php:457, widgets/google-map/google-map.php:98, widgets/hero/hero.php:165, widgets/layout-slider/layout-slider.php:133, widgets/slider/slider.php:129, base/inc/fields/image-size.class.php:64
|
944 |
msgid "Height"
|
945 |
msgstr ""
|
946 |
|
947 |
+
#: widgets/contact/contact.php:461
|
948 |
msgid "Text area height"
|
949 |
msgstr ""
|
950 |
|
951 |
+
#: widgets/contact/contact.php:465, widgets/hero/hero.php:89, widgets/layout-slider/layout-slider.php:61
|
952 |
msgid "Background"
|
953 |
msgstr ""
|
954 |
|
955 |
+
#: widgets/contact/contact.php:479
|
956 |
msgid " Border style"
|
957 |
msgstr ""
|
958 |
|
959 |
+
#: widgets/contact/contact.php:496, widgets/contact/contact.php:606
|
960 |
msgid "Border rounding"
|
961 |
msgstr ""
|
962 |
|
963 |
+
#: widgets/contact/contact.php:506
|
964 |
msgid "Field descriptions"
|
965 |
msgstr ""
|
966 |
|
967 |
+
#: widgets/contact/contact.php:520, widgets/contact/contact.php:667, widgets/google-map/google-map.php:321, widgets/headline/headline.php:185
|
968 |
msgid "Style"
|
969 |
msgstr ""
|
970 |
|
971 |
+
#: widgets/contact/contact.php:523
|
972 |
msgid "Italic"
|
973 |
msgstr ""
|
974 |
|
975 |
+
#: widgets/contact/contact.php:532
|
976 |
msgid "Error messages"
|
977 |
msgstr ""
|
978 |
|
979 |
+
#: widgets/contact/contact.php:536
|
980 |
msgid "Error background color"
|
981 |
msgstr ""
|
982 |
|
983 |
+
#: widgets/contact/contact.php:541
|
984 |
msgid "Error border color"
|
985 |
msgstr ""
|
986 |
|
987 |
+
#: widgets/contact/contact.php:546
|
988 |
msgid "Error text color"
|
989 |
msgstr ""
|
990 |
|
991 |
+
#: widgets/contact/contact.php:551
|
992 |
msgid "Error padding"
|
993 |
msgstr ""
|
994 |
|
995 |
+
#: widgets/contact/contact.php:556
|
996 |
msgid "Error margin"
|
997 |
msgstr ""
|
998 |
|
999 |
+
#: widgets/contact/contact.php:564
|
1000 |
msgid "Submit button"
|
1001 |
msgstr ""
|
1002 |
|
1003 |
+
#: widgets/contact/contact.php:568
|
1004 |
msgid "Style submit button"
|
1005 |
msgstr ""
|
1006 |
|
1007 |
+
#: widgets/contact/contact.php:569
|
1008 |
msgid "Style the button or leave it with default theme styling."
|
1009 |
msgstr ""
|
1010 |
|
1011 |
+
#: widgets/contact/contact.php:580
|
1012 |
msgid "Gradient intensity"
|
1013 |
msgstr ""
|
1014 |
|
1015 |
+
#: widgets/contact/contact.php:623
|
1016 |
msgid "Font weight"
|
1017 |
msgstr ""
|
1018 |
|
1019 |
+
#: widgets/contact/contact.php:627
|
1020 |
msgid "Semi-bold"
|
1021 |
msgstr ""
|
1022 |
|
1023 |
+
#: widgets/contact/contact.php:628
|
1024 |
msgid "Bold"
|
1025 |
msgstr ""
|
1026 |
|
1027 |
+
#: widgets/contact/contact.php:652
|
1028 |
msgid "Inset highlight"
|
1029 |
msgstr ""
|
1030 |
|
1031 |
+
#: widgets/contact/contact.php:653
|
1032 |
msgid "The white highlight at the bottom of the button"
|
1033 |
msgstr ""
|
1034 |
|
1035 |
+
#: widgets/contact/contact.php:663
|
1036 |
msgid "Input focus"
|
1037 |
msgstr ""
|
1038 |
|
1039 |
+
#: widgets/contact/contact.php:710
|
1040 |
msgid "Get more form fields for the Contact Form Widget in %s"
|
1041 |
msgstr ""
|
1042 |
|
1043 |
+
#: widgets/contact/contact.php:711
|
1044 |
msgid "SiteOrigin Premium"
|
1045 |
msgstr ""
|
1046 |
|
1047 |
+
#: widgets/contact/contact.php:738
|
1048 |
msgid "Your Name"
|
1049 |
msgstr ""
|
1050 |
|
1051 |
+
#: widgets/contact/contact.php:741
|
1052 |
msgid "Please enter your name"
|
1053 |
msgstr ""
|
1054 |
|
1055 |
+
#: widgets/contact/contact.php:746
|
1056 |
msgid "Your Email"
|
1057 |
msgstr ""
|
1058 |
|
1059 |
+
#: widgets/contact/contact.php:749
|
1060 |
msgid "Please enter a valid email address"
|
1061 |
msgstr ""
|
1062 |
|
1063 |
+
#: widgets/contact/contact.php:757
|
1064 |
msgid "Please enter a subject"
|
1065 |
msgstr ""
|
1066 |
|
1067 |
+
#: widgets/contact/contact.php:762
|
1068 |
msgid "Message"
|
1069 |
msgstr ""
|
1070 |
|
1071 |
+
#: widgets/contact/contact.php:765
|
1072 |
msgid "Please write something"
|
1073 |
msgstr ""
|
1074 |
|
1075 |
+
#: widgets/contact/contact.php:800, widgets/features/features.php:320, widgets/social-media-buttons/social-media-buttons.php:33, base/inc/widgets/base-slider.class.php:180
|
1076 |
msgid "Responsive Breakpoint"
|
1077 |
msgstr ""
|
1078 |
|
1079 |
+
#: widgets/contact/contact.php:802
|
1080 |
msgid "This setting controls when the field max width will be disabled. The default value is 780px"
|
1081 |
msgstr ""
|
1082 |
|
1083 |
+
#: widgets/contact/contact.php:1083
|
1084 |
msgid "Invalid email address."
|
1085 |
msgstr ""
|
1086 |
|
1087 |
+
#: widgets/contact/contact.php:1108
|
1088 |
msgid "Invalid phone number. It should contain at least three digits."
|
1089 |
msgstr ""
|
1090 |
|
1091 |
+
#: widgets/contact/contact.php:1177
|
1092 |
msgid "Error sending email, please try again later."
|
1093 |
msgstr ""
|
1094 |
|
1095 |
+
#: widgets/contact/contact.php:1203
|
1096 |
msgid "A valid email is required"
|
1097 |
msgstr ""
|
1098 |
|
1099 |
+
#: widgets/contact/contact.php:1205
|
1100 |
msgid "The email address is invalid"
|
1101 |
msgstr ""
|
1102 |
|
1103 |
+
#: widgets/contact/contact.php:1209
|
1104 |
msgid "Missing subject"
|
1105 |
msgstr ""
|
1106 |
|
1107 |
+
#: widgets/contact/contact.php:1243
|
1108 |
msgid "Error validating your Captcha response."
|
1109 |
msgstr ""
|
1110 |
|
1111 |
+
#: widgets/contact/contact.php:1275
|
1112 |
msgid "Unfortunately our system identified your message as spam."
|
1113 |
msgstr ""
|
1114 |
|
1115 |
+
#: widgets/contact/contact.php:1283
|
1116 |
msgctxt "The name of who sent this email"
|
1117 |
msgid "From"
|
1118 |
msgstr ""
|
1141 |
msgid "Button align"
|
1142 |
msgstr ""
|
1143 |
|
1144 |
+
#: widgets/cta/cta.php:112, widgets/google-map/google-map.php:498, widgets/hero/hero.php:68, widgets/hero/hero.php:80
|
1145 |
msgid "Button"
|
1146 |
msgstr ""
|
1147 |
|
1161 |
msgid "Enable the \"Automatically add paragraphs\" setting by default."
|
1162 |
msgstr ""
|
1163 |
|
1164 |
+
#: widgets/editor/editor.php:171
|
1165 |
msgid "Use Google Fonts right inside the Editor Widget using %sSiteOrigin Premium%s"
|
1166 |
msgstr ""
|
1167 |
|
1205 |
msgid "Icon image size"
|
1206 |
msgstr ""
|
1207 |
|
1208 |
+
#: widgets/features/features.php:109, widgets/image/image.php:69
|
1209 |
msgid "Title text"
|
1210 |
msgstr ""
|
1211 |
|
1709 |
msgstr ""
|
1710 |
|
1711 |
#: widgets/google-map/google-map.php:493
|
1712 |
+
msgid "Consent prompt design"
|
1713 |
+
msgstr ""
|
1714 |
+
|
1715 |
+
#: widgets/google-map/google-map.php:503
|
1716 |
+
msgid "Consent prompt button text color"
|
1717 |
+
msgstr ""
|
1718 |
+
|
1719 |
+
#: widgets/google-map/google-map.php:508
|
1720 |
+
msgid "Consent prompt button text hover color"
|
1721 |
+
msgstr ""
|
1722 |
+
|
1723 |
+
#: widgets/google-map/google-map.php:512
|
1724 |
+
msgid "Consent prompt button background color"
|
1725 |
+
msgstr ""
|
1726 |
+
|
1727 |
+
#: widgets/google-map/google-map.php:517
|
1728 |
+
msgid "Consent prompt button background hover color"
|
1729 |
+
msgstr ""
|
1730 |
+
|
1731 |
+
#: widgets/google-map/google-map.php:527
|
1732 |
msgid "Responsive breakpoint"
|
1733 |
msgstr ""
|
1734 |
|
1735 |
+
#: widgets/google-map/google-map.php:529
|
1736 |
msgid "This setting controls when the map will use the mobile zoom. This breakpoint will only be used if a mobile zoom is set in the SiteOrigin Google Maps settings. The default value is 780px"
|
1737 |
msgstr ""
|
1738 |
|
1739 |
+
#: widgets/google-map/google-map.php:678
|
1740 |
msgid "There were no results for the place you entered. Please try another."
|
1741 |
msgstr ""
|
1742 |
|
1743 |
+
#: widgets/google-map/google-map.php:699
|
1744 |
msgid "Custom Map"
|
1745 |
msgstr ""
|
1746 |
|
1747 |
+
#: widgets/google-map/google-map.php:931
|
1748 |
msgid "Get additional map consent design settings with %sSiteOrigin Premium%s"
|
1749 |
msgstr ""
|
1750 |
|
1751 |
+
#: widgets/google-map/google-map.php:933
|
1752 |
msgid "Get a curated list of predefined map styles with %sSiteOrigin Premium%s"
|
1753 |
msgstr ""
|
1754 |
|
1896 |
msgid "Design and Layout"
|
1897 |
msgstr ""
|
1898 |
|
1899 |
+
#: widgets/hero/hero.php:171, widgets/layout-slider/layout-slider.php:138, widgets/slider/slider.php:135
|
1900 |
msgid "Responsive Height"
|
1901 |
msgstr ""
|
1902 |
|
1996 |
msgid "Image file"
|
1997 |
msgstr ""
|
1998 |
|
1999 |
+
#: widgets/image/image.php:45
|
2000 |
msgid "Image alignment"
|
2001 |
msgstr ""
|
2002 |
|
2003 |
+
#: widgets/image/image.php:57
|
2004 |
msgid "Title alignment"
|
2005 |
msgstr ""
|
2006 |
|
2007 |
+
#: widgets/image/image.php:74
|
2008 |
msgid "Title position"
|
2009 |
msgstr ""
|
2010 |
|
2011 |
+
#: widgets/image/image.php:85, widgets/image-grid/image-grid.php:79
|
2012 |
msgid "Alt text"
|
2013 |
msgstr ""
|
2014 |
|
2015 |
+
#: widgets/image/image.php:95, widgets/image-grid/image-grid.php:88, widgets/slider/slider.php:108
|
2016 |
msgid "Open in new window"
|
2017 |
msgstr ""
|
2018 |
|
2019 |
+
#: widgets/image/image.php:101
|
2020 |
msgid "Bound"
|
2021 |
msgstr ""
|
2022 |
|
2023 |
+
#: widgets/image/image.php:102
|
2024 |
msgid "Make sure the image doesn't extend beyond its container."
|
2025 |
msgstr ""
|
2026 |
|
2027 |
+
#: widgets/image/image.php:107
|
2028 |
msgid "Full Width"
|
2029 |
msgstr ""
|
2030 |
|
2031 |
+
#: widgets/image/image.php:108
|
2032 |
msgid "Resize image to fit its container."
|
2033 |
msgstr ""
|
2034 |
|
2035 |
+
#: widgets/image/image.php:238, widgets/image-grid/image-grid.php:230
|
2036 |
msgid "Add a Lightbox to your images with %sSiteOrigin Premium%s"
|
2037 |
msgstr ""
|
2038 |
|
2104 |
msgid "This widget requires Page Builder."
|
2105 |
msgstr ""
|
2106 |
|
2107 |
+
#: widgets/post-carousel/post-carousel.php:4, widgets/post-carousel/post-carousel.php:93
|
2108 |
msgid "Gives you a widget to display your posts as a carousel."
|
2109 |
msgstr ""
|
2110 |
|
2111 |
+
#: widgets/post-carousel/post-carousel.php:91
|
2112 |
msgid "SiteOrigin Post Carousel"
|
2113 |
msgstr ""
|
2114 |
|
2115 |
+
#: widgets/post-carousel/post-carousel.php:165
|
2116 |
msgid "Default Thumbnail"
|
2117 |
msgstr ""
|
2118 |
|
2119 |
+
#: widgets/post-carousel/post-carousel.php:166
|
2120 |
msgid "Choose Thumbnail"
|
2121 |
msgstr ""
|
2122 |
|
2123 |
+
#: widgets/post-carousel/post-carousel.php:167
|
2124 |
msgid "Set Thumbnail"
|
2125 |
msgstr ""
|
2126 |
|
2127 |
+
#: widgets/post-carousel/post-carousel.php:173
|
2128 |
msgid "Featured Image size"
|
2129 |
msgstr ""
|
2130 |
|
2131 |
+
#: widgets/post-carousel/post-carousel.php:179
|
2132 |
msgid "Link target"
|
2133 |
msgstr ""
|
2134 |
|
2135 |
+
#: widgets/post-carousel/post-carousel.php:180
|
2136 |
msgid "Choose where to open each carousel item."
|
2137 |
msgstr ""
|
2138 |
|
2139 |
+
#: widgets/post-carousel/post-carousel.php:182
|
2140 |
msgid "Same window "
|
2141 |
msgstr ""
|
2142 |
|
2143 |
+
#: widgets/post-carousel/post-carousel.php:183
|
2144 |
msgid "New window "
|
2145 |
msgstr ""
|
2146 |
|
2147 |
+
#: widgets/post-carousel/post-carousel.php:188
|
2148 |
msgid "Loop posts"
|
2149 |
msgstr ""
|
2150 |
|
2151 |
+
#: widgets/post-carousel/post-carousel.php:189
|
2152 |
msgid "Automatically return to the first post after the last post."
|
2153 |
msgstr ""
|
2154 |
|
2155 |
+
#: widgets/post-carousel/post-carousel.php:195
|
2156 |
msgid "Posts query"
|
2157 |
msgstr ""
|
2158 |
|
2159 |
+
#: widgets/post-carousel/post-carousel.php:199
|
2160 |
msgid "Posts per load"
|
2161 |
msgstr ""
|
2162 |
|
2163 |
+
#: widgets/post-carousel/post-carousel.php:200
|
2164 |
msgid "Set the number of posts preloaded in the background when clicking next. The default is 10."
|
2165 |
msgstr ""
|
2166 |
|
2167 |
+
#: widgets/post-carousel/post-carousel.php:212
|
2168 |
msgid "Thumbnail overlay hover color"
|
2169 |
msgstr ""
|
2170 |
|
2171 |
+
#: widgets/post-carousel/post-carousel.php:217
|
2172 |
+
msgid "Thumbnail overlay hover opacity"
|
2173 |
+
msgstr ""
|
2174 |
+
|
2175 |
+
#: widgets/post-carousel/post-carousel.php:225
|
2176 |
msgid "Navigation arrow color"
|
2177 |
msgstr ""
|
2178 |
|
2179 |
+
#: widgets/post-carousel/post-carousel.php:230
|
2180 |
msgid "Navigation arrow hover color"
|
2181 |
msgstr ""
|
2182 |
|
2183 |
+
#: widgets/post-carousel/post-carousel.php:234
|
2184 |
msgid "Navigation background"
|
2185 |
msgstr ""
|
2186 |
|
2187 |
+
#: widgets/post-carousel/post-carousel.php:239
|
2188 |
msgid "Navigation hover background"
|
2189 |
msgstr ""
|
2190 |
|
2191 |
+
#: widgets/post-carousel/post-carousel.php:246, widgets/testimonial/testimonial.php:115
|
2192 |
msgid "Responsive"
|
2193 |
msgstr ""
|
2194 |
|
2195 |
+
#: widgets/post-carousel/post-carousel.php:251
|
2196 |
msgid "Desktop"
|
2197 |
msgstr ""
|
2198 |
|
2199 |
+
#: widgets/post-carousel/post-carousel.php:256, widgets/post-carousel/post-carousel.php:279, widgets/post-carousel/post-carousel.php:297, widgets/post-carousel/post-carousel.php:317
|
2200 |
msgid "Slides to scroll"
|
2201 |
msgstr ""
|
2202 |
|
2203 |
+
#: widgets/post-carousel/post-carousel.php:257
|
2204 |
msgid "Set the number of slides to scroll per navigation click or swipe on desktop."
|
2205 |
msgstr ""
|
2206 |
|
2207 |
+
#: widgets/post-carousel/post-carousel.php:264, widgets/testimonial/testimonial.php:120
|
2208 |
msgid "Tablet"
|
2209 |
msgstr ""
|
2210 |
|
2211 |
+
#: widgets/post-carousel/post-carousel.php:269
|
2212 |
msgid "Landscape"
|
2213 |
msgstr ""
|
2214 |
|
2215 |
+
#: widgets/post-carousel/post-carousel.php:274, widgets/post-carousel/post-carousel.php:292, widgets/post-carousel/post-carousel.php:312
|
2216 |
msgid "Breakpoint"
|
2217 |
msgstr ""
|
2218 |
|
2219 |
+
#: widgets/post-carousel/post-carousel.php:280, widgets/post-carousel/post-carousel.php:298
|
2220 |
msgid "Set the number of slides to scroll per navigation click or swipe on tablet devices."
|
2221 |
msgstr ""
|
2222 |
|
2223 |
+
#: widgets/post-carousel/post-carousel.php:287
|
2224 |
msgid "Portrait"
|
2225 |
msgstr ""
|
2226 |
|
2227 |
+
#: widgets/post-carousel/post-carousel.php:307
|
2228 |
msgid "Mobile"
|
2229 |
msgstr ""
|
2230 |
|
2231 |
+
#: widgets/post-carousel/post-carousel.php:318
|
2232 |
msgid " Set the number of slides to scroll per navigation click or swipe on mobile devices."
|
2233 |
msgstr ""
|
2234 |
|
2412 |
msgid "Foreground image"
|
2413 |
msgstr ""
|
2414 |
|
2415 |
+
#: widgets/slider/slider.php:115
|
2416 |
msgid "Controls"
|
2417 |
msgstr ""
|
2418 |
|
2419 |
+
#: widgets/slider/slider.php:327
|
2420 |
msgid "Add a Lightbox to your image slides with %sSiteOrigin Premium%s"
|
2421 |
msgstr ""
|
2422 |
|
2673 |
msgstr ""
|
2674 |
|
2675 |
#: widgets/video/video.php:106
|
2676 |
+
msgid "Loop"
|
2677 |
+
msgstr ""
|
2678 |
+
|
2679 |
+
#: widgets/video/video.php:115
|
2680 |
msgid "Use oEmbed"
|
2681 |
msgstr ""
|
2682 |
|
2683 |
+
#: widgets/video/video.php:116
|
2684 |
msgid "Always use the embedded video rather than the MediaElement player."
|
2685 |
msgstr ""
|
2686 |
|
2687 |
+
#: widgets/video/video.php:125
|
2688 |
msgid "Show related videos."
|
2689 |
msgstr ""
|
2690 |
|
2691 |
+
#: widgets/video/video.php:126
|
2692 |
msgid "If the external host supports it."
|
2693 |
msgstr ""
|
2694 |
|
2696 |
msgid "Search"
|
2697 |
msgstr ""
|
2698 |
|
2699 |
+
#: base/inc/fields/autocomplete.class.php:52, base/inc/fields/link.class.php:39
|
2700 |
msgid "Close"
|
2701 |
msgstr ""
|
2702 |
|
2765 |
msgid "Remove"
|
2766 |
msgstr ""
|
2767 |
|
2768 |
+
#: base/inc/fields/image-size.class.php:21
|
2769 |
msgid "Full"
|
2770 |
msgstr ""
|
2771 |
|
2772 |
+
#: base/inc/fields/image-size.class.php:22
|
2773 |
msgid "Thumbnail (Theme-defined)"
|
2774 |
msgstr ""
|
2775 |
|
2776 |
+
#: base/inc/fields/image-size.class.php:37
|
2777 |
+
msgid "Custom Size"
|
2778 |
+
msgstr ""
|
2779 |
+
|
2780 |
+
#: base/inc/fields/link.class.php:28
|
2781 |
msgid "Select Content"
|
2782 |
msgstr ""
|
2783 |
|
2784 |
+
#: base/inc/fields/link.class.php:33
|
2785 |
msgid "Search Content"
|
2786 |
msgstr ""
|
2787 |
|
3226 |
msgstr ""
|
3227 |
|
3228 |
#: widgets/social-media-buttons/data/networks.php:152
|
3229 |
+
msgid "Discord"
|
3230 |
msgstr ""
|
3231 |
|
3232 |
#: widgets/social-media-buttons/data/networks.php:158
|
3233 |
+
msgid "Dribbble"
|
3234 |
msgstr ""
|
3235 |
|
3236 |
#: widgets/social-media-buttons/data/networks.php:164
|
3237 |
+
msgid "Dropbox"
|
3238 |
msgstr ""
|
3239 |
|
3240 |
#: widgets/social-media-buttons/data/networks.php:170
|
3241 |
+
msgid "Foursquare"
|
3242 |
msgstr ""
|
3243 |
|
3244 |
#: widgets/social-media-buttons/data/networks.php:176
|
3245 |
+
msgid "Github"
|
3246 |
msgstr ""
|
3247 |
|
3248 |
#: widgets/social-media-buttons/data/networks.php:182
|
3249 |
+
msgid "Gratipay"
|
3250 |
msgstr ""
|
3251 |
|
3252 |
#: widgets/social-media-buttons/data/networks.php:188
|
3253 |
+
msgid "Goodreads"
|
3254 |
msgstr ""
|
3255 |
|
3256 |
#: widgets/social-media-buttons/data/networks.php:194
|
3257 |
+
msgid "Hacker News"
|
3258 |
msgstr ""
|
3259 |
|
3260 |
#: widgets/social-media-buttons/data/networks.php:200
|
3261 |
+
msgid "JSFiddle"
|
3262 |
msgstr ""
|
3263 |
|
3264 |
#: widgets/social-media-buttons/data/networks.php:206
|
3265 |
+
msgid "Last.fm"
|
3266 |
msgstr ""
|
3267 |
|
3268 |
#: widgets/social-media-buttons/data/networks.php:212
|
3269 |
+
msgid "Reddit"
|
3270 |
msgstr ""
|
3271 |
|
3272 |
#: widgets/social-media-buttons/data/networks.php:218
|
3273 |
+
msgid "Slack"
|
3274 |
msgstr ""
|
3275 |
|
3276 |
#: widgets/social-media-buttons/data/networks.php:224
|
3277 |
+
msgid "Slideshare"
|
3278 |
msgstr ""
|
3279 |
|
3280 |
#: widgets/social-media-buttons/data/networks.php:230
|
3281 |
+
msgid "Soundcloud"
|
3282 |
msgstr ""
|
3283 |
|
3284 |
#: widgets/social-media-buttons/data/networks.php:236
|
3285 |
+
msgid "Spotify"
|
3286 |
msgstr ""
|
3287 |
|
3288 |
#: widgets/social-media-buttons/data/networks.php:242
|
3289 |
+
msgid "Stack Exchange"
|
3290 |
msgstr ""
|
3291 |
|
3292 |
#: widgets/social-media-buttons/data/networks.php:248
|
3293 |
+
msgid "Stack Overflow"
|
3294 |
msgstr ""
|
3295 |
|
3296 |
#: widgets/social-media-buttons/data/networks.php:254
|
3297 |
+
msgid "Steam"
|
3298 |
msgstr ""
|
3299 |
|
3300 |
#: widgets/social-media-buttons/data/networks.php:260
|
3301 |
+
msgid "Strava"
|
3302 |
msgstr ""
|
3303 |
|
3304 |
#: widgets/social-media-buttons/data/networks.php:266
|
3305 |
+
msgid "StumbleUpon"
|
3306 |
msgstr ""
|
3307 |
|
3308 |
#: widgets/social-media-buttons/data/networks.php:272
|
3309 |
+
msgid "Telegram"
|
3310 |
msgstr ""
|
3311 |
|
3312 |
#: widgets/social-media-buttons/data/networks.php:278
|
3313 |
+
msgid "TikTok"
|
3314 |
msgstr ""
|
3315 |
|
3316 |
#: widgets/social-media-buttons/data/networks.php:284
|
3317 |
+
msgid "Trello"
|
3318 |
msgstr ""
|
3319 |
|
3320 |
#: widgets/social-media-buttons/data/networks.php:290
|
3321 |
+
msgid "TripAdvisor"
|
3322 |
msgstr ""
|
3323 |
|
3324 |
#: widgets/social-media-buttons/data/networks.php:296
|
3325 |
+
msgid "Twitch"
|
3326 |
msgstr ""
|
3327 |
|
3328 |
#: widgets/social-media-buttons/data/networks.php:302
|
3329 |
+
msgid "Vimeo"
|
3330 |
msgstr ""
|
3331 |
|
3332 |
#: widgets/social-media-buttons/data/networks.php:308
|
3333 |
+
msgid "WhatsApp"
|
3334 |
msgstr ""
|
3335 |
|
3336 |
#: widgets/social-media-buttons/data/networks.php:314
|
3337 |
+
msgid "WordPress"
|
3338 |
msgstr ""
|
3339 |
|
3340 |
#: widgets/social-media-buttons/data/networks.php:320
|
3341 |
+
msgid "Xing"
|
3342 |
msgstr ""
|
3343 |
|
3344 |
#: widgets/social-media-buttons/data/networks.php:326
|
3345 |
+
msgid "Yahoo"
|
3346 |
msgstr ""
|
3347 |
|
3348 |
#: widgets/social-media-buttons/data/networks.php:332
|
3349 |
+
msgid "Yelp"
|
3350 |
+
msgstr ""
|
3351 |
+
|
3352 |
+
#: widgets/social-media-buttons/data/networks.php:338
|
3353 |
msgid "YouTube"
|
3354 |
msgstr ""
|
3355 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Tags: bundle, widget, button, slider, image, carousel, price table, google maps,
|
|
3 |
Requires at least: 4.2
|
4 |
Tested up to: 5.7
|
5 |
Requires PHP: 5.6.20
|
6 |
-
Stable tag: 1.
|
7 |
-
Build time:
|
8 |
License: GPLv3 or later
|
9 |
Contributors: gpriday, braam-genis, alexgso
|
10 |
Donate link: https://siteorigin.com/downloads/premium/
|
@@ -66,6 +66,31 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
|
|
66 |
|
67 |
== Changelog ==
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
== 1.17.11 - 09 December 2020 ==
|
70 |
* Google Maps: Added Map Style button styling.
|
71 |
* Accordion: Submitted contact forms added to Accordion will now open the panel on load.
|
3 |
Requires at least: 4.2
|
4 |
Tested up to: 5.7
|
5 |
Requires PHP: 5.6.20
|
6 |
+
Stable tag: 1.18.0
|
7 |
+
Build time: 2021-04-20T17:13:52+02:00
|
8 |
License: GPLv3 or later
|
9 |
Contributors: gpriday, braam-genis, alexgso
|
10 |
Donate link: https://siteorigin.com/downloads/premium/
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
+
== 1.18.0 - 20 April 2021 ==
|
70 |
+
* Updated the Google fonts list.
|
71 |
+
* Updated Font Awesome from `5.14.0` to `5.15.1`.
|
72 |
+
* Block Editor: Styling fixes including specific fixes for the Twenty Twenty-One theme.
|
73 |
+
* Contact Form: Set missing message default value.
|
74 |
+
* Contact Form: Nested the required indicator to make styling easier.
|
75 |
+
* Editor: Stopped processing the `<!--more-->` quicktag in previews.
|
76 |
+
* Features: Ensured the title tag exists before outputting.
|
77 |
+
* Image: Added ability to set custom image sizes.
|
78 |
+
* Image Grid: Changed to use Flexbox to avoid unintended spacing.
|
79 |
+
* Post Carousel: Added an overlay hover opacity setting.
|
80 |
+
* Slider: Added a `Height` setting if the `Foreground image` is set.
|
81 |
+
* Social Media Buttons: Added Discord.
|
82 |
+
* Video: Added a `Loop` setting for self-hosted videos.
|
83 |
+
* Video: If `autoplay` is enabled, `playsinline` will be added.
|
84 |
+
* Developer: Post Carousel: Added `siteorigin_widgets_post_carousel_post_limit` filter
|
85 |
+
* Developer: Google Maps: Corrected marker JavaScript property names.
|
86 |
+
* Developer: Block Editor: Store and serve rendered widget.
|
87 |
+
* Developer: Image form field: Added an optional parameter `custom_size` to enable custom sizes.
|
88 |
+
* Developer: State Emitters: Improved media field external support.
|
89 |
+
* Developer: Sanitized italic fonts rather than clearing them.
|
90 |
+
* Developer: Replaced older-style PHP type conversion functions with type casts.
|
91 |
+
* Developer: Add `units` and `default_unit` parameters for the measurement field.
|
92 |
+
* Developer: Changes for PHP 8.
|
93 |
+
|
94 |
== 1.17.11 - 09 December 2020 ==
|
95 |
* Google Maps: Added Map Style button styling.
|
96 |
* Accordion: Submitted contact forms added to Accordion will now open the panel on load.
|
so-widgets-bundle.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: SiteOrigin Widgets Bundle
|
4 |
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
|
5 |
-
Version: 1.
|
6 |
Text Domain: so-widgets-bundle
|
7 |
Domain Path: /lang
|
8 |
Author: SiteOrigin
|
@@ -12,7 +12,7 @@ License: GPL3
|
|
12 |
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
*/
|
14 |
|
15 |
-
define('SOW_BUNDLE_VERSION', '1.
|
16 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
|
18 |
// Allow JS suffix to be pre-set
|
@@ -418,9 +418,10 @@ class SiteOrigin_Widgets_Bundle {
|
|
418 |
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 400 );
|
419 |
}
|
420 |
|
421 |
-
$form_values =
|
422 |
-
$
|
423 |
-
|
|
|
424 |
wp_send_json_success();
|
425 |
}
|
426 |
|
2 |
/*
|
3 |
Plugin Name: SiteOrigin Widgets Bundle
|
4 |
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
|
5 |
+
Version: 1.18.0
|
6 |
Text Domain: so-widgets-bundle
|
7 |
Domain Path: /lang
|
8 |
Author: SiteOrigin
|
12 |
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
*/
|
14 |
|
15 |
+
define('SOW_BUNDLE_VERSION', '1.18.0');
|
16 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
|
18 |
// Allow JS suffix to be pre-set
|
418 |
wp_die( __( 'Invalid request.', 'so-widgets-bundle' ), 400 );
|
419 |
}
|
420 |
|
421 |
+
$form_values = array_values( $_POST );
|
422 |
+
$form_values = array_shift( $form_values );
|
423 |
+
$widget_object->save_global_settings( stripslashes_deep( array_shift( $form_values ) ) );
|
424 |
+
|
425 |
wp_send_json_success();
|
426 |
}
|
427 |
|
widgets/accordion/js/accordion.js
CHANGED
@@ -145,15 +145,15 @@ jQuery( function ( $ ) {
|
|
145 |
|
146 |
var updatePanelStates = function () {
|
147 |
var panels = $accordionPanels.toArray();
|
|
|
148 |
for ( var i = 0; i < panels.length; i++ ) {
|
149 |
var panel = panels[ i ];
|
150 |
var panelAnchor = $( panel ).data( 'anchor' );
|
151 |
-
var anchors = window.location.hash.substring(1).split( ',' );
|
152 |
var panelOpen = anchors.some(function (anchor) {
|
153 |
return decodeURI( panelAnchor ) === decodeURI( anchor );
|
154 |
});
|
155 |
if ( panelOpen ) {
|
156 |
-
openPanel( panel, true );
|
157 |
} else {
|
158 |
closePanel( panel, true );
|
159 |
}
|
145 |
|
146 |
var updatePanelStates = function () {
|
147 |
var panels = $accordionPanels.toArray();
|
148 |
+
var anchors = window.location.hash.substring( 1 ).split( ',' );
|
149 |
for ( var i = 0; i < panels.length; i++ ) {
|
150 |
var panel = panels[ i ];
|
151 |
var panelAnchor = $( panel ).data( 'anchor' );
|
|
|
152 |
var panelOpen = anchors.some(function (anchor) {
|
153 |
return decodeURI( panelAnchor ) === decodeURI( anchor );
|
154 |
});
|
155 |
if ( panelOpen ) {
|
156 |
+
openPanel( panel, true, true );
|
157 |
} else {
|
158 |
closePanel( panel, true );
|
159 |
}
|
widgets/accordion/js/accordion.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var sowb=window.sowb||{};jQuery((function(o){sowb.setupAccordion=function(){o(".sow-accordion").each((function(n,e){var a=o(this).closest(".so-widget-sow-accordion");if(a.data("initialized"))return o(this);var i=o(e).find("> .sow-accordion-panel");i.not(".sow-accordion-panel-open").children(".sow-accordion-panel-content").hide();var t=i.filter(".sow-accordion-panel-open").toArray(),c=function(){},r=function(n,e){var a=n.offset().top-90;e?o("body,html").animate({scrollTop:a},200):window.scrollTo(0,a)},s=function(n,e,a){var i=o(n);if(!i.is(".sow-accordion-panel-open")){i.find("> .sow-accordion-panel-content").slideDown({start:function(){o(window).trigger("resize"),o(sowb).trigger("setup_widgets")},complete:function(){a&&sowAccordion.scrollto_after_change&&(i.offset().top<window.scrollY||i.offset().top+i.height()>window.scrollY)&&r(i,!0),o(this).trigger("show")}}),i.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").attr("aria-expanded",!0),i.addClass("sow-accordion-panel-open"),t.push(n);var d=o(n).parents(".sow-accordion-panel");d.length&&!d.hasClass("sow-accordion-panel-open")&&s(d.get(0),!0),e||c()}},d=function(n,e){var a=o(n);a.is(".sow-accordion-panel-open")&&(a.find("> .sow-accordion-panel-content").slideUp((function(){o(this).trigger("hide")})),a.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").attr("aria-expanded",!1),a.removeClass("sow-accordion-panel-open"),t.splice(t.indexOf(n),1),e||c())};if(i.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").on("click keydown",(function(n){if("keydown"==n.type){if(13!==n.keyCode&&32!==n.keyCode)return;n.preventDefault()}var e=o(this),i=a.data("maxOpenPanels"),c=e.closest(".sow-accordion-panel");if(c.is(".sow-accordion-panel-open")?d(c.get(0)):s(c.get(0),!1,!0),!isNaN(i)&&i>0&&t.length>i){var r=0;o.each(t.reverse(),(function(o,n){r!==i?r++:d(t[o])}))}})),a.data("useAnchorTags")){var l;c=function(){l&&clearTimeout(l),l=setTimeout((function(){for(var n=[],e=o(".sow-accordion-panel-open").toArray(),a=0;a<e.length;a++){var i=o(e[a]).data("anchor");if(i){var t=o(e[a]).parents(".sow-accordion-panel");(!t.length||t.length&&t.hasClass("sow-accordion-panel-open"))&&(n[a]=i)}}n&&n.length?window.location.hash=n.join(","):window.location.hash&&window.history.pushState("",document.title,window.location.pathname+window.location.search)}),100)};var w=function(){for(var n=i.toArray(),e=0;
|
1 |
+
var sowb=window.sowb||{};jQuery((function(o){sowb.setupAccordion=function(){o(".sow-accordion").each((function(n,e){var a=o(this).closest(".so-widget-sow-accordion");if(a.data("initialized"))return o(this);var i=o(e).find("> .sow-accordion-panel");i.not(".sow-accordion-panel-open").children(".sow-accordion-panel-content").hide();var t=i.filter(".sow-accordion-panel-open").toArray(),c=function(){},r=function(n,e){var a=n.offset().top-90;e?o("body,html").animate({scrollTop:a},200):window.scrollTo(0,a)},s=function(n,e,a){var i=o(n);if(!i.is(".sow-accordion-panel-open")){i.find("> .sow-accordion-panel-content").slideDown({start:function(){o(window).trigger("resize"),o(sowb).trigger("setup_widgets")},complete:function(){a&&sowAccordion.scrollto_after_change&&(i.offset().top<window.scrollY||i.offset().top+i.height()>window.scrollY)&&r(i,!0),o(this).trigger("show")}}),i.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").attr("aria-expanded",!0),i.addClass("sow-accordion-panel-open"),t.push(n);var d=o(n).parents(".sow-accordion-panel");d.length&&!d.hasClass("sow-accordion-panel-open")&&s(d.get(0),!0),e||c()}},d=function(n,e){var a=o(n);a.is(".sow-accordion-panel-open")&&(a.find("> .sow-accordion-panel-content").slideUp((function(){o(this).trigger("hide")})),a.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").attr("aria-expanded",!1),a.removeClass("sow-accordion-panel-open"),t.splice(t.indexOf(n),1),e||c())};if(i.find("> .sow-accordion-panel-header-container > .sow-accordion-panel-header").on("click keydown",(function(n){if("keydown"==n.type){if(13!==n.keyCode&&32!==n.keyCode)return;n.preventDefault()}var e=o(this),i=a.data("maxOpenPanels"),c=e.closest(".sow-accordion-panel");if(c.is(".sow-accordion-panel-open")?d(c.get(0)):s(c.get(0),!1,!0),!isNaN(i)&&i>0&&t.length>i){var r=0;o.each(t.reverse(),(function(o,n){r!==i?r++:d(t[o])}))}})),a.data("useAnchorTags")){var l;c=function(){l&&clearTimeout(l),l=setTimeout((function(){for(var n=[],e=o(".sow-accordion-panel-open").toArray(),a=0;a<e.length;a++){var i=o(e[a]).data("anchor");if(i){var t=o(e[a]).parents(".sow-accordion-panel");(!t.length||t.length&&t.hasClass("sow-accordion-panel-open"))&&(n[a]=i)}}n&&n.length?window.location.hash=n.join(","):window.location.hash&&window.history.pushState("",document.title,window.location.pathname+window.location.search)}),100)};var w=function(){for(var n=i.toArray(),e=window.location.hash.substring(1).split(","),a=0;a<n.length;a++){var t=n[a],c=o(t).data("anchor");e.some((function(o){return decodeURI(c)===decodeURI(o)}))?s(t,!0,!0):d(t,!0)}};o(window).on("hashchange",w),window.location.hash?w():c();var p=a.data("initialScrollPanel");if(window.location.hash&&t.length)setTimeout((function(){r(o(t[0]))}),500);else if(p>0){var h=p>i.length?i.last():i.eq(p-1);setTimeout((function(){r(h)}),500)}}a.data("initialized",!0)}))},sowb.setupAccordion(),o(sowb).on("setup_widgets",sowb.setupAccordion)})),window.sowb=sowb;
|
widgets/button/button.php
CHANGED
@@ -49,6 +49,7 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
|
|
49 |
'url' => array(
|
50 |
'type' => 'link',
|
51 |
'label' => __('Destination URL', 'so-widgets-bundle'),
|
|
|
52 |
),
|
53 |
|
54 |
'new_window' => array(
|
49 |
'url' => array(
|
50 |
'type' => 'link',
|
51 |
'label' => __('Destination URL', 'so-widgets-bundle'),
|
52 |
+
'allow_shortcode' => true,
|
53 |
),
|
54 |
|
55 |
'new_window' => array(
|
widgets/button/tpl/default.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
|
13 |
?>
|
14 |
<div class="ow-button-base ow-button-align-<?php echo esc_attr( $align ) ?>">
|
15 |
-
<a href="<?php echo sow_esc_url( $href ) ?>" <?php foreach( $button_attributes as $name => $val ) echo $name . '="' . esc_attr( $val ) . '" ' ?>
|
16 |
<?php if ( ! empty( $onclick ) ) echo 'onclick="' . esc_js( $onclick ) . '"'; ?>>
|
17 |
<span>
|
18 |
<?php
|
12 |
|
13 |
?>
|
14 |
<div class="ow-button-base ow-button-align-<?php echo esc_attr( $align ) ?>">
|
15 |
+
<a href="<?php echo sow_esc_url( do_shortcode( $href ) ) ?>" <?php foreach( $button_attributes as $name => $val ) echo $name . '="' . esc_attr( $val ) . '" ' ?>
|
16 |
<?php if ( ! empty( $onclick ) ) echo 'onclick="' . esc_js( $onclick ) . '"'; ?>>
|
17 |
<span>
|
18 |
<?php
|
widgets/contact/contact.php
CHANGED
@@ -186,6 +186,7 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
186 |
'type' => 'text',
|
187 |
'label' => __( 'Missing message', 'so-widgets-bundle' ),
|
188 |
'description' => __( 'Error message to display if this field is missing.', 'so-widgets-bundle' ),
|
|
|
189 |
)
|
190 |
)
|
191 |
),
|
@@ -913,7 +914,7 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
913 |
* @param array $errors
|
914 |
* @param $instance
|
915 |
*/
|
916 |
-
function render_form_fields( $fields, $errors
|
917 |
|
918 |
$field_ids = array();
|
919 |
$label_position = $instance['design']['labels']['position'];
|
@@ -944,19 +945,20 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
944 |
<div class="sow-form-field sow-form-field-<?php echo sanitize_html_class( $field['type'] ) ?>"><?php
|
945 |
|
946 |
$label = $field['label'];
|
947 |
-
|
948 |
-
$label .= '*';
|
949 |
-
}
|
950 |
$no_placeholder_support = ( $field['type'] != 'radio' && $field['type'] != 'checkboxes' );
|
951 |
// label should be rendered before the field, then CSS will do the exact positioning.
|
952 |
$render_label_before_field = ( $label_position != 'below' && $label_position != 'inside' ) || ( $label_position == 'inside' && ! $no_placeholder_support );
|
953 |
if ( empty( $label_position ) || $render_label_before_field ) {
|
954 |
-
$this->render_form_label( $field_id, $label, $label_position );
|
955 |
}
|
956 |
|
957 |
$show_placeholder = $label_position == 'inside';
|
|
|
|
|
|
|
958 |
|
959 |
-
if ( ! empty( $errors[ $field_name ] ) ) {
|
960 |
?>
|
961 |
<div class="sow-error">
|
962 |
<?php echo wp_kses_post( $errors[ $field_name ] ) ?>
|
@@ -986,7 +988,7 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
986 |
?></span><?php
|
987 |
|
988 |
if ( ! empty( $label_position ) && $label_position == 'below' ) {
|
989 |
-
$this->render_form_label( $field_id, $label, $instance );
|
990 |
}
|
991 |
|
992 |
if ( ! empty( $field['description'] ) ) {
|
@@ -1001,7 +1003,7 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
1001 |
}
|
1002 |
}
|
1003 |
|
1004 |
-
function render_form_label( $field_id, $label, $position ) {
|
1005 |
if ( ! empty( $label ) ) {
|
1006 |
$label_class = '';
|
1007 |
if ( ! empty( $position ) ) {
|
@@ -1009,7 +1011,14 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
1009 |
}
|
1010 |
?><label<?php if ( ! empty( $label_class ) ) {
|
1011 |
echo $label_class;
|
1012 |
-
} ?> for="<?php echo esc_attr( $field_id ) ?>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1013 |
<?php
|
1014 |
}
|
1015 |
}
|
186 |
'type' => 'text',
|
187 |
'label' => __( 'Missing message', 'so-widgets-bundle' ),
|
188 |
'description' => __( 'Error message to display if this field is missing.', 'so-widgets-bundle' ),
|
189 |
+
'default' => __( 'Required field', 'so-widgets-bundle' ),
|
190 |
)
|
191 |
)
|
192 |
),
|
914 |
* @param array $errors
|
915 |
* @param $instance
|
916 |
*/
|
917 |
+
function render_form_fields( $fields, $errors, $instance ) {
|
918 |
|
919 |
$field_ids = array();
|
920 |
$label_position = $instance['design']['labels']['position'];
|
945 |
<div class="sow-form-field sow-form-field-<?php echo sanitize_html_class( $field['type'] ) ?>"><?php
|
946 |
|
947 |
$label = $field['label'];
|
948 |
+
$indicate_as_required = $indicate_required_fields && ! empty( $field['required']['required'] );
|
|
|
|
|
949 |
$no_placeholder_support = ( $field['type'] != 'radio' && $field['type'] != 'checkboxes' );
|
950 |
// label should be rendered before the field, then CSS will do the exact positioning.
|
951 |
$render_label_before_field = ( $label_position != 'below' && $label_position != 'inside' ) || ( $label_position == 'inside' && ! $no_placeholder_support );
|
952 |
if ( empty( $label_position ) || $render_label_before_field ) {
|
953 |
+
$this->render_form_label( $field_id, $label, $label_position, $indicate_as_required );
|
954 |
}
|
955 |
|
956 |
$show_placeholder = $label_position == 'inside';
|
957 |
+
if ( $show_placeholder && $indicate_as_required ) {
|
958 |
+
$label .= '*';
|
959 |
+
}
|
960 |
|
961 |
+
if ( is_array( $errors ) && ! empty( $errors[ $field_name ] ) ) {
|
962 |
?>
|
963 |
<div class="sow-error">
|
964 |
<?php echo wp_kses_post( $errors[ $field_name ] ) ?>
|
988 |
?></span><?php
|
989 |
|
990 |
if ( ! empty( $label_position ) && $label_position == 'below' ) {
|
991 |
+
$this->render_form_label( $field_id, $label, $instance, $indicate_as_required );
|
992 |
}
|
993 |
|
994 |
if ( ! empty( $field['description'] ) ) {
|
1003 |
}
|
1004 |
}
|
1005 |
|
1006 |
+
function render_form_label( $field_id, $label, $position, $indicate_as_required = false ) {
|
1007 |
if ( ! empty( $label ) ) {
|
1008 |
$label_class = '';
|
1009 |
if ( ! empty( $position ) ) {
|
1011 |
}
|
1012 |
?><label<?php if ( ! empty( $label_class ) ) {
|
1013 |
echo $label_class;
|
1014 |
+
} ?> for="<?php echo esc_attr( $field_id ) ?>">
|
1015 |
+
<strong>
|
1016 |
+
<?php echo esc_html( $label ) ?>
|
1017 |
+
<?php if ( $indicate_as_required ) : ?>
|
1018 |
+
<span class="sow-form-field-required">*</span>
|
1019 |
+
<?php endif; ?>
|
1020 |
+
</strong>
|
1021 |
+
</label>
|
1022 |
<?php
|
1023 |
}
|
1024 |
}
|
widgets/editor/editor.php
CHANGED
@@ -108,7 +108,17 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
|
|
108 |
|
109 |
$instance['text'] = do_shortcode( shortcode_unautop( $instance['text'] ) );
|
110 |
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
|
114 |
|
108 |
|
109 |
$instance['text'] = do_shortcode( shortcode_unautop( $instance['text'] ) );
|
110 |
|
111 |
+
// Don't process more more quicktag if this is a preview.
|
112 |
+
if (
|
113 |
+
! $this->is_preview() &&
|
114 |
+
empty( $GLOBALS[ 'SITEORIGIN_PANELS_PREVIEW_RENDER' ] ) &&
|
115 |
+
(
|
116 |
+
isset( $_POST['action'] ) &&
|
117 |
+
$_POST['action'] != 'so_widgets_preview'
|
118 |
+
)
|
119 |
+
) {
|
120 |
+
$instance['text'] = $this->process_more_quicktag( $instance['text'] );
|
121 |
+
}
|
122 |
}
|
123 |
|
124 |
|
widgets/features/features.php
CHANGED
@@ -300,7 +300,7 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
|
|
300 |
|
301 |
$less_vars['container_size'] = $instance['container_size'];
|
302 |
$less_vars['icon_size'] = $instance['icon_size'];
|
303 |
-
$less_vars['title_tag'] = $instance['title_tag'];
|
304 |
$less_vars['per_row'] = $instance['per_row'];
|
305 |
$less_vars['use_icon_size'] = empty( $instance['icon_size_custom'] ) ? 'false' : 'true';
|
306 |
|
300 |
|
301 |
$less_vars['container_size'] = $instance['container_size'];
|
302 |
$less_vars['icon_size'] = $instance['icon_size'];
|
303 |
+
$less_vars['title_tag'] = ! empty( $instance['title_tag'] ) ? $instance['title_tag'] : 'h5';
|
304 |
$less_vars['per_row'] = $instance['per_row'];
|
305 |
$less_vars['use_icon_size'] = empty( $instance['icon_size_custom'] ) ? 'false' : 'true';
|
306 |
|
widgets/features/tpl/default.php
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
3 |
?>
|
4 |
|
5 |
<div class="sow-features-list <?php if( $instance['responsive'] ) echo 'sow-features-responsive'; ?>">
|
@@ -25,13 +27,18 @@ $last_row = floor( ( count($instance['features']) - 1 ) / $instance['per_row'] )
|
|
25 |
);
|
26 |
if(!empty($attachment)) {
|
27 |
$icon_styles[] = 'background-image: url(' . sow_esc_url($attachment[0]) . ')';
|
28 |
-
if(!empty($instance['icon_size'])
|
|
|
|
|
29 |
|
30 |
?><div class="sow-icon-image" style="<?php echo implode('; ', $icon_styles) ?>"></div><?php
|
31 |
}
|
32 |
}
|
33 |
else {
|
34 |
-
if(!empty($instance['icon_size'])
|
|
|
|
|
|
|
35 |
if(!empty($feature['icon_color'])) $icon_styles[] = 'color: '.$feature['icon_color'];
|
36 |
|
37 |
echo siteorigin_widget_get_icon($feature['icon'], $icon_styles);
|
1 |
<?php
|
2 |
+
if ( ! empty( $instance['features'] ) ) {
|
3 |
+
$last_row = floor( ( count( $instance['features'] ) - 1 ) / $instance['per_row'] );
|
4 |
+
}
|
5 |
?>
|
6 |
|
7 |
<div class="sow-features-list <?php if( $instance['responsive'] ) echo 'sow-features-responsive'; ?>">
|
27 |
);
|
28 |
if(!empty($attachment)) {
|
29 |
$icon_styles[] = 'background-image: url(' . sow_esc_url($attachment[0]) . ')';
|
30 |
+
if ( ! empty( $instance['icon_size'] ) ) {
|
31 |
+
$icon_styles[] = 'font-size: ' . (int) $instance['icon_size'] . esc_attr( $instance['icon_size_unit'] );
|
32 |
+
}
|
33 |
|
34 |
?><div class="sow-icon-image" style="<?php echo implode('; ', $icon_styles) ?>"></div><?php
|
35 |
}
|
36 |
}
|
37 |
else {
|
38 |
+
if ( ! empty( $instance['icon_size'] ) ) {
|
39 |
+
$icon_styles[] = 'font-size: '. (int) $instance['icon_size'] . esc_attr( $instance['icon_size_unit'] );
|
40 |
+
}
|
41 |
+
|
42 |
if(!empty($feature['icon_color'])) $icon_styles[] = 'color: '.$feature['icon_color'];
|
43 |
|
44 |
echo siteorigin_widget_get_icon($feature['icon'], $icon_styles);
|
widgets/google-map/google-map.php
CHANGED
@@ -488,6 +488,40 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
|
488 |
<a href='https://policies.google.com/privacy?hl=en&gl=en' target='_blank' rel='noopener noreferrer'>Read more</a>", 'so-widgets-bundle' ),
|
489 |
),
|
490 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
491 |
'responsive_breakpoint' => array(
|
492 |
'type' => 'number',
|
493 |
'label' => __( 'Responsive breakpoint', 'so-widgets-bundle' ),
|
@@ -596,12 +630,22 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
|
|
596 |
|
597 |
function get_less_variables( $instance ) {
|
598 |
$global_settings = $this->get_global_settings();
|
599 |
-
|
600 |
-
return array(
|
601 |
'height' => $instance['settings']['height'] . 'px',
|
602 |
'map_consent' => ! empty( $global_settings['map_consent'] ),
|
603 |
'responsive_breakpoint' => ! empty( $global_settings['responsive_breakpoint'] ) ? $global_settings['responsive_breakpoint'] : '780',
|
604 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
605 |
}
|
606 |
|
607 |
private function get_location_string( $location_data ) {
|
488 |
<a href='https://policies.google.com/privacy?hl=en&gl=en' target='_blank' rel='noopener noreferrer'>Read more</a>", 'so-widgets-bundle' ),
|
489 |
),
|
490 |
|
491 |
+
'map_consent_design' => array(
|
492 |
+
'type' => 'section',
|
493 |
+
'label' => __( 'Consent prompt design', 'so-widgets-bundle' ),
|
494 |
+
'hide' => true,
|
495 |
+
'fields' => array(
|
496 |
+
'button' => array(
|
497 |
+
'type' => 'section',
|
498 |
+
'label' => __( 'Button', 'so-widgets-bundle' ),
|
499 |
+
'hide' => true,
|
500 |
+
'fields' => array(
|
501 |
+
'color' => array(
|
502 |
+
'type' => 'color',
|
503 |
+
'label' => __( 'Consent prompt button text color', 'so-widgets-bundle' ),
|
504 |
+
'default' => '#fff',
|
505 |
+
),
|
506 |
+
'color_hover' => array(
|
507 |
+
'type' => 'color',
|
508 |
+
'label' => __( 'Consent prompt button text hover color', 'so-widgets-bundle' ),
|
509 |
+
),
|
510 |
+
'background' => array(
|
511 |
+
'type' => 'color',
|
512 |
+
'label' => __( 'Consent prompt button background color', 'so-widgets-bundle' ),
|
513 |
+
'default' => '#41a9d5',
|
514 |
+
),
|
515 |
+
'background_hover' => array(
|
516 |
+
'type' => 'color',
|
517 |
+
'label' => __( 'Consent prompt button background hover color', 'so-widgets-bundle' ),
|
518 |
+
'default' => '#298fba',
|
519 |
+
),
|
520 |
+
),
|
521 |
+
),
|
522 |
+
),
|
523 |
+
),
|
524 |
+
|
525 |
'responsive_breakpoint' => array(
|
526 |
'type' => 'number',
|
527 |
'label' => __( 'Responsive breakpoint', 'so-widgets-bundle' ),
|
630 |
|
631 |
function get_less_variables( $instance ) {
|
632 |
$global_settings = $this->get_global_settings();
|
633 |
+
$less_variables = array(
|
|
|
634 |
'height' => $instance['settings']['height'] . 'px',
|
635 |
'map_consent' => ! empty( $global_settings['map_consent'] ),
|
636 |
'responsive_breakpoint' => ! empty( $global_settings['responsive_breakpoint'] ) ? $global_settings['responsive_breakpoint'] : '780',
|
637 |
);
|
638 |
+
|
639 |
+
// Map Content Button styling.
|
640 |
+
if ( $less_variables['map_consent'] ) {
|
641 |
+
foreach ( $global_settings['map_consent_design']['button'] as $style => $value ) {
|
642 |
+
if ( ! empty( $value ) ) {
|
643 |
+
$less_variables[ 'map_consent_notice_button_' . $style ] = $value;
|
644 |
+
}
|
645 |
+
}
|
646 |
+
}
|
647 |
+
|
648 |
+
return $less_variables;
|
649 |
}
|
650 |
|
651 |
private function get_location_string( $location_data ) {
|
widgets/headline/headline.php
CHANGED
@@ -311,7 +311,7 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
311 |
|
312 |
$less_vars['divider_style'] = isset( $instance['divider']['style'] ) ? $instance['divider']['style'] : false;
|
313 |
$less_vars['divider_width'] = isset( $instance['divider']['width'] ) ? $instance['divider']['width'] : false;
|
314 |
-
$less_vars['divider_thickness'] = isset( $instance['divider']['thickness'] ) ?
|
315 |
$less_vars['divider_align'] = isset( $instance['divider']['align'] ) ? $instance['divider']['align'] : false;
|
316 |
$less_vars['divider_color'] = isset( $instance['divider']['color'] ) ? $instance['divider']['color'] : false;
|
317 |
$less_vars['divider_margin'] = isset( $instance['divider']['margin'] ) ? $instance['divider']['margin'] : false;
|
@@ -385,7 +385,7 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
|
|
385 |
// Change the old divider side margin into overall width
|
386 |
if( isset( $instance['divider']['side_margin'] ) && ! isset( $instance['divider']['width'] ) ) {
|
387 |
global $content_width;
|
388 |
-
$value =
|
389 |
|
390 |
switch( $instance['divider']['side_margin_unit'] ) {
|
391 |
case 'px' :
|
311 |
|
312 |
$less_vars['divider_style'] = isset( $instance['divider']['style'] ) ? $instance['divider']['style'] : false;
|
313 |
$less_vars['divider_width'] = isset( $instance['divider']['width'] ) ? $instance['divider']['width'] : false;
|
314 |
+
$less_vars['divider_thickness'] = isset( $instance['divider']['thickness'] ) ? (int) $instance['divider']['thickness'] . 'px' : false;
|
315 |
$less_vars['divider_align'] = isset( $instance['divider']['align'] ) ? $instance['divider']['align'] : false;
|
316 |
$less_vars['divider_color'] = isset( $instance['divider']['color'] ) ? $instance['divider']['color'] : false;
|
317 |
$less_vars['divider_margin'] = isset( $instance['divider']['margin'] ) ? $instance['divider']['margin'] : false;
|
385 |
// Change the old divider side margin into overall width
|
386 |
if( isset( $instance['divider']['side_margin'] ) && ! isset( $instance['divider']['width'] ) ) {
|
387 |
global $content_width;
|
388 |
+
$value = (float) $instance['divider']['side_margin'];
|
389 |
|
390 |
switch( $instance['divider']['side_margin_unit'] ) {
|
391 |
case 'px' :
|
widgets/hero/hero.php
CHANGED
@@ -327,7 +327,7 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
327 |
'new_window' => !empty( $frame['background']['new_window'] ),
|
328 |
'videos' => $frame['background']['videos'],
|
329 |
'video-sizing' => 'background',
|
330 |
-
'opacity' =>
|
331 |
);
|
332 |
}
|
333 |
|
@@ -413,9 +413,9 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
413 |
|
414 |
$less['vertically_align'] = empty( $instance['design']['vertically_align'] ) ? 'false' : 'true';
|
415 |
|
416 |
-
$less['heading_shadow'] =
|
417 |
$less['heading_color'] = $instance['design']['heading_color'];
|
418 |
-
$less['text_shadow'] = isset( $instance['design']['text_shadow'] ) ?
|
419 |
$less['text_color'] = $instance['design']['text_color'];
|
420 |
|
421 |
|
327 |
'new_window' => !empty( $frame['background']['new_window'] ),
|
328 |
'videos' => $frame['background']['videos'],
|
329 |
'video-sizing' => 'background',
|
330 |
+
'opacity' => (int) $frame['background']['opacity'] / 100,
|
331 |
);
|
332 |
}
|
333 |
|
413 |
|
414 |
$less['vertically_align'] = empty( $instance['design']['vertically_align'] ) ? 'false' : 'true';
|
415 |
|
416 |
+
$less['heading_shadow'] = (int) $instance['design']['heading_shadow'];
|
417 |
$less['heading_color'] = $instance['design']['heading_color'];
|
418 |
+
$less['text_shadow'] = isset( $instance['design']['text_shadow'] ) ? (float) $instance['design']['text_shadow'] : 0.25;
|
419 |
$less['text_color'] = $instance['design']['text_color'];
|
420 |
|
421 |
|
widgets/image-grid/image-grid.php
CHANGED
@@ -189,11 +189,11 @@ class SiteOrigin_Widgets_ImageGrid_Widget extends SiteOrigin_Widget {
|
|
189 |
if ( ! empty( $instance['display'] ) ) {
|
190 |
// Revert changes to `max_width` and `max_height` back to `number` fields.
|
191 |
if ( ! empty( $instance['display']['max_height'] ) ) {
|
192 |
-
$instance['display']['max_height'] =
|
193 |
}
|
194 |
|
195 |
if ( ! empty( $instance['display']['max_width'] ) ) {
|
196 |
-
$instance['display']['max_width'] =
|
197 |
}
|
198 |
|
199 |
// Input for `spacing` changed from `number` to `measurement` field.
|
189 |
if ( ! empty( $instance['display'] ) ) {
|
190 |
// Revert changes to `max_width` and `max_height` back to `number` fields.
|
191 |
if ( ! empty( $instance['display']['max_height'] ) ) {
|
192 |
+
$instance['display']['max_height'] = (int) $instance['display']['max_height'];
|
193 |
}
|
194 |
|
195 |
if ( ! empty( $instance['display']['max_width'] ) ) {
|
196 |
+
$instance['display']['max_width'] = (int) $instance['display']['max_width'];
|
197 |
}
|
198 |
|
199 |
// Input for `spacing` changed from `number` to `measurement` field.
|
widgets/image-grid/styles/default.less
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
@spacing: default;
|
2 |
|
3 |
.sow-image-grid-wrapper {
|
|
|
|
|
|
|
4 |
padding-top: @spacing;
|
5 |
line-height: 0;
|
6 |
text-align:center;
|
@@ -9,10 +12,6 @@
|
|
9 |
padding: 0 @spacing @spacing @spacing;
|
10 |
display: inline-block;
|
11 |
|
12 |
-
> a {
|
13 |
-
display: inline-block;
|
14 |
-
}
|
15 |
-
|
16 |
img {
|
17 |
opacity: 0;
|
18 |
max-width:100%;
|
1 |
@spacing: default;
|
2 |
|
3 |
.sow-image-grid-wrapper {
|
4 |
+
display: flex;
|
5 |
+
flex-wrap: wrap;
|
6 |
+
justify-content: center;
|
7 |
padding-top: @spacing;
|
8 |
line-height: 0;
|
9 |
text-align:center;
|
12 |
padding: 0 @spacing @spacing @spacing;
|
13 |
display: inline-block;
|
14 |
|
|
|
|
|
|
|
|
|
15 |
img {
|
16 |
opacity: 0;
|
17 |
max-width:100%;
|
widgets/image-grid/tpl/default.php
CHANGED
@@ -7,8 +7,8 @@
|
|
7 |
?>
|
8 |
<?php if( ! empty( $images ) ) : ?>
|
9 |
<div class="sow-image-grid-wrapper"
|
10 |
-
<?php if( !empty( $max_width ) ) echo 'data-max-width="' .
|
11 |
-
<?php if( !empty( $max_height ) ) echo 'data-max-height="' .
|
12 |
<?php foreach( $images as $image ) : ?>
|
13 |
<div class="sow-image-grid-image">
|
14 |
<?php if ( ! empty( $image['url'] ) ) : ?>
|
7 |
?>
|
8 |
<?php if( ! empty( $images ) ) : ?>
|
9 |
<div class="sow-image-grid-wrapper"
|
10 |
+
<?php if ( !empty( $max_width ) ) echo 'data-max-width="' . (int) $max_width . '"' ?>
|
11 |
+
<?php if ( !empty( $max_height ) ) echo 'data-max-height="' . (int) $max_height . '"' ?>>
|
12 |
<?php foreach( $images as $image ) : ?>
|
13 |
<div class="sow-image-grid-image">
|
14 |
<?php if ( ! empty( $image['url'] ) ) : ?>
|
widgets/image/image.php
CHANGED
@@ -37,6 +37,7 @@ class SiteOrigin_Widget_Image_Widget extends SiteOrigin_Widget {
|
|
37 |
'size' => array(
|
38 |
'type' => 'image-size',
|
39 |
'label' => __('Image size', 'so-widgets-bundle'),
|
|
|
40 |
),
|
41 |
|
42 |
'align' => array(
|
@@ -117,6 +118,18 @@ class SiteOrigin_Widget_Image_Widget extends SiteOrigin_Widget {
|
|
117 |
public function get_template_variables( $instance, $args ) {
|
118 |
$title = $this->get_image_title( $instance );
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
$src = siteorigin_widgets_get_attachment_image_src(
|
121 |
$instance['image'],
|
122 |
$instance['size'],
|
37 |
'size' => array(
|
38 |
'type' => 'image-size',
|
39 |
'label' => __('Image size', 'so-widgets-bundle'),
|
40 |
+
'custom_size' => true,
|
41 |
),
|
42 |
|
43 |
'align' => array(
|
118 |
public function get_template_variables( $instance, $args ) {
|
119 |
$title = $this->get_image_title( $instance );
|
120 |
|
121 |
+
// Add support for custom sizes.
|
122 |
+
if (
|
123 |
+
$instance['size'] == 'custom_size' &&
|
124 |
+
! empty( $instance['size_width'] ) &&
|
125 |
+
! empty( $instance['size_height'] )
|
126 |
+
) {
|
127 |
+
$instance['size'] = array(
|
128 |
+
(int) $instance['size_width'],
|
129 |
+
(int) $instance['size_width'],
|
130 |
+
);
|
131 |
+
}
|
132 |
+
|
133 |
$src = siteorigin_widgets_get_attachment_image_src(
|
134 |
$instance['image'],
|
135 |
$instance['size'],
|
widgets/layout-slider/layout-slider.php
CHANGED
@@ -252,7 +252,7 @@ class SiteOrigin_Widget_LayoutSlider_Widget extends SiteOrigin_Widget_Base_Slide
|
|
252 |
'new_window' => !empty( $frame['background']['new_window'] ),
|
253 |
'videos' => $frame['background']['videos'],
|
254 |
'video-sizing' => 'background',
|
255 |
-
'opacity' =>
|
256 |
);
|
257 |
}
|
258 |
|
@@ -331,7 +331,7 @@ class SiteOrigin_Widget_LayoutSlider_Widget extends SiteOrigin_Widget_Base_Slide
|
|
331 |
$less['vertically_align'] = empty( $instance['design']['vertically_align'] ) ? 'false' : 'true';
|
332 |
|
333 |
if ( ! empty( $instance['design']['heading_shadow'] ) ) {
|
334 |
-
$less['heading_shadow'] =
|
335 |
}
|
336 |
|
337 |
if ( ! empty( $instance['design']['heading_color'] ) ) {
|
252 |
'new_window' => !empty( $frame['background']['new_window'] ),
|
253 |
'videos' => $frame['background']['videos'],
|
254 |
'video-sizing' => 'background',
|
255 |
+
'opacity' => (int) $frame['background']['opacity'] / 100,
|
256 |
);
|
257 |
}
|
258 |
|
331 |
$less['vertically_align'] = empty( $instance['design']['vertically_align'] ) ? 'false' : 'true';
|
332 |
|
333 |
if ( ! empty( $instance['design']['heading_shadow'] ) ) {
|
334 |
+
$less['heading_shadow'] = (int) $instance['design']['heading_shadow'];
|
335 |
}
|
336 |
|
337 |
if ( ! empty( $instance['design']['heading_color'] ) ) {
|
widgets/post-carousel/css/style.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@font-face{font-family:'carousel-arrows';src:url('fonts/carousel-arrows.eot?-95vnmw');src:url('fonts/carousel-arrows.eot?#iefix-95vnmw') format('embedded-opentype'),url('fonts/carousel-arrows.woff?-95vnmw') format('woff'),url('fonts/carousel-arrows.ttf?-95vnmw') format('truetype'),url('fonts/carousel-arrows.svg?-95vnmw#carousel-arrows') format('svg');font-weight:normal;font-style:normal;font-display:block}.sow-carousel-title.has-title{align-items:baseline;display:flex}.sow-carousel-title.has-title .sow-carousel-navigation{margin-left:auto}body.rtl .sow-carousel-title.has-title .sow-carousel-navigation{margin-right:auto;margin-left:initial}.sow-carousel-title .widget-title{display:inline-block;padding-right:15px}.sow-carousel-title .sow-carousel-navigation{float:right}body.rtl .sow-carousel-title .sow-carousel-navigation{float:left}body.rtl .sow-carousel-title .sow-carousel-navigation a{margin-left:0;margin-right:2px}.sow-carousel-title a.sow-carousel-next,.sow-carousel-title a.sow-carousel-previous{font-family:'carousel-arrows';speak:none;display:block;float:right;overflow:hidden;margin-left:2px;margin-top:3px;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;font-size:8px;line-height:18px;width:18px;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;border-radius:2px}.sow-carousel-title a.sow-carousel-next:before{content:"\e601"}.sow-carousel-title a.sow-carousel-previous:before{content:"\e600"}@media screen and (max-width:600px){.sow-carousel-title a.sow-carousel-previous{display:none}.sow-carousel-title a.sow-carousel-next{display:none}}.widget_sow-carousel{overflow-x:hidden;overflow-y:hidden}.sow-carousel-wrapper{overflow:hidden;position:relative;left:0;right:0}.sow-carousel-wrapper .sow-carousel-items{-webkit-transition:all .45s ease;-moz-transition:all .45s ease;-o-transition:all .45s ease;transition:all .45s ease;margin:0;padding:0;zoom:1}.sow-carousel-wrapper .sow-carousel-items:before{content:'';display:block}.sow-carousel-wrapper .sow-carousel-items:after{content:'';display:table;clear:both}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item{display:block;margin-right:15px}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail{line-height:0}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail:focus{outline:none}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail a{display:block;background-position:center center}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail a,.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail a span.overlay{-webkit-transition:all .35s ease;-moz-transition:all .35s ease;-o-transition:all .35s ease;transition:all .35s ease}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail a span.overlay{display:block;width:100%;height:100%;opacity:0;position:static}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-
|
1 |
+
@font-face{font-family:'carousel-arrows';src:url('fonts/carousel-arrows.eot?-95vnmw');src:url('fonts/carousel-arrows.eot?#iefix-95vnmw') format('embedded-opentype'),url('fonts/carousel-arrows.woff?-95vnmw') format('woff'),url('fonts/carousel-arrows.ttf?-95vnmw') format('truetype'),url('fonts/carousel-arrows.svg?-95vnmw#carousel-arrows') format('svg');font-weight:normal;font-style:normal;font-display:block}.sow-carousel-title.has-title{align-items:baseline;display:flex}.sow-carousel-title.has-title .sow-carousel-navigation{margin-left:auto}body.rtl .sow-carousel-title.has-title .sow-carousel-navigation{margin-right:auto;margin-left:initial}.sow-carousel-title .widget-title{display:inline-block;padding-right:15px}.sow-carousel-title .sow-carousel-navigation{float:right}body.rtl .sow-carousel-title .sow-carousel-navigation{float:left}body.rtl .sow-carousel-title .sow-carousel-navigation a{margin-left:0;margin-right:2px}.sow-carousel-title a.sow-carousel-next,.sow-carousel-title a.sow-carousel-previous{font-family:'carousel-arrows';speak:none;display:block;float:right;overflow:hidden;margin-left:2px;margin-top:3px;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;font-size:8px;line-height:18px;width:18px;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;border-radius:2px}.sow-carousel-title a.sow-carousel-next:before{content:"\e601"}.sow-carousel-title a.sow-carousel-previous:before{content:"\e600"}@media screen and (max-width:600px){.sow-carousel-title a.sow-carousel-previous{display:none}.sow-carousel-title a.sow-carousel-next{display:none}}.widget_sow-carousel{overflow-x:hidden;overflow-y:hidden}.sow-carousel-wrapper{overflow:hidden;position:relative;left:0;right:0}.sow-carousel-wrapper .sow-carousel-items{-webkit-transition:all .45s ease;-moz-transition:all .45s ease;-o-transition:all .45s ease;transition:all .45s ease;margin:0;padding:0;zoom:1}.sow-carousel-wrapper .sow-carousel-items:before{content:'';display:block}.sow-carousel-wrapper .sow-carousel-items:after{content:'';display:table;clear:both}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item{display:block;margin-right:15px}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail{line-height:0}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail:focus{outline:none}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail a{display:block;background-position:center center}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail a,.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail a span.overlay{-webkit-transition:all .35s ease;-moz-transition:all .35s ease;-o-transition:all .35s ease;transition:all .35s ease}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-thumbnail a span.overlay{display:block;width:100%;height:100%;opacity:0;position:static}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item .sow-carousel-default-thumbnail{display:block;background:#E8E8E8;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #E0E0E0), color-stop(1, #E8E8E8));background:-ms-linear-gradient(bottom, #E0E0E0, #E8E8E8);background:-moz-linear-gradient(center bottom, #E0E0E0 0%, #E8E8E8 100%);background:-o-linear-gradient(#E8E8E8, #E0E0E0)}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item h3{font-size:15px;text-align:center;font-weight:500;color:#474747;margin:10px 0 0 0}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-item h3 a{text-decoration:none;color:inherit}.sow-carousel-wrapper .sow-carousel-items .sow-carousel-loading{display:block;background:url(images/carousel-loader.gif) #F6F6F6 center center no-repeat;margin:0}a.sow-carousel-previous{display:none}a.sow-carousel-next{display:none}
|
widgets/post-carousel/js/carousel.js
CHANGED
@@ -63,7 +63,7 @@ jQuery( function ( $ ) {
|
|
63 |
e.preventDefault();
|
64 |
var $items = $$.find( '.sow-carousel-items' ),
|
65 |
numItems = $items.find( '.sow-carousel-item' ).length,
|
66 |
-
complete = numItems
|
67 |
numVisibleItems = Math.ceil( $items.outerWidth() / $items.find( '.sow-carousel-item' ).outerWidth( true ) ),
|
68 |
lastPosition = numItems - numVisibleItems + 1,
|
69 |
slidesToScroll = $items.slick( 'slickGetOption', 'slidesToScroll' );
|
@@ -121,10 +121,6 @@ jQuery( function ( $ ) {
|
|
121 |
if ( $$.data( 'loop-posts-enabled' ) ) {
|
122 |
$items.slick( 'slickGoTo', 0 );
|
123 |
}
|
124 |
-
// Check if the next slide is the last slide and prevent blank spacing.
|
125 |
-
} else if ( complete && $items.slick( 'slickCurrentSlide' ) + numVisibleItems >= lastPosition ) {
|
126 |
-
$items.setSlideTo( lastPosition );
|
127 |
-
|
128 |
// Check if the number of slides to scroll exceeds lastPosition, go to the last slide.
|
129 |
} else if ( $items.slick( 'slickCurrentSlide' ) + slidesToScroll > lastPosition - 1 ) {
|
130 |
$items.setSlideTo( lastPosition );
|
63 |
e.preventDefault();
|
64 |
var $items = $$.find( '.sow-carousel-items' ),
|
65 |
numItems = $items.find( '.sow-carousel-item' ).length,
|
66 |
+
complete = numItems >= $$.data( 'post-count' ),
|
67 |
numVisibleItems = Math.ceil( $items.outerWidth() / $items.find( '.sow-carousel-item' ).outerWidth( true ) ),
|
68 |
lastPosition = numItems - numVisibleItems + 1,
|
69 |
slidesToScroll = $items.slick( 'slickGetOption', 'slidesToScroll' );
|
121 |
if ( $$.data( 'loop-posts-enabled' ) ) {
|
122 |
$items.slick( 'slickGoTo', 0 );
|
123 |
}
|
|
|
|
|
|
|
|
|
124 |
// Check if the number of slides to scroll exceeds lastPosition, go to the last slide.
|
125 |
} else if ( $items.slick( 'slickCurrentSlide' ) + slidesToScroll > lastPosition - 1 ) {
|
126 |
$items.setSlideTo( lastPosition );
|
widgets/post-carousel/js/carousel.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var sowb=window.sowb||{};jQuery((function(i){sowb.setupCarousel=function(){i.fn.setSlideTo=function(e){$item=i(this);var s=$item.slick("slickGetOption","slidesToShow"),t=$item.slick("slickGetOption","slidesToScroll");$item.slick("slickSetOption","slidesToShow",1),$item.slick("slickSetOption","slidesToScroll",1),$item.slick("slickGoTo",e),$item.slick("slickSetOption","slidesToShow",s),$item.slick("slickSetOption","slidesToScroll",t)},i(".sow-carousel-wrapper").each((function(){var e=i(this),s=e.find(".sow-carousel-items"),t=e.data("responsive");s.not(".slick-initialized").slick({arrows:!1,infinite:!1,rows:0,rtl:"rtl"==e.data("dir"),touchThreshold:20,variableWidth:!0,accessibility:!1,slidesToScroll:t.desktop_slides,slidesToShow:t.desktop_slides,responsive:[{breakpoint:t.tablet_portrait_breakpoint,settings:{slidesToScroll:t.tablet_portrait_slides,slidesToShow:t.tablet_portrait_slides}},{breakpoint:t.mobile_breakpoint,settings:{slidesToScroll:t.mobile_slides,slidesToShow:t.mobile_slides}}]}),s.on("swipe",(function(i,s,t){e.parent().parent().find(".sow-carousel-"+("left"==t?"next":"prev")).trigger("touchend")})),e.parent().parent().find(".sow-carousel-previous, .sow-carousel-next").on("click touchend",(function(s,t){s.preventDefault();var o=e.find(".sow-carousel-items"),l=o.find(".sow-carousel-item").length,a=l
|
1 |
+
var sowb=window.sowb||{};jQuery((function(i){sowb.setupCarousel=function(){i.fn.setSlideTo=function(e){$item=i(this);var s=$item.slick("slickGetOption","slidesToShow"),t=$item.slick("slickGetOption","slidesToScroll");$item.slick("slickSetOption","slidesToShow",1),$item.slick("slickSetOption","slidesToScroll",1),$item.slick("slickGoTo",e),$item.slick("slickSetOption","slidesToShow",s),$item.slick("slickSetOption","slidesToScroll",t)},i(".sow-carousel-wrapper").each((function(){var e=i(this),s=e.find(".sow-carousel-items"),t=e.data("responsive");s.not(".slick-initialized").slick({arrows:!1,infinite:!1,rows:0,rtl:"rtl"==e.data("dir"),touchThreshold:20,variableWidth:!0,accessibility:!1,slidesToScroll:t.desktop_slides,slidesToShow:t.desktop_slides,responsive:[{breakpoint:t.tablet_portrait_breakpoint,settings:{slidesToScroll:t.tablet_portrait_slides,slidesToShow:t.tablet_portrait_slides}},{breakpoint:t.mobile_breakpoint,settings:{slidesToScroll:t.mobile_slides,slidesToShow:t.mobile_slides}}]}),s.on("swipe",(function(i,s,t){e.parent().parent().find(".sow-carousel-"+("left"==t?"next":"prev")).trigger("touchend")})),e.parent().parent().find(".sow-carousel-previous, .sow-carousel-next").on("click touchend",(function(s,t){s.preventDefault();var o=e.find(".sow-carousel-items"),l=o.find(".sow-carousel-item").length,a=l>=e.data("post-count"),n=Math.ceil(o.outerWidth()/o.find(".sow-carousel-item").outerWidth(!0)),c=l-n+1,r=o.slick("slickGetOption","slidesToScroll");if(!a&&(o.slick("slickCurrentSlide")+n>=l-1||o.slick("slickCurrentSlide")+r>c-1)&&!e.data("fetching")){e.data("fetching",!0);var d=e.data("page")+1;o.slick("slickAdd",'<div class="sow-carousel-item sow-carousel-loading"></div>'),i.get(e.data("ajax-url"),{action:"sow_carousel_load",paged:d,instance_hash:e.parent().parent().find('input[name="instance_hash"]').val()},(function(i,s){o.find(".sow-carousel-loading").remove(),o.slick("slickAdd",i.html),l=e.find(".sow-carousel-item").length,e.data("fetching",!1),e.data("page",d),t&&o.find('.sow-carousel-item[tabindex="0"]').trigger("focus")}))}i(this).hasClass("sow-carousel-next")?a&&o.slick("slickCurrentSlide")>=c?e.data("loop-posts-enabled")&&o.slick("slickGoTo",0):o.slick("slickCurrentSlide")+r>c-1?o.setSlideTo(c):o.slick("slickNext"):i(this).hasClass("sow-carousel-previous")&&(e.data("loop-posts-enabled")&&0==o.slick("slickCurrentSlide")?o.slick("slickGoTo",c):o.slick("slickPrev"))}))})),i(document).on("keydown",".sow-carousel-navigation a",(function(e){13!=e.keyCode&&32!=e.keyCode||(e.preventDefault(),i(this).trigger("click"))})),i(document).on("keyup",".sow-carousel-item",(function(e){if(13==e.keyCode&&i(this).find("h3 a")[0].click(),37==e.keyCode||39==e.keyCode){var s=i(this).parents(".sow-carousel-wrapper"),t=s.find(".sow-carousel-items"),o=t.find(".sow-carousel-item").length,l=i(this).data("slick-index"),a=o-(o===s.data("post-count")?0:1);if(37==e.keyCode)--l<0&&(l=a);else if(39==e.keyCode&&++l>=a){if(s.data("fetching"))return;s.parent().find(".sow-carousel-next").trigger("click",!0)}t.slick("slickGoTo",l,!0),s.find(".sow-carousel-item").prop("tabindex",-1),s.find('.sow-carousel-item[data-slick-index="'+l+'"]').trigger("focus").prop("tabindex",0)}})),i(window).on("resize load",(function(){i(".sow-carousel-wrapper").each((function(){var e=i(this),s=e.find(".sow-carousel-items.slick-initialized"),t=Math.ceil(s.outerWidth()/s.find(".sow-carousel-item").outerWidth(!0)),o=e.parent().parent().find(".sow-carousel-navigation");t>=e.data("post-count")?(o.hide(),s.slick("slickSetOption","touchMove",!1),s.slick("slickSetOption","draggable",!1)):o.not(":visible")&&(o.show(),s.slick("slickSetOption","touchMove",!0),s.slick("slickSetOption","draggable",!0));var l=e.data("responsive");window.matchMedia("(min-width: "+l.tablet_portrait_breakpoint+"px) and (max-width: "+l.tablet_landscape_breakpoint+"px) and (orientation: landscape)").matches&&(s.slick("slickSetOption","slidesToShow",l.tablet_landscape_slides),s.slick("slickSetOption","slidesToScroll",l.tablet_landscape_slides))})),i(".sow-carousel-item:first-of-type").prop("tabindex",0)}))},sowb.setupCarousel(),i(sowb).on("setup_widgets",sowb.setupCarousel)})),window.sowb=sowb;
|
widgets/post-carousel/post-carousel.php
CHANGED
@@ -15,6 +15,38 @@ function sow_carousel_register_image_sizes(){
|
|
15 |
}
|
16 |
add_action('init', 'sow_carousel_register_image_sizes');
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
function sow_carousel_get_next_posts_page() {
|
19 |
if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
|
20 |
|
@@ -26,17 +58,26 @@ function sow_carousel_get_next_posts_page() {
|
|
26 |
$widget = ! empty ( $wp_widget_factory->widgets['SiteOrigin_Widget_PostCarousel_Widget'] ) ?
|
27 |
$wp_widget_factory->widgets['SiteOrigin_Widget_PostCarousel_Widget'] : null;
|
28 |
if ( ! empty( $widget ) ) {
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
-
ob_start();
|
35 |
-
extract( $template_vars );
|
36 |
-
include 'tpl/carousel-post-loop.php';
|
37 |
-
$result = array( 'html' => ob_get_clean() );
|
38 |
-
header('content-type: application/json');
|
39 |
-
echo json_encode( $result );
|
40 |
|
41 |
exit();
|
42 |
}
|
@@ -171,6 +212,14 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
|
|
171 |
'label' => __( 'Thumbnail overlay hover color', 'so-widgets-bundle' ),
|
172 |
'default' => '#3279BB',
|
173 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
'navigation_color' => array(
|
175 |
'type' => 'color',
|
176 |
'label' => __( 'Navigation arrow color', 'so-widgets-bundle' ),
|
@@ -300,6 +349,7 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
|
|
300 |
'thumbnail_hover_width' => $thumb_hover_width . 'px',
|
301 |
'thumbnail_hover_height'=> $thumb_hover_height . 'px',
|
302 |
'thumbnail_overlay_hover_color' => ! empty ( $instance['design']['thumbnail_overlay_hover_color'] ) ? $instance['design']['thumbnail_overlay_hover_color'] : '',
|
|
|
303 |
'navigation_color' => ! empty ( $instance['design']['navigation_color'] ) ? $instance['design']['navigation_color'] : '',
|
304 |
'navigation_color_hover' => ! empty ( $instance['design']['navigation_color_hover'] ) ? $instance['design']['navigation_color_hover'] : '',
|
305 |
'navigation_background' => ! empty ( $instance['design']['navigation_background'] ) ? $instance['design']['navigation_background'] : '',
|
@@ -333,7 +383,7 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
|
|
333 |
|
334 |
return array(
|
335 |
'title' => $instance['title'],
|
336 |
-
'posts' => $posts,
|
337 |
'default_thumbnail' => ! empty( $default_thumbnail ) ? $default_thumbnail[0] : '',
|
338 |
'loop_posts' => ! empty( $instance['loop_posts'] ),
|
339 |
'link_target' => ! empty( $instance['link_target'] ) ? $instance['link_target'] : 'same',
|
15 |
}
|
16 |
add_action('init', 'sow_carousel_register_image_sizes');
|
17 |
|
18 |
+
/**
|
19 |
+
* This function allows for users to limit the total number of posts.
|
20 |
+
*/
|
21 |
+
function sow_carousel_handle_post_limit( $posts, $paged = 0 ) {
|
22 |
+
$post_limit = apply_filters( 'siteorigin_widgets_post_carousel_post_limit', false );
|
23 |
+
|
24 |
+
if ( is_numeric( $post_limit ) && $posts->found_posts > $post_limit ) {
|
25 |
+
$posts_per_page = $posts->query['posts_per_page'];
|
26 |
+
$current = $posts_per_page * ( $paged - 1 );
|
27 |
+
|
28 |
+
if ( $current < 0 ) {
|
29 |
+
$current = $posts_per_page;
|
30 |
+
}
|
31 |
+
|
32 |
+
set_query_var( 'sow-total_posts', $post_limit - 1 );
|
33 |
+
if ( $current >= $post_limit ) {
|
34 |
+
// Check if we've exceeded the expected pagination.
|
35 |
+
if ( $current + 1 > $post_limit + $posts_per_page ) {
|
36 |
+
$posts->posts = null;
|
37 |
+
} else {
|
38 |
+
// Work out how many posts we need to return
|
39 |
+
$posts->post_count = $post_limit % $posts_per_page;
|
40 |
+
$posts->posts = array_slice( $posts->posts, $current % $posts_per_page, $posts->post_count );
|
41 |
+
}
|
42 |
+
}
|
43 |
+
} else {
|
44 |
+
set_query_var( 'sow-total_posts', $posts->found_posts );
|
45 |
+
}
|
46 |
+
|
47 |
+
return $posts;
|
48 |
+
}
|
49 |
+
|
50 |
function sow_carousel_get_next_posts_page() {
|
51 |
if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
|
52 |
|
58 |
$widget = ! empty ( $wp_widget_factory->widgets['SiteOrigin_Widget_PostCarousel_Widget'] ) ?
|
59 |
$wp_widget_factory->widgets['SiteOrigin_Widget_PostCarousel_Widget'] : null;
|
60 |
if ( ! empty( $widget ) ) {
|
61 |
+
$instance = $widget->get_stored_instance( $instance_hash );
|
62 |
+
$instance['paged'] = (int) $_GET['paged'];
|
63 |
+
$template_vars = $widget->get_template_variables( $instance, array() );
|
64 |
+
|
65 |
+
$template_vars['posts'] = sow_carousel_handle_post_limit(
|
66 |
+
$template_vars['posts'],
|
67 |
+
$instance['paged']
|
68 |
+
);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
// Don't output anything if there are no posts to return;
|
73 |
+
if ( ! empty( $template_vars['posts']->posts ) ) {
|
74 |
+
ob_start();
|
75 |
+
extract( $template_vars );
|
76 |
+
include 'tpl/carousel-post-loop.php';
|
77 |
+
$result = array( 'html' => ob_get_clean() );
|
78 |
+
header( 'content-type: application/json' );
|
79 |
+
echo json_encode( $result );
|
80 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
exit();
|
83 |
}
|
212 |
'label' => __( 'Thumbnail overlay hover color', 'so-widgets-bundle' ),
|
213 |
'default' => '#3279BB',
|
214 |
),
|
215 |
+
'thumbnail_overlay_hover_opacity' => array(
|
216 |
+
'type' => 'slider',
|
217 |
+
'label' => __( 'Thumbnail overlay hover opacity', 'so-widgets-bundle' ),
|
218 |
+
'default' => '0.5',
|
219 |
+
'min' => 0,
|
220 |
+
'max' => 1,
|
221 |
+
'step' => 0.1,
|
222 |
+
),
|
223 |
'navigation_color' => array(
|
224 |
'type' => 'color',
|
225 |
'label' => __( 'Navigation arrow color', 'so-widgets-bundle' ),
|
349 |
'thumbnail_hover_width' => $thumb_hover_width . 'px',
|
350 |
'thumbnail_hover_height'=> $thumb_hover_height . 'px',
|
351 |
'thumbnail_overlay_hover_color' => ! empty ( $instance['design']['thumbnail_overlay_hover_color'] ) ? $instance['design']['thumbnail_overlay_hover_color'] : '',
|
352 |
+
'thumbnail_overlay_hover_opacity' => ! empty ( $instance['design']['thumbnail_overlay_hover_opacity'] ) ? $instance['design']['thumbnail_overlay_hover_opacity'] : 0.5,
|
353 |
'navigation_color' => ! empty ( $instance['design']['navigation_color'] ) ? $instance['design']['navigation_color'] : '',
|
354 |
'navigation_color_hover' => ! empty ( $instance['design']['navigation_color_hover'] ) ? $instance['design']['navigation_color_hover'] : '',
|
355 |
'navigation_background' => ! empty ( $instance['design']['navigation_background'] ) ? $instance['design']['navigation_background'] : '',
|
383 |
|
384 |
return array(
|
385 |
'title' => $instance['title'],
|
386 |
+
'posts' => sow_carousel_handle_post_limit( $posts ),
|
387 |
'default_thumbnail' => ! empty( $default_thumbnail ) ? $default_thumbnail[0] : '',
|
388 |
'loop_posts' => ! empty( $instance['loop_posts'] ),
|
389 |
'link_target' => ! empty( $instance['link_target'] ) ? $instance['link_target'] : 'same',
|
widgets/post-carousel/styles/default.less
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
@thumbnail_hover_width: default;
|
5 |
@thumbnail_hover_height: default;
|
6 |
|
|
|
7 |
@thumbnail_overlay_hover_color: #3279BB;
|
8 |
@navigation_color: #fff;
|
9 |
@navigation_color_hover: default;
|
@@ -45,14 +46,17 @@
|
|
45 |
span.overlay {
|
46 |
background: @thumbnail_overlay_hover_color;
|
47 |
}
|
48 |
-
|
49 |
-
&:hover {
|
50 |
-
background-size: @thumbnail_hover_width @thumbnail_hover_height;
|
51 |
-
}
|
52 |
}
|
53 |
|
54 |
-
&:focus
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
|
58 |
.sow-carousel-default-thumbnail {
|
4 |
@thumbnail_hover_width: default;
|
5 |
@thumbnail_hover_height: default;
|
6 |
|
7 |
+
@thumbnail_overlay_hover_opacity: 0.5;
|
8 |
@thumbnail_overlay_hover_color: #3279BB;
|
9 |
@navigation_color: #fff;
|
10 |
@navigation_color_hover: default;
|
46 |
span.overlay {
|
47 |
background: @thumbnail_overlay_hover_color;
|
48 |
}
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
+
&:focus,
|
52 |
+
&:hover {
|
53 |
+
.sow-carousel-thumbnail a {
|
54 |
+
background-size: @thumbnail_hover_width @thumbnail_hover_height;
|
55 |
+
|
56 |
+
span.overlay {
|
57 |
+
opacity: @thumbnail_overlay_hover_opacity;
|
58 |
+
}
|
59 |
+
}
|
60 |
}
|
61 |
|
62 |
.sow-carousel-default-thumbnail {
|
widgets/post-carousel/tpl/base.php
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>" aria-label="<?php esc_attr_e( 'Next Posts', 'so-widgets-bundle') ?>" role="button"></a>
|
29 |
|
30 |
<div class="sow-carousel-wrapper"
|
31 |
-
data-post-count="<?php echo esc_attr(
|
32 |
data-loop-posts-enabled="<?php echo esc_attr( $loop_posts ) ?>"
|
33 |
data-ajax-url="<?php echo sow_esc_url( wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ) ) ?>"
|
34 |
data-page="1"
|
28 |
<a href="#" class="sow-carousel-next" title="<?php esc_attr_e('Next', 'so-widgets-bundle') ?>" aria-label="<?php esc_attr_e( 'Next Posts', 'so-widgets-bundle') ?>" role="button"></a>
|
29 |
|
30 |
<div class="sow-carousel-wrapper"
|
31 |
+
data-post-count="<?php echo esc_attr( get_query_var( 'sow-total_posts' ) ); ?>"
|
32 |
data-loop-posts-enabled="<?php echo esc_attr( $loop_posts ) ?>"
|
33 |
data-ajax-url="<?php echo sow_esc_url( wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ) ) ?>"
|
34 |
data-page="1"
|
widgets/simple-masonry/simple-masonry.php
CHANGED
@@ -240,24 +240,24 @@ class SiteOrigin_Widget_Simple_Masonry_Widget extends SiteOrigin_Widget {
|
|
240 |
'desktop' => siteorigin_widgets_underscores_to_camel_case(
|
241 |
array(
|
242 |
'num_columns' => $instance['desktop_layout']['columns'],
|
243 |
-
'row_height' => empty( $instance['desktop_layout']['row_height'] ) ? 0 :
|
244 |
-
'gutter' => empty( $instance['desktop_layout']['gutter'] ) ? 0 :
|
245 |
)
|
246 |
),
|
247 |
'tablet' => siteorigin_widgets_underscores_to_camel_case(
|
248 |
array(
|
249 |
'break_point' => $instance['tablet_layout']['break_point'],
|
250 |
'num_columns' => $instance['tablet_layout']['columns'],
|
251 |
-
'row_height' => empty( $instance['tablet_layout']['row_height'] ) ? 0 :
|
252 |
-
'gutter' => empty( $instance['tablet_layout']['gutter'] ) ? 0 :
|
253 |
)
|
254 |
),
|
255 |
'mobile' => siteorigin_widgets_underscores_to_camel_case(
|
256 |
array(
|
257 |
'break_point' => $instance['mobile_layout']['break_point'],
|
258 |
'num_columns' => $instance['mobile_layout']['columns'],
|
259 |
-
'row_height' => empty( $instance['mobile_layout']['row_height'] ) ? 0 :
|
260 |
-
'gutter' => empty( $instance['mobile_layout']['gutter'] ) ? 0 :
|
261 |
)
|
262 |
),
|
263 |
)
|
240 |
'desktop' => siteorigin_widgets_underscores_to_camel_case(
|
241 |
array(
|
242 |
'num_columns' => $instance['desktop_layout']['columns'],
|
243 |
+
'row_height' => empty( $instance['desktop_layout']['row_height'] ) ? 0 : (int) $instance['desktop_layout']['row_height'],
|
244 |
+
'gutter' => empty( $instance['desktop_layout']['gutter'] ) ? 0 : (int) $instance['desktop_layout']['gutter'],
|
245 |
)
|
246 |
),
|
247 |
'tablet' => siteorigin_widgets_underscores_to_camel_case(
|
248 |
array(
|
249 |
'break_point' => $instance['tablet_layout']['break_point'],
|
250 |
'num_columns' => $instance['tablet_layout']['columns'],
|
251 |
+
'row_height' => empty( $instance['tablet_layout']['row_height'] ) ? 0 : (int) $instance['tablet_layout']['row_height'],
|
252 |
+
'gutter' => empty( $instance['tablet_layout']['gutter'] ) ? 0 : (int) $instance['tablet_layout']['gutter'],
|
253 |
)
|
254 |
),
|
255 |
'mobile' => siteorigin_widgets_underscores_to_camel_case(
|
256 |
array(
|
257 |
'break_point' => $instance['mobile_layout']['break_point'],
|
258 |
'num_columns' => $instance['mobile_layout']['columns'],
|
259 |
+
'row_height' => empty( $instance['mobile_layout']['row_height'] ) ? 0 : (int) $instance['mobile_layout']['row_height'],
|
260 |
+
'gutter' => empty( $instance['mobile_layout']['gutter'] ) ? 0 : (int) $instance['mobile_layout']['gutter'],
|
261 |
)
|
262 |
),
|
263 |
)
|
widgets/slider/slider.php
CHANGED
@@ -89,6 +89,13 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
89 |
'library' => 'image',
|
90 |
'label' => __('Foreground image', 'so-widgets-bundle'),
|
91 |
'fallback' => true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
),
|
93 |
|
94 |
'url' => array(
|
@@ -107,7 +114,30 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
107 |
'type' => 'section',
|
108 |
'label' => __('Controls', 'so-widgets-bundle'),
|
109 |
'fields' => $this->control_form_fields()
|
110 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
);
|
112 |
}
|
113 |
|
@@ -152,7 +182,7 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
152 |
if( !empty($foreground_src) ) {
|
153 |
?>
|
154 |
<div class="sow-slider-image-container">
|
155 |
-
<div class="sow-slider-image-wrapper" style="<?php if(!empty($foreground_src[1])) echo 'max-width: ' .
|
156 |
<?php if ( ! empty( $frame['url'] ) ) : ?>
|
157 |
<a href="<?php echo sow_esc_url( $frame['url'] ) ?>"
|
158 |
<?php foreach( $frame['link_attributes'] as $att => $val ) : ?>
|
@@ -161,17 +191,19 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
161 |
<?php endif; ?>
|
162 |
<?php endforeach; ?>>
|
163 |
<?php endif; ?>
|
164 |
-
<?php
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
|
|
|
|
175 |
<?php if ( ! empty( $frame['url'] ) ) : ?>
|
176 |
</a>
|
177 |
<?php endif; ?>
|
@@ -242,6 +274,14 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
|
|
242 |
if( !empty($instance['controls']['nav_color_hex']) ) $less['nav_color_hex'] = $instance['controls']['nav_color_hex'];
|
243 |
if( !empty($instance['controls']['nav_size']) ) $less['nav_size'] = $instance['controls']['nav_size'];
|
244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
return $less;
|
246 |
}
|
247 |
|
89 |
'library' => 'image',
|
90 |
'label' => __('Foreground image', 'so-widgets-bundle'),
|
91 |
'fallback' => true,
|
92 |
+
'state_emitter' => array(
|
93 |
+
'callback' => 'conditional',
|
94 |
+
'args' => array(
|
95 |
+
'show_height[show]: val',
|
96 |
+
'show_height[hide]: ! val'
|
97 |
+
),
|
98 |
+
),
|
99 |
),
|
100 |
|
101 |
'url' => array(
|
114 |
'type' => 'section',
|
115 |
'label' => __('Controls', 'so-widgets-bundle'),
|
116 |
'fields' => $this->control_form_fields()
|
117 |
+
),
|
118 |
+
|
119 |
+
'design' => array(
|
120 |
+
'type' => 'section',
|
121 |
+
'label' => __('Design', 'so-widgets-bundle'),
|
122 |
+
'state_handler' => array(
|
123 |
+
'show_height[show]' => array( 'show' ),
|
124 |
+
'show_height[hide]' => array( 'hide' ),
|
125 |
+
),
|
126 |
+
'fields' => array(
|
127 |
+
'height' => array(
|
128 |
+
'type' => 'measurement',
|
129 |
+
'label' => __( 'Height', 'so-widgets-bundle' ),
|
130 |
+
'default' => 'default',
|
131 |
+
),
|
132 |
+
|
133 |
+
'height_responsive' => array(
|
134 |
+
'type' => 'measurement',
|
135 |
+
'label' => __( 'Responsive Height', 'so-widgets-bundle' ),
|
136 |
+
'default' => 'default',
|
137 |
+
),
|
138 |
+
),
|
139 |
+
),
|
140 |
+
|
141 |
);
|
142 |
}
|
143 |
|
182 |
if( !empty($foreground_src) ) {
|
183 |
?>
|
184 |
<div class="sow-slider-image-container">
|
185 |
+
<div class="sow-slider-image-wrapper" style="<?php if( ! empty( $foreground_src[1] ) ) echo 'max-width: ' . (int) $foreground_src[1] . 'px'; ?>">
|
186 |
<?php if ( ! empty( $frame['url'] ) ) : ?>
|
187 |
<a href="<?php echo sow_esc_url( $frame['url'] ) ?>"
|
188 |
<?php foreach( $frame['link_attributes'] as $att => $val ) : ?>
|
191 |
<?php endif; ?>
|
192 |
<?php endforeach; ?>>
|
193 |
<?php endif; ?>
|
194 |
+
<div class="sow-slider-image-foreground-wrapper" style="<?php if ( ! empty( $foreground_src[2] ) ) echo 'height: ' . intval( $foreground_src[2] ) . 'px;'; ?>">
|
195 |
+
<?php
|
196 |
+
echo siteorigin_widgets_get_attachment_image(
|
197 |
+
$frame['foreground_image'],
|
198 |
+
'full',
|
199 |
+
! empty( $frame['foreground_image_fallback'] ) ? $frame['foreground_image_fallback'] : '',
|
200 |
+
array(
|
201 |
+
'class' => 'sow-slider-foreground-image',
|
202 |
+
'loading' => 'eager',
|
203 |
+
)
|
204 |
+
);
|
205 |
+
?>
|
206 |
+
</div>
|
207 |
<?php if ( ! empty( $frame['url'] ) ) : ?>
|
208 |
</a>
|
209 |
<?php endif; ?>
|
274 |
if( !empty($instance['controls']['nav_color_hex']) ) $less['nav_color_hex'] = $instance['controls']['nav_color_hex'];
|
275 |
if( !empty($instance['controls']['nav_size']) ) $less['nav_size'] = $instance['controls']['nav_size'];
|
276 |
|
277 |
+
$less['slide_height'] = ! empty( $instance['design']['height'] ) ? $instance['design']['height'] : false;
|
278 |
+
$less['slide_height_responsive'] = ! empty( $instance['design']['height_responsive'] ) ? $instance['design']['height_responsive'] : false;
|
279 |
+
|
280 |
+
$global_settings = $this->get_global_settings();
|
281 |
+
if ( ! empty( $global_settings['responsive_breakpoint'] ) ) {
|
282 |
+
$less['responsive_breakpoint'] = $global_settings['responsive_breakpoint'];
|
283 |
+
}
|
284 |
+
|
285 |
return $less;
|
286 |
}
|
287 |
|
widgets/slider/styles/default.less
CHANGED
@@ -2,8 +2,52 @@
|
|
2 |
@nav_color_hex: #FFFFFF;
|
3 |
@nav_size: 25;
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
.sow-slider-base {
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
.sow-slider-pagination {
|
9 |
li a {
|
@@ -20,4 +64,4 @@
|
|
20 |
}
|
21 |
}
|
22 |
|
23 |
-
}
|
2 |
@nav_color_hex: #FFFFFF;
|
3 |
@nav_size: 25;
|
4 |
|
5 |
+
@responsive_breakpoint: 780px;
|
6 |
+
@slide_height: default;
|
7 |
+
@slide_height_responsive: default;
|
8 |
+
|
9 |
+
// Prevent jump by "pre-filling" slider widget area if height is set.
|
10 |
+
& when ( isnumber( @slide_height ) ) {
|
11 |
+
@media (min-width: @responsive_breakpoint) {
|
12 |
+
& {
|
13 |
+
min-height: @slide_height;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
& when ( isnumber( @slide_height_responsive ) ) {
|
19 |
+
@media (max-width: @responsive_breakpoint) {
|
20 |
+
& {
|
21 |
+
min-height: @slide_height_responsive;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
.sow-slider-base {
|
27 |
|
28 |
+
ul.sow-slider-images {
|
29 |
+
|
30 |
+
.sow-slider-image-wrapper {
|
31 |
+
height: @slide_height;
|
32 |
+
|
33 |
+
// Vertically align foreground image if there's a height set.
|
34 |
+
& when ( isnumber( @slide_height ) ), ( isnumber( @responsive_breakpoint ) ) {
|
35 |
+
& {
|
36 |
+
display: flex;
|
37 |
+
align-items: center;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
& when ( isnumber( @slide_height_responsive ) ) {
|
42 |
+
@media (max-width: @responsive_breakpoint) {
|
43 |
+
& {
|
44 |
+
height: @slide_height_responsive;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
|
52 |
.sow-slider-pagination {
|
53 |
li a {
|
64 |
}
|
65 |
}
|
66 |
|
67 |
+
}
|
widgets/social-media-buttons/data/networks.php
CHANGED
@@ -148,6 +148,12 @@ return array(
|
|
148 |
'icon_color' => '#FFFFFF',
|
149 |
'button_color' => '#B2C01C'
|
150 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
'dribbble' => array(
|
152 |
'label' => __( 'Dribbble', 'so-widgets-bundle' ),
|
153 |
'base_url' => 'https://dribbble.com/',
|
148 |
'icon_color' => '#FFFFFF',
|
149 |
'button_color' => '#B2C01C'
|
150 |
),
|
151 |
+
'discord' => array(
|
152 |
+
'label' => __( 'Discord', 'so-widgets-bundle' ),
|
153 |
+
'base_url' => 'https://discord.gg/',
|
154 |
+
'icon_color' => '#ffffff',
|
155 |
+
'button_color' => '#7289da',
|
156 |
+
),
|
157 |
'dribbble' => array(
|
158 |
'label' => __( 'Dribbble', 'so-widgets-bundle' ),
|
159 |
'base_url' => 'https://dribbble.com/',
|
widgets/tabs/js/tabs.js
CHANGED
@@ -90,7 +90,7 @@ jQuery( function ( $ ) {
|
|
90 |
complete: function() {
|
91 |
$( this ).trigger( 'show' );
|
92 |
|
93 |
-
if ( shouldScroll( $tab ) ) {
|
94 |
scrollToTab( true );
|
95 |
}
|
96 |
}
|
90 |
complete: function() {
|
91 |
$( this ).trigger( 'show' );
|
92 |
|
93 |
+
if ( preventHashChange || shouldScroll( $tab ) ) {
|
94 |
scrollToTab( true );
|
95 |
}
|
96 |
}
|
widgets/tabs/js/tabs.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var sowb=window.sowb||{};jQuery((function(t){sowb.setupTabs=function(){t(".sow-tabs").each((function(e,a){var i=t(a),o=i.closest(".so-widget-sow-tabs");if(o.data("initialized"))return t(this);var s,n=o.data("useAnchorTags"),r=i.find("> .sow-tabs-panel-container"),d=i.find("> .sow-tabs-tab-container > .sow-tabs-tab"),c=i.find(".sow-tabs-tab-selected").index(),w=r.find("> .sow-tabs-panel");w.not(":eq("+c+")").hide();var l=function(e){var a=o.offset().top-90;e?t("body,html").animate({scrollTop:a},200):window.scrollTo(0,a)},b=function(t){return sowTabs.scrollto_after_change&&(t.offset().top<window.scrollY||t.offset().top+t.height()>window.scrollY)},f=function(e,a){var i=t(e);if(i.is(".sow-tabs-tab-selected"))return b(i)&&l(!0),!0;var o=i.index();if(o>-1){s&&s.finish();var r=d.filter(".sow-tabs-tab-selected");r.removeClass("sow-tabs-tab-selected");var c=r.index(),f=w.eq(c).children(),h=w.eq(o).children();r.attr("tabindex",-1),r.attr("aria-selected",!1),f.attr("tabindex",-1),i.attr("tabindex",0),i.attr("aria-selected",!0),h.attr("tabindex",0),f.attr("aria-hidden","true"),s=w.eq(c).fadeOut("fast",(function(){t(this).trigger("hide"),h.removeAttr("aria-hidden"),w.eq(o).fadeIn({duration:"fast",start:function(){t(window).trigger("resize"),t(sowb).trigger("setup_widgets")},complete:function(){t(this).trigger("show"),b(i)&&l(!0)}})})),i.addClass("sow-tabs-tab-selected"),n&&!a&&(window.location.hash=i.data("anchor"))}};if(d.on("click",(function(){f(this)})),d.on("keyup",(function(e){var a,i=t(this);37!==e.keyCode&&39!==e.keyCode||(37===e.keyCode&&(a=i.prev().get(0)?i.prev():i.siblings().last()),39===e.keyCode&&(a=i.next().get(0)?i.next():i.siblings().first()),i!==a&&(a.trigger("focus"),f(a.get(0))))})),n){var h=function(){window.location.hash&&window.location.hash.substring(1).split(",").forEach((function(e){var a=d.filter((function(a,i){return decodeURI(e)===decodeURI(t(i).data("anchor"))}));a.length>0&&f(a,!0)}))};t(window).on("hashchange",h),window.location.hash&&h()}o.data("initialized",!0)}))},sowb.setupTabs(),t(sowb).on("setup_widgets",sowb.setupTabs)})),window.sowb=sowb;
|
1 |
+
var sowb=window.sowb||{};jQuery((function(t){sowb.setupTabs=function(){t(".sow-tabs").each((function(e,a){var i=t(a),o=i.closest(".so-widget-sow-tabs");if(o.data("initialized"))return t(this);var s,n=o.data("useAnchorTags"),r=i.find("> .sow-tabs-panel-container"),d=i.find("> .sow-tabs-tab-container > .sow-tabs-tab"),c=i.find(".sow-tabs-tab-selected").index(),w=r.find("> .sow-tabs-panel");w.not(":eq("+c+")").hide();var l=function(e){var a=o.offset().top-90;e?t("body,html").animate({scrollTop:a},200):window.scrollTo(0,a)},b=function(t){return sowTabs.scrollto_after_change&&(t.offset().top<window.scrollY||t.offset().top+t.height()>window.scrollY)},f=function(e,a){var i=t(e);if(i.is(".sow-tabs-tab-selected"))return b(i)&&l(!0),!0;var o=i.index();if(o>-1){s&&s.finish();var r=d.filter(".sow-tabs-tab-selected");r.removeClass("sow-tabs-tab-selected");var c=r.index(),f=w.eq(c).children(),h=w.eq(o).children();r.attr("tabindex",-1),r.attr("aria-selected",!1),f.attr("tabindex",-1),i.attr("tabindex",0),i.attr("aria-selected",!0),h.attr("tabindex",0),f.attr("aria-hidden","true"),s=w.eq(c).fadeOut("fast",(function(){t(this).trigger("hide"),h.removeAttr("aria-hidden"),w.eq(o).fadeIn({duration:"fast",start:function(){t(window).trigger("resize"),t(sowb).trigger("setup_widgets")},complete:function(){t(this).trigger("show"),(a||b(i))&&l(!0)}})})),i.addClass("sow-tabs-tab-selected"),n&&!a&&(window.location.hash=i.data("anchor"))}};if(d.on("click",(function(){f(this)})),d.on("keyup",(function(e){var a,i=t(this);37!==e.keyCode&&39!==e.keyCode||(37===e.keyCode&&(a=i.prev().get(0)?i.prev():i.siblings().last()),39===e.keyCode&&(a=i.next().get(0)?i.next():i.siblings().first()),i!==a&&(a.trigger("focus"),f(a.get(0))))})),n){var h=function(){window.location.hash&&window.location.hash.substring(1).split(",").forEach((function(e){var a=d.filter((function(a,i){return decodeURI(e)===decodeURI(t(i).data("anchor"))}));a.length>0&&f(a,!0)}))};t(window).on("hashchange",h),window.location.hash&&h()}o.data("initialized",!0)}))},sowb.setupTabs(),t(sowb).on("setup_widgets",sowb.setupTabs)})),window.sowb=sowb;
|
widgets/testimonial/testimonial.php
CHANGED
@@ -313,24 +313,24 @@ class SiteOrigin_Widgets_Testimonials_Widget extends SiteOrigin_Widget {
|
|
313 |
return array();
|
314 |
}
|
315 |
return array (
|
316 |
-
'image_size' =>
|
317 |
'testimonial_size' => round(100/$instance['settings']['per_line'], 4) . '%',
|
318 |
-
'testimonial_padding' =>
|
319 |
'testimonial_background' => $instance['design']['colors']['testimonial_background'],
|
320 |
'equalize_testimonial_height' => ! empty( $instance['design']['equalize_testimonial_height'] ) ? 'true' : 'false',
|
321 |
|
322 |
// The text block
|
323 |
-
'text_border_radius' =>
|
324 |
'text_background' => $instance['design']['colors']['text_background'],
|
325 |
'text_color' => $instance['design']['colors']['text_color'],
|
326 |
|
327 |
// All the responsive sizes
|
328 |
'tablet_testimonial_size' => round(100/$instance['settings']['responsive']['tablet']['per_line'], 4) . '%',
|
329 |
-
'tablet_image_size' =>
|
330 |
-
'tablet_width' =>
|
331 |
'mobile_testimonial_size' => round(100/$instance['settings']['responsive']['mobile']['per_line'], 4) . '%',
|
332 |
-
'mobile_image_size' =>
|
333 |
-
'mobile_width' =>
|
334 |
);
|
335 |
}
|
336 |
|
313 |
return array();
|
314 |
}
|
315 |
return array (
|
316 |
+
'image_size' => (int) $instance['design']['image']['image_size'] . 'px',
|
317 |
'testimonial_size' => round(100/$instance['settings']['per_line'], 4) . '%',
|
318 |
+
'testimonial_padding' => (int) $instance['design']['padding'] . 'px',
|
319 |
'testimonial_background' => $instance['design']['colors']['testimonial_background'],
|
320 |
'equalize_testimonial_height' => ! empty( $instance['design']['equalize_testimonial_height'] ) ? 'true' : 'false',
|
321 |
|
322 |
// The text block
|
323 |
+
'text_border_radius' => (int) $instance['design']['border_radius'] . 'px',
|
324 |
'text_background' => $instance['design']['colors']['text_background'],
|
325 |
'text_color' => $instance['design']['colors']['text_color'],
|
326 |
|
327 |
// All the responsive sizes
|
328 |
'tablet_testimonial_size' => round(100/$instance['settings']['responsive']['tablet']['per_line'], 4) . '%',
|
329 |
+
'tablet_image_size' => (int) $instance['settings']['responsive']['tablet']['image_size'] . 'px',
|
330 |
+
'tablet_width' => (int) $instance['settings']['responsive']['tablet']['width'] . 'px',
|
331 |
'mobile_testimonial_size' => round(100/$instance['settings']['responsive']['mobile']['per_line'], 4) . '%',
|
332 |
+
'mobile_image_size' => (int) $instance['settings']['responsive']['mobile']['image_size'] . 'px',
|
333 |
+
'mobile_width' => (int) $instance['settings']['responsive']['mobile']['width'] . 'px',
|
334 |
);
|
335 |
}
|
336 |
|
widgets/video/tpl/default.php
CHANGED
@@ -24,11 +24,15 @@ $video_args = array(
|
|
24 |
);
|
25 |
if ( $autoplay ) {
|
26 |
$video_args['autoplay'] = 1;
|
|
|
27 |
// In most brwosers, Videos need to be muted to autoplay.
|
28 |
if ( apply_filters( 'sow_video_autoplay_mute_self_hosted', true ) ) {
|
29 |
$video_args['muted'] = true;
|
30 |
}
|
31 |
}
|
|
|
|
|
|
|
32 |
if ( ! empty( $poster ) ) {
|
33 |
$video_args['poster'] = esc_url( $poster );
|
34 |
}
|
24 |
);
|
25 |
if ( $autoplay ) {
|
26 |
$video_args['autoplay'] = 1;
|
27 |
+
$video_args['playsinline'] = '';
|
28 |
// In most brwosers, Videos need to be muted to autoplay.
|
29 |
if ( apply_filters( 'sow_video_autoplay_mute_self_hosted', true ) ) {
|
30 |
$video_args['muted'] = true;
|
31 |
}
|
32 |
}
|
33 |
+
if ( $loop ) {
|
34 |
+
$video_args['loop'] = "true";
|
35 |
+
}
|
36 |
if ( ! empty( $poster ) ) {
|
37 |
$video_args['poster'] = esc_url( $poster );
|
38 |
}
|
widgets/video/video.php
CHANGED
@@ -100,6 +100,15 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
|
|
100 |
'default' => false,
|
101 |
'label' => __( 'Autoplay', 'so-widgets-bundle' )
|
102 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
'oembed' => array(
|
104 |
'type' => 'checkbox',
|
105 |
'default' => true,
|
@@ -206,6 +215,7 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
|
|
206 |
'is_skinnable_video_host' => $this->is_skinnable_video_host( $video_host ),
|
207 |
'poster' => $poster,
|
208 |
'autoplay' => ! empty( $instance['playback']['autoplay'] ),
|
|
|
209 |
'related_videos' => ! empty( $instance['playback']['related_videos'] ),
|
210 |
'skin_class' => 'default'
|
211 |
);
|
100 |
'default' => false,
|
101 |
'label' => __( 'Autoplay', 'so-widgets-bundle' )
|
102 |
),
|
103 |
+
'loop' => array(
|
104 |
+
'type' => 'checkbox',
|
105 |
+
'default' => false,
|
106 |
+
'label' => __( 'Loop', 'so-widgets-bundle' ),
|
107 |
+
'state_handler' => array(
|
108 |
+
'video_type[self]' => array( 'show' ),
|
109 |
+
'video_type[external]' => array( 'hide' ),
|
110 |
+
)
|
111 |
+
),
|
112 |
'oembed' => array(
|
113 |
'type' => 'checkbox',
|
114 |
'default' => true,
|
215 |
'is_skinnable_video_host' => $this->is_skinnable_video_host( $video_host ),
|
216 |
'poster' => $poster,
|
217 |
'autoplay' => ! empty( $instance['playback']['autoplay'] ),
|
218 |
+
'loop' => $video_host == 'self' && ! empty( $instance['playback']['loop'] ),
|
219 |
'related_videos' => ! empty( $instance['playback']['related_videos'] ),
|
220 |
'skin_class' => 'default'
|
221 |
);
|