function load_front_styles()
 {
     $grid = Upfront_Grid::get_grid();
     $preprocessor = new Upfront_StylePreprocessor($grid);
     $style = $preprocessor->get_grid();
     $this->_out(new Upfront_CssResponse_Success($style));
 }
 public function add_style_load_url($urls)
 {
     $hub = Upfront_PublicStylesheets_Registry::get_instance();
     $styles = $hub->get_all();
     if (empty($styles)) {
         return $urls;
     }
     $ckey = $this->_cache->key(self::TYPE_STYLE, $styles);
     $raw_cache_key = $ckey->get_hash();
     $cache = $this->_debugger->is_active() ? false : $this->_cache->get($ckey);
     if (empty($cache)) {
         foreach ($styles as $key => $frags) {
             //$path = upfront_element_dir($frags[0], $frags[1]);
             //if (file_exists($path)) $cache .= "/* {$key} */\n" . file_get_contents($path) . "\n";
             if (empty($frags)) {
                 continue;
             }
             $style = $this->_get_style_contents($frags);
             if (!empty($style)) {
                 $cache .= "/* {$key} */\n{$style}\n";
             }
         }
         if (!$this->_debugger->is_active(Upfront_Debug::STYLE)) {
             $cache = Upfront_StylePreprocessor::compress($cache);
         }
         $this->_cache->set($ckey, $cache);
     }
     $url = Upfront_VirtualPage::get_url(join('/', array('upfront-dependencies', 'styles', $raw_cache_key)));
     $urls[] = $url;
     return $urls;
 }
 function load_styles()
 {
     $grid = Upfront_Grid::get_grid();
     $layout = apply_filters('upfront-style-base_layout', Upfront_Layout::get_instance());
     $preprocessor = new Upfront_StylePreprocessor($grid, $layout);
     $base_only = isset($_POST['base_only']) ? filter_var($_POST['base_only'], FILTER_VALIDATE_BOOLEAN) : false;
     // Alright, so initialize the var first
     $style = '';
     // Add typography styles - rearranging so the imports from Google fonts come first, if needed.
     // When loading styles in editor mode don't include typography styles since they are generated
     // by javascript
     if (false === $base_only) {
         $style = $this->prepare_typography_styles($layout, $grid);
         $style .= $preprocessor->process();
     }
     // Always load original theme styles into theme unless we're in builder, yay
     // Reasoning behind it: we want theme users to always have original theme styles loaded
     // because if they want to override some style they can add their own additional properties
     // or nullify explicitly existing rules. So, to avoid complex initialization logic depending
     // on wheather there is something in database just load theme styles always. In builder though
     // we don't want this because user is editing actual theme styles.
     $style .= $this->load_theme_styles_unless_in_builder();
     // When loading styles in editor mode don't include element styles and colors since they
     // will be loaded separately to the body. If they are included in main style than after
     // style is edited in editor (e.g. some property is removed) inconsistencies may occur
     // especially with rules removal since those would still be defined in main style.
     if ($base_only) {
         $this->_out(new Upfront_JsonResponse_Success(array('styles' => $style)));
         return;
     }
     //Add theme styles
     $style .= $this->prepare_theme_styles();
     // Add theme colors styles
     $style .= $this->_get_theme_colors_styles();
     // Add elements presets styles
     $style = apply_filters('get_element_preset_styles', $style);
     $style = Upfront_UFC::init()->process_colors($style);
     $this->_out(new Upfront_CssResponse_Success($style));
 }