File Manager

Current Directory: /home/astoriaah/www/administrator/components/com_sh404sef/adapters
Viewing File: /home/astoriaah/www/administrator/components/com_sh404sef/adapters/importpageids.php
<?php /** * sh404SEF - SEO extension for Joomla! * * @author Yannick Gaultier * @copyright (c) Yannick Gaultier - Weeblr llc - 2022 * @package sh404SEF * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @version 4.24.1.4308 * @date 2022-05-31 */ use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Table; // Security check to ensure this file is being included by a parent file. defined('_JEXEC') || die; /** * Implement wizard based exportation of pageids data * * @author shumisha * */ class Sh404sefAdapterImportpageids extends Sh404sefClassImportgeneric { /** * Parameters for current adapter, to be used by parent controller * */ public function setup() { // let parent do their job $properties = parent::setup(); // set context record $this->_context = 'pageids'; // setup a few custom properties $properties['_returnController'] = 'pageids'; $properties['_returnTask'] = ''; $properties['_returnView'] = 'pageids'; $properties['_returnLayout'] = 'default'; // and return the whole thing return $properties; } /** * Creates a record in the database, based * on data read from import file * * @param array $header an array of fields, as built from the header line * @param string $line raw record obtained from import file * * @throws \Exception */ protected function _createRecord($header, $line) { // get table object to store record $table = Table::getInstance( 'pageids', 'Sh404sefTable' ); // bind table to current record $record = array(); $record['newurl'] = $line[3]; if ($record['newurl'] == '__ Homepage __') { $record['newurl'] = sh404SEF_HOMEPAGE_CODE; } $record['pageid'] = $line[1]; $record['type'] = $line[4]; // save record if (!$table->save($record)) { throw new \Exception( Text::sprintf('COM_SH404SEF_IMPORT_ERROR_INSERTING_INTO_DB', $line[0]) . ' <small>(' . $table->getError() . ')</small>' ); } } }