function init() { parent::init(); $this->addField('domain'); $this->addField('type')->enum(array('agpl', 'closed-source')); $this->addField('fingerprint'); }
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; }
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; }
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()); } }); }
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'); }
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'))); }
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; }
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); }
function init() { parent::init(); $this->addField('expiration'); $this->addField('cache')->type('text'); $this->addField('lock')->type('boolean'); $this->setSource('Memcached'); }
function init() { parent::init(); $this->addField('name'); $this->addField('surname'); $this->addField('bio')->type('text'); $this->addField('descr')->type('text')->allowHtml(true); }
function init() { parent::init(); $this->addField('field1')->group('group1'); $this->addField('field2')->group('group1'); $this->addField('field3')->group('group2'); $this->setControllerData('Foo'); }
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); }
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); }
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); }
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 }
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'); $p = $this->api->pathfinder->searchDir('page'); sort($p); $this->setSource('ArrayAssoc', $p); $this->addHook('afterLoad', $this); return $this; }
function init() { parent::init(); if (!$this->dir) { throw $this->exception('Initialize this model through testsuite/Model_Collection'); } $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->setSource('Folder', $this->dir); $this->joinSource('Mongo', 'testsuite_set'); }
public function init() { parent::init(); if (!$this->table_alias) { $this->table_alias = $this->entity_code; } if (is_null($this->entity_code)) { throw new Exception_InitError('You should define entity code for ' . get_class($this)); } $this->addField('id')->type('int')->system(true); if (method_exists($this, 'defineFields')) { //throw new Exception_Obsolete('defineFields method is obsolete'); // obsolete method $this->defineFields(); } // trying to set required fields //$this->api->addHook('post-init',array($this,'setMandatoryConditions')); }
function init() { parent::init(); $this->setSource('Session'); $this->addField('name'); $this->addField('item_member_design_id'); $this->addField('item_id'); $this->addField('item_code'); $this->addField('tax_percentage'); $this->addField('taxation_id'); $this->addField('raw_sale_price'); $this->addField('raw_original_price'); $this->addField('unit_price')->type('money'); $this->addField('qty'); $this->addField('raw_amount'); $this->addField('row_discount'); $this->addField('discounted_raw_amount'); $this->addField('raw_shipping_charge')->type('money'); $this->addField('row_discount_shipping'); $this->addField('raw_express_shipping_charge')->type('money'); $this->addField('row_discount_shipping_express'); $this->addField('discounted_raw_shipping'); $this->addField('discounted_raw_shipping_express'); $this->addField('tax_amount'); $this->addField('amount'); // taxed $this->addField('shipping_charge')->type('money'); // taxed $this->addField('express_shipping_charge')->type('money'); // taxed $this->addField('original_amount')->type('money'); $this->addField('sales_amount')->type('money'); $this->addField('shipping_duration')->type('text'); $this->addField('shipping_duration_days')->type('Number'); $this->addField('express_shipping_duration')->type('text'); $this->addField('express_shipping_duration_days')->type('Number'); $this->addField('file_upload_ids'); // array of uploaded file/image file store id $this->addField('custom_fields')->type('text'); $this->discount_voucher = $this->app->recall('discount_voucher_obj', $this->add('xepan\\commerce\\Model_DiscountVoucher')); $this->is_express_shipping = $this->app->recall('express_shipping', false); }
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 = $this->api->pathfinder->searchDir($this->dir); sort($p); $this->setSource('ArrayAssoc', $p); $this->addHook('afterLoad', $this); return $this; }
function init() { parent::init(); if (!count($this->fields)) { throw new \Exception("must define the fields"); } if (!$this->config_key) { throw new \Exception("must define epan config key"); } $this->acl_type = $this->config_key; $this->namespace = 'xepan\\' . $this->application; foreach ($this->fields as $name => $type) { $field = $this->addField($name); if ($type != "Line") { $field->display(['form' => $type]); } } $this->config_model = $this->app->epan->config; $this->config_data = json_decode($this->config_model->getConfig($this->config_key, $this->application) ?: '{}', true); $this->setSource("Array", $this->config_data); $this->addHook('beforeSave', $this); $this->addHook('afterDelete', $this); }
/** * return the current session * * @return mixed[object|bool] */ static function current() { //if the user is logged in, they check() will return their ID as an INT //otherwise bool false $check = self::check(); if (!is_int($check) and $check > 0) { return false; } //get our config memeber settings (table / column names) $config = Config::settings('member'); //get the user - but we havent specified a table at this point $model = Model::init()->where('id', $check); //so force the table here $model->table = $config['table']; //now we can execute and request just the first result $result = $model->go(1); //check we have an object back and its not empty if ($result instanceof Model and !empty($result)) { //and return to muma. return $result; } //if we got here, they're not from around here return false; }
function init() { parent::init(); $this->setSource('Mongo'); $this->addField('_id')->system(true); }
function init() { parent::init(); $this->addField('name'); $this->setSource('Array', ['John', 'Peter', 'Joe', 'Steve']); }
public function init() { parent::init(); $this->Board->loadFields($this); }
<?php namespace Blog; $get = array_keys($_GET); $route = array_shift($get); /** Autoloader */ spl_autoload_register(function ($class) { $path = str_replace(__NAMESPACE__ . '\\', '', $class); $path = str_replace('\\', '/', $path); require_once $path . '.php'; }); Model::init(); //Router::route('install', ['Blog\AbstractController', 'install']); // Router::route('posts', ['Blog\\Controller\\Front', 'posts']); //Router::route('edit/post/(\d+)', ['Blog\Controller\Front', 'form']); //Router::route('delete/post/(\d+)', ['Blog\Controller\Front', 'delete']); //Router::route('edit/post/', ['Blog\Controller\Front', 'form']); //Router::route('new/post', ['Blog\Controller\Front', 'form']); // //Router::route('users', ['Blog\Controller\User', 'index']); //Router::route('delete/user/(\d+)', ['Blog\Controller\User', 'delete']); //Router::route('new/user', ['Blog\Controller\User', 'form']); //Router::route('edit/user/', ['Blog\Controller\User', 'form']); //Router::route('edit/user/(\d+)', ['Blog\Controller\User', 'form']); Router::route('([a-z]+)/(index)'); Router::route('([a-z]+)/(single)/(\\d*)'); Router::route('([a-z]+)/(delete)/(\\d+)'); Router::route('([a-z]+)/(insert)'); Router::route('([a-z]+)/(edit)/(\\d*)');
/** * {@inheritdoc} */ public function init() { parent::init(); if (!$this->db) { $this->db = $this->app->db; } if ($this->owner instanceof Field_Reference && !empty($this->owner->owner->relations)) { $this->relations =& $this->owner->owner->relations; } }
public function init() { parent::init(); }
function init() { parent::init(); $this->addField('name'); $this->addField('surname')->defaultValue('Smith'); }
function init() { parent::init(); $this->controller = $this->setController('hierarchy/Array'); $this->controller->useField('children'); }