From eac90243793cf8ba3da2117ac2d76efbcec24e53 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Mon, 15 Feb 2016 21:04:47 +0000
Subject: [PATCH] Usprawnienia wczytywania UTF-8 w module kino
---
class/BotUser.php | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/class/BotUser.php b/class/BotUser.php
index 0040e3a..2fe8251 100644
--- a/class/BotUser.php
+++ b/class/BotUser.php
@@ -9,13 +9,13 @@
* - IMified
* - HTTP
* - Local
- * @var string
+ * @var string $interface
*/
private $interface;
/**
* Numer lub identyfikator użytkownika
- * @var string
+ * @var string $uid
*/
private $uid;
@@ -29,32 +29,45 @@
* - yahoo.imified.com
* - gtalk.imified.com
* - localhost
- * @var string
+ * @var string $network
*/
private $network;
/**
* Identyfikator/unikalna nazwa bota, do którego skierowano zapytanie.
* Najczęściej numer Gadu-Gadu lub botkey w przypadku IMified.com
+ * @var string $bot
*/
private $bot;
/**
* Parametry zapytania. Przy IMified równe zmiennej $_POST['channel']
- * @var string
+ * @var string $params
*/
private $params;
+ /**
+ * Konstruktor. W argumencie otrzymuje pseudo-URL określający użytkownika i sieć.
+ * Przykłady:
+ * - Gadu-Gadu://123456\@gadu-gadu.pl
+ * - IMified://user\\\@jabber\@jabber.imified.com/BOTKEY?private
+ * @param string $user URL użytkownika
+ */
function __construct($user) {
$data = parse_url($user);
$this->interface = $data['scheme'];
$this->uid = strtr($data['user'], array('\\@' => '@'));
$this->network = $data['host'];
- $this->bot = substr($data['path'], 1);
- $this->params = $data['query'];
+ $this->bot = substr(@$data['path'], 1);
+ $this->params = @$data['query'];
}
+ /**
+ * Umożliwia dostęp tylko do odczytu do prywanych zmiennych
+ * @param string $name Nazwa zmiennej
+ * @return mixed Wartość zmiennej prywatnej
+ */
function __get($name) {
return $this->$name;
}
--
Gitblit v1.9.1