public function __construct() { parent::__construct(); plug_config('labels'); plug_helper('view'); plug_library('db'); plug_model('meta'); }
public function __construct() { parent::__construct(); plug_helper('view'); plug_library('db'); plug_library('input'); plug_model('meta'); plug_model('auth'); }
/** * モデルをプラグする */ function plug_model($file) { $instance =& get_instance(); if ($file !== 'model') { plug_model('model'); } $class = ucfirst($file) . '_model'; $sockets = [$GLOBALS['packages'], ['models']]; foreach (array_keys($instance->config['segments']) as $key) { if ($key == 'target') { break; } $sockets[] = isset($instance->segments[$key]) ? [$instance->segments[$key], ''] : (isset($segments[$key]) ? [$segments[$key], ''] : ['']); } $socket = [$class . '.php']; if (isset($instance->config['wild_targets'])) { foreach ($instance->config['wild_targets'] as $key => $value) { if (in_array($file, $value)) { $socket[] = ucfirst($key) . '_model.php'; } } } $sockets[] = $socket; $plugged = plug($sockets); if (is_null($plugged)) { echo "Model '{$file}' not found."; exit(1); } require_once BASEPATH . $plugged; $class = preg_replace('/.php$/', '', basename($plugged)); $instance->{$file . '_model'} = new $class(); return $plugged; }
/** * 行の削除 */ protected function delete_row($target, $id) { plug_model($target); return $this->{$target . '_model'}->delete($target, $id); }