function thim_generate_less2css($fileout, $type, $less_variables = array(), $compile_file = '') { if (!$compile_file) { $compile_file = TP_THEME_DIR . 'less' . DIRECTORY_SEPARATOR . 'theme-options.less'; } $css = ""; WP_Filesystem(); global $wp_filesystem; $compiler = new lessc(); $compiler->setFormatter('compressed'); // set less varivalbles $compiler->setVariables($less_variables); // chose file less to compile $css .= $compiler->compileFile($compile_file); // get customcss $css .= thim_get_customcss(); // minifile css $regex = array("`^([\t\\s]+)`ism" => '', "`^\\/\\*(.+?)\\*\\/`ism" => "", "`([\n\\A;]+)\\/\\*(.+?)\\*\\/`ism" => "\$1", "`([\n\\A;\\s]+)//(.+?)[\n\r]`ism" => "\$1\n", "`(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+`ism" => "", "/\n/i" => ""); $css = preg_replace(array_keys($regex), $regex, $css); /*********************************** * Create style.css file ***********************************/ $style = thim_file_get_contents(TP_THEME_DIR . "inc/theme-info.txt"); // Determine whether Multisite support is enabled if (is_multisite()) { // Write Theme Info into style.css if (!file_put_contents($fileout . $type, $style, LOCK_EX)) { @chmod($fileout . $type, 0777); file_put_contents($fileout . $type, $style, LOCK_EX); } // Write the rest to specific site style-ID.css $fileout = $fileout . '-' . get_current_blog_id(); if (!file_put_contents($fileout . $type, $css, FILE_APPEND)) { @chmod($fileout . $type, 0777); file_put_contents($fileout . $type, $css, FILE_APPEND); } } else { // If this is not multisite, we write them all in style.css file $style .= $css; if (!file_put_contents($fileout . $type, $style, LOCK_EX)) { @chmod($fileout . $type, 0777); file_put_contents($fileout . $type, $style, LOCK_EX); } } }
case 'menus': $next_step = is_dir(EXIST_REV_IMPORT) ? 'slider' : 'done'; if (!$wp_import->set_menus()) { $log = ob_get_clean(); $response = array('step' => 'menus', 'next' => 'error', 'return' => false, 'message' => __('Error on importing menus', 'thim'), 'logs' => $log); echo json_encode($response); } else { $log = ob_get_clean(); $response = array('step' => 'menus', 'next' => $next_step, 'return' => true, 'message' => __('Import menus success', 'thim'), 'logs' => $log); echo json_encode($response); } break; case 'widgets': $widgets_json = $_SESSION['thimpress-demodata-dir'] . '/data/widget/widget_data.json'; // widgets data file $widgets_json = thim_file_get_contents($widgets_json); if (!$wp_import->import_widgets($widgets_json)) { $log = ob_get_clean(); $response = array('step' => 'widgets', 'next' => 'error', 'return' => false, 'message' => __('Error on importing widgets', 'thim'), 'logs' => $log); echo json_encode($response); } else { $log = ob_get_clean(); $response = array('step' => 'widgets', 'next' => 'setting', 'return' => true, 'message' => __('Importing widgets success', 'thim'), 'logs' => $log); echo json_encode($response); } break; case 'setting': if (!is_file($import_settingpath)) { echo 'File not found "' . $import_settingpath . '"'; } if (!$wp_import->set_options($import_settingpath)) {
/** * Get the list of less files and generated css file from a list file * */ static function ListFiles($list_file, &$list, &$css_file_name) { $list = explode("\n", thim_file_get_contents($list_file)); //pop the cached name that should match $compiled_name $css_file_name = array_pop($list); if (!preg_match('/^lessphp_[a-f0-9]+\\.css$/', $css_file_name)) { $list[] = $css_file_name; $css_file_name = false; } }
function parse($file) { $this->wxr_version = $this->in_post = $this->cdata = $this->data = $this->sub_data = $this->in_tag = $this->in_sub_tag = false; $this->authors = $this->posts = $this->term = $this->category = $this->tag = array(); $xml = xml_parser_create('UTF-8'); xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0); xml_set_object($xml, $this); xml_set_character_data_handler($xml, 'cdata'); xml_set_element_handler($xml, 'tag_open', 'tag_close'); if (!xml_parse($xml, thim_file_get_contents($file))) { $current_line = xml_get_current_line_number($xml); $current_column = xml_get_current_column_number($xml); $error_code = xml_get_error_code($xml); $error_string = xml_error_string($error_code); return new WP_Error('XML_parse_error', 'There was an error when reading this WXR file', array($current_line, $current_column, $error_string)); } xml_parser_free($xml); if (!preg_match('/^\\d+\\.\\d+$/', $this->wxr_version)) { return new WP_Error('WXR_parse_error', __('This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer')); } return array('authors' => $this->authors, 'posts' => $this->posts, 'categories' => $this->category, 'tags' => $this->tag, 'terms' => $this->term, 'base_url' => $this->base_url, 'version' => $this->wxr_version); }
/** * @param $import_array Widget Json * * @return bool */ function import_widgets($import_array) { global $wp_registered_sidebars; $json_data = $import_array; $json_data = json_decode($json_data, true); $sidebars_data = $json_data[0]; $widget_data = $json_data[1]; $new_widgets = array(); foreach ($sidebars_data as $import_sidebar => $import_widgets) { foreach ($import_widgets as $import_widget) { //if the sidebar exists if (isset($wp_registered_sidebars[$import_sidebar])) { $title = trim(substr($import_widget, 0, strrpos($import_widget, '-'))); $index = trim(substr($import_widget, strrpos($import_widget, '-') + 1)); $current_widget_data = get_option('widget_' . $title); $new_widget_name = $this->new_widget_name($title, $index); $new_index = trim(substr($new_widget_name, strrpos($new_widget_name, '-') + 1)); if (!empty($new_widgets[$title]) && is_array($new_widgets[$title])) { while (array_key_exists($new_index, $new_widgets[$title])) { $new_index++; } } $current_sidebars[$import_sidebar][] = $title . '-' . $new_index; if (array_key_exists($title, $new_widgets)) { $new_widgets[$title][$new_index] = $widget_data[$title][$index]; $multiwidget = $new_widgets[$title]['_multiwidget']; unset($new_widgets[$title]['_multiwidget']); $new_widgets[$title]['_multiwidget'] = $multiwidget; } else { $current_widget_data[$new_index] = $widget_data[$title][$index]; $new_multiwidget = isset($widget_data[$title]['_multiwidget']) ? $widget_data[$title]['_multiwidget'] : false; $current_multiwidget = isset($current_widget_data['_multiwidget']) ? $current_widget_data['_multiwidget'] : false; $multiwidget = $current_multiwidget != $new_multiwidget ? $current_multiwidget : 1; unset($current_widget_data['_multiwidget']); $current_widget_data['_multiwidget'] = $multiwidget; $new_widgets[$title] = $current_widget_data; } } } } if (isset($new_widgets) && isset($current_sidebars)) { update_option('sidebars_widgets', $current_sidebars); foreach ($new_widgets as $title => $content) { update_option('widget_' . $title, $content); } } // IMPORT Widget Logic $widgets_logic_file = TP_THEME_DIR . 'inc/admin/data/widget/widget_logic_options.txt'; // widgets data file if (is_file($widgets_logic_file)) { $import = explode("\n", thim_file_get_contents($widgets_logic_file)); if (trim(array_shift($import)) == "[START=WIDGET LOGIC OPTIONS]" && trim(array_pop($import)) == "[STOP=WIDGET LOGIC OPTIONS]") { foreach ($import as $import_option) { list($key, $value) = explode("\t", $import_option); echo "{$key}, {$value} <br/>"; $wl_options[$key] = json_decode($value); } $wl_options['msg'] = __('Success! Options file imported', 'widget-logic'); } else { $wl_options['msg'] = __('Invalid options file', 'widget-logic'); } update_option('widget_logic', $wl_options); } return true; }
/** * Create new posts based on import information * * Posts marked as having a parent which doesn't exist will become top level items. * Doesn't create a new post if: the post type doesn't exist, the given post ID * is already noted as imported or a post with the same title and date already exists. * Note that new/updated terms, comments and meta are imported for the last of the above. */ function process_posts() { global $wpdb; $this->posts = apply_filters('wp_import_posts', $this->posts); @($start = intval(thim_file_get_contents(POST_COUNT))); $end = 0; if ($start < 1) { $start = 0; $end = 50; } if ($end > count($this->posts)) { $end = count($this->posts); } else { $end = 50; } $i = 0; $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT wposts.ID\n\t\t\t\t\tFROM {$wpdb->posts} as wposts, {$wpdb->postmeta} as wpostmeta\n\t\t\t\t\t\tWHERE wposts.ID = wpostmeta.post_id\n\t\t\t\t\t\tAND wpostmeta.meta_key = %s\n\t\t\t\t\t\tAND wpostmeta.meta_value LIKE %s\n\t\t\t\t\t\tAND wposts.post_type = %s\n\t\t\t\t\tORDER BY wpostmeta.meta_id ASC", '_wp_attached_file', '%demo_image.jpg', 'attachment')); foreach ($this->posts as $k => $post) { if ($k <= $start) { continue; } if ($i >= $end) { return 0; } thim_file_put_contents(POST_COUNT, $k); file_put_contents(POST_COUNT_TEST, "current_position:{$k} - start: {$start} - jump:{$end} - post_imported: {$i} - data: " . json_encode($post) . "\n", FILE_APPEND); $post = apply_filters('wp_import_post_data_raw', $post); if ('attachment' == $post['post_type'] && $attachment_id) { $this->processed_posts[intval($post['post_id'])] = (int) $attachment_id; $post_parent = (int) $post['post_parent']; if ($post_parent) { // if we already know the parent, map it to the new local ID if (isset($this->processed_posts[$post_parent])) { $post_parent = $this->processed_posts[$post_parent]; // otherwise record the parent for later } else { $this->post_orphans[intval($post['post_id'])] = $post_parent; $post_parent = 0; } } continue; } if (!post_type_exists($post['post_type'])) { do_action('wp_import_post_exists', $post); continue; } if (isset($this->processed_posts[$post['post_id']]) && !empty($post['post_id'])) { continue; } if ($post['status'] == 'auto-draft') { continue; } if ('nav_menu_item' == $post['post_type']) { $this->process_menu_item($post); $i++; continue; } $post_exists = post_exists($post['post_title'], '', $post['post_date']); if ($post_exists && get_post_type($post_exists) == $post['post_type']) { $comment_post_ID = $post_id = $post_exists; } else { $post_parent = (int) $post['post_parent']; if ($post_parent) { // if we already know the parent, map it to the new local ID if (isset($this->processed_posts[$post_parent])) { $post_parent = $this->processed_posts[$post_parent]; // otherwise record the parent for later } else { $this->post_orphans[intval($post['post_id'])] = $post_parent; $post_parent = 0; } } // map the post author $author = sanitize_user($post['post_author'], true); if (isset($this->author_mapping[$author])) { $author = $this->author_mapping[$author]; } else { $author = (int) get_current_user_id(); } $postdata = array('import_id' => $post['post_id'], 'post_author' => $author, 'post_date' => $post['post_date'], 'post_date_gmt' => $post['post_date_gmt'], 'post_content' => $post['post_content'], 'post_excerpt' => $post['post_excerpt'], 'post_title' => $post['post_title'], 'post_status' => $post['status'], 'post_name' => $post['post_name'], 'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'], 'guid' => $post['guid'], 'post_parent' => $post_parent, 'menu_order' => $post['menu_order'], 'post_type' => $post['post_type'], 'post_password' => $post['post_password']); $original_post_ID = $post['post_id']; $postdata = apply_filters('wp_import_post_data_processed', $postdata, $post); if ('attachment' == $postdata['post_type']) { if (!$attachment_id) { $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT wposts.ID\n\t\t\t\t\t\t\t\t\tFROM {$wpdb->posts} as wposts, {$wpdb->postmeta} as wpostmeta\n\t\t\t\t\t\t\t\t\t\tWHERE wposts.ID = wpostmeta.post_id\n\t\t\t\t\t\t\t\t\t\tAND wpostmeta.meta_key = %s\n\t\t\t\t\t\t\t\t\t\tAND wpostmeta.meta_value LIKE %s\n\t\t\t\t\t\t\t\t\t\tAND wposts.post_type = %s\n\t\t\t\t\t\t\t\t\tORDER BY wpostmeta.meta_id ASC ", '_wp_attached_file', '%demo_image.jpg', 'attachment')); } if (!$attachment_id) { $remote_url = !empty($post['attachment_url']) ? $post['attachment_url'] : $post['guid']; if (!$this->method) { $array = array($remote_url); $remote_url = $this->ww_replace_image_links_with_local($array); $remote_url = $remote_url[0]; } // try to use _wp_attached file for upload folder placement to ensure the same location as the export site // e.g. location is 2003/05/image.jpg but the attachment post_date is 2010/09, see media_handle_upload() $postdata['upload_date'] = $post['post_date']; if (isset($post['postmeta'])) { foreach ($post['postmeta'] as $meta) { if ($meta['key'] == '_wp_attached_file') { if (preg_match('%^[0-9]{4}/[0-9]{2}%', $meta['value'], $matches)) { $postdata['upload_date'] = $matches[0]; } break; } } } $comment_post_ID = $post_id = $this->process_attachment($postdata, $remote_url); } else { $comment_post_ID = $post_id = $attachment_id; } } else { $comment_post_ID = $post_id = wp_insert_post($postdata, true); do_action('wp_import_insert_post', $post_id, $original_post_ID, $postdata, $post); } if (is_wp_error($post_id)) { if (defined('IMPORT_DEBUG') && IMPORT_DEBUG) { } continue; } if ($post['is_sticky'] == 1) { stick_post($post_id); } } // map pre-import ID to local ID $this->processed_posts[intval($post['post_id'])] = (int) $post_id; if ($attachment_id && 'attachment' == $post['post_type']) { continue; } if (!isset($post['terms'])) { $post['terms'] = array(); } $post['terms'] = apply_filters('wp_import_post_terms', $post['terms'], $post_id, $post); // add categories, tags and other terms if (!empty($post['terms'])) { $terms_to_set = array(); foreach ($post['terms'] as $term) { // back compat with WXR 1.0 map 'tag' to 'post_tag' $taxonomy = 'tag' == $term['domain'] ? 'post_tag' : $term['domain']; $term_exists = term_exists($term['slug'], $taxonomy); $term_id = is_array($term_exists) ? $term_exists['term_id'] : $term_exists; if (!$term_id) { $t = wp_insert_term($term['name'], $taxonomy, array('slug' => $term['slug'])); if (!is_wp_error($t)) { $term_id = $t['term_id']; do_action('wp_import_insert_term', $t, $term, $post_id, $post); } else { if (defined('IMPORT_DEBUG') && IMPORT_DEBUG) { } do_action('wp_import_insert_term_failed', $t, $term, $post_id, $post); continue; } } $terms_to_set[$taxonomy][] = intval($term_id); } foreach ($terms_to_set as $tax => $ids) { $tt_ids = wp_set_post_terms($post_id, $ids, $tax); do_action('wp_import_set_post_terms', $tt_ids, $ids, $tax, $post_id, $post); } unset($post['terms'], $terms_to_set); } if (!isset($post['comments'])) { $post['comments'] = array(); } $post['comments'] = apply_filters('wp_import_post_comments', $post['comments'], $post_id, $post); // add/update comments if (!empty($post['comments'])) { $num_comments = 0; $inserted_comments = array(); foreach ($post['comments'] as $comment) { $comment_id = $comment['comment_id']; $newcomments[$comment_id]['comment_post_ID'] = $comment_post_ID; $newcomments[$comment_id]['comment_author'] = $comment['comment_author']; $newcomments[$comment_id]['comment_author_email'] = $comment['comment_author_email']; $newcomments[$comment_id]['comment_author_IP'] = $comment['comment_author_IP']; $newcomments[$comment_id]['comment_author_url'] = $comment['comment_author_url']; $newcomments[$comment_id]['comment_date'] = $comment['comment_date']; $newcomments[$comment_id]['comment_date_gmt'] = $comment['comment_date_gmt']; $newcomments[$comment_id]['comment_content'] = $comment['comment_content']; $newcomments[$comment_id]['comment_approved'] = $comment['comment_approved']; $newcomments[$comment_id]['comment_type'] = $comment['comment_type']; $newcomments[$comment_id]['comment_parent'] = $comment['comment_parent']; $newcomments[$comment_id]['commentmeta'] = isset($comment['commentmeta']) ? $comment['commentmeta'] : array(); if (isset($this->processed_authors[$comment['comment_user_id']])) { $newcomments[$comment_id]['user_id'] = $this->processed_authors[$comment['comment_user_id']]; } } ksort($newcomments); foreach ($newcomments as $key => $comment) { // if this is a new post we can skip the comment_exists() check if (!$post_exists || !comment_exists($comment['comment_author'], $comment['comment_date'])) { if (isset($inserted_comments[$comment['comment_parent']])) { $comment['comment_parent'] = $inserted_comments[$comment['comment_parent']]; } $comment = wp_filter_comment($comment); $inserted_comments[$key] = wp_insert_comment($comment); do_action('wp_import_insert_comment', $inserted_comments[$key], $comment, $comment_post_ID, $post); foreach ($comment['commentmeta'] as $meta) { $value = maybe_unserialize($meta['value']); add_comment_meta($inserted_comments[$key], $meta['key'], $value); } $num_comments++; } } unset($newcomments, $inserted_comments, $post['comments']); } if (!isset($post['postmeta'])) { $post['postmeta'] = array(); } $post['postmeta'] = apply_filters('wp_import_post_meta', $post['postmeta'], $post_id, $post); // add/update post meta if (!empty($post['postmeta'])) { foreach ($post['postmeta'] as $meta) { $key = apply_filters('import_post_meta_key', $meta['key'], $post_id, $post); $value = false; if ('_edit_last' == $key) { if (isset($this->processed_authors[intval($meta['value'])])) { $value = $this->processed_authors[intval($meta['value'])]; } else { $key = false; } } if ($key) { // export gets meta straight from the DB so could have a serialized string if (!$value) { $value = maybe_unserialize($meta['value']); } if (!$this->method) { // FIX IMAGES URL'S AND UPLOAD LOCAL IMAGES $value = $this->ww_replace_image_links_with_local($value); } add_post_meta($post_id, $key, $value); do_action('import_post_meta', $post_id, $key, $value); // if the post has a featured image, take note of this in case of remap if ('_thumbnail_id' == $key) { $value = $this->ww_replace_image_links_with_local($value, false, true); } } } } $i++; } unset($this->posts); return true; }
/** * Compile requested scss and serve css. Outputs HTTP response. * * @param string $salt Prefix a string to the filename for creating the cache name hash */ public function serve($salt = '') { if ($input = $this->findInput()) { $output = $this->cacheName($salt . $input); header('Content-type: text/css'); if ($this->needsCompile($input, $output)) { try { echo ent2ncr($this->compile($input, $output)); } catch (Exception $e) { header('HTTP/1.1 500 Internal Server Error'); echo 'Parse error: ' . $e->getMessage() . "\n"; } } else { header('X-SCSS-Cache: true'); echo thim_file_get_contents($output); } return; } header('HTTP/1.0 404 Not Found'); header('Content-type: text'); $v = scssc::$VERSION; echo "/* INPUT NOT FOUND scss {$v} */\n"; }
public function compile($env) { $evald = $this->compileForImport($env); //get path & uri $path_and_uri = null; if (is_callable(Less_Parser::$options['import_callback'])) { $path_and_uri = call_user_func(Less_Parser::$options['import_callback'], $evald); } if (!$path_and_uri) { $path_and_uri = $evald->PathAndUri(); } if ($path_and_uri) { list($full_path, $uri) = $path_and_uri; } else { $full_path = $uri = $evald->getPath(); } //import once if ($evald->skip($full_path, $env)) { return array(); } if ($this->options['inline']) { //todo needs to reference css file not import Less_Parser::AddParsedFile($full_path); $contents = new Less_Tree_Anonymous(thim_file_get_contents($full_path), 0, array(), true); if ($this->features) { return new Less_Tree_Media(array($contents), $this->features->value); } return array($contents); } // css ? if ($evald->css) { $features = $evald->features ? $evald->features->compile($env) : null; return new Less_Tree_Import($this->compilePath($env), $features, $this->options, $this->index); } return $this->ParseImport($full_path, $uri, $env); }
/** * Returns the sources contents * * @return array|null */ protected function getSourcesContent() { if (empty($this->sources)) { return; } $content = array(); foreach ($this->sources as $sourceFile) { $content[] = thim_file_get_contents($sourceFile); } return $content; }
protected function getInput() { if (!$this->input && $this->currentFile && $this->currentFile['filename']) { $this->input = thim_file_get_contents($this->currentFile['filename']); } }
/** * Set up the input buffer * */ public function SetInput($file_path) { if ($file_path) { $this->input = thim_file_get_contents($file_path); } $this->pos = $this->furthest = 0; // Remove potential UTF Byte Order Mark $this->input = preg_replace('/\\G\\xEF\\xBB\\xBF/', '', $this->input); $this->input_len = strlen($this->input); if (Less_Parser::$options['sourceMap'] && $this->env->currentFileInfo) { $uri = $this->env->currentFileInfo['currentUri']; Less_Parser::$contentsMap[$uri] = $this->input; } }
public function datauri($mimetypeNode, $filePathNode = null) { $filePath = $filePathNode ? $filePathNode->value : null; $mimetype = $mimetypeNode->value; $args = 2; if (!$filePath) { $filePath = $mimetype; $args = 1; } $filePath = str_replace('\\', '/', $filePath); if (Less_Environment::isPathRelative($filePath)) { if (Less_Parser::$options['relativeUrls']) { $temp = $this->currentFileInfo['currentDirectory']; } else { $temp = $this->currentFileInfo['entryPath']; } if (!empty($temp)) { $filePath = Less_Environment::normalizePath(rtrim($temp, '/') . '/' . $filePath); } } // detect the mimetype if not given if ($args < 2) { /* incomplete $mime = require('mime'); mimetype = mime.lookup(path); // use base 64 unless it's an ASCII or UTF-8 format var charset = mime.charsets.lookup(mimetype); useBase64 = ['US-ASCII', 'UTF-8'].indexOf(charset) < 0; if (useBase64) mimetype += ';base64'; */ $mimetype = Less_Mime::lookup($filePath); $charset = Less_Mime::charsets_lookup($mimetype); $useBase64 = !in_array($charset, array('US-ASCII', 'UTF-8')); if ($useBase64) { $mimetype .= ';base64'; } } else { $useBase64 = preg_match('/;base64$/', $mimetype); } if (file_exists($filePath)) { $buf = @thim_file_get_contents($filePath); } else { $buf = false; } // IE8 cannot handle a data-uri larger than 32KB. If this is exceeded // and the --ieCompat flag is enabled, return a normal url() instead. $DATA_URI_MAX_KB = 32; $fileSizeInKB = round(strlen($buf) / 1024); if ($fileSizeInKB >= $DATA_URI_MAX_KB) { $url = new Less_Tree_Url($filePathNode ? $filePathNode : $mimetypeNode, $this->currentFileInfo); return $url->compile($this); } if ($buf) { $buf = $useBase64 ? base64_encode($buf) : rawurlencode($buf); $filePath = '"data:' . $mimetype . ',' . $buf . '"'; } return new Less_Tree_Url(new Less_Tree_Anonymous($filePath)); }
/** * Generate the CSS for the widget. * * @param $instance * * @return string */ public function get_instance_css($instance) { if (!class_exists('lessc')) { $style_name = $this->get_style_name($instance); } if (empty($style_name)) { return ''; } $less = thim_file_get_contents(TP_THEME_DIR . 'inc/widgets/' . $this->id_base . '/style/' . $style_name . '.less'); $vars = $this->get_less_variables($instance); if (!empty($vars)) { foreach ($vars as $name => $value) { if (empty($value)) { continue; } $less = preg_replace('/\\@' . preg_quote($name) . ' *\\:.*?;/', '@' . $name . ': ' . $value . ';', $less); } } //get mixins $mixins = thim_file_get_contents(TP_THEME_DIR . 'less/mixins.less'); $less = preg_replace('/@import \\".*mixins\\";/', $mixins . "\n\n", $less); $style = $this->get_style_name($instance); $hash = $this->get_style_hash($instance); $css_name = $this->id_base . '-' . $style . '-' . $hash; $less = '.so-widget-' . $css_name . ' { ' . $less . ' } '; $c = new lessc(); return $c->compile($less); }