Ejemplo n.º 1
0
 function generate_stylesheet($layout_id, $layout_settings)
 {
     it_classes_load('it-file-utility.php');
     require_once dirname(__FILE__) . '/layout-engine.php';
     $this->stylesheet = apply_filters('builder_get_layout_style_rules', '', $layout_id, $layout_settings);
     $file = "{$this->path}/{$layout_id}.css";
     $file = ITFileUtility::get_writable_file($file);
     if (is_wp_error($file) || false === file_put_contents($file, $this->stylesheet)) {
         return;
     }
     $this->layout['stylesheet_version'] = $this->get_current_stylesheet_version();
     $this->layout['stylesheet_file'] = $file;
     $this->layout_settings['layouts'][$this->layout_id] = $this->layout;
     $this->update_layout_storage();
 }
Ejemplo n.º 2
0
 public static function create_writable_file($args, $extension = null)
 {
     if (is_string($args)) {
         $args = array('name' => $args);
     } else {
         if (!is_array($args)) {
             $args = array();
         }
     }
     $default_args = array('create_new' => true, 'rename' => true);
     $args = array_merge($default_args, $args);
     return ITFileUtility::get_writable_file($args, $extension);
 }