private static function basic_compile($file_from, $file_to) { if (!isset($GLOBALS['wpv_only_smart_less_compilation'])) { try { $l = new WpvLessc(); $l->importDir = '.'; include WPV_HELPERS . 'lessphp-extensions.php'; $l->compileFile($file_from, $file_to); // xss ok _e('Saved', 'church-event'); } catch (Exception $e) { self::warning($e->getMessage()); } } else { echo '<!-- smart less failed -->'; _e('Cannot compile LESS file', 'church-event'); } }
ini_set('display_errors', 1); $secret_file = '../cache/less-spawn-secret'; $expected_secret = file_get_contents($secret_file); if (!empty($expected_secret) && $expected_secret === $_POST['secret']) { @unlink($secret_file); define('BASEPATH', realpath(dirname(__FILE__) . '/../') . '/'); $path = realpath(dirname(__FILE__) . '/../vamtam/classes/') . '/'; // increase memory limit using the standard WP functions if (isset($_POST['abspath']) && file_exists($_POST['abspath'] . '/wp-includes/default-constants.php')) { function is_multisite() { return true; } // return value doesn't matter define('ABSPATH', $_POST['abspath']); include $_POST['abspath'] . '/wp-includes/default-constants.php'; wp_initial_constants(); } require $path . "lessc.php"; $l = new WpvLessc(); $l->importDir = '.'; include '../vamtam/helpers/lessphp-extensions.php'; try { $l->compileFile($_POST['input'], $_POST['output']); echo json_encode(array('status' => 'ok', 'memory' => memory_get_peak_usage() / 1024 / 1024)); // xss ok } catch (Exception $e) { echo json_encode(array('status' => 'error', 'message' => $e->getMessage(), 'memory' => memory_get_peak_usage() / 1024 / 1024)); // xss ok } }