public function getRule() { $component = Komento::getCurrentComponent(); $ip = KomentoIpHelper::getIP(); $rules = Komento::getModel( 'ipfilter' )->getRule( $component, $ip ); }
/** * 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]; }
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 ); }