Exemplo n.º 1
0
 /**
  * Method to register custom library.
  *
  * @return  void
  */
 public function onAfterInitialise()
 {
     if (!$this->isRedcoreComponent()) {
         return;
     }
     $redcoreLoader = JPATH_LIBRARIES . '/redcore/bootstrap.php';
     if (file_exists($redcoreLoader)) {
         require_once $redcoreLoader;
         // For Joomla! 2.5 compatibility we add some core functions
         if (version_compare(JVERSION, '3.0', '<')) {
             RLoader::registerPrefix('J', JPATH_LIBRARIES . '/redcore/joomla', false, true);
         }
     }
     // Make available the fields
     JFormHelper::addFieldPath(JPATH_LIBRARIES . '/redcore/form/fields');
     // Make available the rules
     JFormHelper::addRulePath(JPATH_LIBRARIES . '/redcore/form/rules');
 }
Exemplo n.º 2
0
 /**
  * Method to register custom library.
  *
  * @return  void
  */
 public function onAfterInitialise()
 {
     $isAdmin = JFactory::getApplication()->isAdmin();
     if (!$isAdmin || !$this->isRedradComponent()) {
         return;
     }
     $redradLoader = JPATH_LIBRARIES . '/redrad/bootstrap.php';
     if (file_exists($redradLoader) && !class_exists('Inflector')) {
         require_once $redradLoader;
         // For Joomla! 2.5 compatibility we add some core functions
         if (version_compare(JVERSION, '3.0', '<')) {
             RLoader::registerPrefix('J', JPATH_LIBRARIES . '/redrad/joomla', false, true);
         }
     }
     // Make available the fields
     JFormHelper::addFieldPath(JPATH_LIBRARIES . '/redrad/form/fields');
     // Make available the rules
     JFormHelper::addRulePath(JPATH_LIBRARIES . '/redrad/form/rules');
 }
Exemplo n.º 3
0
 /**
  * Proxy for JFormHelper::addRulePath().
  *
  * @param   mixed  $new  A path or array of paths to add.
  *
  * @return  array  The list of paths that have been added.
  *
  * @see JFormHelper::addRulePath()
  * @since   11.1
  */
 public static function addRulePath($new = null)
 {
     return JFormHelper::addRulePath($new);
 }
Exemplo n.º 4
0
/**
 * Bootstrap file.
 * Including this file into your application will make redRad available to use.
 *
 * @package    RedRad
 * @copyright  Copyright (C) 2013 redCOMPONENT.com. All rights reserved.
 * @license    GNU General Public License version 2 or later, see LICENSE.
 */
defined('JPATH_PLATFORM') or die;
define('JPATH_REDRAD', __DIR__);
require JPATH_REDRAD . '/inflector/inflector.php';
// Use our own base field
if (!class_exists('JFormField', false)) {
    $baseField = JPATH_LIBRARIES . '/redrad/joomla/form/field.php';
    if (file_exists($baseField)) {
        require_once $baseField;
    }
}
// Register the classes for autoload.
JLoader::registerPrefix('R', JPATH_REDRAD);
// Setup the RLoader.
RLoader::setup();
// Make available the redRAD fields
JFormHelper::addFieldPath(JPATH_REDRAD . '/form/fields');
// Make available the redRAD form rules
JFormHelper::addRulePath(JPATH_REDRAD . '/form/rules');
// HTML helpers
JHtml::addIncludePath(JPATH_REDRAD . '/html');
// Load library language
$lang = JFactory::getLanguage();
$lang->load('lib_redrad', JPATH_SITE);
Exemplo n.º 5
0
<?php

/**
 * Dummy Library file.
 * Including this file into your application will make dummy available to use.
 *
 * @package    Dummy.Library
 * @copyright  Copyright (C) 2013 redCOMPONENT.com. All rights reserved.
 * @license    GNU General Public License version 2 or later, see LICENSE.
 */
defined('JPATH_PLATFORM') or die;
// Define dummy Library Folder Path
define('JPATH_DUMMY_LIBRARY', __DIR__);
// Bootstraps redCORE
RBootstrap::bootstrap();
// Register library prefix
RLoader::registerPrefix('Dummy', JPATH_DUMMY_LIBRARY);
// Make available the dummy fields
JFormHelper::addFieldPath(JPATH_DUMMY_LIBRARY . '/form/fields');
// Make available the dummy form rules
JFormHelper::addRulePath(JPATH_DUMMY_LIBRARY . '/form/rules');
Exemplo n.º 6
0
 /**
  * Method to get the row form.
  *
  * @return	mixed	JForm object on success, false on failure.
  * @since	1.6
  */
 public function getForm($name = null)
 {
     if (!$name) {
         $name = $this->getName();
     }
     // Initialize variables.
     $app =& JFactory::getApplication();
     // Get the form.
     $form = $this->_getForm($name, 'form', array('control' => 'jform'));
     JFormHelper::addRulePath(JPATH_COMPONENT_ADMINISTRATOR . '/models/rules');
     // Check for an error.
     if (JError::isError($form)) {
         $this->setError($form->getMessage());
         return false;
     }
     // Check the session for previously entered form data.
     $data = $app->getUserState($this->_context . '.edit.' . $name . '.data', array());
     // Bind the form data if present.
     if (!empty($data)) {
         $form->bind($data);
     }
     return $form;
 }
Exemplo n.º 7
0
 /**
  * Effectively bootstrap redCORE.
  *
  * @param   bool  $loadBootstrap  Load bootstrap with redcore plugin options
  *
  * @return  void
  */
 public static function bootstrap($loadBootstrap = true)
 {
     if ($loadBootstrap && !defined('REDCORE_BOOTSTRAPPED')) {
         define('REDCORE_BOOTSTRAPPED', 1);
     }
     if (!defined('REDCORE_LIBRARY_LOADED')) {
         // Sets bootstrapped variable, to avoid bootstrapping redCORE twice
         define('REDCORE_LIBRARY_LOADED', 1);
         // Use our own base field
         if (!class_exists('JFormField', false)) {
             $baseField = JPATH_LIBRARIES . '/redcore/joomla/form/field.php';
             if (file_exists($baseField)) {
                 require_once $baseField;
             }
         }
         // Register the classes for autoload.
         JLoader::registerPrefix('R', JPATH_REDCORE);
         // Setup the RLoader.
         RLoader::setup();
         // Make available the redCORE fields
         JFormHelper::addFieldPath(JPATH_REDCORE . '/form/field');
         JFormHelper::addFieldPath(JPATH_REDCORE . '/form/fields');
         // Make available the redCORE form rules
         JFormHelper::addRulePath(JPATH_REDCORE . '/form/rules');
         // HTML helpers
         JHtml::addIncludePath(JPATH_REDCORE . '/html');
         RHtml::addIncludePath(JPATH_REDCORE . '/html');
         // Load library language
         $lang = JFactory::getLanguage();
         $lang->load('lib_redcore', JPATH_REDCORE);
         // For Joomla! 2.5 compatibility we add some core functions
         if (version_compare(JVERSION, '3.0', '<')) {
             RLoader::registerPrefix('J', JPATH_LIBRARIES . '/redcore/joomla', false, true);
         }
         // Make available the fields
         JFormHelper::addFieldPath(JPATH_LIBRARIES . '/redcore/form/fields');
         // Make available the rules
         JFormHelper::addRulePath(JPATH_LIBRARIES . '/redcore/form/rules');
         // Replaces Joomla database driver for redCORE database driver
         JFactory::$database = null;
         JFactory::$database = RFactory::getDbo();
         if (self::getConfig('enable_translations', 0) == 1 && !JFactory::getApplication()->isAdmin()) {
             // This is our object now
             $db = JFactory::getDbo();
             // Enable translations
             $db->translate = self::getConfig('enable_translations', 0) == 1;
             // Reset plugin translations params if needed
             RTranslationHelper::resetPluginTranslation();
         }
     }
 }
Exemplo n.º 8
0
defined('_JEXEC') or die;
$redcoreLoader = JPATH_LIBRARIES . '/redcore/bootstrap.php';
if (!file_exists($redcoreLoader) || !JPluginHelper::isEnabled('system', 'redcore')) {
    throw new Exception(JText::_('COM_TRACKS_REDCORE_INIT_FAILED'), 404);
}
include_once $redcoreLoader;
// Bootstraps redCORE
RBootstrap::bootstrap();
// Register library prefix
RLoader::registerPrefix('Trackslib', __DIR__);
// Make available the fields
JFormHelper::addFieldPath(JPATH_LIBRARIES . '/tracks/form/field');
JFormHelper::addFieldPath(JPATH_LIBRARIES . '/tracks/form/fields');
// Make available the form rules
JFormHelper::addRulePath(JPATH_LIBRARIES . '/tracks/form/rule');
JFormHelper::addRulePath(JPATH_LIBRARIES . '/tracks/form/rules');
/**
 * Tracks bootstrap class
 *
 * @package     Tracks
 * @subpackage  Library
 * @since       3.0
 */
class TrackslibBootstrap
{
    /**
     * Effectively bootstraps Tracks
     *
     * @return void
     */
    public static function bootstrap()
Exemplo n.º 9
0
<?php

/**
 * @package     Sample
 * @subpackage  Library
 *
 * @copyright   Copyright (C) 2013 Roberto Segura. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
// Ensure that autoloaders are set
JLoader::setup();
// Global libraries autoloader
JLoader::registerPrefix('Hepta', dirname(__FILE__));
// Common fields
JFormHelper::addFieldPath(dirname(__FILE__) . '/form/field');
// Common form rules
JFormHelper::addRulePath(dirname(__FILE__) . '/form/rule');
// Common HTML helpers
JHtml::addIncludePath(dirname(__FILE__) . '/html');
// Load library language
$lang = JFactory::getLanguage();
$lang->load('lib_hepta_formfields', JPATH_SITE);
Exemplo n.º 10
0
<?php

defined('JPATH_PLATFORM') or die;
define('JPATH_OPENHRM', dirname(__FILE__));
require JPATH_OPENHRM . '/functions.php';
if (!class_exists('JFormField', false)) {
    $baseField = JPATH_LIBRARIES . '/openhrm/joomla/form/field.php';
    if (file_exists($baseField)) {
        require_once $baseField;
    }
}
// Register the classes for autoload.
JLoader::registerPrefix('R', JPATH_OPENHRM);
// Setup the RLoader.
RLoader::setup();
// Make available the openhrm fields
JFormHelper::addFieldPath(JPATH_OPENHRM . '/form/fields');
// Make available the openhrm form rules
JFormHelper::addRulePath(JPATH_OPENHRM . '/form/rules');
// HTML helpers
JHtml::addIncludePath(JPATH_OPENHRM . '/html');
// Load library language
$lang = JFactory::getLanguage();
$lang->load('lib_openhrm', JPATH_SITE);
Exemplo n.º 11
0
 /**
  * Validate teh element against a Joomla form Rule
  *
  * @param   string  $type   Rule type e.g. 'password'
  * @param   mixed   $value  Value to validate
  * @param   mixed   $path   Optional path to load teh rule from
  *
  * @throws Exception
  *
  * @return bool
  */
 protected function validateJRule($type, $value, $path = null)
 {
     if (!is_null($path)) {
         JFormHelper::addRulePath($path);
     }
     $rule = JFormHelper::loadRuleType($type, true);
     $xml = new SimpleXMLElement('<xml></xml>');
     $this->lang->load('com_users');
     if (!$rule->test($xml, $value)) {
         $this->validationError = '';
         foreach ($this->app->getMessageQueue() as $i => $msg) {
             if ($msg['type'] === 'warning') {
                 $this->validationError .= $msg['message'] . '<br />';
             }
         }
         FabrikWorker::killMessage($this->app, 'warning');
         return false;
     }
     return true;
 }
Exemplo n.º 12
0
//  ini_set('error_reporting', E_ALL | E_STRICT | E_NOTICE | E_DEPRECATED);
//  ini_set('display_errors', '1');
//  ini_set("log_errors" , "0");
//  ini_set("error_log" , "/var/log/php-error.log");
// import joomla controller library
jimport('joomla.application.component.controller');
jimport('joomla.application.component.view');
jimport('joomla.form.helper');
jimport('migur.migur');
jimport('joomla.error.log');
// Add the helper
JLoader::import('helpers.javascript', JPATH_COMPONENT_ADMINISTRATOR, '');
JLoader::import('helpers.rssfeed', JPATH_COMPONENT_ADMINISTRATOR, '');
JLoader::import('helpers.log', JPATH_COMPONENT_ADMINISTRATOR, '');
JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'html');
JFormHelper::addRulePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'rules');
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models');
JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'entities', 'NewsletterModelEntity');
// Get an instance of the controller prefixed by Newsletter
$controller = JController::getInstance('Newsletter');
// ACL
$resource = JRequest::getString('view', '') . '.' . JRequest::getString('layout', 'default');
switch ($resource) {
    case 'subscribe.unsubscribe':
        if (!JFactory::getUser()->id && !JRequest::getString('uid', NULL)) {
            JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_users&view=login&returnurl=' . base64_encode(JRoute::_('index.php?option=com_newsletter&view=subscribe&layout=unsubscribe', false))), JText::_('COM_NEWSLETTER_LOGIN_FIRST'), 'message');
        }
}
// Add translations used in JavaScript
JavascriptHelper::requireTranslations();