本文整理汇总了PHP中RevSliderCssParser::parseCssToArray方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderCssParser::parseCssToArray方法的具体用法?PHP RevSliderCssParser::parseCssToArray怎么用?PHP RevSliderCssParser::parseCssToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderCssParser
的用法示例。
在下文中一共展示了RevSliderCssParser::parseCssToArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCaptionsCssContentArray
/**
*
* get contents of the css file
*/
public static function getCaptionsCssContentArray()
{
if (file_exists(RS_PLUGIN_PATH . 'public/assets/css/captions.css')) {
$contentCSS = file_get_contents(RS_PLUGIN_PATH . 'public/assets/css/captions.css');
} else {
if (file_exists(RS_PLUGIN_PATH . 'public/assets/css/captions-original.css')) {
$contentCSS = file_get_contents(RS_PLUGIN_PATH . 'public/assets/css/captions-original.css');
} else {
if (file_exists(RS_PLUGIN_PATH . 'backup/' . 'captions.css')) {
$contentCSS = file_get_contents(RS_PLUGIN_PATH . 'backup/' . 'captions.css');
} else {
if (file_exists(RS_PLUGIN_PATH . 'backup/' . 'captions-original.css')) {
$contentCSS = file_get_contents(RS_PLUGIN_PATH . 'backup/' . 'captions-original.css');
} else {
RevSliderFunctions::throwError("No captions.css found! This installation is incorrect, please make sure to reupload the Slider Revolution plugin and try again!");
}
}
}
}
$result = RevSliderCssParser::parseCssToArray($contentCSS);
return $result;
}
示例2: importSliderFromPost
//.........这里部分代码省略.........
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$anim_id = $db->insert(RevSliderGlobals::$table_layer_anims, $arrInsert);
}
} else {
//insert the animation, get the ID
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$anim_id = $db->insert(RevSliderGlobals::$table_layer_anims, $arrInsert);
}
//and set the current customin-oldID and customout-oldID in slider params to new ID from $id
$content = str_replace(array('customin-' . $animation['id'] . '"', 'customout-' . $animation['id'] . '"'), array('customin-' . $anim_id . '"', 'customout-' . $anim_id . '"'), $content);
}
dmp(__("animations imported!", REVSLIDER_TEXTDOMAIN));
} else {
dmp(__("no custom animations found, if slider uses custom animations, the provided export may be broken...", REVSLIDER_TEXTDOMAIN));
}
//overwrite/append static-captions.css
if (!empty($static)) {
if ($updateStatic == "true") {
//overwrite file
RevSliderOperations::updateStaticCss($static);
} elseif ($updateStatic == 'none') {
//do nothing
} else {
//append
$static_cur = RevSliderOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevSliderOperations::updateStaticCss($static);
}
}
//overwrite/create dynamic-captions.css
//parse css to classes
$dynamicCss = RevSliderCssParser::parseCssToArray($dynamic);
if (is_array($dynamicCss) && $dynamicCss !== false && count($dynamicCss) > 0) {
foreach ($dynamicCss as $class => $styles) {
//check if static style or dynamic style
$class = trim($class);
if (strpos($class, ',') !== false && strpos($class, '.tp-caption') !== false) {
//we have something like .tp-caption.redclass, .redclass
$class_t = explode(',', $class);
foreach ($class_t as $k => $cl) {
if (strpos($cl, '.tp-caption') !== false) {
$class = $cl;
}
}
}
if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || strpos($class, ".tp-caption") === false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) {
//.tp-caption>.imageclass or .tp-caption.imageclass>img or .tp-caption.imageclass .img
continue;
}
//is a dynamic style
if (strpos($class, ':hover') !== false) {
$class = trim(str_replace(':hover', '', $class));
$arrInsert = array();
$arrInsert["hover"] = json_encode($styles);
$arrInsert["settings"] = json_encode(array('hover' => 'true'));
} else {
$arrInsert = array();
$arrInsert["params"] = json_encode($styles);
$arrInsert["settings"] = '';
}
//check if class exists
$result = $db->fetch(RevSliderGlobals::$table_css, "handle = '" . $class . "'");
if (!empty($result)) {
//update
示例3: getCaptionsCssContentArray
/**
*
* get contents of the css file
*/
public static function getCaptionsCssContentArray()
{
if (file_exists(RevSliderGlobals::$filepath_captions)) {
$contentCSS = file_get_contents(RevSliderGlobals::$filepath_captions);
} else {
if (file_exists(RevSliderGlobals::$filepath_captions_original)) {
$contentCSS = file_get_contents(RevSliderGlobals::$filepath_captions_original);
} else {
if (file_exists(RevSliderGlobals::$filepath_backup . 'captions.css')) {
$contentCSS = file_get_contents(RevSliderGlobals::$filepath_backup . 'captions.css');
} else {
if (file_exists(RevSliderGlobals::$filepath_backup . 'captions-original.css')) {
$contentCSS = file_get_contents(RevSliderGlobals::$filepath_backup . 'captions-original.css');
} else {
RevSliderFunctions::throwError("No captions.css found! This installation is incorrect, please make sure to reupload the Slider Revolution plugin and try again!");
}
}
}
}
$result = RevSliderCssParser::parseCssToArray($contentCSS);
return $result;
}
示例4: importSliderFromPost
//.........这里部分代码省略.........
$arrInsert = array();
$arrInsert["handle"] = 'copy_' . $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$anim_id = $db->insert(RevSliderGlobals::$table_layer_anims, $arrInsert);
}
} else {
//insert the animation, get the ID
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$anim_id = $db->insert(RevSliderGlobals::$table_layer_anims, $arrInsert);
}
//and set the current customin-oldID and customout-oldID in slider params to new ID from $id
$content = str_replace(array('customin-' . $animation['id'] . '"', 'customout-' . $animation['id'] . '"'), array('customin-' . $anim_id . '"', 'customout-' . $anim_id . '"'), $content);
}
dmp(__("animations imported!", 'revslider'));
}
//overwrite/append static-captions.css
if (!empty($static)) {
if ($updateStatic == "true") {
//overwrite file
RevSliderOperations::updateStaticCss($static);
} elseif ($updateStatic == 'none') {
//do nothing
} else {
//append
$static_cur = RevSliderOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevSliderOperations::updateStaticCss($static);
}
}
//overwrite/create dynamic-captions.css
//parse css to classes
$dynamicCss = RevSliderCssParser::parseCssToArray($dynamic);
if (is_array($dynamicCss) && $dynamicCss !== false && count($dynamicCss) > 0) {
foreach ($dynamicCss as $class => $styles) {
//check if static style or dynamic style
$class = trim($class);
if (strpos($class, ',') !== false && strpos($class, '.tp-caption') !== false) {
//we have something like .tp-caption.redclass, .redclass
$class_t = explode(',', $class);
foreach ($class_t as $k => $cl) {
if (strpos($cl, '.tp-caption') !== false) {
$class = $cl;
}
}
}
if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || strpos($class, ".tp-caption") === false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) {
//.tp-caption>.imageclass or .tp-caption.imageclass>img or .tp-caption.imageclass .img
continue;
}
//is a dynamic style
if (strpos($class, ':hover') !== false) {
$class = trim(str_replace(':hover', '', $class));
$arrInsert = array();
$arrInsert["hover"] = json_encode($styles);
$arrInsert["settings"] = json_encode(array('hover' => 'true'));
} else {
$arrInsert = array();
$arrInsert["params"] = json_encode($styles);
$arrInsert["settings"] = '';
}
//check if class exists
$result = $db->fetch(RevSliderGlobals::$table_css, $db->prepare("handle = %s", array($class)));
if (!empty($result)) {
//update
示例5: add_placeholder_sub_modifications
/**
* Check the CSS for placeholders, replace them with correspinding values
* @since: 5.2.0
**/
public function add_placeholder_sub_modifications($css, $handle, $type, $settings, $slide, $output)
{
$c_css = '';
if (!is_array($settings)) {
$settings = json_decode($settings, true);
}
if (isset($settings['placeholders']) && is_array($settings['placeholders']) && !empty($settings['placeholders'])) {
//first check for media queries, generate more than one staple
$marr = RevSliderCssParser::parse_media_blocks($css);
if (!empty($marr)) {
//handle them separated
foreach ($marr as $media => $mr) {
$css = str_replace($mr, '', $css);
//clean @media query from $mr
$mr = RevSliderCssParser::clear_media_block($mr);
//remove media query and bracket
$d = RevSliderCssParser::parseCssToArray($mr);
$ret = $this->preset_return_array_css($d, $settings, $slide, $handle, $type, $output);
if (trim($ret) !== '') {
$c_css .= "\n" . $media . ' {' . "\n";
$c_css .= $ret;
$c_css .= "\n" . '}' . "\n";
}
}
}
$c = RevSliderCssParser::parseCssToArray($css);
$c_css .= $this->preset_return_array_css($c, $settings, $slide, $handle, $type, $output);
}
return $c_css;
}