本文整理汇总了PHP中KFactory::get方法的典型用法代码示例。如果您正苦于以下问题:PHP KFactory::get方法的具体用法?PHP KFactory::get怎么用?PHP KFactory::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFactory
的用法示例。
在下文中一共展示了KFactory::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}
}
示例2: getItem
/**
* Returns a row with keywords, description and author, based on the
* tablename and row_id from the nodes table
*
* @return object
*/
public function getItem()
{
$nooku = KFactory::get('admin::com.nooku.model.nooku');
$table_name = KInput::get('table_name', array('get', 'post'), 'cmd');
$row_id = KInput::get('row_id', array('get', 'post'), 'int');
$query = $this->getDBO()->getQuery()->select(array('m.*', 'n.*'))->from('nooku_metadata AS m')->join('RIGHT', 'nooku_nodes AS n', 'n.nooku_node_id = m.nooku_node_id')->where('row_id', '=', $row_id)->where('table_name', '=', $table_name);
$result = $this->getTable()->fetchAll($query);
//Get the row
$item = $result->findRow('iso_code', $nooku->getLanguage());
//If no existing row was found populate it
if (!$item->id) {
$original = $result->findRow('iso_code', $nooku->getPrimaryLanguage()->iso_code);
if ($original->id) {
$item->description = $original->description;
$item->keywords = $original->keywords;
$item->author = $original->author;
} else {
$app = KFactory::get('lib.joomla.application');
$item->description = $app->getCfg('MetaDesc');
$item->keywords = $app->getCfg('MetaKeys');
$item->author = KFactory::get('lib.joomla.user')->name;
}
$item->table_name = $table_name;
$item->row_id = $row_id;
}
return $item;
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例13: 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);
}
示例14: 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);
}
示例15: 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;
}