/** * Method to register custom library. * * @return void */ public function onAfterInitialise() { if (defined('REDCORE_LIBRARY_LOADED')) { $apiName = JFactory::getApplication()->input->getString('api'); if ($this->isApiEnabled($apiName)) { $input = JFactory::getApplication()->input; if (!empty($apiName)) { try { // We will disable all error messaging from PHP from the output error_reporting(0); ini_set('display_errors', 0); JError::setErrorHandling(E_ERROR, 'message'); JFactory::getApplication()->clearHeaders(); $webserviceClient = $input->get->getString('webserviceClient', ''); $optionName = $input->get->getString('option', ''); $optionName = strpos($optionName, 'com_') === 0 ? substr($optionName, 4) : $optionName; $viewName = $input->getString('view', ''); $version = $input->getString('webserviceVersion', ''); $token = $input->getString(RBootstrap::getConfig('oauth2_token_param_name', 'access_token'), ''); $apiName = ucfirst($apiName); $method = strtoupper($input->getMethod()); $task = RApiHalHelper::getTask(); $data = RApi::getPostedData(); $dataGet = $input->get->getArray(); if (empty($webserviceClient)) { $webserviceClient = JFactory::getApplication()->isAdmin() ? 'administrator' : 'site'; } $options = array('api' => $apiName, 'optionName' => $optionName, 'viewName' => $viewName, 'webserviceVersion' => $version, 'webserviceClient' => $webserviceClient, 'method' => $method, 'task' => $task, 'data' => $data, 'dataGet' => $dataGet, 'accessToken' => $token, 'format' => $input->getString('format', $this->params->get('webservices_default_format', 'json')), 'id' => $input->getString('id', ''), 'absoluteHrefs' => $input->get->getBool('absoluteHrefs', true)); // Create instance of Api and fill all required options $api = RApi::getInstance($options); // Run the api task $api->execute(); // Display output $api->render(); } catch (Exception $e) { $code = $e->getCode() > 0 ? $e->getCode() : 500; if (strtolower($apiName) == 'soap') { // We must have status of 200 for SOAP communication even if it is fault $message = RApiSoapHelper::createSoapFaultResponse($e->getMessage()); header("Content-Type: soap+xml"); header("Content-length: " . strlen($message)); header("Status: 200"); echo $message; } else { // Set the server response code. header('Status: ' . $code, true, $code); // Check for defined constants if (!defined('JSON_UNESCAPED_SLASHES')) { define('JSON_UNESCAPED_SLASHES', 64); } // An exception has been caught, echo the message and exit. echo json_encode(array('message' => $e->getMessage(), 'code' => $e->getCode(), 'type' => get_class($e)), JSON_UNESCAPED_SLASHES); } } JFactory::getApplication()->close(); } } } }
/** * Display method * * @param string $tpl The template name * * @return void */ public function display($tpl = null) { $this->form = $this->get('Form'); $this->item = $this->get('Item'); // Check if option is enabled if (RBootstrap::getConfig('enable_oauth2_server', 0) == 0) { JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_REDCORE_OAUTH_CLIENTS_PLUGIN_LABEL_WARNING', '<a href="index.php?option=com_plugins&view=plugins&filter_search=redcore">' . JText::_('COM_REDCORE_CONFIGURE') . '</a>'), 'error'); } parent::display($tpl); }
/** * Method to get the field input markup for a generic list. * Use the multiple attribute to enable multiselect. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { $app = JFactory::getApplication(); $listType = !empty($this->element['listType']) ? $this->element['listType'] : RBootstrap::getConfig('payment_list_payments_type', 'radio'); $extensionName = !empty($this->element['extensionName']) ? $this->element['extensionName'] : $app->input->get->getString('option', ''); $ownerName = !empty($this->element['ownerName']) ? $this->element['ownerName'] : ''; // Get the field options. $options = $this->getOptions(); return RLayoutHelper::render('redpayment.list.' . strtolower($listType), array('options' => array('payments' => $options, 'extensionName' => $extensionName, 'ownerName' => $ownerName, 'name' => $this->name, 'value' => $this->value, 'id' => $this->id, 'attributes' => $this->getAttributes()))); }
/** * Creates instance of OAuth2 server object * * @return RApiOauth2Oauth2 */ public static function getOAuth2Server() { if (RBootstrap::getConfig('enable_oauth2_server', 0) == 0) { return null; } if (!isset(self::$serverApi)) { $options = array('api' => 'oauth2'); self::$serverApi = RApi::getInstance($options); } return self::$serverApi; }
/** * Display method * * @param string $tpl The template name * * @return void */ public function display($tpl = null) { $model = $this->getModel('webservice'); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->fields = $model->fields; $this->resources = $model->resources; $this->formData = $model->formData; // Check if option is enabled if (RBootstrap::getConfig('enable_webservices', 0) == 0) { JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_REDCORE_WEBSERVICES_PLUGIN_LABEL_WARNING', '<a href="index.php?option=com_plugins&view=plugins&filter_search=redcore">' . JText::_('COM_REDCORE_CONFIGURE') . '</a>'), 'error'); } parent::display($tpl); }
/** * Display method * * @param string $tpl The template name * * @return void */ public function display($tpl = null) { $model = $this->getModel(); $this->activeFilters = $model->getActiveFilters(); $this->state = $model->getState(); $this->filterForm = $model->getForm(); $this->pagination = $model->getPagination(); $this->items = $model->getItems(); $this->xmlFiles = $model->getXmlFiles(); $this->xmlFilesAvailable = $model->xmlFilesAvailable; $this->return = base64_encode('index.php?option=com_redcore&view=webservices'); // Check if option is enabled if (RBootstrap::getConfig('enable_webservices', 0) == 0) { JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_REDCORE_WEBSERVICES_PLUGIN_LABEL_WARNING', '<a href="index.php?option=com_plugins&view=plugins&filter_search=redcore">' . JText::_('COM_REDCORE_CONFIGURE') . '</a>'), 'error'); } parent::display($tpl); }
/** * Display method * * @param string $tpl The template name * * @return void */ public function display($tpl = null) { $model = $this->getModel(); $this->state = $model->getState(); $this->activeFilters = $model->getActiveFilters(); $this->filterForm = $model->getForm(); $filters = array(); $filters['status'] = RApiPaymentStatus::getStatusCompleted(); if ($filter = $this->state->get('filter.payment_name')) { $filters['payment_name'] = $filter; } if ($filter = $this->state->get('filter.extension_name')) { $filters['extension_name'] = $filter; } if ($startDate = $this->state->get('filter.start_date')) { $filters['start_date'] = $startDate; } if ($endDate = $this->state->get('filter.end_date')) { $filters['end_date'] = $endDate; } $this->viewType = $this->state->get('filter.dashboard_view_type'); $this->chartType = $this->state->get('filter.chart_type'); if (empty($this->viewType)) { $this->viewType = RBootstrap::getConfig('payment_dashboard_view_type', 'payment_name'); $this->state->set('filter.dashboard_view_type', $this->viewType); } if (empty($this->chartType)) { $this->chartType = RBootstrap::getConfig('payment_chart_type', 'Line'); $this->state->set('filter.chart_type', $this->chartType); } if ($this->viewType == 'status') { unset($filters['status']); } $this->paymentData['chart'] = RApiPaymentHelper::getChartData($filters, 7, $this->viewType); $filters['start_date'] = date('Y-01-01', strtotime('today -1 year')); $filters['end_date'] = date('Y-m-d', strtotime('today')); $filters['status'] = RApiPaymentStatus::getStatusCompleted(); $this->paymentData['overall'] = RApiPaymentHelper::getChartData($filters, 7, 'all'); $this->chartData = RApiPaymentHelper::prepareChartData($this->paymentData['chart'], $this->chartType); parent::display($tpl); }
/** * Method to instantiate the file-based api call. * * @param mixed $options Optional custom options to load. JRegistry or array format * * @since 1.2 */ public function __construct($options = null) { parent::__construct($options); // Get the global JAuthentication object. jimport('joomla.user.authentication'); // Register OAuth2 classes require_once dirname(__FILE__) . '/Autoloader.php'; OAuth2\Autoloader::register(); // OAuth2 Server config from plugin $this->serverConfig = array('use_jwt_access_tokens' => (bool) RBootstrap::getConfig('oauth2_use_jwt_access_tokens', false), 'store_encrypted_token_string' => (bool) RBootstrap::getConfig('oauth2_store_encrypted_token_string', true), 'use_openid_connect' => (bool) RBootstrap::getConfig('oauth2_use_openid_connect', false), 'id_lifetime' => RBootstrap::getConfig('oauth2_id_lifetime', 3600), 'access_lifetime' => RBootstrap::getConfig('oauth2_access_lifetime', 3600), 'www_realm' => 'Service', 'token_param_name' => RBootstrap::getConfig('oauth2_token_param_name', 'access_token'), 'token_bearer_header_name' => RBootstrap::getConfig('oauth2_token_bearer_header_name', 'Bearer'), 'enforce_state' => (bool) RBootstrap::getConfig('oauth2_enforce_state', true), 'require_exact_redirect_uri' => (bool) RBootstrap::getConfig('oauth2_require_exact_redirect_uri', true), 'allow_implicit' => (bool) RBootstrap::getConfig('oauth2_allow_implicit', false), 'allow_credentials_in_request_body' => (bool) RBootstrap::getConfig('oauth2_allow_credentials_in_request_body', true), 'allow_public_clients' => (bool) RBootstrap::getConfig('oauth2_allow_public_clients', true), 'always_issue_new_refresh_token' => (bool) RBootstrap::getConfig('oauth2_always_issue_new_refresh_token', false)); // Set database names to Redcore DB tables $prefix = JFactory::getDbo()->getPrefix(); $databaseConfig = array('client_table' => $prefix . 'redcore_oauth_clients', 'access_token_table' => $prefix . 'redcore_oauth_access_tokens', 'refresh_token_table' => $prefix . 'redcore_oauth_refresh_tokens', 'code_table' => $prefix . 'redcore_oauth_authorization_codes', 'user_table' => $prefix . 'redcore_oauth_users', 'jwt_table' => $prefix . 'redcore_oauth_jwt', 'jti_table' => $prefix . 'redcore_oauth_jti', 'scope_table' => $prefix . 'redcore_oauth_scopes', 'public_key_table' => $prefix . 'redcore_oauth_public_keys'); $conf = JFactory::getConfig(); $dsn = 'mysql:dbname=' . $conf->get('db') . ';host=' . $conf->get('host'); $username = $conf->get('user'); $password = $conf->get('password'); $storage = new OAuth2\Storage\Pdoredcore(array('dsn' => $dsn, 'username' => $username, 'password' => $password), $databaseConfig); $this->server = new OAuth2\Server($storage, $this->serverConfig); // Add the "Authorization Code" grant type (this is where the oauth magic happens) $this->server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage, $this->serverConfig)); // Add the "Client Credentials" grant type (it is the simplest of the grant types) $this->server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage, $this->serverConfig)); // Add the "User Credentials" grant type (this is modified to suit Joomla authorization) $this->server->addGrantType(new OAuth2\GrantType\UserCredentials($storage, $this->serverConfig)); // Add the "Refresh Token" grant type (this is great for extending expiration time on tokens) $this->server->addGrantType(new OAuth2\GrantType\RefreshToken($storage, $this->serverConfig)); /* * @todo Implement JwtBearer Grant type with public_key // Typically, the URI of the oauth server $audience = rtrim(JUri::base(), '/'); // Add the "Refresh Token" grant type (this is great for extending expiration time on tokens) $this->server->addGrantType(new OAuth2\GrantType\JwtBearer($storage, $audience)); */ // Init Environment $this->setApiOperation(); }
/** * Get payments pending for checking * * @return mixed */ public function getPaymentsForChecking() { $db = JFactory::getDbo(); $finalStatuses = array(); $retryTime = RBootstrap::getConfig('payment_time_between_payment_check_requests', 24); foreach ($this->finalStatuses as $status) { $finalStatuses[] = $db->q($status); } $query = $db->getQuery(true)->select('p.*')->from($db->qn('#__redcore_payments', 'p'))->where('p.status NOT IN (' . implode(',', $finalStatuses) . ')')->where('p.retry_counter > 0')->where('TIMESTAMPDIFF(HOUR, p.modified_date, NOW()) > ' . (int) $retryTime); $db->setQuery($query); $items = $db->loadObjectList(); return $items; }
/** * Method to send the application response to the client. All headers will be sent prior to the main * application output data. * * @return void * * @since 1.2 */ public function render() { // Set token to uri if used in that way $token = $this->options->get('accessToken', ''); $client = $this->options->get('webserviceClient', ''); $format = $this->options->get('format', 'json'); if (!empty($token)) { $this->setUriParams(RBootstrap::getConfig('oauth2_token_param_name', 'access_token'), $token); } if ($client == 'administrator') { $this->setUriParams('webserviceClient', $client); } $this->setUriParams('api', 'Hal'); if ($format == 'doc') { // This is already in HTML format echo $this->documentation; } else { $documentOptions = array('absoluteHrefs' => $this->options->get('absoluteHrefs', false), 'documentFormat' => $format, 'uriParams' => $this->uriParams); JFactory::$document = new RApiHalDocumentDocument($documentOptions); $body = $this->getBody(); $body = $this->triggerFunction('prepareBody', $body); // Push results into the document. JFactory::$document->setHal($this)->setBuffer($body)->render(false); } }
/** * Logs the relevant data from payment gateway to file * * @param string $paymentName Payment name * @param string $extensionName Extension name * @param mixed $data Request data * @param boolean $isValid Is Valid payment * @param string $statusText Status text * * @return void */ public static function logToFile($paymentName, $extensionName, $data, $isValid = true, $statusText = '') { if (RBootstrap::getConfig('payment_enable_file_logger', 0)) { return; } JLoader::import('joomla.filesystem.file'); $config = JFactory::getConfig(); $logpath = $config->get('log_path'); $logFilename = $logpath . '/redpayment/' . $paymentName . '/' . $extensionName . '/' . date('Y-m-') . strtolower($paymentName) . '-' . strtolower($extensionName) . '_log'; $logFile = $logFilename . '.php'; if (JFile::exists($logFile)) { // If file is over 1MB we break it in new file if (@filesize($logFile) > 1048576) { $i = 1; while (true) { $newFilename = $logFilename . '-' . $i . '.php'; if (!JFile::exists($newFilename)) { // Copy old file contents to a new location JFile::copy($logFile, $newFilename); JFile::delete($logFile); // We start our logger from start $dummy = "<?php die(); ?>\n"; JFile::write($logFile, $dummy); break; } $i++; } } } else { // New log file in a month $dummy = "<?php die(); ?>\n"; JFile::write($logFile, $dummy); } // Current file contents $logData = @file_get_contents($logFile); if ($logData === false) { $logData = ''; } $logData .= "\n" . str_repeat('=', 20); $logData .= $isValid ? ' VALID ' . $paymentName . ' ' : ' INVALID ' . $paymentName . ' *** FRAUD ATTEMPT OR INVALID NOTIFICATION *** '; $logData .= str_repeat('=', 20); if (!empty($statusText)) { $logData .= "\n" . str_repeat('=', 20); $logData .= "\n" . $statusText; $logData .= "\n" . str_repeat('=', 20); } $logData .= "\nDatetime : " . gmdate('Y-m-d H:i:s') . " GMT\n\n"; if (is_array($data)) { foreach ($data as $key => $value) { $logData .= str_pad($key, 30, ' ') . $value . "\n"; } } elseif (is_object($data)) { $logData .= json_encode($data) . "\n"; } else { $logData .= $data . "\n"; } $logData .= "\n"; JFile::write($logFile, $logData); }
/** * Install Content Element from XML file * * @param string $option The Extension Name ex. com_redcore * @param string $xmlFile XML file to install * @param bool $showNotifications Show notifications * * @return boolean Returns true if Content element was successfully installed */ public static function installContentElement($option = 'com_redcore', $xmlFile = '', $showNotifications = true) { // Load Content Element $contentElement = RTranslationHelper::getContentElement($option, $xmlFile); if (empty($contentElement) || empty($contentElement->table)) { if ($showNotifications) { JFactory::getApplication()->enqueueMessage(JText::_('COM_REDCORE_CONFIG_TRANSLATIONS_CONTENT_ELEMENT_NOT_INSTALLED'), 'warning'); } return false; } // Create table with fields $db = JFactory::getDbo(); // We might be in installer and got new tables so we will get fresh list of the tables self::resetLoadedTables(); $originalColumns = self::getTableColumns($contentElement->table); // If original table is not present then we cannot create shadow table if (empty($originalColumns)) { if ($showNotifications) { JFactory::getApplication()->enqueueMessage(JText::sprintf('LIB_REDCORE_TRANSLATIONS_CONTENT_ELEMENT_ERROR_TABLE', $xmlFile, (string) $contentElement->table), 'error'); } return false; } // Check if that table is already installed $columns = self::getTranslationsTableColumns($contentElement->table); $fields = array(); $primaryKeys = array(); $fieldsXml = $contentElement->getTranslateFields(); $newTable = self::getTranslationsTableName($contentElement->table); $originalTable = '#__' . $contentElement->table; foreach ($fieldsXml as $field) { // If not in original table then do not create it if (empty($originalColumns[(string) $field['name']])) { if ($showNotifications) { JFactory::getApplication()->enqueueMessage(JText::sprintf('LIB_REDCORE_TRANSLATIONS_CONTENT_ELEMENT_ERROR_COLUMNS', $xmlFile, (string) $field['name']), 'error'); } return false; } // We are not saving this fields, we only show them in editor if ((string) $field['translate'] == '0' && (string) $field['type'] != 'referenceid') { continue; } $fields[(string) $field['name']] = $db->qn((string) $field['name']); if ((string) $field['type'] == 'referenceid') { $fieldName = (string) $field['name']; $primaryKeys[$fieldName] = $db->qn($fieldName); } } if (empty($fields)) { if ($showNotifications) { JFactory::getApplication()->enqueueMessage(JText::sprintf('LIB_REDCORE_TRANSLATIONS_CONTENT_ELEMENT_ERROR_NO_FIELDS', $xmlFile), 'error'); } return false; } $newTableCreated = false; $innoDBSupport = self::checkIfDatabaseEngineExists(); if (empty($columns)) { $newTableCreated = true; $query = 'CREATE TABLE ' . $db->qn($newTable) . ' (' . $db->qn('rctranslations_id') . ' int(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT, ' . $db->qn('rctranslations_language') . ' char(7) NOT NULL DEFAULT ' . $db->q('') . ', ' . $db->qn('rctranslations_originals') . ' TEXT NOT NULL, ' . $db->qn('rctranslations_modified') . ' datetime NOT NULL DEFAULT ' . $db->q('0000-00-00 00:00:00') . ', ' . $db->qn('rctranslations_state') . ' tinyint(3) NOT NULL DEFAULT ' . $db->q('1') . ', ' . ' KEY ' . $db->qn('language_idx') . ' (' . $db->qn('rctranslations_language') . ',' . $db->qn('rctranslations_state') . ') ' . ' )'; if ($innoDBSupport) { $query .= 'ENGINE=InnoDB'; } $db->setQuery($query); try { $db->execute(); // Since we have new table we will reset it self::resetLoadedTables(); $columns = self::getTableColumns($newTable); if (empty($columns)) { throw new RuntimeException($newTable); } } catch (RuntimeException $e) { if ($showNotifications) { JFactory::getApplication()->enqueueMessage(JText::sprintf('LIB_REDCORE_TRANSLATIONS_CONTENT_ELEMENT_ERROR', $e->getMessage()), 'error'); } return false; } } $allContentElementsFields = implode(',', array_keys($fields)); // Language is automatically added to the table if table exists $columns = self::removeFixedColumnsFromArray($columns); $columnKeys = array_keys($columns); foreach ($fields as $fieldKey => $field) { foreach ($columnKeys as $columnKey => $columnKeyValue) { if ($fieldKey == $columnKeyValue) { unset($columnKeys[$columnKey]); unset($fields[$fieldKey]); } } } // We Add New columns if (!empty($fields)) { $newColumns = array(); foreach ($fields as $fieldKey => $field) { if (!empty($originalColumns[$fieldKey])) { $newColumns[] = 'ADD COLUMN ' . $field . ' ' . $originalColumns[$fieldKey]->Type . ' NULL' . ' DEFAULT NULL '; } } if (!empty($newColumns)) { try { $query = 'ALTER TABLE ' . $db->qn($newTable) . ' ' . implode(',', $newColumns); $db->setQuery($query); $db->execute(); } catch (RuntimeException $e) { if ($showNotifications) { JFactory::getApplication()->enqueueMessage(JText::sprintf('LIB_REDCORE_TRANSLATIONS_CONTENT_ELEMENT_ERROR', $e->getMessage()), 'error'); } return false; } } } // We delete extra columns if (!empty($columnKeys) && !$newTableCreated) { $oldColumns = array(); foreach ($columnKeys as $columnKey) { $oldColumns[] = 'DROP COLUMN ' . $db->qn($columnKey); } if (!empty($oldColumns)) { try { $query = 'ALTER TABLE ' . $db->qn($newTable) . ' ' . implode(',', $oldColumns); $db->setQuery($query); $db->execute(); } catch (RuntimeException $e) { if ($showNotifications) { JFactory::getApplication()->enqueueMessage(JText::sprintf('LIB_REDCORE_TRANSLATIONS_CONTENT_ELEMENT_ERROR', $e->getMessage()), 'error'); } return false; } } } self::updateTableIndexKeys($fieldsXml, $newTable); if (!$newTableCreated) { self::removeExistingConstraintKeys($originalTable, $primaryKeys); } $constraintType = 'foreign_keys'; if (method_exists('RBootstrap', 'getConfig')) { $constraintType = RBootstrap::getConfig('translations_constraint_type', 'foreign_keys'); } // New install use default value foreign key if InnoDB is present if ($constraintType == 'foreign_keys') { if ($innoDBSupport) { self::updateTableForeignKeys($fieldsXml, $newTable, $originalTable); } else { if ($showNotifications) { JFactory::getApplication()->enqueueMessage(JText::_('COM_REDCORE_CONFIG_TRANSLATIONS_CONTENT_ELEMENT_INNODB_MISSING'), 'message'); } } } elseif ($constraintType == 'triggers') { self::updateTableTriggers($fieldsXml, $newTable, $originalTable); } $contentElement->allContentElementsFields = explode(',', $allContentElementsFields); $contentElement->allPrimaryKeys = array_keys($primaryKeys); RTranslationHelper::setInstalledTranslationTables($option, $originalTable, $contentElement); self::saveRedcoreTranslationConfig(); if ($showNotifications) { JFactory::getApplication()->enqueueMessage(JText::_('COM_REDCORE_CONFIG_TRANSLATIONS_CONTENT_ELEMENT_INSTALLED'), 'message'); } return true; }
/** * Display method * * @param string $tpl The template name * * @return void */ public function display($tpl = null) { $model = $this->getModel(); $app = JFactory::getApplication(); $this->contentElementName = RedcoreHelpersTranslation::getCurrentContentElement(); $this->componentName = $app->input->get->get('component', $model->getState('filter.component', '')); $this->activeFilters = $model->getActiveFilters(); $this->state = $model->getState(); $this->filterForm = $model->getForm(); $this->pagination = $model->getPagination(); if (!empty($this->contentElementName)) { $this->translationTable = RedcoreHelpersTranslation::getTranslationTable(); $this->contentElement = RTranslationHelper::getContentElement($this->translationTable->option, $this->translationTable->xml); $this->items = $model->getItems(); $this->filterForm->removeField('component', 'filter'); } else { /** @var RedcoreModelConfig $modelConfig */ $modelConfig = RModelAdmin::getAdminInstance('Config', array('ignore_request' => true), 'com_redcore'); if (!empty($this->componentName)) { $this->component = $modelConfig->getComponent($this->componentName); } $this->contentElements = $modelConfig->loadContentElements($this->componentName); $this->missingContentElements = $modelConfig->loadMissingContentElements($this->componentName, $this->contentElements); $this->return = base64_encode('index.php?option=com_redcore&view=translations&contentelement=&component=' . $this->componentName); $layout = 'manage'; $this->setLayout($layout); $app->input->set('layout', $layout); $this->filterForm->removeField('language', 'filter'); $this->filterForm->removeField('search_translations', 'filter'); $this->filterForm->removeField('translations_limit', 'list'); $this->filterForm->removeField('contentelement', 'filter'); } // Check if option is enabled if (RBootstrap::getConfig('enable_translations', 0) == 0) { JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_REDCORE_CONFIG_TRANSLATIONS_PLUGIN_LABEL_WARNING', '<a href="index.php?option=com_plugins&view=plugins&filter_search=redcore">' . JText::_('COM_REDCORE_CONFIGURE') . '</a>'), 'error'); } parent::display($tpl); }
/** * Display method * * @param string $tpl The template name * * @return void */ public function display($tpl = null) { $this->form = $this->get('Form'); $this->translationTable = RedcoreHelpersTranslation::getTranslationTable(); $this->contentElement = RTranslationHelper::getContentElement($this->translationTable->option, $this->translationTable->xml); $this->item = $this->get('Item'); $editor = JFactory::getConfig()->get('editor'); $this->editor = JEditor::getInstance($editor); $this->columns = array(); $this->noTranslationColumns = array(); $tableColumns = (array) $this->translationTable->columns; $this->fieldsXml = $this->contentElement->getTranslateFields(); foreach ($this->fieldsXml as $field) { foreach ($tableColumns as $column) { if ($column == (string) $field['name']) { $attributes = current($field->attributes()); $attributes['titleLabel'] = (string) $field; $this->columns[$column] = $attributes; break; } } if ((string) $field['translate'] == '0' && (string) $field['type'] != 'referenceid') { $attributes = current($field->attributes()); $attributes['titleLabel'] = (string) $field; $this->noTranslationColumns[(string) $field['name']] = $attributes; } } // Check if option is enabled if (RBootstrap::getConfig('enable_translations', 0) == 0) { JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_REDCORE_CONFIG_TRANSLATIONS_PLUGIN_LABEL_WARNING', '<a href="index.php?option=com_plugins&view=plugins&filter_search=redcore">' . JText::_('COM_REDCORE_CONFIGURE') . '</a>'), 'error'); } parent::display($tpl); }
/** * Gets request method as it is defined in plugin, some servers do not support specific request methods * * @return string */ public function getRequestMethod() { // If defined on a level of the payment plugin (no alternative methods but use specific one) if (!empty($this->requestMethod)) { return $this->requestMethod; } elseif ($this->params->get('payment_request_method', null) !== null) { return $this->params->get('payment_request_method', 'curl'); } // If no alternative, we use global settings for request method return RBootstrap::getConfig('payment_request_method', 'curl'); }