當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Repository類代碼示例

本文整理匯總了PHP中Repository的典型用法代碼示例。如果您正苦於以下問題:PHP Repository類的具體用法?PHP Repository怎麽用?PHP Repository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Repository類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Repository類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。