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


PHP PMF_Utils类代码示例

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


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

示例1: query

 /**
  * This function sends a query to the database.
  *
  * @param string  $query
  * @param integer $offset
  * @param integer $rowcount
  *
  * @return PDOStatement $statement
  */
 public function query($query, $offset = 0, $rowcount = 0)
 {
     if (DEBUG) {
         $this->sqllog .= PMF_Utils::debug($query);
     }
     try {
         return $this->conn->query($query);
     } catch (PDOException $e) {
         $this->sqllog .= $e->getMessage();
     }
 }
开发者ID:maggiofrancesco,项目名称:phpMyFAQ,代码行数:20,代码来源:Pdo.php

示例2: getStickyRecords

 /**
  * Prepares and returns the sticky records for the frontend
  * 
  * @return array
  */
 public function getStickyRecords()
 {
     $result = $this->getStickyRecordsData();
     $output = array();
     if (count($result) > 0) {
         foreach ($result as $row) {
             $shortTitle = PMF_Utils::makeShorterText($row['thema'], 8);
             $output['title'][] = $shortTitle;
             $output['url'][] = $row['url'];
         }
     } else {
         $output['error'] = $this->pmf_lang['err_noTopTen'];
     }
     return $output;
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:20,代码来源:Faq.php

示例3: elseif

        ?>
</td>
                        <td><?php 
        echo $data['lang'];
        ?>
</td>
                        <td>
                            <a href="<?php 
        echo $url;
        ?>
" title="<?php 
        echo $question;
        ?>
">
                                <?php 
        echo PMF_Utils::makeShorterText($question, 14);
        ?>
                            </a>
                        </td>
                        <td><?php 
        echo $data['usr'];
        ?>
</td>
                        <td>
                            <?php 
        if (round($data['num'] * 20) > 75) {
            $progressBar = 'success';
        } elseif (round($data['num'] * 20) < 25) {
            $progressBar = 'danger';
        } else {
            $progressBar = 'info';
开发者ID:Ravikumarsreerama,项目名称:faq,代码行数:31,代码来源:stat.ratings.php

示例4:

    $metaDescription = $faqconfig->get('main.metaDescription');
}
//
// found a solution ID?
//
$solution_id = PMF_Filter::filterInput(INPUT_GET, 'solution_id', FILTER_VALIDATE_INT);
if (!is_null($solution_id)) {
    $title = ' -  powered by phpMyFAQ ' . $faqconfig->get('main.currentVersion');
    $keywords = '';
    $faqData = $faq->getIdFromSolutionId($solution_id);
    if (is_array($faqData)) {
        $id = $faqData['id'];
        $lang = $faqData['lang'];
        $title = ' - ' . $faq->getRecordTitle($id);
        $keywords = ',' . $faq->getRecordKeywords($id);
        $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)) {
开发者ID:jr-ewing,项目名称:phpMyFAQ,代码行数:31,代码来源:index.php

示例5: getNeverExpireDate

 /**
  * Returns date from out of time
  *
  * @return string
  */
 public static function getNeverExpireDate()
 {
     // Unix: 13 Dec 1901 20:45:54 -> 19 Jan 2038 03:14:07, signed 32 bit
     // Windows: 1 Jan 1970 -> 19 Jan 2038.
     // So we will use: 1 Jan 2038 -> 2038-01-01, 00:00:01
     return PMF_Utils::getPMFDate(mktime(0, 0, 1, 1, 1, 2038));
 }
开发者ID:jr-ewing,项目名称:phpMyFAQ,代码行数:12,代码来源:Utils.php

示例6: round

        ?>
</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);
        ?>
 %" width="50" height="15" title="<?php 
        print round($data['num'] * 20);
        ?>
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:31,代码来源:stat.ratings.php

示例7: array

 $showcat = PMF_Filter::filterInput(INPUT_POST, 'showcat', FILTER_SANITIZE_STRING);
 // translate an existing category
 if (!is_null($showcat) && $showcat == 'yes') {
     $categoryData = array('id' => PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT), 'lang' => PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING), 'parent_id' => PMF_Filter::filterInput(INPUT_POST, 'parent_id', FILTER_VALIDATE_INT), 'name' => PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING), 'description' => PMF_Filter::filterInput(INPUT_POST, 'description', FILTER_SANITIZE_STRING), 'user_id' => PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT));
     // translate.category only returns non-existent languages to translate too
     if ($categoryNode->create($categoryData)) {
         printf('<p>%s</p>', $PMF_LANG['ad_categ_translated']);
     } else {
         printf('<p>%s</p>', $db->error());
     }
 }
 print "\n\n<table>\n";
 print "<tr>\n";
 print "    <th>" . $currentLanguage . "</th>\n";
 // get languages in use for all categories
 $allLanguages = PMF_Utils::languageAvailable(0, $table = 'faqcategories');
 asort($allLanguages);
 foreach ($allLanguages as $language) {
     if ($languageCodes[strtoupper($language)] != $currentLanguage) {
         print "    <th>" . $languageCodes[strtoupper($language)] . "</th>\n";
     }
 }
 $categoryDataProvider = new PMF_Category_Tree_DataProvider_SingleQuery();
 $categoryTreeHelper = new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryDataProvider));
 $categoryHelper = new PMF_Category_Helper();
 foreach ($categoryTreeHelper as $categoryId => $categoryName) {
     $indent = str_repeat('&nbsp;', $categoryTreeHelper->indent);
     $categoryLang = $categoryTreeHelper->getInnerIterator()->current()->getLanguage();
     if ($categoryLang == $LANGCODE) {
         print "</tr>\n";
         print "<tr>\n";
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:31,代码来源:category.showstructure.php

示例8: _createHeaders

 /**
  * Create the headers of the email.
  *
  * @return void     
  */
 private function _createHeaders()
 {
     // Cleanup headers
     $this->headers = array();
     // Check if the message consists of just a "plain" single item
     if (false === strpos($this->contentType, 'multipart')) {
         // Content-Disposition: inline
         $this->headers['Content-Disposition'] = $this->contentDisposition;
         // Content-Type
         $this->headers['Content-Type'] = $this->contentType . '; format=flowed; charset="' . $this->charset . '"';
         // Content-Transfer-Encoding: 7bit
         $this->headers['Content-Transfer-Encoding'] = '7bit';
     } else {
         // Content-Type
         $this->headers['Content-Type'] = $this->contentType . '; boundary="' . $this->boundary . '"';
     }
     // Date
     $this->headers['Date'] = self::getDate(self::getTime());
     // Disposition-Notification-To, RFC 3798
     $notifyTos = array();
     foreach ($this->_notifyTo as $address => $name) {
         $notifyTos[] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     $notifyTo = implode(',', $notifyTos);
     if (!empty($notifyTo)) {
         $this->headers['Disposition-Notification-To'] = $notifyTo;
     }
     // From
     foreach ($this->_from as $address => $name) {
         $this->headers['From'] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     // CC
     foreach ($this->_cc as $address => $name) {
         $this->headers['CC'] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     // BCC
     foreach ($this->_bcc as $address => $name) {
         $this->headers['BCC'] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     // Message-Id
     $this->headers['Message-ID'] = $this->messageId;
     // MIME-Version: 1.0
     $this->headers['MIME-Version'] = '1.0';
     // Reply-To
     $this->headers['Reply-To'] = $this->headers['From'];
     foreach ($this->_replyTo as $address => $name) {
         $this->headers['Reply-To'] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     // Return-Path
     foreach ($this->_from as $address => $name) {
         $this->headers['Return-Path'] = '<' . $address . '>';
     }
     foreach ($this->_returnPath as $address => $name) {
         $this->headers['Return-Path'] = '<' . $address . '>';
     }
     // Sender
     $this->headers['Sender'] = $this->headers['From'];
     foreach ($this->_sender as $address => $name) {
         $this->headers['Sender'] = (empty($name) ? '' : $name . ' ') . '<' . $address . '>';
     }
     // Subject. Note: it must be RFC 2047 compliant
     // TODO: wrap mb_encode_mimeheader() to add other content encodings
     $this->headers['Subject'] = PMF_Utils::resolveMarkers(html_entity_decode($this->subject, ENT_COMPAT, 'UTF-8'), $this->_config);
     // X-Mailer
     $this->headers['X-Mailer'] = $this->_mailer;
     // X-MSMail-Priority
     if (isset($this->priorities[(int) $this->priority])) {
         $this->headers['X-MSMail-Priority'] = $this->priorities[(int) $this->priority];
     }
     // X-Originating-IP
     if (isset($_SERVER['REMOTE_ADDR'])) {
         $this->headers['X-Originating-IP'] = $_SERVER['REMOTE_ADDR'];
     }
     // X-Priority
     $this->headers['X-Priority'] = $this->priority;
 }
开发者ID:kapljr,项目名称:Jay-Kaplan-Farmingdale-BCS-Projects,代码行数:81,代码来源:Mail.php

示例9: html_entity_decode

$rss->openMemory();
$rss->setIndent(true);
$rss->startDocument('1.0', 'utf-8');
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', $faqconfig->get('main.titleFAQ') . ' - ' . $PMF_LANG['msgOpenQuestions']);
$rss->writeElement('description', html_entity_decode($faqconfig->get('main.metaDescription')));
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/openquestions/rss.php'));
if ($num > 0) {
    $counter = 0;
    foreach ($rssData as $item) {
        if ($counter < PMF_RSS_OPENQUESTIONS_MAX) {
            $counter++;
            $rss->startElement('item');
            $rss->writeElement('title', PMF_Utils::makeShorterText(html_entity_decode($item->question), 8) . " (" . $item->username . ")");
            $rss->startElement('description');
            $rss->writeCdata($item->question);
            $rss->endElement();
            $rss->writeElement('link', (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER["PHP_SELF"]) . "?action=open#openq_" . $item->id);
            $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item->date, true));
            $rss->endElement();
        }
    }
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
header('Content-Type: application/rss+xml');
header('Content-Length: ' . strlen($rssData));
print $rssData;
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:31,代码来源:rss.php

示例10: query

 /**
  * This function sends a query to the database.
  *
  * @param string  $query
  * @param integer $offset
  * @param integer $rowcount
  *
  * @return  mixed $result
  */
 public function query($query, $offset = 0, $rowcount = 0)
 {
     if (DEBUG) {
         $this->sqllog .= PMF_Utils::debug($query);
     }
     if (0 < $rowcount) {
         $query .= sprintf(' OFFSET %d ROWS FETCH NEXT %d ROWS ONLY', $offset, $rowcount);
     }
     $result = mssql_query($query, $this->conn);
     if (!$result) {
         $this->sqllog .= $this->error();
     }
     return $result;
 }
开发者ID:maggiofrancesco,项目名称:phpMyFAQ,代码行数:23,代码来源:Mssql.php

示例11: round

        ?>
</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_String::htmlspecialchars(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);
        ?>
 %" width="50" height="15" title="<?php 
        print round($data['num'] * 20);
        ?>
开发者ID:jr-ewing,项目名称:phpMyFAQ,代码行数:31,代码来源:stat.ratings.php

示例12: XMLWriter

$rss = new XMLWriter();
$rss->openMemory();
$rss->startDocument('1.0', $PMF_LANG['metaCharset']);
$rss->startElement('rss');
$rss->writeAttribute('version', '2.0');
$rss->startElement('channel');
$rss->writeElement('title', utf8_encode($PMF_CONF['main.titleFAQ']) . ' - ' . utf8_encode($PMF_LANG['msgOpenQuestions']));
$rss->writeElement('description', utf8_encode($PMF_CONF['main.metaDescription']));
$rss->writeElement('link', PMF_Link::getSystemUri('/feed/openquestions/rss.php'));
if ($num > 0) {
    $counter = 0;
    foreach ($rssData as $item) {
        if ($counter < PMF_RSS_OPENQUESTIONS_MAX) {
            $counter++;
            $rss->startElement('item');
            $rss->writeElement('title', utf8_encode(PMF_Utils::makeShorterText($item['question'], 8) . " (" . $item['user'] . ")"));
            $rss->startElement('description');
            $rss->writeCdata(utf8_encode($item['question']));
            $rss->endElement();
            $rss->writeElement('link', utf8_encode((isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER["HTTP_HOST"] . str_replace("feed/openquestions/rss.php", "index.php", $_SERVER["PHP_SELF"]) . "?action=open#openq_" . $item['id']));
            $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['date'], false));
            $rss->endElement();
        }
    }
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
header('Content-Type: application/rss+xml');
header('Content-Length: ' . strlen($rssData));
print $rssData;
开发者ID:noon,项目名称:phpMyFAQ,代码行数:31,代码来源:rss.php

示例13: getRecordsFromLetter

 /**
  * Returns all records from the current first letter
  *
  * @param  string $letter Letter
  * @return array
  * @since  2007-03-30
  * @author Thorsten Rinne <thorsten@phpmyfaq.de>
  */
 public function getRecordsFromLetter($letter = 'A')
 {
     global $sids, $PMF_LANG;
     if ($this->groupSupport) {
         $permPart = sprintf("( fdg.group_id IN (%s)\n            OR\n                (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups));
     } else {
         $permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user);
     }
     $letter = PMF_String::strtoupper($this->db->escape_string(PMF_String::substr($letter, 0, 1)));
     $writeMap = '';
     switch ($this->type) {
         case 'db2':
         case 'sqlite':
             $query = sprintf("\n                    SELECT\n                        fd.thema AS thema,\n                        fd.id AS id,\n                        fd.lang AS lang,\n                        fcr.category_id AS category_id,\n                        fd.content AS snap\n                    FROM\n                        %sfaqcategoryrelations fcr,\n                        %sfaqdata fd\n                    LEFT JOIN\n                        %sfaqdata_group AS fdg\n                    ON\n                        fd.id = fdg.record_id\n                    LEFT JOIN\n                        %sfaqdata_user AS fdu\n                    ON\n                        fd.id = fdu.record_id\n                    WHERE\n                        fd.id = fcr.record_id\n                    AND\n                        SUBSTR(fd.thema, 1, 1) = '%s'\n                    AND\n                        fd.lang = '%s'\n                    AND\n                        fd.active = 'yes'\n                    AND\n                        %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
             break;
         default:
             $query = sprintf("\n                    SELECT\n                        fd.thema AS thema,\n                        fd.id AS id,\n                        fd.lang AS lang,\n                        fcr.category_id AS category_id,\n                        fd.content AS snap\n                    FROM\n                        %sfaqcategoryrelations fcr,\n                        %sfaqdata fd\n                    LEFT JOIN\n                        %sfaqdata_group AS fdg\n                    ON\n                        fd.id = fdg.record_id\n                    LEFT JOIN\n                        %sfaqdata_user AS fdu\n                    ON\n                        fd.id = fdu.record_id\n                    WHERE\n                        fd.id = fcr.record_id\n                    AND\n                        SUBSTRING(fd.thema, 1, 1) = '%s'\n                    AND\n                        fd.lang = '%s'\n                    AND\n                        fd.active = 'yes'\n                    AND\n                        %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
             break;
     }
     $result = $this->db->query($query);
     $oldId = 0;
     while ($row = $this->db->fetch_object($result)) {
         if ($oldId != $row->id) {
             $title = PMF_String::htmlspecialchars($row->thema, ENT_QUOTES, 'utf-8');
             $url = sprintf('%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $sids, $row->category_id, $row->id, $row->lang);
             $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
             $oLink->itemTitle = $row->thema;
             $oLink->text = $title;
             $oLink->tooltip = $title;
             $writeMap .= '<li>' . $oLink->toHtmlAnchor() . '<br />' . "\n";
             $writeMap .= PMF_Utils::chopString(strip_tags($row->snap), 25) . " ...</li>\n";
         }
         $oldId = $row->id;
     }
     $writeMap = empty($writeMap) ? '' : '<ul>' . $writeMap . '</ul>';
     return $writeMap;
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:45,代码来源:Sitemap.php

示例14: getAllTags

 /**
  * Returns all tags
  *
  * @param  string  $search Move the returned result set to be the result of a start-with search
  * @param  boolean $limit  Limit the returned result set
  * @return array
  */
 public function getAllTags($search = null, $limit = false)
 {
     global $DB;
     $tags = $allTags = array();
     // Hack: LIKE is case sensitive under PostgreSQL
     switch ($DB['type']) {
         case 'pgsql':
             $like = 'ILIKE';
             break;
         default:
             $like = 'LIKE';
             break;
     }
     $query = sprintf("\n            SELECT\n                tagging_id, tagging_name\n            FROM\n                %sfaqtags\n                %s\n            ORDER BY tagging_name", SQLPREFIX, isset($search) && $search != '' ? "WHERE tagging_name " . $like . " '" . $search . "%'" : '');
     $result = $this->db->query($query);
     if ($result) {
         while ($row = $this->db->fetchObject($result)) {
             $allTags[$row->tagging_id] = $row->tagging_name;
         }
     }
     $numberOfItems = $limit ? PMF_TAGS_CLOUD_RESULT_SET_SIZE : $this->db->numRows($result);
     if (isset($allTags) && $numberOfItems < count($allTags)) {
         $keys = array_keys($allTags);
         shuffle($keys);
         foreach ($keys as $current_key) {
             $tags[$current_key] = $allTags[$current_key];
         }
         $tags = array_slice($tags, 0, $numberOfItems);
     } else {
         $tags = PMF_Utils::shuffleData($allTags);
     }
     return $tags;
 }
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:40,代码来源:Tags.php

示例15: foreach

$rss->writeElement('link', PMF_Link::getSystemUri('/feed/topten/rss.php'));
if ($num > 0) {
    $i = 0;
    foreach ($rssData as $item) {
        $i++;
        // Get the url
        $link = str_replace($_SERVER['PHP_SELF'], '/index.php', $item['url']);
        if (PMF_RSS_USE_SEO) {
            if (isset($item['thema'])) {
                $oL = new PMF_Link($link);
                $oL->itemTitle = $item['thema'];
                $link = $oL->toString();
            }
        }
        $rss->startElement('item');
        $rss->writeElement('title', utf8_encode(PMF_Utils::makeShorterText($item['thema'], 8) . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")"));
        $rss->startElement('description');
        $rss->writeCdata(utf8_encode("[" . $i . ".] " . $item['thema'] . " (" . $item['visits'] . " " . $PMF_LANG['msgViews'] . ")"));
        $rss->endElement();
        $rss->writeElement('link', utf8_encode(PMF_Link::getSystemUri('/feed/topten/rss.php') . $link));
        $rss->writeElement('pubDate', PMF_Date::createRFC822Date($item['last_visit'], false));
        $rss->endElement();
    }
}
$rss->endElement();
$rss->endElement();
$rssData = $rss->outputMemory();
header('Content-Type: application/rss+xml');
header('Content-Length: ' . strlen($rssData));
print $rssData;
$db->dbclose();
开发者ID:noon,项目名称:phpMyFAQ,代码行数:31,代码来源:rss.php


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