本文整理汇总了PHP中eol函数的典型用法代码示例。如果您正苦于以下问题:PHP eol函数的具体用法?PHP eol怎么用?PHP eol使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eol函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:28,代码来源:FrameworkClassLoader.class.php
示例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;
}
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:34,代码来源:IniConfigProvider.class.php
示例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;
}
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:25,代码来源:Schedule.php
示例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', '[email protected]');
$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 = "[email protected]";
$subject = "test";
$body = "test!!!";
echo "to:" . $to . eol();
$qdmail->sendMail($from, $to, $subject, $body);
break;
}
}
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:29,代码来源:QdmailTestTask.class.php
示例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;
}
}
开发者ID:bytemtek,项目名称:znframework,代码行数:57,代码来源:Template.php
示例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;
}
开发者ID:bytemtek,项目名称:znframework,代码行数:10,代码来源:Transform.php
示例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;
}
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:17,代码来源:DebugUtil.class.php
示例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;
}
开发者ID:bytemtek,项目名称:znframework,代码行数:11,代码来源:Manipulation.php
示例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));
}
}
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:51,代码来源:SandboxProfile.class.php
示例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;
}
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:53,代码来源:CalcTask.class.php
示例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);
}
}
}
开发者ID:bytemtek,项目名称:znframework,代码行数:22,代码来源:Record.php
示例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');
}
开发者ID:erdidoqan,项目名称:znframework,代码行数:53,代码来源:DBTool.php
示例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");
}
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:18,代码来源:Bootstrap.class.php
示例14: close
public function close()
{
$script = '</style>' . eol();
return $script;
}
开发者ID:bytemtek,项目名称:znframework,代码行数:5,代码来源:Style.php
示例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);
}
}
开发者ID:bytemtek,项目名称:znframework,代码行数:34,代码来源:Import.php
示例16: create
public function create()
{
$combineFunction = func_get_args();
$complete = eol() . JQ::selector($this->selector);
$complete .= $this->complete();
if (!empty($combineFunction)) {
foreach ($combineFunction as $function) {
$complete .= $function;
}
}
$complete .= ";";
return $complete;
}
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:13,代码来源:JQBuilder.php
示例17: createHtaccessFile
function createHtaccessFile()
{
// Cache.php ayar dosyasından ayarlar çekiliyor.
$config = Config::get('Cache');
//-----------------------GZIP-------------------------------------------------------------
// mod_gzip = true ayarı yapılmışsa aşağıdaki kodları ekler.
// Gzip ile ön bellekleme başlatılmış olur.
if ($config['modGzip']['status'] === true) {
$modGzip = '<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(' . $config['modGzip']['includedFileExtension'] . ')$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>' . eol(2);
} else {
$modGzip = '';
}
//-----------------------GZIP-------------------------------------------------------------
//-----------------------EXPIRES----------------------------------------------------------
// mod_expires = true ayarı yapılmışsa aşağıdaki kodları ekler.
// Tarayıcı ile ön bellekleme başlatılmış olur.
if ($config['modExpires']['status'] === true) {
$exp = '';
foreach ($config['modExpires']['fileTypeTime'] as $type => $value) {
$exp .= 'ExpiresByType ' . $type . ' "access plus ' . $value . ' seconds"' . eol();
}
$modExpires = '<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus ' . $config['modExpires']['defaultTime'] . ' seconds"
' . $exp . '
</ifModule>' . eol(2);
} else {
$modExpires = '';
}
//-----------------------EXPIRES----------------------------------------------------------
//-----------------------HEADERS----------------------------------------------------------
// mod_headers = true ayarı yapılmışsa aşağıdaki kodları ekler.
// Header ile ön bellekleme başlatılmış olur.
if ($config['modHeaders']['status'] === true) {
$fmatch = '';
foreach ($config['modHeaders']['fileExtensionTimeAccess'] as $type => $value) {
$fmatch .= '<filesMatch "\\.(' . $type . ')$">
Header set Cache-Control "max-age=' . $value['time'] . ', ' . $value['access'] . '"
</filesMatch>' . eol();
}
$modHeaders = '<ifModule mod_headers.c>
' . $fmatch . '
</ifModule>
' . eol(2);
} else {
$modHeaders = '';
}
//-----------------------HEADERS----------------------------------------------------------
//-----------------------HEADER SET-------------------------------------------------------
$headerSet = Config::get("Headers");
if (!empty($headerSet['setHtaccessFile'])) {
$headersIniSet = "<ifModule mod_expires.c>" . eol();
foreach ($headerSet['iniSet'] as $val) {
$headersIniSet .= "{$val}" . eol();
}
$headersIniSet .= "</ifModule>" . eol(2);
} else {
$headersIniSet = '';
}
//-----------------------HEADER SET-------------------------------------------------------
//-----------------------HTACCESS SET-----------------------------------------------------
$htaccessSettings = Config::get("Htaccess");
if (!empty($htaccessSettings['setFile'])) {
$htaccessSettingsStr = '';
foreach ($htaccessSettings['settings'] as $key => $val) {
$htaccessSettingsStr .= "<{$key}>" . eol();
foreach ($val as $v) {
$htaccessSettingsStr .= $v;
}
$keyex = explode(" ", $key);
$htaccessSettingsStr .= eol() . "</{$keyex['0']}>" . eol(2);
}
} else {
$htaccessSettingsStr = '';
}
//-----------------------HTACCESS SET-----------------------------------------------------
// Htaccess dosyasına eklenecek veriler birleştiriliyor...
$htaccess = $modGzip . $modExpires . $modHeaders . $headersIniSet . $htaccessSettingsStr;
//-----------------------URI INDEX PHP----------------------------------------------------
if (!Config::get('Uri', 'index.php')) {
$htaccess .= "<IfModule mod_rewrite.c>" . eol();
$htaccess .= "RewriteEngine On" . eol();
$htaccess .= "RewriteBase /" . eol();
$htaccess .= "RewriteCond %{REQUEST_FILENAME} !-f" . eol();
$htaccess .= "RewriteCond %{REQUEST_FILENAME} !-d" . eol();
$htaccess .= 'RewriteRule ^(.*)$ ' . server('scriptName') . Config::get('Uri', 'indexSuffix') . '/$1 [L]' . eol();
$htaccess .= "</IfModule>";
}
//-----------------------URI INDEX PHP----------------------------------------------------
//-----------------------UPLOAD SETTINGS--------------------------------------------------
$uploadSet = Config::get('Upload');
//.........这里部分代码省略.........
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:101,代码来源:Functions.php
示例18: _mediaContent
protected function _mediaContent($src, $content, $_attributes, $type)
{
if (!is_string($src)) {
$src = '';
}
if (!isValue($content)) {
$content = '';
}
return '<' . $type . 'src="' . $src . '"' . Html::attributes($_attributes) . '>' . $content . "</{$type}>" . eol();
}
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:10,代码来源:HTML5.php
示例19: create
public function create($name = '', $ver = 0)
{
if ($version = $this->_version($ver)) {
$dir = $this->path . $name . $this->versionDir;
if (!is_dir($dir)) {
Folder::create($dir);
}
$file = $dir . suffix($version, '.php');
$name = $name . $version;
} else {
$file = $this->path . suffix($name, '.php');
}
if (!is_file($file)) {
$eol = eol();
$str = '<?php' . $eol;
$str .= 'class ' . $this->classFix . $name . ' extends ' . $this->extendsFix . $eol;
$str .= '{' . $eol;
$str .= "\t" . '//----------------------------------------------------------------------------------------------------' . $eol;
$str .= "\t" . '// Call Undefined Method' . $eol;
$str .= "\t" . '//----------------------------------------------------------------------------------------------------' . $eol;
$str .= "\t" . 'use CallUndefinedMethodTrait;' . $eol . $eol;
$str .= "\t" . '//----------------------------------------------------------------------------------------------------' . $eol;
$str .= "\t" . '// Class/Table Name' . $eol;
$str .= "\t" . '//----------------------------------------------------------------------------------------------------' . $eol;
$str .= "\t" . 'protected static $table = __CLASS__;' . $eol . $eol;
$str .= "\t" . '//----------------------------------------------------------------------------------------------------' . $eol;
$str .= "\t" . '// Up' . $eol;
$str .= "\t" . '//----------------------------------------------------------------------------------------------------' . $eol;
$str .= "\t" . 'public function up()' . $eol;
$str .= "\t" . '{' . $eol;
$str .= "\t\t" . '// Queries' . $eol;
$str .= "\t" . '}' . $eol . $eol;
$str .= "\t" . '//----------------------------------------------------------------------------------------------------' . $eol;
$str .= "\t" . '// Down' . $eol;
$str .= "\t" . '//----------------------------------------------------------------------------------------------------' . $eol;
$str .= "\t" . 'public function down()' . $eol;
$str .= "\t" . '{' . $eol;
$str .= "\t\t" . '// Queries' . $eol;
$str .= "\t\t" . '$this->dropTable(); // Varsayılan işlem.' . $eol;
$str .= "\t" . '}' . $eol;
$str .= '}';
return File::write($file, $str);
} else {
return Error::set('File', 'alreadyFileError', $file);
}
}
开发者ID:bytemtek,项目名称:znframework,代码行数:46,代码来源:Migration.php
示例20: test
/**
* テスト
*
* @param string $action
* @param Charcoal_IEventContext $context
*
* @return boolean
*/
public function test($action, $context)
{
$action = us($action);
/** @var Charcoal_SmartGateway $gw */
$gw = $context->getComponent('smart_gateway@:charcoal:db');
$gw->reset();
switch ($action) {
case "commit":
// トランザクション開始
$gw->beginTrans();
$gw->autoCommit(FALSE);
// 初期データの確認
$result = $gw->query(NULL, "SELECT * FROM posts WHERE post_id=1");
$this->assertEquals('stk2k', $result[0]['post_user'], true);
// 更新
$gw->execute(NULL, "UPDATE posts set post_user = 'hoge' where post_id = 1");
// コミット
$gw->commitTrans();
// 検索
$result = $gw->query(NULL, "SELECT * FROM posts WHERE post_id=1");
$this->assertEquals('hoge', $result[0]['post_user']);
return TRUE;
case "query":
$sql = "SELECT * FROM blogs WHERE blog_id = 1";
$result = $gw->query("query #1", $sql);
$blog_name = '';
foreach ($result as $row) {
$blog_name = $row['blog_name'];
echo "blog_name:{$blog_name}" . eol();
}
$this->assertEquals(1, count($result));
$this->assertEquals("my blog", $blog_name);
return TRUE;
case "select":
$where = "blog_id = ?";
$criteria = new Charcoal_SQLCriteria($where, array(1));
$result = $gw->findAll("select #1", 'blogs', $criteria);
$blog_name = '';
foreach ($result as $row) {
$blog_name = $row['blog_name'];
echo "blog_name:{$blog_name}" . eol();
}
$this->assertEquals(1, count($result));
$this->assertEquals("my blog", $blog_name);
return TRUE;
case "select_alias":
$where = "b.blog_id = ?";
$criteria = new Charcoal_SQLCriteria($where, array(1));
$result = $gw->findAll("select_alias #1", 'blogs as b', $criteria);
$blog_name = '';
foreach ($result as $row) {
$blog_name = $row['blog_name'];
echo "blog_name:{$blog_name}" . eol();
}
$this->assertEquals(1, count($result));
$this->assertEquals("my blog", $blog_name);
return TRUE;
case "select_alias_forupdate":
$where = "blog_name like ?";
$criteria = new Charcoal_SQLCriteria($where, array("My First Blog"));
$result = $gw->findAllForUpdate("select_alias_forupdate #1", 'blogs as b', $criteria);
foreach ($result as $row) {
print print_r($row, true) . PHP_EOL;
}
return TRUE;
case "inner_join":
$where = "blogs.blog_id = ?";
$criteria = new Charcoal_SQLCriteria($where, array(1));
$result = $gw->findAll("inner_join #1", 'blogs + posts on "blogs.blog_id = posts.blog_id" + comments on "posts.post_id = comments.post_id"', $criteria);
$blog_name = '';
foreach ($result as $row) {
$blog_name = $row['blog_name'];
echo "blog_name:{$blog_name}" . eol();
}
$this->assertEquals(3, count($result));
$this->assertEquals("my blog", $blog_name);
return TRUE;
case "left_join":
$where = "blogs.blog_id = ?";
$criteria = new Charcoal_SQLCriteria($where, array(1));
$result = $gw->findAll("left_join #1", 'blogs (+ posts on "blogs.blog_id = posts.blog_id"', $criteria);
$blog_name = '';
foreach ($result as $row) {
$blog_name = $row['blog_name'];
echo "blog_name:{$blog_name}" . eol();
}
$this->assertEquals(2, count($result));
$this->assertEquals("my blog", $blog_name);
return TRUE;
case "right_join":
$where = "blogs.blog_id = ?";
$criteria = new Charcoal_SQLCriteria($where, array(1));
//.........这里部分代码省略.........
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:101,代码来源:SmartGatewayTestTask.class.php
注:本文中的eol函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论