本文整理汇总了PHP中jClasses::inc方法的典型用法代码示例。如果您正苦于以下问题:PHP jClasses::inc方法的具体用法?PHP jClasses::inc怎么用?PHP jClasses::inc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jClasses
的用法示例。
在下文中一共展示了jClasses::inc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCall
public function testCall()
{
jClasses::inc('jelix_tests~testCache');
$myClass = new testCache();
$returnData = jCache::call(array('testCache', 'staticMethod'), array(1, 2), 0, $this->profile);
$this->assertTrue($returnData == 3);
$dataCached = jCache::get(md5(serialize(array('testCache', 'staticMethod')) . serialize(array(1, 2))), $this->profile);
$this->assertTrue($dataCached == $returnData);
try {
jCache::call(array('testCache', 'missingStaticMethod'), null, 0, $this->profile);
$this->fail();
} catch (jException $e) {
$this->pass();
}
$returnData = jCache::call(array($myClass, 'method'), array(1, 2), 0, $this->profile);
$this->assertTrue($returnData == 3);
$dataCached = jCache::get(md5(serialize(array($myClass, 'method')) . serialize(array(1, 2))), $this->profile);
$this->assertTrue($dataCached == $returnData);
try {
jCache::call(array($myClass, 'missingMethod'), null, 0, $this->profile);
$this->fail();
} catch (jException $e) {
$this->pass();
}
$returnData = jCache::call('testFunction', array(1, 2), 0, $this->profile);
$this->assertTrue($returnData == 3);
$dataCached = jCache::get(md5(serialize('testFunction') . serialize(array(1, 2))), $this->profile);
$this->assertTrue($dataCached == $returnData);
try {
jCache::call('testFunction_missing', null, 0, $this->profile);
$this->fail();
} catch (jException $e) {
$this->pass();
}
}
示例2: _prepareTpl
protected function _prepareTpl()
{
jClasses::inc('masterAdminMenuItem');
$menu = array();
$menu['toplinks'] = new masterAdminMenuItem('toplinks', '', '');
$dashboard = new masterAdminMenuItem('dashboard', jLocale::get('gui.menu.item.dashboard'), jUrl::get('default:index'));
$dashboard->icon = $GLOBALS['gJConfig']->urlengine['jelixWWWPath'] . 'design/images/dashboard.png';
$menu['toplinks']->childItems[] = $dashboard;
$menu['system'] = new masterAdminMenuItem('system', jLocale::get('gui.menu.item.system'), '', 100);
$items = jEvent::notify('masteradminGetMenuContent')->getResponse();
foreach ($items as $item) {
if ($item->parentId) {
if (!isset($menu[$item->parentId])) {
$menu[$item->parentId] = new masterAdminMenuItem($item->parentId, '', '');
}
$menu[$item->parentId]->childItems[] = $item;
} else {
if (isset($menu[$item->id])) {
$menu[$item->id]->copyFrom($item);
} else {
$menu[$item->id] = $item;
}
}
}
usort($menu, "masterAdminItemSort");
foreach ($menu as $topitem) {
usort($topitem->childItems, "masterAdminItemSort");
}
$this->_tpl->assign('menuitems', $menu);
$this->_tpl->assign('selectedMenuItem', $this->param('selectedMenuItem', ''));
}
示例3: _prepareTpl
/**
* function to manage data before assigning to the template of its zone
*/
protected function _prepareTpl()
{
jClasses::inc('havefnubb~hfnuMenuItem');
$admin = jAcl2::check('hfnu.admin.index');
$menu = array();
$items = jEvent::notify('hfnuGetMenuContent', array('admin' => $admin))->getResponse();
foreach ($items as $item) {
if ($item->parentId) {
if (!isset($menu[$item->parentId])) {
$menu[$item->parentId] = new hfnuMenuItem($item->parentId, '', '');
}
$menu[$item->parentId]->childItems[] = $item;
} else {
if (isset($menu[$item->id])) {
$menu[$item->id]->copyFrom($item);
} else {
$menu[$item->id] = $item;
}
}
}
usort($menu, "hfnuItemSort");
foreach ($menu as $topitem) {
usort($topitem->childItems, "hfnuItemSort");
}
$this->_tpl->assign('menuitems', $menu);
$this->_tpl->assign('selectedMenuItem', $this->param('selectedMenuItem', ''));
}
示例4: _prepareTpl
protected function _prepareTpl()
{
jClasses::inc('masterAdminMenuItem');
$items = jEvent::notify('masteradminGetInfoBoxContent')->getResponse();
usort($items, "masterAdminItemSort");
$this->_tpl->assign('infoboxitems', $items);
$this->_tpl->assign('user', jAuth::getUserSession());
}
示例5: beforeAction
/**
* @param array $params plugin parameters for the current action
* @return null or jSelectorAct if action should change
*/
public function beforeAction($params)
{
$selector = null;
$floodok = true;
if (isset($params['check.flood']) && $params['check.flood'] && $this->config['time_interval']) {
jClasses::inc('havefnubb~flood');
$hasflood = flood::check($this->config['time_interval'], $this->config['only_same_ip']);
if ($hasflood) {
if ($this->config['on_error'] == 1 || !jApp::coord()->request->isAllowedResponse('jResponseRedirect')) {
throw new jException("havefnubb~flood.elapsed_time_between_two_post");
} else {
$selector = new jSelectorAct($this->config['on_error_action']);
}
}
}
return $selector;
}
示例6: _prepareTpl
protected function _prepareTpl()
{
jClasses::inc('masterAdminMenuItem');
$menu = array();
$menu['toplinks'] = new masterAdminMenuItem('toplinks', '', '');
if (!isset(jApp::config()->master_admin['disable_dashboard_menu']) || !jApp::config()->master_admin['disable_dashboard_menu']) {
$dashboard = new masterAdminMenuItem('dashboard', jLocale::get('gui.menu.item.dashboard'), jUrl::get('default:index'));
$dashboard->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/dashboard.png';
$menu['toplinks']->childItems[] = $dashboard;
}
$menu['refdata'] = new masterAdminMenuItem('refdata', jLocale::get('gui.menu.item.refdata'), '', 80);
$menu['system'] = new masterAdminMenuItem('system', jLocale::get('gui.menu.item.system'), '', 100);
$items = jEvent::notify('masteradminGetMenuContent')->getResponse();
foreach ($items as $item) {
if ($item->parentId) {
if (!isset($menu[$item->parentId])) {
$menu[$item->parentId] = new masterAdminMenuItem($item->parentId, '', '');
}
$isRedefining = false;
foreach ($menu[$item->parentId]->childItems as $child) {
if ($child->id == $item->id) {
$child->copyFrom($item);
$isRedefining = true;
break;
}
}
if (!$isRedefining) {
$menu[$item->parentId]->childItems[] = $item;
}
} else {
if (isset($menu[$item->id])) {
$menu[$item->id]->copyFrom($item);
} else {
$menu[$item->id] = $item;
}
}
}
usort($menu, "masterAdminItemSort");
foreach ($menu as $topitem) {
usort($topitem->childItems, "masterAdminItemSort");
}
$this->_tpl->assign('menuitems', $menu);
$this->_tpl->assign('selectedMenuItem', $this->param('selectedMenuItem', ''));
}
示例7: onHfnuSearchEngineDeleteContent
function onHfnuSearchEngineDeleteContent($event)
{
$id = $event->getParam('id');
$dataSource = $event->getParam('datasource');
if ($id == '' or $dataSource == '') {
return;
}
$strId = '';
if (is_array($id)) {
for ($i = 0; $i < count($id); $i++) {
$strId .= $id[$i];
}
} else {
$strId = $id;
}
jClasses::inc('hfnusearch~search_index');
$service = new search_index($strId, $ds);
$service->searchEngineDelete();
}
示例8: beforeAction
/**
* @param array $params plugin parameters for the current action
* @return null or jSelectorAct if action should change
*/
public function beforeAction($params)
{
$selector = null;
$banok = false;
if (isset($params['banuser.check'])) {
jClasses::inc('havefnubb~bans');
$banok = bans::check();
}
if ($banok) {
// disconnect the user if he was connected
jAuth::logout();
if ($this->config['on_error'] == 1 || !jApp::coord()->request->isAllowedResponse('jResponseRedirect')) {
throw new jException(jLocale::get("havefnubb~ban.you.are.banned"));
} else {
$selector = new jSelectorAct($this->config['on_error_action']);
}
}
return $selector;
}
示例9: getcapabilities
protected function getcapabilities()
{
//Get Cache
$cacheId = $this->repository->getKey() . '_' . $this->project->getKey() . '_WMTS';
$hash = jCache::get($cacheId . '_hash');
$newhash = md5_file(realpath($this->repository->getPath()) . '/' . $this->project->getKey() . ".qgs");
$tileMatrixSetList = jCache::get($cacheId . '_tilematrixsetlist');
$layers = jCache::get($cacheId . '_layers');
if (!$tileMatrixSetList || !$layers || $hash != $newhash) {
$wmsRequest = new lizmapWMSRequest($this->project, array('service' => 'WMS', 'request' => 'GetCapabilities'));
$wmsResult = $wmsRequest->process();
$wms = $wmsResult->data;
$wms_xml = simplexml_load_string($wms);
$wms_xml->registerXPathNamespace("wms", "http://www.opengis.net/wms");
$wms_xml->registerXPathNamespace("xlink", "http://www.w3.org/1999/xlink");
jClasses::inc("lizmap~lizmapTiler");
$tileMatrixSetList = lizmapTiler::getTileMatrixSetList($this->project, $wms_xml);
$cfgLayers = $this->project->getLayers();
$layers = array();
foreach ($cfgLayers as $n => $l) {
$cfgl = $l;
if ($l->cached == 'True' && $l->singleTile != 'True' && strtolower($l->name) != 'overview') {
$layers[] = lizmapTiler::getLayerTileInfo($l->name, $this->project, $wms_xml, $tileMatrixSetList);
}
}
jCache::set($cacheId . '_hash', $newhash, 3600);
jCache::set($cacheId . '_tilematrixsetlist', $tileMatrixSetList, 3600);
jCache::set($cacheId . '_layers', $layers, 3600);
}
$sUrl = jUrl::getFull("lizmap~service:index", array("repository" => $this->repository->getKey(), "project" => $this->project->getKey()));
$tpl = new jTpl();
$tpl->assign('url', $sUrl);
$tpl->assign('repository', $this->param('repository'));
$tpl->assign('project', $this->param('project'));
$tpl->assign('tileMatrixSetList', $tileMatrixSetList);
$tpl->assign('layers', $layers);
return (object) array('code' => 200, 'mime' => 'text/xml', 'data' => $tpl->fetch('lizmap~wmts_capabilities'), 'cached' => False);
}
示例10: getProjects
public function getProjects()
{
$projects = array();
if ($dh = opendir($this->getPath())) {
$cfgFiles = array();
$qgsFiles = array();
while (($file = readdir($dh)) !== false) {
if (substr($file, -3) == 'cfg') {
$cfgFiles[] = $file;
}
if (substr($file, -3) == 'qgs') {
$qgsFiles[] = $file;
}
}
closedir($dh);
jClasses::inc('lizmap~lizmapProject');
foreach ($qgsFiles as $qgsFile) {
if (in_array($qgsFile . '.cfg', $cfgFiles)) {
$projects[] = new lizmapProject(substr($qgsFile, 0, -4), $this);
}
}
}
return $projects;
}
示例11: 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);
}
示例12: __construct
<?php
/**
* Manage OGC request.
* @package lizmap
* @subpackage lizmap
* @author 3liz
* @copyright 2015 3liz
* @link http://3liz.com
* @license Mozilla Public License : http://www.mozilla.org/MPL/
*/
jClasses::inc('lizmap~lizmapProxy');
class lizmapOGCRequest
{
protected $project = null;
protected $repository = null;
protected $params = null;
protected $services = null;
protected $tplExceptions = null;
/**
* constructor
* project : the project has a lizmapProject Class
* params : the params array
*/
public function __construct($project, $params)
{
//print_r( $project != null );
$this->project = $project;
$this->repository = $project->getRepository();
$this->services = lizmap::getServices();
$params['map'] = realpath($this->repository->getPath()) . '/' . $project->getKey() . ".qgs";
示例13: addFormControls
/**
* Dynamically add controls to the form based on QGIS layer information
*
* @param object $form Jelix form to add controls to.
* @return modified form.
*/
private function addFormControls($form)
{
// Get fields data from the edition database
$layerXmlZero = $this->layerXml[0];
$_datasource = $layerXmlZero->xpath('datasource');
$datasource = (string) $_datasource[0];
$s_provider = $layerXmlZero->xpath('provider');
$this->provider = (string) $s_provider[0];
$this->getDataFields($datasource);
// Get QGIS fields extra information from XML for the layer
// edittypes and categories
$edittypesXml = $layerXmlZero->edittypes[0];
$_categoriesXml = $layerXmlZero->xpath('renderer-v2/categories');
$categoriesXml = Null;
if (isset($_categoriesXml[0])) {
$categoriesXml = $_categoriesXml[0];
}
// Get proj4 string
$proj4 = (string) $layerXmlZero->srs->spatialrefsys->proj4;
$this->proj4 = $proj4;
// Get layer srid
$srid = (int) $layerXmlZero->srs->spatialrefsys->srid;
$this->srid = $srid;
// Loop through the table fields
// and create a form control if needed
jClasses::inc('lizmap~qgisFormControl');
$this->formControls = array();
$layerName = $this->layerName;
$capabilities = $this->project->getEditionLayers()->{$layerName}->capabilities;
$toDeactivate = array();
$toSetReadOnly = array();
foreach ($this->dataFields as $fieldName => $prop) {
// Create new control from qgis edit type
$aliasXml = Null;
if ($layerXmlZero->aliases) {
$aliasesZero = $layerXmlZero->aliases[0];
$aliasXml = $aliasesZero->xpath("alias[@field='{$fieldName}']");
}
$edittype = null;
if ($edittypesXml) {
$edittype = $edittypesXml->xpath("edittype[@name='{$fieldName}']");
}
$this->formControls[$fieldName] = new qgisFormControl($fieldName, $edittype, $aliasXml, $categoriesXml, $prop);
if (($this->formControls[$fieldName]->fieldEditType == 15 or $this->formControls[$fieldName]->fieldEditType == 'ValueRelation') and $this->formControls[$fieldName]->valueRelationData) {
// Fill comboboxes of editType "Value relation" from relation layer
// Query QGIS Server via WFS
$this->fillControlFromValueRelationLayer($fieldName);
} else {
if ($this->formControls[$fieldName]->fieldEditType == 8 or $this->formControls[$fieldName]->fieldEditType == 'FileName' or $this->formControls[$fieldName]->fieldEditType == 'Photo') {
// Add Hidden Control for upload
// help to retrieve file path
$hiddenCtrl = new jFormsControlHidden($fieldName . '_hidden');
$form->addControl($hiddenCtrl);
$toDeactivate[] = $fieldName . '_choice';
}
}
// Add the control to the form
$form->addControl($this->formControls[$fieldName]->ctrl);
// Set readonly if needed
$form->setReadOnly($fieldName, $this->formControls[$fieldName]->isReadOnly);
// Hide when no modify capabilities, only for UPDATE cases ( when $this->featureId control exists )
if (!empty($this->featureId) and strtolower($capabilities->modifyAttribute) == 'false' and $fieldName != $this->geometryColumn) {
if ($prop->primary) {
$toSetReadOnly[] = $fieldName;
} else {
$toDeactivate[] = $fieldName;
}
}
}
// Hide when no modify capabilities, only for UPDATE cases ( when $this->featureId control exists )
if (!empty($this->featureId) && strtolower($capabilities->modifyAttribute) == 'false') {
foreach ($toDeactivate as $de) {
if ($form->getControl($de)) {
$form->deactivate($de, true);
}
}
foreach ($toSetReadOnly as $de) {
if ($form->getControl($de)) {
$form->setReadOnly($de, true);
}
}
}
if (!$this->primaryKeys) {
jMessage::add("The table " . $this->table . " has no primary keys. The edition tool needs a primary key on the table to be defined.", "error");
return false;
}
return True;
}
示例14: array
<?php
/**
* @package HeleneKling
* @subpackage HeleneKling
* @author zoolonly
* @copyright 2009 zoolonly
* @link http://www.yourwebsite.undefined
* @license All right reserved
*/
jClasses::inc('Album');
jClasses::inc('Image');
jClasses::inc('Painting');
jClasses::inc('jPicasa');
jClasses::inc('OnDiskVideosService');
class basicGalleryCtrl extends jControllerDaoCrud
{
public $pluginParams = array('*' => array('auth.required' => true, 'zf.active' => true), 'albums' => array('auth.required' => false), 'images' => array('auth.required' => false), 'index' => array('auth.required' => false), 'search' => array('auth.required' => false), 'addComment' => array('auth.required' => false), 'viewComment' => array('auth.required' => false));
function index()
{
$rep = $this->getResponse('redirect');
$rep->action = 'basicGallery:albums';
return $rep;
}
function albums()
{
$rep = $this->getResponse('html');
$tpl = new Jtpl();
$picasaService = new jPicasa();
$tpl->assign('albums', $picasaService->albums());
$rep->body->assign('MAIN', $tpl->fetch('albums_html'));
示例15: single
function single()
{
$conf = jApp::config();
if (!isset($conf->enableTests) || !$conf->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 TestSuite('"' . $module . '" module , ' . $test[2]);
$group->addFile($conf->_modulesPathList[$module] . 'tests/' . $test[0]);
jApp::pushCurrentModule($module);
$group->run($reporter);
jApp::popCurrentModule();
break;
}
}
} else {
$rep->body->assign('MAIN', '<p>no tests for "' . $module . '" module.</p>');
}
return $this->_finishResponse($rep);
}