joomla/com_wk1_6/site/models/wk1.php
<?php
/**
* @package Joomla.Administrator
* @subpackage com_wk1
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* wk1 Model
*
* @since 0.0.2
*/
class Wk1ModelWk1 extends JModelItem
{
protected $titles, $list;
public function __construct() {
parent::__construct();
wkTrace('__construct');
$this->titles = array(); 'wk1 component title';
$this->list = array ( 'Wk1ModelWk1 default list from __file__' => __file__,
'SERVER[REQUEST_METHOD]' => $_SERVER['REQUEST_METHOD'],
'SERVER[REQUEST_URI]' => $_SERVER['REQUEST_URI'],
'$_GET' => print_r($_GET, true),
'$_POST' => print_r($_POST, true),
'headers_list()' => print_r(headers_list(), true),
'headers_sent()' => print_r(headers_sent(), true),
'JURI toString' => JURI::getInstance()->toString(),
'JURI' => print_r(JURI::getInstance(), true),
'application->scope (component)' => ($com = JFactory::getApplication()->scope),
'component' => print_r(JComponentHelper::getComponent($com), true));
}
/**
* Method to get a table object, load it if necessary.
*
* @param string $type The table name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JTable A JTable object
*
* @since 1.6
*/
public function getTable($type = 'wk1', $prefix = 'Wk1Table', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
/**
* Get the message
*
* @param integer $id Greeting Id
*
* @return string Fetched String from Table for relevant Id
*/
public function getTitle($id = 1)
{
if (!isset($this->titles[$id]))
{
// Get a Table instance
$table = $this->getTable();
// Load the message
$table->load($id);
// Assign the message
$this->titles[$id] = $table->greeting;
}
return $this->titles[$id];
}
public function getList()
{
wkTrace('getList');
return $this->list;
}
}