本文整理汇总了PHP中Repository类的典型用法代码示例。如果您正苦于以下问题:PHP Repository类的具体用法?PHP Repository怎么用?PHP Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Repository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
// Get the url of the Alfresco repository from the Joosco plugin
// That's why the Joosco plugin needs to be installed and configured before the component
$plugin =& JPluginHelper::getPlugin('authentication', 'joosco');
$pluginParams = new JParameter($plugin->params);
// Here we connect to the Repository
$repositoryUrl = $pluginParams->get('alf-url');
$repository = new Repository($repositoryUrl);
// The ticket is created by the plugin when a user connects
$ticket = $_SESSION["ticket"];
$session = $repository->createSession($ticket);
$store = new SpacesStore($session);
$currentNode = null;
$uuid = null;
$uuid =& JRequest::getVar('uuid');
if (!isset($uuid)) {
$currentNode = $store->companyHome;
$path = 'Company Home';
} else {
$currentNode = $session->getNode($store, JRequest::getVar('uuid'));
$path = JRequest::getVar('path') . '|' . JRequest::getVar('uuid') . '|' . JRequest::getVar('name');
}
// Pass the values to the rest of the template
$this->assignRef('path', $path);
$this->assignRef('session', $session);
$this->assignRef('store', $store);
$this->assignRef('currentNode', $currentNode);
$this->assignRef('option', JRequest::getVar('option'));
$this->assignRef('view', JRequest::getVar('view'));
$this->assignRef('itemid', JRequest::getVar('Itemid'));
parent::display($tpl);
}
开发者ID:fintanmm,项目名称:joosco,代码行数:33,代码来源:view.html.php
示例2: searchRepository
/**
* Add the field to query to find the model
*
* @param Repository $repository
*
* @return Repository
*/
public function searchRepository($repository, $value, $table = null)
{
if (!$table) {
$table = $this->getObjectSchema()->getTable();
}
return $repository->orWhere($table . "." . $this->getColumn(), (int) $value);
}
开发者ID:EchoWine,项目名称:database,代码行数:14,代码来源:Schema.php
示例3: __construct
/**
* Constructor.
*
* @param Repository $repository
*/
public function __construct(Repository $repository)
{
$this->repository = $repository;
$this->manager = $repository->getManager();
$this->metadata = $repository->getMetadata();
$this->query = $this->manager->getConnection()->createQueryBuilder()->from($this->metadata->getTable());
}
开发者ID:jacobjjc,项目名称:PageKit-framework,代码行数:12,代码来源:QueryBuilder.php
示例4: doRepositoryTest
/**
* Test Repository
*
* @param Repository $repo
* @return Boolean
*/
public function doRepositoryTest($repo)
{
if ($repo->accessType != 'fs') {
return -1;
}
// Check the destination path
$this->failedInfo = "";
$safePath = $repo->getOption("PATH", true);
if (strstr($safePath, "AJXP_USER") !== false) {
return TRUE;
}
// CANNOT TEST THIS CASE!
$path = $repo->getOption("PATH", false);
$createOpt = $repo->getOption("CREATE");
$create = $createOpt == "true" || $createOpt === true ? true : false;
if (!$create && !@is_dir($path)) {
$this->failedInfo .= "Selected repository path " . $path . " doesn't exist, and the CREATE option is false";
return FALSE;
}
/* else if ($create && !is_writeable($path)) {
$this->failedInfo .= "Selected repository path ".$path." isn't writeable"; return FALSE;
}*/
// Do more tests here
return TRUE;
}
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:31,代码来源:test.fsAccess.php
示例5: initRepository
public function initRepository()
{
if (is_array($this->pluginConf)) {
$this->driverConf = $this->pluginConf;
} else {
$this->driverConf = array();
}
$smbclientPath = $this->driverConf["SMBCLIENT"];
define('SMB4PHP_SMBCLIENT', $smbclientPath);
$smbtmpPath = $this->driverConf["SMB_PATH_TMP"];
define('SMB4PHP_SMBTMP', $smbtmpPath);
require_once $this->getBaseDir() . "/smb.php";
$create = $this->repository->getOption("CREATE");
$recycle = $this->repository->getOption("RECYCLE_BIN");
$this->detectStreamWrapper(true);
$this->urlBase = "pydio://" . $this->repository->getId();
if ($recycle != "" && !is_dir($this->urlBase . "/" . $recycle)) {
@mkdir($this->urlBase . "/" . $recycle);
if (!is_dir($this->urlBase . "/" . $recycle)) {
throw new AJXP_Exception("Cannot create recycle bin folder. Please check repository configuration or that your folder is writeable!");
}
}
if ($recycle != "") {
RecycleBinManager::init($this->urlBase, "/" . $recycle);
}
}
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:26,代码来源:class.smbAccessDriver.php
示例6: onAuthenticate
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate($credentials, $options, &$response)
{
// This file is needed to use the Repository class
require_once dirname(__FILE__) . '/alfresco-php-library/Repository.php';
// Get the URL of the Alfresco repository as a parameter of the plugin
$plugin =& JPluginHelper::getPlugin('authentication', 'joosco');
$pluginParams = new JParameter($plugin->params);
// Set the variables
$repositoryUrl = $pluginParams->get('alf-url');
$userName = $credentials['username'];
$password = $credentials['password'];
// Connect to the repository
$repository = new Repository($repositoryUrl);
$ticket = null;
try {
// Try to create a ticket
$ticket = $repository->authenticate($userName, $password);
// If the ticket fails, it means that the username and/or password are wrong
$_SESSION["ticket"] = $ticket;
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
// There's no way to get the Alfresco name or email address of the user
// The only thing to do is wait for an update of the Alfresco PHP API
$response->username = $credentials['username'];
$response->email = $credentials['username'] . "@alfresco.user";
$response->fullname = $credentials['username'];
} catch (Exception $e) {
// Wrong username or password creates an exception
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Authentication failed';
}
}
开发者ID:fintanmm,项目名称:joosco,代码行数:41,代码来源:joosco.php
示例7: __construct
/**
* Session constructor
*
* @param Repository $repository The repository to log in
* @param string $workspaceName The workspace's name
*
* @api
*/
public function __construct(Repository $repository, $workspaceName = null)
{
$this->repository = $repository;
$parameters = $repository->getParameters();
$credentials = new \PHPCR\SimpleCredentials($parameters['credentials.username'], $parameters['credentials.password']);
$this->session = $repository->login($credentials, $workspaceName);
}
开发者ID:marmelab,项目名称:phpcr-api,代码行数:15,代码来源:Session.php
示例8: send
/**
* Send linkback on "create" events to remote repositories
*/
public function send($event, Repository $repo)
{
if ($this->config === false) {
return;
}
if ($event != 'create') {
return;
}
$origin = $repo->getConnectionInfo()->getOrigin();
if ($origin === null) {
return;
}
$originWebUrl = $origin->getWebUrl(true);
if ($originWebUrl === null) {
return;
}
$this->pbc = new \PEAR2\Services\Linkback\Client();
$req = $this->pbc->getRequest();
$req->setConfig(array('ssl_verify_peer' => false, 'ssl_verify_host' => false));
$this->pbc->setRequestTemplate($req);
$req->setHeader('user-agent', 'phorkie');
try {
$res = $this->pbc->send($repo->getLink('display', null, true), $originWebUrl);
} catch (\Exception $e) {
//FIXME: log errors
}
}
开发者ID:nickel715,项目名称:phorkie,代码行数:30,代码来源:Linkback.php
示例9: initRepository
public function initRepository()
{
if (is_array($this->pluginConf)) {
$this->driverConf = $this->pluginConf;
} else {
$this->driverConf = array();
}
if (!function_exists('ssh2_connect')) {
throw new Exception("You must have the php ssh2 extension active!");
}
ConfService::setConf("PROBE_REAL_SIZE", false);
$path = $this->repository->getOption("PATH");
$recycle = $this->repository->getOption("RECYCLE_BIN");
$this->detectStreamWrapper(true);
$this->urlBase = "pydio://" . $this->repository->getId();
restore_error_handler();
if (!file_exists($this->urlBase)) {
if ($this->repository->getOption("CREATE")) {
$test = @mkdir($this->urlBase);
if (!$test) {
throw new AJXP_Exception("Cannot create path ({$path}) for your repository! Please check the configuration.");
}
} else {
throw new AJXP_Exception("Cannot find base path ({$path}) for your repository! Please check the configuration!");
}
}
if ($recycle != "") {
RecycleBinManager::init($this->urlBase, "/" . $recycle);
}
}
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:30,代码来源:class.sftpAccessDriver.php
示例10: updateRepo
public function updateRepo(Repository $repo, $crdate = null, $modate = null)
{
//add repository
$r = new Database_Adapter_Elasticsearch_HTTPRequest($this->searchInstance . 'repo/' . $repo->id, \HTTP_Request2::METHOD_PUT);
$repoData = array('id' => $repo->id, 'description' => $repo->getDescription(), 'tstamp' => gmdate('c', time()));
if ($crdate == null) {
$crdate = $this->getCrDate($repo);
}
if ($crdate !== null) {
$repoData['crdate'] = gmdate('c', $crdate);
}
if ($modate == null) {
$modate = $this->getMoDate($repo);
}
if ($modate !== null) {
$repoData['modate'] = gmdate('c', $modate);
}
$r->setBody(json_encode((object) $repoData));
$r->send();
//add files
//clean up before adding files; files might have been deleted
$this->deleteRepoFiles($repo);
foreach ($repo->getFiles() as $file) {
$r = new Database_Adapter_Elasticsearch_HTTPRequest($this->searchInstance . 'file/?parent=' . $repo->id, \HTTP_Request2::METHOD_POST);
$r->setBody(json_encode((object) array('name' => $file->getFilename(), 'extension' => $file->getExt(), 'content' => $file->isText() ? $file->getContent() : '')));
$r->send();
}
}
开发者ID:nickel715,项目名称:phorkie,代码行数:28,代码来源:Indexer.php
示例11: createSharedChild
function createSharedChild($newLabel, $newOptions, $parentId, $owner, $uniqueUser)
{
$repo = new Repository(0, $newLabel, $this->accessType);
$newOptions = array_merge($this->options, $newOptions);
$repo->options = $newOptions;
$repo->setOwnerData($parentId, $owner, $uniqueUser);
return $repo;
}
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:8,代码来源:class.Repository.php
示例12: testValidateData
/**
* test protected _validateData()
*/
public function testValidateData()
{
$sourceClassName = 'Magento_Module_Controller_Index';
$resultClassName = 'Magento_Module_Controller';
$repository = new Repository();
$repository->init($sourceClassName, $resultClassName);
$this->assertFalse($repository->generate());
}
开发者ID:,项目名称:,代码行数:11,代码来源:
示例13: __construct
/**
* Constructs a commit.
* If commit data is not given, constructor will fetch them from log.
*
* @param Repository $repository Instance of Repository
* @param type $commitHash Commit hash
* @param array $data Optional given commit data
*/
public function __construct(Repository $repository, $commitHash, array $data = [])
{
$this->repository = $repository;
$this->commitHash = $commitHash;
if (empty($data)) {
$data = $this->repository->getLog()->getCommitData($commitHash);
}
$this->setData($data);
}
开发者ID:3wil,项目名称:GIFTploy,代码行数:17,代码来源:Commit.php
示例14: getCollection
/**
* @param array $tags
* @return \AwsInspector\Model\Collection
*/
public static function getCollection(array $tags = [])
{
$hash = serialize($tags);
if (!isset(self::$registry[$hash])) {
$repository = new Repository();
self::$registry[$hash] = $repository->findEc2InstancesByTags($tags);
}
return self::$registry[$hash];
}
开发者ID:AOEpeople,项目名称:AwsInspector,代码行数:13,代码来源:CollectionRegistry.php
示例15: validateRepository
/**
* Callback function to validate data
* @return bool must return true or other hooks don't get called
*/
function validateRepository($editPage, $textBox1, $section, &$hookError)
{
$ns = $editPage->mTitle->getNamespace();
if ($ns == NS_REPOSITORY) {
$repository = new Repository($editPage->mTitle->getText());
$repository->validate($textBox1, $section, $hookError);
}
return true;
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:13,代码来源:Repository.php
示例16: UserSelection
/**
* Construction selector
* @param Repository|null $repository
*/
public function UserSelection($repository = null, $httpVars = null)
{
$this->files = array();
if (isset($repository) && $repository->hasContentFilter()) {
$this->contentFilter = $repository->getContentFilter();
}
if (isset($httpVars)) {
$this->initFromHttpVars($httpVars);
}
}
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:14,代码来源:class.UserSelection.php
示例17: resolveRelations
/**
* Resolve relations
*
* @param array $result
* @param Repository $repository
*
* @return array
*/
public function resolveRelations(&$results, &$relation, $repository)
{
foreach ($results as $result) {
if (!empty($result[$this->getColumn()])) {
if (!$repository->isObjectORM($this->getRelation(), $result[$this->getColumn()])) {
$relation[$this->getRelation()][$this->getRelationColumn()][$result[$this->getColumn()]] = $result[$this->getColumn()];
}
}
}
}
开发者ID:EchoWine,项目名称:database,代码行数:18,代码来源:Schema.php
示例18: boot
/**
* Register custom Redis cache driver.
*
* @return void
*/
public function boot()
{
Cache::extend('redis', function ($app, $config) {
$store = new RedisStore($app['redis'], Arr::get($config, 'prefix', $this->app['config']['cache.prefix']), Arr::get($config, 'connection', 'default'));
$repository = new Repository($store);
if ($app->bound('Illuminate\\Contracts\\Events\\Dispatcher')) {
$repository->setEventDispatcher($app['Illuminate\\Contracts\\Events\\Dispatcher']);
}
return $repository;
});
}
开发者ID:tillkruss,项目名称:laravel-phpredis,代码行数:16,代码来源:RedisServiceProvider.php
示例19: executeAdd
public function executeAdd()
{
$name = mfwRequest::get('name');
$project = mfwRequest::get('project');
if (!$name || !$project) {
return $this->buildErrorPage("invalid argument (name={$name}, project={$project})", "/pulls/add", 'return');
}
$repo = new Repository(array('name' => $name, 'project' => $project));
$repo->save();
return $this->redirect("/pulls/index");
}
开发者ID:ELN,项目名称:metahub,代码行数:11,代码来源:actions.php
示例20: testDeletingDocuments
public function testDeletingDocuments()
{
$config = new Config('/tmp/flywheel');
$repo = new Repository('_pages', $config);
$id = 'delete_test';
$name = $id . '_' . sha1($id) . '.json';
$path = '/tmp/flywheel/_pages/' . $name;
file_put_contents($path, '');
$this->assertTrue(is_file($path));
$repo->delete($id);
$this->assertFalse(is_file($path));
}
开发者ID:gekt,项目名称:www,代码行数:12,代码来源:RepositoryTest.php
注:本文中的Repository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论