Example #1
0
 /**
  * Class entry point
  *
  * @param	object		Registry reference
  * @return	@e void		[Outputs to screen]
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Load handler...
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
     $this->han_login = new $classToLoad($this->registry);
     $this->han_login->init();
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_login'), 'core');
     //-----------------------------------------
     // Show form or process login?
     //-----------------------------------------
     if ($this->request['do'] == 'showForm') {
         $additional_data = $this->han_login->additionalFormHTML();
         $replace = false;
         $data = array();
         if (!is_null($additional_data) and is_array($additional_data) and count($additional_data)) {
             $replace = $additional_data[0];
             $data = $additional_data[1];
         }
         $this->returnHtml($this->registry->getClass('output')->getTemplate('global')->loginForm($replace == 'replace' ? true : false, $data));
     } else {
         if ($this->request['do'] == 'authenticateUser') {
             return $this->_authenticateUser();
         } else {
             return $this->_doLogIn();
         }
     }
 }
 /**
  * Initiate login handler
  *
  * @access	public
  * @return	void
  */
 public function initHanLogin()
 {
     require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php';
     $this->han_login = new han_login($this->registry);
     $this->han_login->is_admin_auth = 1;
     $this->han_login->init();
 }
 /**
  * Initiate login handler
  *
  * @return	@e void
  */
 public function initHanLogin()
 {
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
     $this->han_login = new $classToLoad($this->registry);
     $this->han_login->is_admin_auth = 1;
     $this->han_login->init();
 }
Example #4
0
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### RSS READER ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->objFeed = new \SimplePie();
     $arrUrls = trimsplit('[\\n\\t ]', trim($this->rss_feed));
     if (count($arrUrls) > 1) {
         $this->objFeed->set_feed_url($arrUrls);
     } else {
         $this->objFeed->set_feed_url($arrUrls[0]);
     }
     $this->objFeed->set_output_encoding($GLOBALS['TL_CONFIG']['characterSet']);
     $this->objFeed->set_cache_location(TL_ROOT . '/system/tmp');
     $this->objFeed->enable_cache(false);
     if ($this->rss_cache > 0) {
         $this->objFeed->enable_cache(true);
         $this->objFeed->set_cache_duration($this->rss_cache);
     }
     if (!$this->objFeed->init()) {
         $this->log('Error importing RSS feed "' . $this->rss_feed . '"', 'ModuleRssReader generate()', TL_ERROR);
         return '';
     }
     $this->objFeed->handle_content_type();
     return parent::generate();
 }
Example #5
0
 /**
  * Initialize singleton
  *
  * @return  object
  */
 public static function instance()
 {
     if (empty(self::$_instance)) {
         self::$_instance = new self();
         self::$_instance->init();
     }
     return self::$_instance;
 }
 /**
  * Return the singleton instance.
  *
  * @author Steven A. Zahm
  * @since 0.7.3.0
  * @return void
  */
 public static function getInstance()
 {
     if (!self::$_instance) {
         self::$_instance = new cnSettingsAPI();
         self::$_instance->init();
     }
     return self::$_instance;
 }
Example #7
0
 /**
  * testInit
  *
  * @since 3.0.0
  */
 public function testInit()
 {
     /* setup */
     $this->_registry->init();
     /* actual */
     $actual = $this->_registry;
     /* compare */
     $this->assertInstanceOf('Redaxscript\\Registry', $actual);
 }
 /**
  * testInit
  *
  * @since 2.4.0
  */
 public function testInit()
 {
     /* setup */
     $this->_config->init(Stream::url('root/config.php'));
     /* actual */
     $actual = $this->_config->get('dbType');
     /* compare */
     $this->assertNotEmpty($actual);
 }
Example #9
0
 /**
  * testRender
  *
  * @since 3.0.0
  *
  * @param array $registryArray
  * @param string $expect
  *
  * @dataProvider providerRender
  */
 public function testRender($registryArray = [], $expect = null)
 {
     /* setup */
     $this->_registry->init($registryArray);
     $title = new Head\Title($this->_registry);
     /* actual */
     $actual = $title;
     /* compare */
     $this->assertEquals($expect, $actual);
 }
 /**
  * testRender
  *
  * @since 3.0.0
  *
  * @param array $registryArray
  * @param string $expect
  *
  * @dataProvider providerRender
  */
 public function testRender($registryArray = [], $expect = null)
 {
     /* setup */
     $this->_registry->init($registryArray);
     $consoleForm = new View\ConsoleForm($this->_registry, $this->_language);
     /* actual */
     $actual = $consoleForm->render();
     /* compare */
     $this->assertEquals($expect, $actual);
 }
Example #11
0
 /**
  * @return void
  */
 public function init()
 {
     if ($this->isInitialized()) {
         return;
     }
     $this->config = $this->getServiceConfig();
     $this->driver = $this->config->get('driver');
     $this->driver->init();
     $this->isInitialized = true;
 }
Example #12
0
 /**
  * testInit
  *
  * @since 3.0.0
  */
 public function testInit()
 {
     /* setup */
     $this->_language->init('de');
     $this->_language->init('en');
     /* actual */
     $actual = $this->_language;
     /* compare */
     $this->assertInstanceOf('Redaxscript\\Language', $actual);
 }
 /**
  * Constructor function.
  * @access  public
  * @since   6.0.0
  * @return  void
  */
 public function __construct()
 {
     $this->_token = 'wf';
     $this->_field_obj = new PP_PB_WF_Fields_Settings();
     $options = pp_pb_add_theme_options(array());
     $this->_field_obj->init($options);
     $this->_field_obj->__set('token', 'woo');
     $this->_fields = $this->_field_obj->__get('fields');
     add_action('admin_menu', array($this, 'register_settings_screen'), 110);
 }
 /**
  * testRender
  *
  * @since 3.0.0
  *
  * @param array $registryArray
  * @param integer $articleId
  * @param array $expectArray
  *
  * @dataProvider providerRender
  */
 public function testRender($registryArray = [], $articleId = null, $expectArray = [])
 {
     /* setup */
     $this->_registry->init($registryArray);
     $articleForm = new Admin\View\ArticleForm($this->_registry, $this->_language);
     /* actual */
     $actual = $articleForm->render($articleId);
     /* compare */
     $this->assertStringStartsWith($expectArray['start'], $actual);
     $this->assertStringEndsWith($expectArray['end'], $actual);
 }
Example #15
0
 /**
  * testParser
  *
  * @since 2.1.0
  *
  * @param array $registry
  * @param string $input
  * @param string $route
  * @param string $expect
  *
  * @dataProvider providerParser
  */
 public function testParser($registry = array(), $input = null, $route = null, $expect = null)
 {
     /* setup */
     $this->_registry->init($registry);
     $parser = new Parser($this->_registry, $this->_language);
     $parser->init($input, $route, array('className' => array('break' => 'link-read-more', 'code' => 'box-code')));
     /* actual */
     $actual = $parser->getOutput();
     /* compare */
     $this->assertEquals($expect, $actual);
 }
 /**
  * Collects and returns user group list.
  *
  * @return object
  */
 public function setUserGroups()
 {
     if ($this->_oGroups === null) {
         $this->_oGroups = oxNew('oxlist');
         $this->_oGroups->init('oxgroups');
         $sViewName = getViewName("oxgroups");
         $sSelect = "select gr.* from {$sViewName} as gr, oxobject2group as o2g where\n                         o2g.oxobjectid = " . oxDb::getDb()->quote($this->getId()) . " and gr.oxid = o2g.oxgroupsid ";
         $this->_oGroups->selectString($sSelect);
     }
     return $this->_oGroups;
 }
Example #17
0
 /**
  * testParseBreak
  *
  * @since 2.1.0
  *
  * @param array $registry
  * @param string $text
  * @param string $route
  * @param string $expect
  *
  * @dataProvider providerParser
  */
 public function testParseBreak($registry = array(), $text = null, $route = null, $expect = null)
 {
     /* setup */
     $this->_registry->init($registry);
     $options = array('className' => array('break' => 'link-read-more', 'code' => 'box-code'));
     $parser = new Parser($this->_registry, $this->_language, $text, $route, $options);
     /* result */
     $result = $parser->getOutput();
     /* compare */
     $this->assertEquals($expect, $result);
 }
Example #18
0
 /**
  * testConcat
  *
  * @since 3.0.0
  *
  * @param array $registryArray
  * @param array $collectionArray
  * @param array $expectArray
  *
  * @dataProvider providerConcat
  */
 public function testConcat($registryArray = [], $collectionArray = [], $expectArray = [])
 {
     /* setup */
     $optionArray = ['directory' => Stream::url('root/cache/styles'), 'extension' => 'css', 'attribute' => 'href', 'lifetime' => 86400];
     $this->_registry->init($registryArray);
     $loader = new Assetic\Loader($this->_registry);
     $loader->init($collectionArray, 'css')->concat($optionArray)->concat($optionArray);
     /* actual */
     $actualArray = $loader->getCollectionArray();
     /* compare */
     $this->assertEquals($expectArray, $actualArray);
 }
Example #19
0
 /**
  * Constructor function.
  * @access  public
  * @since   6.0.0
  * @return  void
  */
 public function __construct()
 {
     $this->_token = 'wf';
     $this->_field_obj = new WF_Fields_Settings();
     $this->_field_obj->init($this->get_settings_template());
     $this->_field_obj->__set('token', 'woo');
     $this->_fields = $this->_field_obj->__get('fields');
     if (is_admin()) {
         add_action('admin_menu', array($this, 'register_settings_screen'), 1);
         // Make sure this menu item is always first.
         add_action('admin_notices', array($this, 'admin_notices'));
     }
 }
 /**
  * Initializes the selection object
  *
  * @param	object		$SOBE That is the object that is the module and stores the session data
  * @param 	array 		$selectionClasses Array of class resources
  * @param	string		$paramPrefix Name of a prefix used for special commands (undo).
  * @param	string		$store_MOD_SETTINGS Name of the MOD_SETTINGS key to store the selection.
  * @return	void
  */
 function initSelection(&$SOBE, $selectionClasses, $paramPrefix, $store_MOD_SETTINGS)
 {
     global $TYPO3_CONF_VARS;
     $this->SOBE =& $SOBE;
     $this->sl = t3lib_div::makeInstance('tx_dam_selection');
     $this->sl->init($this, $SOBE, $selectionClasses, $paramPrefix, $store_MOD_SETTINGS);
 }
Example #21
0
 /**
  * Class constructor (ALA Akelos Framework)
  *
  * This method loads an instance of selected driver in order to
  * use it class wide.
  *
  * @access public
  * @param    mixed    $options    You can pass a number specifying the second for
  * the cache to expire or an array with the
  * following options:
  *
  * <code>
  * $options = array(
  * //This options are valid for both cache contains (database and file based)
  * 'lifeTime' => cache lifetime in seconds
  * (int),
  * 'memoryCaching' => enable / disable memory caching (boolean),
  * 'automaticSerialization' => enable / disable automatic serialization (boolean)
  *
  * //This options are for file based cache
  * 'cacheDir' => directory where to put the cache files (string),
  * 'caching' => enable / disable caching (boolean),
  * 'fileLocking' => enable / disable fileLocking (boolean),
  * 'writeControl' => enable / disable write control (boolean),
  * 'readControl' => enable / disable read control (boolean),
  * 'readControlType' => type of read control
  * 'crc32', 'md5', 'strlen' (string),
  * 'pearErrorMode' => pear error mode (when raiseError is called) (cf PEAR doc) (int),
  * 'onlyMemoryCaching' => enable / disable only memory caching (boolean),
  * 'memoryCachingLimit' => max nbr of records to store into memory caching (int),
  * 'fileNameProtection' => enable / disable automatic file name protection (boolean),
  * 'automaticCleaningFactor' => distable / tune automatic cleaning process (int)
  * 'hashedDirectoryLevel' => level of the hashed directory system (int)
  * );
  * </code>
  * @param    integer    $cache_type    The default value is set by defining the constant AK_CACHE_HANDLER in the following line
  *
  * <code>define ('AK_CACHE_HANDLER', 1);</code>
  *
  * in the ''config/config.php'' file
  *
  * Possible values are:
  *
  * - 0: No cache at all
  * - 1: File based cache using the folder defined at AK_CACHE_DIR or the system /tmp dir
  * - 2: Database based cache. This one has a performance penalty, but works on most servers
  * @return void
  */
 function init($options = null, $cache_type = AK_CACHE_HANDLER)
 {
     $options = is_int($options) ? array('lifeTime' => $options) : (is_array($options) ? $options : array());
     switch ($cache_type) {
         case 1:
             $this->cache_enabled = true;
             if (!class_exists('Cache_Lite')) {
                 require_once AK_CONTRIB_DIR . '/pear/Cache_Lite/Lite.php';
             }
             if (!isset($options['cacheDir'])) {
                 if (!is_dir(AK_CACHE_DIR)) {
                     Ak::make_dir(AK_CACHE_DIR, array('base_path' => AK_TMP_DIR));
                 }
                 $options['cacheDir'] = AK_CACHE_DIR . DS;
             }
             $this->_driverInstance =& new Cache_Lite($options);
             break;
         case 2:
             $this->cache_enabled = true;
             require_once AK_LIB_DIR . '/AkCache/AkAdodbCache.php';
             $this->_driverInstance =& new AkAdodbCache();
             $this->_driverInstance->init($options);
             break;
         default:
             $this->cache_enabled = false;
             break;
     }
 }
Example #22
0
 function init($options = array(), $type = null)
 {
     $options = is_int($options) ? array('lifeTime' => $options) : (is_array($options) ? $options : array());
     switch ($type) {
         case 1:
             $this->sessions_enabled = false;
             if (isset($options['save_path'])) {
                 session_save_path($options['save_path']);
             }
             break;
         case 2:
             require_once AK_LIB_DIR . '/AkCache/AkAdodbCache.php';
             $this->_driverInstance =& new AkAdodbCache();
             $res = $this->_driverInstance->init($options);
             $this->sessions_enabled = $res;
             break;
         case 3:
             require_once AK_LIB_DIR . '/AkCache/AkMemcache.php';
             $this->_driverInstance =& new AkMemcache();
             $res = $this->_driverInstance->init($options);
             $this->sessions_enabled = $res;
             break;
         default:
             $this->sessions_enabled = false;
             break;
     }
     if ($this->sessions_enabled) {
         $this->sessionLife = $options['lifeTime'];
         session_set_save_handler(array(&$this, '_open'), array(&$this, '_close'), array(&$this, '_read'), array(&$this, '_write'), array(&$this, '_destroy'), array(&$this, '_gc'));
     }
 }
 /**
  * Returns items list
  *
  * @return oxlist
  */
 public function getItemList()
 {
     if ($this->_oList === null && $this->_sListClass) {
         $this->_oList = oxNew($this->_sListType);
         $this->_oList->clear();
         $this->_oList->init($this->_sListClass);
         $aWhere = $this->buildWhere();
         $oListObject = $this->_oList->getBaseObject();
         oxSession::setVar('tabelle', $this->_sListClass);
         $this->_aViewData['listTable'] = getViewName($oListObject->getCoreTableName());
         $this->getConfig()->setGlobalParameter('ListCoreTable', $oListObject->getCoreTableName());
         if ($oListObject->isMultilang()) {
             // is the object multilingual?
             $oListObject->setLanguage(oxLang::getInstance()->getBaseLanguage());
             if (isset($this->_blEmployMultilanguage)) {
                 $oListObject->setEnableMultilang($this->_blEmployMultilanguage);
             }
         }
         $sSql = $this->_buildSelectString($oListObject);
         $sSql = $this->_prepareWhereQuery($aWhere, $sSql);
         $sSql = $this->_prepareOrderByQuery($sSql);
         $sSql = $this->_changeselect($sSql);
         // calculates count of list items
         $this->_calcListItemsCount($sSql);
         // setting current list position (page)
         $this->_setCurrentListPosition(oxConfig::getParameter('jumppage'));
         // settting additioan params for list: current list size
         $this->_oList->setSqlLimit($this->_iCurrListPos, $this->_getViewListSize());
         $this->_oList->selectString($sSql);
     }
     return $this->_oList;
 }
Example #24
0
 /**
  * {@inheritDoc}
  * @see \Avenue\AppInterface::addRoute()
  */
 public function addRoute()
 {
     if (!$this->route->isFulfilled()) {
         return $this->route->init(func_get_args());
     }
     return true;
 }
 /**
  * Return an instance of this class.
  *
  * @since     1.0.0
  * @return    object    A single instance of this class.
  */
 public static function get_redux_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$redux) {
         self::$redux = new ReduxFramework();
         self::$redux->init();
     }
     return self::$redux;
 }
 /**
  * Return an instance of this class.
  *
  * @since     1.0.0
  * @return    object    A single instance of this class.
  */
 public static function get_avadaredux_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$avadaredux && AvadaReduxFramework::$_as_plugin) {
         self::$avadaredux = new AvadaReduxFramework();
         self::$avadaredux->init();
     }
     return self::$avadaredux;
 }
Example #27
0
 /**
  * Accessor for the log in functions
  *
  * @access	public
  * @return	object
  */
 public function _login()
 {
     if (!is_object($this->_login)) {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
         $this->_login = new $classToLoad($this->registry);
         $this->_login->init();
     }
     return $this->_login;
 }
Example #28
0
 /**
  * testGetClass
  *
  * @since 3.0.0
  *
  * @param array $registryArray
  * @param string $expect
  *
  * @dataProvider providerGetClass
  */
 public function testGetClass($registryArray = [], $expect = null)
 {
     /* setup */
     $this->_registry->init($registryArray);
     /* actual */
     $actual = Template\Helper::getClass();
     /* compare */
     $this->assertEquals($expect, $actual);
 }
Example #29
0
 /**
  * testWrite
  *
  * @since 2.4.0
  */
 public function testWrite()
 {
     /* setup */
     $this->_config->init(Stream::url('root/config.php'));
     /* actual */
     $actual = $this->_config->write();
     /* compare */
     $this->assertNotFalse($actual);
 }
 /**
  * Accessor for the log in functions
  *
  * @access	public
  * @return	object
  */
 public function _login()
 {
     if (!is_object($this->_login)) {
         require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php';
         $this->_login = new han_login($this->registry);
         $this->_login->init();
     }
     return $this->_login;
 }