function rcl_minify_style() { global $rcl_options, $wp_scripts; //print_r($wp_scripts->registered);exit; if (!isset($rcl_options['minify_css']) || $rcl_options['minify_css'] != 1) { return false; } $css_dir = RCL_PATH . 'css/'; $css_ar = array($css_dir . 'lk.css', $css_dir . 'recbar.css', $css_dir . 'regform.css', $css_dir . 'slider.css', $css_dir . 'users.css', $css_dir . 'style.css'); $csses = apply_filters('csspath_array_rcl', $css_ar); //print_r($csses);exit; $path = RCL_UPLOAD_PATH . 'css/'; if (!is_dir($path)) { mkdir($path); chmod($path, 0755); } $filename = 'minify.css'; $file_src = $path . $filename; $f = fopen($file_src, 'w'); $fullcss = ''; foreach ($csses as $k => $css_path) { $url = ''; $imgs = array(); $us = array(); if (!file_exists($css_path)) { continue; } $string_value = ''; preg_match_all("/(?<=\\/wp\\-content\\/)[A-z0-9\\-\\/\\.\\_\\s\\ё]*(?=)/i", $css_path, $string_value); if ($k !== 0) { $fullcss .= "\n\n"; } $fullcss .= '/*' . $string_value[0][0] . '*/' . "\r\n"; $string = file_get_contents($css_path); preg_match_all('/(?<=url\\()[A-zА-я0-9\\-\\_\\/\\"\'\\.\\?\\s]*(?=\\))/iu', $string, $url); $addon = rcl_addon_path($css_path) ? true : false; if ($url[0]) { foreach ($url[0] as $u) { $imgs[] = $addon ? rcl_addon_url(trim($u, '\',\\"'), $css_path) : RCL_URL . 'css/' . trim($u, '\',\\"'); $us[] = $u; } $string = str_replace($us, $imgs, $string); } $fullcss .= $string; } if (isset($fullcss)) { fwrite($f, $fullcss); fclose($f); } }
function rcl_get_template_path($file_temp, $path = false) { $dirs = array(RCL_TAKEPATH . 'templates/', RCL_PATH . 'templates/'); if ($path) { $dirs[1] = rcl_addon_path($path) . 'templates/'; } foreach ($dirs as $dir) { if (!file_exists($dir . $file_temp)) { continue; } return $dir . $file_temp; break; } return false; }