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


PHP Kwf_Registry::get方法代码示例

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


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

示例1: getRow

 public function getRow($select)
 {
     if (!$select) {
         throw new Kwf_Exception('getRow needs a parameter, null is not allowed.');
     }
     if (!is_object($select)) {
         $select = $this->select($select);
     }
     if (count($select->getParts()) != 1) {
         throw new Kwf_Exception("only whereId in select allowed");
     }
     if ($select->getPart(Kwf_Model_Select::WHERE_ID)) {
         $BrowseNodeId = $select->getPart(Kwf_Model_Select::WHERE_ID);
     } else {
         if ($w = $select->getPart(Kwf_Model_Select::WHERE_EQUALS)) {
             foreach ($w as $f => $i) {
                 if ($f != $this->getPrimaryKey()) {
                     throw new Kwf_Exception("only whereEquals with primaryKey in select allowed");
                 }
                 $BrowseNodeId = $i;
             }
         } else {
             throw new Kwf_Exception("only whereEquals or whereId in select allowed");
         }
     }
     if (!isset($this->_rows[$BrowseNodeId])) {
         $options = array('AssociateTag' => Kwf_Registry::get('config')->service->amazon->associateTag);
         $result = $this->_amazon->browseNodeLookup($BrowseNodeId, $options);
         $this->_rows[$BrowseNodeId] = new $this->_rowClass(array('item' => $result, 'model' => $this));
     }
     return $this->_rows[$BrowseNodeId];
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:32,代码来源:Nodes.php

示例2: __construct

 public function __construct($config = array())
 {
     $this->_tableName = 'import' . uniqid();
     $config['table'] = $this->_tableName;
     Kwf_Registry::get('db')->query("CREATE TABLE {$this->_tableName} (\n            `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n            `foo` VARCHAR( 200 ) NOT NULL ,\n            `bar` VARCHAR( 200 ) NOT NULL\n        ) ENGINE = INNODB");
     parent::__construct($config);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:ImportModel.php

示例3: update

 public function update()
 {
     $table = $this->model->getRow($this->table);
     if (!$table) {
         throw new Kwf_ClientException("Table '{$this->table}' not found");
     }
     $field = $table->getChildRows('Fields', $this->model->select()->whereId('component_id'))->current();
     if (!$field) {
         throw new Kwf_ClientException("Field 'component_id' not found");
     }
     if ($field->key != 'PRI') {
         throw new Kwf_ClientException("Field 'component_id' is not the primary key");
     }
     if (!$this->model->getRow('kwc_data')) {
         Kwf_Registry::get('db')->query("CREATE TABLE IF NOT EXISTS `kwc_data` (\n                `component_id` varchar(255) collate utf8_unicode_ci NOT NULL,\n                `data` text collate utf8_unicode_ci NOT NULL,\n                PRIMARY KEY  (`component_id`)\n            ) ENGINE=InnoDB;");
     }
     $model = new Kwf_Component_FieldModel();
     $rows = Kwf_Registry::get('db')->fetchAssoc("SELECT * FROM {$this->table}");
     foreach ($rows as $row) {
         if ($model->getRow($row['component_id'])) {
             throw new Kwf_ClientException("entry with component_id '{$row['component_id']}' does already exist");
         }
     }
     foreach ($rows as $row) {
         $r = $model->createRow();
         foreach ($row as $k => $i) {
             $r->{$k} = $i;
         }
         $r->save();
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:31,代码来源:ConvertTableToFieldModel.php

示例4: testOneLang

 public function testOneLang()
 {
     $c = $this->_root->getPageByUrl('http://' . Kwf_Registry::get('config')->server->domain . '/trltest', 'de');
     $this->assertEquals('de', $c->getLanguage());
     $render = $c->render();
     $this->assertContains('trlTest: Sichtbar', $render);
     $this->assertContains('trlcTest: Am', $render);
     $this->assertContains('trlpTest1: Antwort', $render);
     $this->assertContains('trlpTest2: Antworten', $render);
     $this->assertContains('trlcpTest1: Antwort', $render);
     $this->assertContains('trlcpTest2: Antworten', $render);
     $this->assertContains('trlKwfTest: Sichtbar', $render);
     $this->assertContains('trlcKwfTest: Am', $render);
     $this->assertContains('trlpKwfTest1: Antwort', $render);
     $this->assertContains('trlpKwfTest2: Antworten', $render);
     $this->assertContains('trlcpKwfTest1: Antwort', $render);
     $this->assertContains('trlcpKwfTest2: Antworten', $render);
     $this->assertContains('trlTestTpl: Sichtbar', $render);
     $this->assertContains('trlcTestTpl: Am', $render);
     $this->assertContains('trlpTest1Tpl: Antwort', $render);
     $this->assertContains('trlpTest2Tpl: Antworten', $render);
     $this->assertContains('trlcpTest1Tpl: Antwort', $render);
     $this->assertContains('trlcpTest2Tpl: Antworten', $render);
     $this->assertContains('trlKwfTestTpl: Sichtbar', $render);
     $this->assertContains('trlcKwfTestTpl: Am', $render);
     $this->assertContains('trlpKwfTest1Tpl: Antwort', $render);
     $this->assertContains('trlpKwfTest2Tpl: Antworten', $render);
     $this->assertContains('trlcpKwfTest1Tpl: Antwort', $render);
     $this->assertContains('trlcpKwfTest2Tpl: Antworten', $render);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:30,代码来源:Test.php

示例5: getTemplateVars

 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
 {
     $ret = parent::getTemplateVars($renderer);
     $user = Kwf_Registry::get('userModel')->getAuthedUser();
     $ret['redirectToUrl'] = $this->getData()->getParentByClass(array('Kwc_User_Login_Component', 'Kwc_User_Login_Trl_Component'))->getComponent()->getUrlForRedirect($_REQUEST, $user);
     return $ret;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:7,代码来源:Component.php

示例6: _beforeInsert

 protected function _beforeInsert()
 {
     $user = Kwf_Registry::get('userModel')->getAuthedUser();
     if (!$this->user_id && $user) {
         $this->user_id = $user->id;
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Row.php

示例7: getFavouriteComponentIds

 /**
  * returns a list of all visible favourite componentIds
  */
 public static function getFavouriteComponentIds($favouritesModel)
 {
     $ret = array();
     $userId = Kwf_Registry::get('userModel')->getAuthedUserId();
     if ($userId) {
         $cacheIdUser = 'favCIds' . $userId;
         $ret = Kwf_Cache_Simple::fetch($cacheIdUser, $success);
         if (!$success) {
             // get all favourites related to user
             $select = new Kwf_Model_Select();
             $select->whereEquals('user_id', $userId);
             $favouritesModel = Kwf_Model_Abstract::getInstance($favouritesModel);
             $favourites = $favouritesModel->getRows($select);
             $componentIds = array();
             foreach ($favourites as $favourite) {
                 $component = Kwf_Component_Data_Root::getInstance()->getComponentById($favourite->component_id);
                 // check if component is visible and existent
                 if ($component) {
                     // if component is visible create list of users related to component
                     $componentIds[] = $component->componentId;
                 }
             }
             // cache relation of visible components to user
             Kwf_Cache_Simple::add($cacheIdUser, $componentIds);
             $ret = $componentIds;
         }
     }
     return $ret;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:32,代码来源:Component.php

示例8: getLanguages

 public static function getLanguages()
 {
     $config = Zend_Registry::get('config');
     $langs = array();
     if ($config->webCodeLanguage) {
         $langs[] = $config->webCodeLanguage;
     }
     $possibleUserLanguages = array();
     if ($config->languages) {
         foreach ($config->languages as $lang => $name) {
             $possibleUserLanguages[] = $lang;
         }
     }
     $userModel = Kwf_Registry::get('userModel');
     if (isset($userModel->getAuthedUser()->language) && $userModel->getAuthedUser()->language && in_array($userModel->getAuthedUser()->language, $possibleUserLanguages)) {
         $langs[] = $userModel->getAuthedUser()->language;
     }
     if (Kwf_Component_Data_Root::getComponentClass()) {
         $lngClasses = array();
         foreach (Kwc_Abstract::getComponentClasses() as $c) {
             if (Kwc_Abstract::hasSetting($c, 'baseProperties') && in_array('language', Kwc_Abstract::getSetting($c, 'baseProperties'))) {
                 $lngClasses[] = $c;
             }
         }
         $lngs = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($lngClasses, array('ignoreVisible' => true));
         foreach ($lngs as $c) {
             if (Kwf_Registry::get('acl')->getComponentAcl()->isAllowed($userModel->getAuthedUser(), $c)) {
                 $langs[] = $c->getLanguage();
             }
         }
     }
     return array_unique($langs);
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:33,代码来源:KwfController.php

示例9: getTemplateVars

 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
 {
     $ret = parent::getTemplateVars($renderer);
     $users = Kwf_Registry::get('userModel');
     $showPassword = false;
     //is there a password auth?
     foreach ($users->getAuthMethods() as $auth) {
         if ($auth instanceof Kwf_User_Auth_Interface_Password) {
             $showPassword = true;
         }
     }
     if ($showPassword) {
         //if a redirect auth doesn't allow password hide it
         foreach ($users->getAuthMethods() as $auth) {
             if ($auth instanceof Kwf_User_Auth_Interface_Redirect) {
                 $user = $this->getData()->getChildComponent('-form')->getComponent()->getUserRow();
                 if (!$auth->allowPasswordForUser($user)) {
                     $showPassword = false;
                 }
             }
         }
     }
     $ret['showPassword'] = $showPassword;
     $ret['redirects'] = array();
     foreach ($users->getAuthMethods() as $authKey => $auth) {
         if ($auth instanceof Kwf_User_Auth_Interface_Redirect && $auth->showInFrontend()) {
             $label = $auth->getLoginRedirectLabel();
             $ret['redirects'][] = array('url' => $this->getData()->url, 'code' => $_GET['code'], 'authMethod' => $authKey, 'name' => $this->getData()->trlStaticExecute($label['name']), 'icon' => isset($label['icon']) ? '/assets/' . $label['icon'] : false, 'formOptions' => Kwf_User_Auth_Helper::getRedirectFormOptionsHtml($auth->getLoginRedirectFormOptions()));
         }
     }
     return $ret;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:32,代码来源:Component.php

示例10: getCoordinates

 /**
  * Gibt die Geokoordinaten anhand einer Adresse zurück
  *
  * @param string $address Die Adresse die geocodet werden woll
  * @return array|null $geocode Ein Array mit key 'lat' und 'lng'
  */
 public static function getCoordinates($address)
 {
     $q = $address;
     $q = str_replace(array('ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', 'ß'), array('ae', 'oe', 'ue', 'Ae', 'Oe', 'Ue', 'ss'), $q);
     $getParams = array('address' => $q, 'sensor' => 'false');
     $httpClientConfig = array('timeout' => 20, 'persistent' => false);
     $config = Kwf_Registry::get('config');
     if ($config->http && $config->http->proxy && $config->http->proxy->host && $config->http->proxy->port) {
         $httpClientConfig['adapter'] = 'Zend_Http_Client_Adapter_Proxy';
         $httpClientConfig['proxy_host'] = $config->http->proxy->host;
         $httpClientConfig['proxy_port'] = $config->http->proxy->port;
     }
     $client = new Zend_Http_Client("http://maps.googleapis.com/maps/api/geocode/json", $httpClientConfig);
     $client->setMethod(Zend_Http_Client::GET);
     $client->setParameterGet($getParams);
     $body = utf8_encode($client->request()->getBody());
     try {
         $result = Zend_Json::decode($body);
     } catch (Zend_Json_Exception $e) {
         $e = new Kwf_Exception_Other($e);
         $e->logOrThrow();
     }
     if (isset($result['results'][0]['geometry']['location']['lat']) && isset($result['results'][0]['geometry']['location']['lng'])) {
         return array('lat' => $result['results'][0]['geometry']['location']['lat'], 'lng' => $result['results'][0]['geometry']['location']['lng']);
     }
     return null;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:33,代码来源:Geocode.php

示例11: _initFields

 protected function _initFields()
 {
     parent::_initFields();
     $userEditForm = $this->fields->add(new $this->_userDataFormName('user'));
     $userEditForm->setIdTemplate('{0}');
     $root = Kwf_Component_Data_Root::getInstance();
     if ($root) {
         $userDirectory = $root->getComponentByClass('Kwc_User_Directory_Component');
     }
     if ($root && isset($userDirectory) && $userDirectory) {
         $detailClass = Kwc_Abstract::getChildComponentClass($userDirectory->componentClass, 'detail');
         $userEditForm->addUserForms($detailClass, array('general'));
         $userEditForm->fields['firstname']->setAllowBlank(true);
         $userEditForm->fields['lastname']->setAllowBlank(true);
     } else {
         $this->fields->add(new Kwc_User_Detail_General_Form('general', null))->setIdTemplate('{0}');
     }
     $config = Zend_Registry::get('config');
     $authedUser = Kwf_Registry::get('userModel')->getAuthedUser();
     if (isset($authedUser->language) && $config->languages) {
         $data = array();
         foreach ($config->languages as $key => $value) {
             $data[$key] = $value;
         }
         $this->fields->add(new Kwf_Form_Field_Select('language', trlKwf('Language')))->setValues($data);
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:27,代码来源:Form.php

示例12: testEn

 public function testEn()
 {
     $c = $this->_root->getPageByUrl('http://' . Kwf_Registry::get('config')->server->domain . '/en/test', 'en');
     $this->assertEquals('en', $c->getLanguage());
     $render = $c->render();
     $this->assertContains('trlTest: Visible', $render);
     $this->assertContains('trlcTest: On', $render);
     $this->assertContains('trlpTest1: reply', $render);
     $this->assertContains('trlpTest2: replies', $render);
     $this->assertContains('trlcpTest1: reply', $render);
     $this->assertContains('trlcpTest2: replies', $render);
     $this->assertContains('trlKwfTest: Visible', $render);
     $this->assertContains('trlcKwfTest: On', $render);
     $this->assertContains('trlpKwfTest1: reply', $render);
     $this->assertContains('trlpKwfTest2: replies', $render);
     $this->assertContains('trlcpKwfTest1: reply', $render);
     $this->assertContains('trlcpKwfTest2: replies', $render);
     $this->assertContains('trlTestTpl: Visible', $render);
     $this->assertContains('trlcTestTpl: On', $render);
     $this->assertContains('trlpTest1Tpl: reply', $render);
     $this->assertContains('trlpTest2Tpl: replies', $render);
     $this->assertContains('trlcpTest1Tpl: reply', $render);
     $this->assertContains('trlcpTest2Tpl: replies', $render);
     $this->assertContains('trlKwfTestTpl: Visible', $render);
     $this->assertContains('trlcKwfTestTpl: On', $render);
     $this->assertContains('trlpKwfTest1Tpl: reply', $render);
     $this->assertContains('trlpKwfTest2Tpl: replies', $render);
     $this->assertContains('trlcpKwfTest1Tpl: reply', $render);
     $this->assertContains('trlcpKwfTest2Tpl: replies', $render);
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:30,代码来源:Test.php

示例13: update

 public function update()
 {
     $db = Kwf_Registry::get('db');
     if (!$db->fetchOne("SHOW FIELDS FROM kwc_fulltext_meta LIKE 'changed_recursive'")) {
         $db->query('ALTER TABLE  `kwc_fulltext_meta` ADD  `changed_recursive` TINYINT NOT NULL');
     }
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:7,代码来源:20150309Legacy38003.php

示例14: __construct

 public function __construct(array $config = array())
 {
     if (!empty($config['client'])) {
         $this->_client = $config['client'];
     } else {
         if (!empty($config['serverUrl'])) {
             $this->_serverUrl = $config['serverUrl'];
         } else {
             if (!empty($config['serverConfig'])) {
                 $this->_serverConfig = $config['serverConfig'];
             }
         }
     }
     // wenn aus config verwendet, z.B.: service.xxx.url
     if ($this->_serverConfig && !$this->_serverUrl) {
         $cfg = Kwf_Registry::get('config');
         $this->_serverUrl = $cfg->service->{$this->_serverConfig}->url;
         if ($cfg->service->{$this->_serverConfig}->proxy) {
             if (!empty($cfg->service->{$this->_serverConfig}->proxy->host)) {
                 $config['proxyHost'] = $cfg->service->{$this->_serverConfig}->proxy->host;
             }
             if (!empty($cfg->service->{$this->_serverConfig}->proxy->port)) {
                 $config['proxyPort'] = $cfg->service->{$this->_serverConfig}->proxy->port;
             }
             if (!empty($cfg->service->{$this->_serverConfig}->proxy->user)) {
                 $config['proxyUser'] = $cfg->service->{$this->_serverConfig}->proxy->user;
             }
             if (!empty($cfg->service->{$this->_serverConfig}->proxy->password)) {
                 $config['proxyPassword'] = $cfg->service->{$this->_serverConfig}->proxy->password;
             }
         }
     }
     if ($this->_serverUrl) {
         $srpcClientConfig = array('serverUrl' => $this->_serverUrl);
         if (!empty($config['proxyHost'])) {
             $srpcClientConfig['proxyHost'] = $config['proxyHost'];
         }
         if (!empty($config['proxyPort'])) {
             $srpcClientConfig['proxyPort'] = $config['proxyPort'];
         }
         if (!empty($config['proxyUser'])) {
             $srpcClientConfig['proxyUser'] = $config['proxyUser'];
         }
         if (!empty($config['proxyPassword'])) {
             $srpcClientConfig['proxyPassword'] = $config['proxyPassword'];
         }
         $this->_client = new Kwf_Srpc_Client($srpcClientConfig);
     }
     $this->_init();
     if (!$this->_client) {
         throw new Kwf_Exception("No client or serverUrl has been set in '" . get_class($this) . "'");
     } else {
         if (!$this->_client instanceof Kwf_Srpc_Client) {
             throw new Kwf_Exception("Client must be of type 'Kwf_Srpc_Client' in '" . get_class($this) . "'");
         }
     }
     if (!empty($config['timeout']) && is_integer($config['timeout'])) {
         $this->_client->setTimeout($config['timeout']);
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:60,代码来源:Service.php

示例15: preProcessInput

 public function preProcessInput()
 {
     //use custom user model
     Kwf_Registry::get('config')->user->model = 'Kwc_FavouritesSelenium_UserModel';
     //unset existing userModel instance to get new one
     $reg = Kwf_Registry::getInstance()->set('userModel', Kwf_Model_Abstract::getInstance('Kwc_FavouritesSelenium_UserModel'));
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:7,代码来源:Component.php


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