本文整理汇总了PHP中Setting::getValueByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::getValueByName方法的具体用法?PHP Setting::getValueByName怎么用?PHP Setting::getValueByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setting
的用法示例。
在下文中一共展示了Setting::getValueByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCurrentPeriod
/**
* Returns current period instance
*
* @return <Doctrine_Object> instance of Period
*/
public static function getCurrentPeriod()
{
$date = Period::getCurPeriodDate();
$oPeriod = PeriodTable::getInstance()->findOneByDate($date);
if (!$oPeriod instanceof Period) {
// выставить новые тарифы на новый период
UserTable::setNewTariffs();
$oPeriod = new Period();
// вычислить стоимость 1к знаков
if (($prev = Period::getPrevPeriod()) === false) {
$price1k = SettingTable::getOptionByName('price1k')->getValue();
} else {
// рассчитать веса пользователей
UserTable::countWeights($prev);
if (($price1k = VoteTable::getVoted1k($prev)) === false) {
$price1k = $prev->get1k();
}
}
$oPeriod->set1k(number_format((double) $price1k, 2));
// выставить процент
$oPeriod->setR2rShare(number_format(Setting::getValueByName('percent_r2r'), 2, '.', ''));
// --
$oPeriod->setDate($date);
$oPeriod->save();
//throw new sfException('Cannot get current period. Error in DB data');
}
return $oPeriod;
}
示例2: delete
public function delete($blnRemovePhysical = FALSE)
{
self::$object = "ElementFieldBigText";
self::$table = "pcms_element_field_bigtext";
if ($blnRemovePhysical) {
//*** Get TemplateField.
$objElementField = ElementField::selectByPk($this->fieldId);
if (is_object($objElementField)) {
$objTemplateField = TemplateField::selectByPk($objElementField->getTemplateFieldId());
switch ($objTemplateField->getTypeId()) {
case FIELD_TYPE_FILE:
case FIELD_TYPE_IMAGE:
//*** Get remote settings.
$strServer = Setting::getValueByName('ftp_server');
$strUsername = Setting::getValueByName('ftp_username');
$strPassword = Setting::getValueByName('ftp_password');
$strRemoteFolder = Setting::getValueByName('ftp_remote_folder');
//*** Remove deleted files.
$objFtp = new FTP($strServer);
$objFtp->login($strUsername, $strPassword);
$objFtp->pasv(TRUE);
$arrValues = explode("\n", $this->value);
foreach ($arrValues as $value) {
if (!empty($value)) {
//*** Find file name.
$arrFile = explode(":", $value);
if (count($arrFile) > 1) {
//*** Check if the file is used by other elements.
if (!ElementField::fileHasDuplicates($value, 1)) {
//*** Remove files.
$strFile = $strRemoteFolder . $arrFile[1];
$objFtp->delete($strFile);
if ($objTemplateField->getTypeId() == FIELD_TYPE_IMAGE) {
//*** Remove template settings files.
$objImageField = new ImageField($objElementField->getTemplateFieldId());
$arrSettings = $objImageField->getSettings();
foreach ($arrSettings as $key => $arrSetting) {
if (!empty($arrSetting['width']) || !empty($arrSetting['height'])) {
//*** Remove file.
$strFile = $strRemoteFolder . FileIO::add2Base($arrFile[1], $arrSetting['key']);
$objFtp->delete($strFile);
}
}
}
}
}
}
}
break;
}
}
}
return parent::delete();
}
示例3: cleanLog
public static function cleanLog($blnClearAll = false)
{
global $_CONF;
if (Setting::getValueByName("audit_enable")) {
if ($blnClearAll) {
$strSql = "DELETE FROM pcms_audit_log WHERE accountId = '%s'";
$strSql = sprintf($strSql, $_CONF['app']['account']->getId());
} else {
$strDate = Date::toMySql(time() - 60 * 60 * 24 * Setting::getValueByName("audit_rotation"));
$strSql = "DELETE FROM pcms_audit_log WHERE created < '%s' AND accountId = '%s'";
$strSql = sprintf($strSql, $strDate, $_CONF['app']['account']->getId());
}
parent::select($strSql);
}
}
示例4: delete
public function delete()
{
global $_CONF;
parent::$object = "StorageItem";
parent::$table = "pcms_storage_item";
if (class_exists("AuditLog")) {
AuditLog::addLog(AUDIT_TYPE_STORAGE, $this->getId(), $this->getName(), "delete");
}
//*** Remove child items.
$objElements = $this->getItems();
foreach ($objElements as $objElement) {
$objElement->delete();
}
if ($this->getTypeId() == STORAGE_TYPE_FILE) {
$strValue = $this->getData()->getLocalName();
if (!empty($strValue)) {
//*** Remove physical.
$strServer = Setting::getValueByName('ftp_server');
$strUsername = Setting::getValueByName('ftp_username');
$strPassword = Setting::getValueByName('ftp_password');
$strRemoteFolder = Setting::getValueByName('ftp_remote_folder');
//*** Remove deleted files.
$objFtp = new FTP($strServer);
$objFtp->login($strUsername, $strPassword);
$objFtp->pasv(TRUE);
$strFile = $strRemoteFolder . $strValue;
$objFtp->delete($strFile);
}
$objElements = $this->getLinkedElementFields();
foreach ($objElements as $objElement) {
$strValue = $objElement->getValue();
$arrValue = explode("\n", $strValue);
$arrNew = array();
foreach ($arrValue as $value) {
$arrFile = explode(":", $value);
if (count($arrFile) > 2 && $arrFile[2] == $this->id) {
//*** Skip me.
} else {
array_push($arrNew, $value);
}
}
$objElement->setValue(implode("\n", $arrNew));
$objElement->save();
}
}
return parent::delete($_CONF['app']['account']->getId());
}
示例5: genMassPayWM
public static function genMassPayWM($pay = true)
{
$max_id = Doctrine_Query::create()->select('max(bu.was_paid_id) as bu_max')->from('BalanceUser bu')->where('bu.was_paid > 0')->execute()->getFirst()->getBuMax();
$q = Doctrine_Query::create()->select("bu.id_user, u.account_number as account_number, sum(bu.payable) as to_pay,\n group_concat(p.date separator '|') as p_date, group_concat(bu.id separator '|') as for_ids")->from('BalanceUser bu')->innerJoin('bu.User u')->innerJoin('bu.Period p')->where('bu.was_paid = 0')->andWhere('bu.payable > 0')->andWhere("u.utype = 'puser'")->andWhere('bu.id_period != ?', Period::getCurrentPeriod()->getId())->groupBy('bu.id_user')->execute();
$min_payout = (double) Setting::getValueByName('minPayout');
$out = array();
$out_num = 0;
foreach ($q as $rec) {
if (preg_match('/^R[0-9]{12}$/', $rec->getAccountNumber()) && $rec->getToPay() >= $min_payout) {
if ($pay === true) {
$max_id = (int) $max_id + 1;
$bu_ids = explode('|', $rec->getForIds());
foreach ($bu_ids as $bu_id) {
$bu = BalanceUserTable::getInstance()->findOneById($bu_id);
$bu->setWasPaidId($max_id);
$bu->save();
}
$per = array();
$per_dates = explode('|', $rec->getPDate());
foreach ($per_dates as $p_date) {
$p_date_t = explode('-', $p_date);
$per[] = $p_date_t[1] . '/' . $p_date_t[0];
}
$row = array();
$row[] = $rec->getAccountNumber();
// номер кошелька
$row[] = $rec->getToPay();
// сумма тут надо разобраться с валютой
$row[] = mb_convert_encoding('Выплата за ', 'cp1251', 'utf-8') . join(', ', $per) . '. read2read.ru, payId:' . $max_id;
// комментарий к выплате
$row[] = $max_id;
// номер платежа
$out[] = join(';', $row);
} else {
$out_num += $rec->getToPay();
}
}
}
if ($pay === true) {
return join(PHP_EOL, $out);
} else {
return (int) $out_num;
}
}
示例6: verifyVersion
function verifyVersion($strVersion)
{
$varReturn = true;
switch ($strVersion) {
case "2.6.1":
$varEditAfterSave = Setting::getValueByName("edit_after_save");
if (strlen($varEditAfterSave) <= 0) {
$varReturn = false;
}
// Fall-through to previous versions
// Fall-through to previous versions
case "2.6":
$varNextAfterSave = Setting::getValueByName("next_after_save");
if (strlen($varNextAfterSave) <= 0) {
$varReturn = false;
}
$varNextIsChild = Setting::getValueByName("next_is_child");
if (strlen($varNextIsChild) <= 0) {
$varReturn = false;
}
break;
}
return $varReturn;
}
示例7: save
public function save()
{
global $_CONF, $_PATHS;
if (is_object($this->__template)) {
$strServer = Setting::getValueByName('ftp_server');
$strUsername = Setting::getValueByName('ftp_username');
$strPassword = Setting::getValueByName('ftp_password');
$strRemoteFolder = Setting::getValueByName('ftp_remote_folder');
//*** Element.
$objElement = new Element();
$objElement->setParentId($this->__parent->getId());
$objElement->setAccountId($_CONF['app']['account']->getId());
$objElement->setPermissions($this->__permissions);
$objElement->setActive($this->active);
$objElement->setName($this->name);
$objElement->setUsername($this->username);
$objElement->setSort($this->sort);
$objElement->setTypeId(ELM_TYPE_LOCKED);
$objElement->setTemplateId($this->__template->getId());
$objElement->save(true, false);
//*** Activate default schedule.
$objSchedule = new ElementSchedule();
$objSchedule->setStartActive(0);
$objSchedule->setStartDate(APP_DEFAULT_STARTDATE);
$objSchedule->setEndActive(0);
$objSchedule->setEndDate(APP_DEFAULT_ENDDATE);
$objElement->setSchedule($objSchedule);
//*** Alias.
if ($objElement->isPage()) {
$objAlias = new Alias();
$objAlias->setAlias($this->alias);
$objElement->setAlias($objAlias);
}
foreach ($this->__fields as $intTemplateFieldId => $arrField) {
$objTemplateField = TemplateField::selectByPK($intTemplateFieldId);
$objField = new ElementField();
$objField->setElementId($objElement->getId());
$objField->setTemplateFieldId($objTemplateField->getId());
$objField->save();
foreach ($arrField as $intLanguage => $arrValue) {
$objValue = $objField->getNewValueObject();
switch ($objField->getTypeId()) {
case FIELD_TYPE_FILE:
case FIELD_TYPE_IMAGE:
//*** Upload file.
$arrPath = parse_url($arrValue['value']);
if ($arrPath !== false) {
$strFile = @file_get_contents(str_replace(" ", "%20", $arrValue['value']));
if ($strFile !== false) {
$strOriginalName = array_pop(explode("/", $arrPath['path']));
$strLocalValue = ImageField::filename2LocalName($strOriginalName);
$objImageField = new ImageField($intTemplateFieldId);
$arrSettings = $objImageField->getSettings();
if (file_put_contents($_PATHS['upload'] . $strOriginalName, $strFile) !== false) {
if (count($arrSettings) > 1) {
foreach ($arrSettings as $key => $arrSetting) {
$strFileName = FileIO::add2Base($strLocalValue, $arrSetting['key']);
if (copy($_PATHS['upload'] . $strOriginalName, $_PATHS['upload'] . $strFileName)) {
if ($objTemplateField->getTypeId() == FIELD_TYPE_IMAGE && (!empty($arrSetting['width']) || !empty($arrSetting['height']))) {
//*** Resize the image.
$intQuality = empty($arrSetting['quality']) ? 75 : $arrSetting['quality'];
ImageResizer::resize($_PATHS['upload'] . $strFileName, $arrSetting['width'], $arrSetting['height'], $arrSetting['scale'], $intQuality, true, NULL, false, $arrSetting['grayscale']);
}
//*** Move file to remote server.
$objUpload = new SingleUpload();
if (!$objUpload->moveToFTP($strFileName, $_PATHS['upload'], $strServer, $strUsername, $strPassword, $strRemoteFolder)) {
Log::handleError("File {$strFileName} could not be moved to remote server. " . $objUpload->errorMessage());
}
}
}
//*** Move original file.
if (rename($_PATHS['upload'] . $strOriginalName, $_PATHS['upload'] . $strLocalValue)) {
$objUpload = new SingleUpload();
if (!$objUpload->moveToFTP($strLocalValue, $_PATHS['upload'], $strServer, $strUsername, $strPassword, $strRemoteFolder)) {
Log::handleError("File {$strLocalValue} could not be moved to remote server. " . $objUpload->errorMessage());
}
}
//*** Unlink original file.
@unlink($_PATHS['upload'] . $strOriginalName);
} else {
if ($objTemplateField->getTypeId() == FIELD_TYPE_IMAGE && (!empty($arrSettings[0]['width']) || !empty($arrSettings[0]['height']))) {
$strFileName = FileIO::add2Base($strLocalValue, $arrSettings[0]['key']);
//*** Resize the image.
if (rename($_PATHS['upload'] . $strOriginalName, $_PATHS['upload'] . $strFileName)) {
$intQuality = empty($arrSettings[0]['quality']) ? 75 : $arrSettings[0]['quality'];
ImageResizer::resize($_PATHS['upload'] . $strFileName, $arrSettings[0]['width'], $arrSettings[0]['height'], $arrSettings[0]['scale'], $intQuality, true, NULL, false, $arrSettings[0]['grayscale']);
//*** Move file to remote server.
$objUpload = new SingleUpload();
if (!$objUpload->moveToFTP($strFileName, $_PATHS['upload'], $strServer, $strUsername, $strPassword, $strRemoteFolder)) {
Log::handleError("File {$strFileName} could not be moved to remote server.");
}
}
}
//*** Move original file.
if (file_exists($_PATHS['upload'] . $strOriginalName) && rename($_PATHS['upload'] . $strOriginalName, $_PATHS['upload'] . $strLocalValue)) {
//*** Move file to remote server.
$objUpload = new SingleUpload();
if (!$objUpload->moveToFTP($strLocalValue, $_PATHS['upload'], $strServer, $strUsername, $strPassword, $strRemoteFolder)) {
Log::handleError("File {$strLocalValue} could not be moved to remote server.");
}
//.........这里部分代码省略.........
示例8: getSetting
public function getSetting($strValue)
{
return Setting::getValueByName($strValue, self::$__account->getId());
}
示例9: clearZeroCache
public function clearZeroCache($objFtp = NULL)
{
if (Setting::getValueByName('caching_enable')) {
if (!is_object($objFtp)) {
$objFtp = new FTP(Setting::getValueByName('ftp_server'));
$objFtp->login(Setting::getValueByName('ftp_username'), Setting::getValueByName('ftp_password'));
$objFtp->pasv(TRUE);
}
$objFtp->delete(Setting::getValueByName('caching_ftp_folder') . "/*_0_*");
}
}
示例10: slot
<?php
slot('page_keywords');
echo Setting::getValueByName('indexKeywords');
end_slot('page_keywords');
?>
<?php
slot('page_description');
echo Setting::getValueByName('indexDescription');
end_slot('page_description');
示例11: getFileListHTML
public static function getFileListHTML()
{
global $_CONF;
$strReturn = "";
$intParentId = request("parentId", 0);
$intAccountId = $_CONF['app']['account']->getId();
$arrImages = array('jpg', 'jpeg', 'gif', 'png');
$strSql = sprintf("SELECT * FROM pcms_storage_item WHERE parentId = '%s' AND typeId IN (%s) AND accountId = '%s' ORDER BY name", $intParentId, STORAGE_TYPE_FILE, $intAccountId);
$objElements = StorageItem::select($strSql);
$strReturn .= "<field id=\"{$intParentId}\"><![CDATA[";
$strReturn .= "<ul>";
foreach ($objElements as $objElement) {
$objData = $objElement->getData();
$strExtension = substr(strrchr($objData->getLocalName(), '.'), 1);
$strImageSrc = in_array($strExtension, $arrImages) ? Setting::getValueByName("web_server") . Setting::getValueByName("file_folder") . $objData->getLocalName() : "/images/ico_document_big.gif";
$strReturn .= "<li><a href=\"\" id=\"eid_{$objElement->getId()}\"><img width=\"100\" height=\"100\" src=\"{$strImageSrc}\" alt=\"{$objData->getLocalName()}\" /></a><span>" . str_replace("&", "&", $objElement->getName()) . "</span></li>";
}
$strReturn .= "</ul>";
$strReturn .= "]]></field>";
return $strReturn;
}
示例12: moveImportedFiles
public static function moveImportedFiles($objAccount)
{
global $_CONF, $_PATHS;
$sourceDir = $_PATHS['upload'] . $objAccount->getId() . "/";
if (is_dir($sourceDir)) {
$strServer = Setting::getValueByName('ftp_server', $objAccount->getId());
$strUsername = Setting::getValueByName('ftp_username', $objAccount->getId());
$strPassword = Setting::getValueByName('ftp_password', $objAccount->getId());
$strRemoteFolder = Setting::getValueByName('ftp_remote_folder', $objAccount->getId());
//*** Try to move the files.
$objFtp = new FTP($strServer, NULL, NULL, true);
if ($objFtp->login($strUsername, $strPassword) === true) {
//*** Passive mode.
$objFtp->pasv(true);
if ($objHandle = opendir($sourceDir)) {
while (false !== ($strFile = readdir($objHandle))) {
if ($strFile != "." && $strFile != "..") {
//*** Transfer file.
$objRet = $objFtp->nb_put($strRemoteFolder . $strFile, $sourceDir . $strFile, FTP_BINARY);
while ($objRet == FTP_MOREDATA) {
// Continue uploading...
$objRet = $objFtp->nb_continue();
}
if ($objRet != FTP_FINISHED) {
//*** Something went wrong. Continue without error.
} else {
//*** Remove local file.
@unlink($sourceDir . $strFile);
}
}
}
closedir($objHandle);
}
}
//*** Remove dir if empty.
if (count(scandir($sourceDir)) <= 2) {
rmdir($sourceDir);
}
}
}
示例13: LogError
$objTemplateField = TemplateField::selectByPK($intTemplateFieldId);
if (is_object($objTemplateField)) {
LogError("Template ok");
if ($objTemplateField->getTypeId() == FIELD_TYPE_FILE) {
$objValue = $objTemplateField->getValueByName("tfv_file_extension");
$strExtensions = is_object($objValue) ? $objValue->getValue() : "";
if (!empty($strExtensions)) {
$strExtensions = str_replace("%s", Setting::getValueByName('file_upload_extensions'), $strExtensions);
$strExtensions = str_replace(".", "", $strExtensions);
$arrExtensions = explode(" ", strtolower($strExtensions));
} else {
$strExtensions = str_replace(".", "", strtolower(Setting::getValueByName('file_upload_extensions')));
$arrExtensions = explode(" ", $strExtensions);
}
} else {
$strExtensions = str_replace(".", "", strtolower(Setting::getValueByName('image_upload_extensions')));
$arrExtensions = explode(" ", $strExtensions);
}
$upload_name = "Filedata";
$max_file_size_in_bytes = 2147483647;
// 2GB in bytes
$MAX_FILENAME_LENGTH = 260;
$uploadErrors = array(0 => "There is no error, the file uploaded with success", 1 => "The uploaded file exceeds the upload_max_filesize directive in php.ini", 2 => "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form", 3 => "The uploaded file was only partially uploaded", 4 => "No file was uploaded", 6 => "Missing a temporary folder");
if (!isset($_FILES[$upload_name])) {
HandleError("No upload found in \$_FILES for " . $upload_name);
exit(0);
} else {
if (isset($_FILES[$upload_name]["error"]) && $_FILES[$upload_name]["error"] != 0) {
HandleError($uploadErrors[$_FILES[$upload_name]["error"]]);
exit(0);
} else {
示例14:
?>
<tr>
<td>
</td>
</tr>
</table>
<?php
if ($sf_user->isAnonymous()) {
?>
<div id=mdl1>
<table id=for border="0" cellpadding="0" cellspacing="0">
<tr>
<td class=mdlleft><?php
echo Setting::getValueByName('indexText');
?>
</td>
<td class=mdlright>
<?php
include_component('auth', 'loginForm');
?>
</td><!-- mdllrght end -->
</tr>
</table>
</div><!-- mdl1 end -->
<?php
}
?>
<?php
示例15: url_for
<td class="center">
<a class="contacts" href="<?php
echo url_for('contact');
?>
">Контакты</a>
<a class="catalog" href="<?php
echo url_for('@catalog');
?>
">Каталог статей</a>
</td>
<td class=td><h2>Текст</h2><p class=tr_r>Перевод</p><p class=e2r>С Английского</p></td>
</tr>
</table>
<?php
}
?>
</div><!-- main end -->
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("<?php
echo Setting::getValueByName('googleAnalytics');
?>
");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body>
</html>