static function boot($config = array()) { /* * Initialize configuration */ self::$config = $config; /* * Perform some cleanup: mainly making sure that things work more or less * the same across all PHP servers. */ self::initialize_php_environment(); /* * Next, load some modules. * * Initialize logger */ self::initialize_logger(); /* * Load ActiveRecord class and establish database connection */ self::initialize_active_record(); /* * Load ActionController class and load routes */ self::initialize_action_controller(); /* * Do some more initializations */ self::initialize_class_autoloader(); self::initialize_error_handlers(); }
function &__get($k) { if ($k == 'html') { if ($this->__html == NULL) { $this->__html = new CnCQM_Format($this, 'html'); } return $this->__html; } return parent::__get($k); }
<?php define('ACTIVE_RECORD_BASE_PATH', dirname(__FILE__)); require_once ACTIVE_RECORD_BASE_PATH . '/active_record_exceptions.php'; require_once ACTIVE_RECORD_BASE_PATH . '/database_connector.php'; require_once ACTIVE_RECORD_BASE_PATH . '/sql_builder.php'; require_once ACTIVE_RECORD_BASE_PATH . '/class_static_proxy.php'; require_once ACTIVE_RECORD_BASE_PATH . '/active_record/01_active_record_base_public_instance_methods.php'; require_once ACTIVE_RECORD_BASE_PATH . '/associations/association_proxy.php'; require_once ACTIVE_RECORD_BASE_PATH . '/associations/association_collection.php'; require_once ACTIVE_RECORD_BASE_PATH . '/associations/belongs_to_association.php'; require_once ACTIVE_RECORD_BASE_PATH . '/associations/has_many_association.php'; require_once ACTIVE_RECORD_BASE_PATH . '/associations/has_and_belongs_to_many_association.php'; if (class_exists('YARR')) { YARR::add_default_config('active_record', array()); } else { require_once 'inflector.php'; } abstract class ActiveRecord extends ActiveRecordBasePublicInstanceMethods { private static $table_columns = array(); private static $associations = array(); private static $extensions = array(); private $attributes; private $errors = array(); private $dirty_attributes = array(); private $association_proxies = array(); private $frozen = false; private $read_only = false; private $new_record = true; function __construct($attributes = array())
static function controller_file_name($controller_name) { return YARR::read_config('action_controller/controllers_path') . '/' . $controller_name . '_controller.php'; }
<?php if (class_exists('YARR')) { YARR::require_lib('inflector'); } else { require_once 'inflector.php'; } require dirname(__FILE__) . '/migrations/migrations_runner.php'; require dirname(__FILE__) . '/migrations/migration.php'; /* require_once 'mysql.php'; define('string', 'string'); define('text', 'text'); define('binary', 'binary'); define('integer', 'integer'); define('boolean', 'boolean'); define('float', 'float'); define('decimal', 'decimal'); define('date', 'date'); define('datetime', 'datetime'); define('time', 'time'); define('timestamp', 'timestamp'); */
<?php preg_match('!^(.+)/include!', __FILE__, $m); define('ROOT_DIR', $m[1] . '/'); unset($m); set_include_path(get_include_path() . PATH_SEPARATOR . ROOT_DIR . 'include/' . PATH_SEPARATOR . ROOT_DIR . 'lib/'); function __autoload($class) { $file = str_replace('_', '/', $class) . '.php'; if (file_exists(ROOT_DIR . 'include/' . $file)) { include ROOT_DIR . 'include/' . $file; return true; } if (file_exists(ROOT_DIR . 'lib/' . $file)) { include ROOT_DIR . 'lib/' . $file; return true; } return false; } define('DB', ROOT_DIR . 'db/cncqm.db'); if (!file_exists(DB)) { YARR::init(new PDO('sqlite:' . DB)); YARR::$db->exec(CnCQm_Player::schemaToSQL()); YARR::$db->exec(CnCQm_Game::schemaToSQL()); } else { YARR::init(new PDO('sqlite:' . DB)); }
<?php require dirname(__FILE__) . '/boot.php'; YARR::require_lib('active_record/migrations'); $runner = new MigrationsRunner(YARR_DB_PATH . '/migrate'); if (isset($argv) && isset($argv[1]) && is_numeric($argv[1])) { $runner->migrate((int) $argv[1]); } else { $runner->migrate(); }
<?php require dirname(__FILE__) . '/../framework.php'; require YARR_CONFIG_PATH . '/config.php'; require YARR_CONFIG_PATH . '/database.php'; // TODO: clean this up! YARR::require_lib('helpers/assets'); YARR::require_lib('helpers/transition'); YARR::boot($CONFIG);