<?php
/**
 * @version    1.0
 * @package    Sparta
 * @author     Your Team <support@univertheme.com>
 * @copyright  Copyright (C) 2014 yourdomain.com. All Rights Reserved.
 * @license    GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 */

/**
 * Plug additional sidebars into Admin.
 *
 * @package  Sparta
 * @since    1.0
 */
class Sparta_Start_Visual_Composer {
    /**
     * Variable to hold the initialization state.
     *
     * @var  boolean
     */
    protected static $initialized = false;

    /**
     * Initialize functions.
     *
     * @return  void
     */
    public static function initialize() {
        // Do nothing if start functions already initialized.
        if ( self::$initialized ) {
            return;
        }

        // Filter to Replace default css class for vc_row shortcode and vc_column
        add_filter('vc_shortcodes_css_class', array( __CLASS__, 'sparta_custom_css_classes_for_vc_row_and_vc_column'), 10, 2 );

        // State that initialization completed.
        self::$initialized = true;
    }

    /** 
    * Custom class css row
    */
    public static function sparta_custom_css_classes_for_vc_row_and_vc_column($class_string = null, $tag = null) {

        if($tag=='vc_row' || $tag=='vc_row_inner') {
           $class_string = str_replace('vc_row-fluid', '', $class_string);
        }
        if($tag=='vc_column' || $tag=='vc_column_inner') {
            $class_string = preg_replace('/vc_col-xs-(\d{1,2})/', 'col-xs-$1', $class_string);
            $class_string = preg_replace('/vc_col-sm-(\d{1,2})/', 'col-md-$1', $class_string);
            $class_string = preg_replace('/vc_col-md-(\d{1,2})/', 'col-sm-$1', $class_string);
            $class_string = preg_replace('/vc_col-lg-(\d{1,2})/', 'col-lg-$1', $class_string);
        }
        return $class_string;
    }


}