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


PHP Komento::getCurrentComponent方法代码示例

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


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

示例1: getRule

	public function getRule()
	{
		$component	= Komento::getCurrentComponent();
		$ip			= KomentoIpHelper::getIP();

		$rules		= Komento::getModel( 'ipfilter' )->getRule( $component, $ip );
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:7,代码来源:ip.php

示例2: loadApplication

 /**
  * A model to get data from a component's content item
  */
 public static function loadApplication($component = '')
 {
     static $instances = null;
     if (is_numeric($instances)) {
         $instances = array();
     }
     $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component);
     $properInstance = true;
     $komentoPlugin = true;
     // Create a copy of the name so that the original $component won't get affected
     $componentName = $component;
     // If component is empty, then try to load it from getCurrentComponent
     if (empty($componentName)) {
         $componentName = Komento::getCurrentComponent();
         // If component is still empty, then assign it as error
         if (empty($componentName)) {
             $componentName = 'error';
         }
     }
     // Check for pro components
     // $package = Komento::getPackage();
     // if( $package !== 'paid' && in_array( $component, Komento::getPaidComponents() ) )
     // {
     // 	$componentName = 'error';
     // }
     // It is possible that even getCurrentComponent doesn't have a data
     if (empty($instances[$componentName])) {
         // Require the base abstract class first
         require_once KOMENTO_ROOT . DIRECTORY_SEPARATOR . 'komento_plugins' . DIRECTORY_SEPARATOR . 'abstract.php';
         $classObject = '';
         // Get the component's object first
         $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . $componentName . DIRECTORY_SEPARATOR . 'komento_plugin.php';
         // If it doesn't exist in component path, then look for Komento's native plugin
         if (!JFile::exists($file)) {
             // Load from Komento's plugin folder
             $file = KOMENTO_ROOT . DIRECTORY_SEPARATOR . 'komento_plugins' . DIRECTORY_SEPARATOR . $componentName . '.php';
             if (!JFile::exists($file)) {
                 $komentoPlugin = false;
             }
         }
         // If Komento plugin is found, then initialise it
         if ($komentoPlugin) {
             require_once $file;
             // Load the class
             $className = 'Komento' . ucfirst(strtolower(preg_replace('/[^A-Z0-9]/i', '', $componentName)));
             if (class_exists($className)) {
                 $classObject = new $className($component);
                 // If there are any errors in initialising the class
                 if (!$classObject instanceof KomentoExtension || !$classObject->state) {
                     $properInstance = false;
                 } else {
                     $instances[$componentName] = $classObject;
                 }
             } else {
                 $properInstance = false;
             }
         }
     }
     // If there are any errors
     if (!$komentoPlugin || !$properInstance || empty($componentName)) {
         require_once KOMENTO_ROOT . DIRECTORY_SEPARATOR . 'komento_plugins' . DIRECTORY_SEPARATOR . 'error.php';
         $classObject = new KomentoError($component);
         if (empty($componentName)) {
             $componentName = 'error';
         }
         $instances[$componentName] = $classObject;
     }
     return $instances[$componentName];
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:72,代码来源:helper.php

示例3: allow

	public function allow( $action = '', $component = '' )
	{
		static $loaded = null;

		$component	= $component ? $component : Komento::getCurrentComponent();

		if (!$loaded)
		{
			require_once( KOMENTO_HELPERS . DIRECTORY_SEPARATOR . 'acl.php' );
			$loaded = true;
		}

		return KomentoAclHelper::check( $action, $component, $this->id );
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:14,代码来源:profile.php


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