Merge branch 'develop' into pr/ncenterlite-option

This commit is contained in:
BJRambo 2016-03-27 03:12:23 +09:00
commit 455f3a78dd
85 changed files with 1375 additions and 6059 deletions

View file

@ -1,6 +1,5 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
@ -11,14 +10,14 @@ before_script:
- npm install grunt grunt-cli grunt-contrib-jshint grunt-contrib-csslint grunt-phplint --save-dev
- mysql -u root -e "CREATE DATABASE rhymix"
- mysql -u root -e "SET PASSWORD FOR 'travis'@'localhost' = PASSWORD('travis')"
- if [[ $TRAVIS_PHP_VERSION != "hhvm" ]]; then php -S localhost:8000 & fi
- if [[ $TRAVIS_PHP_VERSION == "5.3" ]]; then touch codecept.phar; fi
- if [[ $TRAVIS_PHP_VERSION != "5.4" && $TRAVIS_PHP_VERSION != "hhvm" ]]; then php -S localhost:8000 & fi
- if [[ $TRAVIS_PHP_VERSION == "5.4" ]]; then wget http://codeception.com/releases/2.0.16/codecept.phar; fi
- if [[ ! -f codecept.phar ]]; then wget http://codeception.com/releases/2.1.6/codecept.phar; fi
script:
- if [[ -s codecept.phar ]]; then php codecept.phar build; fi
- if [[ -s codecept.phar && $TRAVIS_PHP_VERSION == "hhvm" ]]; then php codecept.phar run -d --fail-fast --env travis --skip install; fi
- if [[ -s codecept.phar && $TRAVIS_PHP_VERSION != "hhvm" ]]; then php codecept.phar run -d --fail-fast --env travis; fi
- if [[ -s codecept.phar && $TRAVIS_PHP_VERSION == "5.4" ]]; then php codecept.phar run -d --fail-fast --env travis --skip install; fi
- if [[ -s codecept.phar && $TRAVIS_PHP_VERSION != "5.4" && $TRAVIS_PHP_VERSION != "hhvm" ]]; then php codecept.phar run -d --fail-fast --env travis; fi
- grunt lint
notifications:
email: false

View file

@ -58,6 +58,8 @@ PHP, HTML, XML, CSS, JS 등 모든 텍스트 파일의 문자셋은 BOM이 없
들여쓰기는 1개의 탭으로 합니다.
단, 탭 대신 공백을 사용하는 파일에서는 일관성 유지를 위해 4칸의 공백을 사용할 수 있습니다.
들여쓴 줄들 사이의 빈 줄도 들여씁니다. (에디터에서 후행 공백을 제거하지 않도록 설정하십시오.)
PHP 코드만으로 이루어진 파일은 맨 끝에 `?>` 태그를 사용하지 않습니다.
### 공백 및 줄바꿈 규칙
@ -155,5 +157,8 @@ Rhymix에서 정한 `error_reporting` 설정 하에서 어떤 에러도 발생
문자열과 문자열, 정수와 정수를 비교할 때는 가능하면 `==` 대신 `===`을 사용합니다.
실제 자료형이 다를 가능성이 있는 경우 `intval()`, `strval()` 등의 함수와 함께 사용합니다.
PHP 5.4 이상에서 지원하는 간단한 배열 문법(`[1, 2, 3]`)을 사용할 수 있으나,
복잡한 구조의 배열을 선언할 때는 이 문법이 오히려 가독성을 해칠 수 있으니 주의하시기 바랍니다.
여기에서 규정하지 않은 내용은 [PSR-1](http://www.php-fig.org/psr/psr-1/)과
[PSR-2](http://www.php-fig.org/psr/psr-2/)를 따릅니다.

View file

@ -32,18 +32,23 @@ Rhymix는 개발자와 사용자가 서로의 권리와 책임을 존중하는
### 설치 환경
- PHP 5.3.3 이상 (PHP 5.5.9 이상 권장, PHP 7 지원)
- MySQL 4.1.13 이상 (MySQL 5.0.7 이상 또는 MariaDB 권장)
- CUBRID 또는 MS SQL을 DB로 사용할 수도 있으나, 권장하지는 않습니다.
Rhymix를 사용하려면 아래의 조건을 충족하는 웹호스팅이나 서버를 마련하셔야 합니다.
- PHP 5.5.9 이상 (PHP 7 권장)
- MySQL 5.0.7 이상 (MariaDB 권장)
- 필수 PHP 모듈
- curl
- gd
- iconv 또는 mbstring
- json
- mcrypt 또는 openssl
- xml 및 simplexml
- simplexml
- php.ini에서 session.auto_start = Off로 설정되어 있어야 합니다.
- 설치 폴더 또는 files 폴더에 쓰기 권한이 주어져야 합니다.
- MySQL/MariaDB 외에도 아래의 DB를 사용할 수 있습니다.
- CUBRID 9.0 이상
- Microsoft SQL Server 2008 이상
### 개발 참여

View file

@ -3,7 +3,6 @@
/**
* Manages Context such as request arguments/environment variables
* It has dual method structure, easy-to use methods which can be called as self::methodname(),and methods called with static object.
*
* @author NAVER (developers@xpressengine.com)
*/
@ -449,6 +448,12 @@ class Context
*/
public static function close()
{
// Save debugging information.
if (!DisplayHandler::$debug_printed)
{
DisplayHandler::getDebugInfo();
}
// Check session status and close it if open.
if (self::checkSessionStatus())
{
@ -1360,10 +1365,9 @@ class Context
* @see Cast variables, such as _srl, page, and cpage, into interger
* @param string $key Variable key
* @param string $val Variable value
* @param string $do_stripslashes Whether to strip slashes
* @return mixed filtered value. Type are string or array
*/
public function _filterRequestVar($key, $val, $do_stripslashes = 1)
public function _filterRequestVar($key, $val)
{
if(!($isArray = is_array($val)))
{
@ -1389,19 +1393,6 @@ class Context
else
{
$result[$k] = $v;
if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
{
if (is_array($result[$k]))
{
array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
}
else
{
$result[$k] = stripslashes($result[$k]);
}
}
if(is_array($result[$k]))
{
array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });

View file

@ -24,7 +24,6 @@ class DB
*/
protected static $priority_dbms = array(
'mysqli' => 6,
'mysql' => 4,
'cubrid' => 2,
'mssql' => 1
);
@ -271,9 +270,13 @@ class DB
// after creating instance of class, check is supported
foreach ($supported_list as $db_type)
{
if (strncasecmp($db_type, 'mysql', 5) === 0 && strtolower($db_type) !== 'mysqli')
{
continue;
}
$class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1)));
$class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name);
if(!file_exists($class_file) || stripos($class_file, '_innodb') !== false)
if (!file_exists($class_file))
{
continue;
}

View file

@ -81,9 +81,14 @@ class DBCubrid extends DB
define('__CUBRID_VERSION__', $cubrid_version);
}
if(__CUBRID_VERSION__ >= '8.4.0')
cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
if(version_compare(__CUBRID_VERSION__, '9.0', '<'))
{
$this->setError(-1, 'Rhymix requires CUBRID 9.0 or later. Current CUBRID version is ' . __CUBRID_VERSION__);
return;
}
cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
return $result;
}

View file

@ -71,6 +71,16 @@ class DBMssql extends DB
$this->setError(-1, 'database connect fail' . PHP_EOL . $errors);
return;
}
$server_info = sqlsrv_server_info($result);
$server_version = $server_info['SQLServerVersion'];
if ($server_version && version_compare($server_version, '10', '<'))
{
$this->setError(-1, 'Rhymix requires Microsoft SQL Server 2008 or later. Current version is ' . $server_version);
return;
}
return $result;
}

View file

@ -77,10 +77,10 @@ class DBMysql extends DB
return;
}
// Error appears if the version is lower than 4.1.13
if(version_compare(mysql_get_server_info($result), '4.1.13', '<'))
// Error appears if the version is lower than 5.0.7
if(version_compare(mysql_get_server_info($result), '5.0.7', '<'))
{
$this->setError(-1, 'Rhymix requires MySQL 4.1.13 or later. Current MySQL version is ' . mysql_get_server_info());
$this->setError(-1, 'Rhymix requires MySQL 5.0.7 or later. Current MySQL version is ' . mysql_get_server_info());
return;
}

View file

@ -12,6 +12,7 @@
class DisplayHandler extends Handler
{
public static $response_size = 0;
public static $debug_printed = 0;
var $content_size = 0; // /< The size of displaying contents
var $gz_enabled = FALSE; // / <a flog variable whether to call contents after compressing by gzip
var $handler = NULL;
@ -136,16 +137,34 @@ class DisplayHandler extends Handler
*
* @return string
*/
public function getDebugInfo(&$output)
public function getDebugInfo(&$output = null)
{
// Check if debugging information has already been printed.
if (self::$debug_printed)
{
return;
}
else
{
self::$debug_printed = 1;
}
// Check if debugging is enabled for this request.
if (!config('debug.enabled') || !Rhymix\Framework\Debug::isEnabledForCurrentUser())
{
return;
}
// Do not display debugging information if there is no output.
$display_type = config('debug.display_type');
if ($output === null && $display_type !== 'file')
{
return;
}
// Print debug information.
switch ($display_type = config('debug.display_type'))
switch ($display_type)
{
case 'panel':
$data = Rhymix\Framework\Debug::getDebugData();

View file

@ -176,7 +176,8 @@ class FileHandler
{
if (!ini_get('safe_mode'))
{
return Rhymix\Framework\Storage::createDirectory(self::getRealPath($path_string));
$path = self::getRealPath($path_string);
return Rhymix\Framework\Storage::isDirectory($path) || Rhymix\Framework\Storage::createDirectory($path);
}
// if safe_mode is on, use FTP
@ -475,7 +476,7 @@ class FileHandler
{
return false;
}
return false;
return true;
}
/**

View file

@ -124,7 +124,7 @@ define('__XE_VERSION_ALPHA__', false);
define('__XE_VERSION_BETA__', false);
define('__XE_VERSION_RC__', false);
define('__XE_VERSION_STABLE__', true);
define('__XE_MIN_PHP_VERSION__', '5.3.3');
define('__XE_MIN_PHP_VERSION__', '5.5.9');
define('__XE_RECOMMEND_PHP_VERSION__', '5.5.9');
define('__ZBXE__', true);
define('__ZBXE_VERSION__', RX_VERSION);

View file

@ -64,6 +64,7 @@ return array(
'www.youtube.com/',
'www.youtube-nocookie.com/',
// Google Maps
'www.google.com/maps/embed',
'maps.google.com/',
'maps.google.co.kr/',
// Daum TV Pot

View file

@ -220,8 +220,8 @@ class Formatter
// Compile!
try
{
$scss_compiler = new \scssc;
$scss_compiler->setFormatter($minify ? 'scss_formatter_compressed' : 'scss_formatter');
$scss_compiler = new \Leafo\ScssPhp\Compiler;
$scss_compiler->setFormatter($minify ? '\Leafo\ScssPhp\Formatter\Crunched' : '\Leafo\ScssPhp\Formatter\Expanded');
$scss_compiler->setImportPaths(array(dirname(is_array($source_filename) ? array_first($source_filename) : $source_filename)));
if ($variables)
{

View file

@ -65,6 +65,8 @@ class MIME
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => 'text/plain',
'md' => 'text/markdown',
'markdown' => 'text/markdown',
'rtf' => 'text/rtf',
'xml' => 'text/xml',
'xsl' => 'text/xml',

View file

@ -79,11 +79,11 @@ class Password
public static function getSupportedAlgorithms()
{
$retval = array();
if (version_compare(PHP_VERSION, '5.3.7', '>=') && defined('\CRYPT_BLOWFISH'))
if (defined('\CRYPT_BLOWFISH'))
{
$retval['bcrypt'] = 'bcrypt';
}
if (function_exists('hash_hmac') && in_array('sha512', hash_algos()))
if (in_array('sha512', hash_algos()))
{
$retval['pbkdf2'] = 'pbkdf2';
}

View file

@ -58,7 +58,7 @@ class Security
$key = substr(hash('sha256', $key, true), 0, 16);
// Use defuse/php-encryption if possible.
if (!$force_compat && version_compare(\PHP_VERSION, '5.4.0', '>=') && function_exists('openssl_encrypt'))
if (!$force_compat && function_exists('openssl_encrypt'))
{
try
{
@ -96,7 +96,7 @@ class Security
}
// Use defuse/php-encryption if possible.
if (!$force_compat && version_compare(\PHP_VERSION, '5.4.0', '>=') && function_exists('openssl_decrypt'))
if (!$force_compat && function_exists('openssl_decrypt'))
{
try
{
@ -147,11 +147,11 @@ class Security
{
$entropy = random_bytes($entropy_capped_bytes);
}
elseif(function_exists('openssl_random_pseudo_bytes') && (!$is_windows || version_compare(\PHP_VERSION, '5.4', '>=')))
elseif(function_exists('openssl_random_pseudo_bytes'))
{
$entropy = openssl_random_pseudo_bytes($entropy_capped_bytes);
}
elseif(function_exists('mcrypt_create_iv') && (!$is_windows || version_compare(\PHP_VERSION, '5.3.7', '>=')))
elseif(function_exists('mcrypt_create_iv') && !$is_windows)
{
$entropy = mcrypt_create_iv($entropy_capped_bytes, \MCRYPT_DEV_URANDOM);
}

View file

@ -9,7 +9,7 @@
{ "name": "NAVER", "email": "developers@xpressengine.com" }
],
"require": {
"php": ">=5.3.3",
"php": ">=5.5.9",
"ext-curl": "*",
"ext-gd": "*",
"ext-iconv": "*",
@ -21,13 +21,13 @@
"ext-xml": "*",
"defuse/php-encryption": "1.2.1",
"ezyang/htmlpurifier": "4.7.*",
"firephp/firephp-core": "0.4.0",
"hautelook/phpass": "0.3.*",
"jbbcode/jbbcode": "1.3.*",
"leafo/lessphp": "0.5.*",
"leafo/scssphp": "0.4.*",
"leafo/scssphp": "0.6.*",
"league/html-to-markdown": "4.2.*",
"matthiasmullie/minify": "1.3.*",
"matthiasmullie/path-converter": "1.*",
"michelf/php-markdown": "1.6.*",
"michelf/php-smartypants": "1.6.0-beta1",
"rmccue/requests": "1.6.*",
@ -36,7 +36,6 @@
"true/punycode": "2.*"
},
"require-dev": {
"php": ">=5.4.0",
"codeception/codeception": "2.1.*",
"codeception/verify": "0.3.*",
"codeception/specify": "0.4.*"

59
composer.lock generated
View file

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "61ea4cb999dbb61cd01ba1a4ede5ead6",
"content-hash": "ec214228f19d828ce0ea5feeb0a72aba",
"hash": "ff1a5bab9497b1e5f25dd3069ffbbf13",
"content-hash": "9478a148fd56f1f50543063e3971a777",
"packages": [
{
"name": "defuse/php-encryption",
@ -96,42 +96,6 @@
],
"time": "2015-08-05 01:03:42"
},
{
"name": "firephp/firephp-core",
"version": "v0.4.0",
"source": {
"type": "git",
"url": "https://github.com/firephp/firephp-core.git",
"reference": "fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firephp/firephp-core/zipball/fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf",
"reference": "fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"lib/FirePHPCore/FirePHP.class.php",
"lib/FirePHPCore/fb.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christoph Dorn",
"email": "christoph@christophdorn.com",
"homepage": "http://christophdorn.com"
}
],
"description": "Traditional FirePHPCore library for sending PHP variables to the browser.",
"homepage": "https://github.com/firephp/firephp-core",
"time": "2013-04-23 15:28:20"
},
{
"name": "hautelook/phpass",
"version": "0.3.4",
@ -265,34 +229,31 @@
},
{
"name": "leafo/scssphp",
"version": "v0.4.0",
"version": "v0.6.3",
"source": {
"type": "git",
"url": "https://github.com/leafo/scssphp.git",
"reference": "78a6f27aa4eaf70bb3ff4d13b639bab71fdaf47a"
"reference": "a27edad3d16635a222d7204706572e24c338aa17"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/leafo/scssphp/zipball/78a6f27aa4eaf70bb3ff4d13b639bab71fdaf47a",
"reference": "78a6f27aa4eaf70bb3ff4d13b639bab71fdaf47a",
"url": "https://api.github.com/repos/leafo/scssphp/zipball/a27edad3d16635a222d7204706572e24c338aa17",
"reference": "a27edad3d16635a222d7204706572e24c338aa17",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=5.4.0"
},
"require-dev": {
"kherge/box": "~2.5",
"phpunit/phpunit": "~3.7",
"squizlabs/php_codesniffer": "~2.3"
"squizlabs/php_codesniffer": "~2.5"
},
"bin": [
"bin/pscss"
],
"type": "library",
"autoload": {
"classmap": [
"classmap.php"
],
"psr-4": {
"Leafo\\ScssPhp\\": "src/"
}
@ -317,7 +278,7 @@
"scss",
"stylesheet"
],
"time": "2015-11-09 14:44:09"
"time": "2016-01-15 02:50:06"
},
{
"name": "league/html-to-markdown",
@ -796,7 +757,7 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.3",
"php": ">=5.5.9",
"ext-curl": "*",
"ext-gd": "*",
"ext-iconv": "*",

View file

@ -829,9 +829,9 @@ class commentController extends comment
}
// set modifier's information if logged-in and posting author and modifier are matched.
$logged_info = Context::get('logged_info');
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
if($source_obj->member_srl == $logged_info->member_srl)
{
$obj->member_srl = $logged_info->member_srl;

View file

@ -459,10 +459,20 @@ class communicationController extends communication
$logged_info = Context::get('logged_info');
$target_srl = (int) trim(Context::get('target_srl'));
if(!$target_srl)
if(!$target_srl || $target_srl == $logged_info->member_srl)
{
return new Object(-1, 'msg_invalid_request');
}
// Check duplicate friend
$args = new stdClass();
$args->member_srl = $logged_info->member_srl;
$args->target_srl = $target_srl;
$output = executeQuery('communication.isAddedFriend', $args);
if($output->data->count)
{
return new Object(-1, 'msg_already_friend');
}
// Variable
$args = new stdClass();

View file

@ -21,7 +21,9 @@ $lang->cmd_message_box = 'Message Box';
$lang->cmd_view_message_box = 'Message Box';
$lang->cmd_store = 'Save';
$lang->cmd_add_friend_group = 'Add Friend Group';
$lang->cmd_rename_friend_group = 'Modify Friend Group Name';
$lang->cmd_rename_friend_group = 'Rename Friend Group';
$lang->cmd_delete_friend_group = 'Delete Friend Group';
$lang->msg_already_friend = 'You are already friends with this person.';
$lang->msg_no_message = 'There is no message.';
$lang->msg_cannot_send_to_yourself = 'Cannot send a message to yourself.';
$lang->message_received = 'You have a new message.';
@ -36,4 +38,4 @@ $lang->communication_send_message_grant = 'Send Message Grant';
$lang->cmd_manage_base = 'Basic infomation';
$lang->alert_new_message_arrived = 'You have %d new message(s). Do you want to check it now?';
$lang->enable_communication_friend = 'Friend Enable';
$lang->enable_communication_message = 'Message Enable';
$lang->enable_communication_message = 'Message Enable';

View file

@ -22,6 +22,8 @@ $lang->cmd_view_message_box = 'メッセージ';
$lang->cmd_store = '保存';
$lang->cmd_add_friend_group = '友達グループ追加';
$lang->cmd_rename_friend_group = '友達グループ名変更';
$lang->cmd_delete_friend_group = '友達グループ削除';
$lang->msg_already_friend = '既に友達として登録されています。';
$lang->msg_no_message = 'メッセージがありません。';
$lang->msg_cannot_send_to_yourself = '自分自身へのメッセージ送信はできません。';
$lang->message_received = 'メッセージが届きました。';

View file

@ -22,6 +22,8 @@ $lang->cmd_view_message_box = '쪽지함 보기';
$lang->cmd_store = '보관';
$lang->cmd_add_friend_group = '친구 그룹 추가';
$lang->cmd_rename_friend_group = '친구 그룹 이름 변경';
$lang->cmd_delete_friend_group = '친구 그룹 삭제';
$lang->msg_already_friend = '이미 친구로 등록되어 있습니다.';
$lang->msg_no_message = '쪽지가 없습니다.';
$lang->msg_cannot_send_to_yourself = '자기 자신에게 쪽지를 보낼 수 없습니다.';
$lang->message_received = '쪽지가 왔습니다.';
@ -36,4 +38,4 @@ $lang->communication_send_message_grant = '쪽지 발송 권한';
$lang->cmd_manage_base = '기본 정보';
$lang->alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?';
$lang->enable_communication_friend = '친구기능 사용';
$lang->enable_communication_message = '쪽지기능 사용';
$lang->enable_communication_message = '쪽지기능 사용';

View file

@ -20,12 +20,12 @@
</select>
<button type="button" class="btn" onclick="doJumpFriendGroup()">{$lang->cmd_move}</button>
</span>
<select name="friend_group_list" id="friend_group_list" style="margin:0">
<select name="friend_group_list" id="friend_group_list" cond="count($friend_group_list)" style="margin:0">
<option loop="$friend_group_list => $key,$val" value="{$val->friend_group_srl}" selected="selected"|cond="$val->friend_group_srl == $friend_group_srl">{$val->title}</option>
</select>
<span class="btn-group">
<button type="button" class="btn" onclick="doRenameFriendGroup();return false;">{$lang->cmd_modify}</button>
<button type="button" class="btn" onclick="doDeleteFriendGroup();return false;">{$lang->cmd_delete}</button>
<button type="button" class="btn" cond="count($friend_group_list)" onclick="doRenameFriendGroup();return false;">{$lang->cmd_rename_friend_group}</button>
<button type="button" class="btn" cond="count($friend_group_list)" onclick="doDeleteFriendGroup();return false;">{$lang->cmd_delete_friend_group}</button>
<a href="{getUrl('','module','communication','act','dispCommunicationAddFriendGroup')}" class="btn" onclick="popopen(this.href);return false;">{$lang->cmd_add_friend_group}</a>
</span>
</div>
@ -42,7 +42,7 @@
</thead>
<tbody>
<tr loop="$friend_list => $no,$val">
<td>{$val->group_title?$val->group_title:"&nbsp;"}</td>
<td>{$val->group_title?$val->group_title:$lang->default_friend_group}</td>
<td><a href="#popup_menu_area" class="member_{$val->target_srl}">{$val->nick_name}</a></td>
<td>{zdate($val->regdate,"Y-m-d")}</td>
<td><input type="checkbox" name="friend_srl_list[]" value="{$val->friend_srl}" /></td>
@ -50,11 +50,11 @@
</tbody>
</table>
<div class="btnArea">
<select name="target_friend_group_srl" style="margin:0">
<select name="target_friend_group_srl" cond="count($friend_group_list)" style="margin:0">
<option loop="$friend_group_list => $key,$val" value="{$val->friend_group_srl}">{$val->title}</option>
</select>
<span class="btn-group __submit_group">
<button type="submit" name="act" class="btn" value="procCommunicationMoveFriend">{$lang->cmd_move}</button>
<button type="submit" name="act" class="btn" cond="count($friend_group_list)" value="procCommunicationMoveFriend">{$lang->cmd_move}</button>
<button type="submit" name="act" class="btn" value="procCommunicationDeleteFriend">{$lang->cmd_delete}</button>
</span>
</div>

View file

@ -8,7 +8,7 @@
<form ruleset="sendMessage" action="./" method="post">
<input type="hidden" name="module" value="communication" />
<input type="hidden" name="act" value="procCommunicationSendMessage" />
<input type="hidden" name="content" value="{htmlspecialchars($source_message->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}" />
<input type="hidden" name="content" value="{htmlspecialchars($source_message->content)}" />
<input type="hidden" name="receiver_srl" value="{$receiver_info->member_srl}" />
<input type="hidden" name="xe_validator_id" value="modules/communication/skins/default/send_message/1" />
<table class="table table-striped table-hover">

View file

@ -610,9 +610,9 @@ class documentController extends document
}
// If an author is identical to the modifier or history is used, use the logged-in user's information.
$logged_info = Context::get('logged_info');
if(Context::get('is_logged') && !$manual_updated && $module_info->use_anonymous != 'Y')
{
$logged_info = Context::get('logged_info');
if($source_obj->get('member_srl')==$logged_info->member_srl)
{
$obj->member_srl = $logged_info->member_srl;

View file

@ -763,7 +763,10 @@ class fileController extends file
}
// Create a directory
if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create');
if(!Rhymix\Framework\Storage::isDirectory($path) && !Rhymix\Framework\Storage::createDirectory($path))
{
return new Object(-1,'msg_not_permitted_create');
}
// Move the file
if($manual_insert)

View file

@ -364,15 +364,14 @@ class installController extends install
$checklist = array();
// Check PHP version
$checklist['php_version'] = true;
if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '>='))
{
$checklist['php_version'] = true;
}
else
{
$checklist['php_version'] = false;
}
if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
{
Context::set('phpversion_warning', true);
}
// Check DB
if(DB::getEnableList())

View file

@ -16,14 +16,13 @@
<span cond="!$val" class="error">ERROR</span>
</td>
</tr>
<tr cond="$key === 'php_version' && $phpversion_warning === true">
<tr cond="!$val && isset($lang->install_checklist_desc[$key])">
<td colspan="2" class="error_description">
{sprintf($lang->install_checklist_desc['php_version_warning'], __XE_RECOMMEND_PHP_VERSION__)} <a href="https://secure.php.net/supported-versions.php" target="_blank">[{$lang->more}]</a>
</td>
</tr>
<tr cond="$key !== 'php_version' && !$val && isset($lang->install_checklist_desc[$key])">
<td colspan="2" class="error_description">
{$lang->install_checklist_desc[$key]}
<!--@if($key === 'php_version')-->
{sprintf($lang->install_checklist_desc[$key], __XE_MIN_PHP_VERSION__)}
<!--@else-->
{$lang->install_checklist_desc[$key]}
<!--@end-->
</td>
</tr>
</block>

View file

@ -6,8 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'FB' => $vendorDir . '/firephp/firephp-core/lib/FirePHPCore/fb.php',
'FirePHP' => $vendorDir . '/firephp/firephp-core/lib/FirePHPCore/FirePHP.class.php',
'HTMLPurifier' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.php',
'HTMLPurifier_Arborize' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier/Arborize.php',
'HTMLPurifier_AttrCollections' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier/AttrCollections.php',
@ -262,6 +260,9 @@ return array(
'Leafo\\ScssPhp\\Colors' => $vendorDir . '/leafo/scssphp/src/Colors.php',
'Leafo\\ScssPhp\\Compiler' => $vendorDir . '/leafo/scssphp/src/Compiler.php',
'Leafo\\ScssPhp\\Compiler\\Environment' => $vendorDir . '/leafo/scssphp/src/Compiler/Environment.php',
'Leafo\\ScssPhp\\Exception\\CompilerException' => $vendorDir . '/leafo/scssphp/src/Exception/CompilerException.php',
'Leafo\\ScssPhp\\Exception\\ParserException' => $vendorDir . '/leafo/scssphp/src/Exception/ParserException.php',
'Leafo\\ScssPhp\\Exception\\ServerException' => $vendorDir . '/leafo/scssphp/src/Exception/ServerException.php',
'Leafo\\ScssPhp\\Formatter' => $vendorDir . '/leafo/scssphp/src/Formatter.php',
'Leafo\\ScssPhp\\Formatter\\Compact' => $vendorDir . '/leafo/scssphp/src/Formatter/Compact.php',
'Leafo\\ScssPhp\\Formatter\\Compressed' => $vendorDir . '/leafo/scssphp/src/Formatter/Compressed.php',
@ -370,11 +371,4 @@ return array(
'lessc_formatter_compressed' => $vendorDir . '/leafo/lessphp/lessc.inc.php',
'lessc_formatter_lessjs' => $vendorDir . '/leafo/lessphp/lessc.inc.php',
'lessc_parser' => $vendorDir . '/leafo/lessphp/lessc.inc.php',
'scss_formatter' => $vendorDir . '/leafo/scssphp/classmap.php',
'scss_formatter_compressed' => $vendorDir . '/leafo/scssphp/classmap.php',
'scss_formatter_crunched' => $vendorDir . '/leafo/scssphp/classmap.php',
'scss_formatter_nested' => $vendorDir . '/leafo/scssphp/classmap.php',
'scss_parser' => $vendorDir . '/leafo/scssphp/classmap.php',
'scss_server' => $vendorDir . '/leafo/scssphp/classmap.php',
'scssc' => $vendorDir . '/leafo/scssphp/classmap.php',
);

View file

@ -343,44 +343,6 @@
"punycode"
]
},
{
"name": "firephp/firephp-core",
"version": "v0.4.0",
"version_normalized": "0.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/firephp/firephp-core.git",
"reference": "fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firephp/firephp-core/zipball/fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf",
"reference": "fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf",
"shasum": ""
},
"time": "2013-04-23 15:28:20",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"lib/FirePHPCore/FirePHP.class.php",
"lib/FirePHPCore/fb.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christoph Dorn",
"email": "christoph@christophdorn.com",
"homepage": "http://christophdorn.com"
}
],
"description": "Traditional FirePHPCore library for sending PHP variables to the browser.",
"homepage": "https://github.com/firephp/firephp-core"
},
{
"name": "matthiasmullie/minify",
"version": "1.3.34",
@ -629,64 +591,6 @@
"description": "lessphp is a compiler for LESS written in PHP.",
"homepage": "http://leafo.net/lessphp/"
},
{
"name": "leafo/scssphp",
"version": "v0.4.0",
"version_normalized": "0.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/leafo/scssphp.git",
"reference": "78a6f27aa4eaf70bb3ff4d13b639bab71fdaf47a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/leafo/scssphp/zipball/78a6f27aa4eaf70bb3ff4d13b639bab71fdaf47a",
"reference": "78a6f27aa4eaf70bb3ff4d13b639bab71fdaf47a",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"kherge/box": "~2.5",
"phpunit/phpunit": "~3.7",
"squizlabs/php_codesniffer": "~2.3"
},
"time": "2015-11-09 14:44:09",
"bin": [
"bin/pscss"
],
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"classmap.php"
],
"psr-4": {
"Leafo\\ScssPhp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Leaf Corcoran",
"email": "leafot@gmail.com",
"homepage": "http://leafo.net"
}
],
"description": "scssphp is a compiler for SCSS written in PHP.",
"homepage": "http://leafo.github.io/scssphp/",
"keywords": [
"css",
"less",
"sass",
"scss",
"stylesheet"
]
},
{
"name": "league/html-to-markdown",
"version": "4.2.0",
@ -809,5 +713,60 @@
"typographer",
"typography"
]
},
{
"name": "leafo/scssphp",
"version": "v0.6.3",
"version_normalized": "0.6.3.0",
"source": {
"type": "git",
"url": "https://github.com/leafo/scssphp.git",
"reference": "a27edad3d16635a222d7204706572e24c338aa17"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/leafo/scssphp/zipball/a27edad3d16635a222d7204706572e24c338aa17",
"reference": "a27edad3d16635a222d7204706572e24c338aa17",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"kherge/box": "~2.5",
"phpunit/phpunit": "~3.7",
"squizlabs/php_codesniffer": "~2.5"
},
"time": "2016-01-15 02:50:06",
"bin": [
"bin/pscss"
],
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Leafo\\ScssPhp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Leaf Corcoran",
"email": "leafot@gmail.com",
"homepage": "http://leafo.net"
}
],
"description": "scssphp is a compiler for SCSS written in PHP.",
"homepage": "http://leafo.github.io/scssphp/",
"keywords": [
"css",
"less",
"sass",
"scss",
"stylesheet"
]
}
]

View file

@ -1 +0,0 @@
build/

View file

@ -1,171 +0,0 @@
TODO:
* Fix code indenting in PHP 4 code
* Port maxDepth option to PHP 4 code
2013-04-23 - Release Version: 0.4.0
* No changes
2011-06-22 - Release Version: 0.4.0rc3
* Build fixes
2011-06-20 - Release Version: 0.4.0rc1
* (Issue 163) PHP5 class_exists() throws Exception without second parameter
* (Issue 166) Non-utf8 array values replaced with null
* Cleaned up code formatting [sokolov.innokenty@gmail.com]
* Ensure JSON keys are never NULL (due to NULL key in some arrays)
* Better UTF-8 encoding detection
* Code style cleanup (qbbr)
* Changed license to MIT
* Refactored project
2010-10-26 - Release Version: 0.3.2
2010-10-12 - Release Version: 0.3.2rc6
* (Issue 154) getRequestHeader uses "getallheaders" even though it doesn't always exist. [25m]
2010-10-09 - Release Version: 0.3.2rc5
* (Issue 153) FirePHP incorrectly double-encodes UTF8 when mbstring.func_overload is enabled
2010-10-08 - Release Version: 0.3.2rc4
* Trigger upgrade message if part of FirePHP 1.0
* Removed FirePHP/Init.php inclusion logic and only load FirePHP.class.php if not already loaded
2010-07-19 - Release Version: 0.3.2rc3
* Fixed FirePHP/Init.php inclusion logic
2010-07-19 - Release Version: 0.3.2rc2
* (Issue 145) maxDepth option
* Changed maxObjectDepth and maxArrayDepth option defaults to 5
* Fixed code indentation
2010-03-05 - Release Version: 0.3.2rc1
* (Issue 114) Allow options to be passed on to basic logging wrappers
* (Issue 122) Filter objectStack property of FirePHP class
* (Issue 123) registerErrorHandler(false) by default
* Added setOption() and getOption() methods
* (Issue 117) dump() method argument validation
* Started adding PHPUnit tests
* Some refactoring to support unit testing
* Deprecated setProcessorUrl() and setRendererUrl()
* Check User-Agent and X-FirePHP-Version header to detect FirePHP on client
* (Issue 135) FirePHP 0.4.3 with Firebug 1.5 changes user agent on the fly
* (Issue 112) Error Predefined Constants Not available for PHP 5.x versions
2008-06-14 - Release Version: 0.3.1
* (Issue 108) ignore class name case in object filter
2009-05-11 - Release Version: 0.3
2009-05-01 - Release Version: 0.3.rc.1
* (Issue 90) PHP4 compatible version of FirePHPCore
* (Issue 98) Thrown exceptions don't send an HTTP 500 if the FirePHP exception handler is enabled
* (Issue 85) Support associative arrays in encodeTable method in FirePHP.class.php
* (Issue 66) Add a new getOptions() public method in API
* (Issue 82) Define $this->options outside of __construct
* (Issue 72) Message error if group name is null
* (Issue 68) registerErrorHandler() and registerExceptionHandler() should returns previous handlers defined
* (Issue 69) Add the missing register handler in the triumvirate (error, exception, assert)
* (Issue 75) [Error & Exception Handling] Option to not exit script execution
* (Issue 83) Exception handler can't throw exceptions
* (Issue 80) Auto/Pre collapsing groups AND Custom group row colors
2008-11-09 - Release Version: 0.2.1
* (Issue 70) Problem when logging resources
2008-10-21 - Release Version: 0.2.0
* Updated version to 0.2.0
* Switched to using __sleep instead of __wakeup
* Added support to exclude object members when encoding
* Add support to enable/disable logging
2008-10-17 - Release Version: 0.2.b.8
* New implementation for is_utf8()
* (Issue 55) maxObjectDepth Option not working correctly when using TABLE and EXCEPTION Type
* Bugfix for max[Object|Array]Depth when encoding nested array/object graphs
* Bugfix for FB::setOptions()
2008-10-16 - Release Version: 0.2.b.7
* (Issue 45) Truncate dump when string have non utf8 cars
* (Issue 52) logging will not work when firephp object gets stored in the session.
2008-10-16 - Release Version: 0.2.b.6
* (Issue 37) Display file and line information for each log message
* (Issue 51) Limit output of object graphs
* Bugfix for encoding object members set to NULL|false|''
2008-10-14 - Release Version: 0.2.b.5
* Updated JsonStream wildfire protocol to be more robust
* (Issue 33) PHP error notices running demos
* (Issue 48) Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given
2008-10-08 - Release Version: 0.2.b.4
* Bugfix for logging objects with recursion
2008-10-08 - Release Version: 0.2.b.3
* (Issue 43) Notice message in 0.2b2
* Added support for PHP's native json_encode() if available
* Revised object encoder to detect object recursion
2008-10-07 - Release Version: 0.2.b.2
* (Issue 28) Need solution for logging private and protected object variables
* Added trace() and table() aliases in FirePHP class
* (Issue 41) Use PHP doc in FirePHP
* (Issue 39) Static logging method for object oriented API
2008-10-01 - Release Version: 0.2.b.1
* Added support for error and exception handling
* Updated min PHP version for PEAR package to 5.2
* Added version constant for library
* Gave server library it's own wildfire plugin namespace
* Migrated communication protocol to Wildfire JsonStream
* Added support for console groups using "group" and "groupEnd"
* Added support for log, info, warn and error logging aliases
* (Issue 29) problem with TRACE when using with error_handler
* (Issue 33) PHP error notices running demos
* (Issue 12) undefined index php notice
* Removed closing ?> php tags
* (Issue 13) the code in the fb() function has a second return statement that will never be reached
2008-07-30 - Release Version: 0.1.1.3
* Include __className property in JSON string if variable was an object
* Bugfix - Mis-spelt "Exception" in JSON encoding code
2008-06-13 - Release Version: 0.1.1.1
* Bugfix - Standardize windows paths in stack traces
* Bugfix - Display correct stack trace info in windows environments
* Bugfix - Check $_SERVER['HTTP_USER_AGENT'] before returning
2008-06-13 - Release Version: 0.1.1
* Added support for FirePHP::TRACE log style
* Changed license to New BSD License
2008-06-06 - Release Version: 0.0.2
* Bugfix - Added usleep() to header writing loop to ensure unique index
* Bugfix - Ensure chunk_split does not generate trailing "\n" with empty data header
* Added support for FirePHP::TABLE log style

View file

@ -1,75 +0,0 @@
FirePHPCore
===========
**Status: stable**
> **FirePHP is an advanced logging system that can display PHP variables in the browser as an application is navigated.**
> All communication is out of band to the application meaning that the logging data will not interfere with the normal functioning of the application.
This project contains the *FirePHPCore* PHP server library and provides a development environment (see `./workspace/`) for working on *FirePHPCore*.
Usage
=====
See [Install/Traditional: FirePHPCore](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/Configuration/Traditional) in the
[FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/).
Testing
=======
cd tests
phpunit .
Support & Feedback
==================
See [Support](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#support) in the [FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/).
Contribute
==========
See [Contribute](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#contribute) in the [FirePHP 1.0 Documentation](http://docs.sourcemint.org/firephp.org/firephp/1/-docs/).
Author
======
This project is authored and maintained by [Christoph Dorn](http://www.christophdorn.com/).
Documentation License
=====================
[Creative Commons Attribution-NonCommercial-ShareAlike 3.0](http://creativecommons.org/licenses/by-nc-sa/3.0/)
Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
Code License
============
[MIT License](http://www.opensource.org/licenses/mit-license.php)
Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,26 +0,0 @@
{
"name": "firephp/firephp-core",
"description": "Traditional FirePHPCore library for sending PHP variables to the browser.",
"type": "library",
"homepage": "https://github.com/firephp/firephp-core",
"license": "MIT",
"authors": [
{
"name": "Christoph Dorn",
"email": "christoph@christophdorn.com",
"homepage": "http://christophdorn.com"
}
],
"support": {
"forum": "http://groups.google.com/group/firephp-dev",
"issues": "https://github.com/firephp/firephp-core/issues",
"source": "https://github.com/firephp/firephp-core"
},
"autoload": {
"classmap": [
"lib/FirePHPCore/FirePHP.class.php",
"lib/FirePHPCore/fb.php"
]
}
}

View file

@ -1,82 +0,0 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* *** BEGIN LICENSE BLOCK *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK ***** */
/* NOTE: You must have the FirePHPCore library in your include path */
set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
require('FirePHPCore/FirePHP.class.php');
/* NOTE: You must have Output Buffering enabled via
ob_start() or output_buffering ini directive. */
$firephp = FirePHP::getInstance(true);
$firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */
$firephp->fb('Log message' ,FirePHP::LOG);
$firephp->fb('Info message' ,FirePHP::INFO);
$firephp->fb('Warn message' ,FirePHP::WARN);
$firephp->fb('Error message',FirePHP::ERROR);
$firephp->fb('Message with label','Label',FirePHP::LOG);
$firephp->fb(array('key1'=>'val1',
'key2'=>array(array('v1','v2'),'v3')),
'TestArray',FirePHP::LOG);
function test($Arg1) {
throw new Exception('Test Exception');
}
try {
test(array('Hello'=>'World'));
} catch(Exception $e) {
/* Log exception including stack trace & variables */
$firephp->fb($e);
}
$firephp->fb('Backtrace to here',FirePHP::TRACE);
$firephp->fb(array('2 SQL queries took 0.06 seconds',array(
array('SQL Statement','Time','Result'),
array('SELECT * FROM Foo','0.02',array('row1','row2')),
array('SELECT * FROM Bar','0.04',array('row1','row2'))
)),FirePHP::TABLE);
/* Will show only in "Server" tab for the request */
$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP);
print 'Hello World';

View file

@ -1,72 +0,0 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* *** BEGIN LICENSE BLOCK *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK ***** */
/* NOTE: You must have the FirePHPCore library in your include path */
set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
require('FirePHPCore/FirePHP.class.php4');
/* NOTE: You must have Output Buffering enabled via
ob_start() or output_buffering ini directive. */
$firephp =& FirePHP::getInstance(true);
$firephp->fb('Hello World'); /* Defaults to FirePHP::LOG */
$firephp->fb('Log message' ,FirePHP_LOG);
$firephp->fb('Info message' ,FirePHP_INFO);
$firephp->fb('Warn message' ,FirePHP_WARN);
$firephp->fb('Error message',FirePHP_ERROR);
$firephp->fb('Message with label','Label',FirePHP_LOG);
$firephp->fb(array('key1'=>'val1',
'key2'=>array(array('v1','v2'),'v3')),
'TestArray',FirePHP_LOG);
$firephp->fb('Backtrace to here',FirePHP_TRACE);
$firephp->fb(array('2 SQL queries took 0.06 seconds',array(
array('SQL Statement','Time','Result'),
array('SELECT * FROM Foo','0.02',array('row1','row2')),
array('SELECT * FROM Bar','0.04',array('row1','row2'))
)),FirePHP_TABLE);
/* Will show only in "Server" tab for the request */
$firephp->fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP);
print 'Hello World';

View file

@ -1,79 +0,0 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* *** BEGIN LICENSE BLOCK *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK ***** */
/* NOTE: You must have the FirePHPCore library in your include path */
set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
require('FirePHPCore/fb.php');
/* NOTE: You must have Output Buffering enabled via
ob_start() or output_buffering ini directive. */
fb('Hello World'); /* Defaults to FirePHP::LOG */
fb('Log message' ,FirePHP::LOG);
fb('Info message' ,FirePHP::INFO);
fb('Warn message' ,FirePHP::WARN);
fb('Error message',FirePHP::ERROR);
fb('Message with label','Label',FirePHP::LOG);
fb(array('key1'=>'val1',
'key2'=>array(array('v1','v2'),'v3')),
'TestArray',FirePHP::LOG);
function test($Arg1) {
throw new Exception('Test Exception');
}
try {
test(array('Hello'=>'World'));
} catch(Exception $e) {
/* Log exception including stack trace & variables */
fb($e);
}
fb('Backtrace to here',FirePHP::TRACE);
fb(array('2 SQL queries took 0.06 seconds',array(
array('SQL Statement','Time','Result'),
array('SELECT * FROM Foo','0.02',array('row1','row2')),
array('SELECT * FROM Bar','0.04',array('row1','row2'))
)),FirePHP::TABLE);
/* Will show only in "Server" tab for the request */
fb(apache_request_headers(),'RequestHeaders',FirePHP::DUMP);
print 'Hello World';

View file

@ -1,69 +0,0 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* *** BEGIN LICENSE BLOCK *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK ***** */
/* NOTE: You must have the FirePHPCore library in your include path */
set_include_path(dirname(dirname(__FILE__)).'/lib'.PATH_SEPARATOR.get_include_path());
require('FirePHPCore/fb.php');
/* NOTE: You must have Output Buffering enabled via
ob_start() or output_buffering ini directive. */
fb('Hello World'); /* Defaults to FirePHP::LOG */
fb('Log message' ,FirePHP_LOG);
fb('Info message' ,FirePHP_INFO);
fb('Warn message' ,FirePHP_WARN);
fb('Error message',FirePHP_ERROR);
fb('Message with label','Label',FirePHP_LOG);
fb(array('key1'=>'val1',
'key2'=>array(array('v1','v2'),'v3')),
'TestArray',FirePHP_LOG);
fb('Backtrace to here',FirePHP_TRACE);
fb(array('2 SQL queries took 0.06 seconds',array(
array('SQL Statement','Time','Result'),
array('SELECT * FROM Foo','0.02',array('row1','row2')),
array('SELECT * FROM Bar','0.04',array('row1','row2'))
)),FirePHP_TABLE);
/* Will show only in "Server" tab for the request */
fb(apache_request_headers(),'RequestHeaders',FirePHP_DUMP);
print 'Hello World';

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,275 +0,0 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - qbbr, Sokolov Innokenty <sokolov.innokenty@gmail.com>, Copyright 2011, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/**
* ***** BEGIN LICENSE BLOCK *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK *****
*
* @copyright Copyright (C) 2007+ Christoph Dorn
* @author Christoph Dorn <christoph@christophdorn.com>
* @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
* @package FirePHPCore
*/
if (!class_exists('FirePHP', false)) {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'FirePHP.class.php';
}
/**
* Sends the given data to the FirePHP Firefox Extension.
* The data can be displayed in the Firebug Console or in the
* "Server" request tab.
*
* @see http://www.firephp.org/Wiki/Reference/Fb
* @param mixed $Object
* @return true
* @throws Exception
*/
function fb()
{
$instance = FirePHP::getInstance(true);
$args = func_get_args();
return call_user_func_array(array($instance, 'fb'), $args);
}
class FB
{
/**
* Set an Insight console to direct all logging calls to
*
* @param object $console The console object to log to
* @return void
*/
public static function setLogToInsightConsole($console)
{
FirePHP::getInstance(true)->setLogToInsightConsole($console);
}
/**
* Enable and disable logging to Firebug
*
* @see FirePHP->setEnabled()
* @param boolean $enabled TRUE to enable, FALSE to disable
* @return void
*/
public static function setEnabled($enabled)
{
FirePHP::getInstance(true)->setEnabled($enabled);
}
/**
* Check if logging is enabled
*
* @see FirePHP->getEnabled()
* @return boolean TRUE if enabled
*/
public static function getEnabled()
{
return FirePHP::getInstance(true)->getEnabled();
}
/**
* Specify a filter to be used when encoding an object
*
* Filters are used to exclude object members.
*
* @see FirePHP->setObjectFilter()
* @param string $class The class name of the object
* @param array $filter An array or members to exclude
* @return void
*/
public static function setObjectFilter($class, $filter)
{
FirePHP::getInstance(true)->setObjectFilter($class, $filter);
}
/**
* Set some options for the library
*
* @see FirePHP->setOptions()
* @param array $options The options to be set
* @return void
*/
public static function setOptions($options)
{
FirePHP::getInstance(true)->setOptions($options);
}
/**
* Get options for the library
*
* @see FirePHP->getOptions()
* @return array The options
*/
public static function getOptions()
{
return FirePHP::getInstance(true)->getOptions();
}
/**
* Log object to firebug
*
* @see http://www.firephp.org/Wiki/Reference/Fb
* @param mixed $object
* @return true
* @throws Exception
*/
public static function send()
{
$args = func_get_args();
return call_user_func_array(array(FirePHP::getInstance(true), 'fb'), $args);
}
/**
* Start a group for following messages
*
* Options:
* Collapsed: [true|false]
* Color: [#RRGGBB|ColorName]
*
* @param string $name
* @param array $options OPTIONAL Instructions on how to log the group
* @return true
*/
public static function group($name, $options=null)
{
return FirePHP::getInstance(true)->group($name, $options);
}
/**
* Ends a group you have started before
*
* @return true
* @throws Exception
*/
public static function groupEnd()
{
return self::send(null, null, FirePHP::GROUP_END);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::LOG
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function log($object, $label=null)
{
return self::send($object, $label, FirePHP::LOG);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::INFO
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function info($object, $label=null)
{
return self::send($object, $label, FirePHP::INFO);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::WARN
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function warn($object, $label=null)
{
return self::send($object, $label, FirePHP::WARN);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::ERROR
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function error($object, $label=null)
{
return self::send($object, $label, FirePHP::ERROR);
}
/**
* Dumps key and variable to firebug server panel
*
* @see FirePHP::DUMP
* @param string $key
* @param mixed $variable
* @return true
* @throws Exception
*/
public static function dump($key, $variable)
{
return self::send($variable, $key, FirePHP::DUMP);
}
/**
* Log a trace in the firebug console
*
* @see FirePHP::TRACE
* @param string $label
* @return true
* @throws Exception
*/
public static function trace($label)
{
return self::send($label, FirePHP::TRACE);
}
/**
* Log a table in the firebug console
*
* @see FirePHP::TABLE
* @param string $label
* @param string $table
* @return true
* @throws Exception
*/
public static function table($label, $table)
{
return self::send($table, $label, FirePHP::TABLE);
}
}

View file

@ -1,245 +0,0 @@
<?php
// Authors:
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2007, New BSD License
// - qbbr, Michael Day <manveru.alma@gmail.com>, Copyright 2008, New BSD License
// - cadorn, Christoph Dorn <christoph@christophdorn.com>, Copyright 2011, MIT License
/* ***** BEGIN LICENSE BLOCK *****
*
* [MIT License](http://www.opensource.org/licenses/mit-license.php)
*
* Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ***** END LICENSE BLOCK *****
*
* @copyright Copyright (C) 2007+ Christoph Dorn
* @author Christoph Dorn <christoph@christophdorn.com>
* @author Michael Day <manveru.alma@gmail.com>
* @license [MIT License](http://www.opensource.org/licenses/mit-license.php)
* @package FirePHPCore
*/
require_once dirname(__FILE__).'/FirePHP.class.php4';
/**
* Sends the given data to the FirePHP Firefox Extension.
* The data can be displayed in the Firebug Console or in the
* "Server" request tab.
*
* @see http://www.firephp.org/Wiki/Reference/Fb
* @param mixed $Object
* @return true
* @throws Exception
*/
function fb()
{
$instance =& FirePHP::getInstance(true);
$args = func_get_args();
return call_user_func_array(array(&$instance,'fb'),$args);
}
class FB
{
/**
* Enable and disable logging to Firebug
*
* @see FirePHP->setEnabled()
* @param boolean $Enabled TRUE to enable, FALSE to disable
* @return void
*/
function setEnabled($Enabled) {
$instance =& FirePHP::getInstance(true);
$instance->setEnabled($Enabled);
}
/**
* Check if logging is enabled
*
* @see FirePHP->getEnabled()
* @return boolean TRUE if enabled
*/
function getEnabled() {
$instance =& FirePHP::getInstance(true);
return $instance->getEnabled();
}
/**
* Specify a filter to be used when encoding an object
*
* Filters are used to exclude object members.
*
* @see FirePHP->setObjectFilter()
* @param string $Class The class name of the object
* @param array $Filter An array or members to exclude
* @return void
*/
function setObjectFilter($Class, $Filter) {
$instance =& FirePHP::getInstance(true);
$instance->setObjectFilter($Class, $Filter);
}
/**
* Set some options for the library
*
* @see FirePHP->setOptions()
* @param array $Options The options to be set
* @return void
*/
function setOptions($Options) {
$instance =& FirePHP::getInstance(true);
$instance->setOptions($Options);
}
/**
* Get options for the library
*
* @see FirePHP->getOptions()
* @return array The options
*/
function getOptions() {
$instance =& FirePHP::getInstance(true);
return $instance->getOptions();
}
/**
* Log object to firebug
*
* @see http://www.firephp.org/Wiki/Reference/Fb
* @param mixed $Object
* @return true
*/
function send()
{
$instance =& FirePHP::getInstance(true);
$args = func_get_args();
return call_user_func_array(array(&$instance,'fb'),$args);
}
/**
* Start a group for following messages
*
* Options:
* Collapsed: [true|false]
* Color: [#RRGGBB|ColorName]
*
* @param string $Name
* @param array $Options OPTIONAL Instructions on how to log the group
* @return true
*/
function group($Name, $Options=null) {
$instance =& FirePHP::getInstance(true);
return $instance->group($Name, $Options);
}
/**
* Ends a group you have started before
*
* @return true
*/
function groupEnd() {
return FB::send(null, null, FirePHP_GROUP_END);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::LOG
* @param mixes $Object
* @param string $Label
* @return true
*/
function log($Object, $Label=null) {
return FB::send($Object, $Label, FirePHP_LOG);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::INFO
* @param mixes $Object
* @param string $Label
* @return true
*/
function info($Object, $Label=null) {
return FB::send($Object, $Label, FirePHP_INFO);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::WARN
* @param mixes $Object
* @param string $Label
* @return true
*/
function warn($Object, $Label=null) {
return FB::send($Object, $Label, FirePHP_WARN);
}
/**
* Log object with label to firebug console
*
* @see FirePHP::ERROR
* @param mixes $Object
* @param string $Label
* @return true
*/
function error($Object, $Label=null) {
return FB::send($Object, $Label, FirePHP_ERROR);
}
/**
* Dumps key and variable to firebug server panel
*
* @see FirePHP::DUMP
* @param string $Key
* @param mixed $Variable
* @return true
*/
function dump($Key, $Variable) {
return FB::send($Variable, $Key, FirePHP_DUMP);
}
/**
* Log a trace in the firebug console
*
* @see FirePHP::TRACE
* @param string $Label
* @return true
*/
function trace($Label) {
return FB::send($Label, FirePHP_TRACE);
}
/**
* Log a table in the firebug console
*
* @see FirePHP::TABLE
* @param string $Label
* @param string $Table
* @return true
*/
function table($Label, $Table) {
return FB::send($Table, $Label, FirePHP_TABLE);
}
}

View file

@ -1,43 +0,0 @@
{
"uid": "https://github.com/firephp/firephp-core/",
"name": "firephp-core",
"version": "0.4.0",
"label": "FirePHP Server Library",
"repositories": [
{
"type": "git",
"url": "git://github.com/firephp/firephp-core.git"
}
],
"maintainers": [
{
"name": "Christoph Dorn",
"email": "christoph@christophdorn.com",
"web": "http://www.christophdorn.com/",
"alias": {
"github": "cadorn"
}
}
],
"contributors": [
{
"name": "Christoph Dorn",
"email": "christoph@christophdorn.com",
"web": "http://www.christophdorn.com/",
"alias": {
"github": "cadorn"
}
},
{
"name": "Michael Day",
"email": "manveru.alma@gmail.com"
},
{
"name": "Sokolov Innokenty",
"email": "sokolov.innokenty@gmail.com",
"alias": {
"github": "qbbr"
}
}
]
}

View file

@ -1,5 +0,0 @@
{
"extends": {
"location": "./workspace/program.json"
}
}

View file

@ -1,12 +0,0 @@
<?php
set_include_path(dirname(dirname(dirname(__FILE__))).'/lib'.PATH_SEPARATOR.get_include_path());
require('FirePHPCore/fb.php');
fb('Hello\nWorld');
fb(array('Hello\nWorld'));
fb(array('Table cell with newline',array(
array('Header'),
array('Hello\nWorld'),
)),FirePHP::TABLE);

View file

@ -1,181 +0,0 @@
<?php
class FirePHPCore_FirePHPTest extends PHPUnit_Framework_TestCase
{
/**
* @issue http://code.google.com/p/firephp/issues/detail?id=117
*/
public function testDumpArguments()
{
$firephp = new FirePHP_Test_Class();
$firephp->dump("key", "value");
$headers = $firephp->_getHeaders();
$this->assertEquals('15|{"key":"value"}|', $headers['X-Wf-1-2-1-1']);
$firephp->_clearHeaders();
$caught = false;
try {
$firephp->dump(array(), "value");
} catch(Exception $e) {
// Key passed to dump() is not a string
$caught = true;
}
if(!$caught) $this->fail('No exception thrown');
$caught = false;
try {
$firephp->dump("key \n\r value", "value");
} catch(Exception $e) {
// Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]
$caught = true;
}
if(!$caught) $this->fail('No exception thrown');
$caught = false;
try {
$firephp->dump("keykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeykkeykeykeyk1", "value");
} catch(Exception $e) {
// Key passed to dump() is longer than 100 characters
$caught = true;
}
if(!$caught) $this->fail('No exception thrown');
}
/**
* @issue http://code.google.com/p/firephp/issues/detail?id=123
*/
public function testRegisterErrorHandler()
{
$firephp = new FirePHP_Test_Class();
$firephp->setOption("maxObjectDepth", 1);
$firephp->setOption("maxArrayDepth", 1);
$firephp->registerErrorHandler();
trigger_error("Hello World");
$headers = $firephp->_getHeaders();
if(!isset($headers["X-Wf-1-1-1-1"])) {
$this->fail("Error not in headers");
}
}
/**
* @issue http://code.google.com/p/firephp/issues/detail?id=122
*/
public function testFirePHPClassInstanceLogging()
{
$firephp = new FirePHP_Test_Class();
$firephp->log($firephp);
$headers = $firephp->_getHeaders();
if(!preg_match_all('/"protected:objectStack":"\\*\\* Excluded by Filter \\*\\*"/', $headers['X-Wf-1-1-1-1'], $m)) {
$this->fail("objectStack member contains value");
}
if(!preg_match_all('/"protected:static:instance":"\\*\\* Excluded by Filter \\*\\*"/', $headers['X-Wf-1-1-1-1'], $m)) {
$this->fail("instance member should not be logged");
}
if(!preg_match_all('/"undeclared:json_objectStack":"\\*\\* Excluded by Filter \\*\\*"/', $headers['X-Wf-1-1-1-1'], $m)) {
$this->fail("json_objectStack member should not be logged");
}
}
/**
* @issue http://code.google.com/p/firephp/issues/detail?id=114
*/
public function testCustomFileLineOptions()
{
$firephp = new FirePHP_Test_Class();
$firephp->log("message", "label", array("File"=>"/file/path", "Line"=>"1"));
$firephp->info("message", "label", array("File"=>"/file/path", "Line"=>"1"));
$firephp->warn("message", "label", array("File"=>"/file/path", "Line"=>"1"));
$firephp->error("message", "label", array("File"=>"/file/path", "Line"=>"1"));
$firephp->dump("key", "value", array("File"=>"/file/path", "Line"=>"1"));
$firephp->table("label", array(array("header"),array("cell")), array("File"=>"/file/path", "Line"=>"1"));
$headers = $firephp->_getHeaders();
$this->assertEquals('75|[{"File":"\/file\/path","Line":"1","Type":"LOG","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-1']);
$this->assertEquals('76|[{"File":"\/file\/path","Line":"1","Type":"INFO","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-2']);
$this->assertEquals('76|[{"File":"\/file\/path","Line":"1","Type":"WARN","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-3']);
$this->assertEquals('77|[{"File":"\/file\/path","Line":"1","Type":"ERROR","Label":"label"},"message"]|', $headers['X-Wf-1-1-1-4']);
$this->assertEquals('15|{"key":"value"}|', $headers['X-Wf-1-2-1-5']);
$this->assertEquals('89|[{"File":"\/file\/path","Line":"1","Type":"TABLE","Label":"label"},[["header"],["cell"]]]|', $headers['X-Wf-1-1-1-6']);
}
public function testRecursiveEncode()
{
$firephp = new FirePHP_Test_Class();
$obj = new FirePHPCore_FirePHPTest__TestObject();
$obj->child = $obj;
$firephp->log($obj, "label", array("File"=>"/file/path", "Line"=>"1"));
$headers = $firephp->_getHeaders();
$this->assertEquals('215|[{"File":"\/file\/path","Line":"1","Type":"LOG","Label":"label"},{"__className":"FirePHPCore_FirePHPTest__TestObject","public:var":"value","undeclared:child":"** Recursion (FirePHPCore_FirePHPTest__TestObject) **"}]|', $headers['X-Wf-1-1-1-1']);
}
public function testOptions()
{
$firephp = new FirePHP_Test_Class();
// defaults
$this->assertEquals(5, $firephp->getOption("maxObjectDepth"));
$this->assertEquals(5, $firephp->getOption("maxArrayDepth"));
$this->assertEquals(true, $firephp->getOption("useNativeJsonEncode"));
$this->assertEquals(true, $firephp->getOption("includeLineNumbers"));
// modify
$firephp->setOption("maxObjectDepth", 1);
$this->assertEquals(1, $firephp->getOption("maxObjectDepth"));
// invalid
$caught = false;
try {
$firephp->setOption("invalidName", 1);
} catch(Exception $e) {
$caught = true;
}
if(!$caught) $this->fail('No exception thrown');
$caught = false;
try {
$firephp->getOption("invalidName");
} catch(Exception $e) {
$caught = true;
}
if(!$caught) $this->fail('No exception thrown');
}
public function testDeprecatedMethods()
{
$firephp = new FirePHP_Test_Class();
$caught = false;
try {
$firephp->setProcessorUrl('URL');
} catch(Exception $e) {
$caught = true;
$this->assertEquals(E_USER_DEPRECATED, $e->getCode());
$this->assertEquals('The FirePHP::setProcessorUrl() method is no longer supported', $e->getMessage());
}
if(!$caught) $this->fail('No deprecation error thrown');
$caught = false;
try {
$firephp->setRendererUrl('URL');
} catch(Exception $e) {
$caught = true;
$this->assertEquals(E_USER_DEPRECATED, $e->getCode());
$this->assertEquals('The FirePHP::setRendererUrl() method is no longer supported', $e->getMessage());
}
if(!$caught) $this->fail('No deprecation error thrown');
}
}
class FirePHPCore_FirePHPTest__TestObject
{
public $var = "value";
}

View file

@ -1,55 +0,0 @@
<?php
function __autoload__($class)
{
if (strpos($class, 'FirePHPCore') !== 0 && $class != 'FirePHP') {
return;
}
$basePath = dirname(dirname(__FILE__)) . '/lib';
if (!file_exists($basePath)) {
$basePath = dirname(dirname(dirname(dirname(__FILE__)))) . '/lib';
}
if ($class == 'FirePHP') {
$class = 'FirePHPCore/FirePHP.class';
}
// find relative
if (file_exists($file = $basePath . '/' . str_replace('_', '/', $class) . '.php')) {
require_once($file);
}
}
spl_autoload_register('__autoload__');
class FirePHP_Test_Class extends FirePHP {
private $_headers = array();
public function _getHeaders() {
return $this->_headers;
}
public function _clearHeaders() {
$this->_headers = array();
}
// ######################
// # Subclassed Methods #
// ######################
protected function setHeader($Name, $Value) {
$this->_headers[$Name] = $Value;
}
protected function headersSent(&$Filename, &$Linenum) {
return false;
}
public function detectClientExtension() {
return true;
}
}

View file

@ -1,2 +0,0 @@
<phpunit bootstrap="TestHelper.php">
</phpunit>

View file

@ -1,19 +0,0 @@
The [PINF JavaScript Loader](https://github.com/pinf/loader-js) is used to provide a development environment and package releases for this project.
**NOTE:** It is assumed you have the _PINF JavaScript Loader_ mapped to the `commonjs` command and are using the `node` platform by default as explained [here](https://github.com/pinf/loader-js/blob/master/docs/Setup.md).
Publishing
==========
git tag v...
commonjs -v --script build .
commonjs -v --script publish .
TODO: Auto-upload to PEAR channel server at http://pear.firephp.org/
NOTE: For PEAR RC releases: Change release stability to "beta" and capitalize "RC" in release version in package.xml

View file

@ -1,5 +0,0 @@
exports.main = function(options)
{
}

View file

@ -1,28 +0,0 @@
{
"name": "firephp-core",
"engine": [
"node"
],
"main": "lib/project.js",
"scripts": {
"build": {
"location": "./",
"module": "/scripts/build.js"
},
"publish": {
"location": "./",
"module": "/scripts/publish.js"
}
},
"mappings": {
"nodejs": {
"id": "nodejs.org/"
},
"pinf": {
"id": "pinf.org/loader/"
},
"modules": {
"id": "github.com/pinf/modules-js/"
}
}
}

View file

@ -1,78 +0,0 @@
{
"boot": "workspace",
"engine": [
"node"
],
"packages": {
"workspace": {
"locator": {
"location": "./"
}
},
"nodejs.org/": {
"provider": "nodejs.org/"
},
"pinf.org/loader/": {
"provider": "pinf.org/loader/"
},
"github.com/pinf/modules-js/": {
"locator": {
"archive": "https://github.com/pinf/modules-js/zipball/master"
}
},
"github.com/kriskowal/q/": {
"locator": {
"archive": "https://github.com/kriskowal/q/zipball/v0.3.0"
},
"descriptor": {
"uid": "https://github.com/kriskowal/q/",
"dependencies": [
{
"id": "github.com/pinf/modules-js/"
}
]
}
},
"private-registry.appspot.com/cadorn.com/github/com.cadorn.baby/projects/sourcemint/packages/client-js/": {
"locator": {
"archive": "https://github.com/cadorn/com.cadorn.baby/zipball/master",
"path": "projects/sourcemint/packages/client-js"
}
},
"github.com/cadorn/aws-lib/": {
"locator": {
"archive": "https://github.com/cadorn/aws-lib/zipball/master"
},
"descriptor": {
"uid": "https://github.com/cadorn/aws-lib/",
"native": true,
"dependencies": [
{
"id": "registry.npmjs.org/sax/"
},
{
"id": "registry.npmjs.org/xml2js/"
}
]
}
},
"registry.npmjs.org/sax/": {
"locator": {
"archive": "http://registry.npmjs.org/sax/-/sax-0.1.2.tgz"
},
"descriptor": {
"uid": "http://registry.npmjs.org/sax/",
"native": true
}
},
"registry.npmjs.org/xml2js/": {
"locator": {
"archive": "http://registry.npmjs.org/xml2js/-/xml2js-0.1.6.tgz"
},
"descriptor": {
"uid": "http://registry.npmjs.org/xml2js/",
"native": true
}
}
}
}

View file

@ -1,164 +0,0 @@
var FILE = require("modules/file"),
Q = require("modules/q"),
SYSTEM = require("modules/system"),
UTIL = require("modules/util"),
JSON = require("modules/json");
var pkgPath = FILE.dirname(FILE.dirname(FILE.dirname(module.id))),
buildPath = pkgPath + "/build",
tplPath = pkgPath + "/workspace/tpl",
version = false;
exports.getBuildPath = function()
{
return buildPath;
}
exports.main = function()
{
SYSTEM.exec("rm -Rf " + buildPath, function()
{
FILE.mkdirs(buildPath, 0775);
SYSTEM.exec("git tag", function(stdout)
{
version = UTIL.trim(stdout).split("\n").pop().match(/^v(.*)$/)[1];
// TODO: Compare against version in `../../program.json ~ version` (ensure =)
module.print("\0cyan(Building version: " + version + "\0)\n");
buildZipArchive(function()
{
buildPEARArchive(function()
{
done();
});
});
});
});
function done()
{
module.print("\0green(Done\0)\n");
}
}
function buildZipArchive(callback)
{
var targetBasePath = buildPath + "/FirePHPCore-" + version;
FILE.mkdirs(targetBasePath, 0775);
SYSTEM.exec("rsync -r --copy-links --exclude \"- .DS_Store\" --exclude \"- .git/\" --exclude \"- .tmp_*\" " + pkgPath + "/lib " + targetBasePath, function()
{
replaceVariablesInFile(targetBasePath + "/lib/FirePHPCore/FirePHP.class.php");
replaceVariablesInFile(targetBasePath + "/lib/FirePHPCore/FirePHP.class.php4");
SYSTEM.exec("cp -Rf " + pkgPath + "/examples " + targetBasePath, function()
{
next1();
});
});
function next1()
{
var content = FILE.read(tplPath + "/readme.tpl.md");
content = content.replace(/%%VERSION%%/g, version);
FILE.write(targetBasePath + "/README.md", content);
var content = FILE.read(tplPath + "/license.tpl.md");
FILE.write(targetBasePath + "/LICENSE.md", content);
FILE.write(buildPath + "/info.json", JSON.encode({
version: version
}));
next2();
}
function next2()
{
SYSTEM.exec("cd " + buildPath + " ; zip -vr FirePHPCore-" + version + ".zip FirePHPCore-" + version, function(stdout)
{
console.log(stdout);
callback();
});
}
}
function buildPEARArchive(callback)
{
var targetBasePath = buildPath + "/pear";
FILE.mkdirs(targetBasePath, 0775);
SYSTEM.exec("rsync -r --copy-links --exclude \"- .DS_Store\" --exclude \"- .git/\" --exclude \"- .tmp_*\" " + pkgPath + "/lib/FirePHPCore/* " + targetBasePath, function()
{
replaceVariablesInFile(targetBasePath + "/FirePHP.class.php");
replaceVariablesInFile(targetBasePath + "/FirePHP.class.php4");
next1();
});
function next1()
{
var content = FILE.read(tplPath + "/pear.package.tpl.xml");
var date = new Date();
content = content.replace(/%%DATE%%/g, date.getFullYear() + "-" + UTIL.padBegin(date.getMonth()+1, 2, "0") + "-" + date.getDate());
content = content.replace(/%%VERSION%%/g, version);
content = content.replace(/%%STABILITY%%/g, "stable");
FILE.write(targetBasePath + "/package.xml", content);
next2();
}
function next2()
{
SYSTEM.exec("pear channel-discover pear.firephp.org", function(stdout)
{
console.log(stdout);
SYSTEM.exec("cd " + targetBasePath + "; pear package package.xml", function(stdout)
{
console.log(stdout);
callback();
});
});
}
}
function replaceVariablesInFile(path)
{
var content = FILE.read(path);
// @pinf replace '0.3' with '%%VERSION%%'
var re1 = /\n(.*)\/\/\s*@pinf\s(.*)\n/g;
var match1;
while (match1 = re1.exec(content)) {
var rule = match1[2].match(/^replace (.*?) with (.*)$/);
if(rule) {
// replace variables in rule
var re2 = /%%([^%]*)%%/g;
var match2;
while (match2 = re2.exec(rule[2])) {
var value;
if(match2[1]=="VERSION") {
value = version;
}
rule[2] = rule[2].replace(match2[0], value);
}
match1[1] = match1[1].replace(rule[1], rule[2]);
content = content.replace(match1[0], "\n"+match1[1]+"\n");
}
}
FILE.write(path, content);
}

View file

@ -1,65 +0,0 @@
var PINF_LOADER = require("pinf/loader"),
SANDBOX = PINF_LOADER.getSandbox(),
FILE = require("modules/file"),
Q = require("modules/q"),
SYSTEM = require("modules/system"),
BUILD = require("./build"),
JSON = require("modules/json"),
SOURCEMINT_CLIENT = false;
exports.main = function()
{
module.load({
id: "private-registry.appspot.com/cadorn.com/github/com.cadorn.baby/projects/sourcemint/packages/client-js/",
descriptor: {
main: "lib/client.js"
}
}, function(id)
{
SOURCEMINT_CLIENT = require(id);
publish();
});
}
function publish()
{
var buildPath = BUILD.getBuildPath(),
info = JSON.decode(FILE.read(buildPath + "/info.json")),
descriptor = JSON.decode(FILE.read(FILE.dirname(FILE.dirname(FILE.dirname(module.id))) + "/package.json"));
var bundles = {};
bundles["firephp-core.zip"] = {
"type": "zip",
"options": {
"archivePath": buildPath + "/FirePHPCore-" + info.version + ".zip",
}
};
var packages = [
{
"uid": descriptor.uid,
"stream": "stable",
"version": info.version,
"bundles": bundles
}
];
try
{
Q.when(SOURCEMINT_CLIENT.publish(packages), function(info)
{
module.print("\0green(Published:\n");
console.log(info);
module.print("\0)");
}, function(e)
{
throw e;
});
}
catch(e)
{
console.error("Error: " + e);
}
}

View file

@ -1,21 +0,0 @@
[MIT License](http://www.opensource.org/licenses/mit-license.php)
Copyright (c) 2007+ [Christoph Dorn](http://www.christophdorn.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.7.1"
version="2.0"
xmlns="http://pear.php.net/dtd/package-2.0"
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>FirePHPCore</name>
<channel>pear.firephp.org</channel>
<summary>Log variables from PHP to the browser (Firebug Console)</summary>
<description>Handles all communication between the PHP code on the server and the client. Also implements all core FirePHP features.</description>
<lead>
<name>Christoph Dorn</name>
<user>cadorn</user>
<email>christoph@christophdorn.com</email>
<active>yes</active>
</lead>
<date>%%DATE%%</date>
<version>
<release>%%VERSION%%</release>
<api>0.3</api>
</version>
<stability>
<release>%%STABILITY%%</release>
<api>stable</api>
</stability>
<license>MIT</license>
<notes>No Notes</notes>
<contents>
<dir name="/" baseinstalldir="FirePHPCore">
<file name="fb.php" role="php"/>
<file name="fb.php4" role="php"/>
<file name="FirePHP.class.php" role="php"/>
<file name="FirePHP.class.php4" role="php"/>
</dir>
</contents>
<dependencies>
<required>
<php>
<min>4.0</min>
</php>
<pearinstaller>
<min>1.4.5</min>
</pearinstaller>
</required>
</dependencies>
<phprelease />
</package>

View file

@ -1,17 +0,0 @@
FirePHPCore Server Library
==========================
Status: stable
Version: [%%VERSION%%](https://github.com/firephp/firephp-core/tree/v%%VERSION%%)
This archive contains the *FirePHPCore* PHP server library.
Links
-----
* Documentation: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/
* Install: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/Configuration/Traditional
* Support: http://docs.sourcemint.org/firephp.org/firephp/1/-docs/OpenSource#support
* Author: [Christoph Dorn](http://www.christophdorn.com/)
* License: [MIT License](http://www.opensource.org/licenses/mit-license.php)

View file

@ -12,8 +12,8 @@
error_reporting(E_ALL);
if (version_compare(PHP_VERSION, '5.3') < 0) {
die('Requires PHP 5.3 or above');
if (version_compare(PHP_VERSION, '5.4') < 0) {
die('Requires PHP 5.4 or above');
}
include __DIR__ . '/../scss.inc.php';
@ -30,6 +30,8 @@ $inputFile = null;
$changeDir = false;
$debugInfo = false;
$lineNumbers = false;
$ignoreErrors = false;
$encoding = false;
/**
* Parse argument
@ -67,14 +69,16 @@ Usage: $exe [options] [input-file]
Options include:
--debug-info Annotate selectors with CSS referring to the source file and line number
-h, --help Show this message
-f=format Set the output format (compact, compressed, crunched, expanded, or nested)
-i=path Set import path
--line-numbers Annotate selectors with comments referring to the source file and line number
-p=precision Set decimal number precision (default 5)
-T Dump formatted parse tree
-v, --version Print the version
-h, --help Show this message
--continue-on-error Continue compilation (as best as possible) when error encountered
--debug-info Annotate selectors with CSS referring to the source file and line number
-f=format Set the output format (compact, compressed, crunched, expanded, or nested)
-i=path Set import path
--iso8859-1 Use iso8859-1 encoding instead of utf-8 (default utf-8)
--line-numbers Annotate selectors with comments referring to the source file and line number
-p=precision Set decimal number precision (default 5)
-T Dump formatted parse tree
-v, --version Print the version
EOT;
exit($HELP);
@ -84,11 +88,21 @@ EOT;
exit(Version::VERSION . "\n");
}
if ($argv[$i] === '--continue-on-error') {
$ignoreErrors = true;
continue;
}
if ($argv[$i] === '--debug-info') {
$debugInfo = true;
continue;
}
if ($argv[$i] === '--iso8859-1') {
$encoding = 'iso8859-1';
continue;
}
if ($argv[$i] === '--line-numbers' || $argv[$i] === '--line-comments') {
$lineNumbers = true;
continue;
@ -163,6 +177,10 @@ if ($lineNumbers && $inputFile) {
$scss->setLineNumberStyle(Compiler::LINE_COMMENTS);
}
if ($ignoreErrors) {
$scss->setIgnoreErrors($ignoreErrors);
}
if ($loadPaths) {
$scss->setImportPaths(explode(PATH_SEPARATOR, $loadPaths));
}
@ -175,6 +193,10 @@ if ($style) {
$scss->setFormatter('Leafo\\ScssPhp\\Formatter\\' . ucfirst($style));
}
if ($encoding) {
$scss->setEncoding($encoding);
}
echo $scss->compile($data, $inputFile);
if ($changeDir) {

View file

@ -1,63 +0,0 @@
<?php
/**
* SCSSPHP
*
* Stub classes for backward compatibility
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
// @codingStandardsIgnoreStart
/**
* @deprecated since 0.1.0
*/
class scssc extends \Leafo\ScssPhp\Compiler
{
}
/**
* @deprecated since 0.1.0
*/
class scss_parser extends \Leafo\ScssPhp\Parser
{
}
/**
* @deprecated since 0.1.0
*/
class scss_formatter extends \Leafo\ScssPhp\Formatter\Expanded
{
}
/**
* @deprecated since 0.1.0
*/
class scss_formatter_nested extends \Leafo\ScssPhp\Formatter\Nested
{
}
/**
* @deprecated since 0.1.0
*/
class scss_formatter_compressed extends \Leafo\ScssPhp\Formatter\Compressed
{
}
/**
* @deprecated since 0.1.0
*/
class scss_formatter_crunched extends \Leafo\ScssPhp\Formatter\Crunched
{
}
/**
* @deprecated since 0.1.0
*/
class scss_server extends \Leafo\ScssPhp\Server
{
}
// @codingStandardsIgnoreEnd

View file

@ -15,17 +15,16 @@
}
],
"autoload": {
"classmap": ["classmap.php"],
"psr-4": { "Leafo\\ScssPhp\\": "src/" }
},
"autoload-dev": {
"psr-4": { "Leafo\\ScssPhp\\Test\\": "tests/" }
},
"require": {
"php": ">=5.3.0"
"php": ">=5.4.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "~2.3",
"squizlabs/php_codesniffer": "~2.5",
"phpunit/phpunit": "~3.7",
"kherge/box": "~2.5"
},

View file

@ -1,6 +1,6 @@
<?php
if (version_compare(PHP_VERSION, '5.3') < 0) {
die('Requires PHP 5.3 or above');
if (version_compare(PHP_VERSION, '5.4') < 0) {
throw new \Exception('scssphp requires PHP 5.4 or above');
}
if (! class_exists('scssc', false)) {
@ -9,6 +9,9 @@ if (! class_exists('scssc', false)) {
include_once __DIR__ . '/src/Colors.php';
include_once __DIR__ . '/src/Compiler.php';
include_once __DIR__ . '/src/Compiler/Environment.php';
include_once __DIR__ . '/src/Exception/CompilerException.php';
include_once __DIR__ . '/src/Exception/ParserException.php';
include_once __DIR__ . '/src/Exception/ServerException.php';
include_once __DIR__ . '/src/Formatter.php';
include_once __DIR__ . '/src/Formatter/Compact.php';
include_once __DIR__ . '/src/Formatter/Compressed.php';
@ -24,5 +27,4 @@ if (! class_exists('scssc', false)) {
include_once __DIR__ . '/src/Util.php';
include_once __DIR__ . '/src/Version.php';
include_once __DIR__ . '/src/Server.php';
include_once __DIR__ . '/classmap.php';
}

View file

@ -12,7 +12,7 @@
namespace Leafo\ScssPhp\Base;
/**
* Range class
* Range
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/

View file

@ -12,7 +12,7 @@
namespace Leafo\ScssPhp;
/**
* SCSS block
* Block
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
@ -31,12 +31,17 @@ class Block
/**
* @var integer
*/
public $sourcePosition;
public $sourceIndex;
/**
* @var integer
*/
public $sourceIndex;
public $sourceLine;
/**
* @var integer
*/
public $sourceColumn;
/**
* @var array

View file

@ -25,7 +25,7 @@ class Colors
*
* @var array
*/
public static $cssColors = array(
public static $cssColors = [
'aliceblue' => '240,248,255',
'antiquewhite' => '250,235,215',
'aqua' => '0,255,255',
@ -145,6 +145,7 @@ class Colors
'plum' => '221,160,221',
'powderblue' => '176,224,230',
'purple' => '128,0,128',
'rebeccapurple' => '102,51,153',
'red' => '255,0,0',
'rosybrown' => '188,143,143',
'royalblue' => '65,105,225',
@ -173,6 +174,6 @@ class Colors
'white' => '255,255,255',
'whitesmoke' => '245,245,245',
'yellow' => '255,255,0',
'yellowgreen' => '154,205,50'
);
'yellowgreen' => '154,205,50',
];
}

File diff suppressed because it is too large Load diff

View file

@ -11,10 +11,8 @@
namespace Leafo\ScssPhp\Compiler;
use Leafo\ScssPhp\Block;
/**
* SCSS compiler environment
* Compiler environment
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/

View file

@ -0,0 +1,21 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Exception;
/**
* Compiler exception
*
* @author Oleksandr Savchenko <traveltino@gmail.com>
*/
class CompilerException extends \Exception
{
}

View file

@ -0,0 +1,21 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Exception;
/**
* Parser Exception
*
* @author Oleksandr Savchenko <traveltino@gmail.com>
*/
class ParserException extends \Exception
{
}

View file

@ -0,0 +1,21 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Exception;
/**
* Server Exception
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class ServerException extends \Exception
{
}

View file

@ -14,7 +14,7 @@ namespace Leafo\ScssPhp;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* SCSS base formatter
* Base formatter
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
@ -55,6 +55,11 @@ abstract class Formatter
*/
public $assignSeparator;
/**
* @var boolea
*/
public $keepSemicolons;
/**
* Initialize formatter
*
@ -96,6 +101,15 @@ abstract class Formatter
*/
public function stripSemicolon(&$lines)
{
if ($this->keepSemicolons) {
return;
}
if (($count = count($lines))
&& substr($lines[$count - 1], -1) === ';'
) {
$lines[$count - 1] = substr($lines[$count - 1], 0, -1);
}
}
/**

View file

@ -14,7 +14,7 @@ namespace Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
/**
* SCSS compact formatter
* Compact formatter
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
@ -32,6 +32,7 @@ class Compact extends Formatter
$this->close = "}\n\n";
$this->tagSeparator = ',';
$this->assignSeparator = ':';
$this->keepSemicolons = true;
}
/**

View file

@ -15,7 +15,7 @@ use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* SCSS compressed formatter
* Compressed formatter
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
@ -33,18 +33,7 @@ class Compressed extends Formatter
$this->close = '}';
$this->tagSeparator = ',';
$this->assignSeparator = ':';
}
/**
* {@inheritdoc}
*/
public function stripSemicolon(&$lines)
{
if (($count = count($lines))
&& substr($lines[$count - 1], -1) === ';'
) {
$lines[$count - 1] = substr($lines[$count - 1], 0, -1);
}
$this->keepSemicolons = false;
}
/**
@ -70,15 +59,4 @@ class Compressed extends Formatter
echo $this->break;
}
}
/**
* {@inherit}
*/
public function format(OutputBlock $block)
{
return parent::format($block);
// TODO: we need to fix the 2 "compressed" tests where the "close" is applied
return trim(str_replace(';}', '}', parent::format($block)));
}
}

View file

@ -15,7 +15,7 @@ use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* SCSS crunched formatter
* Crunched formatter
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
@ -33,18 +33,7 @@ class Crunched extends Formatter
$this->close = '}';
$this->tagSeparator = ',';
$this->assignSeparator = ':';
}
/**
* {@inheritdoc}
*/
public function stripSemicolon(&$lines)
{
if (($count = count($lines))
&& substr($lines[$count - 1], -1) === ';'
) {
$lines[$count - 1] = substr($lines[$count - 1], 0, -1);
}
$this->keepSemicolons = false;
}
/**

View file

@ -15,7 +15,7 @@ use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* SCSS debug formatter
* Debug formatter
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
@ -33,6 +33,7 @@ class Debug extends Formatter
$this->close = ' }';
$this->tagSeparator = ', ';
$this->assignSeparator = ': ';
$this->keepSemicolons = true;
}
/**

View file

@ -15,7 +15,7 @@ use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* SCSS expanded formatter
* Expanded formatter
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
@ -33,6 +33,7 @@ class Expanded extends Formatter
$this->close = '}';
$this->tagSeparator = ', ';
$this->assignSeparator = ': ';
$this->keepSemicolons = true;
}
/**

View file

@ -15,7 +15,7 @@ use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* SCSS nested formatter
* Nested formatter
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
@ -38,6 +38,7 @@ class Nested extends Formatter
$this->close = ' }';
$this->tagSeparator = ', ';
$this->assignSeparator = ': ';
$this->keepSemicolons = true;
}
/**
@ -154,7 +155,7 @@ class Nested extends Formatter
private function adjustAllChildren(OutputBlock $block)
{
// flatten empty nested blocks
$children = array();
$children = [];
foreach ($block->children as $i => $child) {
if (empty($child->lines) && empty($child->children)) {

View file

@ -12,7 +12,7 @@
namespace Leafo\ScssPhp\Formatter;
/**
* SCSS output block
* Output block
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/

View file

@ -12,7 +12,7 @@
namespace Leafo\ScssPhp;
/**
* SCSS node
* Base node
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
@ -26,10 +26,15 @@ abstract class Node
/**
* @var integer
*/
public $sourcePosition;
public $sourceIndex;
/**
* @var integer
*/
public $sourceIndex;
public $sourceLine;
/**
* @var integer
*/
public $sourceColumn;
}

View file

@ -11,11 +11,12 @@
namespace Leafo\ScssPhp\Node;
use Leafo\ScssPhp\Compiler;
use Leafo\ScssPhp\Node;
use Leafo\ScssPhp\Type;
/**
* SCSS dimension + optional units
* Dimension + optional units
*
* {@internal
* This is a work-in-progress.
@ -37,8 +38,8 @@ class Number extends Node implements \ArrayAccess
*
* @var array
*/
static protected $unitTable = array(
'in' => array(
static protected $unitTable = [
'in' => [
'in' => 1,
'pc' => 6,
'pt' => 72,
@ -46,27 +47,27 @@ class Number extends Node implements \ArrayAccess
'cm' => 2.54,
'mm' => 25.4,
'q' => 101.6,
),
'turn' => array(
'deg' => 180,
'grad' => 200,
'rad' => M_PI,
'turn' => 0.5,
),
's' => array(
's' => 1,
],
'turn' => [
'deg' => 360,
'grad' => 400,
'rad' => 6.28318530717958647692528676, // 2 * M_PI
'turn' => 1,
],
's' => [
's' => 1,
'ms' => 1000,
),
'Hz' => array(
'Hz' => 1,
],
'Hz' => [
'Hz' => 1,
'kHz' => 0.001,
),
'dpi' => array(
'dpi' => 1,
],
'dpi' => [
'dpi' => 1,
'dpcm' => 2.54,
'dppx' => 96,
),
);
],
];
/**
* @var integer|float
@ -74,21 +75,24 @@ class Number extends Node implements \ArrayAccess
public $dimension;
/**
* @var string
* @var array
*/
public $units;
/**
* Initialize number
*
* @param mixed $dimension
* @param string $initialUnit
* @param mixed $dimension
* @param mixed $initialUnit
*/
public function __construct($dimension, $initialUnit)
{
$this->type = Type::T_NUMBER;
$this->dimension = $dimension;
$this->units = $initialUnit;
$this->units = is_array($initialUnit)
? $initialUnit
: ($initialUnit ? [$initialUnit => 1]
: []);
}
/**
@ -100,13 +104,20 @@ class Number extends Node implements \ArrayAccess
*/
public function coerce($units)
{
$value = $this->dimension;
if (isset(self::$unitTable[$this->units][$units])) {
$value *= self::$unitTable[$this->units][$units];
if ($this->unitless()) {
return new Number($this->dimension, $units);
}
return new Number($value, $units);
$dimension = $this->dimension;
foreach (self::$unitTable['in'] as $unit => $conv) {
$from = isset($this->units[$unit]) ? $this->units[$unit] : 0;
$to = isset($units[$unit]) ? $units[$unit] : 0;
$factor = pow($conv, $from - $to);
$dimension /= $factor;
}
return new Number($dimension, $units);
}
/**
@ -116,13 +127,12 @@ class Number extends Node implements \ArrayAccess
*/
public function normalize()
{
if (isset(self::$unitTable['in'][$this->units])) {
$conv = self::$unitTable['in'][$this->units];
$dimension = $this->dimension;
$units = [];
return new Number($this->dimension / $conv, 'in');
}
$this->normalizeUnits($dimension, $units, 'in');
return new Number($this->dimension, $this->units);
return new Number($dimension, $units);
}
/**
@ -130,8 +140,12 @@ class Number extends Node implements \ArrayAccess
*/
public function offsetExists($offset)
{
if ($offset === -3) {
return $this->sourceColumn !== null;
}
if ($offset === -2) {
return $sourceIndex !== null;
return $this->sourceLine !== null;
}
if ($offset === -1
@ -151,11 +165,14 @@ class Number extends Node implements \ArrayAccess
public function offsetGet($offset)
{
switch ($offset) {
case -3:
return $this->sourceColumn;
case -2:
return $this->sourceIndex;
return $this->sourceLine;
case -1:
return $this->sourcePosition;
return $this->sourceIndex;
case 0:
return $this->type;
@ -178,9 +195,11 @@ class Number extends Node implements \ArrayAccess
} elseif ($offset === 2) {
$this->units = $value;
} elseif ($offset == -1) {
$this->sourcePosition = $value;
} elseif ($offset == -2) {
$this->sourceIndex = $value;
} elseif ($offset == -2) {
$this->sourceLine = $value;
} elseif ($offset == -3) {
$this->sourceColumn = $value;
}
}
@ -194,9 +213,11 @@ class Number extends Node implements \ArrayAccess
} elseif ($offset === 2) {
$this->units = null;
} elseif ($offset === -1) {
$this->sourcePosition = null;
} elseif ($offset === -2) {
$this->sourceIndex = null;
} elseif ($offset === -2) {
$this->sourceLine = null;
} elseif ($offset === -3) {
$this->sourceColumn = null;
}
}
@ -207,7 +228,7 @@ class Number extends Node implements \ArrayAccess
*/
public function unitless()
{
return empty($this->units);
return ! array_sum($this->units);
}
/**
@ -217,7 +238,61 @@ class Number extends Node implements \ArrayAccess
*/
public function unitStr()
{
return $this->units;
$numerators = [];
$denominators = [];
foreach ($this->units as $unit => $unitSize) {
if ($unitSize > 0) {
$numerators = array_pad($numerators, count($numerators) + $unitSize, $unit);
continue;
}
if ($unitSize < 0) {
$denominators = array_pad($denominators, count($denominators) + $unitSize, $unit);
continue;
}
}
return implode('*', $numerators) . (count($denominators) ? '/' . implode('*', $denominators) : '');
}
/**
* Output number
*
* @param \Leafo\ScssPhp\Compiler $compiler
*
* @return string
*/
public function output(Compiler $compiler = null)
{
$dimension = round($this->dimension, self::$precision);
$units = array_filter($this->units, function ($unitSize) {
return $unitSize;
});
if (count($units) > 1 && array_sum($units) === 0) {
$dimension = $this->dimension;
$units = [];
$this->normalizeUnits($dimension, $units, 'in');
$dimension = round($dimension, self::$precision);
$units = array_filter($units, function ($unitSize) {
return $unitSize;
});
}
$unitSize = array_sum($units);
if ($compiler && ($unitSize > 1 || $unitSize < 0 || count($units) > 1)) {
$compiler->throwError((string) $dimension . $this->unitStr() . " isn't a valid CSS value.");
}
reset($units);
list($unit, ) = each($units);
return (string) $dimension . $unit;
}
/**
@ -225,12 +300,30 @@ class Number extends Node implements \ArrayAccess
*/
public function __toString()
{
$value = round($this->dimension, self::$precision);
return $this->output();
}
if (empty($this->units)) {
return (string) $value;
/**
* Normalize units
*
* @param integer|float $dimension
* @param array $units
* @param string $baseUnit
*/
private function normalizeUnits(&$dimension, &$units, $baseUnit = 'in')
{
$dimension = $this->dimension;
$units = [];
foreach ($this->units as $unit => $exp) {
if (isset(self::$unitTable[$baseUnit][$unit])) {
$factor = pow(self::$unitTable[$baseUnit][$unit], $exp);
$unit = $baseUnit;
$dimension /= $factor;
}
$units[$unit] = $exp + (isset($units[$unit]) ? $units[$unit] : 0);
}
return (string) $value . $this->units;
}
}

File diff suppressed because it is too large Load diff

View file

@ -12,10 +12,11 @@
namespace Leafo\ScssPhp;
use Leafo\ScssPhp\Compiler;
use Leafo\ScssPhp\Exception\ServerException;
use Leafo\ScssPhp\Version;
/**
* SCSS server
* Server
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
@ -115,13 +116,12 @@ class Server
/**
* Determine whether .scss file needs to be re-compiled.
*
* @param string $in Input path
* @param string $out Output path
* @param string $etag ETag
*
* @return boolean True if compile required.
*/
protected function needsCompile($in, $out, &$etag)
protected function needsCompile($out, &$etag)
{
if (! is_file($out)) {
return true;
@ -207,21 +207,21 @@ class Server
$elapsed = round((microtime(true) - $start), 4);
$v = Version::VERSION;
$t = @date('r');
$t = date('r');
$css = "/* compiled by scssphp $v on $t (${elapsed}s) */\n\n" . $css;
$etag = md5($css);
file_put_contents($out, $css);
file_put_contents(
$this->metadataName($out),
serialize(array(
serialize([
'etag' => $etag,
'imports' => $this->scss->getParsedFiles(),
'vars' => crc32(serialize($this->scss->getVariables())),
))
])
);
return array($css, $etag);
return [$css, $etag];
}
/**
@ -231,11 +231,11 @@ class Server
*
* @return string
*/
protected function createErrorCSS($error)
protected function createErrorCSS(\Exception $error)
{
$message = str_replace(
array("'", "\n"),
array("\\'", "\\A"),
["'", "\n"],
["\\'", "\\A"],
$error->getfile() . ":\n\n" . $error->getMessage()
);
@ -269,11 +269,13 @@ class Server
* @param string $out Output file (.css) optional
*
* @return string|bool
*
* @throws \Leafo\ScssPhp\Exception\ServerException
*/
public function compileFile($in, $out = null)
{
if (! is_readable($in)) {
throw new \Exception('load error: failed to find ' . $in);
throw new ServerException('load error: failed to find ' . $in);
}
$pi = pathinfo($in);
@ -323,7 +325,7 @@ class Server
$output = $this->cacheName($salt . $input);
$etag = $noneMatch = trim($this->getIfNoneMatchHeader(), '"');
if ($this->needsCompile($input, $output, $etag)) {
if ($this->needsCompile($output, $etag)) {
try {
list($css, $etag) = $this->compile($input, $output);
@ -334,7 +336,6 @@ class Server
header('ETag: "' . $etag . '"');
echo $css;
} catch (\Exception $e) {
if ($this->showErrorsAsCSS) {
header('Content-type: text/css');
@ -346,7 +347,6 @@ class Server
echo 'Parse error: ' . $e->getMessage() . "\n";
}
}
return;
@ -365,7 +365,7 @@ class Server
$modifiedSince = $this->getIfModifiedSinceHeader();
$mtime = filemtime($output);
if (@strtotime($modifiedSince) === $mtime) {
if (strtotime($modifiedSince) === $mtime) {
header($protocol . ' 304 Not Modified');
return;
@ -395,19 +395,19 @@ class Server
*
* @return string Compiled CSS results
*
* @throws \Exception
* @throws \Leafo\ScssPhp\Exception\ServerException
*/
public function checkedCachedCompile($in, $out, $force = false)
{
if (! is_file($in) || ! is_readable($in)) {
throw new \Exception('Invalid or unreadable input file specified.');
throw new ServerException('Invalid or unreadable input file specified.');
}
if (is_dir($out) || ! is_writable(file_exists($out) ? $out : dirname($out))) {
throw new \Exception('Invalid or unwritable output file specified.');
throw new ServerException('Invalid or unwritable output file specified.');
}
if ($force || $this->needsCompile($in, $out, $etag)) {
if ($force || $this->needsCompile($out, $etag)) {
list($css, $etag) = $this->compile($in, $out);
} else {
$css = file_get_contents($out);
@ -444,6 +444,10 @@ class Server
$this->scss = $scss;
$this->showErrorsAsCSS = false;
if (! ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
}
/**

View file

@ -12,7 +12,7 @@
namespace Leafo\ScssPhp;
/**
* SCSS block/node types
* Block/node types
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
@ -59,6 +59,7 @@ class Type
const T_NUMBER = 'number';
const T_RETURN = 'return';
const T_ROOT = 'root';
const T_SCSSPHP_IMPORT_ONCE = 'scssphp-import-once';
const T_SELF = 'self';
const T_STRING = 'string';
const T_UNARY = 'unary';

View file

@ -14,7 +14,7 @@ namespace Leafo\ScssPhp;
use Leafo\ScssPhp\Base\Range;
/**
* SCSS utilties
* Utilties
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/

View file

@ -18,5 +18,5 @@ namespace Leafo\ScssPhp;
*/
class Version
{
const VERSION = 'v0.4.0';
const VERSION = 'v0.6.3';
}