• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CM_Params类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _execute

 protected function _execute(CM_Params $params)
 {
     $id = $params->getInt('id');
     $values = $params->getArray('values');
     $svm = new CM_SVM_Model($id);
     return $svm->predict($values);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:7,代码来源:PredictJob.php


示例2: _execute

 protected function _execute(CM_Params $params)
 {
     $propertyId = $params->getString('propertyId');
     $parameterList = $params->getArray('parameterList');
     $client = new CMService_GoogleAnalytics_MeasurementProtocol_Client($propertyId);
     $client->_submitHit($parameterList);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:7,代码来源:SendHitJob.php


示例3: _execute

 protected function _execute(CM_Params $params)
 {
     $user = $params->getUser('user');
     if (null === CM_Model_StreamChannel_Message_User::findByUser($user)) {
         $user->setOnline(false);
     }
 }
开发者ID:cargomedia,项目名称:cm,代码行数:7,代码来源:OfflineJob.php


示例4: prepare

 public function prepare(CM_Params $renderParams, CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse)
 {
     $text = $this->getParams()->has('text') ? $renderParams->getString('text') : null;
     $skipDropZone = $renderParams->getBoolean('skipDropZone', false);
     $viewResponse->set('text', $text);
     $viewResponse->set('skipDropZone', $skipDropZone);
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:7,代码来源:File.php


示例5: _execute

 protected function _execute(CM_Params $params)
 {
     $id = $params->getInt('id');
     $class = $params->getInt('class');
     $values = $params->getArray('values');
     $svm = new CM_SVM_Model($id);
     $svm->addTraining($class, $values);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:8,代码来源:AddTrainingJob.php


示例6: ajax_loadComponent

 public function ajax_loadComponent(CM_Params $params, CM_Frontend_JavascriptContainer_View $handler, CM_Http_Response_View_Ajax $response)
 {
     $className = $params->getString('className');
     $params->remove('className');
     if (!class_exists($className)) {
         throw new CM_Exception_Invalid('Class not found', CM_Exception::WARN, ['className' => $className]);
     }
     return $response->loadComponent($className, $params);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:9,代码来源:Abstract.php


示例7: _execute

 protected function _execute(CM_Params $params)
 {
     $indexClassName = $params->getString('indexClassName');
     $id = $params->getString('id');
     /** @var CM_Elasticsearch_Type_Abstract $index */
     $index = new $indexClassName();
     $index->update(array($id));
     $index->getIndex()->refresh();
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:9,代码来源:UpdateDocumentJob.php


示例8: ajax_flushLog

 public function ajax_flushLog(CM_Params $params, CM_Frontend_JavascriptContainer $handler, CM_Http_Response_View_Ajax $response)
 {
     if (!$this->_getAllowedFlush($response->getRender()->getEnvironment())) {
         throw new CM_Exception_NotAllowed();
     }
     $type = $params->getInt('type');
     $logList = CM_Paging_Log_Abstract::factory($type);
     $logList->flush();
     $response->reloadComponent();
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:10,代码来源:LogList.php


示例9: _execute

 protected function _execute(CM_Params $params)
 {
     $code = $params->getString('code');
     $identityList = $params->getArray('identityList');
     $eventName = $params->getString('eventName');
     $propertyList = $params->getArray('propertyList');
     $kissMetrics = new CMService_KissMetrics_Client($code);
     $kissMetrics->setIdentityList($identityList);
     $kissMetrics->trackEvent($eventName, $propertyList);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:10,代码来源:TrackEventJob.php


示例10: _execute

 protected function _execute(CM_Params $params)
 {
     $indexClassName = $params->getString('indexClassName');
     $id = $params->getString('id');
     $client = CM_Service_Manager::getInstance()->getElasticsearch()->getClient();
     /** @var CM_Elasticsearch_Type_Abstract $index */
     $index = new $indexClassName($client);
     $index->updateDocuments(array($id));
     $index->refreshIndex();
 }
开发者ID:cargomedia,项目名称:cm,代码行数:10,代码来源:UpdateDocumentJob.php


示例11: ajax_getSuggestionByCoordinates

 public function ajax_getSuggestionByCoordinates(CM_Params $params, CM_Frontend_JavascriptContainer_View $handler, CM_Http_Response_View_Ajax $response)
 {
     $lat = $params->getFloat('lat');
     $lon = $params->getFloat('lon');
     $location = CM_Model_Location::findByCoordinates($lat, $lon);
     $location = $this->_squashLocationInConstraints($location);
     if (!$location) {
         throw new CM_Exception('Cannot find a location by coordinates `' . $lat . '` / `' . $lon . '`.');
     }
     return $this->getSuggestion($location, $response->getRender());
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:11,代码来源:Location.php


示例12: prepare

 public function prepare(CM_Params $renderParams, CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse)
 {
     $text = $renderParams->has('text') ? $renderParams->getString('text') : null;
     $buttonTheme = $this->_params->getString('buttonTheme', 'default');
     $skipPreviews = $this->_params->getBoolean('skipPreviews', false);
     $viewResponse->set('text', $text);
     $viewResponse->set('buttonTheme', $buttonTheme);
     if ($skipPreviews) {
         $viewResponse->setDataAttributes(['skip-previews' => '']);
     }
 }
开发者ID:cargomedia,项目名称:cm,代码行数:11,代码来源:File.php


示例13: ajax_flushLog

 public function ajax_flushLog(CM_Params $params, CM_Frontend_JavascriptContainer $handler, CM_Http_Response_View_Ajax $response)
 {
     if (!$this->_getAllowedFlush($response->getRender()->getEnvironment())) {
         throw new CM_Exception_NotAllowed();
     }
     $level = $params->has('level') ? $params->getInt('level') : null;
     $levelList = $level ? [$level] : null;
     $type = $params->has('type') ? $params->getInt('type') : null;
     $logList = new CM_Paging_Log($levelList, $type);
     $logList->flush();
     $response->reloadComponent();
 }
开发者ID:cargomedia,项目名称:cm,代码行数:12,代码来源:LogList.php


示例14: _processView

 protected function _processView(array $output)
 {
     $success = array();
     $form = $this->_getView();
     $className = get_class($form);
     if (!$form instanceof CM_Form_Abstract) {
         throw new CM_Exception_Invalid('`' . $className . '`is not `CM_Form_Abstract` instance');
     }
     $query = $this->_request->getQuery();
     $actionName = (string) $query['actionName'];
     $data = (array) $query['data'];
     $this->_setStringRepresentation($className . '::' . $actionName);
     $success['data'] = CM_Params::encode($form->process($data, $actionName, $this));
     if (!empty($this->errors)) {
         $success['errors'] = $this->errors;
     }
     $jsCode = $this->getRender()->getGlobalResponse()->getJs();
     if (!empty($jsCode)) {
         $success['exec'] = $jsCode;
     }
     if (!empty($this->messages)) {
         $success['messages'] = $this->messages;
     }
     $output['success'] = $success;
     return $output;
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:26,代码来源:Form.php


示例15: testProcessTranslationsEnableKey

 public function testProcessTranslationsEnableKey()
 {
     $language = CMTest_TH::createLanguage('test');
     $languageKey = CM_Model_LanguageKey::create('Hello World');
     $this->assertSame(false, $languageKey->getJavascript());
     $site = CM_Site_Abstract::factory();
     $render = new CM_Frontend_Render(new CM_Frontend_Environment(null, null, $language));
     // Check that key is *not* included in the JS translations list
     $versionJavascript = CM_Model_Language::getVersionJavascript();
     $request = new CM_Http_Request_Get($render->getUrlResource('library-js', "translations/{$versionJavascript}.js"));
     $response = CM_Http_Response_Resource_Javascript_Library::createFromRequest($request, $site, $this->getServiceManager());
     $response->process();
     $this->assertNotContains('Hello World', $response->getContent());
     // Request JS-enabling of language key via RPC call
     $body = CM_Params::jsonEncode(['method' => 'CM_Model_Language.requestTranslationJs', 'params' => ['Hello World']]);
     $request = new CM_Http_Request_Post('/rpc', null, null, $body);
     $response = CM_Http_Response_RPC::createFromRequest($request, $site, $this->getServiceManager());
     $response->process();
     CMTest_TH::reinstantiateModel($languageKey);
     $this->assertSame(true, $languageKey->getJavascript());
     // Check that key *is* included in the JS translations list
     $versionJavascript = CM_Model_Language::getVersionJavascript();
     $request = new CM_Http_Request_Get($render->getUrlResource('library-js', "translations/{$versionJavascript}.js"));
     $response = CM_Http_Response_Resource_Javascript_Library::createFromRequest($request, $site, $this->getServiceManager());
     $response->process();
     $this->assertContains('Hello World', $response->getContent());
 }
开发者ID:cargomedia,项目名称:cm,代码行数:27,代码来源:LibraryTest.php


示例16: __construct

 /**
  * @param CM_Params|array|null $params
  */
 public function __construct($params = null)
 {
     if (!$params instanceof CM_Params) {
         $params = CM_Params::factory($params, false);
     }
     $this->_params = $params;
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:10,代码来源:Abstract.php


示例17: publish

 /**
  * @param string     $channel
  * @param string     $event
  * @param mixed|null $data
  */
 public function publish($channel, $event, $data = null)
 {
     if (!$this->getEnabled()) {
         return;
     }
     $this->getAdapter()->publish($channel, $event, CM_Params::encode($data));
 }
开发者ID:cargomedia,项目名称:cm,代码行数:12,代码来源:Service.php


示例18: debug

 /**
  * @param mixed $varList
  */
 public function debug($varList)
 {
     foreach ($varList as &$var) {
         $var = CM_Params::encode($var, true);
     }
     $this->_operations[] = 'this.message(' . implode(', ', $varList) . ');';
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:10,代码来源:View.php


示例19: _processView

 protected function _processView(array $output)
 {
     $success = array();
     $query = $this->_request->getQuery();
     if (!isset($query['method'])) {
         throw new CM_Exception_Invalid('No method specified', CM_Exception::WARN);
     }
     if (!preg_match('/^[\\w_]+$/i', $query['method'])) {
         throw new CM_Exception_Invalid('Illegal method', CM_Exception::WARN, ['method' => $query['method']]);
     }
     if (!isset($query['params']) || !is_array($query['params'])) {
         throw new CM_Exception_Invalid('Illegal params', CM_Exception::WARN);
     }
     $view = $this->_getView();
     if ($view instanceof CM_View_CheckAccessibleInterface) {
         $view->checkAccessible($this->getRender()->getEnvironment());
     }
     $ajaxMethodName = 'ajax_' . $query['method'];
     $params = CM_Params::factory($query['params'], true);
     $componentHandler = new CM_Frontend_JavascriptContainer_View();
     $this->_setStringRepresentation(get_class($view) . '::' . $ajaxMethodName);
     if (!method_exists($view, $ajaxMethodName)) {
         throw new CM_Exception_Invalid('Method not found', CM_Exception::WARN, ['method' => $ajaxMethodName]);
     }
     $data = $view->{$ajaxMethodName}($params, $componentHandler, $this);
     $success['data'] = CM_Params::encode($data);
     $frontend = $this->getRender()->getGlobalResponse();
     $frontend->getOnloadReadyJs()->append($componentHandler->compile('this'));
     $jsCode = $frontend->getJs();
     if (strlen($jsCode)) {
         $success['exec'] = $jsCode;
     }
     $output['success'] = $success;
     return $output;
 }
开发者ID:cargomedia,项目名称:cm,代码行数:35,代码来源:Ajax.php


示例20: __construct

 /**
  * @param CM_Model_Language $language
  */
 public function __construct(CM_Model_Language $language)
 {
     $translations = array();
     foreach (new CM_Paging_Translation_Language($language, null, null, null, true) as $translation) {
         $translations[$translation['key']] = $language->getTranslation($translation['key']);
     }
     $this->_content = 'cm.language.setAll(' . CM_Params::encode($translations, true) . ');';
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:11,代码来源:Translations.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CM_Service_Manager类代码示例发布时间:2022-05-23
下一篇:
PHP CM_Db_Db类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap