Пример #1
0
<?php

// Include controller
require_once $_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "modulaise" . DIRECTORY_SEPARATOR . "scripts" . DIRECTORY_SEPARATOR . "php" . DIRECTORY_SEPARATOR . "modulaise-controller.php";
// Create a page using one of the template files from the templates folder
ModulaiseController::createPage("wide.php", basename(__FILE__, ".php"));
// define page contents
ModulaiseController::addModule("head", "bla_blank", "alternative.html");
ModulaiseController::addModule("head", "bla_blank");
// define page contents
ModulaiseController::addModule("foot", "bla_blank", "alternative.html");
ModulaiseController::addModule("foot", "bla_blank");
ModulaiseController::addModule("foot", "bla_blank", "alternative.html");
ModulaiseController::addModule("foot", "bla_blank");
ModulaiseController::addModule("foot", "bla_blank", "alternative.html");
ModulaiseController::addModule("foot", "bla_blank");
// define page contents
ModulaiseController::addModule("extra", "bla_blank");
// print the page
ModulaiseController::printPage();
Пример #2
0
<?php

// Include controller
require_once $_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "modulaise" . DIRECTORY_SEPARATOR . "scripts" . DIRECTORY_SEPARATOR . "php" . DIRECTORY_SEPARATOR . "modulaise-controller.php";
// Initiate IndexAction
ModulaiseController::indexAction();
Пример #3
0
<?php

ModulaiseController::printComment("Print first HTML snippets");
ModulaiseController::printPane(PANE_HTML_FOOT_FIRST);
ModulaiseController::printComment("Import FOOT JavaScript");
ModulaiseController::printPane(PANE_JS_FOOT);
ModulaiseController::printComment("Print last HTML snippets");
ModulaiseController::printPane(PANE_HTML_FOOT_LAST);
?>
</body>
</html>
 /**
  * Initilizes the pane content for this module
  */
 private function initializePaneContent()
 {
     if (!$this->paneContent->initialize($this->moduleId)) {
         ModulaiseController::printComment("\n\nERROR:\nModule could not initialized " . $this->moduleId . "\n\n");
     }
 }
Пример #5
0
?>

  <div id="container">
    <header>
    
<?php 
ModulaiseController::printPane("head");
?>

    </header>
    
    <div id="main">

<?php 
ModulaiseController::printPane("main");
?>
     
    </div>


  <footer>
  
<?php 
ModulaiseController::printPane("footer");
?>

  </footer>
</div>
<!--! end of #container -->
<?php 
include '_foot.php';
Пример #6
0
<?php

include '_head.php';
ModulaiseController::printPane("head");
ModulaiseController::printPane("main");
?>
<br clear="all" />
<hr />
<h2>Footer</h2>
<?php 
ModulaiseController::printPane("foot");
if (ModulaiseController::paneHasContent("extra")) {
    ?>
<br clear="all" />
<div class="pane-extra">
<h2>Extra</h2>
<?php 
    ModulaiseController::printPane("extra");
    ?>
</div>
<?php 
}
include '_foot.php';
Пример #7
0
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<?php 
ModulaiseController::printComment("Always force latest IE rendering engine (even in intranet) & Chrome Frame Remove this if you use the .htaccess");
?>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php 
ModulaiseController::printPageTitle();
?>
</title>
<meta name="description" content="">
<meta name="author" content="">
<?php 
ModulaiseController::printComment("Mobile viewport optimized: j.mp/bplateviewport");
?>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php 
ModulaiseController::printComment("Import css stylesheets");
ModulaiseController::printPane(PANE_CSS);
ModulaiseController::printComment("Print first HTML head snippets");
ModulaiseController::printPane(PANE_HTML_HEAD_FIRST);
ModulaiseController::printComment("Import head javascript javascripts");
ModulaiseController::printPane(PANE_JS_HEAD);
ModulaiseController::printComment("Print last HTML snippets");
ModulaiseController::printPane(PANE_HTML_HEAD_LAST);
?>

</head>
<body>
 /**
  * Initiates index action
  */
 public static function indexAction()
 {
     switch (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "") {
         case "build":
             // Builds the page
             require_once "modulaise-build.php";
             ModulaiseBuild::build();
             break;
         case "getAntProperties":
             // Get ant properties
             require_once "modulaise-get-ant-properties.php";
             AntPropertiesWriter::getAntProperties();
             break;
         case "printPane":
             $debug = false;
             // If we are going to show export pane
             if (isset($_REQUEST["buildMode"]) && $_REQUEST["buildMode"] == "SHOW_EXPORT") {
                 self::$buildMode = SHOW_EXPORT;
             }
             // create a dummy page
             self::createPage("nullstring", "nullstring");
             $paneName = $_REQUEST["pane"];
             if ($debug) {
                 $panes = self::getPaneNames();
                 foreach ($panes as $key => $value) {
                     echo $key . "=" . $value . "\n";
                 }
                 $paneHasContent = self::paneHasContent($paneName);
                 echo "pane has content = '" . (true === $paneHasContent) . "'\n";
             }
             // if the requested pane has content print it - otherwise print a no content comment
             self::printPane($_REQUEST["pane"]);
             break;
         default:
             // Prints the index page
             require_once "modulaise-index-page.php";
             ModulaiseIndexPage::printPage();
             break;
     }
 }
 /**
  * Checks if a pane has content, if it has true is returned
  */
 public function paneHasContent($paneId)
 {
     if (!isset($this->content[$paneId])) {
         return false;
     }
     $returnValue = false;
     $debug = false;
     if ($debug === true) {
         ModulaiseController::printComment("\n\n" . get_class() . "->printPane(): " . print_r($this->content[$paneId]) . "\n\n");
     }
     // now sort according to $priority keys
     ksort($this->content[$paneId]);
     if ($debug === true) {
         ModulaiseController::printComment("\n\n" . get_class() . "->printPane(): " . print_r($this->content[$paneId]) . "\n\n");
     }
     foreach ($this->content[$paneId] as $priorityId) {
         foreach ($priorityId as $snippet) {
             if (strlen(trim($snippet)) != 0) {
                 $returnValue = true;
             }
         }
     }
     return $returnValue;
 }
 /**
  * Concatinates CSS and JavaScript
  */
 public static function buildCompiled()
 {
     echo "\nConcatinating CSS and JavaScript\n--------------------------------------------------------------------------------\n";
     // set the PageController buildMode value to BUILD_EXPORT
     ModulaiseController::$buildMode = BUILD_EXPORT;
     // Reset global modules
     ModulaiseController::initialize();
     // Create a page containing all modules and then in turn print js_head, js_foot and css
     ModulaiseController::createPage("EXPORT", "EXPORT");
     // add all global modules to global modules array
     $allModuleNames = ModulaiseUtils::getDirectoryAsArray(ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES, ONLY_DIRECTORIES);
     // build a list with all non-global modules
     foreach ($allModuleNames as $moduleId) {
         echo "Compiling module        : " . $moduleId . "\n";
         if (substr($moduleId, 0, 1) != "0") {
             ModulaiseController::addModule("EXPORT", $moduleId);
         }
     }
     $buildTagComment = "/*\n\nBuildtag: " . ModulaiseController::$buildTag . "\n\n*/\n\n";
     // Write PANE_JS_HEAD
     // the file to write
     $writeFile = ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES . DIRECTORY_SEPARATOR . FOLDER_COMPILED . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "js_head.concatinated.js";
     echo "Writing file            : " . $writeFile . "\n";
     // capture output start
     $captureOutput = new ModulaiseCaptureOutput();
     $captureOutput->start();
     echo $buildTagComment;
     if (ModulaiseController::paneHasContent(PANE_JS_HEAD)) {
         // render the pane
         ModulaiseController::printPane(PANE_JS_HEAD);
     }
     // capture output end
     $output = $captureOutput->end();
     // write the output to file
     ModulaiseUtils::writeFile($writeFile, $output);
     // Write PANE_JS_FOOT
     // the file to write
     $writeFile = ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES . DIRECTORY_SEPARATOR . FOLDER_COMPILED . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "js_foot.concatinated.js";
     echo "Writing file            : " . $writeFile . "\n";
     // capture output start
     $captureOutput = new ModulaiseCaptureOutput();
     $captureOutput->start();
     echo $buildTagComment;
     if (ModulaiseController::paneHasContent(PANE_JS_FOOT)) {
         // render the pane
         ModulaiseController::printPane(PANE_JS_FOOT);
     }
     // capture output end
     $output = $captureOutput->end();
     // write the output to file
     ModulaiseUtils::writeFile($writeFile, $output);
     // Write each and every PANE_CSS
     // Prepare an empty array to hold the css
     $concatinated_css = array();
     $debug = false;
     // get the pane names
     $paneNames = ModulaiseController::getPaneNames();
     foreach ($paneNames as $name) {
         if ($debug === true) {
             echo "paneName=" . $name . "\n";
         }
         $pos = strpos($name, PANE_CSS);
         if (!($pos === false)) {
             $nameArrays = explode("--", $name);
             // leading zero
             $nameArrays[1] = $nameArrays[1] < 10 ? "0" . $nameArrays[1] : $nameArrays[1];
             // the file to write
             $writeFile = ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES . DIRECTORY_SEPARATOR . FOLDER_COMPILED . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . $nameArrays[1] . DELIMITER . $nameArrays[2] . ".concatinated.css";
             echo "Writing file            : " . $writeFile . "\n";
             // capture output start
             $captureOutput = new ModulaiseCaptureOutput();
             $captureOutput->start();
             echo $buildTagComment;
             if (ModulaiseController::paneHasContent($name)) {
                 // render the pane
                 ModulaiseController::printPane($name);
             }
             // capture output end
             $output = $captureOutput->end();
             // write the output to file
             ModulaiseUtils::writeFile($writeFile, $output);
             // Remove comments and blank lines from output
             $output = preg_replace('!/\\*.*?\\*/!s', '', $output);
             //$output = preg_replace('/\n\s*\n/', '', $output);
             //$output = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "", $output);
             $output = trim($output);
             if ($debug === true) {
                 echo "output=\"" . $output . "\"\n";
             }
             // if there is something to add
             if ($output != "") {
                 // also add the snippet to the concatinated array
                 $concatinated_css[$nameArrays[1] . "--" . $nameArrays[2]][] = $output;
             }
         }
     }
     // Write everything as one big pane
     // the file to write
     $writeFile = ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES . DIRECTORY_SEPARATOR . FOLDER_COMPILED . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "css.concatinated.css";
     echo "Writing file            : " . $writeFile . "\n";
     // capture output start
     $captureOutput = new ModulaiseCaptureOutput();
     $captureOutput->start();
     echo $buildTagComment;
     // now use the concatinated_css array to concatinate everything into its right place
     foreach ($concatinated_css as $css_name => $contentsArray) {
         $nameArrays = explode("--", $css_name);
         $mediaType = ModulaiseUtils::getMediaType($nameArrays[1]);
         if ($mediaType != "@media all") {
             echo "/*!NEWLINE*/" . $mediaType . " {";
         } else {
             echo "/*!NEWLINE*/";
         }
         foreach ($contentsArray as $key => $content) {
             echo $content . "\n";
         }
         if ($mediaType != "@media all") {
             echo "}";
         }
         echo "/*!NEWLINE*/";
     }
     // render the pane
     //print_r($concatinated_css);
     // capture output end
     $output = $captureOutput->end();
     // write the output to file
     ModulaiseUtils::writeFile($writeFile, $output);
     if ($debug) {
         // write an extra output file
         ModulaiseUtils::writeFile($writeFile . ".text", $output);
     }
 }
Пример #11
0
<?php

include '_head.php';
?>
<div class="bg">
<?php 
ModulaiseController::printPane("head");
ModulaiseController::printPane("main");
include '_foot.php';
 /**
  * Get's a directory as an array
  */
 public static function getDirectoryAsArray($directory, $return = ALL_FILES)
 {
     $debug = false;
     if (is_dir($directory)) {
         // Initialize array
         $dirArray = array();
         // open this directory
         $handle = opendir($directory) or die("\n\nERROR! Can't open directory " . $directory . "\n\n");
         // get each entry
         while ($resource = readdir($handle)) {
             // discard hidden files and files starting with DELIMITER
             if (substr($resource, 0, 1) != "." && substr($resource, 0, 1) != DELIMITER) {
                 // Decide what files to include
                 switch ($return) {
                     case ALL_FILES:
                         $dirArray[] = $resource;
                         break;
                     case ONLY_FILES:
                         if (is_file($directory . DIRECTORY_SEPARATOR . $resource)) {
                             $dirArray[] = $resource;
                             if ($debug) {
                                 ModulaiseController::printComment("\n\n" . get_class() . ": ONLY_FILES is_file(" . $directory . DIRECTORY_SEPARATOR . $resource . ") =  " . is_file($directory . DIRECTORY_SEPARATOR . $resource) . "\n\n");
                             }
                         }
                         break;
                     case ONLY_DIRECTORIES:
                         if (is_dir($directory . DIRECTORY_SEPARATOR . $resource)) {
                             $dirArray[] = $resource;
                             if ($debug) {
                                 ModulaiseController::printComment("\n\n" . get_class() . ": ONLY_DIRECTORIES is_dir(" . $directory . DIRECTORY_SEPARATOR . $resource . ") =  " . is_dir($directory . DIRECTORY_SEPARATOR . $resource) . "\n\n");
                             }
                         }
                         break;
                 }
             }
         }
         // close directory
         closedir($handle);
         // sort 'em
         sort($dirArray);
         return $dirArray;
     } else {
         return array();
     }
 }