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


PHP SemanticScuttle_Service_Factory类代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $GLOBALS['enableVoting'] = true;
     //FIXME: create true new instance
     $this->vs = SemanticScuttle_Service_Factory::get('Vote');
     $this->vs->deleteAll();
     $this->bs = SemanticScuttle_Service_Factory::get('Bookmark');
 }
开发者ID:MarxGonzalez,项目名称:SemanticScuttle,代码行数:8,代码来源:VoteTest.php

示例2: setUp

 protected function setUp()
 {
     $this->us = SemanticScuttle_Service_Factory::get('User');
     $this->bs = SemanticScuttle_Service_Factory::get('Bookmark');
     $this->bs->deleteAll();
     $this->b2ts = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
     $this->b2ts->deleteAll();
     $this->tts = SemanticScuttle_Service_Factory::get('Tag2Tag');
     $this->tts->deleteAll();
     $this->tsts = SemanticScuttle_Service_Factory::get('TagStat');
     $this->tsts->deleteAll();
 }
开发者ID:hrepp,项目名称:SemanticScuttle,代码行数:12,代码来源:Tag2TagTest.php

示例3: startElement

function startElement($parser, $name, $attrs)
{
    global $depth, $status, $tplVars, $userservice;
    $bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
    if ($name == 'POST') {
        $newstatus = $status;
        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;
                case 'PRIVATE':
                    if ($attrVal == 'yes') {
                        $newstatus = 2;
                    }
                    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');
            }
            $res = $bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, '', $newstatus, $tags, null, $bDatetime, true, true);
            if ($res) {
                $tplVars['msg'] = T_('Bookmark imported.');
            } else {
                $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
            }
        }
    }
    if (!isset($depth[(int) $parser])) {
        $depth[(int) $parser] = 0;
    }
    $depth[(int) $parser]++;
}
开发者ID:MarxGonzalez,项目名称:SemanticScuttle,代码行数:52,代码来源:import.php

示例4: testOnlyAdminTags

 /**
  * Verify that we only get admin tags, not tags from
  * non-admin people
  */
 public function testOnlyAdminTags()
 {
     $t2t = SemanticScuttle_Service_Factory::get('Tag2Tag');
     $t2t->deleteAll();
     $menu2Tag = reset($GLOBALS['menu2Tags']);
     //we have a subtag now
     $this->addBookmark($this->getAdminUser(), null, 0, $menu2Tag . '>adminsubtag');
     //add another bookmark now, but for a normal user
     $this->addBookmark(null, null, 0, $menu2Tag . '>normalsubtag');
     $res = $this->getRequest('?tag=' . $menu2Tag)->send();
     $this->assertResponseJson200($res);
     $data = json_decode($res->getBody());
     $this->assertInternalType('array', $data);
     //we should have only one subtag now, the admin one
     $this->assertEquals(1, count($data));
     $this->assertEquals('adminsubtag', $data[0]->data->title);
 }
开发者ID:lcorbasson,项目名称:SemanticScuttle,代码行数:21,代码来源:GetAdminLinkedTagsTest.php

示例5: setUp

 protected function setUp()
 {
     if ($GLOBALS['unittestUrl'] === null) {
         $this->assertTrue(false, 'Unittest URL not set in config');
     }
     if ($this->urlPart === null) {
         $this->assertTrue(false, 'Set the urlPart variable');
     }
     $this->url = $GLOBALS['unittestUrl'] . $this->urlPart;
     //clean up before test
     $configFile = $GLOBALS['datadir'] . '/config.testing-tmp.php';
     if (file_exists($configFile)) {
         unlink($configFile);
     }
     $this->us = SemanticScuttle_Service_Factory::get('User');
     $this->us->deleteAll();
     $this->bs = SemanticScuttle_Service_Factory::get('Bookmark');
     $this->bs->deleteAll();
     $this->b2t = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
     $this->b2t->deleteAll();
 }
开发者ID:hrepp,项目名称:SemanticScuttle,代码行数:21,代码来源:TestBaseApi.php

示例6: getAdminUser

 /**
  * Retrieves the UID of an admin user.
  * If that user does not exist in the database, it is created.
  *
  * @return integer UID of admin user
  */
 protected function getAdminUser()
 {
     if (count($GLOBALS['admin_users']) == 0) {
         $this->fail('No admin users configured');
     }
     $adminUserName = reset($GLOBALS['admin_users']);
     $us = SemanticScuttle_Service_Factory::get('User');
     $uid = $us->getIdFromUser($adminUserName);
     if ($uid === null) {
         //that user does not exist in the database; create it
         $uid = $us->addUser($adminUserName, rand(), 'unittest-admin-' . $adminUserName . '@example.org');
     }
     return $uid;
 }
开发者ID:hrepp,项目名称:SemanticScuttle,代码行数:20,代码来源:TestBase.php

示例7: trim

 * @param integer $limit      Number of tags to return. Defaults to 1000
 *
 * Part of SemanticScuttle - your social bookmark manager.
 *
 * PHP version 5.
 *
 * @category Bookmarking
 * @package  SemanticScuttle
 * @author   Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
 * @author   Christian Weiske <cweiske@cweiske.de>
 * @author   Eric Dane <ericdane@users.sourceforge.net>
 * @license  GPL http://www.gnu.org/licenses/gpl.html
 * @link     http://sourceforge.net/projects/semanticscuttle
 */
$httpContentType = 'application/json';
require_once '../www-header.php';
$limit = 30;
$beginsWith = null;
$currentUserId = $userservice->getCurrentUserId();
if (isset($_GET['limit']) && is_numeric($_GET['limit'])) {
    $limit = (int) $_GET['limit'];
}
if (isset($_GET['beginsWith']) && strlen(trim($_GET['beginsWith']))) {
    $beginsWith = trim($_GET['beginsWith']);
}
$listTags = SemanticScuttle_Service_Factory::get('Bookmark2Tag')->getAdminTags($limit, $currentUserId, null, $beginsWith);
$tags = array();
foreach ($listTags as $t) {
    $tags[] = $t['tag'];
}
echo json_encode($tags);
开发者ID:lcorbasson,项目名称:SemanticScuttle,代码行数:31,代码来源:getadmintags.php

示例8:

<?php

/* Export data with semantic format (SIOC: http://sioc-project.org/, FOAF, SKOS, Annotea Ontology) */
$httpContentType = 'text/xml';
require_once '../www-header.php';
/* Service creation: only useful services are created */
$userservice = SemanticScuttle_Service_Factory::get('User');
$bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
echo "<?xml version=\"1.0\" encoding=\"utf-8\"\n?>";
?>
<rdf:RDF
	xmlns="http://xmlns.com/foaf/0.1/"
	xmlns:foaf="http://xmlns.com/foaf/0.1/"
	xmlns:rss="http://purl.org/rss/1.0/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:dcterms="http://purl.org/dc/terms/"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:sioc="http://rdfs.org/sioc/ns#"
	xmlns:sioc_t="http://rdfs.org/sioc/types#"	
	xmlns:bm="http://www.w3.org/2002/01/bookmark#"
	xmlns:skos="http://www.w3.org/2004/02/skos/core#">

<?php 
//site and community are described using FOAF and SIOC ontology
?>
<sioc:Site rdf:about="<?php 
echo ROOT;
?>
" >
  <rdf:label><?php 
开发者ID:hrepp,项目名称:SemanticScuttle,代码行数:31,代码来源:export_sioc.php

示例9: renameTag

 function renameTag($userid, $old, $new, $fromApi = false)
 {
     $bookmarkservice = SemanticScuttle_Service_Factory::get('Bookmark');
     $tagservice = SemanticScuttle_Service_Factory::get('Tag');
     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($userid, $old);
     // Attach new tags
     $new = $tagservice->normalize($new);
     foreach (array_keys($bookmarks) as $key) {
         $row =& $bookmarks[$key];
         $this->attachTags($row['bId'], $new, $fromApi, NULL, false);
     }
     return true;
 }
开发者ID:hrepp,项目名称:SemanticScuttle,代码行数:20,代码来源:Bookmark2Tag.php

示例10: foreach

 *
 * SemanticScuttle - your social bookmark manager.
 *
 * PHP version 5.
 *
 * @category    Bookmarking
 * @package     SemanticScuttle
 * @subcategory Templates
 * @author      Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
 * @author      Christian Weiske <cweiske@cweiske.de>
 * @author      Eric Dane <ericdane@users.sourceforge.net>
 * @license     GPL http://www.gnu.org/licenses/gpl.html
 * @link        http://sourceforge.net/projects/semanticscuttle
 */
/* Service creation: only useful services are created */
$searchhistoryservice = SemanticScuttle_Service_Factory::get('SearchHistory');
$lastSearches = $searchhistoryservice->getAllSearches('all', NULL, 3, NULL, true, false);
if ($lastSearches && count($lastSearches) > 0) {
    ?>

<h2><?php 
    echo T_('Last Searches');
    ?>
</h2>
<div id="searches">
 <table>
<?php 
    foreach ($lastSearches as $row) {
        echo '  <tr><td>';
        echo '<a href="' . htmlspecialchars(createURL('search', $range . '/' . $row['shTerms'])) . '">';
        echo htmlspecialchars($row['shTerms']);
开发者ID:MarxGonzalez,项目名称:SemanticScuttle,代码行数:31,代码来源:sidebar.block.search.php

示例11: deleteAll

 function deleteAll()
 {
     $query = 'TRUNCATE TABLE `' . $this->getTableName() . '`';
     $this->db->sql_query($query);
     $tsts = SemanticScuttle_Service_Factory::get('TagStat');
     $tsts->deleteAll();
 }
开发者ID:MarxGonzalez,项目名称:SemanticScuttle,代码行数:7,代码来源:Tag2Tag.php

示例12: array

    if ($GLOBALS['enableVoting']) {
        if (isset($_SESSION['lastUrl'])) {
            $GLOBALS['lastUrl'] = $_SESSION['lastUrl'];
        }
        //this here is hacky, but currently the only way to
        // differentiate between css/js php files and normal
        // http files
        if (!isset($GLOBALS['saveInLastUrl']) || $GLOBALS['saveInLastUrl']) {
            $_SESSION['lastUrl'] = $_SERVER['REQUEST_URI'];
        }
    }
}
// 5 // Create mandatory services and objects
$userservice = SemanticScuttle_Service_Factory::get('User');
$currentUser = $userservice->getCurrentObjectUser();
$templateservice = SemanticScuttle_Service_Factory::get('Template');
$tplVars = array();
$tplVars['currentUser'] = $currentUser;
$tplVars['userservice'] = $userservice;
// 6 // Force UTF-8 behaviour for server (cannot be moved into top.inc.php which is not included into every file)
if (!defined('UNIT_TEST_MODE') || defined('HTTP_UNIT_TEST_MODE')) {
    //API files define that, so we need a way to support both of them
    if (!isset($httpContentType)) {
        if (DEBUG_MODE) {
            //using that mime type makes all javascript nice in Chromium
            // it also serves as test base if the pages really validate
            $httpContentType = 'application/xhtml+xml';
        } else {
            //until we are sure that all pages validate, we
            // keep the non-strict mode on for normal installations
            $httpContentType = 'text/html';
开发者ID:lcorbasson,项目名称:SemanticScuttle,代码行数:31,代码来源:header.php

示例13: displayLinkedTags

function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode = false, $precedentTag = null, $level = 0, $stopList = array())
{
    if (in_array($tag, $stopList)) {
        return array('output' => '', 'stoplist' => $stopList);
    }
    $tag2tagservice = SemanticScuttle_Service_Factory::get('Tag2Tag');
    $tagstatservice = SemanticScuttle_Service_Factory::get('TagStat');
    // link '>'
    if ($level > 1) {
        if ($editingMode) {
            $link = '<small><a href="' . createURL('tag2tagedit', $precedentTag . '/' . $tag) . '" title="' . _('Edit link') . '">></a> </small>';
        } else {
            $link = '> ';
        }
    } else {
        $link = '';
    }
    $output = '';
    $output .= '<tr>';
    $output .= '<td></td>';
    $output .= '<td>';
    $output .= $level == 1 ? '<b>' : '';
    $output .= str_repeat('&nbsp;', $level * 2) . $link . '<a href="' . sprintf($cat_url, filter($user, 'url'), filter($tag, 'url')) . '" rel="tag">' . filter($tag) . '</a>';
    $output .= $level == 1 ? '</b>' : '';
    //$output.= ' - '. $tagstatservice->getMaxDepth($tag, $linkType, $uId);
    $synonymTags = $tag2tagservice->getAllLinkedTags($tag, '=', $uId);
    $synonymTags = is_array($synonymTags) ? $synonymTags : array($synonymTags);
    sort($synonymTags);
    $synonymList = '';
    foreach ($synonymTags as $synonymTag) {
        //$output.= ", ".$synonymTag;
        $synonymList .= $synonymTag . ' ';
    }
    if (count($synonymTags) > 0) {
        $output .= ', ' . $synonymTags[0];
    }
    if (count($synonymTags) > 1) {
        $output .= '<span title="' . T_('Synonyms:') . ' ' . $synonymList . '">, etc</span>';
    }
    /*if($editingMode) {
    	$output.= ' (';
    	$output.= '<a href="'.createURL('tag2tagadd', $tag).'" title="'._('Add a subtag').'">+</a>';
    	if(1) {
    	    $output.= ' - ';
    	    $output.= '<a href="'.createURL('tag2tagdelete', $tag).'">-</a>';
    	}
    	$output.= ')';
        }*/
    $output .= '</td>';
    $output .= '</tr>';
    $tags = array($tag);
    $tags = array_merge($tags, $synonymTags);
    foreach ($tags as $tag) {
        if (!in_array($tag, $stopList)) {
            $linkedTags = $tag2tagservice->getLinkedTags($tag, '>', $uId);
            $precedentTag = $tag;
            $stopList[] = $tag;
            foreach ($linkedTags as $linkedTag) {
                $displayLinkedTags = displayLinkedTags($linkedTag, $linkType, $uId, $cat_url, $user, $editingMode, $precedentTag, $level + 1, $stopList);
                $output .= $displayLinkedTags['output'];
            }
            if (isset($displayLinkedTags) && is_array($displayLinkedTags['stopList'])) {
                $stopList = array_merge($stopList, $displayLinkedTags['stopList']);
                $stopList = array_unique($stopList);
            }
        }
    }
    return array('output' => $output, 'stopList' => $stopList);
}
开发者ID:MarxGonzalez,项目名称:SemanticScuttle,代码行数:69,代码来源:sidebar.linkedtags.inc.php

示例14: setUp

 protected function setUp()
 {
     $this->us = SemanticScuttle_Service_Factory::get('User');
     $this->us->deleteAll();
 }
开发者ID:hrepp,项目名称:SemanticScuttle,代码行数:5,代码来源:UserTest.php

示例15: T_

        $tplVars['error'] = T_('This username already exists, please make another choice.');
        // Check if username is valid (length, authorized characters)
    } elseif (!$userservice->isValidUsername($posteduser)) {
        $tplVars['error'] = T_('This username is not valid (too short, too long, forbidden characters...), please make another choice.');
        // Check if e-mail address is valid
    } elseif (!$userservice->isValidEmail(POST_MAIL)) {
        $tplVars['error'] = T_('E-mail address is not valid. Please try again.');
        // Check if antispam answer is valid (doesn't take into account spaces and uppercase)
    } elseif (strcasecmp(str_replace(' ', '', POST_ANTISPAMANSWER), str_replace(' ', '', $GLOBALS['antispamAnswer'])) != 0) {
        $tplVars['error'] = T_('Antispam answer is not valid. Please try again.');
        // Register details
    } else {
        $uId = $userservice->addUser($posteduser, POST_PASS, POST_MAIL);
        if ($uId !== false) {
            if (isset($_SERVER['SSL_CLIENT_VERIFY']) && $_SERVER['SSL_CLIENT_VERIFY'] == 'SUCCESS') {
                $ssl = SemanticScuttle_Service_Factory::get('User_SslClientCert');
                $ssl->registerCurrentCertificate($uId);
                $ssl->updateProfileFromCurentCert($uId);
            }
            // Log in with new username
            $login = $userservice->login($posteduser, POST_PASS);
            if ($login) {
                header('Location: ' . createURL('bookmarks', $posteduser));
            }
            $tplVars['msg'] = T_('You have successfully registered. Enjoy!');
        } else {
            $tplVars['error'] = T_('Registration failed. Please try again.');
        }
    }
}
$tplVars['antispamQuestion'] = $GLOBALS['antispamQuestion'];
开发者ID:MarxGonzalez,项目名称:SemanticScuttle,代码行数:31,代码来源:register.php


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