@param      $name
@param      $script
@param bool $rewrite

@return $this
17700
protected function createClassFile($name, $script, $rewrite = true)
    {
        $name = str_replace('\\', DIRECTORY_SEPARATOR, $name);
        $classPath = "{$this->getBuildDirectory()}/$name.php";
        
        return $this->createFile($classPath, $script, $rewrite);
    }
801274
public function addScript($name, $src, array $depends = array(), $version = false, $footer = false) {
			wp_enqueue_script($name, $src, $depends, $version, $footer);

			return $name;
		}
796106
public function includeJs($script)
    {
        if ($script instanceof Url) {
            $this->includedJsScripts[] = $script;
        } else {
            $this->includedJsSnippets[] = $script;
        }

        return $this;
    }
854161
public static function addScript($script)
	{
		if (!$script)
		{
			return;
		}

		if (substr($script, -3) != '.js')
		{
			$script .= '.js';
		}

		$root = self::base();

		if ($document = self::app('document'))
		{
			$document->addScript(rtrim(Request::base(true), '/') . $script . '?v=' . filemtime($root . $script));
		}
	}
1217884
public function set($name, $url, $overwrite = false)
    {
        if (!$overwrite && array_key_exists($name, $this->aliases)) {
            return false;
        }
        $this->aliases[$name] = $url;
        return true;
    }
29866
private function addScriptBefore($script) {
        $script = trim($script);
        if ($script != '') {
            if (strpos($this->script, $script) === false) {
                $this->script = "
				 {$script} 
				 {$this->script}";
            }
        }
    }
927286
final protected String rewriteName(String name)
    {
        return URLRewriterService.getNamePrefix(pageContext.getServletContext(), pageContext.getRequest(), name) + name;
    }
723204
protected function addDoSave(&$script)
    {
        $table = $this->getTable();

        $reloadOnUpdate = $table->isReloadOnUpdate();
        $reloadOnInsert = $table->isReloadOnInsert();

        $script .= "
    /**
     * Performs the work of inserting or updating the row in the database.
     *
     * If the object is new, it inserts it; otherwise an update is performed.
     * All related objects are also updated in this method.
     *
     * @param      ConnectionInterface \$con";
        if ($reloadOnUpdate || $reloadOnInsert) {
            $script .= "
     * @param      boolean \$skipReload Whether to skip the reload for this object from database.";
        }
        $script .= "
     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
     * @throws PropelException
     * @see save()
     */
    protected function doSave(ConnectionInterface \$con".($reloadOnUpdate || $reloadOnInsert ? ", \$skipReload = false" : "").")
    {
        \$affectedRows = 0; // initialize var to track total num of affected rows
        if (!\$this->alreadyInSave) {
            \$this->alreadyInSave = true;
";
        if ($reloadOnInsert || $reloadOnUpdate) {
            $script .= "
            \$reloadObject = false;
";
        }

        if (count($table->getForeignKeys())) {

            $script .= "
            // We call the save method on the following object(s) if they
            // were passed to this object by their corresponding set
            // method.  This object relates to these object(s) by a
            // foreign key reference.
";

            foreach ($table->getForeignKeys() as $fk) {
                $aVarName = $this->getFKVarName($fk);
                $script .= "
            if (\$this->$aVarName !== null) {
                if (\$this->" . $aVarName . "->isModified() || \$this->" . $aVarName . "->isNew()) {
                    \$affectedRows += \$this->" . $aVarName . "->save(\$con);
                }
                \$this->set".$this->getFKPhpNameAffix($fk, false)."(\$this->$aVarName);
            }
";
            } // foreach foreign k
        } // if (count(foreign keys))

        $script .= "
            if (\$this->isNew() || \$this->isModified()) {
                // persist changes
                if (\$this->isNew()) {
                    \$this->doInsert(\$con);
                    \$affectedRows += 1;";
        if ($reloadOnInsert) {
            $script .= "
                    if (!\$skipReload) {
                        \$reloadObject = true;
                    }";
        }
        $script .= "
                } else {
                    \$affectedRows += \$this->doUpdate(\$con);";
        if ($reloadOnUpdate) {
            $script .= "
                    if (!\$skipReload) {
                        \$reloadObject = true;
                    }";
        }
        $script .= "
                }";

        // We need to rewind any LOB columns
        foreach ($table->getColumns() as $col) {
            $clo = $col->getLowercasedName();
            if ($col->isLobType()) {
                $script .= "
                // Rewind the $clo LOB column, since PDO does not rewind after inserting value.
                if (\$this->$clo !== null && is_resource(\$this->$clo)) {
                    rewind(\$this->$clo);
                }
";
            }
        }

        $script .= "
                \$this->resetModified();
            }
";

        if ($table->hasCrossForeignKeys()) {
            foreach ($table->getCrossFks() as $crossFKs) {
                $this->addCrossFkScheduledForDeletion($script, $crossFKs);
            }
        }

        foreach ($table->getReferrers() as $refFK) {
            if ($refFK->isLocalPrimaryKey()) {
                $varName = $this->getPKRefFKVarName($refFK);
                $script .= "
            if (\$this->$varName !== null) {
                if (!\$this->{$varName}->isDeleted() && (\$this->{$varName}->isNew() || \$this->{$varName}->isModified())) {
                    \$affectedRows += \$this->{$varName}->save(\$con);
                }
            }
";
            } else {
                $this->addRefFkScheduledForDeletion($script, $refFK);

                $collName = $this->getRefFKCollVarName($refFK);
                $script .= "
            if (\$this->$collName !== null) {
                foreach (\$this->$collName as \$referrerFK) {
                    if (!\$referrerFK->isDeleted() && (\$referrerFK->isNew() || \$referrerFK->isModified())) {
                        \$affectedRows += \$referrerFK->save(\$con);
                    }
                }
            }
";
            } // if refFK->isLocalPrimaryKey()
        } /* foreach getReferrers() */

        $script .= "
            \$this->alreadyInSave = false;
";
        if ($reloadOnInsert || $reloadOnUpdate) {
            $script .= "
            if (\$reloadObject) {
                \$this->reload(\$con);
            }
";
        }
        $script .= "
        }

        return \$affectedRows;
    } // doSave()
";

    }
1328465
public function script(
        $name,
        string $source,
        $dependencies = [],
        $attributes = [],
        $replaces = []
    ) {
        $this->register('script', $name, $source, $dependencies, $attributes, $replaces);

        return $this;
    }
127154
public function activate_script($name)
    {
        // Kolab's KEP:14
        if ($this->rc->config->get('managesieve_kolab_master')) {
            $extension   = $this->rc->config->get('managesieve_filename_extension', '.sieve');
            $user_script = $_SESSION['managesieve_user_script'];

            // if the script is not active...
            if ($user_script && array_search($name, $this->active) === false) {
                // ...rewrite USER file adding appropriate include command
                if ($this->sieve->load($user_script)) {
                    $script = $this->sieve->script->as_array();
                    $list   = array();
                    $regexp = '/' . preg_quote($extension, '/') . '$/';

                    // Create new include entry
                    $rule = array(
                        'actions' => array(
                            0 => array(
                                'target'   => $name.$extension,
                                'type'     => 'include',
                                'personal' => true,
                    )));

                    // get all active scripts for sorting
                    foreach ($script as $rid => $rules) {
                        foreach ($rules['actions'] as $action) {
                            if ($action['type'] == 'include' && empty($action['global'])) {
                                $target = $extension ? preg_replace($regexp, '', $action['target']) : $action['target'];
                                $list[] = $target;
                            }
                        }
                    }
                    $list[] = $name;

                    // Sort and find current script position
                    asort($list, SORT_LOCALE_STRING);
                    $list = array_values($list);
                    $index = array_search($name, $list);

                    // add rule at the end of the script
                    if ($index === false || $index == count($list)-1) {
                        $this->sieve->script->add_rule($rule);
                    }
                    // add rule at index position
                    else {
                        $script2 = array();
                        foreach ($script as $rid => $rules) {
                            if ($rid == $index) {
                                $script2[] = $rule;
                            }
                            $script2[] = $rules;
                        }
                        $this->sieve->script->content = $script2;
                    }

                    $result = $this->sieve->save();
                    if ($result) {
                        $this->active[] = $name;
                    }
                }
            }
        }
        else {
            $result = $this->sieve->activate($name);
            if ($result)
                $this->active = array($name);
        }

        return $result;
    }
117605
public function set_script($script) {
        if ($script == 1) {
            $this->format['font']['superScript'] = true;
        } else if ($script == 2) {
            $this->format['font']['subScript'] = true;
        } else {
            $this->format['font']['superScript'] = false;
            $this->format['font']['subScript'] = false;
        }
    }
642851
public function getEventScript($name)
    {
        $cacheKey = Cache::EVENT_SCRIPT_CACHE_PREFIX . $name;
        try {
            /** @var EventScript $model */
            $model = \Cache::rememberForever($cacheKey, function () use ($name) {
                if ($model = EventScript::whereName($name)->whereIsActive(true)->first()) {
                    if (!empty($model->storage_service_id) && !empty($model->storage_path)) {
                        try {
                            $serviceId = $model->storage_service_id;
                            $service = \ServiceManager::getServiceById($serviceId);
                            $storagePath = trim($model->storage_path, '/');
                            $scmRepo = $model->scm_repository;
                            $scmRef = $model->scm_reference;
                            if (empty($scmRef)) {
                                $scmRef = null;
                            }
                            $serviceName = $service->getName();
                            $typeGroup = $service->getServiceTypeInfo()->getGroup();

                            if ($typeGroup === ServiceTypeGroups::SCM) {
                                $result = \ServiceManager::handleRequest(
                                    $serviceName,
                                    Verbs::GET,
                                    '_repo/' . $scmRepo,
                                    ['path' => $storagePath, 'branch' => $scmRef, 'content' => 1]
                                );
                                $model->content = $result->getContent();
                            } else {
                                $result = \ServiceManager::handleRequest(
                                    $serviceName,
                                    Verbs::GET,
                                    $storagePath,
                                    ['include_properties' => 1, 'content' => 1]
                                );

                                $model->content = base64_decode(array_get($result->getContent(), 'content'));
                            }
                        } catch (\Exception $e) {
                            \Log::error('Failed to fetch remote script. ' . $e->getMessage());
                            throw $e;
                        }
                    }

                    return $model;
                }

                return ''; // so that we don't hit the database even after we know it isn't there
            });

            if (!empty($model)) { // see '' returned above
                return $model;
            }
        } catch (\Exception $ex) {
            \Log::error('Error occurred while loading event script. ' . $ex->getMessage());
        }

        return null;
    }
237329
public function prepare(Script $script)
    {
        $script->addScriptFunction("buttonscript", $this->getScriptFunction());
        $script->addCustomScriptLabel(ScriptLabel::MouseClick, $this->getScriptMouseClick());
        $script->addCustomScriptLabel(ScriptLabel::MouseOver, <<<EOL
               if (Event.Control.Parent.HasClass("uiButton")) {                 
                  (Event.Control.Parent as CMlFrame).RelativeScale=1.1;
               }
EOL
        );

        $script->addCustomScriptLabel(ScriptLabel::MouseOut, <<<EOL
               if (Event.Control.Parent.HasClass("uiButton")) {                  
                  (Event.Control.Parent as CMlFrame).RelativeScale= 1.; 
               }
EOL
        );
    }
623761
public function setPrettyName($name, $prefix = true)
    {
        if (empty($name)) {
            return $this;
        }

        $this->prettyName = $this->urlize($name);
        $this->prettyPrefix = $prefix;

        return $this;
    }
286344
public function addScriptField(string $name, AbstractScript $script): self
    {
        if (!isset($this->_params['script_fields'])) {
            $this->_params['script_fields'] = new ScriptFields();
        }

        $this->_params['script_fields']->addScript($name, $script);

        return $this;
    }
495910
public function set_header($name, $value, $replace = true)
	{
		if ($replace)
		{
			$this->headers[$name] = $value;
		}
		else
		{
			$this->headers[] = array($name, $value);
		}

		return $this;
	}
11982
public static function setScripts(array $scripts, bool $replace_existing=false) :void {
		// if we want to purge existing scripts
		!$replace_existing ?: self::$_scripts = [];
		// for each script we have to set
		foreach($scripts as $script) {
			// rewrite its path
			self::$_scripts[] = self::getPublicAssetPath($script, 'Js');
		}
	}