Permalink
Browse files

Updated H2t, Updated paths in HtmlSafe, updated bootstrap.dist.php to…

… allow phar based setup, added phar_stub.php which is used only during the build of phar archive.
  • Loading branch information...
snytkine committed Aug 11, 2012
1 parent ad990c3 commit 1035c554b0f0a7d94a4ef821edc8b616142dbbe8
View
@@ -9,6 +9,7 @@
.idea/*/
*admin.xml
build.xml
+phar_stub.php
phpunitbootstrap.php
version.ver
www/phpinfo.php
View
@@ -121,7 +121,7 @@ class H2t
*/
protected function __construct()
{
- if (!extension_loaded('xsl')) {
+ if (!\extension_loaded('xsl')) {
throw new Exception('php_xsl extension not loaded. If you are on Windows, please uncomment ;extension=php_xsl.dll in your php.ini');
}
@@ -203,17 +203,18 @@ public function loadHtml($sHtml)
}
+ /**
+ * @return H2t
+ * @throws HTML2TextException if unable to load plaintext.xsl file
+ * which is a xsl template file and is expected to be in the lib/Lampcms directory
+ *
+ */
protected function makeXslProcessor()
{
$xsl = new \DOMDocument;
- $tpl = LAMPCMS_LIB_DIR . DIRECTORY_SEPARATOR . $this->templateFile;
- if (!is_file($tpl)) {
- throw new HTML2TextException('XSL template not found here: ' . $tpl);
- }
-
-
- if (!$xsl->load($tpl)) {
- throw new HTML2TextException('Unable to load xsl template: ' . $this->templateFile);
+ if (!$xsl->load(__DIR__.DIRECTORY_SEPARATOR.'plaintext.xsl')) {
+ $err = !is_file('plaintext.xsl') ? ' plaintext.xsl file not found' : 'Unable to load xsl template plaintext.xsl';
+ throw new HTML2TextException($err);
}
$this->oXSL = new \XSLTProcessor;
@@ -225,7 +226,7 @@ protected function makeXslProcessor()
/**
- * Performes the transformation
+ * Performs the transformation
* and sets the $this->sOutput
* wraps text so that lines
* are not wider than 75 chars
View
@@ -632,9 +632,6 @@ public function clear()
*/
public function parse($doc)
{
- /*require_once(LAMPCMS_LIB_DIR . DIRECTORY_SEPARATOR . 'Pear' . DIRECTORY_SEPARATOR . 'XML' . DIRECTORY_SEPARATOR . 'HTMLSax3.php');
- require_once(LAMPCMS_LIB_DIR . DIRECTORY_SEPARATOR . 'Pear' . DIRECTORY_SEPARATOR . 'XML' . DIRECTORY_SEPARATOR . 'HTMLSax3' . DIRECTORY_SEPARATOR . 'States.php');
- require_once(LAMPCMS_LIB_DIR . DIRECTORY_SEPARATOR . 'Pear' . DIRECTORY_SEPARATOR . 'XML' . DIRECTORY_SEPARATOR . 'HTMLSax3' . DIRECTORY_SEPARATOR . 'Decorators.php');*/
require_once 'Pear' . DIRECTORY_SEPARATOR . 'XML' . DIRECTORY_SEPARATOR . 'HTMLSax3.php';
require_once 'Pear' . DIRECTORY_SEPARATOR . 'XML' . DIRECTORY_SEPARATOR . 'HTMLSax3' . DIRECTORY_SEPARATOR . 'States.php';
require_once 'Pear' . DIRECTORY_SEPARATOR . 'XML' . DIRECTORY_SEPARATOR . 'HTMLSax3' . DIRECTORY_SEPARATOR . 'Decorators.php';
View
@@ -604,11 +604,15 @@ public static function isPost()
public static function getCleanControllerName($name)
{
$expression = '/^[[:alpha:]\-]{1,32}$/';
+ /**
+ * @todo maybe we can allow non-alpha chars in uri
+ * We can try to allow controller names be encoded in utf8?
+ */
if (!\filter_var($name, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $expression)))) {
- throw new \InvalidArgumentException('Invalid value of controller name. It can only contain letters and a hyphen and be limited to 20 characters in total was: ' . \htmlentities($name));
+ throw new \InvalidArgumentException('Invalid value of controller name. It can only contain letters and a hyphen and be limited to 32 characters in total was: ' . \htmlentities($name));
}
- return \strtolower($name);
+ return \mb_strtolower($name);
}
}
File renamed without changes.
View
@@ -0,0 +1,13 @@
+<?php
+if (in_array("phar", stream_get_wrappers()) && class_exists("Phar", 0)) {
+ Phar::interceptFileFuncs();
+ set_include_path("phar://" . __FILE__ . PATH_SEPARATOR . get_include_path());
+ include "phar://" . __FILE__ . "/SwiftMailer/lib/swift_required.php";
+ include "phar://" . __FILE__ . "/autoload.php";
+ include "phar://" . __FILE__ . "/!inc.php";
+ return;
+} else {
+ exit("You DO NOT have phar extension enabled. Read instructions here: http://www.php.net/manual/en/phar.setup.php Try again when you have phar extension setup properly.");
+}
+
+__HALT_COMPILER();
View
@@ -69,6 +69,8 @@
* (same folders that are included in the Lampcms distribution)
* for example something like this "/var/lampcms/lib" on Linux
* or something like this 'C:\lampcms\lib' on Windows
+ *
+ * This is NOT IMPORTANT when running from the phar archive (see below)
*/
//define('LAMPCMS_LIB_DIR', '');
@@ -85,6 +87,16 @@
//define('LAMPCMS_CONFIG_DIR', '');
+
+/**
+ * If using phar-based setup
+ * make sure to point to full path of where
+ * lampcms.phar is located
+ *
+ * and uncomment the line below
+ */
+//define('LAMPCMS_PHAR', true);
+
/**
* DO NOT REMOVE OR EDIT
* ANY OF THE LINES BELOW!
@@ -99,3 +111,10 @@
if(!defined('LAMPCMS_CONFIG_DIR')){
define('LAMPCMS_CONFIG_DIR', realpath(dirname(__DIR__)).DIRECTORY_SEPARATOR.'config');
}
+
+if (defined('LAMPCMS_PHAR')) {
+ require LAMPCMS_PHAR;
+} else {
+ require LAMPCMS_LIB_DIR . DIRECTORY_SEPARATOR . 'require.php';
+}
+
View
@@ -67,7 +67,6 @@
\Lampcms\Cookie::sendRefferrerCookie();
}
-
$Tr = $Registry->Tr;
$mapper = $Registry->Router->getCallback();
$translator = $Tr->getCallback();

0 comments on commit 1035c55

Please sign in to comment.