本文整理汇总了PHP中Railpage\AppCore::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP AppCore::__construct方法的具体用法?PHP AppCore::__construct怎么用?PHP AppCore::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Railpage\AppCore
的用法示例。
在下文中一共展示了AppCore::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
* @since Version 3.8.7
* @param string $type
*/
public function __construct($type = null)
{
parent::__construct();
$this->Module = new Module("glossary");
if ($type == null) {
return $this;
}
$this->url = new Url(sprintf("%s?mode=type&type=%s", $this->Module->url, $type));
$this->id = $type;
switch ($type) {
case "code":
case "acronym":
case "station":
$this->name = ucfirst($type . "s");
break;
case "slang":
case "general":
$this->name = ucfirst($type);
break;
case "term":
$this->name = "Terminology";
break;
default:
$this->name = "General";
break;
}
}
示例2: __construct
/**
* Constructor
* @since Version 3.8.7
* @param string $type
*/
public function __construct($type = false)
{
parent::__construct();
$this->Module = new Module("glossary");
if ($type) {
$this->url = sprintf("%s?mode=type&type=%s", $this->Module->url, $type);
$this->id = $type;
switch ($type) {
case "code":
$this->name = "Codes";
break;
case "term":
$this->name = "Terminology";
break;
case "acronym":
$this->name = "Acronyms";
break;
case "station":
$this->name = "Stations";
break;
case "slang":
$this->name = "Slang";
break;
}
}
}
示例3: __construct
/**
* Constructor
* @since Version 3.8.6
* @param int|string $id
*/
public function __construct($id = false)
{
parent::__construct();
if ($id) {
$mckey = "railpage:fwlink=" . md5($id);
if ($row = getMemcacheObject($mckey)) {
$this->id = $row['id'];
$this->url = $row['url'];
$this->title = $row['title'];
} else {
if (filter_var($id, FILTER_VALIDATE_INT)) {
$query = "SELECT * FROM fwlink WHERE id = ?";
} else {
$query = "SELECT * FROM fwlink WHERE url = ?";
}
if ($row = $this->db->fetchRow($query, $id)) {
$this->id = $row['id'];
$this->url = $row['url'];
$this->title = $row['title'];
setMemcacheObject($mckey, $row, strtotime("+1 month"));
}
}
if (!empty($this->url)) {
$this->url_canonical = sprintf("http://%s%s", RP_HOST, $this->url);
$this->url_short = sprintf("http://%s/fwlink?id=%d", RP_HOST, $this->id);
}
}
}
示例4: __construct
/**
* Constructor
* @since Version 3.9.1
* @param int $correction_id
*/
public function __construct($correction_id = false)
{
parent::__construct();
if ($this->id = filter_var($correction_id, FILTER_VALIDATE_INT)) {
$this->populate();
}
}
示例5: __construct
/**
* Constructor
* @since Version 3.8.7
* @param int $id
*/
public function __construct($id = false)
{
parent::__construct();
$this->Module = new Module("glossary");
if (filter_var($id, FILTER_VALIDATE_INT)) {
$this->id = $id;
$this->mckey = sprintf("%s.entry=%d", $this->Module->namespace, $this->id);
deleteMemcacheObject($this->mckey);
if ($row = getMemcacheObject($this->mckey)) {
} else {
$query = "SELECT type, short, full, example, date, author FROM glossary WHERE id = ?";
$row = $this->db->fetchRow($query, $this->id);
setMemcacheObject($this->mckey, $row);
}
if (isset($row) && is_array($row)) {
$this->name = $row['short'];
$this->text = $row['full'];
$this->example = $row['example'];
$this->Type = new Type($row['type']);
$this->url = sprintf("%s?mode=entry&id=%d", $this->Module->url, $this->id);
if ($row['date'] == "0000-00-00 00:00:00") {
$this->Date = new DateTime();
$this->commit();
} else {
$this->Date = new DateTime($row['date']);
}
$this->Author = new User($row['author']);
}
}
}
示例6: __construct
/**
* Constructor
*
* @since Version 3.8.7
*
* @param string $module
*/
public function __construct($module)
{
parent::__construct();
if (!is_string($module)) {
return;
}
$this->Colours = new stdClass();
$this->Colours->primary = "#666";
$this->Colours->accent = "#ddd";
$this->Colours->inverse = "#333";
$module = self::getModuleAlternateName($module);
$this->name = ucwords($module);
$this->url = self::getModuleUrl($module);
if (self::getModuleId($module)) {
$this->id = self::getModuleId($module);
}
switch (strtolower($module)) {
case "images.competitions":
$this->name = "Photo competitions";
$this->namespace = "railpage.images.competitions";
break;
case "locations":
$this->Colours->primary = "#116416";
$this->Colours->accent = "#54A759";
$this->Colours->inverse = "#004304";
break;
case "locos":
$this->Colours->primary = "#3D0CE8";
$this->Colours->accent = "#576BFF";
$this->Colours->inverse = "#1B054E";
break;
case "news":
$this->Colours->primary = "#8A2E60";
$this->Colours->accent = "#CE8AAF";
$this->Colours->inverse = "#450026";
break;
case "privatemessages":
$this->name = "Private Messages";
break;
}
/**
* Lazy populate the namespace
*/
if (empty($this->namespace) && !empty($this->name)) {
$this->namespace = sprintf("railpage.%s", strtolower($this->name));
}
/**
* Lazy populate the URL
*/
if (empty($this->url) && !empty($this->name)) {
$this->url = sprintf("modules.php?name=%s", $this->name);
}
/**
* Create and populate the filesystem paths
*/
$this->Paths = new stdClass();
$this->Paths->module = sprintf("%s/modules/%s", RP_SITE_ROOT, $this->name);
$this->Paths->html = sprintf("%s/modules/%s/html", RP_SITE_ROOT, $this->name);
}
示例7: __construct
/**
* Constructor
* @since Version 3.9.1
* @param string $url
*/
public function __construct($url = false)
{
parent::__construct();
$this->GuzzleClient = new Client();
if ($url) {
$this->addFeed($url);
}
}
示例8: __construct
/**
* Constructor
* @since Version 3.9
*/
public function __construct()
{
parent::__construct();
$this->Module = new Module("timetables");
$this->url = new Url($this->Module->url);
$this->url->import = sprintf("%s?mode=import", $this->url->url);
$this->url->location = sprintf("%s?mode=location", $this->url->url);
}
示例9: __construct
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
/**
* Record this in the debug log
*/
debug_recordInstance(__CLASS__);
}
示例10: __construct
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
/**
* Record this in the debug log
*/
Debug::recordInstance();
}
示例11: __construct
/**
* Constructor
* @since Version 3.2
* @param string $dir The download directory to use. If null we'll use the preset one.
*/
public function __construct($dir = null)
{
parent::__construct();
$this->Module = new Module("Downloads");
if ($dir == null) {
$dir = RP_DOWNLOAD_DIR;
}
$this->dir = $dir;
}
示例12: __construct
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
Debug::RecordInstance();
/**
* Load the Module object
*/
$this->Module = new Module("glossary");
}
示例13: __construct
/**
*
* Constructor
* @param object $db
* @param int $db
* @since Version 3.0
* @version 3.0
*
*/
public function __construct()
{
parent::__construct();
foreach (func_get_args() as $arg) {
if (filter_var($arg, FILTER_VALIDATE_INT)) {
$this->id = $arg;
}
}
}
示例14: __construct
/**
* Constructor
* @since Version 3.2
* @param string $dir The download directory to use. If null we'll use the preset one.
*/
public function __construct($dir = NULL)
{
parent::__construct();
if (is_null($dir)) {
// Try to set the directory
$this->dir = RP_DOWNLOAD_DIR;
} else {
$this->dir = $dir;
}
}
示例15: __construct
/**
* Constructor
* @since Version 3.3
* @param object $db
*/
public function __construct($db = false, $user = false)
{
parent::__construct();
$this->Module = new Module("privatemessages");
foreach (func_get_args() as $arg) {
if ($arg instanceof User) {
$this->setUser($arg);
}
}
}