From 2eff11cbb3cb230f798afacd5302173bd67e4cb8 Mon Sep 17 00:00:00 2001 From: Matan Bareket Date: Sun, 20 Jan 2019 14:09:50 -0500 Subject: [PATCH] WEB: Clean up most PSR2 style warnings --- include/Controller.php | 85 +++++++++++++--------------- include/ExceptionHandler.php | 6 +- include/I18N.php | 28 +++++---- include/Objects/Article.php | 23 ++++---- include/Objects/BasicObject.php | 1 + include/Objects/CSection.php | 36 ++++++------ include/Objects/CompatGame.php | 25 ++++---- include/Objects/DSection.php | 30 +++++----- include/Objects/DSubSection.php | 46 +++++++-------- include/Objects/Document.php | 17 +++--- include/Objects/File.php | 50 ++++++++-------- include/Objects/GameDemo.php | 24 ++++---- include/Objects/MenuItem.php | 20 +++---- include/Objects/News.php | 35 ++++++------ include/Objects/Person.php | 18 +++--- include/Objects/Project.php | 6 +- include/Objects/QAEntry.php | 34 +++++------ include/Objects/QASection.php | 22 +++---- include/Objects/Screenshot.php | 27 +++++---- include/Objects/WebLink.php | 18 +++--- include/Pages/CompatibilityPage.php | 40 +++++++------ include/Pages/ContactPage.php | 6 +- include/Pages/CreditsPage.php | 4 +- include/Pages/DemosPage.php | 6 +- include/Pages/DocumentationPage.php | 6 +- include/Pages/DownloadsPage.php | 21 ++++--- include/Pages/ExceptionsPage.php | 6 +- include/Pages/FAQPage.php | 6 +- include/Pages/FeedsPage.php | 12 ++-- include/Pages/GamesPage.php | 6 +- include/Pages/LinksPage.php | 6 +- include/Pages/NewsPage.php | 8 +-- include/Pages/PressPage.php | 6 +- include/Pages/PressSnowberryPage.php | 6 +- include/Pages/ScreenshotsPage.php | 12 ++-- include/Pages/SubprojectsPage.php | 6 +- include/XMLParser.php | 43 +++++++------- 37 files changed, 380 insertions(+), 371 deletions(-) diff --git a/include/Controller.php b/include/Controller.php index b01992cc..266bc311 100644 --- a/include/Controller.php +++ b/include/Controller.php @@ -11,14 +11,9 @@ use ScummVM\Models\MenuModel; */ class Controller { - private $_smarty; - protected $_template; - private $_title; - private $_css_files; - private $_js_files; - private $_show_intro; - private $_content_title; - private $_content; + private $smarty; + private $css_files; + private $js_files; /** * Constructor that will create a Smarty object and configure it according @@ -27,34 +22,34 @@ class Controller public function __construct() { /* Create a Smarty object. */ - $this->_smarty = new Smarty(); + $this->smarty = new Smarty(); # Stick it globally so we could refer the translations global $Smarty; - $Smarty = $this->_smarty; + $Smarty = $this->smarty; global $lang; global $available_languages; /* Configure smarty. */ - $this->_smarty->compile_dir = SMARTY_DIR_COMPILE; - $this->_smarty->cache_dir = SMARTY_DIR_CACHE; - $this->_smarty->config_dir = SMARTY_DIR_CONFIG; - $this->_smarty->caching = SMARTY_CACHING_ENABLE; - $this->_smarty->cache_lifetime = SMARTY_CACHING_LIFETIME; - $this->_smarty->compile_check = SMARTY_CACHING_COMPILE_CHECK; - $this->_smarty->force_compile = SMARTY_CACHING_FORCE_RECHECK; - $this->_smarty->template_dir = array("templates_$lang", 'templates'); - $this->_smarty->compile_id = $lang; - $this->_smarty->config_dir = "."; + $this->smarty->compile_dir = SMARTY_DIR_COMPILE; + $this->smarty->cache_dir = SMARTY_DIR_CACHE; + $this->smarty->config_dir = SMARTY_DIR_CONFIG; + $this->smarty->caching = SMARTY_CACHING_ENABLE; + $this->smarty->cache_lifetime = SMARTY_CACHING_LIFETIME; + $this->smarty->compile_check = SMARTY_CACHING_COMPILE_CHECK; + $this->smarty->force_compile = SMARTY_CACHING_FORCE_RECHECK; + $this->smarty->template_dir = array("templates_$lang", 'templates'); + $this->smarty->compile_id = $lang; + $this->smarty->config_dir = "."; # First we read English, so all defaults are there - $this->_smarty->configLoad(DIR_LANG . "/lang.en.ini"); + $this->smarty->configLoad(DIR_LANG . "/lang.en.ini"); # Now we try to read translations if (is_file(($fname = DIR_LANG . "/lang.$lang.ini")) && is_readable($fname)) { - $this->_smarty->configLoad($fname); + $this->smarty->configLoad($fname); } setlocale(LC_TIME, $Smarty->getConfigVars('locale')); @@ -63,25 +58,21 @@ class Controller * Add a output-filter to make sure ampersands are properly encoded to * HTML-entities. */ - $this->_smarty->registerFilter('output', array($this, 'outputFilter')); + $this->smarty->registerFilter('output', array($this, 'outputFilter')); /* Give Smarty-template access to date(). */ - $this->_smarty->registerPlugin('modifier', 'date_f', array(&$this, 'date_f')); - $this->_smarty->registerPlugin('modifier', 'date_localized', array(&$this, 'date_localized')); + $this->smarty->registerPlugin('modifier', 'date_f', array(&$this, 'dateFormatSmartyModifier')); + $this->smarty->registerPlugin('modifier', 'date_localized', array(&$this, 'dateLocalizedSmartyModifier')); /* Give Smarty-templates access to the ampersandEntity() function. */ - $this->_smarty->registerPlugin( + $this->smarty->registerPlugin( 'modifier', 'escapeAmpersand', array(&$this, 'ampersandEntity') ); - $this->_title = ''; - $this->_css_files = array(); - $this->_js_files = array(); - $this->_show_intro = false; - $this->_content_title = ''; - $this->_content = ''; + $this->css_files = array(); + $this->js_files = array(); /* The menus have caused an exception, need to skip them. */ if (!ExceptionHandler::skipMenus()) { @@ -100,7 +91,7 @@ class Controller 'pageurl' => $pageurl, 'available_languages' => $available_languages, ); - $this->_smarty->assign($vars); + $this->smarty->assign($vars); } /** Smarty outputfilter, run just before displaying. */ @@ -121,13 +112,13 @@ class Controller } /** Formating of dates, registered as a modifier for Smarty templates. */ - public function date_f($timestamp, $format) + public function dateFormatSmartyModifier($timestamp, $format) { return date($format, $timestamp); } /** Formating of dateAs, registered as a modifier for Smarty templates. */ - public function date_localized($timestamp, $format) + public function dateLocalizedSmartyModifier($timestamp, $format) { if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { $format = preg_replace('#(? $this->_css_files, - 'js_files' => $this->_js_files, + 'css_files' => $this->css_files, + 'js_files' => $this->js_files, 'content' => $content, ); - $this->_smarty->assign($vars); - return $this->_smarty->display('pages/index.tpl'); + $this->smarty->assign($vars); + return $this->smarty->display('pages/index.tpl'); } /* Render the HTML using the template and any set variables and returns it. */ @@ -155,9 +146,9 @@ class Controller if (!is_file(SMARTY_DIR_TEMPLATE . "/{$template}")) { } if (!is_null($vars)) { - $this->_smarty->assign($vars); + $this->smarty->assign($vars); } - return $this->_smarty->fetch($template); + return $this->smarty->fetch($template); } /* Set up the variables used by the template and render the page. */ @@ -172,12 +163,12 @@ class Controller public function addCSSFiles($extra_css) { if (is_array($extra_css)) { - $this->_css_files = array_merge( - $this->_css_files, + $this->css_files = array_merge( + $this->css_files, $extra_css ); } elseif (is_string($extra_css) && strlen($extra_css) > 0) { - $this->_css_files[] = $extra_css; + $this->css_files[] = $extra_css; } } @@ -185,12 +176,12 @@ class Controller public function addJSFiles($extra_js) { if (is_array($extra_js)) { - $this->_js_files = array_merge( - $this->_js_files, + $this->js_files = array_merge( + $this->js_files, $extra_js ); } elseif (is_string($extra_js) && strlen($extra_js) > 0) { - $this->_js_files[] = $extra_js; + $this->js_files[] = $extra_js; } } } diff --git a/include/ExceptionHandler.php b/include/ExceptionHandler.php index 04e2b527..d3e5a6fa 100644 --- a/include/ExceptionHandler.php +++ b/include/ExceptionHandler.php @@ -4,13 +4,13 @@ namespace ScummVM; /** Handle uncaught exceptions. */ abstract class ExceptionHandler { - private static $_exception; + private static $exception; /* If the MenuModel cause the exception we need to skip them. */ public static function skipMenus() { $skip_menus = false; - $e = self::$_exception; + $e = self::$exception; if (!is_null($e)) { if (basename($e->getFile() == 'MenuModel.php')) { @@ -31,7 +31,7 @@ abstract class ExceptionHandler /* Handle exceptions. */ public static function handleException($e) { - self::$_exception = $e; + self::$exception = $e; $ep = new \ScummVM\Pages\ExceptionsPage(); return $ep->index($e); diff --git a/include/I18N.php b/include/I18N.php index 3c4b173c..1e28d4b5 100644 --- a/include/I18N.php +++ b/include/I18N.php @@ -8,14 +8,14 @@ define('DIR_NEWS', 'data/news'); class I18N { - private $_purifier; + private $purifier; const NO_FILES = 'No I18N Files Found'; public function __construct() { $config = \HTMLPurifier_Config::createDefault(); - $this->_purifier = new \HTMLPurifier($config); + $this->purifier = new \HTMLPurifier($config); $langs = ['en', 'it', 'fr', 'ru', 'de']; foreach ($langs as $key => $value) { @@ -33,7 +33,7 @@ class I18N $output = ""; foreach ($json as $key => $value) { - $output .= $key . " = " . $this->_purifier->purify($value). "\n"; + $output .= $key . " = " . $this->purifier->purify($value). "\n"; } file_put_contents("lang/{$lang}.ini", $output); @@ -49,12 +49,15 @@ class I18N foreach ($i18n as $key => $value) { $originalJson = json_decode(file_get_contents(DIR_NEWS . "/{$key}.json")); - $value->date = $this->_purifier->purify($originalJson->date); - $value->author = $this->_purifier->purify($originalJson->author); - $value->title = $this->_purifier->purify($value->title); - $value->content = $this->_purifier->purify($value->content); + $value->date = $this->purifier->purify($originalJson->date); + $value->author = $this->purifier->purify($originalJson->author); + $value->title = $this->purifier->purify($value->title); + $value->content = $this->purifier->purify($value->content); - file_put_contents(DIR_NEWS . "/{$lang}/{$key}.json", json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); + file_put_contents( + DIR_NEWS . "/{$lang}/{$key}.json", + json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) + ); } } else { // Update the base english i18n file @@ -63,12 +66,15 @@ class I18N $news = $this->getAllNews($lang); foreach ($news as $key => $value) { $newsJson->$key = array( - "title" => $this->_purifier->purify($value->title), - "content" => $this->_purifier->purify($value->content) + "title" => $this->purifier->purify($value->title), + "content" => $this->purifier->purify($value->content) ); } - file_put_contents(DIR_NEWS . "/i18n/news.{$lang}.json", json_encode($newsJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "\n"); + file_put_contents( + DIR_NEWS . "/i18n/news.{$lang}.json", + json_encode($newsJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "\n" + ); } } diff --git a/include/Objects/Article.php b/include/Objects/Article.php index eddec3ee..9aef3276 100644 --- a/include/Objects/Article.php +++ b/include/Objects/Article.php @@ -7,41 +7,40 @@ namespace ScummVM\Objects; */ class Article extends BasicObject { - private $_name; - private $_url; - private $_language; - private $_posted; + private $url; + private $language; + private $posted; /* Article object constructor. */ public function __construct($data) { - $this->_name = $data['name']; - $this->_url = $data['url']; - $this->_language = $data['language']; - $this->_posted = $data['posted']; + $this->name = $data['name']; + $this->url = $data['url']; + $this->language = $data['language']; + $this->posted = $data['posted']; } /* Get the name. */ public function getName() { - return $this->_name; + return $this->name; } /* Get the URL. */ public function getURL() { - return $this->_url; + return $this->url; } /* Get the language. */ public function getLanguage() { - return $this->_language; + return $this->language; } /* Get the date it was posted. */ public function getPosted() { - return $this->_posted; + return $this->posted; } } diff --git a/include/Objects/BasicObject.php b/include/Objects/BasicObject.php index 220e0d0e..e207226a 100644 --- a/include/Objects/BasicObject.php +++ b/include/Objects/BasicObject.php @@ -7,6 +7,7 @@ namespace ScummVM\Objects; */ abstract class BasicObject { + protected $name; /** * If the input array doesn't contain the numerical key 0, wrap it inside * an array. This functions operates on the data directly. diff --git a/include/Objects/CSection.php b/include/Objects/CSection.php index 00f4fdc7..59203f8f 100644 --- a/include/Objects/CSection.php +++ b/include/Objects/CSection.php @@ -7,24 +7,24 @@ namespace ScummVM\Objects; */ class CSection extends BasicObject { - private $_title; - private $_groups; - private $_subsections; - private $_paragraphs; - private $_anchor; + private $title; + private $groups; + private $subsections; + private $paragraphs; + private $anchor; /* CSection object constructor. */ public function __construct($data) { - $this->_title = $data['title']; - $this->_anchor = $data['anchor']; - $this->_groups = array(); - $this->_subsections = array(); - $this->_paragraphs = array(); + $this->title = $data['title']; + $this->anchor = $data['anchor']; + $this->groups = array(); + $this->subsections = array(); + $this->paragraphs = array(); if (isset($data['subsection'])) { foreach ($data['subsection'] as $value) { - $this->_subsections[] = new CSection($value); + $this->subsections[] = new CSection($value); } } if (isset($data['group'])) { @@ -40,7 +40,7 @@ class CSection extends BasicObject $persons[] = new Person($args); } if (count($persons) > 0) { - $this->_groups[] = array( + $this->groups[] = array( 'name' => $value['name'], 'persons' => $persons, ); @@ -49,37 +49,37 @@ class CSection extends BasicObject } if (isset($data['paragraph'])) { parent::toArray($data['paragraph']); - $this->_paragraphs = $data['paragraph']; + $this->paragraphs = $data['paragraph']; } } /* Get the title. */ public function getTitle() { - return $this->_title; + return $this->title; } /* Get the anchor. */ public function getAnchor() { - return $this->_anchor; + return $this->anchor; } /* Get the optional list of groups. */ public function getGroups() { - return $this->_groups; + return $this->groups; } /* Get the optional list of subsections. */ public function getSubSections() { - return $this->_subsections; + return $this->subsections; } /* Get the optional list of paragraphs. */ public function getParagraphs() { - return $this->_paragraphs; + return $this->paragraphs; } } diff --git a/include/Objects/CompatGame.php b/include/Objects/CompatGame.php index daf46ed2..71fd0bd7 100644 --- a/include/Objects/CompatGame.php +++ b/include/Objects/CompatGame.php @@ -7,48 +7,47 @@ namespace ScummVM\Objects; */ class CompatGame extends BasicObject { - private $_name; - private $_target; - private $_supportLevel; - private $_notes; + private $target; + private $supportLevel; + private $notes; /* Project object constructor. */ public function __construct($data) { - $this->_name = $data['name']; - $this->_target = $data['target']; + $this->name = $data['name']; + $this->target = $data['target']; // In old compat pages we used 'percent' instead of 'support_level'. // we still want to support those thus we check whether the old tag // is present here. if (array_key_exists('percent', $data)) { - $this->_supportLevel = $data['percent']; + $this->supportLevel = $data['percent']; } else { - $this->_supportLevel = $data['support_level']; + $this->supportLevel = $data['support_level']; } - $this->_notes = $data['notes']; + $this->notes = $data['notes']; } /* Get the name. */ public function getName() { - return $this->_name; + return $this->name; } /* Get the target name. */ public function getTarget() { - return $this->_target; + return $this->target; } /* Get the support level. */ public function getSupportLevel() { - return $this->_supportLevel; + return $this->supportLevel; } /* Get the notes. */ public function getNotes() { - return $this->_notes; + return $this->notes; } } diff --git a/include/Objects/DSection.php b/include/Objects/DSection.php index 292c89aa..1d16072f 100644 --- a/include/Objects/DSection.php +++ b/include/Objects/DSection.php @@ -6,48 +6,48 @@ namespace ScummVM\Objects; */ class DSection extends BasicObject { - private $_title; - private $_anchor; - private $_baseurl; - private $_baseturl; - private $_subsections; + private $title; + private $anchor; + private $baseurl; + private $baseturl; + private $subsections; /* DSection object constructor. */ public function __construct($data) { - $this->_title = $data['title']; - $this->_anchor = $data['anchor']; - $this->_baseurl = $data['baseurl']; - $this->_baseturl = $data['baseturl']; - $this->_subsections = array(); + $this->title = $data['title']; + $this->anchor = $data['anchor']; + $this->baseurl = $data['baseurl']; + $this->baseturl = $data['baseturl']; + $this->subsections = array(); parent::toArray($data['subsection']); foreach ($data['subsection'] as $key => $value) { - $this->_subsections[] = new DSubSection($value, $this->_baseurl, $this->_baseturl); + $this->subsections[] = new DSubSection($value, $this->baseurl, $this->baseturl); } } /* Get the title. */ public function getTitle() { - return $this->_title; + return $this->title; } /* Get the anchor name. */ public function getAnchor() { - return $this->_anchor; + return $this->anchor; } /* Get the base URL. */ public function getBaseURL() { - return $this->_baseurl; + return $this->baseurl; } /* Get the list of optional subsections. */ public function getSubSections() { - return $this->_subsections; + return $this->subsections; } } diff --git a/include/Objects/DSubSection.php b/include/Objects/DSubSection.php index 7edaf8ba..ea90bef0 100644 --- a/include/Objects/DSubSection.php +++ b/include/Objects/DSubSection.php @@ -6,34 +6,34 @@ namespace ScummVM\Objects; */ class DSubSection extends BasicObject { - private $_title; - private $_anchor; - private $_notes; - private $_footer; - private $_files; - private $_links; - private $_items; + private $title; + private $anchor; + private $notes; + private $footer; + private $files; + private $links; + private $items; /* DSubSection constructor. */ public function __construct($data, $baseurl, $baseturl) { - $this->_title = $data['title']; - $this->_anchor = $data['anchor']; - $this->_notes = $data['notes']; - $this->_footer = $data['footer']; - $this->_files = array(); - $this->_links = array(); - $this->_items = array(); + $this->title = $data['title']; + $this->anchor = $data['anchor']; + $this->notes = $data['notes']; + $this->footer = $data['footer']; + $this->files = array(); + $this->links = array(); + $this->items = array(); foreach ($data['entries'] as $type => $item) { parent::toArray($item); if ($type == 'file') { foreach ($item as $file) { - $this->_items[] = new File($file, $baseurl, $baseturl); + $this->items[] = new File($file, $baseurl, $baseturl); } } elseif ($type == 'link') { foreach ($item as $link) { - $this->_items[] = new WebLink($link); + $this->items[] = new WebLink($link); } } } @@ -42,42 +42,42 @@ class DSubSection extends BasicObject /* Get the title. */ public function getTitle() { - return $this->_title; + return $this->title; } /* Get the anchor name. */ public function getAnchor() { - return $this->_anchor; + return $this->anchor; } /* Get the optional notes. */ public function getNotes() { - return $this->_notes; + return $this->notes; } /* Get the optional footer. */ public function getFooter() { - return $this->_footer; + return $this->footer; } /* Get the list of files. */ public function getFiles() { - return $this->_files; + return $this->files; } /* Get the list of links. */ public function getLinks() { - return $this->_links; + return $this->links; } /* Get the list of items. */ public function getItems() { - return $this->_items; + return $this->items; } } diff --git a/include/Objects/Document.php b/include/Objects/Document.php index 49c0d257..37db5022 100644 --- a/include/Objects/Document.php +++ b/include/Objects/Document.php @@ -6,33 +6,32 @@ namespace ScummVM\Objects; */ class Document extends BasicObject { - private $_name; - private $_url; - private $_description; + private $url; + private $description; /* Document object constructor. */ public function __construct($data) { - $this->_name = $data['name']; - $this->_url = $data['url']; - $this->_description = $data['description']; + $this->name = $data['name']; + $this->url = $data['url']; + $this->description = $data['description']; } /* Get the name. */ public function getName() { - return $this->_name; + return $this->name; } /* Get the URL. */ public function getURL() { - return $this->_url; + return $this->url; } /* Get the description. */ public function getDescription() { - return $this->_description; + return $this->description; } } diff --git a/include/Objects/File.php b/include/Objects/File.php index 9f02744d..6b91c70a 100644 --- a/include/Objects/File.php +++ b/include/Objects/File.php @@ -6,20 +6,20 @@ namespace ScummVM\Objects; */ class File extends BasicObject { - private $_category_icon; - private $_url; - private $_name; - private $_type; - private $_extra_info; - private $_user_agent; + private $category_icon; + private $url; + + private $type; + private $extra_info; + private $user_agent; public function __construct($data, $baseurl = null, $baseturl = null) { - $this->_category_icon = $data['category_icon']; - $this->_name = $data['name']; - $this->_extra_info = $data['extra_info']; - $this->_type = strtolower($data['type']); - $this->_user_agent = isset($data["user_agent"]) ? $data["user_agent"] : ""; + $this->category_icon = $data['category_icon']; + $this->name = $data['name']; + $this->extra_info = $data['extra_info']; + $this->type = strtolower($data['type']); + $this->user_agent = isset($data["user_agent"]) ? $data["user_agent"] : ""; $fname = ""; @@ -46,7 +46,7 @@ class File extends BasicObject $fname = str_replace('{$release_tools}', RELEASE_TOOLS, $fname); if (is_file($fname) && is_readable($fname)) { - $this->_extra_info = array(); + $this->extra_info = array(); $sz = round((@filesize($fname) / 1024)); if ($sz < 1024) { @@ -61,7 +61,7 @@ class File extends BasicObject $sz = round($sz, 2) . "G"; } } - $this->_extra_info['size'] = $sz; + $this->extra_info['size'] = $sz; $ext = substr($url, (strrpos($url, '.'))); if ($ext == '.bz2' || $ext == '.gz' || $ext == '.xz' || $ext == '.7z') { @@ -70,28 +70,28 @@ class File extends BasicObject if ((is_file($fname . '.sha256') && is_readable($fname . '.sha256')) && (@filemtime($fname . '.sha256') > @filemtime($fname)) ) { - $this->_extra_info['sha256'] = file_get_contents($fname . '.sha256'); + $this->extra_info['sha256'] = file_get_contents($fname . '.sha256'); } else { $hash = hash_file('sha256', $fname); - $this->_extra_info['sha256'] = $hash; + $this->extra_info['sha256'] = $hash; file_put_contents($fname . '.sha256', $hash); } - $this->_extra_info['ext'] = $ext; - $this->_extra_info['msg'] = $data['extra_msg']; + $this->extra_info['ext'] = $ext; + $this->extra_info['msg'] = $data['extra_msg']; } } $this->_url = $url; /** * Get the filesize/last modified information and put it in - * $this->_extra_info. + * $this->extra_info. */ if ($attributes['extra_info'] == 'true') { if (is_file($fname) && is_readable($fname)) { - $this->_extra_info['date'] = date('F j, Y, g:i a', @filemtime($fname)); + $this->extra_info['date'] = date('F j, Y, g:i a', @filemtime($fname)); if (!is_null($data['extra_info'])) { - $this->_extra_info['info'] = $data['extra_info']; + $this->extra_info['info'] = $data['extra_info']; } } } @@ -100,7 +100,7 @@ class File extends BasicObject /* Get the category icon. */ public function getCategoryIcon() { - return $this->_category_icon; + return $this->category_icon; } /* Get the URL. */ @@ -112,24 +112,24 @@ class File extends BasicObject /* Get the name. */ public function getName() { - return $this->_name; + return $this->name; } /* Get the type. */ public function getType() { - return $this->_type; + return $this->type; } /* Get the extra information. */ public function getExtraInfo() { - return $this->_extra_info; + return $this->extra_info; } /* Get the user-agent. */ public function getUserAgent() { - return $this->_user_agent; + return $this->user_agent; } } diff --git a/include/Objects/GameDemo.php b/include/Objects/GameDemo.php index f0daf9d7..443b636a 100644 --- a/include/Objects/GameDemo.php +++ b/include/Objects/GameDemo.php @@ -6,41 +6,41 @@ namespace ScummVM\Objects; */ class GameDemo extends BasicObject { - private $_name; - private $_url; - private $_target; - private $_category; + + private $url; + private $target; + private $category; /* GameDemo object constructor. */ public function __construct($data) { - $this->_name = $data['name']; - $this->_url = $data['url']; - $this->_target = $data['target']; - $this->_category = isset($data['category']) ? $data['category'] : $data['target']; + $this->name = $data['name']; + $this->url = $data['url']; + $this->target = $data['target']; + $this->category = isset($data['category']) ? $data['category'] : $data['target']; } /* Get the name of the demo. */ public function getName() { - return $this->_name; + return $this->name; } /* Get the download URL for the demo. */ public function getURL() { - return $this->_url; + return $this->url; } /* Get the target name for the demo. */ public function getTarget() { - return $this->_target; + return $this->target; } /* Get the category for the demo. */ public function getCategory() { - return $this->_category; + return $this->category; } } diff --git a/include/Objects/MenuItem.php b/include/Objects/MenuItem.php index 0efc92bd..098c4a7e 100644 --- a/include/Objects/MenuItem.php +++ b/include/Objects/MenuItem.php @@ -6,36 +6,36 @@ namespace ScummVM\Objects; */ class MenuItem extends BasicObject { - private $_name; - private $_class; - private $_entries; + + private $class; + private $entries; /* Menu object constructor. */ public function __construct($data) { - $this->_name = $data['name']; - $this->_class = $data['class']; - $this->_entries = array(); + $this->name = $data['name']; + $this->class = $data['class']; + $this->entries = array(); foreach ($data['link'] as $key => $value) { - $this->_entries[$value['name']] = $value['href']; + $this->entries[$value['name']] = $value['href']; } } /* Get the name. */ public function getName() { - return $this->_name; + return $this->name; } /* Get the CSS class. */ public function getClass() { - return $this->_class; + return $this->class; } /* Get the list of links, with the name as key and URL as value. */ public function getEntries() { - return $this->_entries; + return $this->entries; } } diff --git a/include/Objects/News.php b/include/Objects/News.php index 3ff4441b..cf8fc3e8 100644 --- a/include/Objects/News.php +++ b/include/Objects/News.php @@ -6,12 +6,11 @@ namespace ScummVM\Objects; */ class News extends BasicObject { - private $_title; - private $_date; - private $_author; - private $_image; - private $_content; - private $_filename; + private $title; + private $date; + private $author; + private $content; + private $filename; /** * News object constructor that extracts the data from the JSON scheme @@ -28,11 +27,11 @@ class News extends BasicObject */ public function __construct($data, $filename, $processContent = false) { - $this->_title = $processContent ? $this->processText($data->title) : $data->title; - $this->_date = $data->date; - $this->_author = $data->author; - $this->_content = $processContent ? $this->processText($data->content) : $data->content; - $this->_filename = basename($filename); + $this->title = $processContent ? $this->processText($data->title) : $data->title; + $this->date = $data->date; + $this->author = $data->author; + $this->content = $processContent ? $this->processText($data->content) : $data->content; + $this->filename = basename($filename); } /** @@ -44,7 +43,7 @@ class News extends BasicObject * http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references * for a list of valid entities for both XML and HTML */ - function processText($text) + public function processText($text) { return html_entity_decode($text, ENT_COMPAT, 'UTF-8'); } @@ -52,36 +51,36 @@ class News extends BasicObject /* Get the title. */ public function getTitle() { - return $this->_title; + return $this->title; } /* Get the date. */ public function getDate() { - return $this->_date; + return $this->date; } /* Get the author. */ public function getAuthor() { - return $this->_author; + return $this->author; } /* Get the content. */ public function getContent() { - return $this->_content; + return $this->content; } /* Get the filename. */ public function getFilename() { - return $this->_filename; + return $this->filename; } /* Get the News link. */ public function getLink() { - return URL_BASE . 'news/' . substr($this->_filename, 0, -5); + return URL_BASE . 'news/' . substr($this->filename, 0, -5); } } diff --git a/include/Objects/Person.php b/include/Objects/Person.php index 8e6e6dbb..0a6e22df 100644 --- a/include/Objects/Person.php +++ b/include/Objects/Person.php @@ -7,33 +7,33 @@ namespace ScummVM\Objects; */ class Person extends BasicObject { - private $_name; - private $_alias; - private $_description; + + private $alias; + private $description; /* Person object constructor. */ public function __construct($args) { - $this->_name = $args['name']; - $this->_alias = $args['alias']; - $this->_description = $args['description']; + $this->name = $args['name']; + $this->alias = $args['alias']; + $this->description = $args['description']; } /* Get the name. */ public function getName() { - return $this->_name; + return $this->name; } /* Get the alias. */ public function getAlias() { - return $this->_alias; + return $this->alias; } /* Get the description. */ public function getDescription() { - return $this->_description; + return $this->description; } } diff --git a/include/Objects/Project.php b/include/Objects/Project.php index a9375978..3797dbc9 100644 --- a/include/Objects/Project.php +++ b/include/Objects/Project.php @@ -6,9 +6,9 @@ namespace ScummVM\Objects; */ class Project extends BasicObject { - private $_name; - private $_info; - private $_downloads; + + private $info; + private $downloads; /* Project object constructor. */ public function __construct($data) diff --git a/include/Objects/QAEntry.php b/include/Objects/QAEntry.php index 8868cc54..b022b2a9 100644 --- a/include/Objects/QAEntry.php +++ b/include/Objects/QAEntry.php @@ -7,10 +7,10 @@ namespace ScummVM\Objects; */ class QAEntry extends BasicObject { - private $_hrefs; - private $_question; - private $_answer; - private $_xref; + private $hrefs; + private $question; + private $answer; + private $xref; /** * QAEntry object constructor. @@ -22,42 +22,42 @@ class QAEntry extends BasicObject */ public function __construct($data, $section_number, $entry_number, &$xref) { - $this->_hrefs = array(); + $this->hrefs = array(); if (! empty($data['href'])) { - array_push($this->_hrefs, $data['href']); + array_push($this->hrefs, $data['href']); $xref[$data['href']] = $data['question']; } - array_push($this->_hrefs, "{$section_number}_{$entry_number}"); + array_push($this->hrefs, "{$section_number}_{$entry_number}"); - $this->_question = $data['question']; - $this->_answer = $data['answer']; + $this->question = $data['question']; + $this->answer = $data['answer']; /* Save a reference to the xref table for later use. */ - $this->_xref = &$xref; + $this->xref = &$xref; } /* Get the primary anchor name for this entry. */ public function getHref() { - return $this->_hrefs[0]; + return $this->hrefs[0]; } /* Get all anchor names for this entry. */ public function getHrefs() { - return $this->_hrefs; + return $this->hrefs; } /* Get the question for this entry. */ public function getQuestion() { - return $this->_question; + return $this->question; } /* Get the answer for this entry. */ public function getAnswer() { - $answer = &$this->_answer; - $xref = &$this->_xref; + $answer = &$this->answer; + $xref = &$this->xref; /* If we find a xref we need to make the final conversion to HTML. */ if (strpos($answer, '_xref as $anchor => $text) { + foreach ($this->xref as $anchor => $text) { $xref['pattern'][] = "/<\/a>/"; $xref['replace'][] = "{$text}"; } } $answer = preg_replace($xref['pattern'], $xref['replace'], $answer); } - return $this->_answer; + return $this->answer; } } diff --git a/include/Objects/QASection.php b/include/Objects/QASection.php index 9148e76d..13de5e90 100644 --- a/include/Objects/QASection.php +++ b/include/Objects/QASection.php @@ -7,9 +7,9 @@ namespace ScummVM\Objects; */ class QASection extends BasicObject { - private $_title; - private $_entries; - private $_toc; + private $title; + private $entries; + private $toc; /** * QASection object constructor. @@ -20,33 +20,33 @@ class QASection extends BasicObject */ public function __construct($data, $section_number, &$xref) { - $this->_title = $data['title']; - $this->_entries = array(); - $this->_toc = array(); + $this->title = $data['title']; + $this->entries = array(); + $this->toc = array(); parent::toArray($data['entry']); $count = 1; foreach ($data['entry'] as $key => $value) { $qa = new QAEntry($value, $section_number, $count++, $xref); - $this->_entries[] = $qa; - $this->_toc[$qa->getHref()] = $qa->getQuestion(); + $this->entries[] = $qa; + $this->toc[$qa->getHref()] = $qa->getQuestion(); } } /* Get the title of this section. */ public function getTitle() { - return $this->_title; + return $this->title; } /* Get a list with all question-answer entries for this section. */ public function getEntries() { - return $this->_entries; + return $this->entries; } /* Get the table of contents for this section. */ public function getTOC() { - return $this->_toc; + return $this->toc; } } diff --git a/include/Objects/Screenshot.php b/include/Objects/Screenshot.php index 5ffb0600..1bce16bf 100644 --- a/include/Objects/Screenshot.php +++ b/include/Objects/Screenshot.php @@ -6,16 +6,16 @@ namespace ScummVM\Objects; */ class Screenshot extends BasicObject { - private $_name; - private $_category; - private $_files; + + private $category; + private $files; /* The Screenshot object constructor. */ public function __construct($data) { - $this->_name = $data['name']; - $this->_category = $data['category']; - $this->_files = array(); + $this->name = $data['name']; + $this->category = $data['category']; + $this->files = array(); if (isset($data['image'])) { if (!isset($data['image'][0])) { parent::toArray($data['image']); @@ -24,18 +24,21 @@ class Screenshot extends BasicObject foreach ($data['image'] as $value) { if (isset($value['range'])) { $attr = $value['range']['@attributes']; - if (!isset($attr['from']) || !isset($attr['to']) || !isset($attr['format']) || !strstr($value['file'], '#n#')) { + if (!isset($attr['from']) + || !isset($attr['to']) + || !isset($attr['format']) + || !strstr($value['file'], '#n#')) { throw new \ErrorException('Invalid range format for ' . $value['file']); } $pat = str_replace("#n#", $attr['format'], $value['file']); for ($num = $attr['from']; $num <= $attr['to']; $num++) { - $this->_files[] = array( + $this->files[] = array( 'filename' => sprintf($pat, $num), 'caption' => $value['caption'], ); } } else { - $this->_files[] = array( + $this->files[] = array( 'filename' => $value['file'], 'caption' => $value['caption'], ); @@ -47,18 +50,18 @@ class Screenshot extends BasicObject /* Get the name. */ public function getName() { - return $this->_name; + return $this->name; } /* Get the category this screenshot belongs too. */ public function getCategory() { - return $this->_category; + return $this->category; } /* Get the list of files, with the base filename as key and the caption as value. */ public function getFiles() { - return $this->_files; + return $this->files; } } diff --git a/include/Objects/WebLink.php b/include/Objects/WebLink.php index 4474c637..900e04f8 100644 --- a/include/Objects/WebLink.php +++ b/include/Objects/WebLink.php @@ -6,34 +6,34 @@ namespace ScummVM\Objects; */ class WebLink extends BasicObject { - private $_name; - private $_url; - private $_description; + + private $url; + private $description; /* WebLink object constructor. */ public function __construct($data) { - $this->_name = $data['name']; - $this->_url = $data['url']; - $this->_description = $data['description']; + $this->name = $data['name']; + $this->url = $data['url']; + $this->description = $data['description']; } /* Get the name of the link. */ public function getName() { - return $this->_name; + return $this->name; } /* Get the URL of the link. */ public function getURL() { - return $this->_url; + return $this->url; } /* Get the description of the link. */ public function getDescription() { - return $this->_description; + return $this->description; } /* Get the user-agent. */ diff --git a/include/Pages/CompatibilityPage.php b/include/Pages/CompatibilityPage.php index 46f6af39..90deb4b1 100644 --- a/include/Pages/CompatibilityPage.php +++ b/include/Pages/CompatibilityPage.php @@ -11,26 +11,26 @@ use ScummVM\Models\CompatibilityModel; */ class CompatibilityPage extends Controller { - protected $_template; - private $_template_details; - private $_supportLevelDesc; - private $_supportLevelClass; + + private $template_details; + private $supportLevelDesc; + private $supportLevelClass; /* Constructor. */ public function __construct() { parent::__construct(); global $Smarty; - $this->_template = 'pages/compatibility.tpl'; - $this->_template_details = 'components/compatibility_details.tpl'; - $this->_supportLevelDesc = array( + $this->template = 'pages/compatibility.tpl'; + $this->template_details = 'components/compatibility_details.tpl'; + $this->supportLevelDesc = array( 'untested' => $Smarty->getConfigVars('compatibilityUntested'), 'broken' => $Smarty->getConfigVars('compatibilityBroken'), 'bugged' => $Smarty->getConfigVars('compatibilityBugged'), 'good' => $Smarty->getConfigVars('compatibilityGood'), 'excellent' => $Smarty->getConfigVars('compatibilityExcellent') ); - $this->_supportLevelClass = array( + $this->supportLevelClass = array( 'untested' => 'pctU', 'broken' => 'pct0', 'bugged' => 'pct50', @@ -73,14 +73,18 @@ class CompatibilityPage extends Controller return $this->renderPage( array( 'title' => preg_replace('/{version}/', $version, $Smarty->getConfigVars('compatibilityTitle')), - 'content_title' => preg_replace('/{version}/', $version, $Smarty->getConfigVars('compatibilityContentTitle')), + 'content_title' => preg_replace( + '/{version}/', + $version, + $Smarty->getConfigVars('compatibilityContentTitle') + ), 'version' => $version, 'game' => $game, 'old_layout' => $oldLayout, - 'support_level_desc' => $this->_supportLevelDesc, - 'support_level_class' => $this->_supportLevelClass + 'support_level_desc' => $this->supportLevelDesc, + 'support_level_class' => $this->supportLevelClass ), - $this->_template_details + $this->template_details ); } @@ -101,16 +105,20 @@ class CompatibilityPage extends Controller return $this->renderPage( array( 'title' => preg_replace('/{version}/', $version, $Smarty->getConfigVars('compatibilityTitle')), - 'content_title' => preg_replace('/{version}/', $version, $Smarty->getConfigVars('compatibilityContentTitle')), + 'content_title' => preg_replace( + '/{version}/', + $version, + $Smarty->getConfigVars('compatibilityContentTitle') + ), 'version' => $version, 'compat_data' => $compat_data, 'last_updated' => $last_updated, 'versions' => $versions, 'old_layout' => $oldLayout, - 'support_level_desc' => $this->_supportLevelDesc, - 'support_level_class' => $this->_supportLevelClass + 'support_level_desc' => $this->supportLevelDesc, + 'support_level_class' => $this->supportLevelClass ), - $this->_template + $this->template ); } } diff --git a/include/Pages/ContactPage.php b/include/Pages/ContactPage.php index 5f18f4dd..0c76f548 100644 --- a/include/Pages/ContactPage.php +++ b/include/Pages/ContactPage.php @@ -5,13 +5,13 @@ use ScummVM\Controller; class ContactPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/contact.tpl'; + $this->template = 'pages/contact.tpl'; } /* Display the index page. */ @@ -24,7 +24,7 @@ class ContactPage extends Controller 'title' => $Smarty->getConfigVars('contactTitle'), 'content_title' => $Smarty->getConfigVars('contactContentTitle'), ), - $this->_template + $this->template ); } } diff --git a/include/Pages/CreditsPage.php b/include/Pages/CreditsPage.php index 5f4d4c89..1abe0f73 100644 --- a/include/Pages/CreditsPage.php +++ b/include/Pages/CreditsPage.php @@ -12,7 +12,7 @@ class CreditsPage extends Controller public function __construct() { parent::__construct(); - $this->_template = 'pages/credits.tpl'; + $this->template = 'pages/credits.tpl'; } /* Display the index page. */ @@ -27,7 +27,7 @@ class CreditsPage extends Controller 'content_title' => $Smarty->getConfigVars('creditsContentTitle'), 'credits' => $credits, ), - $this->_template + $this->template ); } } diff --git a/include/Pages/DemosPage.php b/include/Pages/DemosPage.php index 9ec5a83b..3cb22467 100644 --- a/include/Pages/DemosPage.php +++ b/include/Pages/DemosPage.php @@ -6,13 +6,13 @@ use ScummVM\Models\GameDemosModel; class DemosPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/game_demos.tpl'; + $this->template = 'pages/game_demos.tpl'; } /* Display the index page. */ @@ -27,7 +27,7 @@ class DemosPage extends Controller 'content_title' => $Smarty->getConfigVars('demosContentTitle'), 'demos' => $demos, ), - $this->_template + $this->template ); } } diff --git a/include/Pages/DocumentationPage.php b/include/Pages/DocumentationPage.php index f9076924..9e4d81f3 100644 --- a/include/Pages/DocumentationPage.php +++ b/include/Pages/DocumentationPage.php @@ -6,13 +6,13 @@ use ScummVM\Models\DocumentationModel; class DocumentationPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/documentation.tpl'; + $this->template = 'pages/documentation.tpl'; } /* Display the index page. */ @@ -29,7 +29,7 @@ class DocumentationPage extends Controller 'content_title' => $Smarty->getConfigVars('documentationContentTitle'), 'documents' => $documents, ), - $this->_template + $this->template ); } } diff --git a/include/Pages/DownloadsPage.php b/include/Pages/DownloadsPage.php index 99c2590c..f4691ff1 100644 --- a/include/Pages/DownloadsPage.php +++ b/include/Pages/DownloadsPage.php @@ -6,19 +6,18 @@ use ScummVM\Models\DownloadsModel; class DownloadsPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/downloads.tpl'; + $this->template = 'pages/downloads.tpl'; } - function getRecommendedDownloadsJS(&$downloads) + private function getRecommendedDownloadsJS(&$downloads) { - $js = "var versions = {\n"; - + $versions = new \stdClass(); foreach ($downloads as $dsection) { foreach ($dsection->getSubSections() as $dsubsection) { foreach ($dsubsection->getItems() as $curItem) { @@ -41,14 +40,18 @@ class DownloadsPage extends Controller $extra_text = $data; } - $js .= "\t\t\t'{$userAgent}':\t{ 'os':\t'{$name}', 'ver':\t'{$version}', 'desc':\t'{$extra_text}', 'url':\t'{$url}'},\n"; + $versions->$userAgent = array( + 'os' => $name, + 'ver' => $version, + 'desc' => $extra_text, + 'url' => $url, + ); } } } } - $js .= "};\n"; - return $js; + return 'var versions = ' . JSON_ENCODE($versions); } /* Display the index page. */ @@ -69,7 +72,7 @@ class DownloadsPage extends Controller 'release_debian' => RELEASE_DEBIAN, 'recommendedDownloadsJS' => $recommendedDownloadsJS ), - $this->_template + $this->template ); } } diff --git a/include/Pages/ExceptionsPage.php b/include/Pages/ExceptionsPage.php index 3f3db985..8598fe90 100644 --- a/include/Pages/ExceptionsPage.php +++ b/include/Pages/ExceptionsPage.php @@ -3,13 +3,13 @@ namespace ScummVM\Pages; class ExceptionsPage extends \ScummVM\Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'components/exception.tpl'; + $this->template = 'components/exception.tpl'; } /* Display the index page. */ @@ -23,7 +23,7 @@ class ExceptionsPage extends \ScummVM\Controller 'content_title' => $Smarty->getConfigVars('exceptionsContentTitle'), 'exception' => $exception, ), - $this->_template + $this->template ); } } diff --git a/include/Pages/FAQPage.php b/include/Pages/FAQPage.php index 8e9ec661..062fdb60 100644 --- a/include/Pages/FAQPage.php +++ b/include/Pages/FAQPage.php @@ -6,13 +6,13 @@ use ScummVM\Models\FAQModel; class FAQPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/faq.tpl'; + $this->template = 'pages/faq.tpl'; } /* Display the index page. */ @@ -29,7 +29,7 @@ class FAQPage extends Controller 'contents' => $contents, 'modified' => $modified, ), - $this->_template + $this->template ); } } diff --git a/include/Pages/FeedsPage.php b/include/Pages/FeedsPage.php index ef3733aa..c448348e 100644 --- a/include/Pages/FeedsPage.php +++ b/include/Pages/FeedsPage.php @@ -6,15 +6,15 @@ use ScummVM\Models\NewsModel; class FeedsPage extends Controller { - private $_template_rss; - private $_template_atom; + private $template_rss; + private $template_atom; /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template_rss = 'pages/feed_rss.tpl'; - $this->_template_atom = 'pages/feed_atom.tpl'; + $this->template_rss = 'pages/feed_rss.tpl'; + $this->template_atom = 'pages/feed_atom.tpl'; } /* Display the index page. */ @@ -22,9 +22,9 @@ class FeedsPage extends Controller { $feed = $_GET['f']; if ($feed == 'atom') { - $template = $this->_template_atom; + $template = $this->template_atom; } else { - $template = $this->_template_rss; + $template = $this->template_rss; } $news_items = NewsModel::getLatestNews(NEWS_ITEMS, true); diff --git a/include/Pages/GamesPage.php b/include/Pages/GamesPage.php index 5fef48fd..5af6aca5 100644 --- a/include/Pages/GamesPage.php +++ b/include/Pages/GamesPage.php @@ -6,13 +6,13 @@ use ScummVM\Models\GamesModel; class GamesPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/games.tpl'; + $this->template = 'pages/games.tpl'; } /* Display the index page. */ @@ -31,7 +31,7 @@ class GamesPage extends Controller 'release_tools' => RELEASE_TOOLS, 'release_debian' => RELEASE_DEBIAN, ), - $this->_template + $this->template ); } } diff --git a/include/Pages/LinksPage.php b/include/Pages/LinksPage.php index 4f4f95da..1a969946 100644 --- a/include/Pages/LinksPage.php +++ b/include/Pages/LinksPage.php @@ -6,13 +6,13 @@ use ScummVM\Models\LinksModel; class LinksPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/links.tpl'; + $this->template = 'pages/links.tpl'; } /* Display the index page. */ @@ -27,7 +27,7 @@ class LinksPage extends Controller 'content_title' => $Smarty->getConfigVars('linksContentTitle'), 'links' => $links, ), - $this->_template + $this->template ); } } diff --git a/include/Pages/NewsPage.php b/include/Pages/NewsPage.php index 3ec9c7fd..50305779 100644 --- a/include/Pages/NewsPage.php +++ b/include/Pages/NewsPage.php @@ -7,13 +7,13 @@ use ScummVM\Models\ScreenshotsModel; class NewsPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/news.tpl'; + $this->template = 'pages/news.tpl'; } /* Display the index page. */ @@ -50,7 +50,7 @@ class NewsPage extends Controller 'news_items' => $news_items, 'news_archive_link' => false, ), - $this->_template + $this->template ); } @@ -75,7 +75,7 @@ class NewsPage extends Controller 'news_archive_link' => true, 'random_shot' => $random_shot, ), - $this->_template + $this->template ); } } diff --git a/include/Pages/PressPage.php b/include/Pages/PressPage.php index 7e3cd3f5..c8dc3d1c 100644 --- a/include/Pages/PressPage.php +++ b/include/Pages/PressPage.php @@ -6,13 +6,13 @@ use ScummVM\Models\ArticleModel; class PressPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/press.tpl'; + $this->template = 'pages/press.tpl'; } /* Display the index page. */ @@ -27,7 +27,7 @@ class PressPage extends Controller 'content_title' => $Smarty->getConfigVars('pressContentTitle'), 'articles' => $articles, ), - $this->_template + $this->template ); } } diff --git a/include/Pages/PressSnowberryPage.php b/include/Pages/PressSnowberryPage.php index 96aa3557..4457b9a9 100644 --- a/include/Pages/PressSnowberryPage.php +++ b/include/Pages/PressSnowberryPage.php @@ -6,13 +6,13 @@ use ScummVM\Models\ArticleModel; class PressSnowberryPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/press_snowberry.tpl'; + $this->template = 'pages/press_snowberry.tpl'; } /* Display the index page. */ @@ -27,7 +27,7 @@ class PressSnowberryPage extends Controller 'content_title' => $Smarty->getConfigVars('pressSnowberryContentTitle'), 'articles' => $articles, ), - $this->_template + $this->template ); } } diff --git a/include/Pages/ScreenshotsPage.php b/include/Pages/ScreenshotsPage.php index b72a1f41..e0ff2e19 100644 --- a/include/Pages/ScreenshotsPage.php +++ b/include/Pages/ScreenshotsPage.php @@ -6,15 +6,15 @@ use ScummVM\Models\ScreenshotsModel; class ScreenshotsPage extends Controller { - protected $_template; - private $_template_category; + + private $template_category; /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/screenshots.tpl'; - $this->_template_category = 'pages/screenshots_category.tpl'; + $this->template = 'pages/screenshots.tpl'; + $this->template_category = 'pages/screenshots_category.tpl'; } /* Display the index page. */ @@ -46,7 +46,7 @@ class ScreenshotsPage extends Controller 'screenshots' => $screenshot, 'random_shot' => $random_shot, ), - $this->_template + $this->template ); } @@ -76,7 +76,7 @@ class ScreenshotsPage extends Controller 'category' => $category, 'game' => $game, ), - $this->_template_category + $this->template_category ); } diff --git a/include/Pages/SubprojectsPage.php b/include/Pages/SubprojectsPage.php index 7e462ed1..a884207f 100644 --- a/include/Pages/SubprojectsPage.php +++ b/include/Pages/SubprojectsPage.php @@ -6,13 +6,13 @@ use ScummVM\Models\SubprojectsModel; class SubprojectsPage extends Controller { - protected $_template; + /* Constructor. */ public function __construct() { parent::__construct(); - $this->_template = 'pages/subprojects.tpl'; + $this->template = 'pages/subprojects.tpl'; } /* Display the index page. */ @@ -27,7 +27,7 @@ class SubprojectsPage extends Controller 'content_title' => $Smarty->getConfigVars('subprojectsContentTitle'), 'subprojects' => $subprojects, ), - $this->_template + $this->template ); } } diff --git a/include/XMLParser.php b/include/XMLParser.php index 8f8be058..57046a51 100644 --- a/include/XMLParser.php +++ b/include/XMLParser.php @@ -22,9 +22,9 @@ class XMLParser const NS_XHTML = 'http://www.w3.org/TR/xhtml1/'; private static $empty_elements = array('br', 'hr', 'img'); - private $_tree; - private $_data; - private $_ptr; + private $tree; + private $data; + private $ptr; /** * Constructor. @@ -34,9 +34,9 @@ class XMLParser */ public function __construct() { - $this->_tree = array(); - $this->_data = null; - $this->_ptr = null; + $this->tree = array(); + $this->data = null; + $this->ptr = null; } /** @@ -125,7 +125,8 @@ class XMLParser /* Parse the data and free the parser resource. */ if (!xml_parse($parser, $xml, true)) { $error = "\n\nError code: " . xml_get_error_code($parser) . "\n"; - $error .= "Line: " . xml_get_current_line_number($parser) . ", character: " . xml_get_current_column_number($parser) . "\n"; + $error .= "Line: " . xml_get_current_line_number($parser) + . ", character: " . xml_get_current_column_number($parser) . "\n"; $error .= "Error message: " . xml_error_string(xml_get_error_code($parser)) . "\n"; xml_parser_free($parser); throw new \ErrorException(self::PARSER_ERROR . $error); @@ -135,7 +136,7 @@ class XMLParser * The root element will contain an array with an empty key, so we can * skip that one right now. */ - $tree = $this->_tree['']; + $tree = $this->tree['']; $this->simplifyArray($tree); return $tree; } @@ -183,14 +184,14 @@ class XMLParser } /* Get the key for the last node in the tree. */ - end($this->_tree); - $key = key($this->_tree); + end($this->tree); + $key = key($this->tree); /* Store the position so we can add the data later. */ - $this->_ptr = &$this->_tree[$key][$name]; + $this->ptr = &$this->tree[$key][$name]; /* Store a reference the attributes. */ if ($element != null) { - $this->_ptr['@attributes'] = &$element; + $this->ptr['@attributes'] = &$element; } else { /** * For one reason or another that escapes me, we must do this, @@ -198,13 +199,13 @@ class XMLParser * in endElement() by overwriting the empty elements created * here. */ - $this->_ptr[] = &$element; + $this->ptr[] = &$element; } /** * Store the reference directly in the tree until this node (and * it's children) are done. Will get removed in endElement(). */ - $this->_tree[$name] = &$element; + $this->tree[$name] = &$element; } } @@ -218,7 +219,7 @@ class XMLParser */ private function getElement($parser, $data) { - $this->_data .= $data; + $this->data .= $data; } /** @@ -246,20 +247,20 @@ class XMLParser } /* Otherwise we can just add the data. */ } else { - $data = trim($this->_data); + $data = trim($this->data); if (!empty($data)) { /* If we got an empty element in the array, overwrite it. */ - $pos = count($this->_ptr); - if (is_null($this->_ptr[($pos-1)])) { + $pos = count($this->ptr); + if (is_null($this->ptr[($pos-1)])) { $pos--; } - $this->_ptr[$pos] = $data; + $this->ptr[$pos] = $data; } /* Reset the internal data holder. */ - $this->_data = null; + $this->data = null; /* Remove the reference. */ - $pop = array_pop($this->_tree); + $pop = array_pop($this->tree); } }