本文整理汇总了PHP中RevSliderCssParser::default_css_classes方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderCssParser::default_css_classes方法的具体用法?PHP RevSliderCssParser::default_css_classes怎么用?PHP RevSliderCssParser::default_css_classes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderCssParser
的用法示例。
在下文中一共展示了RevSliderCssParser::default_css_classes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_css_styles
/**
* update the styles to meet requirements for version 5.0
* @since 5.0
*/
public static function update_css_styles()
{
$css = new RevSliderCssParser();
$db = new RevSliderDB();
$styles = $db->fetch(RevSliderGlobals::$table_css);
$default_classes = RevSliderCssParser::default_css_classes();
$cs = array('background-color' => 'backgroundColor', 'border-color' => 'borderColor', 'border-radius' => 'borderRadius', 'border-style' => 'borderStyle', 'border-width' => 'borderWidth', 'color' => 'color', 'font-family' => 'fontFamily', 'font-size' => 'fontSize', 'font-style' => 'fontStyle', 'font-weight' => 'fontWeight', 'line-height' => 'lineHeight', 'opacity' => 'opacity', 'padding' => 'padding', 'text-decoration' => 'textDecoration', 'x' => 'x', 'y' => 'y', 'z' => 'z', 'skewx' => 'skewx', 'skewy' => 'skewy', 'scalex' => 'scalex', 'scaley' => 'scaley', 'opacity' => 'opacity', 'xrotate' => 'xrotate', 'yrotate' => 'yrotate', '2d_rotation' => '2d_rotation', 'layer_2d_origin_x' => 'layer_2d_origin_x', 'layer_2d_origin_y' => 'layer_2d_origin_y', '2d_origin_x' => '2d_origin_x', '2d_origin_y' => '2d_origin_y', 'pers' => 'pers', 'color-transparency' => 'color-transparency', 'background-transparency' => 'background-transparency', 'border-transparency' => 'border-transparency', 'css_cursor' => 'css_cursor', 'speed' => 'speed', 'easing' => 'easing', 'corner_left' => 'corner_left', 'corner_right' => 'corner_right', 'parallax' => 'parallax');
foreach ($styles as $key => $attr) {
if (isset($attr['advanced'])) {
$adv = json_decode($attr['advanced'], true);
// = array('idle' => array(), 'hover' => '');
} else {
$adv = array('idle' => array(), 'hover' => '');
}
if (!isset($adv['idle'])) {
$adv['idle'] = array();
}
if (!isset($adv['hover'])) {
$adv['hover'] = array();
}
//only do this to styles prior 5.0
$settings = json_decode($attr['settings'], true);
if (!empty($settings) && isset($settings['translated'])) {
if (version_compare($settings['translated'], 5.0, '>=')) {
continue;
}
}
$idle = json_decode($attr['params'], true);
$hover = json_decode($attr['hover'], true);
//check if in styles, there is type, then change the type text to something else
$the_type = 'text';
if (!empty($idle)) {
foreach ($idle as $style => $value) {
if ($style == 'type') {
$the_type = $value;
}
if (!isset($cs[$style])) {
$adv['idle'][$style] = $value;
unset($idle[$style]);
}
}
}
if (!empty($hover)) {
foreach ($hover as $style => $value) {
if (!isset($cs[$style])) {
$adv['hover'][$style] = $value;
unset($hover[$style]);
}
}
}
$settings['translated'] = 5.0;
//set the style version to 5.0
$settings['type'] = $the_type;
//set the type version to text, since 5.0 we also have buttons and shapes, so we need to differentiate from now on
if (!isset($settings['version'])) {
if (isset($default_classes[$styles[$key]['handle']])) {
$settings['version'] = $default_classes[$styles[$key]['handle']];
} else {
$settings['version'] = 'custom';
//set the version to custom as its not in the defaults
}
}
$styles[$key]['params'] = json_encode($idle);
$styles[$key]['hover'] = json_encode($hover);
$styles[$key]['advanced'] = json_encode($adv);
$styles[$key]['settings'] = json_encode($settings);
}
//save now all styles back to database
foreach ($styles as $key => $attr) {
$ret = $db->update(RevSliderGlobals::$table_css, array('settings' => $styles[$key]['settings'], 'params' => $styles[$key]['params'], 'hover' => $styles[$key]['hover'], 'advanced' => $styles[$key]['advanced']), array('id' => $attr['id']));
}
}