public static function instance() { if (!self::$instance) { self::$instance = new self(); } return self::$instance; }
/** * Pre export function - need to save the stack to the metadata (in case being saved in a file) * * @return void * @author **/ function oxy_save_stack_before_export() { global $oxy_theme; $site_stack_id = $oxy_theme->get_option('site_stack'); $settings_options = array('css_save_to' => 'header', 'css_format' => 'scss_formatter_compressed'); $oxygenna_stack = OxygennaStacks::instance(); $oxygenna_stack->save_post_css($site_stack_id, $settings_options); }
/** * Installs default skins * * @return void **/ function oxy_theme_install_skins() { @error_reporting(0); // Don't break the JSON result header('Content-Type: application/json'); @set_time_limit(900); // 5 minutes should be PLENTY $ret = oxy_ajax_return_object(); if (wp_verify_nonce($_POST['nonce'], THEME_SHORT . '-oxy-skins')) { $oxygenna_stack = OxygennaStacks::instance(); $default_skins = (include OXY_THEME_DIR . 'inc/installer/default-skins.php'); foreach ($default_skins as $skin) { // check if default skin is already there $query_args = array('meta_key' => THEME_SHORT . '-default-skin', 'meta_value' => $skin['id'], 'post_type' => 'oxy_stack'); $old_skins_found = get_posts($query_args); if (count($old_skins_found) === 0) { // Create post object $skin_post = array('post_title' => $skin['name'], 'post_content' => '', 'post_status' => 'publish', 'post_type' => 'oxy_stack'); // Insert the post into the database $post_id = wp_insert_post($skin_post); if (!is_wp_error($post_id)) { // add meta tag to show this is a default skin update_post_meta($post_id, THEME_SHORT . '-default-skin', $skin['id']); $oxygenna_stack->import_stack($skin['data'], $post_id); $css = $oxygenna_stack->compile_stack($post_id, 'scss_formatter_compressed'); update_post_meta($post_id, 'oxy_stack_css', $css); $oxygenna_stack->update_css_in_file($post_id); } } } $ret->status = true; } echo json_encode($ret); die; }
<?php /** * Bootstrap for Stacks Moduls * * @package Lambda * @subpackage Stacks * * @copyright (c) 2015 Oxygenna.com * @license **LICENSE** * @version 1.17.0 * @author Oxygenna.com */ define('OXY_STACKS_DIR', OXY_THEME_DIR . 'vendor/oxygenna/oxygenna-stacks/'); define('OXY_STACKS_URI', OXY_THEME_URI . 'vendor/oxygenna/oxygenna-stacks/'); if (!class_exists('OxygennaStacks')) { require_once OXY_STACKS_DIR . 'inc/OxygennaStacks.php'; OxygennaStacks::instance(); }