本文整理汇总了PHP中xoops_trim函数的典型用法代码示例。如果您正苦于以下问题:PHP xoops_trim函数的具体用法?PHP xoops_trim怎么用?PHP xoops_trim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xoops_trim函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formulaire_upload
/**
* Gestion de l'upload
*/
function formulaire_upload($indice, $dstpath, $destname, $permittedtypes, $maxUploadSize)
{
// global $destname;
//$permittedtypes = array("image/gif","image/pjpeg","image/jpeg","image/x-png") ;
$permittedtypes = $allowed_mimetypes;
if (isset($_POST['xoops_upload_file'])) {
include_once XOOPS_ROOT_PATH . '/class/uploader.php';
if (isset($_FILES[$_POST['xoops_upload_file'][$indice]])) {
$fldname = $_FILES[$_POST['xoops_upload_file'][$indice]];
$fldname = get_magic_quotes_gpc() ? stripslashes($fldname['name']) : $fldname['name'];
if (xoops_trim($fldname != '')) {
$uploader = new XoopsMediaUploader($dstpath, $permittedtypes, $maxUploadSize);
if ($uploader->fetchMedia($_POST['xoops_upload_file'][$indice])) {
if ($uploader->upload()) {
return true;
} else {
echo _ERRORS . ' ' . $uploader->getErrors();
echo "indice :" . $indice . "<br> dstpath :" . $dstpath . "<br> destname :" . $destname . " - " . $uploadDestName . "<br> permittedtypes :" . $permittedtypes[0] . "-" . $permittedtypes[1] . "-" . $permittedtypes[2] . "-" . $permittedtypes[3] . "<br>Max upload file:" . $maxUploadSize;
exit;
}
} else {
echo $uploader->getErrors();
}
}
}
}
return false;
}
示例2: listCart
function listCart()
{
global $xoopsTpl, $uid;
$cartForTemplate = $discountsDescription = array();
$emptyCart = false;
$shippingAmount = $commandAmount = $vatAmount = $commandAmountTTC = $discountsCount = 0;
$goOn = '';
$reductions = new myshop_reductions();
$reductions->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription, $discountsCount);
$myshop_Currency =& myshop_Currency::getInstance();
$xoopsTpl->assign('emptyCart', $emptyCart);
// Empty
$xoopsTpl->assign('caddieProducts', $cartForTemplate);
// Products
$xoopsTpl->assign('shippingAmount', $myshop_Currency->amountForDisplay($shippingAmount));
$xoopsTpl->assign('commandAmount', $myshop_Currency->amountForDisplay($commandAmount));
$xoopsTpl->assign('vatAmount', $myshop_Currency->amountForDisplay($vatAmount));
$xoopsTpl->assign('discountsCount', $discountsCount);
$xoopsTpl->assign('goOn', $goOn);
$xoopsTpl->assign('commandAmountTTC', $myshop_Currency->amountForDisplay($commandAmountTTC, 'l'));
$xoopsTpl->assign('discountsDescription', $discountsDescription);
$showOrderButton = true;
if (xoops_trim(myshop_utils::getModuleOption('paypal_email')) == '' && myshop_utils::getModuleOption('offline_payment') == 0) {
$showOrderButton = false;
}
$showRegistredOnly = false;
if (myshop_utils::getModuleOption('restrict_orders', false) && $uid == 0) {
$showRegistredOnly = true;
$showOrderButton = false;
}
$xoopsTpl->assign('showRegistredOnly', $showRegistredOnly);
$xoopsTpl->assign('showOrderButton', $showOrderButton);
}
示例3: getFormContent
/**
* Renvoie les éléments à ajouter au formulaire en tant que zones cachées
*
* @param integer $commmandId
* @param float $ttc
*/
function getFormContent($commandId, $ttc, $emailClient)
{
global $xoopsConfig;
$ret = array();
$ret['cmd'] = '_xclick';
$ret['upload'] = '1';
$ret['currency_code'] = $this->moneyCode;
$ret['business'] = $this->email;
$ret['return'] = MYSHOP_URL . 'thankyou.php';
// Page (générique) de remerciement après paiement
$ret['image_url'] = XOOPS_URL . '/images/logo.gif';
$ret['cpp_header_image'] = XOOPS_URL . '/images/logo.gif';
$ret['invoice'] = $commandId;
$ret['item_name'] = _MYSHOP_COMMAND . $commandId . ' - ' . $xoopsConfig['sitename'];
$ret['item_number'] = $commandId;
$ret['tax'] = 0;
// ajout 25/03/2008
$ret['amount'] = $this->formatAmount($ttc);
$ret['custom'] = $commandId;
//$ret['rm'] = 2; // Return data by POST (normal)
$ret['email'] = $emailClient;
// paypal_pdt
if (xoops_trim($this->passwordCancel) != '') {
// URL à laquelle le navigateur du client est ramené si le paiement est annulé
$ret['cancel_return'] = MYSHOP_URL . 'cancel-payment.php?id=' . $this->passwordCancel;
}
if ($this->useIpn == 1) {
$ret['notify_url'] = MYSHOP_URL . 'paypal-notify.php';
}
return $ret;
}
示例4: fetch
function fetch()
{
parent::fetch();
$t_queries = array();
$myts =& MyTextSanitizer::getInstance();
if ($this->get('andor') == 'exact' && strlen($this->get('query')) >= $this->_mKeywordMin) {
$this->mQueries[] = $myts->addSlashes($this->get('query'));
} else {
$query = $this->get('query');
if (defined('XOOPS_USE_MULTIBYTES')) {
$query = xoops_trim($query);
}
$separator = '/[\\s,]+/';
if (defined('_MD_LEGACY_FORMAT_SEARCH_SEPARATOR')) {
$separator = _MD_LEGACY_FORMAT_SEARCH_SEPARATOR;
}
$tmpArr = preg_split($separator, $query);
foreach ($tmpArr as $tmp) {
if (strlen($tmp) >= $this->_mKeywordMin) {
$this->mQueries[] = $myts->addSlashes($tmp);
}
}
}
$this->set('query', implode(" ", $this->mQueries));
}
示例5: userCheck
function userCheck($uname, $email, $pass, $vpass)
{
global $myxoopsConfigUser;
$xoopsDB =& Database::getInstance();
$stop = '';
if (!checkEmail($email)) {
$stop .= _US_INVALIDMAIL . '<br />';
}
foreach ($myxoopsConfigUser['bad_emails'] as $be) {
if (!empty($be) && preg_match('/' . $be . '/i', $email)) {
$stop .= _US_INVALIDMAIL . '<br />';
break;
}
}
if (strrpos($email, ' ') > 0) {
$stop .= _US_EMAILNOSPACES . '<br />';
}
$uname = xoops_trim($uname);
$restrictions = array(0 => '/[^a-zA-Z0-9\\_\\-]/', 1 => '/[^a-zA-Z0-9\\_\\-\\<\\>\\,\\.\\$\\%\\#\\@\\!\\\'\\"]/', 2 => '/[\\000-\\040]/');
$restriction = $restrictions[$myxoopsConfigUser['uname_test_level']];
if (empty($uname) || preg_match($restriction, $uname)) {
$stop .= _US_INVALIDNICKNAME . '<br />';
}
if (strlen($uname) > $myxoopsConfigUser['maxuname']) {
$stop .= sprintf(_US_NICKNAMETOOLONG, $myxoopsConfigUser['maxuname']) . '<br />';
}
if (strlen($uname) < $myxoopsConfigUser['minuname']) {
$stop .= sprintf(_US_NICKNAMETOOSHORT, $myxoopsConfigUser['minuname']) . '<br />';
}
foreach ($myxoopsConfigUser['bad_unames'] as $bu) {
if (!empty($bu) && preg_match('/' . $bu . '/i', $uname)) {
$stop .= _US_NAMERESERVED . '<br />';
break;
}
}
if (strrpos($uname, ' ') > 0) {
$stop .= _US_NICKNAMENOSPACES . '<br />';
}
$u_handler =& xoonips_getormhandler('xoonips', 'xoops_users');
$criteria = new Criteria('uname', addslashes($uname));
if ($u_handler->getCount($criteria) > 0) {
$stop .= _US_NICKNAMETAKEN . "<br />";
}
if ($email) {
$criteria = new Criteria('email', addslashes($email));
if ($u_handler->getCount($criteria) > 0) {
$stop .= _US_EMAILTAKEN . "<br />";
}
}
if (!isset($pass) || $pass == '' || !isset($vpass) || $vpass == '') {
$stop .= _US_ENTERPWD . '<br />';
}
if (isset($pass) && $pass != $vpass) {
$stop .= _US_PASSNOTSAME . '<br />';
} elseif ($pass != '' && strlen($pass) < $myxoopsConfigUser['minpass']) {
$stop .= sprintf(_US_PWDTOOSHORT, $myxoopsConfigUser['minpass']) . '<br />';
}
return $stop;
}
示例6: pictureExists
/**
* Indique si l'image de la catégorie existe
*
* @return boolean Vrai si l'image existe sinon faux
*/
public function pictureExists()
{
$return = false;
if (xoops_trim($this->getVar('payment_image')) != '' && file_exists(OLEDRION_PICTURES_PATH . DIRECTORY_SEPARATOR . $this->getVar('payment_image'))) {
$return = true;
}
return $return;
}
示例7: pictureExists
/**
* Display if category image exists
*
* @return boolean
*/
function pictureExists()
{
$return = false;
if (xoops_trim($this->getVar('cat_imgurl')) != '' && file_exists(MYSHOP_PICTURES_PATH . DIRECTORY_SEPARATOR . $this->getVar('cat_imgurl'))) {
$return = true;
}
return $return;
}
示例8: getOption
/**
* Retourne une option de l'attribut
*
* @param string $valueToGet
* @param string $format
* @return array
* @since 2.3.2009.03.11
*/
function getOption($valueToGet, $format = 'e')
{
$names = array();
if (xoops_trim($this->getVar($valueToGet, $format)) != '') {
$names = explode(OLEDRION_ATTRIBUTE_SEPARATOR, $this->getVar($valueToGet, $format));
}
return $names;
}
示例9: getCurrentGateway
/**
* Retourne la passerelle de paiement en cours d'utilisation
*
* @return string Le nom de la passerelle de paiement (en fait le nom de son répertoire)
*/
function getCurrentGateway()
{
$return = xoops_trim(oledrion_utils::getModuleOption('used_gateway'));
if ($return == '') {
$return = 'paypal';
// Valeur par défaut
}
return $return;
}
示例10: giveMimetype
function giveMimetype($filename = '')
{
$cmimetype = new cmimetype();
$workingfile = $this->downloadname;
if (xoops_trim($filename) != '') {
$workingfile = $filename;
return $cmimetype->getType($workingfile);
} else {
return '';
}
}
示例11: pictureExists
/**
* Indique si une des 5 images du fabricant existe
*
* @param integer $pictureNumber Le numéro (de 1 à 5) de l'image que l'on souhaite récupérer
* @return boolean Vrai si l'image existe sinon faux
*/
public function pictureExists($pictureNumber)
{
$pictureNumber = intval($pictureNumber);
$return = false;
if ($pictureNumber > 0 && $pictureNumber < 6) {
if (xoops_trim($this->getVar('manu_photo' . $pictureNumber)) != '' && file_exists(OLEDRION_PICTURES_PATH . DIRECTORY_SEPARATOR . $this->getVar('manu_photo' . $pictureNumber))) {
$return = true;
}
}
return $return;
}
示例12: saveParametersForm
function saveParametersForm($data)
{
if (xoops_trim($this->languageFilename) != '' && file_exists($this->languageFilename)) {
require $this->languageFilename;
}
$gatewayName = $this->gatewayInformation['foldername'];
$this->handlers->h_oledrion_gateways_options->deleteGatewayOptions($gatewayName);
if (!$this->handlers->h_oledrion_gateways_options->setGatewayOptionValue($gatewayName, 'parsian_mid', $data['parsian_mid'])) {
return false;
}
return true;
}
示例13: addkeywords
/**
* Add one or many keywords
*/
function addkeywords($keyword)
{
$myts =& MyTextSanitizer::getInstance();
if (is_array($keyword)) {
foreach ($keyword as $onekeyword) {
$onekeyword = xoops_trim($myts->htmlSpecialChars($onekeyword));
$this->keywords[$onekeyword] = $onekeyword;
}
} else {
$keyword = xoops_trim($myts->htmlSpecialChars($keyword));
$this->keywords[$keyword] = $keyword;
}
}
示例14: b_marquee_mydownloads
function b_marquee_mydownloads($limit, $dateformat, $itemssize)
{
include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php';
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
$block = array();
$myts =& MyTextSanitizer::getInstance();
$db =& Database::getInstance();
$result = $db->query("SELECT m.lid, m.cid, m.title, m.date, m.hits, m.submitter, c.title as catitle, u.name, u.uname FROM " . $db->prefix("mydownloads_downloads") . " m, " . $db->prefix("mydownloads_cat") . " c, " . $db->prefix("users") . " u WHERE (c.cid=m.cid) AND (m.submitter=u.uid) AND (m.status>0) ORDER BY m.date DESC", $limit, 0);
while ($myrow = $db->fetchArray($result)) {
$title = $myts->htmlSpecialChars($myrow["title"]);
if ($itemssize > 0) {
$title = xoops_substr($title, 0, $itemssize + 3);
}
$author = $myts->htmlSpecialChars($myrow["uname"]);
if (xoops_trim($myrow["catitle"]) != '') {
$author = $myts->htmlSpecialChars($myrow["name"]);
}
$category = $myts->htmlSpecialChars($myrow["catitle"]);
$block[] = array('date' => formatTimestamp($myrow['date'], $dateformat), 'category' => $category, 'author' => $author, 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/mydownloads/singlefile.php?cid=' . $myrow['cid'] . "&lid=" . $myrow['lid'] . "'>" . $title . '</a>');
}
return $block;
}
示例15: grabEntries
function grabEntries(&$obj)
{
$ret = false;
include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
$items = $h_oledrion_products->getRecentProducts(new oledrion_parameters(array('start' => 0, 'limit' => $this->grab)));
$i = 0;
if (false != $items && count($items) > 0) {
foreach ($items as $item) {
$ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink();
$ret[$i]['title'] = $item->getVar('product_title', 'n');
$ret[$i]['timestamp'] = $item->getVar('product_submitted');
if (xoops_trim($item->getVar('product_summary')) != '') {
$description = $item->getVar('product_summary');
} else {
$description = $item->getVar('product_description');
}
$ret[$i]['description'] = $description;
$ret[$i]['category'] = $this->modname;
$ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/';
$i++;
}
}
return $ret;
}