Пример #1
0
 public static function PublishAllCSS($site)
 {
     $lessDir = SITES_LOCATION . '/' . $site['FriendlyId'] . '/themes/' . $site['Theme'] . '/styles/';
     //get all image files with a .less ext
     $files = glob($lessDir . "*.less");
     // combined css
     $combined_css = '';
     //print each file name
     foreach ($files as $file) {
         $f_arr = explode("/", $file);
         $count = count($f_arr);
         $filename = $f_arr[$count - 1];
         $name = str_replace('.less', '', $filename);
         if (strpos($name, 'respond.min') === FALSE) {
             $combined_css .= Publish::PublishCSS($site, $name);
         }
     }
     // publish combined css
     $css_file = SITES_LOCATION . '/' . $site['FriendlyId'] . '/css/respond.min.css';
     // put combined css
     file_put_contents($css_file, $combined_css);
 }
Пример #2
0
 public static function PublishAllCSS($siteUniqId, $root = '../')
 {
     $site = Site::GetBySiteUniqId($siteUniqId);
     // test for now
     $lessDir = $root . 'sites/' . $site['FriendlyId'] . '/themes/' . $site['Theme'] . '/styles/';
     //get all image files with a .less ext
     $files = glob($lessDir . "*.less");
     //print each file name
     foreach ($files as $file) {
         $f_arr = explode("/", $file);
         $count = count($f_arr);
         $filename = $f_arr[$count - 1];
         $name = str_replace('.less', '', $filename);
         Publish::PublishCSS($site, $name, $root);
     }
 }
Пример #3
0
 public static function PublishAllCSS($siteId)
 {
     $site = Site::GetBySiteId($siteId);
     // test for now
     $lessDir = SITES_LOCATION . '/' . $site['FriendlyId'] . '/themes/' . $site['Theme'] . '/styles/';
     //get all image files with a .less ext
     $files = glob($lessDir . "*.less");
     // combined css
     $combined_css = '';
     //print each file name
     foreach ($files as $file) {
         $f_arr = explode("/", $file);
         $count = count($f_arr);
         $filename = $f_arr[$count - 1];
         $name = str_replace('.less', '', $filename);
         if (strpos($name, 'respond.min') === FALSE) {
             $combined_css .= Publish::PublishCSS($site, $name);
         }
     }
     // get plugins CSS
     $plugins_file = SITES_LOCATION . '/' . $site['FriendlyId'] . '/css/plugins.css';
     if (file_exists($plugins_file)) {
         $css = file_get_contents($plugins_file);
         // remove comments
         $css = preg_replace('!/\\*[^*]*\\*+([^/][^*]*\\*+)*/!', '', $css);
         // Remove space after colons
         $css = str_replace(': ', ':', $css);
         // Remove whitespace
         $css = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $css);
         $combined_css .= $css;
     }
     // publish combined css
     $css_file = SITES_LOCATION . '/' . $site['FriendlyId'] . '/css/respond.min.css';
     // put combined css
     file_put_contents($css_file, $combined_css);
 }