Completed
Push — master ( 08e0cd...7a5dd8 )
by
unknown
02:07
created
assets/lib/Helpers/Assets.php 1 patch
Braces   +27 added lines, -25 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 /**
6 6
  * Class AssetsHelper
7 7
  */
8
-class AssetsHelper
9
-{
8
+class AssetsHelper
9
+{
10 10
     /**
11 11
      * Объект DocumentParser - основной класс MODX
12 12
      * @var \DocumentParser
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @return self
27 27
      */
28
-    public static function getInstance(DocumentParser $modx)
29
-    {
28
+    public static function getInstance(DocumentParser $modx)
29
+    {
30 30
 
31
-        if (null === self::$instance) {
31
+        if (null === self::$instance) {
32 32
             self::$instance = new self($modx);
33 33
         }
34 34
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
      * is not allowed to call from outside: private!
40 40
      *
41 41
      */
42
-    private function __construct(DocumentParser $modx)
43
-    {
42
+    private function __construct(DocumentParser $modx)
43
+    {
44 44
         $this->modx = $modx;
45 45
         $this->fs = \Helpers\FS::getInstance();
46 46
     }
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
      *
51 51
      * @return void
52 52
      */
53
-    private function __clone()
54
-    {
53
+    private function __clone()
54
+    {
55 55
 
56 56
     }
57 57
 
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @return void
62 62
      */
63
-    private function __wakeup()
64
-    {
63
+    private function __wakeup()
64
+    {
65 65
 
66 66
     }
67 67
 
68 68
     /**
69 69
      * @return string
70 70
      */
71
-    public function registerJQuery()
72
-    {
71
+    public function registerJQuery()
72
+    {
73 73
         $output = '';
74 74
         $plugins = $this->modx->pluginEvent;
75 75
         //файл проверяется чтобы определить новую админку
76
-        if (file_exists(MODX_MANAGER_PATH . 'media/script/jquery/jquery.min.js') || array_search('ManagerManager', $plugins['OnDocFormRender']) !== false) {
76
+        if (file_exists(MODX_MANAGER_PATH . 'media/script/jquery/jquery.min.js') || array_search('ManagerManager', $plugins['OnDocFormRender']) !== false) {
77 77
             return $output;
78 78
         }
79 79
 
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
      * @param $params
92 92
      * @return string
93 93
      */
94
-    public function registerScript($name, $params)
95
-    {
94
+    public function registerScript($name, $params)
95
+    {
96 96
         $out = '';
97
-        if (!isset($this->modx->loadedjscripts[$name])) {
97
+        if (!isset($this->modx->loadedjscripts[$name])) {
98 98
             $src = $params['src'];
99 99
             $remote = strpos($src, "http") !== false;
100
-            if (!$remote) {
100
+            if (!$remote) {
101 101
                 $src = $this->modx->config['site_url'] . $src;
102
-                if (!$this->fs->checkFile($params['src'])) {
102
+                if (!$this->fs->checkFile($params['src'])) {
103 103
                     $this->modx->logEvent(0, 3, 'Cannot load ' . $src, 'Assets helper');
104 104
 
105 105
                     return $out;
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 
109 109
             $tmp = explode('.', $src);
110 110
             $type = isset($params['type']) ? $params['type'] : end($tmp);
111
-            if ($type == 'js') {
111
+            if ($type == 'js') {
112 112
                 $out = '<script type="text/javascript" src="' . $src . '"></script>';
113
-            } else {
113
+            } else {
114 114
                 $media = isset($params['media']) ? " media=\"{$params['media']}\"" : '';
115 115
                 $out = "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$src}\"{$media}>";
116 116
             }
@@ -126,12 +126,14 @@  discard block
 block discarded – undo
126 126
      * @param array $list
127 127
      * @return string
128 128
      */
129
-    public function registerScriptsList($list = array())
130
-    {
129
+    public function registerScriptsList($list = array())
130
+    {
131 131
         $out = '';
132
-        if (!is_array($list)) return $out;
132
+        if (!is_array($list)) {
133
+            return $out;
134
+        }
133 135
 
134
-        foreach ($list as $script => $params) {
136
+        foreach ($list as $script => $params) {
135 137
             $out .= $this->registerScript($script, $params);
136 138
         }
137 139
 
Please login to merge, or discard this patch.