Esempio n. 1
0
<!-- layout: default -->

Current Module: <?php 
echo $moduleName;
?>
<br />
Testing: <?php 
echo $welcomeText;
?>
<br />

<?php 
\Scabbia\Helpers\String::vardump($this->controller->routeInfo);
\Scabbia\Helpers\String::vardump(\Scabbia\Framework\ApplicationBase::$current->config);
?>

.
Esempio n. 2
0
 /**
  * GET /config action
  *
  * @route {method: get, name: "home/config", path: "/config"}
  *
  * @return void
  */
 public function getConfig()
 {
     // $tConfig = new Config();
     // $tConfig->add("/var/www/test.yml");
     // $tConfig->add("/var/www/test2.yml");
     // var_dump($tConfig->get());
     echo "application configuration:<br />";
     String::vardump($this->application->config);
     echo "<br />";
     echo "module configuration:<br />";
     String::vardump($this->moduleConfig);
     echo "<br />";
 }
Esempio n. 3
0
 /**
  * A sample for event-member method for requestBegin event
  *
  * @event {on: requestBegin, priority: 10}
  *
  * @param null|array $uEventArgs arguments for the event
  *
  * @return void
  */
 public static function onRequestBegin($uEventArgs)
 {
     // echo "onRequestBegin<br />";
     String::vardump($uEventArgs);
 }
Esempio n. 4
0
 /**
  * Creates a table widget
  *
  * @param array    $uHeaders   table headers
  * @param iterable $uData      table data
  * @param array    $uVariables variables
  *
  * @return string html output
  */
 public static function table(array $uHeaders, $uData, array $uVariables)
 {
     $uVariables = $uVariables + self::$defaults;
     $tResult = String::format($uVariables["table_table"], []);
     if (count($uHeaders) > 0) {
         $tResult .= "<tr>";
         foreach ($uHeaders as $tColumn) {
             $tResult .= String::format($uVariables["table_header"], ["value" => $tColumn]);
         }
         $tResult .= "</tr>";
     }
     $tCount = 0;
     foreach ($uData as $tRow) {
         if (isset($uVariables["table_row_func"])) {
             $tResult .= call_user_func($uVariables["table_row_func"], $tRow, $tCount++);
         } else {
             if (isset($uVariables["row"])) {
                 $tResult .= String::format($uVariables["table_row"], $tRow);
             } else {
                 $tResult .= "<tr>";
                 foreach ($tRow as $tColumn) {
                     $tResult .= String::format($uVariables["table_cell"], ["value" => $tColumn]);
                 }
                 $tResult .= "</tr>";
             }
         }
     }
     $tResult .= "</table>";
     return $tResult;
 }
 /**
  * Returns the mimetype of given extension
  *
  * @param string $uExtension extension of the file
  * @param string $uDefault   default mimetype if nothing found
  *
  * @return string
  */
 public static function getMimetype($uExtension, $uDefault = "application/octet-stream")
 {
     $tExtension = String::toLower($uExtension);
     if ($tExtension === "pdf") {
         return "application/pdf";
     } elseif ($tExtension === "exe") {
         return "application/octet-stream";
     } elseif ($tExtension === "dll") {
         return "application/x-msdownload";
     } elseif ($tExtension === "zip") {
         return "application/zip";
     } elseif ($tExtension === "rar") {
         return "application/x-rar-compressed";
     } elseif ($tExtension === "gz" || $tExtension === "gzip" || $tExtension === "tgz") {
         return "application/gzip";
     } elseif ($tExtension === "7z") {
         return "application/x-7z-compressed";
     } elseif ($tExtension === "tar") {
         return "application/x-tar";
     } elseif ($tExtension === "jar") {
         return "application/java-archive";
     } elseif ($tExtension === "deb") {
         return "application/x-deb";
     } elseif ($tExtension === "img") {
         return "application/x-apple-diskimage";
     } elseif ($tExtension === "csv") {
         return "text/csv";
     } elseif ($tExtension === "txt" || $tExtension === "text" || $tExtension === "log" || $tExtension === "ini") {
         return "text/plain";
     } elseif ($tExtension === "md") {
         return "text/x-markdown";
     } elseif ($tExtension === "rtf") {
         return "text/rtf";
     } elseif ($tExtension === "odt") {
         return "application/vnd.oasis.opendocument.text";
     } elseif ($tExtension === "ods") {
         return "application/vnd.oasis.opendocument.spreadsheet";
     } elseif ($tExtension === "smil") {
         return "application/smil";
     } elseif ($tExtension === "eml") {
         return "message/rfc822";
     } elseif ($tExtension === "xml" || $tExtension === "xsl") {
         return "text/xml";
     } elseif ($tExtension === "doc" || $tExtension === "dot" || $tExtension === "word") {
         return "application/msword";
     } elseif ($tExtension === "docx" || $tExtension === "dotx") {
         return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
     } elseif ($tExtension === "xls") {
         return "application/vnd.ms-excel";
     } elseif ($tExtension === "xl") {
         return "application/excel";
     } elseif ($tExtension === "xlsx") {
         return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
     } elseif ($tExtension === "ppt" || $tExtension === "pps") {
         return "application/vnd.ms-powerpoint";
     } elseif ($tExtension === "pptx") {
         return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
     } elseif ($tExtension === "ppsx") {
         return "application/vnd.openxmlformats-officedocument.presentationml.slideshow";
     } elseif ($tExtension === "ics") {
         return "text/calendar";
     } elseif ($tExtension === "vcf" || $tExtension === "vcard") {
         return "text/vcard";
     } elseif ($tExtension === "bmp") {
         return "image/x-ms-bmp";
     } elseif ($tExtension === "gif") {
         return "image/gif";
     } elseif ($tExtension === "png") {
         return "image/png";
     } elseif ($tExtension === "jpeg" || $tExtension === "jpe" || $tExtension === "jpg") {
         return "image/jpeg";
     } elseif ($tExtension === "webp") {
         return "image/webp";
     } elseif ($tExtension === "tif" || $tExtension === "tiff") {
         return "image/tiff";
     } elseif ($tExtension === "psd") {
         return "image/vnd.adobe.photoshop";
     } elseif ($tExtension === "ai" || $tExtension === "eps" || $tExtension === "ps") {
         return "application/postscript";
     } elseif ($tExtension === "cdr") {
         return "application/cdr";
     } elseif ($tExtension === "mid" || $tExtension === "midi") {
         return "audio/midi";
     } elseif ($tExtension === "mpga" || $tExtension === "mp2" || $tExtension === "mp3") {
         return "audio/mpeg";
     } elseif ($tExtension === "aif" || $tExtension === "aiff" || $tExtension === "aifc") {
         return "audio/x-aiff";
     } elseif ($tExtension === "wav") {
         return "audio/x-wav";
     } elseif ($tExtension === "aac") {
         return "audio/aac";
     } elseif ($tExtension === "ogg") {
         return "application/ogg";
     } elseif ($tExtension === "wma") {
         return "audio/x-ms-wma";
     } elseif ($tExtension === "m4a") {
         return "audio/x-m4a";
     } elseif ($tExtension === "mpeg" || $tExtension === "mpg" || $tExtension === "mpe") {
         return "video/mpeg";
     } elseif ($tExtension === "mp4" || $tExtension === "f4v") {
         return "application/mp4";
     } elseif ($tExtension === "qt" || $tExtension === "mov") {
         return "video/quicktime";
     } elseif ($tExtension === "avi") {
         return "video/x-msvideo";
     } elseif ($tExtension === "wmv") {
         return "video/x-ms-wmv";
     } elseif ($tExtension === "webm") {
         return "video/webm";
     } elseif ($tExtension === "swf") {
         return "application/x-shockwave-flash";
     } elseif ($tExtension === "flv") {
         return "video/x-flv";
     } elseif ($tExtension === "mkv") {
         return "video/x-matroska";
     } elseif ($tExtension === "htm" || $tExtension === "html" || $tExtension === "shtm" || $tExtension === "shtml") {
         return "text/html";
     } elseif ($tExtension === "php") {
         return "application/x-httpd-php";
     } elseif ($tExtension === "phps") {
         return "application/x-httpd-php-source";
     } elseif ($tExtension === "css") {
         return "text/css";
     } elseif ($tExtension === "js") {
         return "application/x-javascript";
     } elseif ($tExtension === "json") {
         return "application/json";
     } elseif ($tExtension === "c" || $tExtension === "h") {
         return "text/x-c";
     } elseif ($tExtension === "py") {
         return "application/x-python";
     } elseif ($tExtension === "sh") {
         return "text/x-shellscript";
     } elseif ($tExtension === "pem") {
         return "application/x-x509-user-cert";
     } elseif ($tExtension === "crt" || $tExtension === "cer") {
         return "application/x-x509-ca-cert";
     } elseif ($tExtension === "pgp") {
         return "application/pgp";
     } elseif ($tExtension === "gpg") {
         return "application/gpg-keys";
     } elseif ($tExtension === "svg") {
         return "image/svg+xml";
     } elseif ($tExtension === "ttf") {
         return "application/x-font-ttf:";
     } elseif ($tExtension === "woff") {
         return "application/x-font-woff";
     }
     if (function_exists("finfo_open")) {
         $tFinfo = finfo_open(FILEINFO_MIME);
         $tMimetype = finfo_file($tFinfo, "test.{$uExtension}");
         finfo_close($tFinfo);
         return $tMimetype;
     }
     return $uDefault;
 }