Server IP : 195.201.23.43 / Your IP : 3.144.110.198 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/kdecoratie/public_html/libraries/src/UCM/ |
Upload File : |
<?php /** * Joomla! Content Management System * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\UCM; defined('JPATH_PLATFORM') or die; use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\Table\Table; use Joomla\CMS\Table\TableInterface; /** * Base class for implementing UCM * * @since 3.1 */ class UCMBase implements UCM { /** * The UCM type object * * @var UCMType * @since 3.1 */ protected $type; /** * The alias for the content table * * @var string * @since 3.1 */ protected $alias; /** * Instantiate the UCMBase. * * @param string $alias The alias string * @param UCMType $type The type object * * @since 3.1 */ public function __construct($alias = null, UCMType $type = null) { // Setup dependencies. $input = \JFactory::getApplication()->input; $this->alias = isset($alias) ? $alias : $input->get('option') . '.' . $input->get('view'); $this->type = isset($type) ? $type : $this->getType(); } /** * Store data to the appropriate table * * @param array $data Data to be stored * @param TableInterface $table Table Object * @param string $primaryKey The primary key name * * @return boolean True on success * * @since 3.1 * @throws \Exception */ protected function store($data, TableInterface $table = null, $primaryKey = null) { if (!$table) { $table = Table::getInstance('Ucm'); } $ucmId = isset($data['ucm_id']) ? $data['ucm_id'] : null; $primaryKey = $primaryKey ?: $ucmId; if (isset($primaryKey)) { $table->load($primaryKey); } try { $table->bind($data); } catch (\RuntimeException $e) { throw new \Exception($e->getMessage(), 500, $e); } try { $table->store(); } catch (\RuntimeException $e) { throw new \Exception($e->getMessage(), 500, $e); } return true; } /** * Get the UCM Content type. * * @return UCMType The UCM content type * * @since 3.1 */ public function getType() { if (!$this->type) { $this->type = new UCMType($this->alias); } return $this->type; } /** * Method to map the base ucm fields * * @param array $original Data array * @param UCMType $type UCM Content Type * * @return array Data array of UCM mappings * * @since 3.1 */ public function mapBase($original, UCMType $type = null) { $type = $type ?: $this->type; $data = array( 'ucm_type_id' => $type->id, 'ucm_item_id' => $original[$type->primary_key], 'ucm_language_id' => ContentHelper::getLanguageId($original['language']), ); return $data; } }Private