public function compileCss(&$templateData, $cssFileName) { glz_importLib('lessphp/lessc.inc.php'); $less = new lessc(); $less->setImportDir(array(__DIR__ . '/less/')); $css = file_get_contents(__DIR__ . '/less/styles.less'); $css = $this->applyCssVariables($templateData, $less, $css); $css = $this->applyFont($templateData, $less, $css); $css = $less->compile($css); $css = str_replace(array('../img/', '../font/'), array('../static/movio/templates/Movio/img/', '../static/movio/templates/Movio/font/'), $css); $css .= PHP_EOL . $templateData->customCss; file_put_contents($cssFileName, $css); $templateData->css = '<link rel="stylesheet" href="' . $cssFileName . '" type="text/css" media="screen" />'; }
public function compileCss(&$templateData, $cssFileName) { glz_importLib('lessphp/lessc.inc.php'); $less = new lessc(); $less->setImportDir(array(__DIR__ . '/less/')); $css = file_get_contents(__DIR__ . '/less/styles.less'); $css = $this->applyCssVariables($templateData, $less, $css); $css = $this->applyFont($templateData, $less, $css); $css = $less->compile($css); $css = $this->fixUrl($css); $css = $this->addLogoAndCustomCss($templateData, $css); file_put_contents($cssFileName, $css); $templateData->css = '<link rel="stylesheet" href="' . $cssFileName . '" type="text/css" media="screen" />'; }
public function process_ajax() { $a = __Request::get('a'); $b = __Request::get('b'); $it = org_glizy_objectFactory::createModelIterator('org.glizycms.core.models.Content'); $it->where("document_detail_id", $a)->allStatuses(); $ar_a = $it->first(); $it = org_glizy_objectFactory::createModelIterator('org.glizycms.core.models.Content'); $it->where("document_detail_id", $b)->allStatuses(); $ar_b = $it->first(); $a = explode("\n", str_replace("<\\/p>", "<\\/p>\n", json_encode(json_decode($ar_a->document_detail_object), JSON_PRETTY_PRINT))); $b = explode("\n", str_replace("<\\/p>", "<\\/p>\n", json_encode(json_decode($ar_b->document_detail_object), JSON_PRETTY_PRINT))); glz_importLib('Diff/Diff.php'); glz_importLib('Diff/Diff/Renderer/Html/SideBySide.php'); // Options for generating the diff $options = array(); $diff = new Diff($a, $b, $options); $renderer = new Diff_Renderer_Html_SideBySide(); $result = $diff->Render($renderer); return array('html' => $result); }
private function resizeImage_gd($cacheFileName, $width, $height, $crop = false, $cropOffset = 1, $forceSize = false, $usePiramidalSizes = true, $resize = true) { $objImg = null; if (file_exists($this->getFileName())) { $imagetype = $this->getOriginalImageType(); switch ($imagetype) { case 'image/gif': if (function_exists('imageCreateFromGIF')) { $objImg = imageCreateFromGIF($this->getFileName()); } else { $objImg = imageCreateFromPNG($this->getFileName()); } break; case 'image/jpeg': $objImg = imageCreateFromJPEG($this->getFileName()); break; case 'image/png': $objImg = imageCreateFromPNG($this->getFileName()); break; case 'image/vnd.wap.wbmp': $objImg = imageCreateFromWBMP($this->getFileName()); break; default: // $ermsg = $imageInfo['mime'].' images are not supported<br />'; break; } } $originalSizes = $this->getOriginalSizes(); if (!is_null($objImg)) { $finalSizes = $this->resizeImageGetFinalSizes($width, $height, $crop, $cropOffset, $forceSize); $img = imageCreateTrueColor($crop ? $width : $finalSizes['width'], $crop ? $height : $finalSizes['height']); $w = imagecolorallocate($img, 255, 255, 255); imagefill($img, 0, 0, $w); if ($resize) { imageCopyResampled($img, $objImg, $finalSizes['cropX'], $finalSizes['cropY'], 0, 0, $finalSizes['width'], $finalSizes['height'], $originalSizes['width'], $originalSizes['height']); $unsharpMask = __Config::get('glizy.media.image.unsharpMask'); if ($unsharpMask) { list($a, $r, $t) = explode(',', $unsharpMask); glz_importLib('phpUnsharpMask/phpUnsharpMask.php'); phpUnsharpMask::applyUnsharpMask($img, $a, $r, $t); } } else { imageCopy($img, $objImg, 0, 0, 0, 0, $originalSizes['width'], $originalSizes['height']); } if ($this->watermark) { $this->insertWatermark($img, $crop ? $width : $finalSizes['width'], $crop ? $height : $finalSizes['height'], 'gd', false); } imageJPEG($img, $cacheFileName, org_glizy_Config::get('JPG_COMPRESSION')); imageDestroy($objImg); imageDestroy($img); unset($objImg); unset($img); @touch($cacheFileName, filemtime($this->getFileName())); @chmod($cacheFileName, 0777); $retInfo = array('imageType' => IMG_JPG, 'fileName' => $cacheFileName, 'width' => $crop ? $width : $finalSizes['width'], 'height' => $crop ? $height : $finalSizes['height'], 'originalWidth' => $originalSizes['width'], 'originalHeight' => $originalSizes['height']); } else { $fileName = org_glizy_Assets::get('ICON_MEDIA_IMAGE'); list($width, $height, $imagetypes) = getImageSize($fileName); $retInfo = array('imageType' => IMG_GIF, 'fileName' => $fileName, 'width' => $width, 'height' => $height, 'originalWidth' => $width, 'originalHeight' => $height); } return $retInfo; }
public function loadClass($className) { if (strpos($className, 'DebugBar') === 0 || strpos($className, 'Psr') === 0) { glz_importLib(str_replace('\\', '/', $className) . '.php'); } }