本文整理汇总了PHP中value函数的典型用法代码示例。如果您正苦于以下问题:PHP value函数的具体用法?PHP value怎么用?PHP value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* processes the form. Used internally only.
*/
function process() {
global $goon, $lang, $c, $errors;
if ($goon == $lang->get("commit")) {
// process all the registered checks.
for ($i = 0; $i < count($this->actions); $i++) {
if (value($this->actions[$i][0]) != "0") {
$this->actions[$i][1]->process($this->actions[$i][0]);
if ($errors == "") {
$this->addToTopText("<br><b>" . $this->actions[$i][2] . " ". $lang->get("var_succeeded"). "</b>");
} else {
$this->addToTopText($lang->get("error"));
$this->setTopStyle("headererror;");
}
}
}
} else if ($goon == $lang->get("cancel")) {
global $db;
$db->close();
if ($this->backpage == "") {
header ("Location: " . $c["docroot"] . "api/userinterface/page/blank_page.php");
} else {
header ("Location: " . $c["docroot"] . $this->backpage);
}
exit;
}
}
示例2: syncVariations
/**
* syncronize variations with entered data to the database.
* The configuration for this function must be set manually.
* I.E. there must be the $oid-Variable set and there must(!)
* be also the global vars content_variations_VARIATION_ID_XX
* and content_MODULE_ID
* set which are automatically set by the SelectMultiple2Input.
*/
function syncVariations()
{
global $db, $oid, $content_MODULE_ID;
$module = value("content_MODULE_ID", "NUMERIC");
if ($module == "0") {
$module = $content_MODULE_ID;
}
includePGNSource($module);
//delete all variations first.
$del = "UPDATE content_variations SET DELETED=1 WHERE CID = {$oid}";
$query = new query($db, $del);
// get list of variations
$variations = createNameValueArray("variations", "NAME", "VARIATION_ID", "DELETED=0");
for ($i = 0; $i < count($variations); $i++) {
$id = $variations[$i][1];
if (value("content_variations_VARIATION_ID_" . $id) != "0") {
// create or restore variation
// check, if variations already exists and is set to deleted.
$sql = "SELECT COUNT(CID) AS ANZ FROM content_variations WHERE CID = {$oid} AND VARIATION_ID = {$id}";
$query = new query($db, $sql);
$query->getrow();
$amount = $query->field("ANZ");
if ($amount > 0) {
$sql = "UPDATE content_variations SET DELETED=0 WHERE CID = {$oid} AND VARIATION_ID = {$id}";
} else {
$fk = nextGUID();
$sql = "INSERT INTO content_variations (CID, VARIATION_ID, FK_ID, DELETED) VALUES ( {$oid}, {$id}, {$fk}, 0)";
$PGNRef = createPGNRef($module, $fk);
$PGNRef->sync();
}
$query = new query($db, $sql);
}
}
}
示例3: get
/**
* Get an item from the collection by key.
*
* @param mixed $key
* @param mixed $default
* @return mixed
*/
public function get($key, $default = null)
{
if ($this->offsetExists($key)) {
return $this->offsetGet($key);
}
return value($default);
}
示例4: get
/**
* Get an item from the collection by key.
*
* @param mixed $key
* @param mixed $default
*
* @return mixed|static
*/
public function get($key, $default = null)
{
if ($this->offsetExists($key)) {
return is_array($this->items[$key]) ? new static($this->items[$key]) : $this->items[$key];
}
return value($default);
}
示例5: get
public static function get($path, $default = null)
{
if (file_exists($path)) {
return file_get_contents($path);
}
return value($default);
}
示例6: get
/**
* @param string $filter
* @param mixed $default
*
* @return Filter
*/
public function get($filter, $default = null)
{
if ($this->offsetExists($filter)) {
return $this->items[$filter];
}
return value($default);
}
示例7: dataGet
function dataGet($target, $key, $default = null)
{
if (is_null($key)) {
return $target;
}
foreach (explode('.', $key) as $segment) {
if (is_array($target)) {
if (!array_key_exists($segment, $target)) {
return value($default);
}
$target = $target[$segment];
} elseif ($target instanceof \ArrayAccess) {
if (!isset($target[$segment])) {
return value($default);
}
$target = $target[$segment];
} elseif (is_object($target)) {
if (!isset($target->{$segment})) {
return value($default);
}
$target = $target->{$segment};
} else {
return value($default);
}
}
return $target;
}
示例8: data_get
/**
* Get an item from an array or object using "dot" notation.
*
* @param mixed $target
* @param string|array $key
* @param mixed $default
* @return mixed
*/
function data_get($target, $key, $default = null)
{
if (is_null($key)) {
return $target;
}
$key = is_array($key) ? $key : explode('.', $key);
foreach ($key as $segment) {
if (is_array($target)) {
if (!array_key_exists($segment, $target)) {
return value($default);
}
$target = $target[$segment];
} elseif ($target instanceof ArrayAccess) {
if (!isset($target[$segment])) {
return value($default);
}
$target = $target[$segment];
} elseif (is_object($target)) {
$method = 'get' . ucfirst($segment);
if (isset($target->{$segment})) {
$target = $target->{$segment};
} elseif (is_callable([$target, $method])) {
$target = $target->{$method}();
} else {
return value($default);
}
} else {
return value($default);
}
}
return $target;
}
示例9: processForm
/**
* Process the formfields, if set. Takes fields pgnratingcomment<id>, pgnratingvote<id>,
* pgnratingsend<id>
*/
function processForm($sourceId)
{
if (value("pgnratingsend" . $sourceId) == "1") {
return saveData(value("pgnrating" . $sourceId, "NUMERIC"), value("pgnratingcomment" . $sourceId, "", ""), $sourceId);
}
return false;
}
示例10: get
public function get($key, $default = NULL)
{
if ($this->offsetExists($key)) {
return $this->items[$key]['response'];
}
return value($default);
}
示例11: rule
public function rule($rule, $condition = true)
{
if (value($condition) && !in_array($rule, $this->rules)) {
$this->rules[] = $rule;
}
return $this;
}
示例12: env
function env($key, $default = null)
{
if (isset($_ENV[$key])) {
$value = $_ENV[$key];
} else {
return value($default);
}
switch (strtolower($value)) {
case 'true':
case '(true)':
return true;
case 'false':
case '(false)':
return false;
case 'empty':
case '(empty)':
return '';
case 'null':
case '(null)':
return;
}
if (preg_match('/^"[^"]+"$/', $value)) {
return substr($value, 1, -1);
} else {
return $value;
}
}
示例13: env
/**
* Gets the value of an environment variable. Supports boolean, empty and null.
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
function env($key, $default = NULL)
{
$value = getenv($key);
if ($value === FALSE) {
return value($default);
}
switch (strtolower($value)) {
case 'true':
case '(true)':
return TRUE;
case 'false':
case '(false)':
return FALSE;
case 'empty':
case '(empty)':
return '';
case 'null':
case '(null)':
return NULL;
}
if (strlen($value) > 1 && Lib::starts_with('"', $value) && Lib::ends_with('"', $value)) {
return substr($value, 1, -1);
}
return $value;
}
示例14: env
function env($key, $default = null)
{
$value = getenv($key);
if ($value === false) {
return value($default);
}
switch (strtolower($value)) {
case 'true':
case '(true)':
return true;
case 'false':
case '(false)':
return false;
case 'empty':
case '(empty)':
return '';
case 'null':
case '(null)':
return;
}
if ($value[0] === '"' && $value[strlen($value) - 1] === '"') {
return substr($value, 1, -1);
}
return $value;
}
示例15: param
/**
* Gets a parameters
* @param string $name The parameter name
* @param mixed|\Closure $default Default value if parameter is not set
* @return mixed
*/
public function param($name, $default = null)
{
if (isset($this->parameters[$name])) {
return $this->parameters[$name];
}
return value($default);
}