/**
  * 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', 'text-align' => 'textAlign');
     $cs = array_merge($cs, RevSliderCssParser::get_deformation_css_tags());
     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']));
     }
 }