当前位置: 首页>>代码示例>>PHP>>正文


PHP KFactory::map方法代码示例

本文整理汇总了PHP中KFactory::map方法的典型用法代码示例。如果您正苦于以下问题:PHP KFactory::map方法的具体用法?PHP KFactory::map怎么用?PHP KFactory::map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KFactory的用法示例。


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

示例1: display

 public function display()
 {
     $model = KFactory::get($this->getModel());
     $identifier = $model->getIdentifier();
     $package = $identifier->package;
     KFactory::map('admin::com.' . $package . '.form.default', 'admin::com.ninja.form.default');
     return parent::display();
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:8,代码来源:ajax.php

示例2: __construct

 public function __construct($subject, $config = array())
 {
     // Check if Koowa is active
     if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') {
         JError::raiseWarning(0, JText::_("Koowa plugin requires MySQLi Database Driver. Please change your database configuration settings to 'mysqli'"));
         return;
     }
     // Check for suhosin
     if (in_array('suhosin', get_loaded_extensions())) {
         //Attempt setting the whitelist value
         @ini_set('suhosin.executor.include.whitelist', 'tmpl://, file://');
         //Checking if the whitelist is ok
         if (!@ini_get('suhosin.executor.include.whitelist') || strpos(@ini_get('suhosin.executor.include.whitelist'), 'tmpl://') === false) {
             JError::raiseWarning(0, sprintf(JText::_('Your server has Suhosin loaded. Please follow <a href="%s" target="_blank">this</a> tutorial.'), 'https://nooku.assembla.com/wiki/show/nooku-framework/Known_Issues'));
             return;
         }
     }
     //Set constants
     define('KDEBUG', JDEBUG);
     define('JPATH_IMAGES', JPATH_ROOT . '/images');
     //Set exception handler
     set_exception_handler(array($this, 'exceptionHandler'));
     // Require the library loader
     JLoader::import('libraries.koowa.koowa', JPATH_ROOT);
     JLoader::import('libraries.koowa.loader.loader', JPATH_ROOT);
     //Setup the loader
     KLoader::addAdapter(new KLoaderAdapterKoowa(Koowa::getPath()));
     KLoader::addAdapter(new KLoaderAdapterJoomla(JPATH_LIBRARIES));
     KLoader::addAdapter(new KLoaderAdapterModule(JPATH_BASE));
     KLoader::addAdapter(new KLoaderAdapterPlugin(JPATH_ROOT));
     KLoader::addAdapter(new KLoaderAdapterComponent(JPATH_BASE));
     //Setup the factory
     KFactory::addAdapter(new KFactoryAdapterKoowa());
     KFactory::addAdapter(new KFactoryAdapterJoomla());
     KFactory::addAdapter(new KFactoryAdapterModule());
     KFactory::addAdapter(new KFactoryAdapterPlugin());
     KFactory::addAdapter(new KFactoryAdapterComponent());
     //Setup the identifier application paths
     KIdentifier::registerApplication('site', JPATH_SITE);
     KIdentifier::registerApplication('admin', JPATH_ADMINISTRATOR);
     //Setup the request
     KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base()));
     //Set factory identifier aliasses
     KFactory::map('lib.koowa.database.adapter.mysqli', 'admin::com.default.database.adapter.mysqli');
     //Load the koowa plugins
     JPluginHelper::importPlugin('koowa', null, true, KFactory::get('lib.koowa.event.dispatcher'));
     //Bugfix : Set offset accoording to user's timezone
     if (!KFactory::get('lib.joomla.user')->guest) {
         if ($offset = KFactory::get('lib.joomla.user')->getParam('timezone')) {
             KFactory::get('lib.joomla.config')->setValue('config.offset', $offset);
         }
     }
     parent::__construct($subject, $config);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:54,代码来源:koowa.php

示例3: instantiate

 /**
  * Force creation of a singleton
  *
  * @return KDispatcherDefault
  */
 public static function instantiate($config = array())
 {
     static $instance;
     if ($instance === NULL) {
         //Create the singleton
         $classname = $config->identifier->classname;
         $instance = new $classname($config);
         //Add the factory map to allow easy access to the singleton
         KFactory::map('lib.koowa.dispatcher', $config->identifier);
     }
     return $instance;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:17,代码来源:default.php

示例4: defined

 * @link     	http://ninjaforge.com
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
$ninja = JPATH_ADMINISTRATOR . '/components/com_ninja/ninja.php';
if (!file_exists($ninja)) {
    return JError::raiseWarning(0, JText::_('The Ninja Framework component (com_ninja) is required for this component to run.'));
}
require_once $ninja;
/** 
* If koowa is unavailable
* Abort the dispatcher
*/
if (!defined('KOOWA')) {
    return JError::raiseWarning(0, JText::_('This component cannot run without Nooku Framework.'));
}
KFactory::map('admin::com.ninjaboard.template.helper.default', 'admin::com.ninja.helper.default');
// Uncomment for localhost ajax testing of request spinners and response messages
// As it'll delay the request making it closer to the end-user experience
//if(KRequest::type() == 'AJAX') sleep(3);
//Load the ninjaboard plugins
JPluginHelper::importPlugin('ninjaboard', null, true, KFactory::get('lib.koowa.event.dispatcher'));
//Debug RTL
if (KFactory::get('lib.joomla.language')->isRTL() && KRequest::has('get.debug.rtl')) {
    KFactory::get('lib.joomla.document')->addScriptDeclaration("\n\t\tString.prototype.reverse = function(){\n\t\t\treturn this.split('').reverse().join('');\n\t\t};\n\t\t\n\t\twindow.addEventListener('blur', function(){\n\t\t\tdocument.html.removeClass('rtl');\n\t\t});\n\t\t\n\t\twindow.addEventListener('focus', function(){\n\t\t\tdocument.html.addClass('rtl');\n\t\t});\n\t");
    KFactory::get('lib.joomla.document')->addStyleDeclaration("\n\t\thtml.rtl {\n\t\t\t-webkit-transform: rotateY(180deg);\n\t\t\tdirection: rtl !important; \n\t\t\tunicode-bidi: bidi-override !important;\n\t\t}\n\t");
}
// Create the component dispatcher
echo KFactory::get('admin::com.ninjaboard.dispatcher')->dispatch(KRequest::get('get.view', 'cmd', 'dashboard'));
// Add untranslated words to the current NB language file
KFactory::get('admin::com.ninja.helper.language');
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:31,代码来源:ninjaboard.php

示例5: display

 public function display()
 {
     //Add the template override path
     $parts = $this->_identifier->path;
     array_shift($parts);
     if (count($parts) > 1) {
         $path = KInflector::pluralize(array_shift($parts));
         $path .= count($parts) ? DS . implode(DS, $parts) : '';
         $path .= DS . strtolower($this->getName());
     } else {
         $path = strtolower($this->getName());
     }
     $template = KFactory::get('lib.joomla.application')->getTemplate();
     $override = JPATH_THEMES . DS . $template . DS . 'html' . DS . 'com_' . $this->_identifier->package . DS . $path;
     KFactory::get($this->getTemplate())->addPath($override);
     if ($template == 'morph' && class_exists('Morph')) {
         $override = JPATH_ROOT . '/morph_assets/themelets/' . Morph::getInstance()->themelet . '/html/' . 'com_' . $this->_identifier->package . '/' . $path;
         KFactory::get($this->getTemplate())->addPath($override);
     }
     $model = KFactory::get($this->getModel());
     $identifier = $model->getIdentifier();
     $type = $identifier->type;
     $package = $identifier->package;
     $isAdmin = KFactory::get('lib.joomla.application')->isAdmin();
     //Set the document title
     if ($this->_auto_title) {
         $this->setDocumentTitle();
     }
     // Hide the toolbar if we're in an iframe
     if (KRequest::get('get.tmpl', 'cmd') == 'component') {
         $this->_toolbar = false;
     }
     $this->assign('length', KFactory::tmp($this->getModel()->getIdentifier())->getTotal());
     if ($this->_toolbar) {
         $toolbar = $this->_createToolbar();
         if (!$this->length && KInflector::isPlural($this->getName())) {
             $toolbar->removeListButtons();
         }
         $this->_document->setBuffer($toolbar->renderTitle(), 'modules', 'title');
         $this->_document->setBuffer($toolbar->render(), 'modules', 'toolbar');
         //Needed for templates like AdminPraise2
         //@TODO submit patch to com_default's dispatcher
         KFactory::get('lib.joomla.application')->set('JComponentTitle', $toolbar->renderTitle());
     }
     KFactory::map('admin::com.' . $package . '.form.default', 'admin::com.ninja.form.default');
     //Add admin.css from the extension or current template if it exists.
     if ($isAdmin) {
         $this->css('/admin.css');
     }
     return parent::display();
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:51,代码来源:html.php

示例6: array

    require $root . 'setup/koowa.' . $ver . '.php';
}
if (!JPluginHelper::isEnabled('system', 'ninja') || JFactory::getApplication()->get('wrong_koowa_plugin_order')) {
    require $root . 'setup/ninja.' . $ver . '.php';
}
// date.timezone fix to avoid errors in date helpers
if (version_compare('5.3', phpversion(), '<=')) {
    // If NULL, then that means ini_get is a disabled function, not necessarily that date.timezone is undefined
    if (ini_get('date.timezone') !== NULL && !ini_get('date.timezone')) {
        //Using @ to silence any PHP warnings complaining about date.timezone not being defined in the ini file
        @date_default_timezone_set(@date_default_timezone_get());
    }
}
// Add Ninja template filters and some legacy
if (defined('KOOWA')) {
    //@TODO get rid of this legacy mapping
    KFactory::map('lib.koowa.document', 'lib.joomla.document');
    $rules = array(KFactory::get('admin::com.ninja.template.filter.document'));
    KFactory::get('lib.koowa.template.default')->addFilters($rules);
}
$cache = JPATH_ROOT . '/cache/' . $extension_name . '/upgrade';
if (!JFile::exists($cache)) {
    //Run extension specific upgrade procedure if found
    $upgrade = JPATH_COMPONENT_ADMINISTRATOR . '/install/upgrade.php';
    if (JFile::exists($upgrade)) {
        require_once $upgrade;
    }
    //1.6 bugfix
    $buffer = false;
    JFile::write($cache, $buffer);
}
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:31,代码来源:ninja.php

示例7: jimport

jimport( 'joomla.utilities.utility' );
jimport( 'joomla.event.event');
jimport( 'joomla.event.dispatcher');
jimport( 'joomla.language.language');
jimport( 'joomla.utilities.string' );
jimport( 'joomla.plugin.helper' );

// Koowa : setup loader
JLoader::import('libraries.koowa.koowa'        , JPATH_ROOT);
JLoader::import('libraries.koowa.loader.loader', JPATH_ROOT);
		
KLoader::addAdapter(new KLoaderAdapterKoowa(Koowa::getPath()));
KLoader::addAdapter(new KLoaderAdapterJoomla(JPATH_LIBRARIES));
KLoader::addAdapter(new KLoaderAdapterModule(JPATH_BASE));
KLoader::addAdapter(new KLoaderAdapterPlugin(JPATH_ROOT));
KLoader::addAdapter(new KLoaderAdapterComponent(JPATH_BASE));
		
// Koowa : setup factory
KFactory::addAdapter(new KFactoryAdapterKoowa());
KFactory::addAdapter(new KFactoryAdapterJoomla());
KFactory::addAdapter(new KFactoryAdapterModule());
KFactory::addAdapter(new KFactoryAdapterPlugin());
KFactory::addAdapter(new KFactoryAdapterComponent());
		
//Koowa : register identifier application paths
KIdentifier::registerApplication('site' , JPATH_SITE);
KIdentifier::registerApplication('admin', JPATH_ADMINISTRATOR);

//Koowa : setup factory mappings
KFactory::map('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
开发者ID:raeldc,项目名称:com_learn,代码行数:30,代码来源:framework.php

示例8:

<?php

/**
 * @version		$Id: stream.php 22 2010-07-25 17:29:36Z copesc $
 * @package		error
 * @copyright	Copyright (C) 2009 - 2010 Nooku. All rights reserved.
 * @license 	GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.nooku.org
 */
// Check if Koowa is active
if (!defined('KOOWA')) {
    JError::raiseWarning(0, JText::_("Koowa wasn't found. Please install the Koowa plugin and enable it."));
    return;
}
// Require the defines
KLoader::load('admin::com.stream.defines');
KFactory::map('lib.koowa.template.helper.behavior', 'admin::com.stream.helper.behavior');
// Create the controller dispatcher
KFactory::get('admin::com.stream.dispatcher')->dispatch(KRequest::get('get.view', 'cmd', 'targets'));
开发者ID:raeldc,项目名称:com_stream,代码行数:19,代码来源:stream.php

示例9:

<?php
/**
 * @version		$Id: mappings.php 2643 2011-09-01 03:07:12Z johanjanssens $
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Weblinks
 * @copyright	Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

/**
 * Factory mappings
 *
 * @author    	Jeremy Wilken <http://nooku.assembla.com/profile/gnomeontherun>
 * @category 	Nooku
 * @package     Nooku_Server
 * @subpackage  Weblinks
 */

KFactory::map('com://site/weblinks.model.categories', 'com://admin/weblinks.model.categories');
KFactory::map('com://site/weblinks.model.weblinks'  , 'com://admin/weblinks.model.weblinks');
开发者ID:raeldc,项目名称:com_learn,代码行数:22,代码来源:mappings.php

示例10: __construct

 public function __construct($subject, $config)
 {
     parent::__construct($subject, $config);
     //If com_ninja don't exist, abort execution to prevent errors
     if (!is_dir(JPATH_ADMINISTRATOR . '/components/com_ninja')) {
         return;
     }
     //If the diagnose failed, FFS don't do anything!
     if (!$this->_diagnose()) {
         return;
     }
     //@TODO this is legacy, update your code to use the right identifiers
     KFactory::map('lib.koowa.application', 'lib.joomla.application');
     KFactory::map('lib.koowa.language', 'lib.joomla.language');
     KFactory::map('lib.koowa.document', 'lib.joomla.document');
     KFactory::map('lib.koowa.user', 'lib.joomla.user');
     KFactory::map('lib.koowa.editor', 'lib.joomla.editor');
     KFactory::map('lib.koowa.database', 'lib.koowa.database.adapter.mysqli');
     /**
      * Safety Extender compatability
      *
      * @TODO suggest patch for Nooku Framework's plgSystemKoowa after testing
      *
      * @author Margus Kaidja <abi@zone.ee>
      */
     if (extension_loaded("safeex") && strpos("tmpl", ini_get("safeex.url_include_proto_whitelist")) === false) {
         $s = ini_get("safeex.url_include_proto_whitelist");
         ini_set("safeex.url_include_proto_whitelist", (strlen($s) ? $s . ',' : '') . 'tmpl');
     }
     //Override JModuleHelper if j!1.6.x
     if (JVersion::isCompatible('1.6.0')) {
         $override = JPATH_ADMINISTRATOR . '/components/com_ninja/overrides/modulehelper.php';
         if (file_exists($override)) {
             require_once $override;
         }
     }
     $napiElement = JPATH_ADMINISTRATOR . '/components/com_ninja/elements/napi.php';
     if (!class_exists('JElementNapi', false) && file_exists($napiElement)) {
         require_once $napiElement;
     }
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         return;
     }
     if (!is_dir(JPATH_ADMINISTRATOR . '/components/com_ninja')) {
         return;
     }
     $path = KFactory::get('admin::com.ninja.helper.application')->getPath('com_xml');
     if (!$path) {
         return;
     }
     $xml = simplexml_load_file($path);
     if (!class_exists('KRequest')) {
         return;
     }
     $name = str_replace('com_', '', KRequest::get('get.option', 'cmd'));
     if (!$xml['mootools']) {
         return;
     }
     if (version_compare($xml['mootools'], '1.2', '<')) {
         return;
     }
     if (JVersion::isCompatible('1.6.0')) {
         KFactory::get('admin::com.ninja.helper.default')->js('/mootools12.js');
         KFactory::get('admin::com.ninja.helper.default')->js('/moocompat.js');
     } else {
         JHTML::addIncludePath(JPATH_ROOT . '/administrator/components/com_ninja/html');
         //Loading Mootools 1.2
         if (class_exists('JHTMLBehavior')) {
             return;
         }
         JHTML::_('behavior.framework');
     }
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:74,代码来源:ninja.php

示例11: register

 /**
  * Register mapped objects to the factory, and other things necessary for Ninjaboard to operate properly
  *
  * This function can only be executed once, statically
  *
  * Example:
  * 		<code>
  *			 if( !KLoader::path('site::com.ninjaboard.dispatcher') ) return;
  *			 
  *			 //Initialize the dispatcher just so models are mapped, and everything else Ninjaboard needs to run
  *			 KLoader::load('site::com.ninjaboard.dispatcher');
  *			 ComNinjaboardDispatcher::register();
  * 		</code>
  *
  * @author Stian Didriksen <stian@ninjaforge.com>
  * @return boolean	true means it registered, false means it have already registered
  */
 public static function register()
 {
     static $instance;
     if (isset($instance)) {
         return false;
     }
     // We like code reuse, so we map the frontend models to the backend models
     foreach (array('avatars', 'forums', 'settings', 'users', 'usergroups', 'people', 'profiles', 'topics', 'posts', 'attachments', 'watches', 'messages') as $model) {
         KFactory::map('site::com.ninjaboard.model.' . $model, 'admin::com.ninjaboard.model.' . $model);
     }
     foreach (array('forum') as $row) {
         KFactory::map('site::com.ninjaboard.database.row.' . $row, 'admin::com.ninjaboard.database.row.' . $row);
     }
     KFactory::map('site::com.ninjaboard.database.table.topics', 'admin::com.ninjaboard.database.table.topics');
     KFactory::map('site::com.ninjaboard.database.table.posts', 'admin::com.ninjaboard.database.table.posts');
     KFactory::map('site::com.ninjaboard.database.table.attachments', 'admin::com.ninjaboard.database.table.attachments');
     KFactory::map('site::com.ninjaboard.database.table.users', 'admin::com.ninjaboard.database.table.users');
     KFactory::map('site::com.ninjaboard.database.table.people', 'admin::com.ninjaboard.database.table.people');
     KFactory::map('site::com.ninjaboard.database.table.settings', 'admin::com.ninjaboard.database.table.settings');
     KFactory::map('site::com.ninjaboard.database.table.watches', 'admin::com.ninjaboard.database.table.watches');
     KFactory::map('site::com.ninjaboard.database.table.messages', 'admin::com.ninjaboard.database.table.messages');
     //@TODO temporary mappings
     KFactory::map('site::com.ninjaboard.model.rules', 'admin::com.ninjaboard.model.profile_fields');
     KFactory::map('site::com.ninjaboard.model.helps', 'admin::com.ninjaboard.model.profile_fields');
     //Set napi to load jquery scripts instead of mootools
     KFactory::get('admin::com.ninja.helper.default')->framework('jquery');
     //The following makes sure MooTools always loads first when needed and only loads jQuery if it isn't already
     if (KFactory::get('lib.joomla.application')->getTemplate() != 'morph' && !JFactory::getApplication()->get('jquery')) {
         KFactory::get('admin::com.ninja.helper.default')->js('/jquery.min.js');
         //Set jQuery as loaded, used in template frameworks like Warp5
         JFactory::getApplication()->set('jquery', true);
     }
     //Load the ninjaboard plugins
     JPluginHelper::importPlugin('ninjaboard', null, true, KFactory::get('lib.koowa.event.dispatcher'));
     return $instance = true;
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:53,代码来源:dispatcher.php


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