本文整理汇总了PHP中setValue函数的典型用法代码示例。如果您正苦于以下问题:PHP setValue函数的具体用法?PHP setValue怎么用?PHP setValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setValue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:vanilla,项目名称:vanilla,代码行数:34,代码来源:class.socialcontroller.php
示例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());
}
开发者ID:picqer,项目名称:exact-php-client,代码行数:13,代码来源:example.php
示例3: parseXMLGetValues
function parseXMLGetValues($path, $fields)
{
$sites = simplexml_load_file($path);
foreach ($sites as $key => $value) {
$fields = setValue($key, $value, $fields);
}
return $fields;
}
开发者ID:stumpdk,项目名称:OnlineArchiveIndexTool,代码行数:8,代码来源:index.php
示例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;
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:16,代码来源:funciones.php
示例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;
}
开发者ID:NassimElBoussadi,项目名称:PHP,代码行数:45,代码来源:funciones.php
示例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;
}
开发者ID:sitexa,项目名称:vanilla,代码行数:24,代码来源:class.messagemodel.php
示例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;
}
开发者ID:EliasZ,项目名称:moneybird-php-client,代码行数:30,代码来源:example.php
示例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');
}
开发者ID:vanilla,项目名称:addons,代码行数:44,代码来源:class.qna.plugin.php
示例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-->
开发者ID:GitupPatsyy,项目名称:PhP_FormVal,代码行数:31,代码来源:index.php
示例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());
}
开发者ID:RodSloan,项目名称:vanilla,代码行数:67,代码来源:class.discussionmodel.php
示例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');
}
开发者ID:vanilla,项目名称:vanilla,代码行数:40,代码来源:class.usermodel.php
示例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');
}
开发者ID:RodSloan,项目名称:vanilla,代码行数:47,代码来源:class.usermodel.php
示例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>
//.........这里部分代码省略.........
开发者ID:raynaldmo,项目名称:php-education,代码行数:101,代码来源:registration.php
示例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'));
}
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:21,代码来源:class.settingscontroller.php
示例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
}
开发者ID:raynaldmo,项目名称:php-education,代码行数:45,代码来源:registration_multistep.php
示例16: displayForm2
function displayForm2()
{
$ciudades = array('Roma', 'Paris', 'Nueva York', 'Londres', 'Berlin', 'Atenas');
$ocultosInformacion = "";
$ocultosCiudades = "";
foreach ($ciudades as $valor) {
$valorCampo = setValue2("ciudades", $valor);
$ocultosCiudades .= '<input type="hidden" name="ciudades[]" value="' . $valorCampo . '">';
}
$informacion = array('Correo Postal', 'Email');
foreach ($informacion as $valor) {
$valorCampo = setValue2("informacion", $valor);
$ocultosInformacion .= '<input type="hidden" name="informacion[]" value="' . $valorCampo . '">';
}
$datos = array("error" => $error, "ocultosCiudades" => $ocultosCiudades, "ocultosInformacion" => $ocultosInformacion, "validacionNombre" => validateField("nombre", $camposPendientes, $camposErroneos), "nombre" => setValue("nombre"), "validacionApellidos" => validateField("apellidos", $camposPendientes, $camposErroneos), "apellidos" => setValue("apellidos"), "validacionDireccion" => validateField("direccion", $camposPendientes, $camposErroneos), "direccion" => setValue("direccion"), "validacionTelefono" => validateField("telefono", $camposPendientes, $camposErroneos), "telefono" => setValue("telefono"), "email" => setValue("email"), "validacionEmail" => validateField("email", $camposPendientes, $camposErroneos), "validacionFoto" => validateField("foto", $camposPendientes, $camposErroneos));
$plantilla = "plantillas/paso1.html";
$formulario = vista($datos, $plantilla);
$datos = array("titulo" => TITULO, "formulario" => $formulario);
$plantilla = "plantillas/plantilla.html";
$html = vista($datos, $plantilla);
print $html;
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:22,代码来源:funciones.php
示例17: addCategoryColumns
/**
* Modifies category data before it is returned.
*
* Adds CountAllDiscussions column to each category representing the sum of
* discussions within this category as well as all subcategories.
*
* @since 2.0.17
* @access public
*
* @param object $Data SQL result.
*/
public static function addCategoryColumns($Data)
{
$Result =& $Data->result();
$Result2 = $Result;
foreach ($Result as &$Category) {
if (!property_exists($Category, 'CountAllDiscussions')) {
$Category->CountAllDiscussions = $Category->CountDiscussions;
}
if (!property_exists($Category, 'CountAllComments')) {
$Category->CountAllComments = $Category->CountComments;
}
// Calculate the following field.
$Following = !((bool) val('Archived', $Category) || (bool) val('Unfollow', $Category));
$Category->Following = $Following;
$DateMarkedRead = val('DateMarkedRead', $Category);
$UserDateMarkedRead = val('UserDateMarkedRead', $Category);
if (!$DateMarkedRead) {
$DateMarkedRead = $UserDateMarkedRead;
} elseif ($UserDateMarkedRead && Gdn_Format::toTimestamp($UserDateMarkedRead) > Gdn_Format::ToTimeStamp($DateMarkedRead)) {
$DateMarkedRead = $UserDateMarkedRead;
}
// Set appropriate Last* columns.
setValue('LastTitle', $Category, val('LastDiscussionTitle', $Category, null));
$LastDateInserted = val('LastDateInserted', $Category, null);
if (val('LastCommentUserID', $Category) == null) {
setValue('LastCommentUserID', $Category, val('LastDiscussionUserID', $Category, null));
setValue('DateLastComment', $Category, val('DateLastDiscussion', $Category, null));
setValue('LastUserID', $Category, val('LastDiscussionUserID', $Category, null));
$LastDiscussion = arrayTranslate($Category, array('LastDiscussionID' => 'DiscussionID', 'CategoryID' => 'CategoryID', 'LastTitle' => 'Name'));
setValue('LastUrl', $Category, DiscussionUrl($LastDiscussion, false, '/') . '#latest');
if (is_null($LastDateInserted)) {
setValue('LastDateInserted', $Category, val('DateLastDiscussion', $Category, null));
}
} else {
$LastDiscussion = arrayTranslate($Category, array('LastDiscussionID' => 'DiscussionID', 'CategoryID' => 'CategoryID', 'LastTitle' => 'Name'));
setValue('LastUserID', $Category, val('LastCommentUserID', $Category, null));
setValue('LastUrl', $Category, DiscussionUrl($LastDiscussion, false, '/') . '#latest');
if (is_null($LastDateInserted)) {
setValue('LastDateInserted', $Category, val('DateLastComment', $Category, null));
}
}
$LastDateInserted = val('LastDateInserted', $Category, null);
if ($DateMarkedRead) {
if ($LastDateInserted) {
$Category->Read = Gdn_Format::toTimestamp($DateMarkedRead) >= Gdn_Format::toTimestamp($LastDateInserted);
} else {
$Category->Read = true;
}
} else {
$Category->Read = false;
}
foreach ($Result2 as $Category2) {
if ($Category2->TreeLeft > $Category->TreeLeft && $Category2->TreeRight < $Category->TreeRight) {
$Category->CountAllDiscussions += $Category2->CountDiscussions;
$Category->CountAllComments += $Category2->CountComments;
}
}
}
}
开发者ID:R-J,项目名称:vanilla,代码行数:70,代码来源:class.categorymodel.php
示例18: setValue
<title><?php
echo setValue($settings, 'site_name', 'T-Shirt eCommerce');
?>
</title>
<meta property="og:url" content="<?php
echo $url;
?>
" />
<meta property="og:type" content="website" />
<meta property="og:title" content="<?php
echo setValue($settings, 'site_name', 'T-Shirt eCommerce');
?>
" />
<meta property="og:description" content="<?php
echo setValue($settings, 'meta_description', 'T-Shirt eCommerce');
?>
" />
<meta property="og:image" content="<?php
echo $image;
?>
" />
<script>
window.location.href = "<?php
echo $base_url;
?>
";
</script>
</head>
<body>
</body>
开发者ID:rootcave,项目名称:9livesprints-web,代码行数:31,代码来源:sharing.php
示例19: settingsController_profileFieldAddEdit_create
/**
* Add/edit a field.
*/
public function settingsController_profileFieldAddEdit_create($Sender, $Args)
{
$Sender->permission('Garden.Settings.Manage');
$Sender->setData('Title', t('Add Profile Field'));
if ($Sender->Form->authenticatedPostBack()) {
// Get whitelisted properties
$FormPostValues = $Sender->Form->formValues();
foreach ($FormPostValues as $Key => $Value) {
if (!in_array($Key, $this->FieldProperties)) {
unset($FormPostValues[$Key]);
}
}
// Make Options an array
if ($Options = val('Options', $FormPostValues)) {
$Options = explode("\n", preg_replace('/[^\\w\\s()-]/u', '', $Options));
if (count($Options) < 2) {
$Sender->Form->addError('Must have at least 2 options.', 'Options');
}
setValue('Options', $FormPostValues, $Options);
}
// Check label
if (val('FormType', $FormPostValues) == 'DateOfBirth') {
setValue('Label', $FormPostValues, 'DateOfBirth');
}
if (!val('Label', $FormPostValues)) {
$Sender->Form->addError('Label is required.', 'Label');
}
// Check form type
if (!array_key_exists(val('FormType', $FormPostValues), $this->FormTypes)) {
$Sender->Form->addError('Invalid form type.', 'FormType');
}
// Force CheckBox options
if (val('FormType', $FormPostValues) == 'CheckBox') {
setValue('Required', $FormPostValues, true);
setValue('OnRegister', $FormPostValues, true);
}
// Merge updated data into config
$Fields = $this->GetProfileFields();
if (!($Name = val('Name', $FormPostValues))) {
// Make unique name from label for new fields
$Name = $TestSlug = preg_replace('`[^0-9a-zA-Z]`', '', val('Label', $FormPostValues));
$i = 1;
while (array_key_exists($Name, $Fields) || in_array($Name, $this->ReservedNames)) {
$Name = $TestSlug . $i++;
}
}
// Save if no errors
if (!$Sender->Form->errorCount()) {
$Data = c('ProfileExtender.Fields.' . $Name, array());
$Data = array_merge((array) $Data, (array) $FormPostValues);
saveToConfig('ProfileExtender.Fields.' . $Name, $Data);
$Sender->RedirectUrl = url('/settings/profileextender');
}
} elseif (isset($Args[0])) {
// Editing
$Data = $this->GetProfileField($Args[0]);
if (isset($Data['Options']) && is_array($Data['Options'])) {
$Data['Options'] = implode("\n", $Data['Options']);
}
$Sender->Form->setData($Data);
$Sender->Form->addHidden('Name', $Args[0]);
$Sender->setData('Title', t('Edit Profile Field'));
}
$CurrentFields = $this->getProfileFields();
$FormTypes = $this->FormTypes;
/**
* We only allow one DateOfBirth field, since it is a special case. Remove it as an option if we already
* have one, unless we're editing the one instance we're allowing.
*/
if (array_key_exists('DateOfBirth', $CurrentFields) && $Sender->Form->getValue('FormType') != 'DateOfBirth') {
unset($FormTypes['DateOfBirth']);
}
$Sender->setData('FormTypes', $FormTypes);
$Sender->setData('CurrentFields', $CurrentFields);
$Sender->render('addedit', '', 'plugins/ProfileExtender');
}
开发者ID:ReKungPaw,项目名称:vanilla,代码行数:79,代码来源:class.profileextender.plugin.php
|
请发表评论