Exemple #1
0
<?php

require_once "library/epages-rest-php.phar";
// Set the logger to the wished log level.
// Default is: NOTIFICATION, so all messages will be print.
ep6\Logger::setLogLevel("ERROR");
// Print an error message.
ep6\Logger::notify("Notify this message");
// To print an error message without being restricted by the log level you can use following code.
ep6\Logger::force("This message will be printed every time!");
Exemple #2
0
<?php

require "src/Shop.class.php";
ep6\Logger::setLogLevel(ep6\LogLevel::NONE);
$shop = new ep6\Shop("xxx", "xxx", "xxx", true);
# parse parameter
if (isset($_GET["product"]) && isset($_GET["stocklevel"])) {
    $product = new ep6\Product(array("productId" => $_GET["product"]));
    if ($_GET["stocklevel"] == "plus") {
        $product->increaseStockLevel();
        header("Location: ?");
    } else {
        if ($_GET["stocklevel"] == "minus") {
            $product->decreaseStockLevel();
            header("Location: ?");
        }
    }
}
if (isset($_GET["sort"])) {
    switch ($_GET["sort"]) {
        case "priceu":
            $sort = "price";
            $direction = "asc";
            break;
        case "priced":
            $sort = "price";
            $direction = "desc";
            break;
        case "nameu":
            $sort = "name";
            $direction = "asc";
Exemple #3
0
 fclose($handle);
 $configArray = ep6\JSONHandler::parseJSON($configuration);
 if (ep6\InputValidator::isEmptyArray($configArray)) {
     ep6\Logger::warning("ep6\\ConfigLoader\nConfiguration file has no valid JSON.");
     break;
 }
 # handle logging
 if (!ep6\InputValidator::isEmptyArrayKey($configArray, "logging")) {
     if (!ep6\InputValidator::isEmptyArrayKey($configArray["logging"], "level")) {
         ep6\Logger::setLogLevel($configArray["logging"]["level"]);
     }
     if (!ep6\InputValidator::isEmptyArrayKey($configArray["logging"], "output")) {
         ep6\Logger::setOutput($configArray["logging"]["output"]);
     }
     if (!ep6\InputValidator::isEmptyArrayKey($configArray["logging"], "outputfile")) {
         ep6\Logger::setOutputFile($configArray["logging"]["outputfile"]);
     }
 }
 # handle formatting
 if (!ep6\InputValidator::isEmptyArrayKey($configArray, "formatting")) {
     foreach ($configArray["formatting"] as $formatKey => $formatSetting) {
         $formatName = $formatKey . "Formatter";
         ${$formatName} = new ep6\Formatter();
         if (!ep6\InputValidator::isEmptyArrayKey($formatSetting, "id")) {
             ${$formatName}->setID($formatSetting["id"]);
         }
         if (!ep6\InputValidator::isEmptyArrayKey($formatSetting, "classes") && !ep6\InputValidator::isEmptyArray($formatSetting["classes"])) {
             foreach ($formatSetting["classes"] as $className) {
                 ${$formatName}->setClass($className);
             }
         }