Paperyard
BasicController.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Paperyard\Controllers;
4 
6 
8 {
10  protected $view;
11 
13  protected $logger;
14 
16  protected $flash;
17 
19  private $plugins_js;
20 
22  private $plugins_css;
23 
29  public function getPlugins()
30  {
31  return array(
32  'css' => $this->plugins_css,
33  'js' => $this->plugins_js
34  );
35  }
36 
43  public function registerPlugin($name, $type = PluginType::NORMAL)
44  {
45  $js_path = $_SERVER["DOCUMENT_ROOT"] . '/frontend/public/static/js/plugins/' . $name . '.js';
46  $css_path = $_SERVER["DOCUMENT_ROOT"] . '/frontend/public/static/js/plugins/' . $name . '.js';
47 
48  switch ($type) {
49  case PluginType::NORMAL:
50  if (file_exists($js_path) &&
51  file_exists($css_path)) {
52  $this->plugins_js[] = $name;
53  $this->plugins_css[] = $name;
54  }
55  break;
57  if (file_exists($css_path)) {
58  $this->plugins_css[] = $name;
59  }
60  break;
62  if (file_exists($js_path)) {
63  $this->plugins_js[] = $name;
64  }
65  break;
66  }
67  }
68 
74  public function getLanguageFlag() {
75  $codes = array(
76  "de_DE" => "flag-icon-de",
77  "en_US" => "flag-icon-gb");
78  return $codes[$_SESSION['lang-code']];
79  }
80 }
registerPlugin($name, $type=PluginType::NORMAL)