当前位置: 首页>>代码示例>>PHP>>正文


PHP JString::trim方法代码示例

本文整理汇总了PHP中JString::trim方法的典型用法代码示例。如果您正苦于以下问题:PHP JString::trim方法的具体用法?PHP JString::trim怎么用?PHP JString::trim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JString的用法示例。


在下文中一共展示了JString::trim方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->app = JFactory::getApplication();
     // Get project id.
     $this->projectId = $this->input->getUint('pid');
     // Prepare log object
     $registry = Joomla\Registry\Registry::getInstance('com_crowdfunding');
     /** @var  $registry Joomla\Registry\Registry */
     $fileName = $registry->get('logger.file');
     $tableName = $registry->get('logger.table');
     $file = JPath::clean($this->app->get('log_path') . DIRECTORY_SEPARATOR . $fileName);
     $this->log = new Prism\Log\Log();
     $this->log->addAdapter(new Prism\Log\Adapter\Database(JFactory::getDbo(), $tableName));
     $this->log->addAdapter(new Prism\Log\Adapter\File($file));
     // Create an object that contains a data used during the payment process.
     $this->paymentProcessContext = Crowdfunding\Constants::PAYMENT_SESSION_CONTEXT . $this->projectId;
     $this->paymentProcess = $this->app->getUserState($this->paymentProcessContext);
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = JString::trim(JString::strtolower($this->input->getCmd('payment_service')));
     $paymentService = $filter->clean($paymentService, 'ALNUM');
     $this->context = JString::strlen($paymentService) > 0 ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams('com_crowdfunding');
 }
开发者ID:bellodox,项目名称:CrowdFunding,代码行数:26,代码来源:notifier.raw.php

示例2: _loadData

 /**
  * Parse CBR XML
  * TODO: Sometimes SimpleXML doesn't work, so we used preg_matches
  * @param null $currency
  * @return array|void
  */
 public function _loadData($currency = null)
 {
     if (is_null($this->_curList)) {
         $this->_curList = array();
         $params = array();
         if ((int) $this->config->get('force_date', 1)) {
             $params['date_req'] = date("d/m/Y");
         }
         $xmlString = $this->_loadUrl($this->_apiUrl, $params);
         if (empty($xmlString)) {
             $xmlString = $this->app->jbhttp->url($this->_apiUrl, $params);
             // anti ban
         }
         if (empty($xmlString)) {
             return $this->_curList;
         }
         $xmlString = JString::trim(iconv("WINDOWS-1251", "UTF-8//TRANSLIT", $xmlString));
         preg_match_all('#<Valute(.*?)<\\/Valute>#ius', $xmlString, $out);
         if (!empty($out) && isset($out[1])) {
             foreach ($out[1] as $row) {
                 preg_match("#<Value>(.*?)</Value>#ius", $row, $value);
                 preg_match("#<CharCode>(.*?)</CharCode>#ius", $row, $code);
                 preg_match("#<Nominal>(.*?)</Nominal>#ius", $row, $nominal);
                 $value = $this->_jbmoney->clearValue($value[1]);
                 $nominal = trim(strtolower($nominal[1]));
                 $code = trim(strtolower($code[1]));
                 $this->_curList[$code] = $value / $nominal;
             }
             $this->_curList['rub'] = 1;
         }
         $this->_curList = $this->_normToDefault($this->_curList);
     }
     return $this->_curList;
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:40,代码来源:cbr.php

示例3: render

 /**
  * @param array $params
  * @return array|mixed|null|string
  */
 public function render($params = array())
 {
     if (!$this->hasValue($params)) {
         return $this->renderWrapper();
     }
     $prices = $this->getPrices();
     $discount = JBCart::val();
     $curList = $discount->getCurList();
     if ($prices['save']->isNegative()) {
         $discount->set($prices['save']->val(), $prices['save']->cur());
     }
     /** @type JBCartValue $total */
     $total = $prices['total'];
     $message = JText::_(JString::trim($params->get('empty_text', '')));
     $layout = $params->get('layout', 'full-div');
     if ($total->isEmpty() && !empty($message)) {
         $layout = 'empty';
     }
     if ($layout == 'totla-cur' && isset($curList[$total->cur()])) {
         unset($curList[$total->cur()]);
     }
     unset($curList[JBCartValue::DEFAULT_CODE]);
     if ($layout = $this->getLayout($layout . '.php')) {
         return $this->renderLayout($layout, array('total' => $total, 'price' => $prices['price'], 'save' => $prices['save']->abs(true), 'discount' => $discount->abs(), 'currency' => $this->currency(), 'curList' => $curList, 'message' => $message));
     }
     return null;
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:31,代码来源:value.php

示例4: display

 public function display($tpl = null)
 {
     // Initialise variables
     $mainframe = JFactory::getApplication();
     $tagId = JRequest::getVar('tagid', '');
     $tag = JTable::getInstance('Tags', 'Discuss');
     $tag->load($tagId);
     $tag->title = JString::trim($tag->title);
     $tag->alias = JString::trim($tag->alias);
     $this->tag = $tag;
     // Generate All tags for merging selections
     $tagsModel = $this->getModel('Tags');
     $tags = $tagsModel->getData(false);
     $tagList = array();
     array_push($tagList, JHTML::_('select.option', 0, 'Select tag', 'value', 'text', false));
     if (!empty($tags)) {
         foreach ($tags as $item) {
             if ($item->id != $tagId) {
                 $tagList[] = JHtml::_('select.option', $item->id, $item->title);
             }
         }
     }
     // Set default values for new entries.
     if (empty($tag->created)) {
         $date = DiscussHelper::getDate();
         $date->setOffSet($mainframe->getCfg('offset'));
         $tag->created = $date->toFormat();
         $tag->published = true;
     }
     $this->assignRef('tag', $tag);
     $this->assignRef('tagList', $tagList);
     parent::display($tpl);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:33,代码来源:view.html.php

示例5: check

 function check()
 {
     //initialize
     $this->_error = null;
     $this->oldurl = JString::trim($this->oldurl);
     $this->newurl = JString::trim($this->newurl);
     // check for valid URLs
     if ($this->oldurl == '' || $this->newurl == '') {
         $this->_error .= JTExt::_('COM_SH404SEF_EMPTYURL');
         return false;
     }
     if (JString::substr($this->oldurl, 0, 1) == '/') {
         $this->_error .= JText::_('COM_SH404SEF_NOLEADSLASH');
     }
     if (JString::substr($this->newurl, 0, 9) != 'index.php') {
         $this->_error .= JText::_('COM_SH404SEF_BADURL');
     }
     // V 1.2.4.t remove this check. We check for pre-existing non-sef instead of SEF
     if (is_null($this->_error)) {
         // check for existing URLS
         $this->_db->setQuery("SELECT id,oldurl FROM #__sh404sef_urls WHERE `newurl` LIKE " . $this->_db->Quote($this->newurl));
         $xid = $this->_db->loadObject();
         // V 1.3.1 don't raise error if both newurl and old url are same. It means we may have changed alias list
         if ($xid && $xid->id != intval($this->id)) {
             $this->_error = JText::_('COM_SH404SEF_URLEXIST');
             return false;
         }
         $identical = $xid->id == intval($this->id) && $xid->oldurl == $this->oldurl;
         return $identical ? 'identical' : true;
     } else {
         return false;
     }
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:33,代码来源:shMosSEF.class.php

示例6: check

 function check()
 {
     //initialize
     $this->_error = null;
     $this->newurl = JString::trim($this->newurl);
     $this->metadesc = JString::trim($this->metadesc);
     $this->metakey = JString::trim($this->metakey);
     $this->metatitle = JString::trim($this->metatitle);
     $this->metalang = JString::trim($this->metalang);
     $this->metarobots = JString::trim($this->metarobots);
     // check for valid URLs
     if ($this->newurl == '') {
         $this->_error .= COM_SH404SEF_EMPTYURL;
         return false;
     }
     if (substr($this->newurl, 0, 9) != 'index.php') {
         $this->_error .= COM_SH404SEF_BADURL;
     }
     if (is_null($this->_error)) {
         // check for existing URLS
         $this->_db->setQuery("SELECT id FROM #__sh404SEF_meta WHERE `newurl` LIKE " . $this->_db->Quote($this->newurl));
         $xid = intval($this->_db->loadResult());
         if ($xid && $xid != intval($this->id)) {
             $this->_error = COM_SH404SEF_URLEXIST;
             return false;
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:31,代码来源:sh404SEFMeta.class.php

示例7: check

 public function check()
 {
     //initialize
     $this->oldurl = JString::trim($this->oldurl);
     $this->newurl = JString::trim($this->newurl);
     // check for valid URLs
     if ($this->oldurl == '' || $this->newurl == '') {
         $this->setError(COM_SH404SEF_EMPTYURL);
         return false;
     }
     if (JString::substr($this->oldurl, 0, 1) == '/') {
         $this->setError(COM_SH404SEF_NOLEADSLASH);
         return false;
     }
     if (JString::substr($this->newurl, 0, 9) != 'index.php') {
         $this->setError(COM_SH404SEF_BADURL);
         return false;
     }
     // check for pre-existing non-sef
     $this->_db->setQuery('SELECT id, oldurl FROM #__redirection WHERE `newurl` LIKE ' . $this->_db->Quote($this->newurl));
     $xid = $this->_db->loadObject();
     // raise error if we found a record with the same non-sef url
     // but don't if both newurl and old url are same. It means we may have changed alias list
     if ($xid && $xid->id != intval($this->id)) {
         $this->setError(COM_SH404SEF_URLEXIST);
         return false;
     }
     return true;
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:29,代码来源:urls.php

示例8: setQueryConditions

    private function setQueryConditions(&$query)
    {
        $db = $this->getDBO();
        if (is_numeric($this->getState('state'))) {
            $query->where($db->quoteName('extraField.state') . ' = ' . (int) $this->getState('state'));
        }
        if ($this->getState('id')) {
            $id = $this->getState('id');
            if (is_array($id)) {
                JArrayHelper::toInteger($id);
                $query->where($db->quoteName('extraField.id') . ' IN ' . $id);
            } else {
                $query->where($db->quoteName('extraField.id') . ' = ' . (int) $id);
            }
        }
        if ($this->getState('group')) {
            $query->where($db->quoteName('extraField.group') . ' = ' . (int) $this->getState('group'));
        }
        if ($this->getState('type')) {
            $query->where($db->quoteName('extraField.type') . ' = ' . $db->quote($this->getState('type')));
        }
        if ($this->getState('search')) {
            $search = JString::trim($this->getState('search'));
            $search = JString::strtolower($search);
            if ($search) {
                $search = $db->escape($search, true);
                $query->where('( LOWER(' . $db->quoteName('extraField.name') . ') LIKE ' . $db->Quote('%' . $search . '%', false) . ' 
				OR ' . $db->quoteName('extraField.id') . ' = ' . (int) $search . ')');
            }
        }
    }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:31,代码来源:extrafields.php

示例9: check

 function check()
 {
     // Check name
     $this->name = JString::trim($this->name);
     if (empty($this->name)) {
         $this->setError(JText::_('NOTICE_MISSING_NAME'));
         return false;
     }
     // Check html
     $this->htmltext = trim($this->htmltext);
     $this->htmlsmall = trim($this->htmlsmall);
     $this->htmllarge = trim($this->htmllarge);
     $this->htmlbutton = trim($this->htmlbutton);
     $this->htmlcustom = trim($this->htmlcustom);
     $defSize = 'html' . $this->size;
     if (empty($this->{$defSize})) {
         $this->setError(JText::_('NOTICE_MISSING_HTML'));
         return false;
     }
     $this->popular = $this->popular ? 1 : 0;
     $this->text = JString::trim($this->text);
     if (empty($this->text)) {
         $this->text = $this->name;
     }
     return true;
 }
开发者ID:jtresca,项目名称:nysurveyor,代码行数:26,代码来源:bookmark.php

示例10: changepassword

 function changepassword()
 {
     $mainframe = JFactory::getApplication();
     $return = JRequest::getVar('return', 0);
     $return = base64_decode($return);
     $user_data = $_POST;
     if ($user_data['password'] == $user_data['password2']) {
         $user = JFactory::getUser();
         $salt = JUserHelper::genRandomPassword(32);
         $crypt = JUserHelper::getCryptedPassword(JString::trim($user_data['password']), $salt);
         $password = $crypt . ':' . $salt;
         $user->set('password', $password);
         if ($user->save()) {
             $mainframe->enqueueMessage(JText::_('Successfully saved'), 'message');
         }
     } else {
         JError::raiseWarning('', JText::_(' Passwords do not match. Please re-enter password.'));
     }
     $config = JBFactory::getConfig();
     if ($return) {
         $this->setRedirect($return);
     } else {
         $this->setRedirect('index.php?option=com_bookpro&view=account&form=password&Itemid=' . JRequest::getVar('Itemid'));
     }
 }
开发者ID:hixbotay,项目名称:executivetransport,代码行数:25,代码来源:customer.php

示例11: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     try {
         /* get template assigned */
         $this->_template = JSNTemplateModel::getDefaultTemplate();
         /* get template mainfet*/
         $client = JApplicationHelper::getClientInfo($this->_template->client_id);
         @($this->_template->xml = new SimpleXMLElement($client->path . '/templates/' . $this->_template->element . '/templateDetails.xml', null, true));
         /* get author template */
         $author = JString::trim(JString::strtolower($this->_template->xml->author));
         if (!$author) {
             $author = JString::trim(JString::strtolower($this->_template->xml->authorEmail));
             if ($author) {
                 @(list($eName, $eHost) = explode('@', $author));
                 @(list($this->_author, $dotCom) = explode('.', $author));
             }
         } else {
             @(list($this->_author, $dotCom) = explode('.', $author));
         }
         if (empty($this->_author)) {
             $this->_author = 'default';
         }
         switch ($this->_author) {
             case 'joomagic':
                 // An template using T3 Framework
                 $this->_author = 'joomlart';
                 break;
         }
     } catch (Exception $e) {
         throw new Exception(JText::_('JSN_EXTFW_NOTICE_SITE_TEMPLATE_NOT_SET'));
     }
 }
开发者ID:NallelyFlores89,项目名称:basvec,代码行数:35,代码来源:helper.php

示例12: getRedirectUrl

 /**
  * @return null|string
  */
 public function getRedirectUrl()
 {
     if ($url = JString::trim($this->config->get('redirect_url'))) {
         return $url;
     }
     return null;
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:10,代码来源:manual.php

示例13: check

 public function check()
 {
     if (JString::trim($this->name) == '') {
         $this->setError(JText::_('K2_TAG_MUST_HAVE_A_NAME'));
         return false;
     }
     $this->normalize();
     $this->alias = $this->name;
     if (JFactory::getConfig()->get('unicodeslugs') == 1) {
         $this->alias = JFilterOutput::stringURLUnicodeSlug($this->alias);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
     }
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     $query->select($db->quoteName('id'))->from($db->quoteName('#__k2_tags'))->where($db->quoteName('alias') . ' = ' . $db->quote($this->alias));
     if ($this->id) {
         $query->where($db->quoteName('id') . ' != ' . (int) $this->id);
     }
     $db->setQuery($query);
     if ($db->loadResult()) {
         $this->alias .= '-' . uniqid();
     }
     return true;
 }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:25,代码来源:tags.php

示例14: getCategoriesTree

 function getCategoriesTree()
 {
     $db = JFactory::getDBO();
     $this->setState('published', -1);
     $this->setState('trash', -1);
     $this->setState('ordering', 'category.parent, category.ordering');
     $this->setState('orderingDir', '');
     $rows = $this->getData();
     $children = array();
     if ($rows) {
         foreach ($rows as $row) {
             $row->title = $row->name;
             $row->parent_id = $row->parent;
             $index = $row->parent;
             $list = @$children[$index] ? $children[$index] : array();
             array_push($list, $row);
             $children[$index] = $list;
         }
     }
     $categories = JHTML::_('menu.treerecurse', isset($rows[0]->parent) ? $rows[0]->parent : 0, '', array(), $children, 9999, 0, 0);
     foreach ($categories as $category) {
         $category->treename = JString::trim($category->treename);
         $category->treename = JString::str_ireplace('&#160;&#160;', '- ', $category->treename);
         $category->treename = JString::str_ireplace('- ', ' ', $category->treename, 1);
     }
     return $categories;
 }
开发者ID:Gskflute,项目名称:joomla25,代码行数:27,代码来源:categories.php

示例15: getEventcategoryHTML

 function getEventcategoryHTML($name, $value, $control_name = 'params', $reqnone = false, $reqall = false)
 {
     $required = '1';
     $html = '';
     $class = $required == 1 ? ' required' : '';
     $options = $this->getEventcategory();
     $html .= '<select id="' . $control_name . '[' . $name . ']" name="' . $control_name . '[' . $name . ']" title="' . "Select Group Category" . '">';
     if ($reqall) {
         $selected = JString::trim(0) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . 0 . '"' . $selected . '>' . XiptText::_("ALL") . '</option>';
     }
     if ($reqnone) {
         $selected = JString::trim(-1) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . -1 . '"' . $selected . '>' . XiptText::_("NONE") . '</option>';
     }
     foreach ($options as $op) {
         $option = $op->name;
         $id = $op->id;
         $selected = JString::trim($id) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . $id . '"' . $selected . '>' . $option . '</option>';
     }
     $html .= '</select>';
     $html .= '<span id="errprofiletypemsg" style="display: none;">&nbsp;</span>';
     return $html;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:25,代码来源:eventcategory.php


注:本文中的JString::trim方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。