Exemple #1
0
 /**
  * @param string|string[]	$add
  * @param string			$mode
  * @param bool				$core
  *
  * @return Page
  */
 protected function js_internal($add, $mode = 'file', $core = false)
 {
     if (is_array($add)) {
         foreach ($add as $script) {
             if ($script) {
                 $this->js_internal($script, $mode, $core);
             }
         }
     } elseif ($add) {
         if ($core) {
             if ($mode == 'file') {
                 $this->core_js[0][] = h::script(['src' => $add, 'level' => false]) . "\n";
             } elseif ($mode == 'code') {
                 $this->core_js[1][] = $add . "\n";
             }
         } else {
             if ($mode == 'file') {
                 $this->js[0][] = h::script(['src' => $add, 'level' => false]) . "\n";
             } elseif ($mode == 'code') {
                 $this->js[1][] = $add . "\n";
             }
         }
     }
     return $this;
 }