Use composer for class loading.
This commit is contained in:
parent
4c39933e8d
commit
b5acf69035
18 changed files with 102 additions and 17 deletions
17
ajaxchat.php
17
ajaxchat.php
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
define('AJAX_CHAT_PATH', __DIR__);
|
define('AJAX_CHAT_PATH', __DIR__);
|
||||||
define('AJAX_CHAT_DEBUG', is_file(AJAX_CHAT_PATH . '/.debug'));
|
define('AJAX_CHAT_DEBUG', is_file(AJAX_CHAT_PATH . '/.debug'));
|
||||||
|
|
||||||
|
@ -20,17 +22,4 @@ if(AJAX_CHAT_DEBUG) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include Class libraries:
|
// Include Class libraries:
|
||||||
require_once AJAX_CHAT_PATH . '/src/AJAXChat.php';
|
require_once AJAX_CHAT_PATH . '/vendor/autoload.php';
|
||||||
require_once AJAX_CHAT_PATH . '/src/AJAXChatDataBase.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/AJAXChatMySQLiDataBase.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/AJAXChatMySQLiQuery.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/AJAXChatEncoding.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/AJAXChatString.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/AJAXChatFileSystem.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/AJAXChatHTTPHeader.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/AJAXChatLanguage.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/AJAXChatTemplate.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/SockChatAuth.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/CustomAJAXChat.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/CustomAJAXChatShoutBox.php';
|
|
||||||
require_once AJAX_CHAT_PATH . '/src/CustomAJAXChatInterface.php';
|
|
||||||
|
|
10
composer.json
Normal file
10
composer.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"AJAXChat\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"flashii/apii": "^0.2"
|
||||||
|
}
|
||||||
|
}
|
56
composer.lock
generated
Normal file
56
composer.lock
generated
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{
|
||||||
|
"_readme": [
|
||||||
|
"This file locks the dependencies of your project to a known state",
|
||||||
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
|
"This file is @generated automatically"
|
||||||
|
],
|
||||||
|
"content-hash": "1eb898418ab7dcf8d2a4021ae3915e34",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "flashii/apii",
|
||||||
|
"version": "v0.2.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://patchii.net/flashii/apii-php.git",
|
||||||
|
"reference": "6a93d31375dd7e75ff9264f3024f2208ce602f49"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpstan/phpstan": "^1.12",
|
||||||
|
"phpunit/phpunit": "^10.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Flashii\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"bsd-3-clause-clear"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "flashwave",
|
||||||
|
"email": "packagist@flash.moe",
|
||||||
|
"homepage": "https://flash.moe",
|
||||||
|
"role": "mom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Client library for the Flashii.net API.",
|
||||||
|
"homepage": "https://api.flashii.net",
|
||||||
|
"time": "2024-11-16T16:03:42+00:00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"packages-dev": [],
|
||||||
|
"aliases": [],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": [],
|
||||||
|
"platform-dev": [],
|
||||||
|
"plugin-api-version": "2.6.0"
|
||||||
|
}
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
if(!empty($_GET['common'])) {
|
if(!empty($_GET['common'])) {
|
||||||
$domain = (strpos($_SERVER['HTTP_HOST'], 'flashii.net') ? 'flashii' : 'edgii');
|
$domain = (strpos($_SERVER['HTTP_HOST'], 'flashii.net') ? 'flashii' : 'edgii');
|
||||||
$commonUrl = 'https://futami.' . $domain . '.net/common.json';
|
$commonUrl = 'https://futami.' . $domain . '.net/common.json';
|
||||||
|
@ -155,4 +157,4 @@ if(!empty($_GET['common'])) {
|
||||||
require_once __DIR__ . '/../ajaxchat.php';
|
require_once __DIR__ . '/../ajaxchat.php';
|
||||||
|
|
||||||
// Initialize the chat:
|
// Initialize the chat:
|
||||||
$ajaxChat = new CustomAJAXChat();
|
$ajaxChat = new CustomAJAXChat;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
// Ajax Chat backend logic:
|
// Ajax Chat backend logic:
|
||||||
class AJAXChat {
|
class AJAXChat {
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
// Class to initialize the DataBase connection:
|
// Class to initialize the DataBase connection:
|
||||||
class AJAXChatDataBase {
|
class AJAXChatDataBase {
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
|
use mysqli;
|
||||||
|
|
||||||
// Class to initialize the MySQL DataBase connection:
|
// Class to initialize the MySQL DataBase connection:
|
||||||
class AJAXChatDataBaseMySQLi {
|
class AJAXChatDataBaseMySQLi {
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
// Class to provide static encoding methods
|
// Class to provide static encoding methods
|
||||||
class AJAXChatEncoding {
|
class AJAXChatEncoding {
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,10 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
// Class to provide methods for file system access:
|
// Class to provide methods for file system access:
|
||||||
class AJAXChatFileSystem {
|
class AJAXChatFileSystem {
|
||||||
|
|
||||||
public static function getFileContents($file) {
|
public static function getFileContents($file) {
|
||||||
if(function_exists('file_get_contents')) {
|
if(function_exists('file_get_contents')) {
|
||||||
return file_get_contents($file);
|
return file_get_contents($file);
|
||||||
|
@ -17,5 +18,4 @@ class AJAXChatFileSystem {
|
||||||
return(implode('', file($file)));
|
return(implode('', file($file)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
// Class to manage HTTP header
|
// Class to manage HTTP header
|
||||||
class AJAXChatHTTPHeader {
|
class AJAXChatHTTPHeader {
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
class AJAXChatLanguage {
|
class AJAXChatLanguage {
|
||||||
|
|
||||||
private $_regExpAcceptLangCode;
|
private $_regExpAcceptLangCode;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
// Class to perform SQL (MySQLi) queries:
|
// Class to perform SQL (MySQLi) queries:
|
||||||
class AJAXChatMySQLiQuery {
|
class AJAXChatMySQLiQuery {
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
// Class to provide multibyte enabled string methods
|
// Class to provide multibyte enabled string methods
|
||||||
class AJAXChatString {
|
class AJAXChatString {
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
// Class to handle HTML templates
|
// Class to handle HTML templates
|
||||||
class AJAXChatTemplate {
|
class AJAXChatTemplate {
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
class CustomAJAXChat extends AJAXChat {
|
class CustomAJAXChat extends AJAXChat {
|
||||||
|
|
||||||
// Returns an associative array containing userName, userID and userRole
|
// Returns an associative array containing userName, userID and userRole
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
class CustomAJAXChatInterface extends CustomAJAXChat {
|
class CustomAJAXChatInterface extends CustomAJAXChat {
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* @link https://blueimp.net/ajax/
|
* @link https://blueimp.net/ajax/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
class CustomAJAXChatShoutBox extends CustomAJAXChat {
|
class CustomAJAXChatShoutBox extends CustomAJAXChat {
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace AJAXChat;
|
||||||
|
|
||||||
final class SockChatAuth {
|
final class SockChatAuth {
|
||||||
public static function attempt(string $endPoint, string $secret, string $cookie): object {
|
public static function attempt(string $endPoint, string $secret, string $cookie): object {
|
||||||
if(!empty($cookie)) {
|
if(!empty($cookie)) {
|
||||||
|
|
Loading…
Reference in a new issue