本文整理汇总了PHP中setValue函数的典型用法代码示例。如果您正苦于以下问题:PHP setValue函数的具体用法?PHP setValue怎么用?PHP setValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConnections
/**
* Find available social plugins.
*
* @return array|mixed
* @throws Exception
*/
protected function getConnections()
{
$this->fireEvent('GetConnections');
$connections = [];
$addons = Gdn::addonManager()->lookupAllByType(\Vanilla\Addon::TYPE_ADDON);
foreach ($addons as $addonName => $addon) {
$addonInfo = $addon->getInfo();
// Limit to designated social addons.
if (!array_key_exists('socialConnect', $addonInfo)) {
continue;
}
// See if addon is enabled.
$isEnabled = Gdn::addonManager()->isEnabled($addonName, \Vanilla\Addon::TYPE_ADDON);
setValue('enabled', $addonInfo, $isEnabled);
// See if we can detect whether connection is configured.
$isConfigured = null;
if ($isEnabled) {
$pluginInstance = Gdn::pluginManager()->getPluginInstance($addonName, Gdn_PluginManager::ACCESS_PLUGINNAME);
if (method_exists($pluginInstance, 'isConfigured')) {
$isConfigured = $pluginInstance->isConfigured();
}
}
setValue('configured', $addonInfo, $isConfigured);
// Add the connection.
$connections[$addonName] = $addonInfo;
}
return $connections;
}
示例2: tokenUpdateCallback
/**
* Callback function that sets values that expire and are refreshed by Connection.
*
* @param \Picqer\Financials\Exact\Connection $connection
*/
function tokenUpdateCallback(\Picqer\Financials\Exact\Connection $connection)
{
// Save the new tokens for next connections
setValue('accesstoken', $connection->getAccessToken());
setValue('refreshtoken', $connection->getRefreshToken());
// Save expires time for next connections
setValue('expires_in', $connection->getTokenExpires());
}
示例3: parseXMLGetValues
function parseXMLGetValues($path, $fields)
{
$sites = simplexml_load_file($path);
foreach ($sites as $key => $value) {
$fields = setValue($key, $value, $fields);
}
return $fields;
}
示例4: displayForm
function displayForm($camposPendientes)
{
if ($camposPendientes) {
$error = '<p class="error">Hubo algunos problemas con el formulario que usted presentó. Por favor, complete correctamente los campos remarcados de abajo y haga clic en Enviar para volver a enviar el formulario.</p>';
} else {
$error = '<p>por favor, rellene sus datos a continuación y haga clic en Enviar.
Los campos marcados con un asterisco (*) son obligatorios.</p>';
}
$datos = array("error" => $error, "scriptUrl" => "index.php", "validacionNombre" => validateField("nombre", $camposPendientes), "valorNombre" => setValue("nombre"), "valorComentario" => setValue("comentario"), "validacionClave" => validateField("clave", $camposPendientes), "valorClave" => setValue("clave"), "precio" => array("mas 14k" => setSelectedParaUno("precio", "mas 14k"), "14k" => setSelectedParaUno("precio", "14k"), "menos 14k" => setSelectedParaUno("precio", "menos 14k")), "color" => array("rojo" => setChecked1("color", "rojo"), "verde" => setChecked1("color", "verde"), "azul" => setChecked1("color", "azul")), "extras" => array("aireAcondicionado" => setChecked2("extras", "aireAcondicionado"), "Yantas" => setChecked2("extras", "Yantas"), "Tapiceria" => setChecked2("extras", "Tapiceria")));
$plantilla = "plantillas/encuestaForm.html";
$formulario = vista($datos, $plantilla);
$datos = array("titulo" => TITULO, "formulario" => $formulario);
$plantilla = "plantillas/plantilla.html";
$html = vista($datos, $plantilla);
print $html;
}
示例5: displayForm1
function displayForm1($camposPendientes = array(), $camposErroneos = array(), $mensajeErrorImagen = "correcto")
{
if ($camposPendientes || $camposErroneos || $mensajeErrorImagen != "correcto") {
$error = '<p class="error1">Hubo algunos problemas con el formulario que usted presentó. Por favor, complete correctamente los campos remarcados de abajo y haga clic en Enviar para volver a enviar el formulario.</p>';
} else {
$error = '<p>por favor, rellene sus datos a continuación y haga clic en Enviar.
Los campos marcados con un asterisco (*) son obligatorios.</p>';
}
if (count($camposPendientes) > 0) {
$error .= "<p class='error2'>Faltan por rellenar campos en el formulario:";
foreach ($camposPendientes as $campo) {
$error .= $campo . ", ";
}
$error = preg_replace("/, \$/", "", $error);
$error .= "</p>";
}
if (count($camposErroneos) > 0) {
$error .= "<p class='error1'>Hay campos mal rellenados en el formulario:";
foreach ($camposErroneos as $campo) {
$error .= $campo . ", ";
}
$error = preg_replace("/, \$/", "", $error);
$error .= "</p>";
}
if ($mensajeErrorImagen != "correcto") {
$error .= "<p class='error3'>{$mensajeErrorImagen}</p>";
}
$ciudades = array("Roma", "Paris", "Nueva York", "Londres", "Berlin", "Atenas");
$medios = array("correoPostal", "email");
$ocultosCiudades = "";
foreach ($ciudades as $ciudad) {
$ocultosCiudades .= '<input type="hidden" name="ciudades[]" value="' . setValue("ciudades", $ciudad) . "\"/>\n";
}
$ocultosMedios = "";
foreach ($medios as $medio) {
$ocultosMedios .= '<input type="hidden" name="medios[]" value="' . setValue("medios", $medio) . "\"/>\n";
}
$datos = array("error" => $error, "scriptUrl" => "index.php", "ocultosCiudades" => $ocultosCiudades, "ocultosMedios" => $ocultosMedios, "validacionNombre" => validateField("nombre", $camposPendientes, $camposErroneos), "valorNombre" => setValue("nombre"), "validacionApellidos" => validateField("apellidos", $camposPendientes, $camposErroneos), "valorApellidos" => setValue("apellidos"), "validacionDireccion" => validateField("direccion", $camposPendientes, $camposErroneos), "valorDireccion" => setValue("direccion"), "validacionTelefono" => validateField("telefono", $camposPendientes, $camposErroneos), "valorTelefono" => setValue("telefono"), "validacionEmail" => validateField("email", $camposPendientes, $camposErroneos), "valorEmail" => setValue("email"), "validacionFoto" => validateField("foto1", $camposPendientes, $camposErroneos, $mensajeErrorImagen));
$plantilla = "plantillas/formulario.html";
$formulario = vista($datos, $plantilla);
$datos = array("titulo" => TITULO, "formulario" => $formulario);
$plantilla = "plantillas/plantilla.html";
$html = vista($datos, $plantilla);
print $html;
}
示例6: defineLocation
/**
* Build the Message's Location property and add it.
*
* @param array|object $Message Message data.
* @return array|object Message data with Location property/key added.
*/
public function defineLocation($Message)
{
$Controller = val('Controller', $Message);
$Application = val('Application', $Message);
$Method = val('Method', $Message);
if (in_array($Controller, $this->_SpecialLocations)) {
setValue('Location', $Message, $Controller);
} else {
setValue('Location', $Message, $Application);
if (!stringIsNullOrEmpty($Controller)) {
setValue('Location', $Message, val('Location', $Message) . '/' . $Controller);
}
if (!stringIsNullOrEmpty($Method)) {
setValue('Location', $Message, val('Location', $Message) . '/' . $Method);
}
}
return $Message;
}
示例7: connect
/**
* Function to connect to Moneybird, this creates the client and automatically retrieves oAuth tokens if needed
*
* @return \Picqer\Financials\Moneybird\Connection
* @throws Exception
*/
function connect($redirectUrl, $clientId, $clientSecret)
{
$connection = new \Picqer\Financials\Moneybird\Connection();
$connection->setRedirectUrl($redirectUrl);
$connection->setClientId($clientId);
$connection->setClientSecret($clientSecret);
// Retrieves authorizationcode from database
if (getValue('authorizationcode')) {
$connection->setAuthorizationCode(getValue('authorizationcode'));
}
// Retrieves accesstoken from database
if (getValue('accesstoken')) {
$connection->setAccessToken(getValue('accesstoken'));
}
// Make the client connect and exchange tokens
try {
$connection->connect();
} catch (\Exception $e) {
throw new Exception('Could not connect to Moneybird: ' . $e->getMessage());
}
// Save the new tokens for next connections
setValue('accesstoken', $connection->getAccessToken());
return $connection;
}
示例8: _discussionOptions
/**
*
*
* @param $sender controller instance.
* @param int|string $discussionID Identifier of the discussion.
*
* @throws notFoundException
*/
protected function _discussionOptions($sender, $discussionID)
{
$sender->Form = new Gdn_Form();
$Discussion = $sender->DiscussionModel->getID($discussionID);
if (!$Discussion) {
throw notFoundException('Discussion');
}
$sender->permission('Vanilla.Discussions.Edit', true, 'Category', val('PermissionCategoryID', $Discussion));
// Both '' and 'Discussion' denote a discussion type of discussion.
if (!val('Type', $Discussion)) {
setValue('Type', $Discussion, 'Discussion');
}
if ($sender->Form->isPostBack()) {
$sender->DiscussionModel->setField($discussionID, 'Type', $sender->Form->getFormValue('Type'));
// Update the QnA field. Default to "Unanswered" for questions. Null the field for other types.
$qna = val('QnA', $Discussion);
switch ($sender->Form->getFormValue('Type')) {
case 'Question':
$sender->DiscussionModel->setField($discussionID, 'QnA', $qna ? $qna : 'Unanswered');
break;
default:
$sender->DiscussionModel->setField($discussionID, 'QnA', null);
}
// $Form = new Gdn_Form();
$sender->Form->setValidationResults($sender->DiscussionModel->validationResults());
// if ($sender->DeliveryType() == DELIVERY_TYPE_ALL || $Redirect)
// $sender->RedirectUrl = Gdn::Controller()->Request->PathAndQuery();
Gdn::controller()->jsonTarget('', '', 'Refresh');
} else {
$sender->Form->setData($Discussion);
}
$sender->setData('Discussion', $Discussion);
$sender->setData('_Types', array('Question' => '@' . t('Question Type', 'Question'), 'Discussion' => '@' . t('Discussion Type', 'Discussion')));
$sender->setData('Title', t('Q&A Options'));
$sender->render('DiscussionOptions', '', 'plugins/QnA');
}
示例9: setValue
<?php
if (isset($errors['username'])) {
echo $errors['username'];
}
?>
</span>
</div>
</div>
<!-- Password -->
<div class="row">
<div class="label">
<label for="password">Password</label>
<div class="control">
<input type="password" id="password" name="password" value="<?php
setValue($formdata, 'password');
?>
"/>
</div>
<div class="errors">
<span id="passwordError">
<?php
if (isset($errors['password'])) {
echo $errors['password'];
}
?>
</span>
</div>
</div>
<!--Date of Birth-->
示例10: save
//.........这里部分代码省略.........
// Get all fields on the form that relate to the schema
$Fields = $this->Validation->schemaValidationFields();
// Check for spam.
$spam = SpamModel::isSpam('Discussion', $Fields);
if ($spam) {
return SPAM;
}
// Get DiscussionID if one was sent
$DiscussionID = intval(val('DiscussionID', $Fields, 0));
// Remove the primary key from the fields for saving.
unset($Fields['DiscussionID']);
$StoredCategoryID = false;
if ($DiscussionID > 0) {
// Updating
$Stored = $this->getID($DiscussionID, DATASET_TYPE_OBJECT);
// Block Format change if we're forcing the formatter.
if (c('Garden.ForceInputFormatter')) {
unset($Fields['Format']);
}
// Clear the cache if necessary.
$CacheKeys = array();
if (val('Announce', $Stored) != val('Announce', $Fields)) {
$CacheKeys[] = $this->getAnnouncementCacheKey();
$CacheKeys[] = $this->getAnnouncementCacheKey(val('CategoryID', $Stored));
}
if (val('CategoryID', $Stored) != val('CategoryID', $Fields)) {
$CacheKeys[] = $this->getAnnouncementCacheKey(val('CategoryID', $Fields));
}
foreach ($CacheKeys as $CacheKey) {
Gdn::cache()->remove($CacheKey);
}
self::serializeRow($Fields);
$this->SQL->put($this->Name, $Fields, array($this->PrimaryKey => $DiscussionID));
setValue('DiscussionID', $Fields, $DiscussionID);
LogModel::logChange('Edit', 'Discussion', (array) $Fields, $Stored);
if (val('CategoryID', $Stored) != val('CategoryID', $Fields)) {
$StoredCategoryID = val('CategoryID', $Stored);
}
} else {
// Inserting.
if (!val('Format', $Fields) || c('Garden.ForceInputFormatter')) {
$Fields['Format'] = c('Garden.InputFormatter', '');
}
if (c('Vanilla.QueueNotifications')) {
$Fields['Notified'] = ActivityModel::SENT_PENDING;
}
// Check for approval
$ApprovalRequired = checkRestriction('Vanilla.Approval.Require');
if ($ApprovalRequired && !val('Verified', Gdn::session()->User)) {
LogModel::insert('Pending', 'Discussion', $Fields);
return UNAPPROVED;
}
// Create discussion
$this->serializeRow($Fields);
$DiscussionID = $this->SQL->insert($this->Name, $Fields);
$Fields['DiscussionID'] = $DiscussionID;
// Update the cache.
if ($DiscussionID && Gdn::cache()->activeEnabled()) {
$CategoryCache = array('LastDiscussionID' => $DiscussionID, 'LastCommentID' => null, 'LastTitle' => Gdn_Format::text($Fields['Name']), 'LastUserID' => $Fields['InsertUserID'], 'LastDateInserted' => $Fields['DateInserted'], 'LastUrl' => DiscussionUrl($Fields));
CategoryModel::setCache($Fields['CategoryID'], $CategoryCache);
// Clear the cache if necessary.
if (val('Announce', $Fields)) {
Gdn::cache()->remove($this->getAnnouncementCacheKey(val('CategoryID', $Fields)));
if (val('Announce', $Fields) == 1) {
Gdn::cache()->remove($this->getAnnouncementCacheKey());
}
示例11: setCalculatedFields
/**
* Set fields that need additional manipulation after retrieval.
*
* @param array|object &$User
* @throws Exception
*/
public function setCalculatedFields(&$User)
{
if ($v = val('Attributes', $User)) {
if (is_string($v)) {
setValue('Attributes', $User, dbdecode($v));
}
}
if ($v = val('Permissions', $User)) {
if (is_string($v)) {
setValue('Permissions', $User, dbdecode($v));
}
}
if ($v = val('Preferences', $User)) {
if (is_string($v)) {
setValue('Preferences', $User, dbdecode($v));
}
}
if ($v = val('Photo', $User)) {
if (!isUrl($v)) {
$PhotoUrl = Gdn_Upload::url(changeBasename($v, 'n%s'));
} else {
$PhotoUrl = $v;
}
setValue('PhotoUrl', $User, $PhotoUrl);
}
// We store IPs in the UserIP table. To avoid unnecessary queries, the full list is not built here. Shim for BC.
setValue('AllIPAddresses', $User, [val('InsertIPAddress', $User), val('LastIPAddress', $User)]);
setValue('_CssClass', $User, '');
if (val('Banned', $User)) {
setValue('_CssClass', $User, 'Banned');
}
$this->EventArguments['User'] =& $User;
$this->fireEvent('SetCalculatedFields');
}
示例12: setCalculatedFields
/**
* Set fields that need additional manipulation after retrieval.
*
* @param $User
* @throws Exception
*/
public function setCalculatedFields(&$User)
{
if ($v = val('Attributes', $User)) {
if (is_string($v)) {
setValue('Attributes', $User, @unserialize($v));
}
}
if ($v = val('Permissions', $User)) {
if (is_string($v)) {
setValue('Permissions', $User, @unserialize($v));
}
}
if ($v = val('Preferences', $User)) {
if (is_string($v)) {
setValue('Preferences', $User, @unserialize($v));
}
}
if ($v = val('Photo', $User)) {
if (!isUrl($v)) {
$PhotoUrl = Gdn_Upload::url(changeBasename($v, 'n%s'));
} else {
$PhotoUrl = $v;
}
setValue('PhotoUrl', $User, $PhotoUrl);
}
if ($v = val('AllIPAddresses', $User)) {
if (is_string($v)) {
$IPAddresses = explode(',', $v);
foreach ($IPAddresses as $i => $IPAddress) {
$IPAddresses[$i] = ForceIPv4($IPAddress);
}
setValue('AllIPAddresses', $User, $IPAddresses);
}
}
setValue('_CssClass', $User, '');
if ($v = val('Banned', $User)) {
setValue('_CssClass', $User, 'Banned');
}
$this->EventArguments['User'] =& $User;
$this->fireEvent('SetCalculatedFields');
}
示例13: displayForm
function displayForm($missingFields)
{
?>
<h1>Membership Form</h1>
<?php
if ($missingFields) {
?>
<p class="error">There were some problems with the form you submitted. Please complete the fields highlighted below and click Send Details to resend the form.</p>
<?php
} else {
?>
<p>Thanks for choosing to join The Widget Club. To register, please fill in your details below and click Send Details. Fields marked with an asterisk (*) are required.</p>
<?php
}
?>
<form action="registration.php" method="post">
<div style="width: 30em;">
<label for="firstName"<?php
validateField("firstName", $missingFields);
?>
>First name *</label>
<input type="text" name="firstName" id="firstName" value="<?php
setValue("firstName");
?>
" />
<label for="lastName"<?php
validateField("lastName", $missingFields);
?>
>Last name *</label>
<input type="text" name="lastName" id="lastName" value="<?php
setValue("lastName");
?>
" />
<label for="password1"<?php
if ($missingFields) {
echo ' class="error"';
}
?>
>Choose a password *</label>
<input type="password" name="password1" id="password1" value="" />
<label for="password2"<?php
if ($missingFields) {
echo ' class="error"';
}
?>
>Retype password *</label>
<input type="password" name="password2" id="password2" value="" />
<label<?php
validateField("gender", $missingFields);
?>
>Your gender: *</label>
<label for="genderMale">Male</label>
<input type="radio" name="gender" id="genderMale" value="M"<?php
setChecked("gender", "M");
?>
/>
<label for="genderFemale">Female</label>
<input type="radio" name="gender" id="genderFemale" value="F"<?php
setChecked("gender", "F");
?>
/>
<label for="favoriteWidget">What's your favorite widget? *</label>
<select name="favoriteWidget" id="favoriteWidget" size="1">
<option value="superWidget"<?php
setSelected("favoriteWidget", "superWidget");
?>
>The SuperWidget</option>
<option value="megaWidget"<?php
setSelected("favoriteWidget", "megaWidget");
?>
>The MegaWidget</option>
<option value="wonderWidget"<?php
setSelected("favoriteWidget", "wonderWidget");
?>
>The WonderWidget</option>
</select>
<label for="newsletter">Do you want to receive our newsletter?</label>
<input type="checkbox" name="newsletter" id="newsletter" value="yes"<?php
setChecked("newsletter", "yes");
?>
/>
<label for="comments">Any comments?</label>
<textarea name="comments" id="comments" rows="4" cols="50"><?php
setValue("comments");
?>
</textarea>
<div style="clear: both;">
<input type="submit" name="submitButton" id="submitButton" value="Send Details" />
<input type="reset" name="resetButton" id="resetButton" value="Reset Form" style="margin-right: 20px;" />
</div>
//.........这里部分代码省略.........
示例14: sortAddons
/**
* Sort list of addons for display.
*
* @since 2.0.0
* @access public
* @param array $Array Addon data (e.g. $PluginInfo).
* @param bool $Filter Whether to exclude hidden addons (defaults to TRUE).
*/
public static function sortAddons(&$Array, $Filter = true)
{
// Make sure every addon has a name.
foreach ($Array as $Key => $Value) {
if ($Filter && val('Hidden', $Value)) {
unset($Array[$Key]);
continue;
}
$Name = val('Name', $Value, $Key);
setValue('Name', $Array[$Key], $Name);
}
uasort($Array, array('SettingsController', 'CompareAddonName'));
}
示例15: displayStep3
function displayStep3()
{
?>
<h1>Member Signup: Step 3</h1>
<form action="registration_multistep.php" method="post">
<div style="width: 30em;">
<input type="hidden" name="step" value="3" />
<input type="hidden" name="firstName" value="<?php
setValue("firstName");
?>
" />
<input type="hidden" name="lastName" value="<?php
setValue("lastName");
?>
" />
<input type="hidden" name="gender" value="<?php
setValue("gender");
?>
" />
<input type="hidden" name="favoriteWidget" value="<?php
setValue("favoriteWidget");
?>
" />
<label for="newsletter">Do you want to receive our newsletter?</label>
<input type="checkbox" name="newsletter" id="newsletter" value="yes"<?php
setChecked("newsletter", "yes");
?>
/>
<label for="comments">Any comments?</label>
<textarea name="comments" id="comments" rows="4" cols="50"><?php
setValue("comments");
?>
</textarea>
<div style="clear: both;">
<input type="submit" name="submitButton" id="nextButton" value="Next >" />
<input type="submit" name="submitButton" id="backButton" value="< Back" style="margin-right: 20px;" />
</div>
</div>
</form>
<?php
}