当前位置: 首页>>代码示例>>PHP>>正文


PHP Ethna_Util类代码示例

本文整理汇总了PHP中Ethna_Util的典型用法代码示例。如果您正苦于以下问题:PHP Ethna_Util类的具体用法?PHP Ethna_Util怎么用?PHP Ethna_Util使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Ethna_Util类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 /**
  *  テンプレートのスケルトンを生成する
  *
  *  @access public
  *  @param  string  $forward_name   テンプレート名
  *  @param  string  $skelton        スケルトンファイル名
  *  @return true|Ethna_Error        true:成功 Ethna_Error:失敗
  */
 function &generate($forward_name, $skelton = null)
 {
     $tpl_dir = $this->ctl->getTemplatedir();
     if ($tpl_dir[strlen($tpl_dir) - 1] != '/') {
         $tpl_dir .= '/';
     }
     $tpl_path = $this->ctl->getDefaultForwardPath($forward_name);
     // entity
     $entity = $tpl_dir . $tpl_path;
     Ethna_Util::mkdir(dirname($entity), 0755);
     // skelton
     if ($skelton === null) {
         $skelton = 'skel.template.tpl';
     }
     // macro
     $macro = array();
     // add '_' for tpl and no user macro for tpl
     $macro['_project_id'] = $this->ctl->getAppId();
     // generate
     if (file_exists($entity)) {
         printf("file [%s] already exists -> skip\n", $entity);
     } else {
         if ($this->_generateFile($skelton, $entity, $macro) == false) {
             printf("[warning] file creation failed [%s]\n", $entity);
         } else {
             printf("template file(s) successfully created [%s]\n", $entity);
         }
     }
     $true = true;
     return $true;
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:39,代码来源:Ethna_Plugin_Generator_Template.php

示例2: array

 /**
  *  ビューのスケルトンを生成する
  *
  *  @access public
  *  @param  string  $forward_name   ビュー名
  *  @param  string  $skelton        スケルトンファイル名
  *  @return true|Ethna_Error        true:成功 Ethna_Error:失敗
  */
 function &generate($forward_name, $skelton = null, $gateway = GATEWAY_WWW)
 {
     $view_dir = $this->ctl->getViewdir();
     $view_class = $this->ctl->getDefaultViewClass($forward_name, $gateway);
     $view_path = $this->ctl->getDefaultViewPath($forward_name);
     // entity
     $entity = $view_dir . $view_path;
     Ethna_Util::mkdir(dirname($entity), 0755);
     // skelton
     if ($skelton === null) {
         $skelton = 'skel.view.php';
     }
     // macro
     $macro = array();
     $macro['project_id'] = $this->ctl->getAppId();
     $macro['forward_name'] = $forward_name;
     $macro['view_class'] = $view_class;
     $macro['view_path'] = $view_path;
     // user macro
     $user_macro = $this->_getUserMacro();
     $macro = array_merge($macro, $user_macro);
     // generate
     if (file_exists($entity)) {
         printf("file [%s] already exists -> skip\n", $entity);
     } else {
         if ($this->_generateFile($skelton, $entity, $macro) == false) {
             printf("[warning] file creation failed [%s]\n", $entity);
         } else {
             printf("view script(s) successfully created [%s]\n", $entity);
         }
     }
     $true = true;
     return $true;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:42,代码来源:Ethna_Plugin_Generator_View.php

示例3: ucfirst

 /**
  * ScaffoldSmartyPlugin を生成する
  * 
  * @access public
  */
 function &generate()
 {
     $app_dir = $this->ctl->getDirectory('app');
     $app_path = ucfirst($this->ctl->getAppId()) . '_ScaffoldSmartyPlugin.php';
     $macro = array();
     $macro['project_id'] = $this->ctl->getAppId();
     $macro['file_path'] = $app_path;
     $user_macro = $this->_getUserMacro();
     $macro = array_merge($macro, $user_macro);
     // ファイル生成
     $filePath = "{$app_dir}/{$app_path}";
     Ethna_Util::mkdir(dirname($filePath), 0755);
     $skelton = "skel.scaffold-smartyPlugin.php";
     if (file_exists($filePath)) {
         printf("file [%s] already exists -> skip\n", $filePath);
     } else {
         if ($this->_generateFile($skelton, $filePath, $macro) == false) {
             printf("[warning] file creation failed [%s]\n", $filePath);
         } else {
             printf("action script(s) successfully created [%s]\n", $filePath);
         }
     }
     $true = true;
     return $true;
 }
开发者ID:bobpp,项目名称:php-Ethna-Ethcaffold,代码行数:30,代码来源:Ethna_Plugin_Generator_ScaffoldSmartyPlugin.php

示例4: __construct

 /**
  *  Constructor for Ethna_Renderer_Smarty3
  *
  *  @access public
  */
 public function __construct($controller)
 {
     parent::__construct($controller);
     // get renderer config
     $smarty_config = isset($this->config['smarty3']) ? $this->config['smarty3'] : array();
     $this->loadEngine($smarty_config);
     $this->engine = new Smarty();
     // Configurerd by controller
     $template_dir = $controller->getTemplatedir();
     $compile_dir = $controller->getDirectory('template_c');
     $this->setTemplateDir($template_dir);
     $this->compile_dir = $compile_dir;
     $this->engine->template_dir = $template_dir;
     $this->engine->compile_dir = $compile_dir;
     $this->engine->compile_id = md5($this->template_dir);
     if (isset($smarty_config['left_delimiter'])) {
         $this->engine->left_delimiter = $smarty_config['left_delimiter'];
     }
     if (isset($smarty_config['right_delimiter'])) {
         $this->engine->right_delimiter = $smarty_config['right_delimiter'];
     }
     // make compile dir
     if (is_dir($this->engine->compile_dir) === false) {
         Ethna_Util::mkdir($this->engine->compile_dir, 0755);
     }
     $this->engine->inheritance = true;
     $this->engine->plugins_dir = array_merge($controller->getDirectory('plugins'), array(ETHNA_BASE . '/class/Plugin/Smarty', SMARTY_DIR . 'plugins'));
 }
开发者ID:riaf,项目名称:pastit,代码行数:33,代码来源:Smarty3.php

示例5: __construct

 /**
  *  Ethna_Renderer_Smartyクラスのコンストラクタ
  *
  *  @access public
  */
 public function __construct($controller)
 {
     parent::__construct($controller);
     $this->engine = new Smarty();
     // ディレクトリ関連は Controllerによって実行時に設定
     // TODO: iniファイルによって上書き可にするかは要検討
     $template_dir = $controller->getTemplatedir();
     $compile_dir = $controller->getDirectory('template_c');
     $this->setTemplateDir($template_dir);
     $this->compile_dir = $compile_dir;
     $this->engine->template_dir = $this->template_dir;
     $this->engine->compile_dir = $this->compile_dir;
     $this->engine->compile_id = md5($this->template_dir);
     //  デリミタは Ethna_Config を見る
     $smarty_config = isset($this->config['smarty']) ? $this->config['smarty'] : array();
     if (array_key_exists('left_delimiter', $smarty_config)) {
         $this->engine->left_delimiter = $smarty_config['left_delimiter'];
     }
     if (array_key_exists('right_delimiter', $smarty_config)) {
         $this->engine->right_delimiter = $smarty_config['right_delimiter'];
     }
     // コンパイルディレクトリは必須なので一応がんばってみる
     if (is_dir($this->engine->compile_dir) === false) {
         Ethna_Util::mkdir($this->engine->compile_dir, 0755);
     }
     $this->engine->plugins_dir = array_merge($controller->getDirectory('plugins'), array(ETHNA_BASE . '/class/Plugin/Smarty', SMARTY_DIR . 'plugins'));
 }
开发者ID:riaf,项目名称:ethna,代码行数:32,代码来源:Smarty.php

示例6: generate

 /**
  *  テンプレートのスケルトンを生成する
  *
  *  @access public
  *  @param  string  $forward_name   テンプレート名
  *  @param  string  $skelton        スケルトンファイル名
  *  @param  string  $locale         ロケール名
  *  @param  string  $encoding       エンコーディング
  *  @return true|Ethna_Error        true:成功 Ethna_Error:失敗
  */
 function generate($forward_name, $skelton = null, $locale, $encoding)
 {
     //  ロケールが指定された場合は、それを優先する
     if (!empty($locale)) {
         $this->ctl->setLocale($locale);
     }
     //  ロケール名がディレクトリに含まれていない場合は、
     //  ディレクトリがないためなのでそれを補正
     $tpl_dir = $this->ctl->getTemplatedir();
     $tpl_path = $this->ctl->getDefaultForwardPath($forward_name);
     // entity
     $entity = $tpl_dir . '/' . $tpl_path;
     Ethna_Util::mkdir(dirname($entity), 0755);
     // skelton
     if ($skelton === null) {
         $skelton = 'skel.template.tpl';
     }
     // macro
     $macro = array();
     // add '_' for tpl and no user macro for tpl
     $macro['_project_id'] = $this->ctl->getAppId();
     $macro['client_enc'] = $encoding;
     // generate
     if (file_exists($entity)) {
         printf("file [%s] already exists -> skip\n", $entity);
     } else {
         if ($this->_generateFile($skelton, $entity, $macro) == false) {
             printf("[warning] file creation failed [%s]\n", $entity);
         } else {
             printf("template file(s) successfully created [%s]\n", $entity);
         }
     }
     $true = true;
     return $true;
 }
开发者ID:hiroki-ta,项目名称:my.project,代码行数:45,代码来源:Template.php

示例7: generate

 /**
  *  アプリケーションオブジェクトのスケルトンを生成する
  *
  *  @access public
  *  @param  string  $table_name     テーブル名
  *  @return bool    true:成功 false:失敗
  */
 function generate($table_name)
 {
     $table_id = preg_replace_callback('/_(.)/', function (array $matches) {
         return strtoupper($matches[1]);
     }, ucfirst($table_name));
     $app_dir = $this->ctl->getDirectory('app');
     $app_path = ucfirst($this->ctl->getAppId()) . '_' . $table_id . '.php';
     $macro = array();
     $macro['project_id'] = $this->ctl->getAppId();
     $macro['app_path'] = $app_path;
     $macro['app_object'] = ucfirst($this->ctl->getAppId()) . '_' . $table_id;
     $user_macro = $this->_getUserMacro();
     $macro = array_merge($macro, $user_macro);
     $path = "{$app_dir}/{$app_path}";
     Ethna_Util::mkdir(dirname($path), 0755);
     if (file_exists($path)) {
         printf("file [%s] already exists -> skip\n", $path);
     } else {
         if ($this->_generateFile("skel.app_object.php", $path, $macro) == false) {
             printf("[warning] file creation failed [%s]\n", $path);
         } else {
             printf("app-object script(s) successfully created [%s]\n", $path);
         }
     }
 }
开发者ID:ethna,项目名称:ethna-generator,代码行数:32,代码来源:AppObject.php

示例8: array

 /**
  * ScaffoldActionForm を生成する
  * 
  * @access public
  * @param $model string テーブル名
  * @param $modelDefine array モデル定義
  * @param $formDef array フォーム定義
  */
 function &generate($model, $modelDefine, $formDef)
 {
     $table_id = $this->_getTableId($model);
     $project_id = $this->ctl->getAppId();
     $dir = $this->ctl->getDirectory('action_form');
     if ($dir == null) {
         $dir = $this->ctl->getDirectory('app') . "/action_form/";
     }
     $file = "{$project_id}_{$table_id}_ActionForm.php";
     // Macro
     $macro = array();
     $macro['model'] = $model;
     $macro['modelName'] = $table_id;
     $macro['modelUName'] = strtoupper($table_id);
     $macro['project_id'] = $project_id;
     $macro['column_name_file'] = $this->_getColumnNamePath($table_id);
     $macro['form_define'] = $this->_getActionFormDefine($formDef);
     $user_macro = $this->_getUserMacro();
     $macro = array_merge($macro, $user_macro);
     $skelton = "skel.scaffold-actionform.php";
     // ファイル生成
     $path = "{$dir}{$file}";
     Ethna_Util::mkdir(dirname($path), 0755);
     if (file_exists($path)) {
         printf("file [%s] already exists -> skip\n", $path);
     } else {
         if ($this->_generateFile($skelton, $path, $macro) == false) {
             printf("[warning] file creation failed [%s]\n", $path);
         } else {
             printf("action script(s) successfully created [%s]\n", $path);
         }
     }
     $true = true;
     return $true;
 }
开发者ID:bobpp,项目名称:php-Ethna-Ethcaffold,代码行数:43,代码来源:Ethna_Plugin_Generator_ScaffoldActionForm.php

示例9: ucfirst

 /**
  * ScaffoldAppObject を生成する
  * 
  * @access public
  * @param $table_name string テーブル名
  */
 function &generate($table_name)
 {
     $table_id = $this->_getTableId($table_name);
     $app_dir = $this->ctl->getDirectory('app');
     $app_path = ucfirst($this->ctl->getAppId()) . '_' . $table_id . '.php';
     $baseClass_path = ucfirst($this->ctl->getAppId()) . '_AppBase_AppObject.php';
     // マクロ
     $macro = array();
     $macro['model'] = $table_name;
     $macro['modelName'] = $table_id;
     $macro['modelUName'] = strtoupper($table_id);
     $macro['project_id'] = $this->ctl->getAppId();
     $macro['app_path'] = $app_path;
     $macro['app_object'] = ucfirst($this->ctl->getAppId()) . '_' . $table_id;
     $macro['column_name_file'] = $this->_getColumnNamePath($table_id);
     $macro['base_class_file'] = $baseClass_path;
     $user_macro = $this->_getUserMacro();
     $macro = array_merge($macro, $user_macro);
     // ファイル生成
     $path = "{$app_dir}/{$app_path}";
     Ethna_Util::mkdir(dirname($path), 0755);
     if (file_exists($path)) {
         printf("file [%s] already exists -> skip\n", $path);
     } else {
         if ($this->_generateFile("skel.scaffold-appobject.php", $path, $macro) == false) {
             printf("[warning] file creation failed [%s]\n", $path);
         } else {
             printf("app-object script(s) successfully created [%s]\n", $path);
         }
     }
     $true = true;
     return $true;
 }
开发者ID:bobpp,项目名称:php-Ethna-Ethcaffold,代码行数:39,代码来源:Ethna_Plugin_Generator_ScaffoldAppObject.php

示例10: __construct

 /**
  *  Ethna_Renderer_Smartyクラスのコンストラクタ
  *
  *  @access public
  */
 public function __construct($controller)
 {
     parent::__construct($controller);
     // get renderer config
     $smarty_config = $this->config;
     // load template engine
     $this->loadEngine($smarty_config);
     $this->engine = new Smarty();
     // ディレクトリ関連は Controllerによって実行時に設定
     $template_dir = $controller->getTemplatedir();
     $compile_dir = $controller->getDirectory('template_c');
     $this->setTemplateDir($template_dir);
     $this->compile_dir = $compile_dir;
     $this->engine->template_dir = $this->template_dir;
     $this->engine->compile_dir = $this->compile_dir;
     $this->engine->compile_id = md5($this->template_dir);
     // delimiter setting
     $this->engine->left_delimiter = $smarty_config['left_delimiter'];
     $this->engine->right_delimiter = $smarty_config['right_delimiter'];
     // コンパイルディレクトリは必須なので一応がんばってみる
     if (is_dir($this->engine->compile_dir) === false) {
         Ethna_Util::mkdir($this->engine->compile_dir, 0755);
     }
     $this->engine->plugins_dir = array_merge($controller->getDirectory('plugins'), array(ETHNA_BASE . '/class/Plugin/Smarty', SMARTY_DIR . 'plugins'));
 }
开发者ID:hiroki-ta,项目名称:my.project,代码行数:30,代码来源:Smarty.php

示例11: testCachemanagerLocalfile

 function testCachemanagerLocalfile()
 {
     $ctl =& Ethna_Controller::getInstance();
     $plugin =& $ctl->getPlugin();
     $cm = $plugin->getPlugin('Cachemanager', 'Localfile');
     // 文字列のキャッシュ
     $string_key = 'string_key';
     $string_value = "cache\ncontent";
     $cm->set($string_key, $string_value, mktime(0, 0, 0, 7, 1, 2000));
     $cache_string = $cm->get($string_key);
     $this->assertTrue($cm->isCached($string_key));
     $this->assertEqual(mktime(0, 0, 0, 7, 1, 2000), $cm->getLastModified($string_key));
     $this->assertTrue($string_value, $cache_string);
     // 整数のキャッシュ + namespace
     $int_key = 'int_key';
     $int_value = 777;
     $namespace = 'test';
     $cm->set($int_key, $int_value, mktime(0, 0, 0, 7, 1, 2000), $namespace);
     $cache_int = $cm->get($int_key, mktime(0, 0, 0, 7, 1, 2000), $namespace);
     $this->assertTrue($cm->isCached($int_key, mktime(0, 0, 0, 7, 1, 2000), $namespace));
     $this->assertTrue($int_value, $cache_int);
     // オブジェクトのキャッシュ
     $object_key = 'object_key';
     $object_value =& $cm;
     $cm->set($object_key, $object_value);
     $this->assertTrue($cm->isCached($object_key));
     // キャッシュされたインスタンス
     $cache_object = $cm->get($object_key);
     $this->assertTrue($string_value, $cache_object->get($string_key));
     // キャッシュのクリアをテスト
     $cm->clear($object_key);
     $this->assertFalse($cm->isCached($object_key));
     // キャッシュされていないのに呼び出そうとした場合
     $nocache_key = 'nocache_key';
     $cm->clear($nocache_key);
     $pear_error = $cm->get($nocache_key);
     $this->assertEqual(E_CACHE_NO_VALUE, $pear_error->getCode());
     $this->assertEqual('fopen failed', $pear_error->getMessage());
     // ファイルに読み込み権限がない場合
     Ethna_Util::chmod($cm->_getCacheFile(null, $string_key), 0222);
     $pear_error = $cm->get($string_key);
     $this->assertEqual(E_CACHE_NO_VALUE, $pear_error->getCode());
     $this->assertEqual('fopen failed', $pear_error->getMessage());
     Ethna_Util::chmod($cm->_getCacheFile(null, $string_key), 0666);
     // lifetime切れの場合
     $pear_error = $cm->get($string_key, 1);
     $this->assertEqual(E_CACHE_EXPIRED, $pear_error->getCode());
     $this->assertEqual('fopen failed', $pear_error->getMessage());
     // ディレクトリ名と同じファイルがあってディレクトリが作成できない場合
     $tmp_key = 'tmpkey';
     $tmp_dirname = $cm->_getCacheDir(null, $tmp_key);
     Ethna_Util::mkdir(dirname($tmp_dirname), 0777);
     $tmp_file = fopen($tmp_dirname, 'w');
     fclose($tmp_file);
     $pear_error = $cm->set($tmp_key, $string_value);
     $this->assertEqual(E_USER_WARNING, $pear_error->getCode());
     $this->assertEqual("mkdir({$tmp_dirname}) failed", $pear_error->getMessage());
     $this->rm($cm->backend->getTmpdir());
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:59,代码来源:Ethna_Plugin_Cachemanager_Localfile_Test.php

示例12: array

 /**
  * ScaffoldTemplates を生成する
  * 
  * @access public
  * @param string $baseAction ベースのアクション名
  * @param string  $model モデル名
  * @param array $modelDefine モデル定義
  * @param string $idDefine 主キー名
  * @param array $formDef フォーム定義
  */
 function &generate($baseAction, $model, $modelDefine, $idDefine, $formDef)
 {
     // Template Directory
     $tpl_dir = $this->ctl->getTemplatedir();
     if ($tpl_dir[strlen($tpl_dir) - 1] != '/') {
         $tpl_dir .= '/';
     }
     $table_id = $this->_getTableId($model);
     // Generating Templates
     $templates = array('list' => array('title' => sprintf("Listing {model_name model='%s'}", $table_id), 'template' => 'list', 'headerTag' => $this->_getListHeaderTags($modelDefine, $table_id), 'mainTag' => $this->_getListMainTags($modelDefine, $table_id)), 'read' => array('title' => sprintf("Show {model_name model='%s'}", $table_id), 'template' => 'item', 'itemTag' => $this->_getItemMainTag($modelDefine, $table_id)), 'form_create' => array('title' => sprintf("New {model_name model='%s'}", $table_id), 'template' => 'form', 'formTag' => $this->_getFormMainTag($formDef, null, array($idDefine)), 'action' => $this->_getFullAction($baseAction, 'create_do')), 'form_update' => array('title' => sprintf("Editing {model_name model='%s'}", $table_id), 'template' => 'form', 'formTag' => $this->_getFormMainTag($formDef, null, array($idDefine)), 'action' => $this->_getFullAction($baseAction, 'update_do')), 'delete' => array('title' => sprintf("Are you sure?", $model), 'template' => 'delete', 'itemTag' => $this->_getItemMainTag($modelDefine, $table_id)), '_errorbox' => array('_fileName' => '_errorMessages.tpl.html', 'template' => 'errorMessages'), '_noticebox' => array('_fileName' => '_noticeMessages.tpl.html', 'template' => 'noticeMessages'));
     // Create BoxFilePath
     foreach ($templates as $name => $value) {
         if ($name[0] == '_') {
             $tpl_path = $this->ctl->getDefaultForwardPath($this->_getFullAction($baseAction, 'test'));
             $path = explode("/", $tpl_path);
             $path[count($path) - 1] = $value['_fileName'];
             $templates[$name]['path'] = implode("/", $path);
         }
     }
     // Project OverAll Macro
     $projMacro = array();
     $projMacro['listAction'] = $this->_getFullAction($baseAction, 'index');
     $projMacro['readAction'] = $this->_getFullAction($baseAction, 'read');
     $projMacro['createAction'] = $this->_getFullAction($baseAction, 'create');
     $projMacro['createDoAction'] = $this->_getFullAction($baseAction, 'create_do');
     $projMacro['updateAction'] = $this->_getFullAction($baseAction, 'update');
     $projMacro['updateDoAction'] = $this->_getFullAction($baseAction, 'update_do');
     $projMacro['deleteAction'] = $this->_getFullAction($baseAction, 'delete');
     $projMacro['deleteDoAction'] = $this->_getFullAction($baseAction, 'delete_do');
     $projMacro['errorBoxFile'] = $templates['_errorbox']['path'];
     $projMacro['noticeBoxFile'] = $templates['_noticebox']['path'];
     $projMacro['model'] = $model;
     $projMacro['modelName'] = ucfirst($table_id);
     $projMacro['modelPK'] = $idDefine;
     $projMacro['project_id'] = $this->ctl->getAppId();
     foreach ($templates as $name => $value) {
         $tpl_path = $this->ctl->getDefaultForwardPath($this->_getFullAction($baseAction, $name));
         // FormBox TemplateFile.
         if (isset($value['path'])) {
             $tpl_path = $value['path'];
         }
         $macro = array_merge($value, $projMacro);
         // ファイル生成
         Ethna_Util::mkdir(dirname("{$tpl_dir}/{$tpl_path}"), 0755);
         $skel = "skel.scaffold-template-{$value['template']}.tpl";
         if (file_exists("{$tpl_dir}{$tpl_path}")) {
             printf("file [%s] already exists -> skip\n", "{$tpl_dir}{$tpl_path}");
         } else {
             if ($this->_generateFile($skel, "{$tpl_dir}{$tpl_path}", $macro) == false) {
                 printf("[warning] file creation failed [%s]\n", "{$tpl_dir}{$tpl_path}");
             } else {
                 printf("template file(s) successfully created [%s]\n", "{$tpl_dir}{$tpl_path}");
             }
         }
     }
     $true = true;
     return $true;
 }
开发者ID:bobpp,项目名称:php-Ethna-Ethcaffold,代码行数:68,代码来源:Ethna_Plugin_Generator_ScaffoldTemplates.php

示例13: smarty_function_uniqid

/**
 *  smarty function:ユニークIDを生成する(double postチェック用)
 *
 *  sample:
 *  <code>
 *  {uniqid}
 *  </code>
 *  <code>
 *  <input type="hidden" name="uniqid" value="a0f24f75e...e48864d3e">
 *  </code>
 *
 *  @param  string  $type   表示タイプ("get" or "post"−デフォルト="post")
 *  @see    isDuplicatePost
 */
function smarty_function_uniqid($params, &$smarty)
{
    $uniqid = Ethna_Util::getRandom();
    if (isset($params['type']) && $params['type'] == 'get') {
        return "uniqid={$uniqid}";
    } else {
        return "<input type=\"hidden\" name=\"uniqid\" value=\"{$uniqid}\" />\n";
    }
}
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:23,代码来源:function.uniqid.php

示例14: array

 /**
  * ScaffoldViews を生成する
  * 
  * @access public
  * @param $baseAction string ベースのアクション名
  * @param $model string モデル名
  * @param $modelDefine array モデル定義
  * @param $formDef array フォーム定義
  */
 function &generate($baseAction, $model, $modelDefine, $idDefine, $formDef)
 {
     $table_id = $this->_getTableId($model);
     $columnName_path = $this->_getColumnNamePath($table_id);
     // Viewを生成
     $views = array("list" => array('helper' => $this->_getFullAction($baseAction, 'create_do')), "read" => array('helper' => $this->_getFullAction($baseAction, 'create_do')), "form_create" => array('helper' => $this->_getFullAction($baseAction, 'create_do')), "form_update" => array('helper' => $this->_getFullAction($baseAction, 'update_do')), "delete" => array('helper' => $this->_getFullAction($baseAction, 'create_do')));
     foreach ($views as $name => $value) {
         $forward_name = $this->_getFullAction($baseAction, $name);
         $view_dir = $this->ctl->getViewdir();
         $view_class = $this->ctl->getDefaultViewClass($forward_name, false);
         $view_path = $this->ctl->getDefaultViewPath($forward_name, false);
         $macro = $value;
         $macro['model'] = $model;
         $macro['modelName'] = ucfirst($table_id);
         $macro['modelUName'] = strtoupper($table_id);
         $macro['modelPK'] = $idDefine;
         $macro['project_id'] = $this->ctl->getAppId();
         $macro['forward_name'] = $forward_name;
         $macro['view_class'] = $view_class;
         $macro['view_path'] = $view_path;
         $macro['column_name_file'] = $columnName_path;
         $user_macro = $this->_getUserMacro();
         $macro = array_merge($macro, $user_macro);
         Ethna_Util::mkdir(dirname("{$view_dir}/{$view_path}"), 0755);
         if ($name == 'list') {
             $skelton = 'skel.scaffold-view-list.php';
         } else {
             if ($name == 'delete') {
                 $skelton = 'skel.scaffold-view-delete.php';
             } else {
                 if ($name == 'read') {
                     $skelton = 'skel.scaffold-view-item.php';
                 } else {
                     if ($name == 'form_create') {
                         $skelton = 'skel.scaffold-view-formCreate.php';
                     } else {
                         if ($name == 'form_update') {
                             $skelton = 'skel.scaffold-view-formUpdate.php';
                         }
                     }
                 }
             }
         }
         if (file_exists("{$view_dir}{$view_path}")) {
             printf("file [%s] already exists -> skip\n", "{$view_dir}{$view_path}");
         } else {
             if ($this->_generateFile($skelton, "{$view_dir}{$view_path}", $macro) == false) {
                 printf("[warning] file creation failed [%s]\n", "{$view_dir}{$view_path}");
             } else {
                 printf("view script(s) successfully created [%s]\n", "{$view_dir}{$view_path}");
             }
         }
     }
     $true = true;
     return $true;
 }
开发者ID:bobpp,项目名称:php-Ethna-Ethcaffold,代码行数:65,代码来源:Ethna_Plugin_Generator_ScaffoldViews.php

示例15: testIsAbsolute

 function testIsAbsolute()
 {
     $absolute_paths = array('/root', '/home/user/giza');
     $invalid_params = array('', false, true, '0x1');
     foreach ($absolute_paths as $path) {
         $this->assertTrue(Ethna_Util::isAbsolute($path));
     }
     foreach ($invalid_params as $path) {
         $this->assertFalse(Ethna_Util::isAbsolute($path));
     }
 }
开发者ID:hiroki-namekawa,项目名称:test-upr,代码行数:11,代码来源:Ethna_Util_Test.php


注:本文中的Ethna_Util类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。