예제 #1
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->app = JFactory::getApplication();
     // Get project id.
     $this->projectId = $this->input->getUint('pid');
     // Prepare log object
     $registry = Joomla\Registry\Registry::getInstance('com_crowdfunding');
     /** @var  $registry Joomla\Registry\Registry */
     $fileName = $registry->get('logger.file');
     $tableName = $registry->get('logger.table');
     $file = JPath::clean($this->app->get('log_path') . DIRECTORY_SEPARATOR . $fileName);
     $this->log = new Prism\Log\Log();
     $this->log->addAdapter(new Prism\Log\Adapter\Database(JFactory::getDbo(), $tableName));
     $this->log->addAdapter(new Prism\Log\Adapter\File($file));
     // Create an object that contains a data used during the payment process.
     $this->paymentProcessContext = Crowdfunding\Constants::PAYMENT_SESSION_CONTEXT . $this->projectId;
     $this->paymentProcess = $this->app->getUserState($this->paymentProcessContext);
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = JString::trim(JString::strtolower($this->input->getCmd('payment_service')));
     $paymentService = $filter->clean($paymentService, 'ALNUM');
     $this->context = JString::strlen($paymentService) > 0 ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams('com_crowdfunding');
 }
 public function init()
 {
     jimport("EmailTemplates.init");
     // Prepare log object
     $registry = Joomla\Registry\Registry::getInstance("com_crowdfunding");
     /** @var  $registry Joomla\Registry\Registry */
     $fileName = $registry->get("logger.file");
     $tableName = $registry->get("logger.table");
     // Create log object
     $this->log = new Prism\Log\Log();
     // Set database writer.
     $this->log->addWriter(new Prism\Log\Writer\Database(JFactory::getDbo(), $tableName));
     // Set file writer.
     if (!empty($fileName)) {
         $file = JPath::clean(JFactory::getApplication()->get("log_path") . DIRECTORY_SEPARATOR . $fileName);
         $this->log->addWriter(new Prism\Log\Writer\File($file));
     }
     // Load language
     $this->loadLanguage();
 }
예제 #3
0
 /**
  * @return \Joomla\Registry\Registry
  */
 protected function getState()
 {
     return Joomla\Registry\Registry::getInstance($this->_statekey);
 }
예제 #4
0
if (!defined("CROWDFUNDING_PATH_COMPONENT_ADMINISTRATOR")) {
    define("CROWDFUNDING_PATH_COMPONENT_ADMINISTRATOR", JPATH_ADMINISTRATOR . "/components/com_crowdfunding");
}
if (!defined("CROWDFUNDING_PATH_COMPONENT_SITE")) {
    define("CROWDFUNDING_PATH_COMPONENT_SITE", JPATH_SITE . "/components/com_crowdfunding");
}
if (!defined("CROWDFUNDING_PATH_LIBRARY")) {
    define("CROWDFUNDING_PATH_LIBRARY", JPATH_LIBRARIES . "/Crowdfunding");
}
JLoader::registerNamespace('Crowdfunding', JPATH_LIBRARIES);
// Register some helpers
JLoader::register("CrowdfundingHelper", CROWDFUNDING_PATH_COMPONENT_ADMINISTRATOR . "/helpers/crowdfunding.php");
JLoader::register("CrowdfundingHelperRoute", CROWDFUNDING_PATH_COMPONENT_SITE . "/helpers/route.php");
// Register some Joomla! classes
JLoader::register('JHtmlString', JPATH_LIBRARIES . "/joomla/html/html/string.php");
JLoader::register("JHtmlCategory", JPATH_LIBRARIES . "/joomla/html/html/category.php");
// Include HTML helpers path
JHtml::addIncludePath(CROWDFUNDING_PATH_COMPONENT_SITE . '/helpers/html');
// Register Observers
JLoader::register("CrowdfundingObserverReward", CROWDFUNDING_PATH_COMPONENT_ADMINISTRATOR . "/tables/observers/reward.php");
JObserverMapper::addObserverClassToClass('CrowdfundingObserverReward', 'CrowdfundingTableReward', array('typeAlias' => 'com_crowdfunding.reward'));
// Prepare logger
$registry = Joomla\Registry\Registry::getInstance("com_crowdfunding");
/** @var  $registry Joomla\Registry\Registry */
$registry->set("logger.table", "#__crowdf_logs");
$registry->set("logger.file", "com_crowdfunding.php");
// Load library language
$lang = JFactory::getLanguage();
$lang->load('lib_crowdfunding', CROWDFUNDING_PATH_LIBRARY);
// Register class aliases.
JLoader::registerAlias('CrowdfundingCategories', '\\Crowdfunding\\Categories');