本文整理汇总了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 );
}
示例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];
}
示例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 );
}