@param string $code
@param bool $defer
@param boolean $prepend
@param array $attrs
@param string $target Any of {self::getTargets()}

@return HtmlBuilderMeta
181151
public function addJsCode(string $code, bool $defer = false, $prepend = false, array $attrs = null, $target = self::TARGET_HEAD) {
		ArgUtils::valEnum($target, array(self::TARGET_HEAD, self::TARGET_BODY_START, self::TARGET_BODY_END));
		
		if ($target == self::TARGET_HEAD) {
			$target = self::HEAD_SCRIPT_KEY;
		}
		
		$attrs = array(/*'type' => 'text/javascript'*/);
		if ($defer) {
			$attrs['defer'] = 'defer';
		}
		
		$this->htmlProperties->push($target,
				new HtmlElement('script', $attrs, new Raw("\r\n" . $code . "\r\n" . "\r\n")),
				$prepend);
		
		return $this;
	}
1179160
function setCode( $code ) {
        $this->code = $code;
        $this->addHeader($this->getDefaultHeaderFromCode( $code ));
        return $this;
    }
899006
function( HTMLCode ){

        var deferred = Q.defer();

        if( HTMLCode === this.srcHTMLCode ){
            deferred.resolve();
            return deferred.promise;
        }

        fs.writeFile( this.path, HTMLCode, function( err ){
            if( err ){
                deferred.reject( err );
                return;
            }
            deferred.resolve();
        } );

        return deferred.promise;
    }
1025062
public function PrependExternal ($path = '', $async = FALSE, $defer = FALSE, $doNotMinify = FALSE) {
		return $this->Prepend($path, $async, $defer, $doNotMinify, TRUE);
	}
17229
static public function build(array $attr, callable $callback = null): string
    {
        if (!count($attr)) {
            return '';
        }

        $html = array_map(function ($val, $key) use ($callback) {
            if (is_bool($val)) {
                return $val ? self::getKey($key) : '';
            }

            if (isset($val)) {
                if ($val instanceof \Closure) {
                    $val = $val();
                } elseif ($val instanceof \JsonSerializable) {
                    $val = \json_encode($val->jsonSerialize(), (JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
                } elseif (is_callable([$val, 'toArray'])) {
                    $val = $val->toArray();
                } elseif (is_callable([$val, '__toString'])) {
                    $val = strval($val);
                }

                if (is_array($val)) {
                    $val = \json_encode($val);
                }

                if (is_callable($callback)) {
                    $val = call_user_func($callback, $val);
                } else {
                    $val = htmlspecialchars($val, ENT_QUOTES);
                }

                if (is_string($val)) {
                    return sprintf('%1$s="%2$s"', self::getKey($key), $val);
                }
            }

            return self::getKey($key);
        }, $attr, array_keys($attr));

        return implode(' ', $html);
    }
105109
public static function generateBooster($code)
    {
        $url = sprintf("%s/%s/%s/booster", QueryBuilder::ENDPOINT, self::RESOURCE, $code);

        return (new QueryBuilder(self::class))->findMany($url, Card::class, Card::RESOURCE);
    }
1190338
public function addAsyncJsUrl(string $src, bool $prepend = false) {
		$this->htmlProperties->add(self::HEAD_SCRIPT_KEY, 'type:javascript:src:' . $src,
				new HtmlElement('script', array(/*'type' => 'text/javascript'*/),
						"\r\n" . '//<![CDATA[' . "\r\n" . '(function() {var b=document.createElement("script");b.type="text/javascript";b.async=true;b.src="' .
						addslashes($src) . '";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(b,a)})();' . "\r\n" . '//]]>' . "\r\n"),
				$prepend);
		
		return $this;
	}
501335
public function prepare(&$attrs)
    {
        $attrs['type'] = $this->type ?: 'text';
        $attrs['name'] = $this->getFieldName();
        $attrs['id'] = $this->getAttribute('id', $this->getId());
        $attrs['class'] = $this->getAttribute('class');
        $attrs['placeholder'] = $this->getAttribute('placeholder');
        $attrs['size'] = $this->getAttribute('size');
        $attrs['maxlength'] = $this->getAttribute('maxlength');
        $attrs['readonly'] = $this->getAttribute('readonly');
        $attrs['disabled'] = $this->getAttribute('disabled');
        $attrs['autofocus'] = $this->getAttribute('autofocus');
        $attrs['autocomplete'] = $this->getAttribute('autocomplete');
        $attrs['form'] = $this->getAttribute('form');
        $attrs['formenctype'] = $this->getAttribute('formenctype');
        $attrs['formmethod'] = $this->getAttribute('formmethod');
        $attrs['formnovalidate'] = $this->getAttribute('formnovalidate');
        $attrs['formtarget'] = $this->getAttribute('formtarget');
        $attrs['onchange'] = $this->getAttribute('onchange');
        $attrs['onfocus'] = $this->getAttribute('onfocus');
        $attrs['onblur'] = $this->getAttribute('onblur');
        $attrs['value'] = $this->escape($this->getValue());
        $attrs['list'] = $this->getAttribute('list', count($this->options) ? $this->getId() . '-list' : null);

        $attrs['required'] = $this->required;
    }
1351412
public function build(HtmlView $view, array $attrs = null, array $ulAttrs = null, array $liAttrs = null, array $aAttrs = null) {
		$pageState = $view->lookup(PageState::class);
		CastUtils::assertTrue($pageState instanceof PageState);
		
		$navItemBuilder = null;
		if ($this->navItemBuilder === null) {
			$navItemBuilder = new CommonNavItemBuilder();
		} else if ($this->navItemBuilder instanceof NavItemBuilder) {
			$navItemBuilder = $this->navItemBuilder;
		} else {
			$navItemBuilder = $view->lookup($this->navItemBuilder);
			if (!($navItemBuilder instanceof NavItemBuilder)) {
				throw new UiException('Invalid NavItemBuilder: ' . $navItemBuilder);
			}
		}
		
		$navFactory = new NavFactory($navItemBuilder, $view->getN2nLocale(), $this->numLevels, $this->numOpenLevels);
		if ($pageState->hasCurrent()) {
			$navFactory->setCurrentNavBranch($pageState->getCurrentNavBranch());
		}
		$navFactory->setNumLevels($this->numLevels);
		$navFactory->setNumOpenLevels($this->numOpenLevels);
		$navFactory->setRootUlAttrs((array) $attrs);
		$navFactory->setUlAttrs((array) $ulAttrs);
		$navFactory->setLiAttrs((array) $liAttrs);
		$navFactory->setAAttrs((array) $aAttrs);
		
		$n2nLocale = $view->getN2nLocale();
		$navBranch = $this->navBranchCriteria->determine($pageState, $n2nLocale, $view->getN2nContext());
		$startLevel = 1;
		if ($this->absStartlevelNo !== null) {
			$startLevel = $this->absStartlevelNo - $navBranch->getLevel();
		} else if ($this->relStartLevelNo !== null) {
			$startLevel = $this->relStartLevelNo;
		}
		
		return $navFactory->create($view, $this->dertermineBases($navBranch, $startLevel));
	}
690052
public function _set_defer( $tag, $handle, $src ) {
		$handles = apply_filters( 'inc2734_wp_page_speed_optimization_defer_scripts', [] );

		if ( ! in_array( $handle, $handles ) ) {
			return $tag;
		}

		return str_replace( ' src', ' defer src', $tag );
	}
367442
public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content)
    {
        try {
            $compiler->findBlock('dynamic');

            return $content;
        }
        catch (CompilationException $e) {
        }
        $output = Compiler::PHP_OPEN . 'if($doCache) {' . "\n\t" . 'echo \'<dwoo:dynamic_\'.$dynamicId.\'>' . str_replace('\'', '\\\'', $content) . '</dwoo:dynamic_\'.$dynamicId.\'>\';' . "\n} else {\n\t";
        if (substr($content, 0, strlen(Compiler::PHP_OPEN)) == Compiler::PHP_OPEN) {
            $output .= substr($content, strlen(Compiler::PHP_OPEN));
        } else {
            $output .= Compiler::PHP_CLOSE . $content;
        }
        if (substr($output, - strlen(Compiler::PHP_CLOSE)) == Compiler::PHP_CLOSE) {
            $output = substr($output, 0, - strlen(Compiler::PHP_CLOSE));
        } else {
            $output .= Compiler::PHP_OPEN;
        }
        $output .= "\n}" . Compiler::PHP_CLOSE;

        return $output;
    }
277654
public function transpile($code)
    {
        try {
            return AfxService::convertAfxToFusion($code);
        } catch (AfxException $afxException) {
            throw new Fusion\Exception(sprintf('Error during AFX-parsing: %s', $afxException->getMessage()));
        }
    }
285301
public function block($code, $render = false, array $attrs = array()) {
        return $this->_storeOrRender(
            'block',
            array(
                'value' => $code,
                'render' => $render,
                'attrs' => $attrs
            )
        );
    }
1155653
function compile($indent) {
		$function_name = $this->function_name( $this->name ) ;
		
		// Build the typestack
		$typestack = array(); $class=$this;
		do {
			$typestack[] = $this->function_name($class->name);
		}
		while($class = $class->extends);

		$typestack = "array('" . implode("','", $typestack) . "')";
		
		// Build an array of additional arguments to add to result node (if any)
		if (empty($this->arguments)) {
			$arguments = 'null';
		}
		else {
			$arguments = "array(";
			foreach ($this->arguments as $k=>$v) { $arguments .= "'$k' => '$v'"; }
			$arguments .= ")";
		}
		
		$match = PHPBuilder::build() ;
		
		$match->l("protected \$match_{$function_name}_typestack = $typestack;");

		$match->b( "function match_{$function_name} (\$stack = array())",
			'$matchrule = "'.$function_name.'"; $result = $this->construct($matchrule, $matchrule, '.$arguments.');',
			$this->parsed->compile()->replace(array(
				'MATCH' => 'return $this->finalise($result);',
				'FAIL' => 'return FALSE;'
			))
		);

		$functions = array() ;
		foreach( $this->functions as $name => $function ) {
			$function_name = $this->function_name( preg_match( '/^_/', $name ) ? $this->name.$name : $this->name.'_'.$name ) ;
			$functions[] = implode( PHP_EOL, array(
				'function ' . $function_name . ' ' . $function
			));
		}

		// print_r( $match ) ; return '' ;
		return $match->render(NULL, $indent) . PHP_EOL . PHP_EOL . implode( PHP_EOL, $functions ) ;
	}
1056239
public static function Create($code, $args = null, $_ = null)
  {
    if (!is_null($args)) {
      if (!is_array($args)) {
        $args = array_slice(func_get_args(), 1);
      }
    }

    $str = static::GetNameForCode($code, $args);

    return new static($str, $code);
  }
1355862
public static function forCompileError(array $error, $code, $limit = 25)
    {
        $code = explode("\n", $code);
        $start = $error['line'] - $limit;
        if ($start < 0) {
            $start = 0;
        }

        $code = array_splice($code, $start, $limit * 2);

        foreach ($code as $i => $line) {
            $code[$i] = (++$start) . ': ' . $line;
        }

        $message = sprintf(
            self::COMPILE_ERROR,
            $error['message'],
            $error['line'],
            implode("\n", $code)
        );

        return new static($message);
    }
519232
public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content)
    {
        $params = $compiler->getCompiledParams($params);

        $mode = trim($params['mode'], '"\'');
        switch ($mode) {
            case 'js':
            case 'javascript':
                $content = preg_replace('#(?<!:)//\s[^\r\n]*|/\*.*?\*/#s', '', $content);

            case 'default':
            default:
        }
        $content = preg_replace(array(
            "/\n/",
            "/\r/",
            '/(<\?(?:php)?|<%)\s*/'
        ), array(
            '',
            '',
            '$1 '
        ), preg_replace('#^\s*(.+?)\s*$#m', '$1', $content));

        return $content;
    }