本文整理汇总了PHP中KFactory类的典型用法代码示例。如果您正苦于以下问题:PHP KFactory类的具体用法?PHP KFactory怎么用?PHP KFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _validate
protected function _validate($context)
{
$config = $this->_config;
$row = $context->caller;
if (is_uploaded_file($row->file) && $config->restrict && !in_array($row->extension, $config->ignored_extensions->toArray()))
{
if ($row->isImage())
{
if (getimagesize($row->file) === false) {
$context->setError(JText::_('WARNINVALIDIMG'));
return false;
}
}
else
{
$mime = KFactory::get('com://admin/files.database.row.file')->setData(array('path' => $row->file))->mimetype;
if ($config->check_mime && $mime)
{
if (in_array($mime, $config->illegal_mimetypes->toArray()) || !in_array($mime, $config->allowed_mimetypes->toArray())) {
$context->setError(JText::_('WARNINVALIDMIME'));
return false;
}
}
elseif (!$config->authorized) {
$context->setError(JText::_('WARNNOTADMIN'));
return false;
}
}
}
}
开发者ID:raeldc,项目名称:com_learn,代码行数:32,代码来源:mimetype.php
示例2: getList
public function getList()
{
if (!isset($this->_list))
{
$rowset = KFactory::get('com://admin/settings.database.rowset.settings');
//Insert the system configuration settings
$rowset->insert(KFactory::get('com://admin/settings.database.row.system'));
//Insert the component configuration settings
$components = KFactory::get('com://admin/extensions.model.components')->enabled(1)->parent(0)->getList();
foreach($components as $component)
{
$path = JPATH_ADMINISTRATOR.'/components/'.$component->option.'/config.xml';
$params = new JParameter( $component->params);
$config = array(
'name' => strtolower(substr($component->option, 4)),
'path' => file_exists($path) ? $path : '',
'id' => $component->id,
'data' => $params->toArray(),
);
$row = KFactory::get('com://admin/settings.database.row.component', $config);
$rowset->insert($row);
}
$this->_list = $rowset;
}
return $this->_list;
}
开发者ID:raeldc,项目名称:com_learn,代码行数:34,代码来源:settings.php
示例3: display
public function display()
{
//Set the document link
$this->_document->link = $this->createRoute('format=html&view=posts&blog_blog_id=' . KRequest::get('get.id', 'int'));
//Get the list of posts
$posts = KFactory::get($this->getModel())->getList();
foreach ($posts as $post) {
// strip html from feed item title
$title = html_entity_decode($post->title);
// url link to article
$link = $this->createRoute('format=html&view=post&slug=' . $post->slug);
// generate the description as a hcard
$description = $post->text;
// load individual item creator class
$item = new JFeedItem();
$item->title = $title;
$item->link = $link;
$item->description = $description;
$item->date = date('r', strtotime($post->created_on));
$item->category = '';
// loads item info into rss array
$doc =& JFactory::getDocument();
$doc->addItem($item);
}
return $this;
}
开发者ID:raeldc,项目名称:com_blog,代码行数:26,代码来源:feed.php
示例4: __construct
/**
* Constructor
*
* @param object An optional KConfig object with configuration options
*/
public function __construct(KConfig $config)
{
// set the document object
//@TODO submit koowa patch for this one
$this->_document = KFactory::get('lib.joomla.document');
parent::__construct($config);
}
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:12,代码来源:json.php
示例5: display
public function display($tpl = null)
{
global $mainframe;
$pathway =& $mainframe->getPathway();
$params =& $mainframe->getParams();
$model = KFactory::get('site::com.picman.model.album');
$album = $model->getItem();
// set Breadcrumbs
$pathway->addItem($album->name);
// set Document data
$document =& JFactory::getDocument();
$document->setMetaData('keywords', $album->metakey);
$document->setMetaData('description', $album->metadesc);
$document->setTitle($album->name);
// Load GData plugin
$plugin =& JPluginHelper::getPlugin('system', 'gdata');
$gdata = new JParameter($plugin->params);
// get Simple XML feed from GData Plugin
$album = "picman_album_" . $album->id;
$query = "kind=photo&access=all&thumbsize=144c&imgmax=512";
$simpleXml = plgSystemGdata::getSimpleXml($album, $query);
$this->assignRef('album', $album);
$this->assignRef('params', $params);
$this->assignRef('simpleXml', $simpleXml);
$this->assignRef('filter', $model->getFilters());
$this->assignRef('pagination', $model->getPagination());
// Display the layout
parent::display($tpl);
}
开发者ID:janssit,项目名称:www.alu-andries.be,代码行数:29,代码来源:html.php
示例6: display
public function display()
{
$modules = KFactory::get('com://admin/extensions.model.modules')->position('cpanel')->application('administrator')->enabled(1)->getList();
$this->assign('modules', $modules);
return parent::display();
}
开发者ID:raeldc,项目名称:com_learn,代码行数:7,代码来源:html.php
示例7: delete
/**
* Drops all translated copies of the table, as well as all nodes
*/
public function delete($wheres)
{
$nooku = KFactory::get('admin::com.nooku.model.nooku');
$nodes = KFactory::get('admin::com.nooku.table.nodes');
$languages = $nooku->getAddedLanguages();
foreach ($wheres as $where) {
$table_name = KFactory::get('admin::com.nooku.table.tables')->find($where)->get('table_name');
// Delete all items for this table from the nodes table
$query = $this->_db->getQuery()->where('table_name', '=', $table_name);
$nodes->delete($query);
if ($err = $nodes->getError()) {
//throw new KDatabaseTableException($err);
}
// Delete all #__isocode_table_name
foreach ($languages as $language) {
$query = 'DROP TABLE ' . $this->_db->quoteName('#__' . strtolower($language->iso_code) . '_' . $table_name);
$this->_db->execute($query);
if ($err = $this->_db->getError()) {
//throw new KDatabaseTableException($err);
}
}
}
// Delete the table item in nooku_tables
return parent::delete($wheres);
}
开发者ID:janssit,项目名称:www.reliancelaw.be,代码行数:28,代码来源:tables.php
示例8: display
/**
* Return the views output
*
* @return string The output of the view
*/
public function display()
{
//Set the filename
$filename = KFactory::get('koowa:filter.filename')->sanitize($this->_properties['FN']);
$this->filename = $filename.'.vcf';
//Render the vcard
$data = 'BEGIN:VCARD';
$data .= "\r\n";
$data .= 'VERSION:2.1';
$data .= "\r\n";
foreach( $this->_properties as $key => $value )
{
$data .= "$key:$value";
$data .= "\r\n";
}
$data .= 'REV:'. date( 'Y-m-d' ) .'T'. date( 'H:i:s' ). 'Z';
$data .= "\r\n";
$data .= 'END:VCARD';
$data .= "\r\n";
$this->output = $data;
parent::display();
}
开发者ID:raeldc,项目名称:com_learn,代码行数:32,代码来源:vcard.php
示例9: display
public function display()
{
$state = $this->getModel()->getState();
$folders = KFactory::get('com://admin/files.controller.folder')
->container($state->container)
->tree(true)
->browse();
$this->assign('folders', $folders);
$config = KFactory::get('com://admin/files.model.configs')->getItem();
// prepare an extensions array for fancyupload
$extensions = $config->upload_extensions;
$this->assign('allowed_extensions', $extensions);
$this->assign('maxsize' , $config->upload_maxsize);
$this->assign('path' , $state->container->relative_path);
$this->assign('sitebase' , ltrim(JURI::root(true), '/'));
$this->assign('token' , JUtility::getToken());
$this->assign('session' , JFactory::getSession());
if (!$this->editor) {
$this->assign('editor', '');
}
return parent::display();
}
开发者ID:raeldc,项目名称:com_learn,代码行数:29,代码来源:html.php
示例10: onApplicationBeforeRender
public function onApplicationBeforeRender(ArrayObject $args)
{
$nooku = KFactory::get('admin::com.nooku.model.nooku');
// Input
$view = KInput::get('view', array('post', 'get'), 'cmd');
$task = KInput::get('task', array('post', 'get'), 'cmd');
$format = KInput::get('format', array('post', 'get'), 'cmd', null, 'html');
$component = KInput::get('option', array('post', 'get'), 'cmd');
// onBeforeRender
if ('html' != $format || $task == 'edit') {
return;
}
$table_name = 'menu';
$row_id = KInput::get('Itemid', array('post', 'get'), 'int');
if ($view == 'article' && $component == 'com_content') {
$table_name = 'content';
$row_id = KInput::get('id', 'get', 'slug');
}
$query = KFactory::get('lib.joomla.database')->getQuery()->select(array('m.*', 'n.*', 'm.nooku_node_id AS id'))->from('nooku_metadata AS m')->join('LEFT', 'nooku_nodes AS n', 'n.nooku_node_id = m.nooku_node_id')->where('row_id', '=', $row_id)->where('table_name', '=', $table_name)->where('iso_code', '=', $nooku->getLanguage());
$meta = KFactory::get('admin::com.nooku.table.metadata')->fetchRow($query);
// get head data
$doc = KFactory::get('lib.joomla.document');
$head = $doc->getHeadData();
$head['description'] = empty($meta->description) ? @$head['description'] : $meta->description;
$head['metaTags']['standard']['keywords'] = empty($meta->keywords) ? @$head['metaTags']['standard']['keywords'] : $meta->keywords;
$head['metaTags']['standard']['author'] = empty($meta->author) ? @$head['metaTags']['standard']['author'] : $meta->author;
$doc->setHeadData($head);
}
开发者ID:janssit,项目名称:www.reliancelaw.be,代码行数:28,代码来源:system.php
示例11: onGetWebServices
/**
* Proxy for the onGetWebServices
*
* Will call describe for each xmlrpc event handler and return the results to
* the xmlrpc server.
*
* @return array An array of associative arrays defining the available methods
*/
function onGetWebServices()
{
$services = array();
//Get the event dispatcher
$dispatcher = KFactory::get('lib.koowa.event.dispatcher');
$path = JPATH_COMPONENT . DS . 'xmlrpc';
$dir = new DirectoryIterator($path);
foreach ($dir as $file) {
//Make sure we found a valid file
if ($file->isDot() || in_array($file->getFilename(), array('.svn', 'index.html'))) {
continue;
}
$filename = basename($file->getFilename(), ".php");
//Load the event handler
Koowa::import('admin::com.nooku.xmlrpc.' . $filename);
//Register the event handler
$dispatcher->register('NookuXmlrpc' . ucfirst($filename));
}
$results = $dispatcher->dispatch('describe', new ArrayObject());
foreach ($results as $result) {
foreach ($result as $key => $value) {
$services[$key] = $value;
}
}
return $services;
}
开发者ID:janssit,项目名称:www.reliancelaw.be,代码行数:34,代码来源:nooku.php
示例12: fetchElement
public function fetchElement($name, $value, &$node, $control_name)
{
$buffer = '';
$chain = $node->children();
if (!defined('NINJA_CHAIN')) {
$document = KFactory::get('lib.joomla.document');
$document->addStyleDeclaration("\n\t\t\t\t.wrapper {\n\t\t\t\t\t-webkit-border-radius: 3px;\n\t\t\t\t\t-moz-border-radius: 3px;\n\t\t\t\t\tborder-radius: 3px;\n\t\t\t\t\tbackground-color: #EBEBEB;\n\t\t\t\t\tbackground-color: hsla(0, 0%, 94%, 0.8);\n\t\t\t\t\tborder: 1px solid #E6E6E6;\n\t\t\t\t\tborder-color: hsla(0, 0%, 90%, 0.8);\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tpadding: 6px;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t.wrapper .chain-label {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t.wrapper .chain .value, .wrapper .chain ul.group {\n\t\t\t\t\tmargin-left: auto!important;\n\t\t\t\t}\n\t\t\t");
define('NINJA_CHAIN', 1);
}
//
$buffer .= "<div class='wrapper'>";
foreach ($chain as $item) {
//get the type of the parameter
$type = (string) $item['type'];
try {
$identifier = new KIdentifier($type);
} catch (KException $e) {
$identifier = 'admin::com.ninja.element.' . $type;
}
$chaindata = $this->_parent->get((string) $node['name']);
if (isset($chaindata[(string) $item['name']]) && $chaindata[(string) $item['name']] !== false) {
$value = $chaindata[(string) $item['name']];
} else {
$value = (string) $item['default'];
}
$element = KFactory::tmp($identifier, array('parent' => $this->_parent, 'node' => $item, 'value' => $value, 'field' => $this->field, 'group' => $this->_parent->getGroup(), 'name' => $name . '[' . (string) $item['name'] . ']', 'fetchTooltip' => false));
$buffer .= '<div class="chain ' . $name . '_' . (string) $item['name'] . ' chain-' . $type . '">';
$buffer .= '<span class="chain-label">' . JText::_($element->label) . '</span>';
$buffer .= $element->toString();
$buffer .= "</div>";
}
$buffer .= "</div>";
return $buffer;
}
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:34,代码来源:chain.php
示例13: setLayout
public function setLayout($layout)
{
$identifier = KFactory::identify('md://admin/com.learn.docs.pages.'.$layout);
$this->_layout = $identifier;
return $this;
}
开发者ID:raeldc,项目名称:com_learn,代码行数:7,代码来源:html.php
示例14: display
public function display($tpl = null)
{
global $mainframe;
$pathway =& $mainframe->getPathway();
$params =& $mainframe->getParams();
$model = KFactory::get('site::com.immotoa.model.projects');
$project = $model->getItem();
// Add metadata to header
$document =& JFactory::getDocument();
$document->setMetaData('keywords', $project->metakey);
$document->setMetaData('description', $project->metadesc);
// load GData plugin and get the images
$plugin =& JPluginHelper::getPlugin('system', 'gdata');
$images = plgSystemGdata::getAlbumFeed("immotoa_project_" . $project->id);
// Build Google Static Map API URL
$project->map = "http://maps.google.com/staticmap?" . "center=" . $project->coordinates . "&format=jpg&zoom=" . $params->get('maps_zoom') . "&" . "size=" . $params->get('maps_width') . "x" . $params->get('maps_height') . "&" . "maptype=roadmap&markers=" . $project->coordinates . "," . $params->get('maps_color') . "&" . "sensor=false&key=" . $params->get('maps_key');
// set breadcrumbs
$pathway->addItem($project->name);
$this->assignRef('project', $project);
$this->assignRef('params', $params);
$this->assignRef('images', $images);
$this->assignRef('filter', $model->getFilters());
$this->assignRef('pagination', $model->getPagination());
// Display the layout
parent::display($tpl);
}
开发者ID:janssit,项目名称:www.gincoprojects.be,代码行数:26,代码来源:html.php
示例15: categories
public function categories($config = array())
{
$config = new KConfig($config);
$config->append(array(
'name' => 'category',
'deselect' => true,
'selected' => $config->category,
'prompt' => '- Select -'
));
if($config->deselect) {
$options[] = $this->option(array('text' => JText::_($config->prompt), 'value' => -1));
}
$options[] = $this->option(array('text' => JText::_('Uncategorised'), 'value' => 0));
if($config->section != '0')
{
$list = KFactory::get('com://admin/categories.model.categories')
->set('section', $config->section > 0 ? $config->section : 'com_content')
->set('sort', 'title')
->set('limit', 0)
->getList();
foreach($list as $item) {
$options[] = $this->option(array('text' => $item->title, 'value' => $item->id));
}
}
else $config->selected = 0;
$config->options = $options;
return $this->optionlist($config);
}
开发者ID:raeldc,项目名称:com_learn,代码行数:34,代码来源:listbox.php
示例16: display
public function display()
{
$profiler = KFactory::get('com://admin/debug.profiler.events');
$database = KFactory::get('com://admin/debug.profiler.queries');
$language = KFactory::get('joomla:language');
//Remove the template includes
$includes = get_included_files();
foreach($includes as $key => $value)
{
if($value == 'tmpl://koowa.template.stack') {
unset($includes[$key]);
}
}
$this->assign('memory' , $profiler->getMemory())
->assign('events' , $profiler->getEvents())
->assign('queries' , $database->getQueries())
->assign('languages', $language->getPaths())
->assign('includes' , $includes)
->assign('strings' , $language->getOrphans());
return parent::display();
}
开发者ID:raeldc,项目名称:com_learn,代码行数:25,代码来源:html.php
示例17: display
public function display($tpl = null)
{
$model = KFactory::get('admin::com.nooku.model.articles');
$nooku = KFactory::get('admin::com.nooku.model.nooku');
$article = $model->getArticle();
$id = $model->getState('id');
if (JString::strlen($article->fulltext) > 1) {
$text = $article->introtext . "<hr id=\"system-readmore\" />" . $article->fulltext;
} else {
$text = $article->introtext;
}
// for the lang switcher
$languages = $nooku->getLanguages();
$target_lang = $languages[$nooku->getLanguage()];
$source_lang = $nooku->getPrimaryLanguage();
$source_url = 'index.php?option=com_nooku&view=translate.source&tmpl=component&id=' . $id . '&source_lang=' . $source_lang->iso_code;
// Assign to template
$this->assign('text', $text);
$this->assign('languages', $languages);
$this->assign('target_lang', $target_lang);
$this->assign('source_lang', $source_lang);
$this->assign('source_url', $source_url);
$this->assign('id', $id);
// Display the layout
parent::display($tpl);
}
开发者ID:janssit,项目名称:www.reliancelaw.be,代码行数:26,代码来源:html.php
示例18: _afterTableSelect
/**
* Decodes json data on each field
*
* @return boolean true.
*/
protected function _afterTableSelect(KCommandContext $context)
{
//We should only run this on row objects
if ($context->mode == KDatabase::FETCH_FIELD) {
return;
}
$rows = $context['data'];
$identifier = clone $rows->getTable();
$identifier->path = array('model');
$identifier->name = 'settings';
$defaults = KFactory::get($identifier)->getParams()->toArray();
if (is_a($rows, 'KDatabaseRowInterface')) {
$rows = array($rows);
}
foreach ($rows as $row) {
//if(is_array($row->params)) continue;
//echo $row->params;
//if(is_array($row->params)) die('<pre>'.var_export(is_string($row->params) && !is_null($row->params), true).'</pre>');
//$true = false;
//if(is_array($row->params)) $true = true;
$params = is_string($row->params) ? json_decode($row->params, true) : $row->params;
//if(!is_array($params)) $params = array();
//if($true) die('<pre>'.__CLASS__.' '.var_export($params, true).'</pre>');
$params = new KConfig($params);
//@TODO Make this configurable, instead of hardcoding the defaults to only apply when JSite
if (KFactory::get('lib.joomla.application')->isSite()) {
$params->append($defaults);
}
$row->params = $params;
}
}
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:36,代码来源:configurable.php
示例19: display
public function display()
{
//Get User details from Joomla!
$joomla = array('Name' => 'name', 'Username' => 'username', 'E-Mail' => 'email', 'Group' => 'usertype', 'Register Date' => 'registerDate', 'Last Visit Date' => 'lastvisitDate');
$this->assign('joomla', $joomla);
$this->assign('ifedit', range(0, 1));
//Get user
$usertype = KFactory::get('lib.joomla.user')->get('usertype');
$this->assign('avatar', null);
$user = KFactory::get($this->getModel())->getItem();
$usergroups = array();
foreach ($user->usergroups as $group) {
$usergroups[] = $group->id;
}
$this->usergroups = $usergroups;
if ($user->inherits) {
$this->usergroups = 0;
$inherits = array();
foreach ($user->usergroups as $usergroup) {
$link = '<a href="' . $this->createRoute('view=usergroup&id=' . $usergroup->id) . '">';
$link .= $usergroup->title;
$link .= '</a>';
$inherits[] = $link;
}
$this->inherits = implode(', ', $inherits);
}
// Display the layout
return parent::display();
}
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:29,代码来源:html.php
示例20: parse
/**
* Proxy the router parse function to fix a bug in the core
*
* @param object $url The URI to parse
* @return array
*/
public function parse($uri)
{
$nooku = KFactory::get('admin::com.nooku.model.nooku');
$app = KFactory::get('lib.joomla.application');
// Perform the actual parse
$result = parent::parse($uri);
$this->setVars($result);
// Redirect if the language has changed
$old = $nooku->getLanguage();
$new = KInput::get('lang', array('post', 'get'), 'lang');
if (isset($new) && strtolower($new) != strtolower($old)) {
//Set the language
$nooku->setLanguage($new);
if (KInput::getMethod() == 'POST') {
$uri->setVar('lang', $new);
$route = JRoute::_($uri->toString(), false);
/*
* Dirty hack. Joomla URI class transforms cid[] into cid[0]
*
* TODO : either fix in KUri or in the koowa javascript uri parser
*/
$route = str_replace('cid[0]', 'cid[]', $route);
$app->redirect($route);
}
}
return $result;
}
开发者ID:janssit,项目名称:www.reliancelaw.be,代码行数:33,代码来源:router.php
注:本文中的KFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论