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


PHP PMF_String类代码示例

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


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

示例1: printHTTPStatus404

function printHTTPStatus404()
{
    if ('cgi' == PMF_String::substr(php_sapi_name(), 0, 3) || isset($_SERVER['ALL_HTTP'])) {
        header('Status: 404 Not Found');
    } else {
        header('HTTP/1.0 404 Not Found');
    }
    exit;
}
开发者ID:noon,项目名称:phpMyFAQ,代码行数:9,代码来源:sitemap.google.php

示例2: addPost

 /**
  * Adds a post to Twitter
  * 
  * @param string $question Question
  * @param string $tags     String of tags
  * @param string $link     URL to FAQ
  * 
  * @return void
  */
 public function addPost($question, $tags, $link)
 {
     $hashtags = '';
     if ($tags != '') {
         $hashtags = '#' . str_replace(',', ' #', $tags);
     }
     $message = PMF_String::htmlspecialchars($question);
     $message .= ' ' . $hashtags;
     $message .= ' ' . $link;
     $this->connection->post('statuses/update', array('status' => $message));
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:20,代码来源:Twitter.php

示例3: buildSitemapNode

function buildSitemapNode($location, $lastmod = null, $changeFreq = null, $priority = null)
{
    if (!isset($lastmod)) {
        $lastmod = PMF_Date::createISO8601Date($_SERVER['REQUEST_TIME'], false);
    }
    if (!isset($changeFreq)) {
        $changeFreq = PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY;
    }
    $node = '<url>' . '<loc>' . PMF_String::htmlspecialchars($location) . '</loc>' . '<lastmod>' . $lastmod . '</lastmod>' . '<changefreq>' . $changeFreq . '</changefreq>' . (isset($priority) ? '<priority>' . $priority . '</priority>' : '') . '</url>';
    return $node;
}
开发者ID:rybal06,项目名称:phpMyFAQ,代码行数:11,代码来源:sitemap.google.php

示例4: userTracking

 /**
  * Tracks the user and log what he did
  *
  * @param  string  $action Action string
  * @param  integer $id     Current ID
  *
  * @return void
  */
 public function userTracking($action, $id = 0)
 {
     global $sid, $user, $botBlacklist;
     if ($this->_config->get('main.enableUserTracking')) {
         $bots = 0;
         $banned = false;
         $agent = $_SERVER['HTTP_USER_AGENT'];
         $sid = PMF_Filter::filterInput(INPUT_GET, PMF_GET_KEY_NAME_SESSIONID, FILTER_VALIDATE_INT);
         $sidc = PMF_Filter::filterInput(INPUT_COOKIE, self::PMF_COOKIE_NAME_SESSIONID, FILTER_VALIDATE_INT);
         if (!is_null($sidc)) {
             $sid = $sidc;
         }
         if ($action == 'old_session') {
             $sid = null;
         }
         foreach ($botBlacklist as $bot) {
             if ((bool) PMF_String::strstr($agent, $bot)) {
                 $bots++;
             }
         }
         $network = new PMF_Network($this->_config);
         // if we're running behind a reverse proxy like nginx/varnish, fix the client IP
         $remoteAddr = $_SERVER['REMOTE_ADDR'];
         $localAddresses = array('127.0.0.1', '::1');
         if (in_array($remoteAddr, $localAddresses) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
             $remoteAddr = $_SERVER['HTTP_X_FORWARDED_FOR'];
         }
         // clean up as well
         $remoteAddr = preg_replace('([^0-9a-z:\\.]+)i', '', $remoteAddr);
         if (!$network->checkIp($remoteAddr)) {
             $banned = true;
         }
         if (0 == $bots && false == $banned) {
             if (!isset($sid)) {
                 $sid = $this->_config->getDb()->nextId(PMF_Db::getTablePrefix() . 'faqsessions', 'sid');
                 // Sanity check: force the session cookie to contains the current $sid
                 if (!is_null($sidc) && !$sidc != $sid) {
                     self::setCookie(self::PMF_COOKIE_NAME_SESSIONID, $sid);
                 }
                 $query = sprintf("\n                        INSERT INTO \n                            %sfaqsessions\n                        (sid, user_id, ip, time)\n                            VALUES\n                        (%d, %d, '%s', %d)", PMF_Db::getTablePrefix(), $sid, $user ? $user->getUserId() : -1, $remoteAddr, $_SERVER['REQUEST_TIME']);
                 $this->_config->getDb()->query($query);
             }
             $data = $sid . ';' . str_replace(';', ',', $action) . ';' . $id . ';' . $remoteAddr . ';' . str_replace(';', ',', isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '') . ';' . str_replace(';', ',', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '') . ';' . str_replace(';', ',', urldecode($_SERVER['HTTP_USER_AGENT'])) . ';' . $_SERVER['REQUEST_TIME'] . ";\n";
             $file = './data/tracking' . date('dmY');
             if (is_writeable($file)) {
                 file_put_contents($file, $data, FILE_APPEND);
             } else {
                 throw new PMF_Exception('Cannot write to ' . $file);
             }
         }
     }
 }
开发者ID:maggiofrancesco,项目名称:phpMyFAQ,代码行数:60,代码来源:Session.php

示例5: setRelationLinks

 /**
  * Verlinkt einen Artikel dynamisch mit der Suche �ber die �bergebenen Schl�sselw�rter
  *
  * @param    string     $strHighlight
  * @param    string     $strSource
  * @param    integer    $intCount
  * @return   string
  * @author   Marco Enders <marco@minimarco.de>
  * @author   Thorsten Rinne <thorsten@phpmyfaq.de>
  */
 public function setRelationLinks($strHighlight, $strSource, $intCount = 0)
 {
     global $in_content;
     $x = 0;
     $arrMatch = array();
     PMF_String::preg_match_all('/(<a[^<>]*?>.*?<\\/a>)|(<.*?>)/is', $strSource, $arrMatch);
     $strSource = PMF_String::preg_replace('/(<a[^<>]*?>.*?<\\/a>)|(<.*?>)/is', '~+*# replaced html #*+~', $strSource);
     $x = $x + PMF_String::preg_match('/(' . preg_quote($strHighlight) . ')/ims', $strSource);
     $strSource = PMF_String::preg_replace('/(' . preg_quote($strHighlight) . ')/ims', '<a href="index.php?action=search&search=' . $strHighlight . '" title="Insgesamt ' . $intCount . ' Artikel zu diesem Schlagwort (' . $strHighlight . ') vorhanden. Jetzt danach suchen..." class="relation">$1</a>', $strSource);
     foreach ($arrMatch[0] as $html) {
         $strSource = PMF_String::preg_replace('/' . preg_quote('~+*# replaced html #*+~') . '/', $html, $strSource, 1);
     }
     if ($x == 0) {
         $in_content = false;
     } else {
         $in_content = true;
     }
     return $strSource;
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:29,代码来源:Relation.php

示例6: AddImage

 /**
  * Adds a image
  *
  * @param    string  path to the image
  * @return   void
  * @access   private
  */
 function AddImage($image)
 {
     // Check, if image is stored locally or not
     if ('http' != PMF_String::substr($image, 0, 4)) {
         // Please note that the image must be accessible by HTTP NOT ONLY by HTTPS
         $image = 'http://' . EndSlash($_SERVER['HTTP_HOST']) . $image;
     }
     // Set a friendly User Agent
     $ua = ini_get('user_agent');
     ini_set('user_agent', 'phpMyFAQ PDF Builder');
     if (!($info = getimagesize($image))) {
         return;
     }
     if ($info[0] > 555) {
         $w = $info[0] / 144 * 25.4;
         $h = $info[1] / 144 * 25.4;
     } else {
         $w = $info[0] / 72 * 25.4;
         $h = $info[1] / 72 * 25.4;
     }
     // Check for the fpdf image type support
     if (isset($this->mimetypes[$info[2]])) {
         $type = $this->mimetypes[$info[2]];
     } else {
         return;
     }
     $hw_ratio = $h / $w;
     $this->Write(5, ' ');
     if ($info[0] > $this->wPt) {
         $info[0] = $this->wPt - $this->lMargin - $this->rMargin;
         if ($w > $this->w) {
             $w = $this->w - $this->lMargin - $this->rMargin;
             $h = $w * $hw_ratio;
         }
     }
     $x = $this->GetX();
     if ($this->GetY() + $h > $this->h) {
         $this->AddPage();
     }
     $y = $this->GetY();
     $this->Image($image, $x, $y, $w, $h, $type);
     $this->Write(5, ' ');
     $y = $this->GetY();
     $this->Image($image, $x, $y, $w, $h, $type);
     if ($y + $h > $this->hPt) {
         $this->AddPage();
     } else {
         if ($info[1] > 20) {
             $this->SetY($y + $h);
         }
         $this->SetX($x + $w);
     }
     // Unset the friendly User Agent restoring the original UA
     ini_set('user_agent', $ua);
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:62,代码来源:Pdf.php

示例7: array

        $metaDescription = PMF_Utils::makeShorterText(strip_tags($faqData['content']), 12);
    }
}
//
// Handle the Tagging ID
//
$tag_id = PMF_Filter::filterInput(INPUT_GET, 'tagging_id', FILTER_VALIDATE_INT);
if (!is_null($tag_id)) {
    $title = ' - ' . $oTag->getTagNameById($tag_id);
    $keywords = '';
}
//
// Handle the SiteMap
//
$letter = PMF_Filter::filterInput(INPUT_GET, 'letter', FILTER_SANITIZE_STRIPPED);
if (!is_null($letter) && 1 == PMF_String::strlen($letter)) {
    $title = ' - ' . $letter . '...';
    $keywords = $letter;
}
//
// Found a category ID?
//
$cat = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT, 0);
$cat_from_id = -1;
$categoryPath = array(0);
if (is_numeric($id) && $id > 0) {
    $categoryRelations = new PMF_Category_Relations();
    foreach ($categoryRelations->fetchAll() as $relation) {
        if ($relation->record_id == $id) {
            $cat_from_id = $relation->category_id;
            break;
开发者ID:jr-ewing,项目名称:phpMyFAQ,代码行数:31,代码来源:index.php

示例8: array

$current_groups = array(-1);
$action = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
$language = PMF_Filter::filterInput(INPUT_GET, 'lang', FILTER_SANITIZE_STRING, 'en');
$categoryId = PMF_Filter::filterInput(INPUT_GET, 'categoryId', FILTER_VALIDATE_INT);
$recordId = PMF_Filter::filterInput(INPUT_GET, 'recordId', FILTER_VALIDATE_INT);
// Get language (default: english)
$Language = new PMF_Language();
$language = $Language->setLanguage($faqconfig->get('main.languageDetection'), $faqconfig->get('main.language'));
// Set language
if (PMF_Language::isASupportedLanguage($language)) {
    require 'lang/language_' . $language . '.php';
} else {
    require 'lang/language_en.php';
}
$plr = new PMF_Language_Plurals($PMF_LANG);
PMF_String::init($language);
// Set empty result
$result = array();
// Handle actions
switch ($action) {
    case 'getVersion':
        $result = array('version' => $faqconfig->get('main.currentVersion'));
        break;
    case 'getApiVersion':
        $result = array('apiVersion' => (int) $faqconfig->get('main.currentApiVersion'));
        break;
    case 'search':
        $search = new PMF_Search($db, $Language);
        $searchString = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRIPPED);
        $result = $search->search($searchString, false);
        $url = $faqconfig->get('main.referenceURL') . '/index.php?action=artikel&cat=%d&id=%d&artlang=%s';
开发者ID:atlcurling,项目名称:tkt,代码行数:31,代码来源:api.php

示例9: str_replace

            ?>
 '<?php 
            print str_replace("\"", "´", $record['title']);
            ?>
'"><?php 
            print $record['title'];
            ?>
</a>
<?php 
            if (isset($numCommentsByFaq[$record['id']])) {
                print " (" . $numCommentsByFaq[$record['id']] . " " . $PMF_LANG["ad_start_comments"] . ")";
            }
            ?>
</td>
        <td class="list" style="width: 48px;"><?php 
            print PMF_String::substr($record['date'], 0, 10);
            ?>
</td>
        <td class="list" style="width: 96px;"><?php 
            print $linkverifier->getEntryStateHTML($record['id'], $record['lang']);
            ?>
</td>
        <td class="list" style="width: 16px;">
            <a href="#" onclick="javascript:deleteRecord(<?php 
            print $record['id'];
            ?>
, '<?php 
            print $record['lang'];
            ?>
');" title="<?php 
            print $PMF_LANG["ad_user_delete"];
开发者ID:rybal06,项目名称:phpMyFAQ,代码行数:31,代码来源:record.show.php

示例10: round

        $num = round($searchItem['number'] * 100 / $searchesCount, 2);
        ?>
        <tr class="row_search_id_<?php 
        print $searchItem['id'];
        ?>
">
            <td><?php 
        print PMF_String::htmlspecialchars($searchItem['searchterm']);
        ?>
</td>
            <td><?php 
        print $searchItem['number'];
        ?>
</td>
            <td><?php 
        print $languageCodes[PMF_String::strtoupper($searchItem['lang'])];
        ?>
</td>
            <td><?php 
        print $num;
        ?>
 %</td>
            <td>
                <a onclick="deleteSearchTerm('<?php 
        print $searchItem['searchterm'];
        ?>
', <?php 
        print $searchItem['id'];
        ?>
); return false;"
                   href="javascript:;">
开发者ID:atlcurling,项目名称:tkt,代码行数:31,代码来源:stat.search.php

示例11: search_vars

 /**
  * 
  * @param unknown_type $text
  */
 private function search_vars($text)
 {
     if (DEBUG) {
         $pattern = "/{(?!meta|baseHref|phpmyfaqversion)\\w+}/msi";
     } else {
         $pattern = "/{(?!debug|meta|baseHref|phpmyfaqversion)\\w+}/msi";
     }
     if (PMF_String::preg_match($pattern, $text)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:jr-ewing,项目名称:phpMyFAQ,代码行数:17,代码来源:Template.php

示例12: verifyArticleURL

 /**
  * Verifies specified article content and update links_state database entry
  *
  * @param   string  $contents
  * @param   integer $id
  * @param   string  $artlang
  * @param   boolean $cron
  * 
  * @result  string  HTML text, if $cron is false (default)
  */
 public function verifyArticleURL($contents = '', $id = 0, $artlang = '', $cron = false)
 {
     global $PMF_LANG;
     $faqconfig = PMF_Configuration::getInstance();
     if ($faqconfig->get('main.referenceURL') == '') {
         $output = $PMF_LANG['ad_linkcheck_noReferenceURL'];
         return $cron ? '' : '<br /><br />' . $output;
     }
     if (trim('' == $faqconfig->get('main.referenceURL'))) {
         $output = $PMF_LANG['ad_linkcheck_noReferenceURL'];
         return $cron ? '' : '<br /><br />' . $output;
     }
     if ($this->isReady() === false) {
         $output = $PMF_LANG['ad_linkcheck_noAllowUrlOpen'];
         return $cron ? '' : '<br /><br />' . $output;
     }
     // Parse contents and verify URLs
     $this->parse_string($contents);
     $result = $this->VerifyURLs($faqconfig->get('main.referenceURL'));
     $this->markEntry($id, $artlang);
     // If no URLs found
     if ($result == false) {
         $output = sprintf('<h2>%s</h2><br />%s', $PMF_LANG['ad_linkcheck_checkResult'], $PMF_LANG['ad_linkcheck_noLinksFound']);
         return $cron ? '' : utf8_decode($output);
     }
     //uncomment to see the result structure
     //print str_replace("\n","<br />",PMF_String::htmlspecialchars(print_r($result, true)));
     $failreasons = $inforeasons = array();
     $output = "    <h2>" . $PMF_LANG['ad_linkcheck_checkResult'] . "</h2>\n";
     $output .= '    <table class="verifyArticleURL">' . "\n";
     foreach ($result as $type => $_value) {
         $output .= "        <tr><td><strong>" . PMF_String::htmlspecialchars($type) . "</strong></td></tr>\n";
         foreach ($_value as $url => $value) {
             $_output = '            <td />';
             $_output .= '            <td><a href="' . $value['absurl'] . '" target="_blank">' . PMF_String::htmlspecialchars($value['absurl']) . "</a></td>\n";
             $_output .= '            <td>';
             if (isset($value['redirects']) && $value['redirects'] > 0) {
                 $_redirects = "(" . $value['redirects'] . ")";
             } else {
                 $_redirects = "";
             }
             if ($value['valid'] === true) {
                 $_classname = "urlsuccess";
                 $_output .= '<td class="' . $_classname . '">' . $PMF_LANG['ad_linkcheck_checkSuccess'] . $_redirects . '</td>';
                 if ($value['reason'] != "") {
                     $inforeasons[] = sprintf($PMF_LANG['ad_linkcheck_openurl_infoprefix'], PMF_String::htmlspecialchars($value['absurl'])) . $value['reason'];
                 }
             } else {
                 $_classname = "urlfail";
                 $_output .= '<td class="' . $_classname . '">' . $PMF_LANG['ad_linkcheck_checkFailed'] . '</td>';
                 if ($value['reason'] != "") {
                     $failreasons[] = $value['reason'];
                 }
             }
             $_output .= '</td>';
             $output .= '        <tr class="' . $_classname . '">' . "\n" . $_output . "\n";
             $output .= "        </tr>\n";
         }
     }
     $output .= "    </table>\n";
     if (count($failreasons) > 0) {
         $output .= "    <br />\n    <strong>" . $PMF_LANG['ad_linkcheck_failReason'] . "</strong>\n    <ul>\n";
         foreach ($failreasons as $reason) {
             $output .= "        <li>" . $reason . "</li>\n";
         }
         $output .= "    </ul>\n";
     }
     if (count($inforeasons) > 0) {
         $output .= "    <br />\n    <strong>" . $PMF_LANG['ad_linkcheck_infoReason'] . "</strong>\n    <ul>\n";
         foreach ($inforeasons as $reason) {
             $output .= "        <li>" . $reason . "</li>\n";
         }
         $output .= "    </ul>\n";
     }
     if ($cron) {
         return '';
     } else {
         return utf8_decode($output);
     }
 }
开发者ID:jr-ewing,项目名称:phpMyFAQ,代码行数:90,代码来源:Linkverifier.php

示例13: header

 * @subpackage Frontend
 * @author     Thomas Zeithaml <seo@annatom.de>
 * @author     Thorsten Rinne <thorsten@phpmyfaq.de>
 * @since      2005-08-21
 * @version    SVN: $Id$
 * @copyright  2005-2009 phpMyFAQ Team
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$faqsession->userTracking('sitemap', 0);
$letter = PMF_Filter::filterInput(INPUT_GET, 'letter', FILTER_SANITIZE_STRIPPED);
if (!is_null($letter) && 1 == PMF_String::strlen($letter)) {
    $currentLetter = strtoupper($db->escape_string(PMF_String::substr($letter, 0, 1)));
} else {
    $currentLetter = 'A';
}
$sitemap = new PMF_Sitemap($current_user, $current_groups);
$tpl->processTemplate('writeContent', array('writeLetters' => $sitemap->getAllFirstLetters(), 'writeMap' => $sitemap->getRecordsFromLetter($currentLetter), 'writeCurrentLetter' => $currentLetter));
$tpl->includeTemplate('writeContent', 'index');
开发者ID:noon,项目名称:phpMyFAQ,代码行数:31,代码来源:sitemap.php

示例14: round

</td>
        <td><?php 
        print $data['lang'];
        ?>
</td>
        <td><a href="../index.php?action=artikel&amp;cat=<?php 
        print $data['category_id'];
        ?>
&amp;id=<?php 
        print $data['id'];
        ?>
&amp;artlang=<?php 
        print $data['lang'];
        ?>
" title="<?php 
        print PMF_String::htmlspecialchars(trim($data['question']), ENT_QUOTES, 'utf-8');
        ?>
"><?php 
        print PMF_Utils::makeShorterText(PMF_htmlentities(trim($data['question']), ENT_QUOTES, 'utf-8'), 14);
        ?>
</a></td>
        <td><?php 
        print $data['usr'];
        ?>
</td>
        <td style="width: 50px;"><img src="stat.bar.php?num=<?php 
        print $data['num'];
        ?>
" border="0" alt="<?php 
        print round($data['num'] * 20);
        ?>
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:31,代码来源:stat.ratings.php

示例15: printHTTPStatus404

 /**
  * Returns a 404 header
  * 
  * @return void
  */
 public function printHTTPStatus404()
 {
     if ('cgi' == PMF_String::substr(PHP_SAPI, 0, 3) || isset($_SERVER['ALL_HTTP'])) {
         header('Status: 404 Not Found');
     } else {
         header('HTTP/1.0 404 Not Found');
     }
     exit;
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:14,代码来源:Http.php


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