updated plugin GP Premium
version 1.12.2
This commit is contained in:
@ -9,7 +9,7 @@ if ( ! class_exists( 'GeneratePress_Pro_CSS' ) ) :
|
||||
* Modified by Tom Usborne for GeneratePress
|
||||
*/
|
||||
class GeneratePress_Pro_CSS {
|
||||
|
||||
|
||||
/**
|
||||
* The css selector that you're currently adding rules to
|
||||
*
|
||||
@ -17,7 +17,7 @@ class GeneratePress_Pro_CSS {
|
||||
* @var string
|
||||
*/
|
||||
protected $_selector = '';
|
||||
|
||||
|
||||
/**
|
||||
* Stores the final css output with all of its rules for the current selector.
|
||||
*
|
||||
@ -25,7 +25,7 @@ class GeneratePress_Pro_CSS {
|
||||
* @var string
|
||||
*/
|
||||
protected $_selector_output = '';
|
||||
|
||||
|
||||
/**
|
||||
* Stores all of the rules that will be added to the selector
|
||||
*
|
||||
@ -33,7 +33,7 @@ class GeneratePress_Pro_CSS {
|
||||
* @var string
|
||||
*/
|
||||
protected $_css = '';
|
||||
|
||||
|
||||
/**
|
||||
* The string that holds all of the css to output
|
||||
*
|
||||
@ -41,14 +41,14 @@ class GeneratePress_Pro_CSS {
|
||||
* @var string
|
||||
*/
|
||||
protected $_output = '';
|
||||
|
||||
|
||||
/**
|
||||
* Stores media queries
|
||||
*
|
||||
*
|
||||
* @var null
|
||||
*/
|
||||
protected $_media_query = null;
|
||||
|
||||
|
||||
/**
|
||||
* The string that holds all of the css to output inside of the media query
|
||||
*
|
||||
@ -62,7 +62,7 @@ class GeneratePress_Pro_CSS {
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
*
|
||||
* @param string $selector - the css identifier of the html that you wish to target
|
||||
* @return $this
|
||||
*/
|
||||
@ -80,7 +80,7 @@ class GeneratePress_Pro_CSS {
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
*
|
||||
* @param string $property - the css property
|
||||
* @param string $value - the value to be placed with the property
|
||||
* @param string $og_default - check to see if the value matches the default
|
||||
@ -95,15 +95,15 @@ class GeneratePress_Pro_CSS {
|
||||
$og_default = $og_default . $unit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If we don't have a value or our value is the same as our og default, bail
|
||||
if ( empty( $value ) || $og_default == $value )
|
||||
return false;
|
||||
|
||||
|
||||
$this->_css .= $property . ':' . $value . ';';
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets a media query in the class
|
||||
*
|
||||
@ -114,17 +114,17 @@ class GeneratePress_Pro_CSS {
|
||||
public function start_media_query( $value ) {
|
||||
// Add the current rules to the output
|
||||
$this->add_selector_rules_to_output();
|
||||
|
||||
|
||||
// Add any previous media queries to the output
|
||||
if ( ! empty( $this->_media_query ) ) {
|
||||
$this->add_media_query_rules_to_output();
|
||||
}
|
||||
|
||||
|
||||
// Set the new media query
|
||||
$this->_media_query = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stops using a media query.
|
||||
*
|
||||
@ -136,7 +136,7 @@ class GeneratePress_Pro_CSS {
|
||||
public function stop_media_query() {
|
||||
return $this->start_media_query( null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the current media query's rules to the class' output variable
|
||||
*
|
||||
@ -146,13 +146,13 @@ class GeneratePress_Pro_CSS {
|
||||
private function add_media_query_rules_to_output() {
|
||||
if( !empty( $this->_media_query_output ) ) {
|
||||
$this->_output .= sprintf( '@media %1$s{%2$s}', $this->_media_query, $this->_media_query_output );
|
||||
|
||||
|
||||
// Reset the media query output string
|
||||
$this->_media_query_output = '';
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the current selector rules to the output variable
|
||||
*
|
||||
@ -165,7 +165,7 @@ class GeneratePress_Pro_CSS {
|
||||
if( !empty( $this->_css ) ) {
|
||||
$this->_selector_output = $this->_selector;
|
||||
$selector_output = sprintf( '%1$s{%2$s}', $this->_selector_output, $this->_css );
|
||||
|
||||
|
||||
// Add our CSS to the output
|
||||
if ( ! empty( $this->_media_query ) ) {
|
||||
$this->_media_query_output .= $selector_output;
|
||||
@ -186,7 +186,7 @@ class GeneratePress_Pro_CSS {
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function css_output()
|
||||
@ -199,4 +199,4 @@ class GeneratePress_Pro_CSS {
|
||||
}
|
||||
|
||||
}
|
||||
endif;
|
||||
endif;
|
||||
|
Reference in New Issue
Block a user