Example #1
0
 public function use($packages, bool $recursive = false, bool $getContents = false, string $dir = NULL)
 {
     if (!empty(Properties::$parameters['usable'])) {
         $getContents = Properties::$parameters['usable'];
     }
     if (!empty(Properties::$parameters['recursive'])) {
         $recursive = Properties::$parameters['recursive'];
     }
     Properties::$parameters = [];
     if (!is_array($packages)) {
         return $this->_package($dir . $packages, $recursive, $getContents);
     } else {
         $return = '';
         if (!empty($packages)) {
             foreach ($packages as $package) {
                 $return .= $this->_package($dir . $package, $recursive, true);
             }
         }
         if ($getContents === false) {
             echo $return;
         } else {
             return $return;
         }
     }
 }
Example #2
0
 public function use(string $page, array $data = NULL, bool $obGetContents = false, string $randomPageDir = VIEWS_DIR)
 {
     if (!empty(Properties::$parameters['usable'])) {
         $obGetContents = Properties::$parameters['usable'];
     }
     if (!empty(Properties::$parameters['data'])) {
         $data = Properties::$parameters['data'];
     }
     Properties::$parameters = [];
     if (stristr($page, $this->templateWizardExtension)) {
         return $this->_templateWizard($page, $data, $obGetContents, $randomPageDir);
     }
     return $this->_page($page, $data, $obGetContents, $randomPageDir);
 }
 protected function _parameters($arguments, $cdn)
 {
     if (!empty(Properties::$parameters['usable'])) {
         $lastParam = Properties::$parameters['usable'];
         Properties::$parameters = [];
     } else {
         $argumentCount = count($arguments) - 1;
         $lastParam = $arguments[$argumentCount] ?? false;
     }
     $arguments = array_unique($arguments);
     if ($lastParam === true) {
         $arguments = Arrays::removeLast($arguments);
     }
     return (object) ['arguments' => $arguments, 'lastParam' => $lastParam, 'cdnLinks' => array_change_key_case(Config::get('ViewObjects', 'cdn')[$cdn])];
 }
Example #4
0
 public function use(string $randomPageVariable, array $randomDataVariable = NULL, bool $randomObGetContentsVariable = false)
 {
     if (!empty(Properties::$parameters['usable'])) {
         $randomObGetContentsVariable = Properties::$parameters['usable'];
     }
     if (!empty(Properties::$parameters['data'])) {
         $randomDataVariable = Properties::$parameters['data'];
     }
     Properties::$parameters = [];
     $eol = EOL;
     $randomPageVariableExtension = extension($randomPageVariable);
     $randomPageVariableBaseUrl = baseUrl($randomPageVariable);
     $return = '';
     if (!is_file($randomPageVariable)) {
         throw new InvalidArgumentException('Error', 'fileParameter', '1.($randomPageVariable)');
     }
     if ($randomPageVariableExtension === 'js') {
         $return = '<script type="text/javascript" src="' . $randomPageVariableBaseUrl . '"></script>' . $eol;
     } elseif ($randomPageVariableExtension === 'css') {
         $return = '<link href="' . $randomPageVariableBaseUrl . '" rel="stylesheet" type="text/css" />' . $eol;
     } elseif (stristr('svg|woff|otf|ttf|' . implode('|', Config::get('ViewObjects', 'font')['differentFontExtensions']), $randomPageVariableExtension)) {
         $return = '<style type="text/css">@font-face{font-family:"' . divide(removeExtension($randomPageVariable), "/", -1) . '"; src:url("' . $randomPageVariableBaseUrl . '") format("truetype")}</style>' . $eol;
     } elseif ($randomPageVariableExtension === 'eot') {
         $return = '<style type="text/css"><!--[if IE]>@font-face{font-family:"' . divide(removeExtension($randomPageVariable), "/", -1) . '"; src:url("' . $randomPageVariableBaseUrl . '") format("truetype")}<![endif]--></style>' . $eol;
     } else {
         $randomPageVariable = suffix($randomPageVariable, '.php');
         if (is_file($randomPageVariable)) {
             if (is_array($randomDataVariable)) {
                 extract($randomDataVariable, EXTR_OVERWRITE, 'zn');
             }
             if ($randomObGetContentsVariable === false) {
                 require $randomPageVariable;
             } else {
                 ob_start();
                 require $randomPageVariable;
                 $randomSomethingFileContent = ob_get_contents();
                 ob_end_clean();
                 return $randomSomethingFileContent;
             }
         }
     }
     if ($randomObGetContentsVariable === false) {
         echo $return;
     } else {
         return $return;
     }
 }
Example #5
0
 public function use(array $randomDataVariable = NULL, array $head = NULL)
 {
     if (!empty(Properties::$parameters['headData'])) {
         $head = Properties::$parameters['headData'];
     }
     if (!empty(Properties::$parameters['data'])) {
         $randomDataVariable = Properties::$parameters['data'];
     }
     Properties::$parameters = [];
     $eol = EOL;
     $masterPageSet = Config::get('Masterpage');
     $randomPageVariable = $head['bodyPage'] ?? $masterPageSet['bodyPage'];
     $headPage = $head['headPage'] ?? $masterPageSet['headPage'];
     $docType = $head['docType'] ?? $masterPageSet["docType"];
     $header = Config::get('ViewObjects', 'doctype')[$docType] . $eol;
     $htmlAttributes = $head['attributes']['html'] ?? $masterPageSet['attributes']['html'];
     $header .= '<html xmlns="http://www.w3.org/1999/xhtml"' . Html::attributes($htmlAttributes) . '>' . $eol;
     $headAttributes = $head['attributes']['head'] ?? $masterPageSet['attributes']['head'];
     $header .= '<head' . Html::attributes($headAttributes) . '>' . $eol;
     $contentCharset = $head['content']['charset'] ?? $masterPageSet['content']['charset'];
     if (is_array($contentCharset)) {
         foreach ($contentCharset as $v) {
             $header .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$v}\">" . $eol;
         }
     } else {
         $header .= '<meta http-equiv="Content-Type" content="text/html; charset=' . $contentCharset . '">' . $eol;
     }
     $contentLanguage = $head['content']['language'] ?? $masterPageSet['content']['language'];
     $header .= '<meta http-equiv="Content-Language" content="' . $contentLanguage . '">' . $eol;
     $datas = $masterPageSet['data'];
     $metas = $masterPageSet['meta'];
     $title = $head['title'] ?? $masterPageSet["title"];
     if (!empty($title)) {
         $header .= '<title>' . $title . '</title>' . $eol;
     }
     if (isset($head['meta'])) {
         $metas = array_merge($metas, $head['meta']);
     }
     if (!empty($metas)) {
         foreach ($metas as $name => $content) {
             if (isset($head['meta'][$name])) {
                 $content = $head['meta'][$name];
             }
             if (!stristr($name, 'http:') && !stristr($name, 'name:')) {
                 $name = 'name:' . $name;
             }
             if (!empty($content)) {
                 $nameEx = explode(":", $name);
                 $httpOrName = $nameEx[0] === 'http' ? 'http-equiv' : 'name';
                 $name = isset($nameEx[1]) ? $nameEx[1] : $nameEx[0];
                 if (!is_array($content)) {
                     $header .= "<meta {$httpOrName}=\"{$name}\" content=\"{$content}\">" . $eol;
                 } else {
                     foreach ($content as $key => $val) {
                         $header .= "<meta {$httpOrName}=\"{$name}\" content=\"{$val}\">" . $eol;
                     }
                 }
             }
         }
     }
     $header .= $this->_links($masterPageSet, $head, 'font');
     $header .= $this->_links($masterPageSet, $head, 'script');
     $header .= $this->_links($masterPageSet, $head, 'style');
     $browserIcon = $head['browserIcon'] ?? $masterPageSet["browserIcon"];
     if (!empty($browserIcon) && is_file($browserIcon)) {
         $header .= '<link rel="shortcut icon" href="' . baseUrl($browserIcon) . '" />' . $eol;
     }
     $theme = $head['theme']['name'] ?? $masterPageSet['theme']['name'];
     $themeRecursive = $head['theme']['recursive'] ?? $masterPageSet['theme']['recursive'];
     if (!empty($theme)) {
         $header .= Import::theme($theme, $themeRecursive, true);
     }
     $plugin = $head['plugin']['name'] ?? $masterPageSet['plugin']['name'];
     $pluginRecursive = $head['plugin']['recursive'] ?? $masterPageSet['plugin']['recursive'];
     if (!empty($plugin)) {
         $header .= Import::plugin($plugin, $pluginRecursive, true);
     }
     if (isset($head['data'])) {
         $datas = array_merge($datas, $head['data']);
     }
     if (!empty($datas)) {
         if (!is_array($datas)) {
             $header .= $datas . $eol;
         } else {
             foreach ($datas as $v) {
                 $header .= $v . $eol;
             }
         }
     }
     $header .= $this->_setpage($headPage);
     $header .= '</head>' . $eol;
     $backgroundImage = $head['backgroundImage'] ?? $masterPageSet["backgroundImage"];
     $bgImage = !empty($backgroundImage) && is_file($backgroundImage) ? ' background="' . baseUrl($backgroundImage) . '" bgproperties="fixed"' : '';
     $bodyAttributes = $head['attributes']['body'] ?? $masterPageSet['attributes']['body'];
     $header .= '<body' . Html::attributes($bodyAttributes) . $bgImage . '>' . $eol;
     echo $header;
     if (!empty($randomPageVariable)) {
         Import::page($randomPageVariable, $randomDataVariable);
     }
     $randomFooterVariable = $eol . '</body>' . $eol;
     $randomFooterVariable .= '</html>';
     echo $randomFooterVariable;
 }