-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
739 additions
and
1,781 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,15 @@ | |
/** | ||
* Module Name: Customizer | ||
* Description: Customizer functionality. | ||
* Version: 1.1.5 | ||
* Version: 1.1.6 | ||
* Author: Cherry Team | ||
* Author URI: http://www.cherryframework.com/ | ||
* License: GPLv3 | ||
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | ||
* | ||
* @package Cherry_Framework | ||
* @subpackage Modules | ||
* @version 1.1.5 | ||
* @version 1.1.6 | ||
* @author Cherry Team <[email protected]> | ||
* @copyright Copyright (c) 2012 - 2016, Cherry Team | ||
* @link http://www.cherryframework.com/ | ||
|
@@ -797,6 +797,8 @@ public function sanitize_range( $number, $setting ) { | |
// Get step. | ||
$step = ( isset( $atts['step'] ) ? $atts['step'] : 1 ); | ||
|
||
$number = ( ! isset( $atts['min'] ) && 0 > $number ) ? $setting->default : $number ; | ||
|
||
if ( is_float( $step ) ) { | ||
|
||
// Ensure input is a float value. | ||
|
@@ -805,7 +807,7 @@ public function sanitize_range( $number, $setting ) { | |
} else { | ||
|
||
// Ensure input is an absolute integer. | ||
$number = absint( $number ); | ||
$number = ( isset( $atts['min'] ) && 0 > $atts['min'] && 0 > $number ) ? intval( $number ) : absint( $number ); | ||
$checker = is_int( $number / $step ); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,17 @@ | |
/** | ||
* Module Name: Dynamic CSS | ||
* Description: CSS parser which uses variables & functions for CSS code optimization | ||
* Version: 1.2.2 | ||
* Version: 1.4.0 | ||
* Author: Cherry Team | ||
* Author URI: http://www.cherryframework.com/ | ||
* License: GPLv3 | ||
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | ||
* | ||
* @package Cherry_Framework | ||
* @subpackage Modules | ||
* @version 1.2.2 | ||
* @version 1.4.0 | ||
* @author Cherry Team <[email protected]> | ||
* @copyright Copyright (c) 2012 - 2016, Cherry Team | ||
* @copyright Copyright (c) 2012 - 2017, Cherry Team | ||
* @link http://www.cherryframework.com/ | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html | ||
*/ | ||
|
@@ -72,25 +72,64 @@ class Cherry_Dynamic_Css { | |
*/ | ||
public static $collector = null; | ||
|
||
/** | ||
* Reserved words list | ||
* | ||
* @since 1.4.0 | ||
* @var array | ||
*/ | ||
public $css_reserved = array( | ||
'media', | ||
'supports', | ||
); | ||
|
||
/** | ||
* Constructor for the module | ||
*/ | ||
function __construct( $core, $args ) { | ||
|
||
$this->core = $core; | ||
$this->args = wp_parse_args( $args, array( | ||
'prefix' => 'blank', | ||
'type' => 'theme_mod', | ||
'single' => true, | ||
'css_files' => null, | ||
'options' => array(), | ||
'prefix' => 'blank', | ||
'type' => 'theme_mod', | ||
'parent_handle' => false, | ||
'single' => true, | ||
'css_files' => null, | ||
'options' => array(), | ||
) ); | ||
|
||
add_action( 'wp_head', array( $this, 'print_inline_css' ), 99 ); | ||
|
||
$this->init_dynamic_css(); | ||
$this->init_collector(); | ||
} | ||
|
||
/** | ||
* Initalize dynamic CSS with fallback compatibility. | ||
* | ||
* @since 1.3.0 | ||
* @return void | ||
*/ | ||
public function init_dynamic_css() { | ||
|
||
/** | ||
* Not actual for now, required only for fallback compatibility. | ||
*/ | ||
if ( empty( $this->args['parent_handle'] ) ) { | ||
add_action( 'wp_head', array( $this, 'print_inline_css' ), 99 ); | ||
} | ||
|
||
add_action( 'wp_enqueue_scripts', array( $this, 'add_inline_css' ), 99 ); | ||
} | ||
|
||
/** | ||
* Adds inline CSS into queue | ||
* | ||
* @since 1.3.0 | ||
* @return void | ||
*/ | ||
public function add_inline_css() { | ||
wp_add_inline_style( $this->args['parent_handle'], $this->get_inline_css() ); | ||
} | ||
|
||
/** | ||
* Initalize CSS collector class | ||
* | ||
|
@@ -296,12 +335,12 @@ public function parse( $css ) { | |
} | ||
|
||
/** | ||
* Print inline CSS after current theme stylesheet | ||
* Returns complied dynamic CSS string. | ||
* | ||
* @since 1.0.0 | ||
* @return void|bool false | ||
* @since 1.3.0 | ||
* @return string|bool false | ||
*/ | ||
public function print_inline_css() { | ||
public function get_inline_css() { | ||
|
||
if ( ! $this->args['css_files'] ) { | ||
return false; | ||
|
@@ -311,6 +350,14 @@ public function print_inline_css() { | |
$this->args['css_files'] = array( $this->args['css_files'] ); | ||
} | ||
|
||
/** | ||
* Filter CSS reserved words list | ||
* | ||
* @since 1.4.0 | ||
* @var array | ||
*/ | ||
$this->css_reserved = apply_filters( 'cherry_dynamic_css_reserved_words_list', $this->css_reserved ); | ||
|
||
ob_start(); | ||
|
||
foreach ( $this->args['css_files'] as $file ) { | ||
|
@@ -344,6 +391,23 @@ public function print_inline_css() { | |
*/ | ||
$parsed_css = apply_filters( 'cherry_dynamic_css_parsed_styles', $parsed_css, $this->args ); | ||
|
||
return $parsed_css; | ||
} | ||
|
||
/** | ||
* Print inline CSS after current theme stylesheet | ||
* | ||
* @since 1.0.0 | ||
* @return void|bool false | ||
*/ | ||
public function print_inline_css() { | ||
|
||
$parsed_css = $this->get_inline_css(); | ||
|
||
if ( empty( $parsed_css ) ) { | ||
return false; | ||
} | ||
|
||
printf( '<style type="text/css">%s</style>', $parsed_css ); | ||
|
||
} | ||
|
@@ -409,11 +473,13 @@ function replace_func( $matches ) { | |
|
||
$functions = $this->get_css_functions(); | ||
|
||
// check if function exists and is not CSS @media query | ||
if ( ! array_key_exists( $matches[2], $functions ) && 'media' !== $matches[2] ) { | ||
return $not_found; | ||
} elseif ( 'media' == $matches[2] ) { | ||
return $matches[0]; | ||
// check if function exists and is not CSS-reserved word | ||
if ( ! array_key_exists( $matches[2], $functions ) ) { | ||
if ( is_array( $this->css_reserved ) && in_array( $matches[2], $this->css_reserved ) ) { | ||
return $matches[0]; | ||
} else { | ||
return $not_found; | ||
} | ||
} | ||
|
||
$function = $functions[ $matches[2] ]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,15 @@ | |
/** | ||
* Module Name: Cherry handler | ||
* Description: Initializes handlers | ||
* Version: 1.1.1 | ||
* Version: 1.1.2 | ||
* Author: Cherry Team | ||
* Author URI: http://www.cherryframework.com/ | ||
* License: GPLv3 | ||
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | ||
* | ||
* @package Cherry_Framework | ||
* @subpackage Modules | ||
* @version 1.1.1 | ||
* @version 1.1.2 | ||
* @author Cherry Team <[email protected]> | ||
* @copyright Copyright (c) 2012 - 2016, Cherry Team | ||
* @link http://www.cherryframework.com/ | ||
|
@@ -31,15 +31,6 @@ | |
*/ | ||
class Cherry_Handler { | ||
|
||
/** | ||
* A reference to an instance of this class. | ||
* | ||
* @since 1.0.0 | ||
* @access private | ||
* @var object | ||
*/ | ||
private static $handlers_list = array(); | ||
|
||
/** | ||
* Default settings. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.