本文整理汇总了PHP中eol函数的典型用法代码示例。如果您正苦于以下问题:PHP eol函数的具体用法?PHP eol怎么用?PHP eol使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eol函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadClass
public function loadClass($class_name)
{
$debug = $this->getSandbox()->isDebug();
$class_name = us($class_name);
$class_paths = self::$class_paths;
// フレームワークのクラスではない場合はFALSEを返却
if (!isset($class_paths[$class_name])) {
// log_info( "system,debug,class_loader", "class_loader", "[FrameworkClassLoader] Can not load class: [$class_name]" );
if ($debug) {
echo "Class NOT found in framework class loader: {$class_name}" . eol();
}
return FALSE;
}
// クラス名からクラスパスを取得
$file_name = $class_name . '.class.php';
$pos = strpos($file_name, 'Charcoal_');
if ($pos !== FALSE) {
$file_name = substr($file_name, $pos + 9);
}
$class_path = CHARCOAL_HOME . '/src/' . $class_paths[$class_name] . '/' . $file_name;
// log_info( "system,debug,class_loader", "class_loader", "[FrameworkClassLoader] class_path=[$class_path] class_name=[$class_name]" );
// ソース読み込み
Charcoal_Framework::loadSourceFile($class_path);
if ($debug) {
echo "Class found in framework class loader: {$class_name}" . eol();
}
return TRUE;
}
示例2: loadConfig
/**
* load config
*
* @param string|Charcoal_String $key config key
*
* @return mixed configure data
*/
public function loadConfig($key)
{
// Charcoal_ParamTrait::validateString( 1, $key );
$source = $key . '.ini';
$is_debug = b($this->debug)->isTrue();
$result = NULL;
if (!is_file($source)) {
if ($is_debug) {
print "ini file[{$source}] does not exist." . eol();
log_warning("system, debug, config", "config", "ini file[{$source}] does not exist.");
}
} else {
// read ini file
$result = @parse_ini_file($source, TRUE);
if ($is_debug) {
print "[{$source}] parse_ini_file({$source})=" . eol();
ad($result);
if ($result === FALSE) {
print "parse_ini_file failed: [{$source}]" . eol();
log_warning("system, debug, config", "config", "parse_ini_file failed: [{$source}]");
} else {
log_debug("system, debug, config", "config", "read ini file[{$source}]:" . print_r($result, true));
}
}
}
return $result;
}
示例3: _element
protected function _element($data = '', $tab = '', $start = 0)
{
static $start;
$eof = eol();
$output = '';
$attrs = '';
$tab = str_repeat("\t", $start);
if (!is_array($data)) {
return $data . $eof;
} else {
foreach ($data as $k => $v) {
if (is_numeric($k)) {
$k = 'li';
}
$end = "/" . Arrays::getFirst(explode(' ', $k));
if (!is_array($v)) {
$output .= "{$tab}<{$k}>{$v}<{$end}>{$eof}";
} else {
$output .= $tab . "<{$k}>{$eof}" . $this->_element($v, $tab, $start++) . $tab . "<{$end}>" . $tab . $eof;
$start--;
}
}
}
return $output;
}
示例4: test
/**
* execute tests
*/
public function test($action, $context)
{
$request = $context->getRequest();
$action = us($action);
// Qdmail
$qdmail = $context->getComponent('qdmail@:qdmail');
$config = new Charcoal_Config($this->getSandbox()->getEnvironment());
$config->set('qdsmtp.host', 'localhost');
$config->set('qdsmtp.port', '25');
$config->set('qdsmtp.from', 'stk2k@sazysoft.com');
$config->set('qdsmtp.protocol', 'SMTP');
$config->set('qdsmtp.user', '');
$config->set('qdsmtp.pass', '');
$qdmail->configure($config);
switch ($action) {
// Send mail
case "send_mail":
$to = $request->get("to");
$from = "stk2k@sazysoft.com";
$subject = "test";
$body = "test!!!";
echo "to:" . $to . eol();
$qdmail->sendMail($from, $to, $subject, $body);
break;
}
}
示例5: data
public function data($string = '', $data = array())
{
// Parametre konrolleri sağlanıyor.
if (!is_string($string)) {
return Error::set('Error', 'stringParameter', 'string');
}
$eol = eol();
// Veri dizisi boş değilse işlemleri gerçekleştir.
if (!empty($data)) {
$space = '\\s*';
$all = '.*';
foreach ($data as $key => $val) {
// Eleman dizi değilse değiştirme işlemi gerçekleştir.
if (!is_array($val)) {
$key = $this->ldel . $space . $key . $space . $this->rdel;
$string = preg_replace('/' . $key . '/', $val, $string);
} else {
$allString = '';
$newResult = '';
if (!empty($val)) {
$kstart = $this->ldel . $space . $key . $space . $this->rdel;
$kend = $this->ldel . $space . '\\/' . $space . $key . $space . $this->rdel;
preg_match('/' . $kstart . $all . $kend . '/s', $string, $result);
if (!empty($result)) {
// Bloğu değiştirme ve çoğalatma
// işlemi gerçekleştir.
foreach ($result as $res) {
// Değiştirme işlemlerini gerçekleştir.
foreach ($data[$key] as $item) {
$newResult = preg_replace('/' . $kstart . '/', '', $res);
$newResult = preg_replace('/' . $kend . '/', '', $newResult);
$allString .= $this->data($newResult, $item) . $eol;
}
$string = str_replace($res, $allString, $string);
}
}
}
}
}
}
$regexChar = '(([^@]|(\'|\\").*?(\'|\\"))*)';
$htmlRegexChar = '.*?';
$pattern = array('/\\s*\\#end(\\w+)/i' => '</$1>', '/\\#\\#(\\!*\\w+)\\s*\\((' . $htmlRegexChar . ')\\)/i' => '<$1 $2>', '/\\s*\\#\\#(\\w+)/i' => '</$1>', '/\\#(\\!*\\w+)\\s*\\((' . $htmlRegexChar . ')(\\s*\\,\\s*(' . $htmlRegexChar . '))*\\)/i' => '<$1 $4>$2</$1>', '/\\#(\\!*\\w+)\\s*(\\[(' . $htmlRegexChar . ')\\])*\\s*/i' => '<$1 $3>', '/\\<(\\!*\\w+)\\s+\\>/i' => '<$1>', '/\\$\\(\'\\s*\\<(.*?)\\>\\s*\'\\)/i' => '$(\'#$1\')', '/\\$\\(\\"\\s*\\<(.*?)\\>\\s*\\"\\)/i' => '$("#$1")', '/@(if)\\s*(\\(' . $htmlRegexChar . '\\))' . $eol . '\\s*/' => '<?php $1$2: ?>', '/\\s*@(elseif)\\s*(\\(' . $htmlRegexChar . '\\))' . $eol . '\\s*/' => '<?php $1$2: ?>', '/\\s*@(endif)/' => '<?php $1 ?>', '/@(foreach)\\s*(\\(' . $htmlRegexChar . '\\))' . $eol . '\\s*/' => '<?php $1$2: ?>', '/\\s*@(endforeach)/' => '<?php $1 ?>', '/@(for)\\s*(\\(' . $htmlRegexChar . '\\))' . $eol . '\\s*/' => '<?php $1$2: ?>', '/\\s*@(endfor)/' => '<?php $1 ?>', '/@(while)\\s*(\\(' . $htmlRegexChar . '\\))' . $eol . '\\s*/' => '<?php $1$2: ?>', '/\\s*@(endswhile)/' => '<?php $1 ?>', '/@(break)/' => '<?php $1 ?>', '/@(continue)/' => '<?php $1 ?>', '/@(default)/' => '<?php $1: ?>', '/@@((\\w+|\\$|::|\\s*\\-\\>\\s*)*\\s*\\(' . $regexChar . '\\))/' => '<?php echo $1 ?>', '/@((\\w+|\\$|::|\\s*\\-\\>\\s*)*\\s*\\(' . $regexChar . '\\))/' => '<?php $1 ?>', '/@(\\$\\w+(\\$|::|\\s*\\-\\>\\s*|\\(' . $regexChar . '\\))*)/' => '<?php echo $1 ?>', '/\\{\\-\\-\\s*(' . $htmlRegexChar . ')\\s*\\-\\-\\}/' => '<!--$1-->', '/\\{\\{\\{\\s*(' . $htmlRegexChar . ')\\s*\\}\\}\\}/' => '<?php echo htmlentities($1) ?>', '/\\{\\{(\\s*' . $htmlRegexChar . ')\\s*\\}\\}/' => '<?php echo $1 ?>', '/\\{\\[\\s*(' . $htmlRegexChar . ')\\s*\\]\\}/' => '<?php $1 ?>');
$string = preg_replace(array_keys($pattern), array_values($pattern), $string);
if (is_array($data)) {
extract($data, EXTR_OVERWRITE);
}
ob_start();
@eval("?>{$string}");
$content = ob_get_contents();
ob_end_clean();
if ($lastError = Error::last()) {
Exceptions::table('', $lastError['message'], '', $lastError['line']);
} else {
return $content;
}
}
示例6: _transform
protected function _transform($data)
{
$str = '';
$str .= $this->selector . "{" . eol();
foreach ($this->browsers as $val) {
$str .= $val . "transform:{$data};" . eol();
}
$str .= "}" . eol();
return $str;
}
示例7: describeParentClass
/**
* Describe object/array structure. If an object is specified, this method will return or output it's own
* method names or properties.
*
* @param ReflectionClass $ref_class target class
* @param integer $indent indent count
*/
public static function describeParentClass(ReflectionClass $ref_class, $indent)
{
$result = '';
$result .= space($indent * 4) . $ref_class->getName() . eol();
$ref_parent = $ref_class->getParentClass();
if ($ref_parent) {
$result .= self::describeParentClass($ref_parent, $indent++);
}
return $result;
}
示例8: attr
public function attr($attr = array())
{
if (!is_array($attr)) {
return Error::set('Error', 'arrayParameter', 'attr');
}
$str = $this->selector . "{" . eol();
$str .= $this->_attr($attr) . eol();
$str .= "}" . eol();
$this->_defaultVariable();
return $str;
}
示例9: load
public function load($debug_mode, $profile_name)
{
$config_file = "{$profile_name}.profile.ini";
try {
// get profile directory path
$profile_dir = Charcoal_ResourceLocator::getApplicationFile('config/profile');
// make config file object
$config_file = new Charcoal_File($config_file, $profile_dir);
// check if profile directory exists
if (!$profile_dir->exists()) {
if ($debug_mode) {
echo "profile directory not exists: [{$profile_dir}]" . eol();
}
log_error("debug,config,profile", "profile directory not exists: [{$profile_dir}]");
_throw(new Charcoal_ProfileDirectoryNotFoundException($profile_dir));
}
// throw exception when config file is not found
if (!$config_file->isFile() || !$config_file->canRead()) {
if ($debug_mode) {
echo "profile config file not exists or not readable: [{$config_file}]" . eol();
}
log_error("debug,config,profile", "profile config file not exists or not readable: [{$config_file}]");
_throw(new Charcoal_ProfileConfigFileNotFoundException($config_file));
}
// parse config file
// log_debug( "debug,config,profile", "profile", "parsing config file: [$config_file]" );
$config_file = $config_file->getAbsolutePath();
if ($debug_mode) {
echo "executing parse_ini_file: [{$config_file}]" . eol();
}
$config = @parse_ini_file($config_file, FALSE);
if ($config === FALSE) {
if ($debug_mode) {
echo "profile config file format error: [{$config_file}]" . eol();
}
log_error("debug,config,profile", "profile config file format error: [{$config_file}]");
_throw(new Charcoal_ProfileConfigFileFormatException($config_file));
}
if ($debug_mode) {
echo "executed parse_ini_file: " . ad($config) . eol();
}
// log_debug( "profile", "profile", "parse_ini_file: " . print_r($config,TRUE) );
// 設定を保存
parent::mergeArray($config);
// log_debug( "debug,config,profile", "profile", "marged profile:" . print_r($config,TRUE) );
} catch (Exception $ex) {
// log_debug( "system,error,debug", "catch $e" );
_catch($ex);
_throw(new Charcoal_ProfileLoadingException($config_file, $profile_name, $ex));
}
}
示例10: processEvent
/**
* process event
*
* @param Charcoal_IEventContext $context event context
*
* @return boolean|Charcoal_Boolean
*
* @throws DivisionByZeroException
*/
public function processEvent($context)
{
$request = $context->getRequest();
// Get parameter from request
$a = $request->getInteger('a', 0);
$b = $request->getInteger('b', 0);
$op = $request->getString('op', '+');
$a = ui($a);
$b = ui($b);
$op = us($op);
$result = NULL;
switch ($op) {
case 'add':
$result = $a + $b;
break;
case 'sub':
$result = $a - $b;
break;
case 'mul':
$result = $a * $b;
break;
case 'div':
if ($b == 0) {
throw new DivisionByZeroException();
}
$result = $a / $b;
break;
}
// show message
if ($result) {
echo "result:" . $result . eol();
} else {
echo "<pre>USAGE:" . PHP_EOL;
echo "http://" . $_SERVER['SERVER_NAME'] . "/calc/value1/value2/[add/sub/mul/div]" . PHP_EOL;
echo "value1, value2: number" . eol();
echo "add: shows result of 'value1 + value2'" . PHP_EOL;
echo "sub: shows result of 'value1 - value2'" . PHP_EOL;
echo "mul: shows result of 'value1 * value2'" . PHP_EOL;
echo "div: shows result of 'value1 / value2'" . PHP_EOL;
echo "</pre>" . eol();
}
// return TRUE if processing the procedure success.
return TRUE;
}
示例11: __construct
public function __construct()
{
// Ayarlar alınıyor...
$this->config = Config::get('Record');
// Ana dizin belirleniyor...
$this->znrDir = STORAGE_DIR . 'ZNRecords/';
// Güvenlik eki olşturuluyor...
$this->secureFix .= eol();
$recordName = $this->config['record'];
$recordDir = $this->_recordName($recordName);
// Config/Record.php dosyasıda yer alan
// record parametresi ayarlanmışsa
// oluşturma ve seçme işlemini otomatik yap.
if (!empty($recordName)) {
if (!is_dir($recordDir)) {
$this->createRecord($recordName);
}
if (is_dir($recordDir)) {
$this->selectRecord($recordName);
}
}
}
示例12: backup
public function backup($tables = '*', $fileName = '', $path = FILES_DIR)
{
if ($this->db->backup($fileName) !== false) {
return $this->db->backup($fileName);
}
if ($tables === '*') {
$tables = array();
$this->db->query('SHOW TABLES');
while ($row = $this->db->fetchRow()) {
$tables[] = $row[0];
}
} else {
$tables = is_array($tables) ? $tables : explode(',', $tables);
}
$return = NULL;
foreach ($tables as $table) {
if (!empty($this->prefix) && !strstr($table, $this->prefix)) {
$table = $this->prefix . $table;
}
$this->db->query('SELECT * FROM ' . $table);
$numFields = $this->db->numFields();
$return .= 'DROP TABLE ' . $table . ';';
$this->db->query('SHOW CREATE TABLE ' . $table);
$row2 = $this->db->fetchRow();
$return .= eol(2) . $row2[1] . ";" . eol(2);
for ($i = 0; $i < $numFields; $i++) {
while ($row = $this->db->fetchRow()) {
$return .= 'INSERT INTO ' . $table . ' VALUES(';
for ($j = 0; $j < $numFields; $j++) {
$row[$j] = addslashes($row[$j]);
$row[$j] = preg_replace("/\n/", "\\n", $row[$j]);
if (isset($row[$j])) {
$return .= '"' . $row[$j] . '"';
} else {
$return .= '""';
}
if ($j < $numFields - 1) {
$return .= ',';
}
}
$return .= ");" . eol();
}
}
$return .= eol(3);
}
if (empty($fileName)) {
$fileName = 'db-backup-' . time() . '-' . md5(implode(',', $tables)) . '.sql';
}
$handle = fopen($path . $fileName, 'w+');
fwrite($handle, $return);
fclose($handle);
return getMessage('Database', 'backupTablesSuccess');
}
示例13: run
/**
* run bootstrap
*
* @param boolean $debug
*/
public static function run($debug = FALSE)
{
self::$debug = $debug;
// register bootstrap clas loader
if (!spl_autoload_register('Charcoal_Bootstrap::loadClass', false)) {
echo "registering bootstrap class loader failed." . eol();
exit;
}
// register system handlers
register_shutdown_function('Charcoal_Bootstrap::onShutdown');
set_error_handler("Charcoal_Bootstrap::onUnhandledError");
set_exception_handler("Charcoal_Bootstrap::onUnhandledException");
}
示例14: close
public function close()
{
$script = '</style>' . eol();
return $script;
}
示例15: _package
protected function _package($packages = "", $recursive = false, $getContents = false)
{
if (!is_string($packages)) {
Error::set('Error', 'stringParameter', 'packages');
return false;
}
if (!empty($this->parameters['usable'])) {
$getContents = $this->parameters['usable'];
}
if (!empty($this->parameters['recursive'])) {
$recursive = $this->parameters['recursive'];
}
$this->parameters = array();
$eol = eol();
$return = '';
if (is_dir($packages)) {
$packageFiles = Folder::allFiles(suffix($packages), $recursive);
if (!empty($packageFiles)) {
foreach ($packageFiles as $val) {
$val = restorationPath($val);
if ($getContents === true) {
$return .= $this->something($val, '', true);
} else {
$this->something($val);
}
}
return $return;
} else {
return false;
}
} elseif (is_file($packages)) {
return $this->something($packages, '', $getContents);
}
}