Exemplo n.º 1
0
/**
 * Get Domain Mapping URL based on origal URL.
 *
 * @since 2.2
 */
function rocket_replace_domain_mapping_siteurl($url)
{
    $original_siteurl_host = parse_url(get_original_url('siteurl'), PHP_URL_HOST);
    $domain_mapping_siteurl_host = parse_url(domain_mapping_siteurl(false), PHP_URL_HOST);
    $url = str_replace($original_siteurl_host, $domain_mapping_siteurl_host, $url);
    return $url;
}
Exemplo n.º 2
0
function domain_mapping_gc_cache($function, $directory)
{
    global $cache_path;
    if (!function_exists('domain_mapping_warning')) {
        return false;
    }
    $siteurl = domain_mapping_siteurl(false);
    if (!$siteurl) {
        return false;
    }
    $protocol = 'on' == strtolower($_SERVER['HTTPS']) ? 'https://' : 'http://';
    $siteurl = trailingslashit(str_replace($protocol, '', $siteurl));
    if ($directory == 'homepage') {
        $directory = '';
    }
    switch ($function) {
        case "rebuild":
            @wp_cache_rebuild_or_delete($cache_path . 'supercache/' . $siteurl . $directory . 'index.html');
            @wp_cache_rebuild_or_delete($cache_path . 'supercache/' . $siteurl . $directory . 'index.html.gz');
            break;
        case "prune":
            prune_super_cache($cache_path . 'supercache/' . $siteurl . $directory . 'index.html', true, true);
            prune_super_cache($cache_path . 'supercache/' . $siteurl . $directory . 'index.html.gz', true, true);
            break;
    }
    return $directory;
}
function domain_mapping_supercachedir($dir)
{
    global $cache_path;
    if (!function_exists('domain_mapping_warning')) {
        return $dir;
    }
    $siteurl = domain_mapping_siteurl(false);
    if (!$siteurl) {
        return $dir;
    }
    $protocol = 'on' == strtolower($_SERVER['HTTPS']) ? 'https://' : 'http://';
    $siteurl = str_replace($protocol, '', $siteurl);
    return $cache_path . 'supercache/' . $siteurl;
}
Exemplo n.º 4
0
 function site_url()
 {
     $site_url = '';
     // compatibility for WordPress MU Domain Mapping plugin
     if (defined('DOMAIN_MAPPING') && DOMAIN_MAPPING) {
         if (!function_exists('domain_mapping_siteurl')) {
             if (!function_exists('is_plugin_active')) {
                 require_once ABSPATH . '/wp-admin/includes/plugin.php';
             }
             $plugin = 'wordpress-mu-domain-mapping/domain_mapping.php';
             if (is_plugin_active($plugin)) {
                 include_once WP_PLUGIN_DIR . '/' . $plugin;
             }
         }
         if (function_exists('domain_mapping_siteurl')) {
             $site_url = domain_mapping_siteurl(false);
         }
     }
     if (empty($site_url)) {
         $site_url = site_url();
     }
     return $site_url;
 }
Exemplo n.º 5
0
 /**
  * Redirect Check
  *
  * Checks if the current page needs to be redirected
  *
  * @param none
  * @return void
  */
 public function redirect_check()
 {
     global $post;
     $plugin = $this->getPlugin();
     $force_ssl = apply_filters('force_ssl', null, $post ? $post->ID : null, ($plugin->isSsl() ? 'https' : 'http') . '://' . (isset($_SERVER['HTTP_X_FORWARDED_SERVER']) ? $_SERVER['HTTP_X_FORWARDED_SERVER'] : $_SERVER['HTTP_HOST']) . $_SERVER['REQUEST_URI']);
     // Domain mapping check
     if (function_exists('domain_mapping_siteurl') && $force_ssl) {
         $mapped_domain = domain_mapping_siteurl(false);
         if (strpos($plugin->getHttpsUrl(), $mapped_domain) === false) {
             if (remove_action('template_redirect', 'redirect_to_mapped_domain')) {
                 $plugin->getLogger()->log('[FIXED] Domain mapping redirect removed.');
             } else {
                 $plugin->getLogger()->log('[WARNING] Unable to remove domain mapping redirect.');
             }
         }
     }
     if (!$plugin->isSsl() && isset($force_ssl) && $force_ssl) {
         $scheme = 'https';
     } else {
         if ($plugin->isSsl() && isset($force_ssl) && !$force_ssl) {
             $scheme = 'http';
         }
     }
     if (isset($scheme)) {
         $plugin->redirect($scheme);
     }
 }
 /**
  * Get domains local to the WordPress installation.
  * 
  * @param none
  * @return array $hosts Array of domains local to the WordPress installation.
  */
 public function getLocalDomains()
 {
     global $wpdb;
     $hosts = array($this->getHttpUrl()->getHost(), $this->getHttpsUrl()->getHost());
     if (is_multisite() && is_subdomain_install()) {
         $multisite_hosts = $wpdb->get_col($wpdb->prepare("SELECT domain FROM %d", $wpdb->blogs));
         $hosts = array_merge($hosts, $multisite_hosts);
     }
     if (function_exists('domain_mapping_siteurl')) {
         if ($mapped_host = parse_url(domain_mapping_siteurl(false), PHP_URL_HOST)) {
             $hosts[] = $mapped_host;
         }
     }
     return $hosts;
 }
/**
 * Same as above, but handles all domains in a multisite
 */
function htsda_mu_https_domain_rewrite($url, $status = 0)
{
    if (!is_string($url)) {
        // do nothing if $url is not a string
        // the customizer view seems to sometimes pass an empty array to this filter for some reason.
        // this would crash the entire plugin
        return $url;
    }
    // Rewrite only if the request is https, or the user is logged in
    // to preserve cookie integrity
    if (substr($url, 0, 5) == 'https' || function_exists('is_user_logged_in') && is_user_logged_in() && !(defined('DISABLE_FRONTEND_SSL') && DISABLE_FRONTEND_SSL)) {
        // these won't change during the request
        static $domains;
        if (!isset($domains)) {
            $args = array('limit' => null);
            // do not limit the number of results
            $blogs = wp_get_sites($args);
            // get info from wp_blogs table
            $domains = array();
            // map the domains here
            $domains[] = hstda_trim_url(parse_url(get_site_url(1), PHP_URL_HOST), 'www.');
            // main site home
            // special case for wpmu domain mapping plugin
            if (function_exists('domain_mapping_siteurl')) {
                $domains[] = hstda_trim_url(parse_url(domain_mapping_siteurl(false), PHP_URL_HOST), 'www.');
            }
            foreach ($blogs as $blog) {
                $domains[] = hstda_trim_url($blog['domain'], 'www.');
            }
            // dedupe domains
            $domains = array_unique($domains);
        }
        // Rewrite the $url
        $url = hstda_rewrite_url($url, $domains);
    }
    return $url;
}
Exemplo n.º 8
0
function autoptimize_end_buffering($content)
{
    if (stripos($content, "<html") === false || stripos($content, "<xsl:stylesheet") !== false) {
        return $content;
    }
    // load URL constants as late as possible to allow domain mapper to kick in
    if (function_exists("domain_mapping_siteurl")) {
        define('AUTOPTIMIZE_WP_SITE_URL', domain_mapping_siteurl(get_current_blog_id()));
        define('AUTOPTIMIZE_WP_CONTENT_URL', str_replace(get_original_url(AUTOPTIMIZE_WP_SITE_URL), AUTOPTIMIZE_WP_SITE_URL, content_url()));
    } else {
        define('AUTOPTIMIZE_WP_SITE_URL', site_url());
        define('AUTOPTIMIZE_WP_CONTENT_URL', content_url());
    }
    if (is_multisite()) {
        $blog_id = get_current_blog_id();
        define('AUTOPTIMIZE_CACHE_URL', AUTOPTIMIZE_WP_CONTENT_URL . AUTOPTIMIZE_CACHE_CHILD_DIR . $blog_id . '/');
    } else {
        define('AUTOPTIMIZE_CACHE_URL', AUTOPTIMIZE_WP_CONTENT_URL . AUTOPTIMIZE_CACHE_CHILD_DIR);
    }
    define('AUTOPTIMIZE_WP_ROOT_URL', str_replace(AUTOPTIMIZE_WP_CONTENT_NAME, '', AUTOPTIMIZE_WP_CONTENT_URL));
    // Config element
    $conf = autoptimizeConfig::instance();
    // Choose the classes
    $classes = array();
    if ($conf->get('autoptimize_js')) {
        $classes[] = 'autoptimizeScripts';
    }
    if ($conf->get('autoptimize_css')) {
        $classes[] = 'autoptimizeStyles';
    }
    if ($conf->get('autoptimize_html')) {
        $classes[] = 'autoptimizeHTML';
    }
    // Set some options
    $classoptions = array('autoptimizeScripts' => array('justhead' => $conf->get('autoptimize_js_justhead'), 'forcehead' => $conf->get('autoptimize_js_forcehead'), 'trycatch' => $conf->get('autoptimize_js_trycatch'), 'js_exclude' => $conf->get('autoptimize_js_exclude'), 'cdn_url' => $conf->get('autoptimize_cdn_url')), 'autoptimizeStyles' => array('justhead' => $conf->get('autoptimize_css_justhead'), 'datauris' => $conf->get('autoptimize_css_datauris'), 'defer' => $conf->get('autoptimize_css_defer'), 'defer_inline' => $conf->get('autoptimize_css_defer_inline'), 'inline' => $conf->get('autoptimize_css_inline'), 'css_exclude' => $conf->get('autoptimize_css_exclude'), 'cdn_url' => $conf->get('autoptimize_cdn_url')), 'autoptimizeHTML' => array('keepcomments' => $conf->get('autoptimize_html_keepcomments')));
    $content = apply_filters('autoptimize_filter_html_before_minify', $content);
    // Run the classes
    foreach ($classes as $name) {
        $instance = new $name($content);
        if ($instance->read($classoptions[$name])) {
            $instance->minify();
            $instance->cache();
            $content = $instance->getcontent();
        }
        unset($instance);
    }
    $content = apply_filters('autoptimize_html_after_minify', $content);
    return $content;
}
 /**
  * Gets the primary domain for the site.
  *
  * This function is necessary for MU sites where the URL for the backend is different than the URL for the frontend.
  *
  * See https://github.com/10up/PushUp/issues/9 for more information.
  *
  * @return string Represents the primary domain name for the domain name being used.
  */
 public static function get_site_url()
 {
     $url = '';
     // Support for WordPress MU Domain Mapping
     if (function_exists('domain_mapping_siteurl')) {
         $url = domain_mapping_siteurl('');
     }
     if (empty($url)) {
         $url = site_url();
     }
     return apply_filters('pushup_site_url', $url);
 }
Exemplo n.º 10
0
 function WPVarnishActuallyPurgeObject($wpv_url)
 {
     global $varnish_servers;
     // added this hook to enable other plugins do something when cache is purged
     do_action('WPVarnishPurgeObject', $wpv_url);
     if (is_array($varnish_servers)) {
         foreach ($varnish_servers as $server) {
             list($host, $port, $secret) = explode(':', $server);
             $wpv_purgeaddr[] = $host;
             $wpv_purgeport[] = $port;
             $wpv_secret[] = $secret;
         }
     } else {
         $wpv_purgeaddr = get_option($this->wpv_addr_optname);
         $wpv_purgeport = get_option($this->wpv_port_optname);
         $wpv_secret = get_option($this->wpv_secret_optname);
     }
     $wpv_timeout = get_option($this->wpv_timeout_optname);
     $wpv_use_adminport = get_option($this->wpv_use_adminport_optname);
     global $varnish_version;
     if (isset($varnish_version) && in_array($varnish_version, array(2, 3))) {
         $wpv_vversion_optval = $varnish_version;
     } else {
         $wpv_vversion_optval = get_option($this->wpv_vversion_optname);
     }
     // check for domain mapping plugin by donncha
     if (function_exists('domain_mapping_siteurl')) {
         $wpv_wpurl = domain_mapping_siteurl('NA');
     } else {
         $wpv_wpurl = get_bloginfo('url');
     }
     $wpv_replace_wpurl = '/^https?:\\/\\/([^\\/]+)(.*)/i';
     $wpv_host = preg_replace($wpv_replace_wpurl, "\$1", $wpv_wpurl);
     $wpv_blogaddr = preg_replace($wpv_replace_wpurl, "\$2", $wpv_wpurl);
     $wpv_url = $wpv_blogaddr . $wpv_url;
     // allow custom purge functions and stop if they return false
     if (function_exists($this->wpv_custom_purge_obj_f)) {
         $f = $this->wpv_custom_purge_obj_f;
         if (!$f($wpv_url, $wpv_host)) {
             return;
         }
     }
     for ($i = 0; $i < count($wpv_purgeaddr); $i++) {
         $varnish_sock = fsockopen($wpv_purgeaddr[$i], $wpv_purgeport[$i], $errno, $errstr, $wpv_timeout);
         if (!$varnish_sock) {
             error_log("wp-varnish error: {$errstr} ({$errno}) on server {$wpv_purgeaddr[$i]}:{$wpv_purgeport[$i]}");
             continue;
         }
         if ($wpv_use_adminport) {
             $buf = fread($varnish_sock, 1024);
             if (preg_match('/(\\w+)\\s+Authentication required./', $buf, $matches)) {
                 # get the secret
                 $secret = $wpv_secret[$i];
                 fwrite($varnish_sock, "auth " . $this->WPAuth($matches[1], $secret) . "\n");
                 $buf = fread($varnish_sock, 1024);
                 if (!preg_match('/^200/', $buf)) {
                     error_log("wp-varnish error: authentication failed using admin port on server {$wpv_purgeaddr[$i]}:{$wpv_purgeport[$i]}");
                     fclose($varnish_sock);
                     continue;
                 }
             }
             if ($wpv_vversion_optval == 3) {
                 $out = "ban req.url ~ ^{$wpv_url}\$ && req.http.host == {$wpv_host}\n";
             } else {
                 $out = "purge req.url ~ ^{$wpv_url} && req.http.host == {$wpv_host}\n";
             }
         } else {
             $out = "BAN {$wpv_url} HTTP/1.0\r\n";
             $out .= "Host: {$wpv_host}\r\n";
             $out .= "User-Agent: WordPress-Varnish plugin\r\n";
             $out .= "Connection: Close\r\n\r\n";
         }
         fwrite($varnish_sock, $out);
         fclose($varnish_sock);
     }
 }
Exemplo n.º 11
0
function wpcf7_is_email_in_site_domain($email)
{
    if (wpcf7_is_localhost()) {
        return true;
    }
    $site_domain = strtolower($_SERVER['SERVER_NAME']);
    if (preg_match('/^[0-9.]+$/', $site_domain)) {
        // 123.456.789.012
        return true;
    }
    if (wpcf7_is_email_in_domain($email, $site_domain)) {
        return true;
    }
    $home_url = home_url();
    // for interoperability with WordPress MU Domain Mapping plugin
    if (is_multisite() && function_exists('domain_mapping_siteurl')) {
        $domain_mapping_siteurl = domain_mapping_siteurl(false);
        if ($domain_mapping_siteurl) {
            $home_url = $domain_mapping_siteurl;
        }
    }
    if (preg_match('%^https?://([^/]+)%', $home_url, $matches)) {
        $site_domain = strtolower($matches[1]);
        if ($site_domain != strtolower($_SERVER['SERVER_NAME']) && wpcf7_is_email_in_domain($email, $site_domain)) {
            return true;
        }
    }
    return false;
}
/**
 * Same as above, but handles all domains in a multisite
 */
function htsda_mu_https_domain_rewrite($url, $status = 0)
{
    // Rewrite only if the request is https, or the user is logged in
    // to preserve cookie integrity
    if (substr($url, 0, 5) == 'https' || function_exists('is_user_logged_in') && is_user_logged_in() && !(defined('DISABLE_FRONTEND_SSL') && DISABLE_FRONTEND_SSL)) {
        // these won't change during the request
        static $domains;
        if (!isset($domains)) {
            $blogs = wp_get_sites();
            // get info from wp_blogs table
            $domains = array();
            // map the domains here
            $domains[] = hstda_trim_url(parse_url(get_site_url(1), PHP_URL_HOST), 'www.');
            // main site home
            // special case for wpmu domain mapping plugin
            if (function_exists('domain_mapping_siteurl')) {
                $domains[] = hstda_trim_url(parse_url(domain_mapping_siteurl(false), PHP_URL_HOST), 'www.');
            }
            foreach ($blogs as $blog) {
                $domains[] = hstda_trim_url($blog['domain'], 'www.');
            }
            // dedupe domains
            $domains = array_unique($domains);
        }
        // Rewrite the $url
        $url = hstda_rewrite_url($url, $domains);
    }
    return $url;
}
Exemplo n.º 13
0
 /**
  * Try to get an canonical URL when Donncha Domain Mapping is active.
  *
  * @since 2.4.0
  *
  * @param string $path The post relative path.
  * @param bool $get_scheme Output array with scheme.
  * @return string|array|void The unescaped URL, the scheme
  */
 public function the_url_donncha_domainmap($path, $get_scheme = false)
 {
     if (false === $this->is_donncha_domainmapping_active()) {
         return '';
     }
     global $current_blog;
     $scheme = is_ssl() ? 'https' : 'http';
     $url = function_exists('domain_mapping_siteurl') ? domain_mapping_siteurl(false) : false;
     $request_uri = '';
     if ($url && untrailingslashit($scheme . '://' . $current_blog->domain . $current_blog->path) !== $url) {
         if (defined('VHOST') && 'yes' !== VHOST || defined('SUBDOMAIN_INSTALL') && false === SUBDOMAIN_INSTALL) {
             $request_uri = isset($_SERVER['REQUEST_URI']) ? str_replace($current_blog->path, '/', $_SERVER['REQUEST_URI']) : '';
         }
         $url = trailingslashit($url . $request_uri) . ltrim($path, ' \\/');
         if ($get_scheme) {
             return array($url, $scheme);
         } else {
             return $url;
         }
     }
     return '';
 }
function redirect_to_mapped_domain()
{
    global $current_blog, $wpdb, $wp_customize;
    // don't redirect the main site
    if (is_main_site()) {
        return;
    }
    // don't redirect post previews
    if (isset($_GET['preview']) && $_GET['preview'] == 'true') {
        return;
    }
    // don't redirect theme customizer (WP 3.4)
    if (is_a($wp_customize, 'WP_Customize_Manager')) {
        return;
    }
    $protocol = is_ssl() ? 'https://' : 'http://';
    $url = domain_mapping_siteurl(false);
    if ($url && $url != untrailingslashit($protocol . $current_blog->domain . $current_blog->path)) {
        $redirect = get_site_option('dm_301_redirect') ? '301' : '302';
        if (defined('VHOST') && constant("VHOST") != 'yes' || defined('SUBDOMAIN_INSTALL') && constant('SUBDOMAIN_INSTALL') == false) {
            $_SERVER['REQUEST_URI'] = str_replace($current_blog->path, '/', $_SERVER['REQUEST_URI']);
        }
        header("Location: {$url}{$_SERVER['REQUEST_URI']}", true, $redirect);
        exit;
    }
}
Exemplo n.º 15
0
 /**
  * Get base URL, get domain mapping if plugin exists
  * @param string $path
  * @return string
  */
 public static function getBaseURL($path = '', $original_url = false)
 {
     global $current_site;
     // check for domain mapping plugin by donncha
     if (function_exists('domain_mapping_siteurl') && $original_url == false) {
         $base_url = domain_mapping_siteurl('NA');
         $base_url = untrailingslashit($base_url);
         $base_url .= $path;
     } elseif (is_multisite() && is_subdomain_install() == false) {
         $base_url = network_site_url($path);
         $base_url = str_replace($current_site->path, '', $base_url);
     } else {
         $base_url = home_url($path);
     }
     return $base_url;
 }
Exemplo n.º 16
0
function redirect_to_mapped_domain()
{
    global $current_blog, $nxtdb;
    // don't redirect post previews
    if (isset($_GET['preview']) && $_GET['preview'] == 'true') {
        return;
    }
    if (!isset($_SERVER['HTTPS'])) {
        $_SERVER['HTTPS'] = 'off';
    }
    $protocol = 'on' == strtolower($_SERVER['HTTPS']) ? 'https://' : 'http://';
    $url = domain_mapping_siteurl(false);
    if ($url && $url != untrailingslashit($protocol . $current_blog->domain . $current_blog->path)) {
        $redirect = get_site_option('dm_301_redirect') ? '301' : '302';
        if (defined('VHOST') && constant("VHOST") != 'yes' || defined('SUBDOMAIN_INSTALL') && constant('SUBDOMAIN_INSTALL') == false) {
            $_SERVER['REQUEST_URI'] = str_replace($current_blog->path, '/', $_SERVER['REQUEST_URI']);
        }
        header("Location: {$url}{$_SERVER['REQUEST_URI']}", true, $redirect);
        exit;
    }
}
 /**
  * Validate the user's API key both with the LivePress webservice
  * and the plugin update service.
  *
  * @return string
  */
 public static function api_key_validate()
 {
     self::die_if_not_allowed();
     check_ajax_referer('livepress_api_validate_nonce');
     $api_key = esc_html(stripslashes($_GET['api_key']));
     $domains = array();
     // Add domain mapping primary domain
     if (function_exists('domain_mapping_siteurl')) {
         $domain_mapping_siteurl = domain_mapping_siteurl();
         $domains['alias[]'] = $domain_mapping_siteurl;
     }
     $home_url = get_home_url();
     // Mapped domain on VIP
     $domains['alias[]'] = $home_url;
     // Validate with the LivePress webservice
     $livepress_communication = new LivePress_Communication($api_key);
     $status = $livepress_communication->validate_on_livepress($domains);
     $options = get_option(self::$options_name);
     $options['api_key'] = $api_key;
     $options['error_api_key'] = 1 != $status && 2 != $status;
     if ($status == 1) {
         // We pass validation, update blog parameters from LP side
         $blog = $livepress_communication->get_blog();
         $options['blog_shortname'] = $blog->shortname;
         $options['post_from_twitter_username'] = $blog->twitter_username;
     }
     update_option(self::$options_name, $options);
     if (false == $options['error_api_key']) {
         // Validate with plugin update service
         $api_params = array('edd_action' => 'activate_license', 'license' => $api_key, 'item_name' => urlencode(LP_ITEM_NAME));
         if (function_exists('vip_safe_wp_remote_get')) {
             $response = vip_safe_wp_remote_get(add_query_arg($api_params, LP_STORE_URL), '', 5, 10, 20, array('reject_unsafe_urls' => false));
         } else {
             $response = wp_remote_get(add_query_arg($api_params, LP_STORE_URL), array('reject_unsafe_urls' => false));
         }
         if (is_wp_error($response)) {
             die('Ouch');
         }
         $license_data = json_decode(wp_remote_retrieve_body($response));
         update_option('livepress_license_status', $license_data->license);
     }
     if (2 == $status || 1 == $status || 0 == $status) {
         header('Content-Type: application/json');
         die(json_encode($options));
     } else {
         die('Ouch');
     }
 }
 public function file($target = 'path')
 {
     /**
      * Get the blog ID
      */
     if (is_multisite()) {
         $current_site = get_blog_details();
         $blog_id = $current_site->blog_id;
     } else {
         $blog_id = 1;
     }
     /**
      * Get the upload directory for this site.
      */
     $upload_dir = wp_upload_dir();
     /**
      * If this is a multisite installation, append the blogid to the filename
      */
     $blog_id = is_multisite() && $blog_id > 1 ? '_blog-' . $blog_id : null;
     $page_id = $this->page_id() ? $this->page_id() : 'global';
     $file_name = 'avada' . $blog_id . '-' . $page_id . '.css';
     $folder_path = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'avada-styles';
     /**
      * The complete path to the file.
      */
     $file_path = $folder_path . DIRECTORY_SEPARATOR . $file_name;
     /**
      * Get the URL directory of the stylesheet
      */
     $css_uri_folder = $upload_dir['baseurl'];
     /**
      * Build the URL of the file
      */
     $css_uri = trailingslashit($css_uri_folder) . 'avada-styles/' . $file_name;
     /**
      * Take care of domain mapping.
      * When using domain mapping we have to make sure that the URL to the file
      * does not include the original domain but instead the mapped domain.
      */
     if (defined('DOMAIN_MAPPING') && DOMAIN_MAPPING) {
         if (function_exists('domain_mapping_siteurl') && function_exists('get_original_url')) {
             $mapped_domain = domain_mapping_siteurl(false);
             $original_domain = get_original_url('siteurl');
             $css_uri = str_replace($original_domain, $mapped_domain, $css_uri);
         }
     }
     /**
      * Strip protocols from the URL.
      * Make sure we don't have any issues with sites using HTTPS/SSL
      */
     $css_uri = str_replace('https://', '//', $css_uri);
     $css_uri = str_replace('http://', '//', $css_uri);
     /**
      * Return the path or the URL
      * depending on the $target we have defined when calling this method.
      */
     if ('path' == $target) {
         return $file_path;
     } elseif ('url' == $target || 'uri' == $target) {
         $timestamp = file_exists($file_path) ? '?timestamp=' . filemtime($file_path) : '';
         return $css_uri . $timestamp;
     }
 }
        public static function makecss()
        {
            global $wp_filesystem, $ss_framework;
            $file = self::file();
            // Initialize the Wordpress filesystem.
            if (empty($wp_filesystem)) {
                require_once ABSPATH . '/wp-admin/includes/file.php';
                WP_Filesystem();
            }
            $content = '/********* Compiled - Do not edit *********/

			';
            $content .= $ss_framework->compiler();
            // Take care of domain mapping
            if (defined('DOMAIN_MAPPING') && 1 == DOMAIN_MAPPING) {
                if (function_exists('domain_mapping_siteurl') && function_exists('get_original_url')) {
                    $mapped_domain = domain_mapping_siteurl(false);
                    $mapped_domain = str_replace('https://', '//', $domain_mapping);
                    $mapped_domain = str_replace('http://', '//', $mapped_domain);
                    $original_domain = get_original_url('siteurl');
                    $original_domain = str_replace('https://', '//', $original_domain);
                    $original_domain = str_replace('http://', '//', $original_domain);
                    $content = str_replace($original_domain, $mapped_domain, $content);
                }
            }
            // Strip protocols
            $content = str_replace('https://', '//', $content);
            $content = str_replace('http://', '//', $content);
            if (is_writeable($file) || !file_exists($file) && is_writeable(dirname($file))) {
                if (!$wp_filesystem->put_contents($file, $content, FS_CHMOD_FILE)) {
                    return apply_filters('shoestrap_css_output', $content);
                }
            }
            // Force re-building the stylesheet version transient
            delete_transient('shoestrap_stylesheet_time');
            delete_transient('shoestrap_stylesheet_path');
            delete_transient('shoestrap_stylesheet_uri');
        }