| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/ees_request/administrator/components/com_printme/ |
Upload File : |
<?php
/**
* @package Printme
* @copyright Copyright (C) 2009 DT Design Inc. All rights reserved.
* @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
* @link http://www.dioscouri.com
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
class Printme extends JObject
{
static $_version = '0.1.0';
static $_copyrightyear = '2010';
static $_name = 'printme';
static $_min_php = '5.2';
/**
* Get the version
*/
public static function getVersion()
{
return self::$_version;
}
/**
* Get the copyright year
*/
public static function getCopyrightYear()
{
return self::$_copyrightyear;
}
/**
* Get the Name
*/
public static function getName()
{
return self::$_name;
}
/**
* Get the URL to the folder containing all media assets
*
* @param string $type The type of URL to return, default 'media'
* @return string URL
*/
public static function getURL($type = 'media')
{
$url = '';
switch($type)
{
case 'media' :
$url = JURI::root(true).'/media/com_printme/';
break;
case 'css' :
$url = JURI::root(true).'/media/com_printme/css/';
break;
case 'images' :
$url = JURI::root(true).'/media/com_printme/images/';
break;
case 'js' :
$url = JURI::root(true).'/media/com_printme/js/';
break;
}
return $url;
}
/**
* Get the path to the folder containing all media assets
*
* @param string $type The type of path to return, default 'media'
* @return string Path
*/
public static function getPath($type = 'media')
{
$path = '';
switch($type)
{
case 'media' :
$path = JPATH_SITE.DS.'media'.DS.'com_printme';
break;
case 'css' :
$path = JPATH_SITE.DS.'media'.DS.'com_printme'.DS.'css';
break;
case 'images' :
$path = JPATH_SITE.DS.'media'.DS.'com_printme'.DS.'images';
break;
case 'js' :
$path = JPATH_SITE.DS.'media'.DS.'com_printme'.DS.'js';
break;
}
return $path;
}
/**
* Method to intelligently load class files in the Printme framework
*
* @param string $classname The class name
* @param string $filepath The filepath ( dot notation )
* @param array $options
* @return boolean
*/
public static function load( $classname, $filepath, $options=array( 'site'=>'admin', 'type'=>'components', 'ext'=>'com_printme' ) )
{
$classname = strtolower( $classname );
$classes = JLoader::register();
if ( class_exists($classname) || array_key_exists( $classname, $classes ) )
{
return true;
}
static $paths;
if (empty($paths))
{
$paths = array();
}
if (empty($paths[$classname]) || !is_file($paths[$classname]))
{
// find the file and set the path
if (!empty($options['base']))
{
$base = $options['base'];
}
else
{
// recreate base from $options array
switch ($options['site'])
{
case "site":
$base = JPATH_SITE.DS;
break;
default:
$base = JPATH_ADMINISTRATOR.DS;
break;
}
$base .= (!empty($options['type'])) ? $options['type'].DS : '';
$base .= (!empty($options['ext'])) ? $options['ext'].DS : '';
}
$paths[$classname] = $base.str_replace( '.', DS, $filepath ).'.php';
}
// if invalid path, return false
if (!is_file($paths[$classname]))
{
return false;
}
// if not registered, register it
if ( !array_key_exists( $classname, $classes ) )
{
JLoader::register( $classname, $paths[$classname] );
return true;
}
return false;
}
/**
* Intelligently loads instances of classes in Printme framework
*
* Usage: $object = Printme::getClass( 'PrintmeHelperCarts', 'helpers.carts' );
* Usage: $suffix = Printme::getClass( 'PrintmeHelperCarts', 'helpers.carts' )->getSuffix();
* Usage: $categories = Printme::getClass( 'PrintmeSelect', 'library.select' )->category( $selected );
*
* @param string $classname The class name
* @param string $filepath The filepath ( dot notation )
* @param array $options
* @return object of requested class (if possible), else a new JObject
*/
public function getClass( $classname, $filepath='controller', $options=array( 'site'=>'admin', 'type'=>'components', 'ext'=>'com_printme' ) )
{
if (Printme::load( $classname, $filepath, $options ))
{
$instance = new $classname();
return $instance;
}
$instance = new JObject();
return $instance;
}
/**
* Method to dump the structure of a variable for debugging purposes
*
* @param mixed A variable
* @param boolean True to ensure all characters are htmlsafe
* @return string
* @since 1.5
* @static
*/
public static function dump( &$var, $htmlSafe = true ) {
$result = print_r( $var, true );
return '<pre>'.( $htmlSafe ? htmlspecialchars( $result ) : $result).'</pre>';
}
var $show_linkback = '1';
var $display_breadcrumb = '1';
var $display_pagetitle = '1';
var $header_html = '';
var $footer_html = '';
/**
* constructor
* @return void
*/
function __construct() {
parent::__construct();
$this->setVariables();
}
/**
* Returns the query
* @return string The query to be used to retrieve the rows from the database
*/
function _buildQuery()
{
$query = "SELECT * FROM #__printme_config";
return $query;
}
/**
* Retrieves the data
* @return array Array of objects containing the data from the database
*/
function getData() {
// load the data if it doesn't already exist
if (empty( $this->_data )) {
$database = &JFactory::getDBO();
$query = $this->_buildQuery();
$database->setQuery( $query );
$this->_data = $database->loadObjectList();
}
return $this->_data;
}
/**
* Set Variables
*
* @acces public
* @return object
*/
function setVariables() {
$success = false;
if ( $data = $this->getData() )
{
for ($i=0; $i<count($data); $i++)
{
$title = $data[$i]->config_name;
$value = $data[$i]->value;
if (isset($title)) {
$this->$title = $value;
}
}
$success = true;
}
return $success;
}
/**
* Get component config
*
* @acces public
* @return object
*/
function &getInstance() {
static $instance;
if (!is_object($instance)) {
$instance = new Printme();
}
return $instance;
}
}
?>