本文整理汇总了PHP中self::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP self::execute方法的具体用法?PHP self::execute怎么用?PHP self::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replaceLinks
/**
* replaceLinks
* EditPage::attemptSave hook function
* replaces links to Census pages with template
*/
public static function replaceLinks($editpage)
{
wfProfileIn(__METHOD__);
$cas = new self();
$cas->execute($editpage->textbox1);
wfProfileOut(__METHOD__);
return true;
}
示例2: validate
/**
* @param string $schema A schema file to load from the configured schema path
* @param array $input
*
* @return array|bool|Result
* @throws InvalidConstraintException
* @throws InvalidInputException
* @throws ValidationException
*
*/
public static function validate($schema, array $input)
{
$instance = new self($input, self::getSchema($schema));
if ($instance->execute()) {
return new Result($instance->getCleanedData(), $instance->getViolations());
} else {
throw new InvalidInputException($instance->getViolations());
}
}
示例3: create
/**
* Creates a transaction and optionally execute a transaction
* @return Transaction
*/
public static function create($closure, $execute = true)
{
$transaction = new self();
$transaction->callback($closure);
if ($execute) {
$transaction->execute();
}
return $transaction;
}
示例4: do_get
public static function do_get($url, $parameters = null, $headers = null)
{
$client = new self($url);
$client->parameters = $parameters ? $parameters : array();
$client->headers = $headers ? $headers : array();
try {
$response = $client->execute();
} catch (Exception $e) {
throw new Exception('Could not fetch: ' . $url . ':' . $e);
}
return $response;
}
示例5: read
public static function read($file, array $options = [])
{
$reader = new self($file, $options);
$reader->execute();
$requirements = [];
foreach ($reader->requirements as $type => $reqsOfType) {
foreach ($reqsOfType as $name => $unused) {
$requirements[] = ['type' => $type, 'name' => $name];
}
}
return ['requirements' => $requirements, 'tests' => $reader->tests, 'articles' => $reader->articles];
}
示例6: createAndExec
public static function createAndExec($_type, $_cmd, $_options)
{
$scenarioExpression = new self();
$scenarioExpression->setType($_type);
$scenarioExpression->setExpression($_cmd);
if (is_array($_options)) {
foreach ($_options as $key => $value) {
$scenarioExpression->setOptions($key, $value);
}
}
return $scenarioExpression->execute();
}
示例7: exec
public static function exec($table, $where = '', $conn = null)
{
$db = new self($conn);
$db->table = $table;
$db->where = $where;
$db->execute();
}
示例8: render
/**
* [render description]
* @param [type] $__content [description]
* @param array $__params [description]
* @param boolean $__sandbox [description]
* @return [type] [description]
*/
public static function render($content, $params = array(), $sandbox = false, $srcinfo = null)
{
$obj = new self();
return $obj->execute($content, $params, $sandbox, $srcinfo);
}
示例9: read
/**
* Read a ZIP file and call a function for each file discovered in it.
*
* Because this class is aimed at verification, an error is raised on
* suspicious or ambiguous input, instead of emulating some standard
* behaviour.
*
* @param $fileName string The archive file name
* @param $callback Array The callback function. It will be called for each file
* with a single associative array each time, with members:
*
* - name: The file name. Directories conventionally have a trailing
* slash.
*
* - mtime: The file modification time, in MediaWiki 14-char format
*
* - size: The uncompressed file size
*
* @param $options Array An associative array of read options, with the option
* name in the key. This may currently contain:
*
* - zip64: If this is set to true, then we will emulate a
* library with ZIP64 support, like OpenJDK 7. If it is set to
* false, then we will emulate a library with no knowledge of
* ZIP64.
*
* NOTE: The ZIP64 code is untested and probably doesn't work. It
* turned out to be easier to just reject ZIP64 archive uploads,
* since they are likely to be very rare. Confirming safety of a
* ZIP64 file is fairly complex. What do you do with a file that is
* ambiguous and broken when read with a non-ZIP64 reader, but valid
* when read with a ZIP64 reader? This situation is normal for a
* valid ZIP64 file, and working out what non-ZIP64 readers will make
* of such a file is not trivial.
*
* @return Status object. The following fatal errors are defined:
*
* - zip-file-open-error: The file could not be opened.
*
* - zip-wrong-format: The file does not appear to be a ZIP file.
*
* - zip-bad: There was something wrong or ambiguous about the file
* data.
*
* - zip-unsupported: The ZIP file uses features which
* ZipDirectoryReader does not support.
*
* The default messages for those fatal errors are written in a way that
* makes sense for upload verification.
*
* If a fatal error is returned, more information about the error will be
* available in the debug log.
*
* Note that the callback function may be called any number of times before
* a fatal error is returned. If this occurs, the data sent to the callback
* function should be discarded.
*/
public static function read($fileName, $callback, $options = array())
{
$zdr = new self($fileName, $callback, $options);
return $zdr->execute();
}
示例10: execute
/**
* Execute the chain
*/
public function execute()
{
for ($i = 0; $i < count($this->rules); $i++) {
$this->rules[$i]->execute();
echo "LinkType: " . $this->rules[$i]->linkType . "\n";
switch ($this->rules[$i]->linkType) {
case "NONE":
break;
case "LOOP":
// Find the matching endloop, extract the subarray as a new chain and loop
// execution for each row
echo "DETECTED LOOP\n";
if (count($this->rules) - ($i + 1) > 0) {
// if(((count($this->rules)-1)-$i) > 0) {
$endindex = $this->getEndLoopIndex($i + 1);
echo "LOOP START\n";
echo $i . ": LOOP RULE Index\n";
$loopcount = 0;
$loopchain = NULL;
while ($row = $this->rules[$i]->getNextResultRow()) {
echo $i + 1 . ": INNER RULE Index\n";
echo $endindex . ": Endindex\n";
$loopcount++;
echo "INNER RULE ITERATION COUNTER: " . $loopcount . "\n";
echo "Offset: " . ($i + 1) . "\n";
echo "Length: " . ($endindex - $i) . "\n";
$loopchain = new self(null, \array_slice($this->rules, $i + 1, $endindex - $i), $row, FALSE);
$loopchain->execute();
echo "CURRENT LOOP RULE\n";
if (in_array($this->rules[$endindex]->resultType, ['ROW', 'RECORDSET'])) {
$this->rules[$endindex]->setOutput($loopchain->getChainResult());
}
}
echo "LOOP END\n";
$i = $endindex + 1;
echo $i . ": Current Index\n";
}
break;
case "ENDLOOP":
break;
case "NEXT":
if (count($this->rules) - $i > 1) {
$this->rules[$i + 1]->input = clone $this->rules[$i]->input;
}
break;
default:
// do nothing
break;
}
}
}
示例11: minify
/**
* @see sfCombineMinifierInterface::minify
* @param string $content
* @param array $options
* @return string
*/
public static function minify($content, array $options = array())
{
$obj = new self($content, $options);
return $obj->execute();
}
示例12: run
/**
* 启动控制器
*
* @param string $uri 路径
*
* @return Controller
*/
public static function run($uri)
{
$c = new self($uri);
$c->cutURI();
$c->dispatch();
try {
$c->execute();
} catch (\Exception $e) {
Error::exceptionHandler($e);
} finally {
if ($c->outputAllow) {
Responder::write();
}
}
return $c;
}
示例13: hook
/**
* Hook account creation
*
* @param User $user User that was created
* @return bool
*/
public static function hook($user)
{
$notifier = new self();
$notifier->execute($user);
return true;
}
示例14: execute
function execute()
{
global $osC_Cache;
if (isset($this->cache_key)) {
if ($osC_Cache->read($this->cache_key, $this->cache_expire)) {
$this->cache_data = $osC_Cache->getCache();
$this->cache_read = true;
}
}
if ($this->cache_read === false) {
if ($this->db_class->use_foreign_keys == false) {
$query_action = substr($this->sql_query, 0, strpos($this->sql_query, ' '));
if ($query_action == 'delete' || $query_action == 'update') {
if (empty($this->db_class->fkeys)) {
$Qfk = new self($this->db_class);
$Qfk->setQuery('select * from :table_fk_relationships');
$Qfk->bindTable(':table_fk_relationships', TABLE_FK_RELATIONSHIPS);
// $Qfk->setCache('fk_relationships');
$Qfk->execute();
while ($Qfk->next()) {
$this->db_class->fkeys[$Qfk->value('to_table')][] = array('from_table' => $Qfk->value('from_table'), 'from_field' => $Qfk->value('from_field'), 'to_field' => $Qfk->value('to_field'), 'on_update' => $Qfk->value('on_update'), 'on_delete' => $Qfk->value('on_delete'));
}
$Qfk->freeResult();
}
}
if ($query_action == 'delete') {
$query_data = split(' ', $this->sql_query, 4);
$query_table = substr($query_data[2], strlen(DB_TABLE_PREFIX));
if (isset($this->db_class->fkeys[$query_table])) {
// check for RESTRICT constraints first
foreach ($this->db_class->fkeys[$query_table] as $fk) {
if ($fk['on_delete'] == 'restrict') {
$child_query = $this->db_class->simpleQuery('select ' . $fk['to_field'] . ' from ' . $query_data[2] . ' ' . $query_data[3]);
while ($child_result = $this->db_class->next($child_query)) {
$Qcheck = new self($this->db_class);
$Qcheck->setQuery('select ' . $fk['from_field'] . ' from ' . DB_TABLE_PREFIX . $fk['from_table'] . ' where ' . $fk['from_field'] . ' = "' . $child_result[$fk['to_field']] . '" limit 1');
$Qcheck->execute();
if ($Qcheck->numberOfRows() === 1) {
$this->db_class->setError('RESTRICT constraint condition from table ' . DB_TABLE_PREFIX . $fk['from_table'], null, $this->sql_query);
return false;
}
}
}
}
foreach ($this->db_class->fkeys[$query_table] as $fk) {
$parent_query = $this->db_class->simpleQuery('select * from ' . $query_data[2] . ' ' . $query_data[3]);
while ($parent_result = $this->db_class->next($parent_query)) {
if ($fk['on_delete'] == 'cascade') {
$Qdel = new self($this->db_class);
$Qdel->setQuery('delete from :from_table where :from_field = :' . $fk['from_field']);
$Qdel->bindTable(':from_table', DB_TABLE_PREFIX . $fk['from_table']);
$Qdel->bindRaw(':from_field', $fk['from_field'], false);
$Qdel->bindValue(':' . $fk['from_field'], $parent_result[$fk['to_field']]);
if ($this->logging === true) {
if ($this->db_class->logging_transaction === false) {
$this->db_class->logging_transaction = true;
}
$Qdel->setLogging($this->logging_module, $this->logging_module_id);
}
$Qdel->execute();
} elseif ($fk['on_delete'] == 'set_null') {
$Qupdate = new self($this->db_class);
$Qupdate->setQuery('update :from_table set :from_field = :' . $fk['from_field'] . ' where :from_field = :' . $fk['from_field']);
$Qupdate->bindTable(':from_table', DB_TABLE_PREFIX . $fk['from_table']);
$Qupdate->bindRaw(':from_field', $fk['from_field'], false);
$Qupdate->bindRaw(':' . $fk['from_field'], 'null');
$Qupdate->bindRaw(':from_field', $fk['from_field'], false);
$Qupdate->bindValue(':' . $fk['from_field'], $parent_result[$fk['to_field']], false);
if ($this->logging === true) {
if ($this->db_class->logging_transaction === false) {
$this->db_class->logging_transaction = true;
}
$Qupdate->setLogging($this->logging_module, $this->logging_module_id);
}
$Qupdate->execute();
}
}
}
}
} elseif ($query_action == 'update') {
$query_data = split(' ', $this->sql_query, 3);
$query_table = substr($query_data[1], strlen(DB_TABLE_PREFIX));
if (isset($this->db_class->fkeys[$query_table])) {
// check for RESTRICT constraints first
foreach ($this->db_class->fkeys[$query_table] as $fk) {
if ($fk['on_update'] == 'restrict') {
$child_query = $this->db_class->simpleQuery('select ' . $fk['to_field'] . ' from ' . $query_data[2] . ' ' . $query_data[3]);
while ($child_result = $this->db_class->next($child_query)) {
$Qcheck = new self($this->db_class);
$Qcheck->setQuery('select ' . $fk['from_field'] . ' from ' . DB_TABLE_PREFIX . $fk['from_table'] . ' where ' . $fk['from_field'] . ' = "' . $child_result[$fk['to_field']] . '" limit 1');
$Qcheck->execute();
if ($Qcheck->numberOfRows() === 1) {
$this->db_class->setError('RESTRICT constraint condition from table ' . DB_TABLE_PREFIX . $fk['from_table'], null, $this->sql_query);
return false;
}
}
}
}
foreach ($this->db_class->fkeys[$query_table] as $fk) {
// check to see if foreign key column value is being changed
//.........这里部分代码省略.........
示例15: doBlockLevels
/**
* Make lists from lines starting with ':', '*', '#', etc.
*
* @param string $text
* @param bool $lineStart Whether or not this is at the start of a line.
* @return string The lists rendered as HTML
*/
public static function doBlockLevels($text, $lineStart)
{
$pass = new self($text, $lineStart);
return $pass->execute();
}