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


PHP Model::init方法代码示例

本文整理汇总了PHP中Model::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::init方法的具体用法?PHP Model::init怎么用?PHP Model::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model的用法示例。


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

示例1: init

 function init()
 {
     parent::init();
     $this->addField('domain');
     $this->addField('type')->enum(array('agpl', 'closed-source'));
     $this->addField('fingerprint');
 }
开发者ID:TigerBui,项目名称:atk4,代码行数:7,代码来源:Licenses.php

示例2: init

 function init()
 {
     parent::init();
     $this->add('xepan\\base\\Controller_Validator');
     $this->addField('name')->defaultValue();
     $this->addField('code')->type('text');
     $this->is(['code|to_trim|required']);
     /**
      * This model automatically sets its source by traversing 
      * and searching for suitable files
      */
     $path = $this->path = $this->api->pathfinder->base_location->base_path . '/./vendor/' . str_replace("\\", "/", $this->namespace) . "/" . $this->dir;
     $p = scandir($path);
     unset($p[0]);
     unset($p[1]);
     asort($p);
     $i = 2;
     foreach ($p as $file) {
         // $temp = explode(".", explode("-", $file)[1]);
         $temp = explode(".", $file);
         if (is_array($temp) and isset($temp[0]) and $temp[0] != "index") {
             if ($this->max_count < $temp[0]) {
                 $this->max_count = $temp[0];
             }
         }
         if (strpos($file, ".sql") === false) {
             unset($p[$i]);
         }
         $i++;
     }
     asort($p);
     $this->setSource('Array', $p);
     $this->addHook('beforeDelete', $this);
     return $this;
 }
开发者ID:xepan,项目名称:epanservices,代码行数:35,代码来源:DbVersion.php

示例3: init

 function init()
 {
     parent::init();
     $this->addField('name');
     /**
      * This model automatically sets its source by traversing 
      * and searching for suitable files
      */
     $path = $this->path = $this->api->pathfinder->base_location->base_path . '/./vendor/' . str_replace("\\", "/", $this->namespace) . "/" . $this->dir;
     $p = scandir($path);
     unset($p[0]);
     unset($p[1]);
     asort($p);
     $i = 2;
     foreach ($p as $file) {
         // $temp = explode(".", explode("-", $file)[1]);
         $temp = explode(".", $file);
         if (strpos($file, ".ttf") === false) {
             unset($p[$i]);
         }
         $i++;
     }
     asort($p);
     $this->setSource('Array', $p);
     $this->addHook('beforeDelete', $this);
     return $this;
 }
开发者ID:xepan,项目名称:commerce,代码行数:27,代码来源:Fonts.php

示例4: init

 function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('title');
     $this->addField('data')->caption('Markdown Template');
     $this->addField('rendered')->caption('HTML render cache');
     $this->addHook('afterLoad', function ($m) {
         if (is_null($m['rendered'])) {
             $markdown = $m['data'];
             if (!$m->hook('prepareTemplate', array(&$markdown))) {
                 $markdown = $this->prepareTemplate($markdown);
             }
             $m['rendered'] = \ParsedownExtra::instance()->parse($markdown);
             // $this->prepareTemplate());
         }
         if (is_null($m['title'])) {
             $x = null;
             preg_match('/^# (.*)$/m', $m['data'], $x);
             $m['title'] = $x[1];
             //v
             //$m['rendered'] = \ParsedownExtra::instance()->parse($markdown);
             // $this->prepareTemplate());
         }
     });
 }
开发者ID:romaninsh,项目名称:mdcms,代码行数:26,代码来源:Model.php

示例5: init

 function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('folder');
     $this->addField('lib');
     // cached run statistics?
     $this->addField('last_run');
     $this->addField('pass_cnt');
     $this->addField('fail_cnt');
     $this->addField('skip_cnt');
     $this->addField('exec_time');
     $this->addField('exec_tics');
     // The primary generator of the IDs and
     // basic data is pathfinder. However it can
     // only provide us with the basic location (the ID)
     //
     // Remaining data must be loaded from the secondary table,
     // but it can also be stored there
     $dirs = $this->api->pathfinder->search('test', '', 'path');
     $colls = array();
     foreach ($dirs as $dir) {
         $d = dir($dir);
         while (false !== ($file = $d->read())) {
             if ($file[0] == '.') {
                 continue;
             }
             if (is_dir($dir . '/' . $file)) {
                 $colls[] = array('folder' => $dir . '/' . $file, 'lib' => $dir . '/' . $file . '/lib', 'name' => $file, 'id' => $file);
             }
         }
     }
     $this->setSource('Array', $colls);
     //$this->addCache('Mongo','testsuite_collection');
 }
开发者ID:atk4,项目名称:testsuite,代码行数:35,代码来源:Collection.php

示例6: init

 function init()
 {
     parent::init();
     $this->addField('myusername');
     $this->addfield('mypassword');
     $this->setSource('Array', array(array('myusername' => 'jonh', 'mypassword' => 'smith'), array('myusername' => 'peter', 'mypassword' => '$2y$10$NquZ/mcgKawWcTpq1i9Oz.aC.n5eD1gC3cEsbCOc3XtSFlP6oNAKG')));
 }
开发者ID:TigerBui,项目名称:atk4,代码行数:7,代码来源:auth.php

示例7: init

 function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('total');
     $this->addField('success');
     $this->addField('fail');
     $this->addField('exception');
     $this->addField('speed');
     $this->addField('memory');
     $this->addField('result');
     /**
      * This model automatically sets its source by traversing 
      * and searching for suitable files
      */
     $p = scandir($this->api->pathfinder->base_location->base_path . '/../vendor/' . str_replace("\\", "/", $this->namespace) . "/page/" . $this->dir);
     // $p=$this->api->pathfinder->searchDir($this->type,$this->dir);
     unset($p[0]);
     unset($p[1]);
     $i = 2;
     foreach ($p as $file) {
         if (strpos($file, ".php") === false) {
             unset($p[$i]);
         }
         $i++;
     }
     sort($p);
     $this->setSource('Array', $p);
     $this->addHook('afterLoad', $this);
     return $this;
 }
开发者ID:xepan,项目名称:base,代码行数:31,代码来源:xEpanTester.php

示例8: init

 public function init()
 {
     parent::init();
     // load dimensions
     $sql = "\r\n\t\t\tSELECT MAX(x) as `max_x`, MIN(x) as `min_x`, MAX(y) as `max_y`, MIN(y) as `min_y`\r\n\t\t\tFROM `fields` WHERE `board_id` = {$this->id};\r\n\t\t";
     $result = mysql_query($sql) or die('3ogihslakdhaf' . mysql_error());
     $this->dimensions = mysql_fetch_assoc($result);
 }
开发者ID:LovagiasParaszt,项目名称:phpscrabble,代码行数:8,代码来源:model.Board.php

示例9: init

 function init()
 {
     parent::init();
     $this->addField('expiration');
     $this->addField('cache')->type('text');
     $this->addField('lock')->type('boolean');
     $this->setSource('Memcached');
 }
开发者ID:atk4,项目名称:atk4-tests,代码行数:8,代码来源:ViewCache.php

示例10: init

 function init()
 {
     parent::init();
     $this->addField('name');
     $this->addField('surname');
     $this->addField('bio')->type('text');
     $this->addField('descr')->type('text')->allowHtml(true);
 }
开发者ID:atk4,项目名称:atk4-tests,代码行数:8,代码来源:text.php

示例11: init

 function init()
 {
     parent::init();
     $this->addField('field1')->group('group1');
     $this->addField('field2')->group('group1');
     $this->addField('field3')->group('group2');
     $this->setControllerData('Foo');
 }
开发者ID:atk4,项目名称:atk4-tests,代码行数:8,代码来源:TestModel.php

示例12: init

 function init()
 {
     parent::init();
     $this->addField('name');
     // cache buildstacks
     $buildstacks = $this->app->recall('buildstacks', false) ?: $this->app->memorize('buildstacks', trim(file_get_contents('https://raw.githubusercontent.com/progrium/buildstep/master/stack/buildpacks.txt')));
     $a = explode("\n", $buildstacks);
     $a = array_combine($a, $a);
     $this->setSource('Array', $a);
 }
开发者ID:romaninsh,项目名称:dokku_alt,代码行数:10,代码来源:Buildpack.php

示例13: init

 function init()
 {
     parent::init();
     $this->addField('id');
     $this->addField('title');
     $this->addField('description');
     $this->hasOne('Model_ComplexModel', 'parent_id');
     $this->hasMany('Model_ComplexModel', 'parent_id');
     $this->setControllerData('Foo');
     $this->setControllerSource(self::$exampleSource);
 }
开发者ID:atk4,项目名称:atk4-tests,代码行数:11,代码来源:ComplexModel.php

示例14: init

 function init()
 {
     parent::init();
     if ($d = $_GET[$this->name . '_debug']) {
         if ($d == 'query') {
             $this->debug();
         }
     }
     if ($this->owner instanceof Field_Reference && $this->owner->owner->relations) {
         $this->relations =& $this->owner->owner->relations;
     }
     $this->addField($this->id_field)->system(true);
 }
开发者ID:romaninsh,项目名称:atkSchool,代码行数:13,代码来源:Table.php

示例15: init

 function init()
 {
     parent::init();
     $this->addField('email');
     $this->addField('password');
     $this->addField('token')->system(true);
     // token is issued as alternative to password
     $this->setSource('Session');
     //$this->addCache('Session');
     $this->addHook('beforeSave', $this);
     $this->hasMany('AgileToolkit_Licenes');
     $this->hasMany('AgileToolkit_Purchase');
     $this->hasMany('AgileToolkit_Addon');
     // We would need to use controller if we want to talk with API
 }
开发者ID:TigerBui,项目名称:atk4,代码行数:15,代码来源:Access.php


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