Made BlogListGenerator PSR-2 conform
This commit is contained in:
parent
0bb2dede4d
commit
89e756819d
5 changed files with 16 additions and 9 deletions
|
@ -25,7 +25,10 @@ date_default_timezone_set('UTC');
|
||||||
require __DIR__ . '/vendor/autoload.php'; // loading composer libs
|
require __DIR__ . '/vendor/autoload.php'; // loading composer libs
|
||||||
|
|
||||||
require './res/php/Config.php';
|
require './res/php/Config.php';
|
||||||
|
require_once './res/php/BlogListGenerator.php';
|
||||||
|
|
||||||
use mmk2410\rbe\config\Config as Config;
|
use mmk2410\rbe\config\Config as Config;
|
||||||
|
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
|
||||||
|
|
||||||
$configParser = new Config('config.yaml', 'vendor/autoload.php');
|
$configParser = new Config('config.yaml', 'vendor/autoload.php');
|
||||||
|
|
||||||
|
@ -33,7 +36,7 @@ $config = $configParser->getConfig();
|
||||||
|
|
||||||
require './lang/' . $config["language"] . ".php"; // Language file
|
require './lang/' . $config["language"] . ".php"; // Language file
|
||||||
require_once 'res/php/ArticleGenerator.php'; // The article generator
|
require_once 'res/php/ArticleGenerator.php'; // The article generator
|
||||||
require_once './res/php/BlogListGenerator.php'; // and the blog list generator
|
|
||||||
|
|
||||||
// Getting some variables ($_GET and $_SERVER)
|
// Getting some variables ($_GET and $_SERVER)
|
||||||
$getblog = filter_input(INPUT_GET, "blog"); // get the blog variable
|
$getblog = filter_input(INPUT_GET, "blog"); // get the blog variable
|
||||||
|
|
|
@ -35,8 +35,10 @@
|
||||||
|
|
||||||
require '../vendor/autoload.php';
|
require '../vendor/autoload.php';
|
||||||
require '../res/php/Config.php';
|
require '../res/php/Config.php';
|
||||||
|
require "./../res/php/BlogListGenerator.php";
|
||||||
|
|
||||||
use \mmk2410\rbe\config\Config as Config;
|
use \mmk2410\rbe\config\Config as Config;
|
||||||
|
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
|
||||||
|
|
||||||
$config = new Config("../config.yaml", '../vendor/autoload.php');
|
$config = new Config("../config.yaml", '../vendor/autoload.php');
|
||||||
$settings = $config->getConfig();
|
$settings = $config->getConfig();
|
||||||
|
@ -108,7 +110,7 @@ if ($config["rcc"]["rcc"] == "on") {
|
||||||
} else {
|
} else {
|
||||||
if (password_verify($passwd, $password)) {
|
if (password_verify($passwd, $password)) {
|
||||||
$_SESSION['login'] = true;
|
$_SESSION['login'] = true;
|
||||||
include_once "./../res/php/BlogListGenerator.php";
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- Post Upload -->
|
<!-- Post Upload -->
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* @license MIT License
|
* @license MIT License
|
||||||
* @link http://marcel-kapfer.de/rangitaki
|
* @link http://marcel-kapfer.de/rangitaki
|
||||||
*/
|
*/
|
||||||
|
namespace mmk2410\rbe\BlogListGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The blog list generator class is a collection of functions for generating
|
* The blog list generator class is a collection of functions for generating
|
||||||
|
@ -37,7 +37,7 @@ class BlogListGenerator
|
||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*/
|
*/
|
||||||
function listBlog($directory, $blogname, $blogmaintitle)
|
public function listBlog($directory, $blogname, $blogmaintitle)
|
||||||
{
|
{
|
||||||
// get content of the blog file;
|
// get content of the blog file;
|
||||||
$blog = file_get_contents($directory . $blogname);
|
$blog = file_get_contents($directory . $blogname);
|
||||||
|
@ -74,7 +74,7 @@ class BlogListGenerator
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getName($file)
|
public function getName($file)
|
||||||
{
|
{
|
||||||
// get the content of the blog file
|
// get the content of the blog file
|
||||||
$blog = file_get_contents($file);
|
$blog = file_get_contents($file);
|
||||||
|
@ -96,7 +96,7 @@ class BlogListGenerator
|
||||||
*
|
*
|
||||||
* @return int Amount of files
|
* @return int Amount of files
|
||||||
*/
|
*/
|
||||||
static function getArticleAmount($blog)
|
public static function getArticleAmount($blog)
|
||||||
{
|
{
|
||||||
$directory = "./articles/" . $blog . "/";
|
$directory = "./articles/" . $blog . "/";
|
||||||
if (!file_exists($directory)) {
|
if (!file_exists($directory)) {
|
||||||
|
@ -104,7 +104,7 @@ class BlogListGenerator
|
||||||
} else {
|
} else {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$handle = opendir($directory);
|
$handle = opendir($directory);
|
||||||
while (($file = readdir($handle)) !== false ) {
|
while (($file = readdir($handle)) !== false) {
|
||||||
if (!in_array($file, array('.','..'))) {
|
if (!in_array($file, array('.','..'))) {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -112,5 +112,4 @@ class BlogListGenerator
|
||||||
return $i;
|
return $i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* @link http://marcel-kapfer.de/rangitaki
|
* @link http://marcel-kapfer.de/rangitaki
|
||||||
*/
|
*/
|
||||||
require_once "BlogListGenerator.php";
|
require_once "BlogListGenerator.php";
|
||||||
|
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
|
||||||
|
|
||||||
require_once './res/php/Config.php';
|
require_once './res/php/Config.php';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'PHPUnit/Autoload.php';
|
require_once 'PHPUnit/Autoload.php';
|
||||||
include 'res/php/BlogListGenerator.php';
|
|
||||||
|
require_once 'res/php/BlogListGenerator.php';
|
||||||
|
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
|
||||||
|
|
||||||
class BlogListGeneratorTest extends \PHPUnit_Framework_TestCase
|
class BlogListGeneratorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue