本文整理汇总了PHP中Ak::import方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::import方法的具体用法?PHP Ak::import怎么用?PHP Ak::import使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::import方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_should_establish_multiple_connections
function test_should_establish_multiple_connections()
{
if(AK_PHP5){
$db_settings = Ak::convert('yaml', 'array', AK_CONFIG_DIR.DS.'database.yml');
$db_settings['sqlite_databases'] = array(
'database_file' => AK_TMP_DIR.DS.'testing_sqlite_database.sqlite',
'type' => 'sqlite'
);
file_put_contents(AK_CONFIG_DIR.DS.'database.yml', Ak::convert('array', 'yaml', $db_settings));
$this->installAndIncludeModels(array('TestOtherConnection'));
Ak::import('test_other_connection');
$OtherConnection = new TestOtherConnection(array('name'=>'Delia'));
$this->assertTrue($OtherConnection->save());
$this->installAndIncludeModels(array('DummyModel'=>'id,name'));
$Dummy = new DummyModel();
$this->assertNotEqual($Dummy->getConnection(), $OtherConnection->getConnection());
unset($db_settings['sqlite_databases']);
file_put_contents(AK_CONFIG_DIR.DS.'database.yml', Ak::convert('array', 'yaml', $db_settings));
}
}
示例2: test_start
public function test_start()
{
$this->installAndIncludeModels(array(
'Category'=>'id, parent_id, description, department string(25)'
));
Ak::import('DependentCategory');
}
示例3: test_start
public function test_start()
{
eval("class ObservedAccount extends AkActiveRecord { public \$notified_observers = array();} ");
eval("class ObservedPerson extends AkActiveRecord { public \$notified_observers = array();} ");
$this->installAndIncludeModels(array('ObservedAccount' => 'id, balance, created_at, updated_at', 'ObservedPerson' => 'id, user_name, first_name, last_name, city, state'));
Ak::import('TestAuditor', 'ObservedPersonObserver');
}
示例4: test_start
public function test_start()
{
$this->installAndIncludeModels(array(
'ObservedAccount'=>'id, balance, created_at, updated_at',
'ObservedPerson'=>'id, user_name, first_name, last_name, city, state'));
Ak::import('TestAuditor','ObservedPersonObserver');
}
示例5: test_setup
function test_setup()
{
$this->uninstallAndInstallMigration('AdminPlugin');
Ak::import('extension');
$this->Extension =& new Extension();
$this->populateTables('extensions');
}
示例6: authenticate
function authenticate()
{
Ak::import('sentinel');
$Sentinel =& new Sentinel();
$Sentinel->init($this);
return $Sentinel->authenticate();
}
示例7: Method
function &updateClassDetails(&$File, &$Component, &$SourceAnalyzer)
{
Ak::import('method');
$MethodInstance =& new Method();
$parsed_details = $SourceAnalyzer->getParsedArray($File->body);
$available_classes = empty($parsed_details['classes']) ? array() : array_keys($parsed_details['classes']);
if (empty($available_classes)) {
return $available_classes;
}
$Classes = array();
foreach ($available_classes as $class_name) {
$extends = !empty($parsed_details['classes'][$class_name]['extends']) ? $parsed_details['classes'][$class_name]['extends'] : false;
if ($extends) {
$SourceAnalyzer->log('Looking for parent class: ' . $extends);
$ParentClass =& $this->_addOrUpdateClassDetails($extends, $File, $Component, $SourceAnalyzer, array(), true);
}
$Class =& $this->_addOrUpdateClassDetails($class_name, $File, $Component, $SourceAnalyzer, $parsed_details['classes'][$class_name]);
if (!empty($ParentClass)) {
$SourceAnalyzer->log('Setting ' . $extends . ' as the parent of ' . $class_name);
$ParentClass->tree->addChild($Class);
$ParentClass->save();
}
$Class->methods = array();
if (!empty($parsed_details['classes'][$class_name]['methods'])) {
foreach ($parsed_details['classes'][$class_name]['methods'] as $method_name => $method_details) {
$Class->methods[] =& $MethodInstance->updateMethodDetails($Class, $method_name, $method_details, $SourceAnalyzer);
}
}
$Classes[] =& $Class;
}
return $Classes;
}
示例8: addDefaults
public function addDefaults()
{
if (AK_ENVIRONMENT == 'testing') {
return;
}
Ak::import('User', 'Role', 'Permission', 'Extension');
$this->createExtensions();
$this->createRoles();
$this->createAdministrator();
}
示例9: test_for_importing_models
public function test_for_importing_models()
{
$models = 'ImportTestModelA, import_test_model_b';
$this->assertEqual(Ak::import($models), array('ImportTestModelA', 'ImportTestModelB'));
$this->assertTrue(class_exists('ImportTestModelA'));
$this->assertTrue(class_exists('ImportTestModelB'));
$models = array('ImportTestModelB', 'Import Test Model C');
$this->assertEqual(Ak::import($models), array('ImportTestModelB', 'ImportTestModelC'));
$this->assertTrue(class_exists('ImportTestModelC'));
}
示例10: akelos_autoload
function akelos_autoload($name, $path = null)
{
static $paths = array(), $lib_paths = array(), $app_paths = array();
if (!empty($path)) {
$paths[$name] = $path;
return;
}
if (empty($app_paths)) {
$app_paths = array('BaseActionController' => 'controllers/base_action_controller.php', 'BaseActiveRecord' => 'models/base_active_record.php', 'ApplicationController' => 'controllers/application_controller.php', 'ActiveRecord' => 'models/active_record.php');
}
if (empty($lib_paths)) {
$lib_paths = array('AkActionMailer' => 'action_mailer/base.php', 'AkMailComposer' => 'action_mailer/composer.php', 'AkMailEncoding' => 'action_mailer/encoding.php', 'AkMailBase' => 'action_mailer/mail_base.php', 'AkMailMessage' => 'action_mailer/message.php', 'AkMailParser' => 'action_mailer/parser.php', 'AkMailPart' => 'action_mailer/part.php', 'AkActionMailerQuoting' => 'action_mailer/quoting.php', 'AkActionController' => 'action_pack/action_controller.php', 'AkExceptionDispatcher' => 'action_pack/exception_dispatcher.php', 'AkActionView' => 'action_pack/action_view.php', 'AkBaseHelper' => 'action_pack/base_helper.php', 'AkActionViewHelper' => 'action_pack/base_helper.php', 'AkCacheHandler' => 'action_pack/cache_handler.php', 'AkCacheSweeper' => 'action_pack/cache_sweeper.php', 'AkActionControllerTest' => 'action_pack/testing.php', 'AkHelperTest' => 'action_pack/testing.php', 'AkDbSession' => 'action_pack/db_session.php', 'AkCookieStore' => 'action_pack/cookie_store.php', 'AkDispatcher' => 'action_pack/dispatcher.php', 'AkActiveRecordHelper' => 'action_pack/helpers/ak_active_record_helper.php', 'AkAssetTagHelper' => 'action_pack/helpers/ak_asset_tag_helper.php', 'AkFormHelperBuilder' => 'action_pack/helpers/ak_form_helper.php', 'AkFormHelperInstanceTag' => 'action_pack/helpers/ak_form_helper.php', 'AkFormHelper' => 'action_pack/helpers/ak_form_helper.php', 'AkFormHelperOptionsInstanceTag' => 'action_pack/helpers/ak_form_options_helper.php', 'AkFormTagHelper' => 'action_pack/helpers/ak_form_tag_helper.php', 'AkJavascriptHelper' => 'action_pack/helpers/ak_javascript_helper.php', 'AkJavascriptMacrosHelper' => 'action_pack/helpers/ak_javascript_macros_helper.php', 'AkMailHelper' => 'action_pack/helpers/ak_mail_helper.php', 'AkMenuHelper' => 'action_pack/helpers/ak_menu_helper.php', 'AkNumberHelper' => 'action_pack/helpers/ak_number_helper.php', 'AkPaginationHelper' => 'action_pack/helpers/ak_pagination_helper.php', 'AkPrototypeHelper' => 'action_pack/helpers/ak_prototype_helper.php', 'AkScriptaculousHelper' => 'action_pack/helpers/ak_scriptaculous_helper.php', 'AkTextHelper' => 'action_pack/helpers/ak_text_helper.php', 'AkUrlHelper' => 'action_pack/helpers/ak_url_helper.php', 'AkXmlHelper' => 'action_pack/helpers/ak_xml_helper.php', 'AkHelperLoader' => 'action_pack/helper_loader.php', 'AkPaginator' => 'action_pack/pagination.php', 'AkPhpCodeSanitizer' => 'action_pack/php_code_sanitizer.php', 'AkPhpTemplateHandler' => 'action_pack/php_template_handler.php', 'AkRequest' => 'action_pack/request.php', 'AkResponse' => 'action_pack/response.php', 'AkRouter' => 'action_pack/router/base.php', 'AkDynamicSegment' => 'action_pack/router/dynamic_segment.php', 'AkLangSegment' => 'action_pack/router/lang_segment.php', 'AkRoute' => 'action_pack/router/route.php', 'AkRouterConfig' => 'action_pack/router/router_config.php', 'AkRouterHelper' => 'action_pack/router/router_helper.php', 'AkSegment' => 'action_pack/router/segment.php', 'AkStaticSegment' => 'action_pack/router/static_segment.php', 'AkUrl' => 'action_pack/router/url.php', 'AkUrlWriter' => 'action_pack/router/url_writer.php', 'AkVariableSegment' => 'action_pack/router/variable_segment.php', 'AkWildcardSegment' => 'action_pack/router/wildcard_segment.php', 'AkResource' => 'action_pack/router/resources.php', 'AkResources' => 'action_pack/router/resources.php', 'AkSingletonResource' => 'action_pack/router/resources.php', 'AkSession' => 'action_pack/session.php', 'AkStream' => 'action_pack/stream.php', 'AkSintags' => 'action_pack/template_engines/sintags/base.php', 'AkSintagsLexer' => 'action_pack/template_engines/sintags/lexer.php', 'AkSintagsParser' => 'action_pack/template_engines/sintags/parser.php', 'AkXhtmlValidator' => 'action_pack/xhtml_validator.php', 'AkActionWebService' => 'action_pack/action_web_service.php', 'AkActionWebserviceApi' => 'action_pack/action_web_service/api.php', 'AkActionWebServiceClient' => 'action_pack/action_web_service/client.php', 'AkActionWebServiceServer' => 'action_pack/action_web_service/server.php', 'AkActiveRecord' => 'active_record/base.php', 'AkDbAdapter' => 'active_record/adapters/base.php', 'AkAssociatedActiveRecord' => 'active_record/associated_active_record.php', 'AkAssociation' => 'active_record/associations/base.php', 'AkBelongsTo' => 'active_record/associations/belongs_to.php', 'AkHasAndBelongsToMany' => 'active_record/associations/has_and_belongs_to_many.php', 'AkHasMany' => 'active_record/associations/has_many.php', 'AkHasOne' => 'active_record/associations/has_one.php', 'AkDbSchemaCache' => 'active_record/database_schema_cache.php', 'AkActiveRecordMock' => 'active_record/mock.php', 'AkObserver' => 'active_record/observer.php', 'AkHttpClient' => 'active_resource/http_client.php', 'AkAdodbCache' => 'active_support/cache/adodb.php', 'AkCache' => 'active_support/cache/base.php', 'AkMemcache' => 'active_support/cache/memcache.php', 'AkColor' => 'active_support/color/base.php', 'AkConsole' => 'active_support/console/base.php', 'AkAnsiColor' => 'active_support/console/ansi.php', 'AkConfig' => 'active_support/config/base.php', 'AkClassExtender' => 'active_support/core/class_extender.php', 'AkDebug' => 'active_support/core/debug.php', 'AkLazyObject' => 'active_support/core/lazy_object.php', 'AkArray' => 'active_support/core/types/array.php', 'AkType' => 'active_support/core/types/base.php', 'AkDate' => 'active_support/core/types/date.php', 'AkMimeType' => 'active_support/core/types/mime.php', 'AkNumber' => 'active_support/core/types/number.php', 'AkString' => 'active_support/core/types/string.php', 'AkTime' => 'active_support/core/types/time.php', 'AkFileSystem' => 'active_support/file_system/base.php', 'AkelosGenerator' => 'active_support/generator.php', 'AkCharset' => 'active_support/i18n/charset/base.php', 'AkCountries' => 'active_support/i18n/countries.php', 'AkLocaleManager' => 'active_support/i18n/locale_manager.php', 'AkTimeZone' => 'active_support/i18n/time_zone.php', 'AkImage' => 'active_support/image/base.php', 'AkImageColorScheme' => 'active_support/image/color_scheme.php', 'AkImageFilter' => 'active_support/image/filters/base.php', 'AkLogger' => 'active_support/logger.php', 'AkInstaller' => 'active_support/migrations/installer.php', 'AkBaseModel' => 'active_support/models/base.php', 'AkModelExtenssion' => 'active_support/models/base.php', 'AkFtp' => 'active_support/network/ftp.php', 'AkPlugin' => 'active_support/plugin/base.php', 'AkPluginLoader' => 'active_support/plugin/base.php', 'AkPluginInstaller' => 'active_support/plugin/installer.php', 'AkPluginManager' => 'active_support/plugin/manager.php', 'AkProfiler' => 'active_support/profiler.php', 'AkReflection' => 'active_support/reflection/base.php', 'AkReflectionClass' => 'active_support/reflection/class.php', 'AkReflectionDocBlock' => 'active_support/reflection/doc_block.php', 'AkReflectionFile' => 'active_support/reflection/file.php', 'AkReflectionFunction' => 'active_support/reflection/function.php', 'AkReflectionMethod' => 'active_support/reflection/method.php', 'AkTestApplication' => 'active_support/testing/application.php', 'AkelosTextReporter' => 'active_support/testing/base.php', 'AkelosVerboseTextReporter' => 'active_support/testing/base.php', 'AkXUnitXmlReporter' => 'active_support/testing/base.php', 'AkUnitTest' => 'active_support/testing/base.php', 'AkWebTestCase' => 'active_support/testing/base.php', 'AkTestDispatcher' => 'active_support/testing/dispatcher.php', 'AkTestRequest' => 'active_support/testing/request.php', 'AkTestResponse' => 'active_support/testing/response.php', 'AkUnitTestSuite' => 'active_support/testing/suite.php', 'AkRouterUnitTest' => 'active_support/testing/router.php', 'AkRouteUnitTest' => 'active_support/testing/route.php', 'AkControllerUnitTest' => 'active_support/testing/controller.php', 'AkInflector' => 'active_support/text/inflector.php', 'AkLexer' => 'active_support/text/lexer.php', 'AkError' => 'active_support/error_handlers/base.php', 'AkActiveDocument' => 'active_document/base.php', 'AkOdbAdapter' => 'active_document/adapters/base.php');
}
if (isset($lib_paths[$name])) {
include AK_FRAMEWORK_DIR . DS . $lib_paths[$name];
return;
}
if (isset($app_paths[$name])) {
$file_path = AkConfig::getDir('app') . DS . $app_paths[$name];
if (file_exists($file_path)) {
include $file_path;
return;
}
}
if (isset($paths[$name])) {
include $paths[$name];
} elseif (file_exists(DS . $name . '.php')) {
include DS . $name . '.php';
} else {
$underscored_name = AkInflector::underscore($name);
if (!Ak::import($name)) {
if (strstr($name, 'Helper')) {
$file_path = AkConfig::getDir('helpers') . DS . $underscored_name . '.php';
if (!file_exists($file_path)) {
$file_path = AK_ACTION_PACK_DIR . DS . 'helpers' . DS . $underscored_name . '.php';
if (!file_exists($file_path)) {
$file_path = AK_ACTION_PACK_DIR . DS . 'helpers' . DS . 'ak_' . $underscored_name . '.php';
if (include_once $file_path) {
eval('class ' . $name . ' extends Ak' . $name . '{}');
return;
}
}
}
} elseif (strstr($name, 'Installer')) {
$file_path = AkConfig::getDir('app_installers') . DS . $underscored_name . '.php';
} elseif (strstr($name, 'Controller')) {
$file_path = AkInflector::toControllerFilename($name);
}
}
}
if (isset($file_path) && file_exists($file_path)) {
include $file_path;
}
}
示例11: __test_should_extract_javadoc_blocks
function __test_should_extract_javadoc_blocks()
{
$SourceAnalyzer = new SourceAnalyzer();
include_once AK_TEST_DIR . DS . 'fixtures' . DS . 'data' . DS . 'parsed.php';
$SourceAnalyzer->importCategories($parsed['categories']);
unset($parsed['categories']);
Ak::import('akelos_class');
$ClassInstance =& new AkelosClass();
foreach ($parsed as $class_name => $details) {
if (!($Class =& $ClassInstance->findFirstBy('name', $class_name))) {
echo "<pre>" . print_r($details, true) . "</pre>";
$Class =& new AkelosClass(array('name' => $class_name));
$this->assertTrue($Class->save());
}
}
// print_r($parsed);
}
示例12: importCategories
function importCategories($categories)
{
Ak::import('category');
$CategoryInstance =& new Category();
foreach ($categories as $category_name => $related) {
if (!($Category =& $CategoryInstance->findFirstBy('name', $category_name))) {
$Category =& new Category(array('name' => $category_name));
if ($Category->save()) {
$this->log('Created new category: ' . $category_name);
}
}
if (!empty($related['relations'])) {
foreach ($related['relations'] as $related_category) {
if (!($RelatedCategory =& $CategoryInstance->findFirstBy('name', $related_category))) {
$RelatedCategory =& new Category(array('name' => $related_category));
$RelatedCategory->save();
}
$this->log('Relating category ' . $related_category . ' with ' . $category_name);
$Category->related_category->add($RelatedCategory);
}
}
}
}
示例13: test_should_establish_multiple_connections
public function test_should_establish_multiple_connections()
{
$db_file_existed = false;
if (file_exists(AkConfig::getDir('config') . DS . 'database.yml')) {
$db_file_existed = true;
$db_settings = Ak::convert('yaml', 'array', AkConfig::getDir('config') . DS . 'database.yml');
}
$db_settings['sqlite_databases'] = array('database_file' => AK_TMP_DIR . DS . 'testing_sqlite_database.sqlite', 'type' => 'sqlite');
file_put_contents(AkConfig::getDir('config') . DS . 'database.yml', Ak::convert('array', 'yaml', $db_settings));
@unlink(AK_TMP_DIR . DS . 'testing_sqlite_database.sqlite');
$this->installAndIncludeModels(array('TestOtherConnection'));
Ak::import('test_other_connection');
$OtherConnection = new TestOtherConnection(array('name' => 'Delia'));
$this->assertTrue($OtherConnection->save());
$this->installAndIncludeModels(array('DummyModel' => 'id,name'));
$Dummy = new DummyModel();
$this->assertNotEqual($Dummy->getConnection(), $OtherConnection->getConnection());
unset($db_settings['sqlite_databases']);
if ($db_file_existed) {
file_put_contents(AkConfig::getDir('config') . DS . 'database.yml', Ak::convert('array', 'yaml', $db_settings));
} else {
unlink(AkConfig::getDir('config') . DS . 'database.yml');
}
}
示例14: instantiateIncludedModelClasses
function instantiateIncludedModelClasses($models = array())
{
require_once AK_LIB_DIR . DS . 'AkActiveRecord.php';
require_once AK_APP_DIR . DS . 'shared_model.php';
empty($this->model) ? $this->model = $this->params['controller'] : null;
empty($this->models) ? $this->models = array() : null;
$models = array_unique(array_merge(Ak::import($this->model), Ak::import($this->models), Ak::import($models), empty($this->app_models) ? array() : Ak::import($this->app_models)));
foreach ($models as $model) {
$this->instantiateModelClass($model, empty($this->finder_options[$model]) ? array() : $this->finder_options[$model]);
}
}
示例15:
public function &getAssociatedModelInstance()
{
static $ModelInstances;
$class_name = $this->getOption($this->association_id, 'class_name');
if (empty($ModelInstances[$class_name])) {
Ak::import($class_name);
$ModelInstances[$class_name] = new $class_name();
}
return $ModelInstances[$class_name];
}