Skip to content

Commit

Permalink
Testing extended class methods
Browse files Browse the repository at this point in the history
  • Loading branch information
TriForceX committed Oct 18, 2019
1 parent 13aa5bd commit 5171214
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
7 changes: 2 additions & 5 deletions standalone/resources/websitebase/core.php
Expand Up @@ -15,20 +15,16 @@ public function __construct($config)
{
// Set global config
$this->config = $config;

// Check WordPress install
if(class_exists('WP'))
{
// Get custom WordPress functions
require_once('wordpress.php');

// Class initialization
$this->wp = new WebsiteBaseWP($this->config);
}

// Set debug
$this->debug($this->config['debug']);

// Set TimeZone
date_default_timezone_set($this->config['timezone']);
}
Expand All @@ -48,10 +44,11 @@ function get($key)
// Error handle
public function debug($enable = false)
{
// Warnings
ini_set('display_errors', $enable ? 1 : 0);
ini_set('display_startup_errors', $enable ? 1 : 0);
error_reporting($enable ? E_ALL : 0);

// Handle
if($enable == 2)
{
ob_start(function(){
Expand Down
22 changes: 19 additions & 3 deletions standalone/test.php
Expand Up @@ -5,11 +5,27 @@
<div class="container">
Main Content
<?php
class Custom extends WebsiteBase
{
// Constructor
function __construct()
{
}
// Custom function
public function message($name)
{
return 'Hi <b>'.$name.'</b>, the language is <b>'.$this->config['lang'].'</b>';
}
}

$custom = new Custom();

$base->set(['custom' => '12345']);
echo '<code>';
echo '<br>Variable from config: '.$base->get('timezone');
echo '<br>Variable custom: '.$base->get('custom');
echo '<br>Variable undefined:'.$cause_error;
echo '<br>Config variable: '.$base->get('timezone');
echo '<br>Custom variable: '.$base->get('custom');
echo '<br>Undefined variable: '.$cause_error;
echo '<br>Extended function: '.$custom->message('User');
echo '</code>';
?>
</div>
Expand Down

0 comments on commit 5171214

Please sign in to comment.