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


PHP ServiceFactory::getServiceInstance方法代码示例

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


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

示例1: startElement

function startElement($parser, $name, $attrs)
{
    global $depth, $status, $tplVars, $userservice;
    $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
    $userservice =& ServiceFactory::getServiceInstance('UserService');
    if ($name == 'POST') {
        while (list($attrTitle, $attrVal) = each($attrs)) {
            switch ($attrTitle) {
                case 'HREF':
                    $bAddress = $attrVal;
                    break;
                case 'DESCRIPTION':
                    $bTitle = $attrVal;
                    break;
                case 'EXTENDED':
                    $bDescription = $attrVal;
                    break;
                case 'TIME':
                    $bDatetime = $attrVal;
                    break;
                case 'TAG':
                    $tags = strtolower($attrVal);
                    break;
            }
        }
        if ($bookmarkservice->bookmarkExists($bAddress, $userservice->getCurrentUserId())) {
            $tplVars['error'] = T_('You have already submitted this bookmark.');
        } else {
            // Strangely, PHP can't work out full ISO 8601 dates, so we have to chop off the Z.
            $bDatetime = substr($bDatetime, 0, -1);
            // If bookmark claims to be from the future, set it to be now instead
            if (strtotime($bDatetime) > time()) {
                $bDatetime = gmdate('Y-m-d H:i:s');
            }
            if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $status, $tags, $bDatetime, true, true)) {
                $tplVars['msg'] = T_('Bookmark imported.');
            } else {
                $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
            }
        }
    }
    $depth[$parser]++;
}
开发者ID:asymmetric,项目名称:scuttle,代码行数:43,代码来源:import.php

示例2: array

(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
***************************************************************************/
require_once 'header.inc.php';
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$tplVars = array();
header('Content-Type: application/xml');
list($url, $user, $cat) = explode('/', $_SERVER['PATH_INFO']);
if ($usecache) {
    // Generate hash for caching on
    $hashtext = $_SERVER['REQUEST_URI'];
    if ($userservice->isLoggedOn()) {
        $hashtext .= $userservice->getCurrentUserID();
        $currentUser = $userservice->getCurrentUser();
        $currentUsername = $currentUser[$userservice->getFieldName('username')];
        if ($currentUsername == $user) {
            $hashtext .= $user;
        }
    }
    $hash = md5($hashtext);
开发者ID:kidwellj,项目名称:scuttle,代码行数:31,代码来源:rss.php

示例3: array

(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
***************************************************************************/
require_once 'header.inc.php';
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$userservice =& ServiceFactory::getServiceInstance('UserService');
$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
$tplVars = array();
@(list($url, $user, $page) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL);
$loggedon = false;
if ($userservice->isLoggedOn()) {
    $loggedon = true;
    $currentUser = $userservice->getCurrentUser();
    $currentUsername = $currentUser[$userservice->getFieldName('username')];
}
if ($usecache) {
    // Generate hash for caching on
    if ($loggedon) {
        if ($currentUsername != $user) {
            $cachehash = md5($_SERVER['REQUEST_URI'] . $currentUsername);
            // Cache for 5 minutes
            $cacheservice->Start($cachehash);
开发者ID:kidwellj,项目名称:scuttle,代码行数:31,代码来源:watchlist.php

示例4:

<?php

$userservice =& ServiceFactory::getServiceInstance('UserService');
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
$logged_on_userid = $userservice->getCurrentUserId();
$this->includeTemplate($GLOBALS['top_include']);
include 'search.inc.php';
if (count($bookmarks) > 0) {
    ?>

<p id="sort">
    <?php 
    echo T_("Sort by:");
    ?>
    <a href="?sort=date_desc"><?php 
    echo T_("Date");
    ?>
</a><span> / </span>
    <a href="?sort=title_asc"><?php 
    echo T_("Title");
    ?>
</a><span> / </span>
    <?php 
    if (!isset($hash)) {
        ?>
    <a href="?sort=url_asc"><?php 
        echo T_("URL");
        ?>
</a>
    <?php 
    }
开发者ID:asymmetric,项目名称:scuttle,代码行数:31,代码来源:bookmarks.tpl.php

示例5: Copyright

<?php

/***************************************************************************
Copyright (c) 2004 - 2010 Marcus Campbell
http://scuttle.org/

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
***************************************************************************/
require_once 'header.inc.php';
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
$tplVars = array();
$tplVars['subtitle'] = T_('About');
$templateservice->loadTemplate('about.tpl', $tplVars);
开发者ID:kidwellj,项目名称:scuttle,代码行数:25,代码来源:about.php

示例6: countOthers

 function countOthers($address)
 {
     if (!$address) {
         return false;
     }
     $userservice =& ServiceFactory::getServiceInstance('UserService');
     $sId = $userservice->getCurrentUserId();
     if ($userservice->isLoggedOn()) {
         // All public bookmarks, user's own bookmarks and any shared with user
         $privacy = ' AND ((B.bStatus = 0) OR (B.uId = ' . $sId . ')';
         $watchnames = $userservice->getWatchNames($sId, true);
         foreach ($watchnames as $watchuser) {
             $privacy .= ' OR (U.username = "' . $watchuser . '" AND B.bStatus = 1)';
         }
         $privacy .= ')';
     } else {
         // Just public bookmarks
         $privacy = ' AND B.bStatus = 0';
     }
     $sql = 'SELECT COUNT(*) FROM ' . $userservice->getTableName() . ' AS U, ' . $GLOBALS['tableprefix'] . 'bookmarks AS B WHERE U.' . $userservice->getFieldName('primary') . ' = B.uId AND B.bHash = "' . md5($address) . '"' . $privacy;
     if (!($dbresult =& $this->db->sql_query($sql))) {
         message_die(GENERAL_ERROR, 'Could not get vars', '', __LINE__, __FILE__, $sql, $this->db);
     }
     return $this->db->sql_fetchfield(0, 0) - 1;
 }
开发者ID:kidwellj,项目名称:scuttle,代码行数:25,代码来源:bookmarkservice.php

示例7: renameTag

 function renameTag($userid, $old, $new, $fromApi = false)
 {
     $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
     if (is_null($userid) || is_null($old) || is_null($new)) {
         return false;
     }
     // Find bookmarks with old tag
     $bookmarksInfo =& $bookmarkservice->getBookmarks(0, NULL, $userid, $old);
     $bookmarks =& $bookmarksInfo['bookmarks'];
     // Delete old tag
     $this->deleteTag($old);
     // Attach new tags
     foreach (array_keys($bookmarks) as $key) {
         $row =& $bookmarks[$key];
         $this->attachTags($row['bId'], $new, $fromApi, NULL, false);
     }
     return true;
 }
开发者ID:kidwellj,项目名称:scuttle,代码行数:18,代码来源:tagservice.php

示例8: foreach

<?php

$tagservice =& ServiceFactory::getServiceInstance('TagService');
$commonTags =& $tagservice->getRelatedTagsByHash($hash);
$commonTags =& $tagservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc');
if ($commonTags && count($commonTags) > 0) {
    ?>

<h2><?php 
    echo T_('Popular Tags');
    ?>
</h2>
<div id="common">
    <p class="tags">
    <?php 
    $contents = '';
    foreach ($commonTags as $row) {
        $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']);
        $contents .= '<a href="' . sprintf($cat_url, $user, filter($row['tag'], 'url')) . '" title="' . $row['bCount'] . ' ' . $entries . '" rel="tag" style="font-size:' . $row['size'] . '">' . filter($row['tag']) . '</a> ';
    }
    echo $contents . "\n";
    ?>
    </p>
</div>

<?php 
}
开发者ID:kidwellj,项目名称:scuttle,代码行数:27,代码来源:sidebar.block.common.php


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