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


PHP StringUtils类代码示例

本文整理汇总了PHP中StringUtils的典型用法代码示例。如果您正苦于以下问题:PHP StringUtils类的具体用法?PHP StringUtils怎么用?PHP StringUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: _xmodule

 protected function _xmodule()
 {
     $str = StringUtils::l("{% begin contents %}");
     if (!empty($this->js)) {
         $str .= StringUtils::l('<script type="text/javascript">');
         $str .= StringUtils::l();
         if (!self::$printedFieldClasses) {
             $str .= StringUtils::l($this->_buildFieldClasses());
             self::$printedFieldClasses = true;
         }
         $str .= StringUtils::l();
         $str .= StringUtils::l('    $(document).ready(function() {');
         $str .= StringUtils::l();
         foreach ((array) $this->js as $line) {
             $str .= StringUtils::l($line);
         }
         $str .= StringUtils::l();
         $str .= StringUtils::l('    });');
         $str .= StringUtils::l();
         $str .= StringUtils::l('</script>');
     }
     if (!empty($this->xhtml)) {
         foreach ((array) $this->xhtml as $line) {
             $str .= StringUtils::l($line);
         }
     }
     $str .= StringUtils::l("{% end %}");
     return $str;
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:29,代码来源:EditCmsBuilder.php

示例2: select

 /**
  * @name select($pId)
  * @param integer
  * @return AdherentSoldeVO
  * @desc Récupère la ligne correspondant à l'id en paramètre, créé un AdherentVO contenant les informations et le renvoie
  */
 public static function select($pId)
 {
     // Initialisation du Logger
     $lLogger =& Log::singleton('file', CHEMIN_FICHIER_LOGS);
     $lLogger->setMask(Log::MAX(LOG_LEVEL));
     $lRequete = "SELECT " . AdherentManager::CHAMP_ADHERENT_NUMERO . "," . AdherentManager::CHAMP_ADHERENT_ID_COMPTE . "," . AdherentManager::CHAMP_ADHERENT_NOM . "," . AdherentManager::CHAMP_ADHERENT_PRENOM . "," . AdherentManager::CHAMP_ADHERENT_COURRIEL_PRINCIPAL . "," . AdherentManager::CHAMP_ADHERENT_COURRIEL_SECONDAIRE . "," . AdherentManager::CHAMP_ADHERENT_TELEPHONE_PRINCIPAL . "," . AdherentManager::CHAMP_ADHERENT_TELEPHONE_SECONDAIRE . "," . AdherentManager::CHAMP_ADHERENT_ADRESSE . "," . AdherentManager::CHAMP_ADHERENT_CODE_POSTAL . "," . AdherentManager::CHAMP_ADHERENT_VILLE . "," . AdherentManager::CHAMP_ADHERENT_DATE_NAISSANCE . "," . AdherentManager::CHAMP_ADHERENT_DATE_ADHESION . "," . AdherentManager::CHAMP_ADHERENT_DATE_MAJ . "," . AdherentManager::CHAMP_ADHERENT_COMMENTAIRE . " \n\t\t\t\t\tFROM " . AdherentManager::TABLE_ADHERENT . " \n\t\t\t\t\tWHERE " . AdherentManager::CHAMP_ADHERENT_ID . " = '" . StringUtils::securiser($pId) . "'";
     $lLogger->log("Execution de la requete : " . $lRequete, PEAR_LOG_DEBUG);
     // Maj des logs
     $lSql = Dbutils::executerRequete($lRequete);
     if (mysql_num_rows($lSql) > 0) {
         $lLigne = mysql_fetch_assoc($lSql);
         $lAdherent = AdherentSoldeManager::remplirAdherent($pId, $lLigne[AdherentManager::CHAMP_ADHERENT_NUMERO], $lLigne[AdherentManager::CHAMP_ADHERENT_ID_COMPTE], $lLigne[AdherentManager::CHAMP_ADHERENT_NOM], $lLigne[AdherentManager::CHAMP_ADHERENT_PRENOM], $lLigne[AdherentManager::CHAMP_ADHERENT_COURRIEL_PRINCIPAL], $lLigne[AdherentManager::CHAMP_ADHERENT_COURRIEL_SECONDAIRE], $lLigne[AdherentManager::CHAMP_ADHERENT_TELEPHONE_PRINCIPAL], $lLigne[AdherentManager::CHAMP_ADHERENT_TELEPHONE_SECONDAIRE], $lLigne[AdherentManager::CHAMP_ADHERENT_ADRESSE], $lLigne[AdherentManager::CHAMP_ADHERENT_CODE_POSTAL], $lLigne[AdherentManager::CHAMP_ADHERENT_VILLE], $lLigne[AdherentManager::CHAMP_ADHERENT_DATE_NAISSANCE], $lLigne[AdherentManager::CHAMP_ADHERENT_DATE_ADHESION], $lLigne[AdherentManager::CHAMP_ADHERENT_DATE_MAJ], $lLigne[AdherentManager::CHAMP_ADHERENT_COMMENTAIRE]);
         // Ajout des modules d'accés
         $lListeAutorisation = AutorisationManager::selectByIdAdherent($lAdherent->getId());
         $lListeModuleAll = ModuleManager::selectAll();
         $lListeModule = array();
         foreach ($lListeAutorisation as $lAutorisation) {
             if ($lListeModuleAll[$lAutorisation->getIdModule()] === NULL) {
                 $lListeModuleAll[$lAutorisation->getIdModule()] = new ModuleVO();
             }
             array_push($lListeModule, $lListeModuleAll[$lAutorisation->getIdModule()]);
         }
         $lAdherent->setListeModule($lListeModule);
         return $lAdherent;
     } else {
         return new AdherentSoldeVO();
     }
 }
开发者ID:google-code-backups,项目名称:zeybux,代码行数:34,代码来源:xxx-AdherentSoldeManager.php

示例3: asVarName

 public static function asVarName($input)
 {
     $input = StringUtils::toAlphaNum($input, array('-', '_', '.', ':'));
     $input = self::camelize($input);
     $input[0] = strtolower($input[0]);
     return $input;
 }
开发者ID:payin7-payments,项目名称:payin7-prestashop,代码行数:7,代码来源:inflector.php

示例4: Render

 public function Render()
 {
     include_once 'libs/smartylibs/Smarty.class.php';
     $smarty = new Smarty();
     $smarty->template_dir = 'components/templates';
     $smarty->assign_by_ref('Page', $this);
     $users = $this->tableBasedGrantsManager->GetAllUsersAsJson();
     $smarty->assign_by_ref('Users', $users);
     $localizerCaptions = $this->GetLocalizerCaptions();
     $smarty->assign_by_ref('Captions', $localizerCaptions);
     /* $roles = $this->tableBasedGrantsManager->GetAllRolesAsJson();
        $smarty->assign_by_ref('Roles', $roles); */
     $headerString = 'Content-Type: text/html';
     if ($this->GetContentEncoding() != null) {
         StringUtils::AddStr($headerString, 'charset=' . $this->GetContentEncoding(), ';');
     }
     header($headerString);
     $pageInfos = GetPageInfos();
     $pageListViewData = array('Pages' => array(), 'CurrentPageOptions' => array());
     foreach ($pageInfos as $pageInfo) {
         $pageListViewData['Pages'][] = array('Caption' => $this->RenderText($pageInfo['caption']), 'Hint' => $this->RenderText($pageInfo['short_caption']), 'Href' => $pageInfo['filename'], 'GroupName' => $this->RenderText($pageInfo['group_name']), 'BeginNewGroup' => $pageInfo['add_separator']);
     }
     $pageGroups = GetPageGroups();
     foreach ($pageGroups as &$pageGroup) {
         $pageGroup = $this->RenderText($pageGroup);
     }
     $pageListViewData['Groups'] = $pageGroups;
     $smarty->assign_by_ref('PageList', $pageListViewData);
     $authenticationViewData = $this->GetAuthenticationViewData();
     $smarty->assign_by_ref('Authentication', $authenticationViewData);
     $smarty->display('admin_panel.tpl');
 }
开发者ID:BCDevExchange,项目名称:WORKPLAN,代码行数:32,代码来源:phpgen_admin.php

示例5: formatLogEntry

 static function formatLogEntry($type, $action, $title, $sk, $parameters)
 {
     $msg = "lqt-log-action-{$action}";
     switch ($action) {
         case 'merge':
             if ($parameters[0]) {
                 $msg = 'lqt-log-action-merge-across';
             } else {
                 $msg = 'lqt-log-action-merge-down';
             }
             break;
         case 'move':
             $smt = new SpecialMoveThread();
             $rightsCheck = $smt->checkUserRights($parameters[1] instanceof Title ? $parameters[1] : Title::newFromText($parameters[1]), $parameters[0] instanceof Title ? $parameters[0] : Title::newFromText($parameters[0]));
             if ($rightsCheck === true) {
                 $parameters[] = Message::rawParam(Linker::link(SpecialPage::getTitleFor('MoveThread', $title), wfMessage('revertmove')->text(), array(), array('dest' => $parameters[0])));
             } else {
                 $parameters[] = '';
             }
             break;
         default:
             // Give grep a chance to find the usages:
             // lqt-log-action-move, lqt-log-action-split, lqt-log-action-subjectedit,
             // lqt-log-action-resort, lqt-log-action-signatureedit
             $msg = "lqt-log-action-{$action}";
             break;
     }
     array_unshift($parameters, $title->getPrefixedText());
     $html = wfMessage($msg, $parameters);
     if ($sk === null) {
         return StringUtils::delimiterReplace('<', '>', '', $html->inContentLanguage()->parse());
     }
     return $html->parse();
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:34,代码来源:LogFormatter.php

示例6: getPageContent

 public function getPageContent()
 {
     $template = $this->getTemplateEngine()->readTemplate($this->getTemplate());
     $products = $this->getModel()->getProducts();
     $sum = 0;
     $visible = CSS::HIDDEN;
     $empty = "";
     $productsTpl = "";
     if (count($products) > 0) {
         $visible = "";
         $empty = CSS::HIDDEN;
         $engine = $tpl = $this->getTemplateEngine();
         foreach ($products as $product) {
             $tpl = $engine->readTemplate(Template::CART_PRODUCT);
             $tpl = $engine->replaceTag("classification", $product->getClassification(), $tpl);
             $tpl = $engine->replaceTag("type", $product->getType(), $tpl);
             $tpl = $engine->replaceTag("imgname", $product->getImgname(), $tpl);
             $tpl = $engine->replaceTag("id", $product->getId(), $tpl);
             $tpl = $engine->replaceTag("name", $product->getName(), $tpl);
             $tpl = $engine->replaceTag("optionsList", StringUtils::arrangeOptions($product->getProperties()), $tpl);
             $tpl = $engine->replaceTag("price", StringUtils::formatAmount($product->getPrice()), $tpl);
             $sum += $product->getPrice();
             $productsTpl .= $tpl;
         }
     }
     $template = $this->getTemplateEngine()->replaceTag("empty", $empty, $template);
     $template = $this->getTemplateEngine()->replaceTag("visible", $visible, $template);
     $template = $this->getTemplateEngine()->replaceTag("productrows", $productsTpl, $template);
     $template = $this->getTemplateEngine()->replaceTag("total", StringUtils::formatAmount($sum), $template);
     return $template;
 }
开发者ID:webel3,项目名称:ch.bfh.bti7054.w2014.q.wew,代码行数:31,代码来源:CartView.php

示例7: onAddCommentsFormDiv

/**
 * adding the flag table to the comments form
 *
 * @global SFFormPrinter $sfgFormPrinter from SMW
 * @global Article $wgArticle
 * @param String $sHtml
 * @return boolean
 */
function onAddCommentsFormDiv(&$sHtml)
{
    global $sfgFormPrinter, $wgArticle, $webplatformSectionCommentsSMW;
    $sHtml .= '<a id="comments-flag-link">' . wfMessage('comments-flag-link')->text() . '</a>';
    $sHtml .= '<div id="comment-flags">';
    $sFormName = $webplatformSectionCommentsSMW['form'];
    //$sPageName = 'Comments';
    $oTitle = Title::newFromText($sFormName, SF_NS_FORM);
    $oArticle = new Article($oTitle, 0);
    $sFormDefinition = $oArticle->getContent();
    $sFormDefinition = StringUtils::delimiterReplace('<noinclude>', '</noinclude>', '', $sFormDefinition);
    $aHtml = $sfgFormPrinter->formHTML($sFormDefinition, false, true, $oTitle->getArticleID(), $wgArticle->fetchContent());
    //, $wgArticle->getTitle()->getArticleID(), $wgArticle->fetchContent(), $wgArticle->getTitle()->getText(), null );
    $aMatches = array();
    preg_match_all('#<table.*?</table>#is', $aHtml[0], $aMatches);
    $index = null;
    foreach ($aMatches[0] as $key => $value) {
        $bPos = strrpos($value, $webplatformSectionCommentsSMW['template'] . '[');
        if ($bPos !== false) {
            $index = $key;
            break;
        }
    }
    $sHtml .= $aMatches[0][$index];
    $sHtml .= '</div>';
    return true;
}
开发者ID:renoirb,项目名称:mediawiki-1,代码行数:35,代码来源:SectionComments.php

示例8: formatLogEntry

 static function formatLogEntry($type, $action, $title, $sk, $parameters)
 {
     switch ($action) {
         case 'merge':
             if ($parameters[0]) {
                 $msg = 'lqt-log-action-merge-across';
             } else {
                 $msg = 'lqt-log-action-merge-down';
             }
             break;
         default:
             $msg = 'lqt-log-action-' . $action;
             break;
     }
     $options = array('parseinline');
     $forIRC = $sk === null;
     if ($forIRC) {
         global $wgContLang;
         $options['language'] = $wgContLang->getCode();
     }
     $replacements = array_merge(array($title->getPrefixedText()), $parameters);
     $html = wfMsgExt($msg, $options, $replacements);
     if ($forIRC) {
         $html = StringUtils::delimiterReplace('<', '>', '', $html);
     }
     return $html;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:27,代码来源:LogFormatter.php

示例9: testEndsWith

 /**
  * Test for Schwaen\Stdlib\StringUtils::endsWith
  */
 public function testEndsWith()
 {
     $this->assertEquals(false, StringUtils::endsWith('Hallo Welt', 'welt'));
     $this->assertEquals(true, StringUtils::endsWith('Hallo Welt', 'Welt'));
     $this->assertEquals(false, StringUtils::endsWith('Hallo Welt', 'Test'));
     $this->assertEquals(true, StringUtils::endsWith('Hallo Welt', ''));
 }
开发者ID:schwaen,项目名称:stdlib,代码行数:10,代码来源:StringUtilsTest.php

示例10: xmodule

 protected function xmodule()
 {
     $this->parseChildren();
     $element = $this->globals['INPUT_ELEMENT'];
     $sectionType = $this->globals['INPUT_SECTIONTYPE'];
     if (empty($element)) {
         throw new Exception('XModule [' . $this->template->getName() . '] is missing POST parameter [element]');
     }
     $str = StringUtils::l("{% set DataSource %}node-sections{% end %}");
     $str .= StringUtils::l("{% begin contents %}");
     if (!empty($this->js)) {
         $str .= StringUtils::l('<script type="text/javascript">');
         $str .= StringUtils::l();
         foreach ((array) $this->js as $line) {
             $str .= StringUtils::l($line);
         }
         $str .= StringUtils::l();
         $str .= StringUtils::l("document.sectionWidgets['{$sectionType}'].initializeSection(%TempSectionID%);");
         $str .= StringUtils::l('</script>');
     }
     if (!empty($this->xhtml)) {
         foreach ((array) $this->xhtml as $line) {
             $str .= StringUtils::l($line);
         }
     }
     $str .= StringUtils::l("{% end %}");
     return $str;
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:28,代码来源:SectionCmsBuilder.php

示例11: showThumbnails

 public function showThumbnails()
 {
     $json = $this->getParameter('value');
     if (empty($json)) {
         return '';
     }
     $json = JSONUtils::decode($json);
     $thumbs = $this->getParameter('thumbnails');
     $tlist = array();
     if (!empty($thumbs)) {
         $tlist = explode(',', $thumbs);
     }
     $xmod = StringUtils::strToBool($this->getParameter('xmod'));
     $markup = '';
     if ($xmod) {
         foreach ($json as $thumb) {
             if (!empty($list) && in_array($thumb->value, $tlist) || empty($tlist)) {
                 $markup .= '<image id="' . $thumb->url . '" width="full"/>';
             }
         }
     } else {
         $markup .= '<ul class="thumbnail-list">';
         foreach ($json as $thumb) {
             if (!empty($tlist) && in_array($thumb->value, $tlist) || empty($tlist)) {
                 $markup .= '<li><p><img src="' . $thumb->url . '" alt="' . $this->getLocal('Title') . '" /></p><p><strong>Size:</strong> ' . $thumb->value . '</p></li>';
             }
         }
         $markup .= '</ul>';
     }
     return $markup;
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion-advanced-media,代码行数:31,代码来源:MediaFilterer.php

示例12: tagize

 public static function tagize($string)
 {
     $string = StringUtils::removeAccents($string);
     $string = strtolower($string);
     $string = str_replace(' ', '_', $string);
     return $string;
 }
开发者ID:noose,项目名称:Planeta,代码行数:7,代码来源:Tag.php

示例13: create

 public static function create($type, $name, $value = null)
 {
     list($form_class_prefix, $function_name) = explode("/", $type);
     $class_name = StringUtils::underscored_to_camel_case($form_class_prefix) . "FormFieldFactory";
     $form_field_factory = __create_instance($class_name);
     $form_field_factory->{$function_name}($name, $value);
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:7,代码来源:Form.class.php

示例14: __construct

 protected function __construct()
 {
     $this->array = ArrayUtils::instance();
     $this->file = FileUtils::instance();
     $this->object = ObjectUtils::instance();
     $this->string = StringUtils::instance();
 }
开发者ID:patxi1980,项目名称:utilities,代码行数:7,代码来源:Utils.php

示例15: pre

 /**
  * Core parser tag hook function for 'pre'.
  * Text is treated roughly as 'nowiki' wrapped in an HTML 'pre' tag;
  * valid HTML attributes are passed on.
  *
  * @param string $text
  * @param array $attribs
  * @param Parser $parser
  * @return string HTML
  */
 public static function pre($text, $attribs, $parser)
 {
     // Backwards-compatibility hack
     $content = StringUtils::delimiterReplace('<nowiki>', '</nowiki>', '$1', $text, 'i');
     $attribs = Sanitizer::validateTagAttributes($attribs, 'pre');
     return Xml::openElement('pre', $attribs) . Xml::escapeTagsOnly($content) . '</pre>';
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:17,代码来源:CoreTagHooks.php


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