本文整理汇总了PHP中jClasses::create方法的典型用法代码示例。如果您正苦于以下问题:PHP jClasses::create方法的具体用法?PHP jClasses::create怎么用?PHP jClasses::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jClasses
的用法示例。
在下文中一共展示了jClasses::create方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createInstance
protected function _createInstance()
{
if ($this->toSelector === null) {
$this->instance = null;
$this->toSelector = $this->_getClassSelector();
}
return jClasses::create($this->toSelector->toString());
}
示例2: _prepareTpl
/**
* function to manage data before assigning to the template of its zone
*/
protected function _prepareTpl()
{
list($nbAnonymous, $members, $bots) = jClasses::create('activeusers~connectedusers')->getConnectedList();
$this->_tpl->assign('nbAnonymous', $nbAnonymous);
$this->_tpl->assign('members', $members);
$this->_tpl->assign('nbMembers', count($members));
$this->_tpl->assign('bots', $bots);
}
示例3: verifyPassword
public function verifyPassword($login, $password)
{
if (trim($password) == '') {
return false;
}
$classuser = jClasses::create($this->_params['class']);
$user = $classuser->getByLoginPassword($login, $this->cryptPassword($password));
return $user ? $user : false;
}
示例4: _prepareTpl
/**
* function to manage data before assigning to the template of its zone
*/
protected function _prepareTpl()
{
$today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
list($nbAnonymous, $members, $bots) = jClasses::create('activeusers~connectedusers')->getConnectedList($today, true);
$this->_tpl->assign('nbAnonymous', $nbAnonymous);
$this->_tpl->assign('members', $members);
$this->_tpl->assign('nbMembers', count($members));
$this->_tpl->assign('bots', $bots);
}
示例5: getInstance
/**
* Get the binded instance
*
* @return mixed
*/
public function getInstance()
{
if ($this->instance === null) {
if ($this->toSelector === null) {
$this->toSelector = $this->_getClassSelector();
}
$this->instance = jClasses::create($this->toSelector->toString());
}
return $this->instance;
}
示例6: testBindingInCodeToInstance
public function testBindingInCodeToInstance()
{
$instance = jClasses::create('jelix_tests~myclass');
jClasses::bind('jelix_tests~test')->toInstance($instance);
$class = jClasses::getBindedService('jelix_tests~test');
$this->assertTrue($class instanceof myclass);
jClasses::bind('jelix_tests~test')->toInstance($instance);
$classname = jClasses::bind('jelix_tests~test')->getClassName();
$this->assertTrue($classname === 'myclass');
}
示例7: _prepareTpl
/**
* function to manage data before assigning to the template of its zone
*/
protected function _prepareTpl()
{
$login = $this->param('login');
$status = 'offline';
if ($login) {
if (jClasses::create('connectedusers')->isConnected($login)) {
$status = 'online';
} else {
$status = 'offline';
}
}
$this->_tpl->assign('status', $status);
}
示例8: save
function save()
{
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
$form = jForms::fill('config');
if (!$form) {
return $rep;
}
if (!$form->check()) {
return $rep;
}
$activeusers = jClasses::create('activeusers~connectedusers');
try {
$activeusers->saveVisitTimeout($form->getData('timeout_visit'));
jMessage::add(jLocale::get('main.config.save.ok'));
} catch (Exception $e) {
jMessage::add('Error: ' . $e->getMessage(), 'error');
}
return $rep;
}
示例9: verifyPassword
public function verifyPassword($login, $password)
{
if (trim($password) == '') {
return false;
}
$class = jClasses::create($this->_params['class']);
$user = $class->getByLogin($login);
if (!$user) {
return false;
}
$result = $this->checkPassword($password, $user->password);
if ($result === false) {
return false;
}
if ($result !== true) {
// it is a new hash for the password, let's update it persistently
$user->password = $result;
$class->updatePassword($login, $result);
}
return $user;
}
示例10: single
function single()
{
$rep = $this->_prepareResponse();
$module = $this->param('mod');
$testname = $this->param('test');
$category = $this->category ? ' ' . $this->category : '';
if (isset($this->testsList[$module])) {
$reporter = jClasses::create($this->responseType);
jClasses::inc('junittests~junittestcase');
jClasses::inc('junittests~junittestcasedb');
$reporter->setResponse($rep);
foreach ($this->testsList[$module] as $test) {
if ($test[1] == $testname) {
$group = new TestSuite('"' . $module . '" module , ' . $test[2]);
$group->addFile(jApp::config()->_modulesPathList[$module] . 'tests/' . $test[0]);
jApp::pushCurrentModule($module);
$result = $group->run($reporter);
if (!$result) {
$rep->setExitCode(jResponseCmdline::EXIT_CODE_ERROR);
}
jApp::popCurrentModule();
break;
}
}
} else {
$this->output("\n" . 'no' . $category . ' tests for "' . $module . '" module.' . "\n");
}
return $this->_finishResponse($rep);
}
示例11: onservinfoGetInfo
function onservinfoGetInfo($event)
{
$nbMembers = jClasses::create('activeusers~connectedusers')->getCount();
$label = jLocale::get('activeusers_admin~main.server.infos.online.users');
$event->add(new serverinfoData('user-online', $label, $nbMembers));
}
示例12: single
function single()
{
$rep = $this->_prepareResponse();
$module = $this->param('mod');
$testname = $this->param('test');
if (isset($this->testsList[$module])) {
$reporter = jClasses::create("junittests~jtextrespreporter");
jClasses::inc('junittests~junittestcase');
jClasses::inc('junittests~junittestcasedb');
$reporter->setResponse($rep);
foreach ($this->testsList[$module] as $test) {
if ($test[1] == $testname) {
$group = new GroupTest('"' . $module . '" module , ' . $test[2]);
$group->addTestFile($GLOBALS['gJConfig']->_modulesPathList[$module] . 'tests/' . $test[0]);
jContext::push($module);
$result = $group->run($reporter);
if (!$result) {
$rep->setExitCode(jResponseCmdline::EXIT_CODE_ERROR);
}
jContext::pop();
break;
}
}
} else {
$rep->addContent("\n" . 'no tests for "' . $module . '" module.' . "\n");
}
return $this->_finishResponse($rep);
}
示例13: _prepareResponse
protected function _prepareResponse()
{
$rep = $this->getResponse('html', true);
$rep->bodyTpl = 'junittests~main';
$rep->body->assign('page_title', 'Unit Tests');
$rep->body->assign('versionphp', phpversion());
$rep->body->assign('versionjelix', JELIX_VERSION);
$rep->body->assign('basepath', jApp::config()->urlengine['basePath']);
$rep->body->assign('isurlsig', jApp::config()->urlengine['engine'] == 'significant');
$runnerPreparer = jClasses::create('junittests~jrunnerpreparer');
$this->allTestsList = $runnerPreparer->getTestsList('html');
$this->category = $this->param('categ', false);
$this->testsList = $runnerPreparer->filterTestsByCategory($this->category, $this->allTestsList);
$rep->body->assign('modules', $this->allTestsList);
return $rep;
}
示例14: single
function single()
{
if (!isset($GLOBALS['gJConfig']->enableTests) || !$GLOBALS['gJConfig']->enableTests) {
// security
$rep = $this->getResponse('html', true);
$rep->title = 'Error';
$rep->setHttpStatus('404', 'Not found');
$rep->addContent('<p>404 Not Found</p>');
return $rep;
}
$rep = $this->_prepareResponse();
$module = $this->param('mod');
$testname = $this->param('test');
if (isset($this->testsList[$module])) {
$reporter = jClasses::create("junittests~jhtmlrespreporter");
jClasses::inc('junittests~junittestcase');
jClasses::inc('junittests~junittestcasedb');
$reporter->setResponse($rep);
foreach ($this->testsList[$module] as $test) {
if ($test[1] == $testname) {
$group = new GroupTest('"' . $module . '" module , ' . $test[2]);
$group->addTestFile($GLOBALS['gJConfig']->_modulesPathList[$module] . 'tests/' . $test[0]);
jContext::push($module);
$group->run($reporter);
jContext::pop();
break;
}
}
} else {
$rep->body->assign('MAIN', '<p>no tests for "' . $module . '" module.</p>');
}
return $this->_finishResponse($rep);
}