ver. 0.285: remove deleted class.Tpl.php and curl.class.php
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,91 +0,0 @@
|
||||
<?php
|
||||
class Tpl
|
||||
{
|
||||
protected $dir = 'templates/';
|
||||
protected $vars = array();
|
||||
|
||||
function __construct( $dir = null )
|
||||
{
|
||||
if ( $dir !== null )
|
||||
$this -> dir = $dir;
|
||||
}
|
||||
|
||||
public static function view( $file, $values = '' )
|
||||
{
|
||||
$tpl = new \Tpl;
|
||||
if ( is_array( $values ) ) foreach ( $values as $key => $val )
|
||||
$tpl -> $key = $val;
|
||||
return $tpl -> render( $file );
|
||||
}
|
||||
|
||||
public function secureHTML( $val )
|
||||
{
|
||||
$out = stripslashes( $val );
|
||||
$out = str_replace( "'", "'", $out );
|
||||
$out = str_replace( '"', """, $out );
|
||||
$out = str_replace( "<", "<", $out );
|
||||
$out = str_replace( ">", ">", $out );
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function render( $file )
|
||||
{
|
||||
if ( file_exists( 'templates_user/' . $file . '.php' ) )
|
||||
{
|
||||
ob_start();
|
||||
include 'templates_user/' . $file . '.php';
|
||||
$out = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $out;
|
||||
}
|
||||
else if ( file_exists( 'templates/' . $file . '.php' ) )
|
||||
{
|
||||
ob_start();
|
||||
include 'templates/' . $file . '.php';
|
||||
$out = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $out;
|
||||
}
|
||||
else if ( file_exists( '../templates_user/' . $file . '.php' ) )
|
||||
{
|
||||
ob_start();
|
||||
include '../templates/' . $file . '.php';
|
||||
$out = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $out;
|
||||
}
|
||||
else if ( file_exists( '../templates/' . $file . '.php' ) )
|
||||
{
|
||||
ob_start();
|
||||
include '../templates/' . $file . '.php';
|
||||
$out = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $out;
|
||||
}
|
||||
else if ( file_exists( $file . '.php' ) )
|
||||
{
|
||||
ob_start();
|
||||
include $file . '.php';
|
||||
$out = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $out;
|
||||
}
|
||||
else
|
||||
return '<div class="alert alert-danger" role="alert">Nie znaleziono pliku widoku: <b>' . $this -> dir . $file . '.php</b>';
|
||||
}
|
||||
|
||||
public function __set( $name, $value )
|
||||
{
|
||||
$this -> vars[ $name ] = $value;
|
||||
}
|
||||
|
||||
public function __get( $name )
|
||||
{
|
||||
return $this -> vars[ $name ];
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
// ------------------------------------------------
|
||||
// This is a cURL Object
|
||||
// Created by: Gilberto C.
|
||||
// InteractiveUtopia.com
|
||||
// ------------------------------------------------
|
||||
|
||||
class CurlServer
|
||||
{
|
||||
private $access_token;
|
||||
|
||||
function __construct( $token )
|
||||
{
|
||||
$this->access_token = $token;
|
||||
}
|
||||
|
||||
function post_request($url, $submitJson, $debug = false )
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $submitJson);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $this->access_token, 'Content-Type: application/json'));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$server_output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$serverReponseObject = json_decode($server_output);
|
||||
|
||||
// Debug
|
||||
if ( $debug )
|
||||
print_r($serverReponseObject);
|
||||
}
|
||||
function get_request($url)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $this->access_token));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$server_output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$serverReponseObject = json_decode($server_output);
|
||||
|
||||
// Debug
|
||||
//print_r ( $server_output );
|
||||
print_r($serverReponseObject);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user