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


PHP XenForo_Link::getTitleForUrl方法代码示例

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


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

示例1: quoteVerse

 public static function quoteVerse(array $tag, array $rendererStates, XenForo_BbCode_Formatter_Base $formatter)
 {
     $option = explode(',', $tag['option']);
     $xenOptions = XenForo_Application::get('options');
     $verse = '';
     $version = null;
     if (count($option) > 1) {
         $verse = $option[0];
         $version = strtoupper($option[1]);
     } elseif ($option[0]) {
         if (preg_match('#^[A-z]+$#', $tag['option'])) {
             $verse = '';
             $version = strtoupper($tag['option']);
         } else {
             $verse = $tag['option'];
             $version = strtoupper($xenOptions->th_bible_defaultBible);
         }
     }
     if (!$verse && count($tag['children']) == 1 && is_string($tag['children'][0])) {
         $bibleId = $version ? strtolower($version) : null;
         /* @var $verseModel ThemeHouse_Bible_Model_Verse */
         $verseModel = XenForo_Model::create('ThemeHouse_Bible_Model_Verse');
         $verseText = $verseModel->getVerseFromText($tag['children'][0], $bibleId, true);
         if ($verseText) {
             $verse = $tag['children'][0];
             $version = strtoupper($bibleId);
             $tag['children'] = $verseText;
         }
     }
     $link = '';
     $params = array('bible_id' => strtolower($version));
     if (in_array(strtolower($version), $xenOptions->th_bible_bbCodeBibles)) {
         if (preg_match('#^(.*)\\s+([0-9\\-:]+)$#', $verse, $matches)) {
             $urlPortion = strtolower(XenForo_Link::getTitleForUrl($matches[1], true));
             $link = XenForo_Link::buildPublicLink('bible/' . $urlPortion . '/' . $matches[2] . '/', null, $params);
             /* @var $bibleModel ThemeHouse_Bible_Model_Bible */
             $bibleModel = XenForo_Model::create('ThemeHouse_Bible_Model_Bible');
             $titlePhraseName = $bibleModel->getBibleTitlePhraseName(strtolower($version));
             $bibleTitle = new XenForo_Phrase($titlePhraseName);
             $bibleTitle->setPhraseNameOnInvalid(false);
             if ((string) $bibleTitle) {
                 $version = $bibleTitle;
             }
         } else {
             $urlPortion = strtolower(XenForo_Link::getTitleForUrl($verse, true));
             $link = XenForo_Link::buildPublicLink('bible/' . $urlPortion . '/', null, $params);
         }
     } else {
         $link = '';
     }
     $content = $formatter->renderSubTree($tag['children'], $rendererStates);
     $view = $formatter->getView();
     if ($view) {
         $template = $view->createTemplateObject('th_bb_code_verse_bible', array('content' => $content, 'verse' => $verse, 'version' => $version, 'link' => $link));
         $content = $template->render();
         return trim($content);
     }
     return $content;
 }
开发者ID:ThemeHouse-XF,项目名称:Biblea,代码行数:59,代码来源:Verse.php

示例2: getTitleForUrl

 public static function getTitleForUrl($location)
 {
     $location = trim($location);
     $aPattern = array("a" => "á|à|ạ|ả|ã|ă|ắ|ằ|ặ|ẳ|ẵ|â|ấ|ầ|ậ|ẩ|ẫ|Á|À|Ạ|Ả|Ã|Ă|Ắ|Ằ|Ặ|Ẳ|Ẵ|Â|Ấ|Ầ|Ậ|Ẩ|Ẫ", "o" => "ó|ò|ọ|ỏ|õ|ô|ố|ồ|ộ|ổ|ỗ|ơ|ớ|ờ|ợ|ở|ỡ|Ó|Ò|Ọ|Ỏ|Õ|Ô|Ố|Ồ|Ộ|Ổ|Ỗ|Ơ|Ớ|Ờ|Ợ|Ở|Ỡ", "e" => "é|è|ẹ|ẻ|ẽ|ê|ế|ề|ệ|ể|ễ|É|È|Ẹ|Ẻ|Ẽ|Ê|Ế|Ề|Ệ|Ể|Ễ", "u" => "ú|ù|ụ|ủ|ũ|ư|ứ|ừ|ự|ử|ữ|Ú|Ù|Ụ|Ủ|Ũ|Ư|Ứ|Ừ|Ự|Ử|Ữ", "i" => "í|ì|ị|ỉ|ĩ|Í|Ì|Ị|Ỉ|Ĩ", "y" => "ý|ỳ|ỵ|ỷ|ỹ|Ý|Ỳ|Ỵ|Ỷ|Ỹ", "d" => "đ|Đ");
     while (list($key, $value) = each($aPattern)) {
         $location = preg_replace('/' . $value . '/i', $key, $location);
     }
     $location = XenForo_Link::getTitleForUrl($location);
     return $location;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:10,代码来源:Gallery.php

示例3: stepUserFields

    public function stepUserFields($start, array $options)
    {
        $sDb = $this->_sourceDb;
        $prefix = $this->_prefix;
        /* @var $model XenForo_Model_Import */
        $model = $this->_importModel;
        $profileFields = $sDb->fetchAll('
			SELECT pf.*, pl.*
			FROM ' . $prefix . 'profile_fields AS pf
			INNER JOIN ' . $prefix . 'profile_lang AS pl ON
				(pf.field_id = pl.field_id AND pl.lang_id = ' . $sDb->quote($this->_defaultLangId) . ')
		');
        $profileFieldOptions = array();
        $pfoResult = $sDb->query('
			SELECT *
			FROM ' . $prefix . 'profile_fields_lang
			WHERE lang_id = ' . $sDb->quote($this->_defaultLangId));
        while ($pfo = $pfoResult->fetch()) {
            $profileFieldOptions[$pfo['field_id']][$pfo['option_id']] = $this->_convertToUtf8($pfo['lang_value'], true);
        }
        $existingFields = XenForo_Model::create('XenForo_Model_UserField')->getUserFields();
        $userFieldLookups = array();
        $total = 0;
        XenForo_Db::beginTransaction($this->_db);
        foreach ($profileFields as $profileField) {
            $title = $this->_convertToUtf8($profileField['lang_name'], true);
            $description = $this->_convertToUtf8($profileField['lang_explain'], true);
            $fieldId = $model->getUniqueFieldId(str_replace('-', '_', XenForo_Link::getTitleForUrl($profileField['field_name'], true)), $existingFields, 25);
            $import = array('field_id' => $fieldId, 'title' => $title, 'description' => $description, 'display_order' => $profileField['field_order'], 'max_length' => $profileField['field_maxlen'], 'viewable_profile' => !$profileField['field_no_view'], 'user_editable' => $profileField['field_show_profile'] ? 'yes' : 'never', 'viewable_message' => isset($profileField['field_show_on_vt']) ? (bool) $profileField['field_show_on_vt'] : 0, 'show_registration' => (bool) $profileField['field_show_on_reg'], 'required' => (bool) $profileField['field_required']);
            if ($profileField['field_validation'] && $profileField['field_validation'] != '.*') {
                $import['match_type'] = 'regex';
                $import['match_regex'] = '^' . $this->_convertToUtf8($profileField['field_validation']) . '$';
            }
            switch ($profileField['field_type']) {
                case 1:
                    // numbers
                    $import['field_type'] = 'textbox';
                    $import['match_type'] = 'number';
                    break;
                case 2:
                    // text box
                    $import['field_type'] = 'textbox';
                    break;
                case 3:
                    // text area
                    $import['field_type'] = 'textarea';
                    break;
                case 4:
                    // boolean
                // boolean
                case 5:
                    // drop down
                    $import['field_type'] = $profileField['field_type'] == 4 ? 'radio' : 'select';
                    if (empty($profileFieldOptions[$profileField['field_id']])) {
                        continue;
                    }
                    $import['field_choices'] = $profileFieldOptions[$profileField['field_id']];
                    $userFieldLookups[$profileField['field_name']] = $profileFieldOptions[$profileField['field_id']];
                    break;
                case 6:
                    // date
                    $import['field_type'] = 'textbox';
                    break;
                default:
                    $import['field_type'] = 'textbox';
                    break;
            }
            if ($imported = $model->importUserField($profileField['field_name'], $import)) {
                $total++;
            }
        }
        XenForo_Db::commit($this->_db);
        $this->_session->setExtraData('userFieldLookups', $userFieldLookups);
        $this->_session->incrementStepImportTotal($total);
        return true;
    }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:76,代码来源:PhpBb3.php

示例4: _convertUserFieldChoices

 protected function _convertUserFieldChoices(array $profileField, array &$fieldChoiceLookups)
 {
     try {
         $choiceData = @unserialize($profileField['data']);
     } catch (Exception $e) {
         // this is either corrupted data or an invalid char set. The latter isn't something we can automatically detect
         return array();
     }
     if (!is_array($choiceData)) {
         return array();
     }
     $choices = array();
     foreach ($choiceData as $key => $choice) {
         $choice = $this->_convertToUtf8($choice);
         $choiceId = XenForo_Helper_String::wholeWordTrim($choice, 23, 0, '');
         if ($choiceId != '') {
             $choiceId = str_replace('-', '_', XenForo_Link::getTitleForUrl($choiceId, true));
             $i = 1;
             $choiceIdBase = $choiceId;
             while (isset($choices[$choiceId])) {
                 $choiceId = $choiceIdBase . '_' . ++$i;
             }
         } else {
             $choiceId = $key;
         }
         $choices[$choiceId] = $choice;
     }
     $lookUps = array();
     switch ($profileField['type']) {
         case 'checkbox':
         case 'select_multiple':
             $multiple = true;
             $i = 1;
             foreach ($choices as $key => $value) {
                 $lookUps[$i] = $key;
                 $i = $i * 2;
             }
             break;
         case 'select':
         case 'radio':
         default:
             $multiple = false;
             foreach ($choices as $key => $value) {
                 $lookUps[$value] = $key;
             }
             break;
     }
     $fieldChoiceLookups[$profileField['profilefieldid']] = array('multiple' => $multiple, 'choices' => $lookUps);
     return $choices;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:50,代码来源:vBulletin.php

示例5: stepUserFields

    public function stepUserFields($start, array $options)
    {
        $sDb = $this->_sourceDb;
        $prefix = $this->_prefix;
        /* @var $model XenForo_Model_Import */
        $model = $this->_importModel;
        $profileFields = $sDb->fetchAll('
			SELECT *
			FROM ' . $prefix . 'profilefields
			WHERE fid > 3
		');
        $existingFields = XenForo_Model::create('XenForo_Model_UserField')->getUserFields();
        $userFieldLookups = array();
        $total = 0;
        XenForo_Db::beginTransaction($this->_db);
        foreach ($profileFields as $profileField) {
            $title = $this->_convertToUtf8($profileField['name'], true);
            $description = $this->_convertToUtf8($profileField['description'], true);
            $fieldId = $model->getUniqueFieldId(str_replace('-', '_', XenForo_Link::getTitleForUrl($profileField['name'], true)), $existingFields, 25);
            $import = array('field_id' => $fieldId, 'title' => $title, 'description' => $description, 'display_order' => $profileField['disporder'], 'max_length' => $profileField['maxlength'], 'viewable_profile' => !$profileField['hidden'], 'user_editable' => $profileField['editable'] ? 'yes' : 'never', 'viewable_message' => 0, 'show_registration' => 0, 'required' => $profileField['required']);
            $typeParts = preg_split('/\\r?\\n/', $this->_convertToUtf8($profileField['type']), -1, PREG_SPLIT_NO_EMPTY);
            $type = array_shift($typeParts);
            $typeParts = array_unique($typeParts);
            switch ($type) {
                case 'text':
                    $import['field_type'] = 'textbox';
                    break;
                case 'textarea':
                    $import['field_type'] = 'textarea';
                    break;
                case 'select':
                case 'radio':
                case 'checkbox':
                case 'multiselect':
                    $import['field_type'] = $type;
                    $import['field_choices'] = $typeParts;
                    $userFieldLookups[$profileField['fid']] = array_flip($typeParts);
                    break;
                default:
                    $import['field_type'] = 'textbox';
                    break;
            }
            if ($imported = $model->importUserField($profileField['fid'], $import)) {
                $total++;
            }
        }
        XenForo_Db::commit($this->_db);
        $this->_session->setExtraData('userFieldLookups', $userFieldLookups);
        $this->_session->incrementStepImportTotal($total);
        return true;
    }
开发者ID:Sywooch,项目名称:forums,代码行数:51,代码来源:MyBb.php

示例6: execute


//.........这里部分代码省略.........
             if (file_exists($htmlFilename)) {
                 $html = file_get_contents($htmlFilename);
                 preg_match('#<body>(.*)</body>#s', $html, $matches);
                 if (!empty($matches[1])) {
                     $html = $matches[1];
                 }
             } else {
                 $html = '';
             }
             $title = $bibleModel->getTemplateTitle(array('bible_id' => $bibleId));
             /* @var $templateModel XenForo_Model_Template */
             $templateModel = XenForo_Model::create('XenForo_Model_Template');
             $template = $templateModel->getTemplateInStyleByTitle($title);
             if (!$template || $html) {
                 $templateWriter = XenForo_DataWriter::create('XenForo_DataWriter_Template');
                 if ($template) {
                     $templateWriter->setExistingData($template);
                 }
                 $templateWriter->set('title', $title);
                 $templateWriter->set('template', $html);
                 $templateWriter->set('style_id', 0);
                 $templateWriter->set('addon_id', '');
                 $templateWriter->save();
             }
         }
         $bookNamesFilename = $path . '/book_names.txt';
         if (file_exists($bookNamesFilename)) {
             $phraseModel = XenForo_Model::create('XenForo_Model_Phrase');
             $bibleBookNameValues = array();
             $priorities = array();
             foreach ($bookIndexes as $bookIndex => $bookTitle) {
                 $book = $bookModel->getBookByName(strtolower($bookTitle));
                 if (!$book) {
                     $urlPortion = strtolower(XenForo_Link::getTitleForUrl($bookTitle, true));
                     $book = $bookModel->getBookByUrlPortion($urlPortion);
                 } else {
                     $urlPortion = $book['url_portion'];
                 }
                 $title = $verseModel->getBookPhraseTitle($urlPortion);
                 $phraseModel->insertOrUpdateMasterPhrase($title, $bookTitle, '', array(), array(XenForo_DataWriter_Phrase::OPTION_REBUILD_LANGUAGE_CACHE => false, XenForo_DataWriter_Phrase::OPTION_RECOMPILE_TEMPLATE => false));
                 if ($book) {
                     $bookId = $book['book_id'];
                     $priorities[$book['section']] = $book['priority'];
                 } else {
                     $section = substr($bookIndex, -1, 1);
                     if (isset($priorities[$section])) {
                         $priorities[$section] = $priorities[$section] + 10;
                     } else {
                         $priorities[$section] = 10;
                     }
                     $db->query('
                             UPDATE xf_bible_book
                             SET priority = priority + 10
                             WHERE priority >= ? AND section = ?
                         ', array($priorities[$section], $section));
                     $db->query('
                             INSERT INTO xf_bible_book
                             (url_portion, priority, section)
                             VALUES (?, ?, ?)
                         ', array($urlPortion, $priorities[$section], $section));
                     $bookId = $db->lastInsertId();
                     $bibleBookNameValues[] = '(' . $db->quote(strtolower($bookTitle)) . ',' . $db->quote($bookId) . ')';
                 }
                 $bookNameIds[strtolower($bookTitle)] = $bookId;
             }
             if ($bibleBookNameValues) {
开发者ID:ThemeHouse-XF,项目名称:Biblea,代码行数:67,代码来源:Import.php


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