Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
core_css.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * send css file
8  *
9  * @author Anakeen
10  * @package FDL
11  * @subpackage CORE
12  */
13 /**
14  */
15 function core_css(Action & $action)
16 {
17 
18  $layout = $action->getArgument("layout");
19  $type = $action->getArgument("type");
20  $packName = $action->getArgument("pack");
21  $nfFile = array();
22 
23  if ($layout != '') {
24  $action->lay->template = '';
25  }
26  if ($packName) {
27  $packSession = $action->read("RSPACK_" . $packName);
28  $action->lay->template = '';
29  $action->lay->noparse = true;
30  /*
31  * @var array $packSession
32  */
33  foreach ($packSession as $resource) {
34  if ($resource["needparse"]) {
35  $action->lay->noparse = false;
36  if (preg_match("/([A-Z_-]+):([^:]+):{0,1}[A-Z]{0,1}/", $resource["ref"], $reg)) {
37  $lfile = getLayoutFile($reg[1], strtolower($reg[2]));
38  if ($lfile) $action->lay->template.= file_get_contents($lfile);
39  else $nfFile[] = $resource["ref"];
40  }
41  } else {
42  $action->lay->template.= file_get_contents($resource["ref"]);
43  }
44  }
45  } else {
46 
47  if (preg_match("/([A-Z_0-9-]+):([^:]+):{0,1}[A-Z]{0,1}/", $layout, $reg)) {
48  $action->lay->template = '';
49  $lfile = getLayoutFile($reg[1], strtolower($reg[2]));
50  if ($lfile) $action->lay = new Layout($lfile, $action);
51  } else {
52  if (preg_match("/^css/", $layout, $reg) && strpos($layout, '..') === false) {
53 
54  if (is_file($layout)) $action->lay = new Layout($layout, $action);
55  }
56  }
57  }
58 
59  if ($action->lay->template == '') {
60  $nfFile[] = $layout;
61  }
62 
63  $mimetype = '';
64  if ($type == '' || $type == 'css') {
65 
66  $mimetype = 'text/css';
67  } elseif ($type == 'js') {
68  $mimetype = 'text/javascript';
69  }
70  if (count($nfFile) > 0) {
71  header(sprintf("HTTP/1.0 404 %s layout [%s] not found", $type, implode(" ,", $nfFile)));
72  } else {
74  }
75 }
76 ?>
Layout is a template generator.
global $action
$mimetype
Definition: geticon.php:24
getLayoutFile($app, $layfile)
Definition: Lib.Common.php:258
core_css(Action &$action)
Definition: core_css.php:15
static getArgument($k, $def= '')
$packName
Definition: pack.php:56
setHeaderCache($type)
Definition: pack.php:11
← centre documentaire © anakeen