/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); // load plugin parameters $this->_config = Component::params('com_projects'); $this->_database = App::get('db'); }
/** * Constructor. * * @param object &$subject The object to observe * @param array $config An array that holds the plugin configuration * * @since 1.5 */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); // Log the deprecated API. if ($this->params->get('log-deprecated')) { \JLog::addLogger(array('text_file' => 'deprecated.php'), \JLog::ALL, array('deprecated')); } // Log database errors if ($this->params->get('log-database-errors')) { \JLog::addLogger(array('text_file' => 'jdatabase.error.php'), \JLog::ALL, array('database')); } // Log database queries if ($this->params->get('log-database-queries')) { \JLog::addLogger(array('text_file' => 'jdatabase.query.php'), \JLog::ALL, array('databasequery')); // Register the HUBzero database logger as well // Don't worry, this won't log things twice...queries through joomla's database driver // will get logged above, and this will catch queries through hubzero's database driver \Event::listen(function ($event) { \Hubzero\Database\Log::add($event->getArgument('query'), $event->getArgument('time')); }, 'database_query'); } // Only if debugging or language debug is enabled if (Config::get('debug') || Config::get('debug_lang')) { Config::set('gzip', 0); ob_start(); ob_implicit_flush(false); } $this->linkFormat = ini_get('xdebug.file_link_format'); }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); include_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'tables' . DS . 'category.php'; include_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'tables' . DS . 'publication.php'; include_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'tables' . DS . 'author.php'; }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->infolink = '/kb/points/'; $this->banking = Component::params('com_members')->get('bankAccounts'); include_once __DIR__ . DS . 'helper.php'; }
public function __construct(&$subject, $config) { parent::__construct($subject, $config); // Ensure that constructor is called one time self::$cookie = SID == ''; if (!self::$default_lang) { $app = JFactory::getApplication(); $router = $app->getRouter(); if (App::isSite()) { // setup language data self::$mode_sef = $router->getMode() == JROUTER_MODE_SEF ? true : false; self::$sefs = JLanguageHelper::getLanguages('sef'); self::$lang_codes = JLanguageHelper::getLanguages('lang_code'); self::$default_lang = Component::params('com_languages')->get('site', 'en-GB'); self::$default_sef = self::$lang_codes[self::$default_lang]->sef; self::$homes = MultilangstatusHelper::getHomepages(); $user = User::getRoot(); $levels = $user->getAuthorisedViewLevels(); foreach (self::$sefs as $sef => &$language) { if (isset($language->access) && $language->access && !in_array($language->access, $levels)) { unset(self::$sefs[$sef]); } } App::forget('language.filter'); App::set('language.filter', true); $uri = JFactory::getURI(); if (self::$mode_sef) { // Get the route path from the request. $path = JString::substr($uri->toString(), JString::strlen($uri->base())); // Apache mod_rewrite is Off $path = Config::get('sef_rewrite') ? $path : JString::substr($path, 10); // Trim any spaces or slashes from the ends of the path and explode into segments. $path = JString::trim($path, '/ '); $parts = explode('/', $path); // The language segment is always at the beginning of the route path if it exists. $sef = $uri->getVar('lang'); if (!empty($parts) && empty($sef)) { $sef = reset($parts); } } else { $sef = $uri->getVar('lang'); } if (isset(self::$sefs[$sef])) { $lang_code = self::$sefs[$sef]->lang_code; // Create a cookie $cookie_domain = Config::get('cookie_domain', ''); $cookie_path = Config::get('cookie_path', '/'); setcookie(App::hash('language'), $lang_code, $this->getLangCookieTime(), $cookie_path, $cookie_domain); // set the request var Request::setVar('language', $lang_code); } } parent::__construct($subject, $config); // Detect browser feature if (App::isSite()) { $app->setDetectBrowser($this->params->get('detect_browser', '1') == '1'); } } }
/** * Object Constructor. * * @param object The object to observe -- event dispatcher. * @param object The configuration object for the plugin. * @return void * @since 1.0 */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); if (App::isSite()) { // Set the error handler for E_ERROR to be the class handleError method. set_exception_handler(array('plgSystemRedirect', 'handleError')); } }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->_database = App::get('db'); require_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'tables' . DS . 'logs.php'; require_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'tables' . DS . 'publication.php'; require_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'tables' . DS . 'author.php'; require_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'tables' . DS . 'category.php'; require_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'helpers' . DS . 'html.php'; }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function plgSupportCaptcha(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); if (!User::isGuest()) { if (User::get('activation') == 1 || User::get('activation') == 3) { $this->_verified = true; } } }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function plgSupportCaptcha(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); if (!User::isGuest()) { $profile = \Hubzero\User\Profile::getInstance(User::get('id')); if ($profile->get('emailConfirmed') == 1 || $profile->get('emailConfirmed') == 3) { $this->_verified = true; } } }
/** * Overloading Parent Constructor * * @param array $config Optional configurations to be used * @return void */ public function __construct($subject, $config) { // get all public methods ending in 'action' $reflectionClass = new ReflectionClass($this); foreach ($reflectionClass->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { $name = $method->getName(); if (substr(strtolower($name), -6) == 'action') { $this->_actionMap[] = $name; } } // call parent constructor parent::__construct($subject, $config); }
/** * Object Constructor. * * @param object $subject The object to observe -- event dispatcher. * @param object $config The configuration object for the plugin. * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); $hash = App::hash('plgSystemLogout'); if (App::isSite() and Request::getString($hash, null, 'cookie')) { // Destroy the cookie $cookie_domain = Config::get('config.cookie_domain', ''); $cookie_path = Config::get('config.cookie_path', '/'); setcookie($hash, false, time() - 86400, $cookie_path, $cookie_domain); // Set the error handler for E_ALL to be the class handleError method. set_exception_handler(array('plgSystemLogout', 'handleError')); } }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); Lang::load('com_jobs'); $path = Component::path('com_jobs'); include_once $path . DS . 'tables' . DS . 'admin.php'; include_once $path . DS . 'tables' . DS . 'application.php'; include_once $path . DS . 'tables' . DS . 'category.php'; include_once $path . DS . 'tables' . DS . 'employer.php'; include_once $path . DS . 'tables' . DS . 'job.php'; include_once $path . DS . 'tables' . DS . 'prefs.php'; include_once $path . DS . 'tables' . DS . 'resume.php'; include_once $path . DS . 'tables' . DS . 'seeker.php'; include_once $path . DS . 'tables' . DS . 'shortlist.php'; include_once $path . DS . 'tables' . DS . 'stats.php'; include_once $path . DS . 'tables' . DS . 'type.php'; $this->config = Component::params('com_jobs'); }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->database = App::get('db'); }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'tables' . DS . 'type.php'; include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'tables' . DS . 'resource.php'; }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->_path = PATH_APP . DS . 'cache'; }
/** * Get the default parameters for a plugin * * @param string $folder Plugin folder * @param string $element Plugin name * @return object */ public static function getDefaultParams($folder = null, $element = null) { $plugin = \Plugin::byType($folder, $element); return new Registry($plugin->params); }
/** * Constructor * * @access protected * @param object $subject The object to observe * @param array $config An array that holds the plugin configuration * @since 1.5 */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); }
/** * Constructor * * @param object &$subject The object to observe * @param array $config An optional associative array of configuration settings. * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); include_once Component::path('com_publications') . DS . 'tables' . DS . 'category.php'; include_once Component::path('com_publications') . DS . 'tables' . DS . 'publication.php'; }
/** * Get the default parameters for a plugin * * @param string $folder Plugin folder * @param string $element Plugin name * @return object */ public function getDefaultParams($folder = null, $element = null) { $folder = $folder ?: $this->folder; $element = $element ?: $this->element; if (!$folder || !$element) { return null; } $plugin = \Plugin::byType($folder, $element); return new Registry($plugin->params); }
/** * Format the file * * @param object $row Record to format * @return string */ public function format($row) { //get fields to not include for all citations $config = \Component::params('com_citations'); $exclude = $config->get('citation_download_exclude', ''); if (strpos($exclude, ",") !== false) { $exclude = str_replace(',', "\n", $exclude); } $exclude = array_values(array_filter(array_map('trim', explode("\n", $exclude)))); //get fields to not include for specific citation $cparams = new \Hubzero\Config\Registry($row->params); $citation_exclude = $cparams->get('exclude', ''); if (strpos($citation_exclude, ',') !== false) { $citation_exclude = str_replace(',', "\n", $citation_exclude); } $citation_exclude = array_values(array_filter(array_map('trim', explode("\n", $citation_exclude)))); //merge overall exclude and specific exclude $exclude = array_values(array_unique(array_merge($exclude, $citation_exclude))); //var to hold document conetnt $doc = ''; //get all the citation types $db = \App::get('db'); $ct = new Type($db); $types = $ct->getType(); $type = ''; foreach ($types as $t) { if ($t['id'] == $row->type) { $type = $t['type_title']; } } //set the type to generic if we dont have one $type = $type != '' ? $type : 'Generic'; //set the type $doc .= "%0 {$type}" . "\r\n"; if ($row->booktitle && !in_array('booktitle', $exclude)) { $bt = html_entity_decode($row->booktitle); $bt = !preg_match('!\\S!u', $bt) ? utf8_encode($bt) : $bt; $doc .= "%B " . $bt . "\r\n"; } if ($row->journal && !in_array('journal', $exclude)) { $j = html_entity_decode($row->journal); $j = !preg_match('!\\S!u', $j) ? utf8_encode($j) : $j; $doc .= "%J " . $j . "\r\n"; } if ($row->year && !in_array('year', $exclude)) { $doc .= "%D " . trim($row->year) . "\r\n"; } if ($row->title && !in_array('title', $exclude)) { $t = html_entity_decode($row->title); $t = !preg_match('!\\S!u', $t) ? utf8_encode($t) : $t; $doc .= "%T " . $t . "\r\n"; } if (!in_array('authors', $exclude)) { $author = html_entity_decode($row->author); $author = !preg_match('!\\S!u', $author) ? utf8_encode($author) : $author; $author_array = explode(';', stripslashes($author)); foreach ($author_array as $auth) { $auth = preg_replace('/{{(.*?)}}/s', '', $auth); if (!strstr($auth, ',')) { $bits = explode(' ', $auth); $n = array_pop($bits) . ', '; $bits = array_map('trim', $bits); $auth = $n . trim(implode(' ', $bits)); } $doc .= "%A " . trim($auth) . "\r\n"; } } if ($row->address && !in_array('address', $exclude)) { $doc .= "%C " . htmlspecialchars_decode(trim(stripslashes($row->address))) . "\r\n"; } if ($row->editor && !in_array('editor', $exclude)) { $editor = html_entity_decode($row->editor); $editor = !preg_match('!\\S!u', $editor) ? utf8_encode($editor) : $editor; $author_array = explode(';', stripslashes($editor)); foreach ($author_array as $auth) { $doc .= "%E " . trim($auth) . "\r\n"; } } if ($row->publisher && !in_array('publisher', $exclude)) { $p = html_entity_decode($row->publisher); $p = !preg_match('!\\S!u', $p) ? utf8_encode($p) : $p; $doc .= "%I " . $p . "\r\n"; } if ($row->number && !in_array('number', $exclude)) { $doc .= "%N " . trim($row->number) . "\r\n"; } if ($row->pages && !in_array('pages', $exclude)) { $doc .= "%P " . trim($row->pages) . "\r\n"; } if ($row->url && !in_array('url', $exclude)) { $doc .= "%U " . trim($row->url) . "\r\n"; } if ($row->volume && !in_array('volume', $exclude)) { $doc .= "%V " . trim($row->volume) . "\r\n"; } if ($row->note && !in_array('note', $exclude)) { $n = html_entity_decode($row->note); $n = !preg_match('!\\S!u', $n) ? utf8_encode($n) : $n; $doc .= "%Z " . $n . "\r\n"; } if ($row->edition && !in_array('edition', $exclude)) { $doc .= "%7 " . trim($row->edition) . "\r\n"; } if ($row->month && !in_array('month', $exclude)) { $doc .= "%8 " . trim($row->month) . "\r\n"; } if ($row->isbn && !in_array('isbn', $exclude)) { $doc .= "%@ " . trim($row->isbn) . "\r\n"; } if ($row->doi && !in_array('doi', $exclude)) { $doc .= "%1 " . trim($row->doi) . "\r\n"; } if ($row->keywords && !in_array('keywords', $exclude)) { $k = html_entity_decode($row->keywords); $k = !preg_match('!\\S!u', $k) ? utf8_encode($k) : $k; $doc .= "%K " . $k . "\r\n"; } if ($row->research_notes && !in_array('research_notes', $exclude)) { $rn = html_entity_decode($row->research_notes); $rn = !preg_match('!\\S!u', $rn) ? utf8_encode($rn) : $rn; $doc .= "%< " . $rn . "\r\n"; } if ($row->abstract && !in_array('abstract', $exclude)) { $a = html_entity_decode($row->abstract); $a = !preg_match('!\\S!u', $a) ? utf8_encode($a) : $a; $doc .= "%X " . $a . "\r\n"; } if ($row->label && !in_array('label', $exclude)) { $l = html_entity_decode($row->label); $l = !preg_match('!\\S!u', $l) ? utf8_encode($l) : $l; $doc .= "%F " . $label . "\r\n"; } if ($row->language && !in_array('language', $exclude)) { $lan = html_entity_decode($row->language); $lan = !preg_match('!\\S!u', $lan) ? utf8_encode($lan) : $lan; $doc .= "%G " . $lan . "\r\n"; } if ($row->author_address && !in_array('author_address', $exclude)) { $aa = html_entity_decode($row->author_address); $aa = !preg_match('!\\S!u', $aa) ? utf8_encode($aa) : $aa; $doc .= "%+ " . $aa . "\r\n"; } if ($row->accession_number && !in_array('accession_number', $exclude)) { $an = html_entity_decode($row->accession_number); $an = !preg_match('!\\S!u', $an) ? utf8_encode($an) : $an; $doc .= "%M " . trim($an) . "\r\n"; } if ($row->call_number && !in_array('callnumber', $exclude)) { $doc .= "%L " . trim($row->call_number) . "\r\n"; } if ($row->short_title && !in_array('short_title', $exclude)) { $st = html_entity_decode($row->short_title); $st = !preg_match('!\\S!u', $st) ? utf8_encode($st) : $st; $doc .= "%! " . htmlspecialchars_decode(trim($st)) . "\r\n"; } //get the endnote import params //we want to get the endnote key used for importing badges to export them $endnote_import_plugin_params = \Hubzero\Plugin\Plugin::getParams('endnote', 'citation'); $custom_tags = explode("\n", $endnote_import_plugin_params->get('custom_tags')); $citation_endnote_tags = array(); $citation_badges_key = ""; foreach ($custom_tags as $ct) { $citation_endnote_tags[] = explode("-", trim($ct)); } foreach ($citation_endnote_tags as $cet) { if ($cet[0] == 'badges') { $citation_badges_key = $cet[1]; } } //if we found a key to export badges then add to export if (isset($row->badges) && $row->badges && !in_array('badges', $exclude) && $citation_badges_key != '') { $doc .= $citation_badges_key . ' ' . $row->badges; } $doc .= "\r\n"; return $doc; }
/** * Method to add a message to the component message que * * @param string $message The message to add * @return void */ public function redirect($url, $msg = '', $msgType = '') { $url = $url != '' ? $url : Request::getVar('REQUEST_URI', Route::url('index.php?option=' . $this->option . '&id=' . $this->obj_id . '&active=comments'), 'server'); parent::redirect($url, $msg, $msgType); }
/** * Constructor * * @param object $subject The object to observe * @param array $config An array that holds the plugin configuration * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); JFormHelper::addFieldPath(dirname(__FILE__) . '/fields'); }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->infolink = '/kb/points/'; $this->banking = Component::params('com_members')->get('bankAccounts'); }
/** * Method to add a message to the component message que * * @param string $message The message to add * @return void */ public function redirect($url, $msg = '', $msgType = '') { $url = $url != '' ? $url : Request::getVar('REQUEST_URI', Route::url($this->obj->link() . '&active=reviews'), 'server'); parent::redirect($url, $msg, $msgType); }