id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
188,000 | rexxars/html-validator | library/HtmlValidator/Response.php | Response.parse | private function parse() {
$data = json_decode($this->httpResponse->getBody(), true);
foreach ($data['messages'] as $message) {
$msg = new Message($message);
$this->messages[] = $msg;
if ($message['type'] === 'error' || $message['type'] === 'non-document-error') {
... | php | private function parse() {
$data = json_decode($this->httpResponse->getBody(), true);
foreach ($data['messages'] as $message) {
$msg = new Message($message);
$this->messages[] = $msg;
if ($message['type'] === 'error' || $message['type'] === 'non-document-error') {
... | [
"private",
"function",
"parse",
"(",
")",
"{",
"$",
"data",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"httpResponse",
"->",
"getBody",
"(",
")",
",",
"true",
")",
";",
"foreach",
"(",
"$",
"data",
"[",
"'messages'",
"]",
"as",
"$",
"message",
")",
... | Parse the received response into a usable format | [
"Parse",
"the",
"received",
"response",
"into",
"a",
"usable",
"format"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/Response.php#L95-L108 |
188,001 | rexxars/html-validator | library/HtmlValidator/Response.php | Response.format | public function format($useHTML = false) {
$msgs = array();
foreach ($this->messages as $msg) {
$msgs[] = $msg->format($useHTML);
}
return implode(PHP_EOL . PHP_EOL, $msgs);
} | php | public function format($useHTML = false) {
$msgs = array();
foreach ($this->messages as $msg) {
$msgs[] = $msg->format($useHTML);
}
return implode(PHP_EOL . PHP_EOL, $msgs);
} | [
"public",
"function",
"format",
"(",
"$",
"useHTML",
"=",
"false",
")",
"{",
"$",
"msgs",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"messages",
"as",
"$",
"msg",
")",
"{",
"$",
"msgs",
"[",
"]",
"=",
"$",
"msg",
"->",
"for... | Returns a string-representation of all messages encountered
@param boolean $useHTML Whether to use HTML for formatting
@return string | [
"Returns",
"a",
"string",
"-",
"representation",
"of",
"all",
"messages",
"encountered"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/Response.php#L170-L178 |
188,002 | silverstripe/silverstripe-dms | code/model/DMSDocument_versions.php | DMSDocument_versions.create_version | public static function create_version(DMSDocument $doc)
{
$success = false;
$existingPath = $doc->getFullPath();
if (is_file($existingPath)) {
$docData = $doc->toMap();
unset($docData['ID']);
$version = new DMSDocument_versions($docData); //create a copy... | php | public static function create_version(DMSDocument $doc)
{
$success = false;
$existingPath = $doc->getFullPath();
if (is_file($existingPath)) {
$docData = $doc->toMap();
unset($docData['ID']);
$version = new DMSDocument_versions($docData); //create a copy... | [
"public",
"static",
"function",
"create_version",
"(",
"DMSDocument",
"$",
"doc",
")",
"{",
"$",
"success",
"=",
"false",
";",
"$",
"existingPath",
"=",
"$",
"doc",
"->",
"getFullPath",
"(",
")",
";",
"if",
"(",
"is_file",
"(",
"$",
"existingPath",
")",
... | Creates a new version of a document by moving the current file and
renaming it to the versioned filename.
This method assumes that the method calling this is just about to upload
a new file to replace the old file.
@static
@param DMSDocument $doc
@return bool Success or failure | [
"Creates",
"a",
"new",
"version",
"of",
"a",
"document",
"by",
"moving",
"the",
"current",
"file",
"and",
"renaming",
"it",
"to",
"the",
"versioned",
"filename",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument_versions.php#L66-L98 |
188,003 | silverstripe/silverstripe-dms | code/model/DMSDocument_versions.php | DMSDocument_versions.getFullPath | public function getFullPath($filename = null)
{
if (!$filename) {
$filename = $this->Filename;
}
return DMS::inst()->getStoragePath() . DIRECTORY_SEPARATOR . $this->Folder . DIRECTORY_SEPARATOR . $filename;
} | php | public function getFullPath($filename = null)
{
if (!$filename) {
$filename = $this->Filename;
}
return DMS::inst()->getStoragePath() . DIRECTORY_SEPARATOR . $this->Folder . DIRECTORY_SEPARATOR . $filename;
} | [
"public",
"function",
"getFullPath",
"(",
"$",
"filename",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"filename",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"Filename",
";",
"}",
"return",
"DMS",
"::",
"inst",
"(",
")",
"->",
"getStoragePath... | Returns the full filename of the document stored in this object. Can
optionally specify which filename to use at the end.
@param string
@return string | [
"Returns",
"the",
"full",
"filename",
"of",
"the",
"document",
"stored",
"in",
"this",
"object",
".",
"Can",
"optionally",
"specify",
"which",
"filename",
"to",
"use",
"at",
"the",
"end",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument_versions.php#L177-L183 |
188,004 | silverstripe/silverstripe-dms | code/model/DMSDocument_versions.php | DMSDocument_versions.generateVersionedFilename | protected function generateVersionedFilename(DMSDocument $doc, $versionCounter)
{
$filename = $doc->Filename;
do {
// Add leading zeros to make sorting accurate up to 10,000 documents
$versionPaddingString = str_pad($versionCounter, 4, '0', STR_PAD_LEFT);
$newVer... | php | protected function generateVersionedFilename(DMSDocument $doc, $versionCounter)
{
$filename = $doc->Filename;
do {
// Add leading zeros to make sorting accurate up to 10,000 documents
$versionPaddingString = str_pad($versionCounter, 4, '0', STR_PAD_LEFT);
$newVer... | [
"protected",
"function",
"generateVersionedFilename",
"(",
"DMSDocument",
"$",
"doc",
",",
"$",
"versionCounter",
")",
"{",
"$",
"filename",
"=",
"$",
"doc",
"->",
"Filename",
";",
"do",
"{",
"// Add leading zeros to make sorting accurate up to 10,000 documents",
"$",
... | Creates a new filename for the current Document's file when replacing the
current file with a new file.
@param DMSDocument $filename The original filename
@return string The new filename | [
"Creates",
"a",
"new",
"filename",
"for",
"the",
"current",
"Document",
"s",
"file",
"when",
"replacing",
"the",
"current",
"file",
"with",
"a",
"new",
"file",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument_versions.php#L204-L223 |
188,005 | silverstripe/silverstripe-dms | code/extensions/DMSSiteTreeExtension.php | DMSSiteTreeExtension.getAllDocuments | public function getAllDocuments()
{
$documents = ArrayList::create();
foreach ($this->owner->DocumentSets() as $documentSet) {
/** @var DocumentSet $documentSet */
$documents->merge($documentSet->getDocuments());
}
$documents->removeDuplicates();
ret... | php | public function getAllDocuments()
{
$documents = ArrayList::create();
foreach ($this->owner->DocumentSets() as $documentSet) {
/** @var DocumentSet $documentSet */
$documents->merge($documentSet->getDocuments());
}
$documents->removeDuplicates();
ret... | [
"public",
"function",
"getAllDocuments",
"(",
")",
"{",
"$",
"documents",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"owner",
"->",
"DocumentSets",
"(",
")",
"as",
"$",
"documentSet",
")",
"{",
"/** @var DocumentSet... | Get a list of all documents from all document sets for the owner page
@return ArrayList | [
"Get",
"a",
"list",
"of",
"all",
"documents",
"from",
"all",
"document",
"sets",
"for",
"the",
"owner",
"page"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/extensions/DMSSiteTreeExtension.php#L73-L84 |
188,006 | silverstripe/silverstripe-dms | code/model/DMSDocumentSet.php | DMSDocumentSet.addRequirements | protected function addRequirements()
{
// Javascript to customize the grid field for the DMS document (overriding entwine
// in FRAMEWORK_DIR.'/javascript/GridField.js'
Requirements::javascript(DMS_DIR . '/javascript/DMSGridField.js');
Requirements::css(DMS_DIR . '/dist/css/dmsbundle... | php | protected function addRequirements()
{
// Javascript to customize the grid field for the DMS document (overriding entwine
// in FRAMEWORK_DIR.'/javascript/GridField.js'
Requirements::javascript(DMS_DIR . '/javascript/DMSGridField.js');
Requirements::css(DMS_DIR . '/dist/css/dmsbundle... | [
"protected",
"function",
"addRequirements",
"(",
")",
"{",
"// Javascript to customize the grid field for the DMS document (overriding entwine",
"// in FRAMEWORK_DIR.'/javascript/GridField.js'",
"Requirements",
"::",
"javascript",
"(",
"DMS_DIR",
".",
"'/javascript/DMSGridField.js'",
"... | Add required CSS and Javascript requirements for managing documents
@return $this | [
"Add",
"required",
"CSS",
"and",
"Javascript",
"requirements",
"for",
"managing",
"documents"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocumentSet.php#L187-L198 |
188,007 | silverstripe/silverstripe-dms | code/model/DMSDocumentSet.php | DMSDocumentSet.addQueryFields | public function addQueryFields($fields)
{
/** @var DMSDocument $doc */
$doc = singleton('DMSDocument');
/** @var FormField $field */
$dmsDocFields = $doc->scaffoldSearchFields(array('fieldClasses' => true));
$membersMap = Member::get()->map('ID', 'Name')->toArray();
a... | php | public function addQueryFields($fields)
{
/** @var DMSDocument $doc */
$doc = singleton('DMSDocument');
/** @var FormField $field */
$dmsDocFields = $doc->scaffoldSearchFields(array('fieldClasses' => true));
$membersMap = Member::get()->map('ID', 'Name')->toArray();
a... | [
"public",
"function",
"addQueryFields",
"(",
"$",
"fields",
")",
"{",
"/** @var DMSDocument $doc */",
"$",
"doc",
"=",
"singleton",
"(",
"'DMSDocument'",
")",
";",
"/** @var FormField $field */",
"$",
"dmsDocFields",
"=",
"$",
"doc",
"->",
"scaffoldSearchFields",
"(... | Adds the query fields to build the document logic to the DMSDocumentSet.
@param FieldList $fields | [
"Adds",
"the",
"query",
"fields",
"to",
"build",
"the",
"document",
"logic",
"to",
"the",
"DMSDocumentSet",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocumentSet.php#L205-L266 |
188,008 | silverstripe/silverstripe-dms | code/model/DMSDocumentSet.php | DMSDocumentSet.saveLinkedDocuments | public function saveLinkedDocuments()
{
if (empty($this->KeyValuePairs) || !$this->isChanged('KeyValuePairs')) {
return;
}
$keyValuesPair = Convert::json2array($this->KeyValuePairs);
/** @var DMSDocument $dmsDoc */
$dmsDoc = singleton('DMSDocument');
$co... | php | public function saveLinkedDocuments()
{
if (empty($this->KeyValuePairs) || !$this->isChanged('KeyValuePairs')) {
return;
}
$keyValuesPair = Convert::json2array($this->KeyValuePairs);
/** @var DMSDocument $dmsDoc */
$dmsDoc = singleton('DMSDocument');
$co... | [
"public",
"function",
"saveLinkedDocuments",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"KeyValuePairs",
")",
"||",
"!",
"$",
"this",
"->",
"isChanged",
"(",
"'KeyValuePairs'",
")",
")",
"{",
"return",
";",
"}",
"$",
"keyValuesPair",
"=",... | Retrieve a list of the documents in this set. An extension hook is provided before the result is returned. | [
"Retrieve",
"a",
"list",
"of",
"the",
"documents",
"in",
"this",
"set",
".",
"An",
"extension",
"hook",
"is",
"provided",
"before",
"the",
"result",
"is",
"returned",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocumentSet.php#L278-L298 |
188,009 | silverstripe/silverstripe-dms | code/model/DMSDocumentSet.php | DMSDocumentSet.addQueryBuilderSearchResults | protected function addQueryBuilderSearchResults(DataList $documents)
{
/** @var ManyManyList $originals Documents that belong to just this set. */
$originals = $this->Documents();
$originals->removeByFilter('"ManuallyAdded" = 0');
foreach ($documents as $document) {
$ori... | php | protected function addQueryBuilderSearchResults(DataList $documents)
{
/** @var ManyManyList $originals Documents that belong to just this set. */
$originals = $this->Documents();
$originals->removeByFilter('"ManuallyAdded" = 0');
foreach ($documents as $document) {
$ori... | [
"protected",
"function",
"addQueryBuilderSearchResults",
"(",
"DataList",
"$",
"documents",
")",
"{",
"/** @var ManyManyList $originals Documents that belong to just this set. */",
"$",
"originals",
"=",
"$",
"this",
"->",
"Documents",
"(",
")",
";",
"$",
"originals",
"->... | Remove all ManuallyAdded = 0 original results and add in the new documents returned by the search context
@param DataList $documents
@return DataList | [
"Remove",
"all",
"ManuallyAdded",
"=",
"0",
"original",
"results",
"and",
"add",
"in",
"the",
"new",
"documents",
"returned",
"by",
"the",
"search",
"context"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocumentSet.php#L325-L336 |
188,010 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.trackView | public function trackView()
{
if ($this->ID > 0) {
$count = $this->ViewCount + 1;
$this->ViewCount = $count;
DB::query("UPDATE \"DMSDocument\" SET \"ViewCount\"='$count' WHERE \"ID\"={$this->ID}");
$this->extend('trackView');
}
return $this... | php | public function trackView()
{
if ($this->ID > 0) {
$count = $this->ViewCount + 1;
$this->ViewCount = $count;
DB::query("UPDATE \"DMSDocument\" SET \"ViewCount\"='$count' WHERE \"ID\"={$this->ID}");
$this->extend('trackView');
}
return $this... | [
"public",
"function",
"trackView",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ID",
">",
"0",
")",
"{",
"$",
"count",
"=",
"$",
"this",
"->",
"ViewCount",
"+",
"1",
";",
"$",
"this",
"->",
"ViewCount",
"=",
"$",
"count",
";",
"DB",
"::",
"que... | Increase ViewCount by 1, without update any other record fields such as
LastEdited.
@return DMSDocument | [
"Increase",
"ViewCount",
"by",
"1",
"without",
"update",
"any",
"other",
"record",
"fields",
"such",
"as",
"LastEdited",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L230-L243 |
188,011 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.getLink | public function getLink()
{
$urlSegment = sprintf('%d-%s', $this->ID, URLSegmentFilter::create()->filter($this->getTitle()));
$result = Controller::join_links(Director::baseURL(), 'dmsdocument/' . $urlSegment);
if (!$this->canView()) {
$result = sprintf("javascript:alert('%s')", ... | php | public function getLink()
{
$urlSegment = sprintf('%d-%s', $this->ID, URLSegmentFilter::create()->filter($this->getTitle()));
$result = Controller::join_links(Director::baseURL(), 'dmsdocument/' . $urlSegment);
if (!$this->canView()) {
$result = sprintf("javascript:alert('%s')", ... | [
"public",
"function",
"getLink",
"(",
")",
"{",
"$",
"urlSegment",
"=",
"sprintf",
"(",
"'%d-%s'",
",",
"$",
"this",
"->",
"ID",
",",
"URLSegmentFilter",
"::",
"create",
"(",
")",
"->",
"filter",
"(",
"$",
"this",
"->",
"getTitle",
"(",
")",
")",
")"... | Returns a link to download this document from the DMS store.
Alternatively a basic javascript alert will be shown should the user not have view permissions. An extension
point for this was also added.
To extend use the following from within an Extension subclass:
<code>
public function updateGetLink($result)
{
// Do ... | [
"Returns",
"a",
"link",
"to",
"download",
"this",
"document",
"from",
"the",
"DMS",
"store",
".",
"Alternatively",
"a",
"basic",
"javascript",
"alert",
"will",
"be",
"shown",
"should",
"the",
"user",
"not",
"have",
"view",
"permissions",
".",
"An",
"extensio... | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L261-L272 |
188,012 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.embargoUntilPublished | public function embargoUntilPublished($write = true)
{
$this->EmbargoedUntilPublished = true;
if ($write) {
$this->write();
}
return $this;
} | php | public function embargoUntilPublished($write = true)
{
$this->EmbargoedUntilPublished = true;
if ($write) {
$this->write();
}
return $this;
} | [
"public",
"function",
"embargoUntilPublished",
"(",
"$",
"write",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"EmbargoedUntilPublished",
"=",
"true",
";",
"if",
"(",
"$",
"write",
")",
"{",
"$",
"this",
"->",
"write",
"(",
")",
";",
"}",
"return",
"$",
... | Hides the document until any page it is linked to is published
@param bool $write Save change to database
@return DMSDocument | [
"Hides",
"the",
"document",
"until",
"any",
"page",
"it",
"is",
"linked",
"to",
"is",
"published"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L311-L320 |
188,013 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.isHidden | public function isHidden()
{
$hidden = $this->isEmbargoed() || $this->isExpired();
$readingMode = Versioned::get_reading_mode();
if ($readingMode == "Stage.Stage") {
if ($this->EmbargoedUntilPublished == true) {
$hidden = false;
}
}
r... | php | public function isHidden()
{
$hidden = $this->isEmbargoed() || $this->isExpired();
$readingMode = Versioned::get_reading_mode();
if ($readingMode == "Stage.Stage") {
if ($this->EmbargoedUntilPublished == true) {
$hidden = false;
}
}
r... | [
"public",
"function",
"isHidden",
"(",
")",
"{",
"$",
"hidden",
"=",
"$",
"this",
"->",
"isEmbargoed",
"(",
")",
"||",
"$",
"this",
"->",
"isExpired",
"(",
")",
";",
"$",
"readingMode",
"=",
"Versioned",
"::",
"get_reading_mode",
"(",
")",
";",
"if",
... | Returns if this is Document is embargoed or expired.
Also, returns if the document should be displayed on the front-end,
respecting the current reading mode of the site and the embargo status.
I.e. if a document is embargoed until published, then it should still
show up in draft mode.
@return bool | [
"Returns",
"if",
"this",
"is",
"Document",
"is",
"embargoed",
"or",
"expired",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L333-L345 |
188,014 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.isEmbargoed | public function isEmbargoed()
{
if (is_object($this->EmbargoedUntilDate)) {
$this->EmbargoedUntilDate = $this->EmbargoedUntilDate->Value;
}
$embargoed = false;
if ($this->EmbargoedIndefinitely) {
$embargoed = true;
} elseif ($this->EmbargoedUntilPubl... | php | public function isEmbargoed()
{
if (is_object($this->EmbargoedUntilDate)) {
$this->EmbargoedUntilDate = $this->EmbargoedUntilDate->Value;
}
$embargoed = false;
if ($this->EmbargoedIndefinitely) {
$embargoed = true;
} elseif ($this->EmbargoedUntilPubl... | [
"public",
"function",
"isEmbargoed",
"(",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"this",
"->",
"EmbargoedUntilDate",
")",
")",
"{",
"$",
"this",
"->",
"EmbargoedUntilDate",
"=",
"$",
"this",
"->",
"EmbargoedUntilDate",
"->",
"Value",
";",
"}",
"$",
... | Returns if this is Document is embargoed.
@return bool | [
"Returns",
"if",
"this",
"is",
"Document",
"is",
"embargoed",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L352-L371 |
188,015 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.clearEmbargo | public function clearEmbargo($write = true)
{
$this->EmbargoedIndefinitely = false;
$this->EmbargoedUntilPublished = false;
$this->EmbargoedUntilDate = null;
if ($write) {
$this->write();
}
return $this;
} | php | public function clearEmbargo($write = true)
{
$this->EmbargoedIndefinitely = false;
$this->EmbargoedUntilPublished = false;
$this->EmbargoedUntilDate = null;
if ($write) {
$this->write();
}
return $this;
} | [
"public",
"function",
"clearEmbargo",
"(",
"$",
"write",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"EmbargoedIndefinitely",
"=",
"false",
";",
"$",
"this",
"->",
"EmbargoedUntilPublished",
"=",
"false",
";",
"$",
"this",
"->",
"EmbargoedUntilDate",
"=",
"nul... | Clears any previously set embargos, so the Document always shows up in
all queries.
@param bool $write
@return DMSDocument | [
"Clears",
"any",
"previously",
"set",
"embargos",
"so",
"the",
"Document",
"always",
"shows",
"up",
"in",
"all",
"queries",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L401-L412 |
188,016 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.isExpired | public function isExpired()
{
if (is_object($this->ExpireAtDate)) {
$this->ExpireAtDate = $this->ExpireAtDate->Value;
}
$expired = false;
if (!empty($this->ExpireAtDate)) {
if (SS_Datetime::now()->Value >= $this->ExpireAtDate) {
$expired = tr... | php | public function isExpired()
{
if (is_object($this->ExpireAtDate)) {
$this->ExpireAtDate = $this->ExpireAtDate->Value;
}
$expired = false;
if (!empty($this->ExpireAtDate)) {
if (SS_Datetime::now()->Value >= $this->ExpireAtDate) {
$expired = tr... | [
"public",
"function",
"isExpired",
"(",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"this",
"->",
"ExpireAtDate",
")",
")",
"{",
"$",
"this",
"->",
"ExpireAtDate",
"=",
"$",
"this",
"->",
"ExpireAtDate",
"->",
"Value",
";",
"}",
"$",
"expired",
"=",
... | Returns if this is Document is expired.
@return bool | [
"Returns",
"if",
"this",
"is",
"Document",
"is",
"expired",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L419-L434 |
188,017 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.clearExpiry | public function clearExpiry($write = true)
{
$this->ExpireAtDate = null;
if ($write) {
$this->write();
}
return $this;
} | php | public function clearExpiry($write = true)
{
$this->ExpireAtDate = null;
if ($write) {
$this->write();
}
return $this;
} | [
"public",
"function",
"clearExpiry",
"(",
"$",
"write",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"ExpireAtDate",
"=",
"null",
";",
"if",
"(",
"$",
"write",
")",
"{",
"$",
"this",
"->",
"write",
"(",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"... | Clears any previously set expiry.
@param bool $write
@return DMSDocument | [
"Clears",
"any",
"previously",
"set",
"expiry",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L463-L472 |
188,018 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.getFullPath | public function getFullPath()
{
if ($this->Filename) {
return DMS::inst()->getStoragePath() . DIRECTORY_SEPARATOR
. $this->Folder . DIRECTORY_SEPARATOR . $this->Filename;
}
return null;
} | php | public function getFullPath()
{
if ($this->Filename) {
return DMS::inst()->getStoragePath() . DIRECTORY_SEPARATOR
. $this->Folder . DIRECTORY_SEPARATOR . $this->Filename;
}
return null;
} | [
"public",
"function",
"getFullPath",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Filename",
")",
"{",
"return",
"DMS",
"::",
"inst",
"(",
")",
"->",
"getStoragePath",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"this",
"->",
"Folder",
".",
"DIREC... | Returns the full filename of the document stored in this object.
@return string | [
"Returns",
"the",
"full",
"filename",
"of",
"the",
"document",
"stored",
"in",
"this",
"object",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L499-L507 |
188,019 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.delete | public function delete()
{
// delete the file (and previous versions of files)
$filesToDelete = array();
$storageFolder = $this->getStorageFolder();
if (file_exists($storageFolder)) {
if ($handle = opendir($storageFolder)) {
while (false !== ($entry = rea... | php | public function delete()
{
// delete the file (and previous versions of files)
$filesToDelete = array();
$storageFolder = $this->getStorageFolder();
if (file_exists($storageFolder)) {
if ($handle = opendir($storageFolder)) {
while (false !== ($entry = rea... | [
"public",
"function",
"delete",
"(",
")",
"{",
"// delete the file (and previous versions of files)",
"$",
"filesToDelete",
"=",
"array",
"(",
")",
";",
"$",
"storageFolder",
"=",
"$",
"this",
"->",
"getStorageFolder",
"(",
")",
";",
"if",
"(",
"file_exists",
"(... | Deletes the DMSDocument and its underlying file. Also calls the parent DataObject's delete method in
order to complete an cascade.
@return void | [
"Deletes",
"the",
"DMSDocument",
"and",
"its",
"underlying",
"file",
".",
"Also",
"calls",
"the",
"parent",
"DataObject",
"s",
"delete",
"method",
"in",
"order",
"to",
"complete",
"an",
"cascade",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L558-L598 |
188,020 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.storeDocument | public function storeDocument($filePath)
{
if (empty($this->ID)) {
user_error("Document must be written to database before it can store documents", E_USER_ERROR);
}
// calculate all the path to copy the file to
$fromFilename = basename($filePath);
$toFilename = $... | php | public function storeDocument($filePath)
{
if (empty($this->ID)) {
user_error("Document must be written to database before it can store documents", E_USER_ERROR);
}
// calculate all the path to copy the file to
$fromFilename = basename($filePath);
$toFilename = $... | [
"public",
"function",
"storeDocument",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"ID",
")",
")",
"{",
"user_error",
"(",
"\"Document must be written to database before it can store documents\"",
",",
"E_USER_ERROR",
")",
";",
"}",... | Relate an existing file on the filesystem to the document.
Copies the file to the new destination, as defined in {@link DMS::getStoragePath()}.
@param string $filePath Path to file, relative to webroot.
@return DMSDocument | [
"Relate",
"an",
"existing",
"file",
"on",
"the",
"filesystem",
"to",
"the",
"document",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L609-L652 |
188,021 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.getPermissionsActionPanel | public function getPermissionsActionPanel()
{
$fields = FieldList::create();
$showFields = array(
'CanViewType' => '',
'ViewerGroups' => 'hide',
'CanEditType' => '',
'EditorGroups' => 'hide',
);
/** @var SiteTree $siteTree */
... | php | public function getPermissionsActionPanel()
{
$fields = FieldList::create();
$showFields = array(
'CanViewType' => '',
'ViewerGroups' => 'hide',
'CanEditType' => '',
'EditorGroups' => 'hide',
);
/** @var SiteTree $siteTree */
... | [
"public",
"function",
"getPermissionsActionPanel",
"(",
")",
"{",
"$",
"fields",
"=",
"FieldList",
"::",
"create",
"(",
")",
";",
"$",
"showFields",
"=",
"array",
"(",
"'CanViewType'",
"=>",
"''",
",",
"'ViewerGroups'",
"=>",
"'hide'",
",",
"'CanEditType'",
... | Adds permissions selection fields to a composite field and returns so it can be used in the "actions panel"
@return CompositeField | [
"Adds",
"permissions",
"selection",
"fields",
"to",
"a",
"composite",
"field",
"and",
"returns",
"so",
"it",
"can",
"be",
"used",
"in",
"the",
"actions",
"panel"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L921-L955 |
188,022 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.getRelatedPages | public function getRelatedPages()
{
$pages = ArrayList::create();
foreach ($this->Sets() as $documentSet) {
/** @var DocumentSet $documentSet */
$pages->add($documentSet->Page());
}
$pages->removeDuplicates();
$this->extend('updateRelatedPages', $pag... | php | public function getRelatedPages()
{
$pages = ArrayList::create();
foreach ($this->Sets() as $documentSet) {
/** @var DocumentSet $documentSet */
$pages->add($documentSet->Page());
}
$pages->removeDuplicates();
$this->extend('updateRelatedPages', $pag... | [
"public",
"function",
"getRelatedPages",
"(",
")",
"{",
"$",
"pages",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"Sets",
"(",
")",
"as",
"$",
"documentSet",
")",
"{",
"/** @var DocumentSet $documentSet */",
"$",
"pa... | Get a list of related pages for this document by going through the associated document sets
@return ArrayList | [
"Get",
"a",
"list",
"of",
"related",
"pages",
"for",
"this",
"document",
"by",
"going",
"through",
"the",
"associated",
"document",
"sets"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L1198-L1211 |
188,023 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.getRelatedDocumentsGridField | protected function getRelatedDocumentsGridField()
{
$gridField = GridField::create(
'RelatedDocuments',
_t('DMSDocument.RELATEDDOCUMENTS', 'Related Documents'),
$this->RelatedDocuments(),
new GridFieldConfig_RelationEditor
);
$gridFieldConfig ... | php | protected function getRelatedDocumentsGridField()
{
$gridField = GridField::create(
'RelatedDocuments',
_t('DMSDocument.RELATEDDOCUMENTS', 'Related Documents'),
$this->RelatedDocuments(),
new GridFieldConfig_RelationEditor
);
$gridFieldConfig ... | [
"protected",
"function",
"getRelatedDocumentsGridField",
"(",
")",
"{",
"$",
"gridField",
"=",
"GridField",
"::",
"create",
"(",
"'RelatedDocuments'",
",",
"_t",
"(",
"'DMSDocument.RELATEDDOCUMENTS'",
",",
"'Related Documents'",
")",
",",
"$",
"this",
"->",
"Related... | Get a GridField for managing related documents
@return GridField | [
"Get",
"a",
"GridField",
"for",
"managing",
"related",
"documents"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L1218-L1247 |
188,024 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.getRelatedDocumentsForAutocompleter | protected function getRelatedDocumentsForAutocompleter()
{
$documents = DMSDocument::get()->exclude('ID', $this->ID);
$this->extend('updateRelatedDocumentsForAutocompleter', $documents);
return $documents;
} | php | protected function getRelatedDocumentsForAutocompleter()
{
$documents = DMSDocument::get()->exclude('ID', $this->ID);
$this->extend('updateRelatedDocumentsForAutocompleter', $documents);
return $documents;
} | [
"protected",
"function",
"getRelatedDocumentsForAutocompleter",
"(",
")",
"{",
"$",
"documents",
"=",
"DMSDocument",
"::",
"get",
"(",
")",
"->",
"exclude",
"(",
"'ID'",
",",
"$",
"this",
"->",
"ID",
")",
";",
"$",
"this",
"->",
"extend",
"(",
"'updateRela... | Get the list of documents to show in "related documents". This can be modified via the extension point, for
example if you wanted to exclude embargoed documents or something similar.
@return DataList | [
"Get",
"the",
"list",
"of",
"documents",
"to",
"show",
"in",
"related",
"documents",
".",
"This",
"can",
"be",
"modified",
"via",
"the",
"extension",
"point",
"for",
"example",
"if",
"you",
"wanted",
"to",
"exclude",
"embargoed",
"documents",
"or",
"somethin... | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L1255-L1260 |
188,025 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.validate | protected function validate()
{
$valid = parent::validate();
if ($this->CanViewType == 'OnlyTheseUsers' && !$this->ViewerGroups()->count()) {
$valid->error(
_t(
'DMSDocument.VALIDATIONERROR_NOVIEWERSELECTED',
"Selecting 'Only these... | php | protected function validate()
{
$valid = parent::validate();
if ($this->CanViewType == 'OnlyTheseUsers' && !$this->ViewerGroups()->count()) {
$valid->error(
_t(
'DMSDocument.VALIDATIONERROR_NOVIEWERSELECTED',
"Selecting 'Only these... | [
"protected",
"function",
"validate",
"(",
")",
"{",
"$",
"valid",
"=",
"parent",
"::",
"validate",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"CanViewType",
"==",
"'OnlyTheseUsers'",
"&&",
"!",
"$",
"this",
"->",
"ViewerGroups",
"(",
")",
"->",
"coun... | Checks at least one group is selected if CanViewType || CanEditType == 'OnlyTheseUsers'
@return ValidationResult | [
"Checks",
"at",
"least",
"one",
"group",
"is",
"selected",
"if",
"CanViewType",
"||",
"CanEditType",
"==",
"OnlyTheseUsers"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L1267-L1290 |
188,026 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.getPermissionDeniedReason | public function getPermissionDeniedReason()
{
$result = '';
if ($this->CanViewType == 'LoggedInUsers') {
$result = _t('DMSDocument.PERMISSIONDENIEDREASON_LOGINREQUIRED', 'Please log in to view this document');
}
if ($this->CanViewType == 'OnlyTheseUsers') {
... | php | public function getPermissionDeniedReason()
{
$result = '';
if ($this->CanViewType == 'LoggedInUsers') {
$result = _t('DMSDocument.PERMISSIONDENIEDREASON_LOGINREQUIRED', 'Please log in to view this document');
}
if ($this->CanViewType == 'OnlyTheseUsers') {
... | [
"public",
"function",
"getPermissionDeniedReason",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"CanViewType",
"==",
"'LoggedInUsers'",
")",
"{",
"$",
"result",
"=",
"_t",
"(",
"'DMSDocument.PERMISSIONDENIEDREASON_LOGINREQUIRED'",
... | Returns a reason as to why this document cannot be viewed.
@return string | [
"Returns",
"a",
"reason",
"as",
"to",
"why",
"this",
"document",
"cannot",
"be",
"viewed",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L1297-L1313 |
188,027 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.getActionTaskHtml | public function getActionTaskHtml()
{
$html = '<div class="field dmsdocment-actions">'
. '<label class="left">' . _t('DMSDocument.ACTIONS_LABEL', 'Actions') . '</label>'
. '<ul>';
foreach ($this->actionTasks as $panelKey => $title) {
$panelKey = Convert::raw2xml(... | php | public function getActionTaskHtml()
{
$html = '<div class="field dmsdocment-actions">'
. '<label class="left">' . _t('DMSDocument.ACTIONS_LABEL', 'Actions') . '</label>'
. '<ul>';
foreach ($this->actionTasks as $panelKey => $title) {
$panelKey = Convert::raw2xml(... | [
"public",
"function",
"getActionTaskHtml",
"(",
")",
"{",
"$",
"html",
"=",
"'<div class=\"field dmsdocment-actions\">'",
".",
"'<label class=\"left\">'",
".",
"_t",
"(",
"'DMSDocument.ACTIONS_LABEL'",
",",
"'Actions'",
")",
".",
"'</label>'",
".",
"'<ul>'",
";",
"for... | Returns a HTML representation of the action tasks for the CMS
@return string | [
"Returns",
"a",
"HTML",
"representation",
"of",
"the",
"action",
"tasks",
"for",
"the",
"CMS"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L1333-L1351 |
188,028 | silverstripe/silverstripe-dms | code/model/DMSDocument.php | DMSDocument.removeActionPanelTask | public function removeActionPanelTask($panelKey)
{
if (array_key_exists($panelKey, $this->actionTasks)) {
unset($this->actionTasks[$panelKey]);
}
return $this;
} | php | public function removeActionPanelTask($panelKey)
{
if (array_key_exists($panelKey, $this->actionTasks)) {
unset($this->actionTasks[$panelKey]);
}
return $this;
} | [
"public",
"function",
"removeActionPanelTask",
"(",
"$",
"panelKey",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"panelKey",
",",
"$",
"this",
"->",
"actionTasks",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"actionTasks",
"[",
"$",
"panelKey",
... | Removes an "action panel" tasks
@param string $panelKey
@return $this | [
"Removes",
"an",
"action",
"panel",
"tasks"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument.php#L1359-L1365 |
188,029 | silverstripe/silverstripe-dms | code/cms/DMSDocumentAddController.php | DMSDocumentAddController.getCurrentDocumentSet | public function getCurrentDocumentSet()
{
if ($id = $this->getRequest()->getVar('dsid')) {
return DMSDocumentSet::get()->byId($id);
}
return singleton('DMSDocumentSet');
} | php | public function getCurrentDocumentSet()
{
if ($id = $this->getRequest()->getVar('dsid')) {
return DMSDocumentSet::get()->byId($id);
}
return singleton('DMSDocumentSet');
} | [
"public",
"function",
"getCurrentDocumentSet",
"(",
")",
"{",
"if",
"(",
"$",
"id",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getVar",
"(",
"'dsid'",
")",
")",
"{",
"return",
"DMSDocumentSet",
"::",
"get",
"(",
")",
"->",
"byId",
"(",
"$... | Get the current document set, if a document set ID was provided
@return DMSDocumentSet | [
"Get",
"the",
"current",
"document",
"set",
"if",
"a",
"document",
"set",
"ID",
"was",
"provided"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/cms/DMSDocumentAddController.php#L60-L66 |
188,030 | silverstripe/silverstripe-dms | code/cms/DMSDocumentAddController.php | DMSDocumentAddController.getPageEditLink | protected function getPageEditLink($pageId, $documentSetId)
{
return Controller::join_links(
CMSPageEditController::singleton()->getEditForm($pageId)->FormAction(),
'field/DocumentSets/item',
(int) $documentSetId
);
} | php | protected function getPageEditLink($pageId, $documentSetId)
{
return Controller::join_links(
CMSPageEditController::singleton()->getEditForm($pageId)->FormAction(),
'field/DocumentSets/item',
(int) $documentSetId
);
} | [
"protected",
"function",
"getPageEditLink",
"(",
"$",
"pageId",
",",
"$",
"documentSetId",
")",
"{",
"return",
"Controller",
"::",
"join_links",
"(",
"CMSPageEditController",
"::",
"singleton",
"(",
")",
"->",
"getEditForm",
"(",
"$",
"pageId",
")",
"->",
"For... | Return a link to edit a page, deep linking into the document set given
@param int $pageId
@param int $documentSetId
@return string | [
"Return",
"a",
"link",
"to",
"edit",
"a",
"page",
"deep",
"linking",
"into",
"the",
"document",
"set",
"given"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/cms/DMSDocumentAddController.php#L210-L217 |
188,031 | silverstripe/silverstripe-dms | code/cms/DMSDocumentAddController.php | DMSDocumentAddController.linkdocument | public function linkdocument()
{
$return = array('error' => _t('UploadField.FIELDNOTSET', 'Could not add document to page'));
$documentSet = $this->getCurrentDocumentSet();
if (!empty($documentSet)) {
$document = DMSDocument::get()->byId($this->getRequest()->getVar('documentID'))... | php | public function linkdocument()
{
$return = array('error' => _t('UploadField.FIELDNOTSET', 'Could not add document to page'));
$documentSet = $this->getCurrentDocumentSet();
if (!empty($documentSet)) {
$document = DMSDocument::get()->byId($this->getRequest()->getVar('documentID'))... | [
"public",
"function",
"linkdocument",
"(",
")",
"{",
"$",
"return",
"=",
"array",
"(",
"'error'",
"=>",
"_t",
"(",
"'UploadField.FIELDNOTSET'",
",",
"'Could not add document to page'",
")",
")",
";",
"$",
"documentSet",
"=",
"$",
"this",
"->",
"getCurrentDocumen... | Link an existing document to the given document set ID
@return string JSON | [
"Link",
"an",
"existing",
"document",
"to",
"the",
"given",
"document",
"set",
"ID"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/cms/DMSDocumentAddController.php#L246-L273 |
188,032 | silverstripe/silverstripe-dms | code/cms/DMSDocumentAddController.php | DMSDocumentAddController.documentlist | public function documentlist()
{
if (!$this->getRequest()->getVar('pageID')) {
return $this->httpError(400);
}
$page = SiteTree::get()->byId($this->getRequest()->getVar('pageID'));
if ($page && $page->getAllDocuments()->count() > 0) {
$list = '<ul>';
... | php | public function documentlist()
{
if (!$this->getRequest()->getVar('pageID')) {
return $this->httpError(400);
}
$page = SiteTree::get()->byId($this->getRequest()->getVar('pageID'));
if ($page && $page->getAllDocuments()->count() > 0) {
$list = '<ul>';
... | [
"public",
"function",
"documentlist",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getVar",
"(",
"'pageID'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"400",
")",
";",
"}",
"$",
"page",
"=",
... | Returns HTML representing a list of documents that are associated with the given page ID, across all document
sets.
@return string HTML | [
"Returns",
"HTML",
"representing",
"a",
"list",
"of",
"documents",
"that",
"are",
"associated",
"with",
"the",
"given",
"page",
"ID",
"across",
"all",
"document",
"sets",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/cms/DMSDocumentAddController.php#L281-L309 |
188,033 | silverstripe/silverstripe-dms | code/cms/DMSDocumentAddController.php | DMSDocumentAddController.canView | public function canView($member = null)
{
if (!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
$member = Member::currentUser();
}
if ($member &&
Permission::checkMember(
$member,
array(
'CMS_ACCESS_D... | php | public function canView($member = null)
{
if (!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
$member = Member::currentUser();
}
if ($member &&
Permission::checkMember(
$member,
array(
'CMS_ACCESS_D... | [
"public",
"function",
"canView",
"(",
"$",
"member",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"member",
"||",
"!",
"(",
"is_a",
"(",
"$",
"member",
",",
"'Member'",
")",
")",
"||",
"is_numeric",
"(",
"$",
"member",
")",
")",
"{",
"$",
"member"... | Overrides the parent method to allow users with access to DMS admin to access this controller
@param Member $member
@return bool | [
"Overrides",
"the",
"parent",
"method",
"to",
"allow",
"users",
"with",
"access",
"to",
"DMS",
"admin",
"to",
"access",
"this",
"controller"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/cms/DMSDocumentAddController.php#L333-L350 |
188,034 | silverstripe/silverstripe-dms | code/cms/DMSGridFieldEditButton.php | DMSGridFieldEditButton.getColumnContent | public function getColumnContent($gridField, $record, $columnName)
{
$data = new ArrayData(array(
'Link' => Controller::join_links($gridField->Link('item'), $record->ID, 'edit')
));
$template = $record->canEdit() ? 'GridFieldEditButton' : 'GridFieldViewButton';
return $... | php | public function getColumnContent($gridField, $record, $columnName)
{
$data = new ArrayData(array(
'Link' => Controller::join_links($gridField->Link('item'), $record->ID, 'edit')
));
$template = $record->canEdit() ? 'GridFieldEditButton' : 'GridFieldViewButton';
return $... | [
"public",
"function",
"getColumnContent",
"(",
"$",
"gridField",
",",
"$",
"record",
",",
"$",
"columnName",
")",
"{",
"$",
"data",
"=",
"new",
"ArrayData",
"(",
"array",
"(",
"'Link'",
"=>",
"Controller",
"::",
"join_links",
"(",
"$",
"gridField",
"->",
... | Overriding the parent method to change the template that the DMS edit button will be rendered with based on
whether or not the user has edit permissions.
@param GridField $gridField
@param DataObject $record
@param string $columnName
@return string - the HTML for the column | [
"Overriding",
"the",
"parent",
"method",
"to",
"change",
"the",
"template",
"that",
"the",
"DMS",
"edit",
"button",
"will",
"be",
"rendered",
"with",
"based",
"on",
"whether",
"or",
"not",
"the",
"user",
"has",
"edit",
"permissions",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/cms/DMSGridFieldEditButton.php#L16-L25 |
188,035 | rexxars/html-validator | library/HtmlValidator/Message.php | Message.highlight | private function highlight($str, $start, $length) {
$parts = array(
substr($str, 0, $start),
substr($str, $start, $length),
substr($str, $start + $length)
);
$parts = array_map('htmlentities', $parts);
$highlighted = $parts[0] . '<span class="' . $t... | php | private function highlight($str, $start, $length) {
$parts = array(
substr($str, 0, $start),
substr($str, $start, $length),
substr($str, $start + $length)
);
$parts = array_map('htmlentities', $parts);
$highlighted = $parts[0] . '<span class="' . $t... | [
"private",
"function",
"highlight",
"(",
"$",
"str",
",",
"$",
"start",
",",
"$",
"length",
")",
"{",
"$",
"parts",
"=",
"array",
"(",
"substr",
"(",
"$",
"str",
",",
"0",
",",
"$",
"start",
")",
",",
"substr",
"(",
"$",
"str",
",",
"$",
"start... | Highlight the given string, enclosing it in a span
@param string $str String to highlight
@param int $start Start index of substring to highlight
@param int $length Length of substring to highlight
@return string | [
"Highlight",
"the",
"given",
"string",
"enclosing",
"it",
"in",
"a",
"span"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/Message.php#L256-L269 |
188,036 | rexxars/html-validator | library/HtmlValidator/Message.php | Message.format | public function format($html = false) {
$format = '%s: %s';
if ($this->lastLine > 0) {
$format .= PHP_EOL;
$format .= 'From line %d, column %d; ' ;
$format .= 'to line %d, column %d';
}
$message = sprintf(
$format,
$html ? '<... | php | public function format($html = false) {
$format = '%s: %s';
if ($this->lastLine > 0) {
$format .= PHP_EOL;
$format .= 'From line %d, column %d; ' ;
$format .= 'to line %d, column %d';
}
$message = sprintf(
$format,
$html ? '<... | [
"public",
"function",
"format",
"(",
"$",
"html",
"=",
"false",
")",
"{",
"$",
"format",
"=",
"'%s: %s'",
";",
"if",
"(",
"$",
"this",
"->",
"lastLine",
">",
"0",
")",
"{",
"$",
"format",
".=",
"PHP_EOL",
";",
"$",
"format",
".=",
"'From line %d, col... | Format the message in readable format
@param boolean $html Whether to return an HTML-representation or not
@return string | [
"Format",
"the",
"message",
"in",
"readable",
"format"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/Message.php#L277-L310 |
188,037 | silverstripe/silverstripe-dms | code/model/DMSDocument_Controller.php | DMSDocument_Controller.getDocumentFromID | protected function getDocumentFromID($request)
{
$doc = null;
$id = Convert::raw2sql($request->param('ID'));
if (strpos($id, 'version') === 0) {
// Versioned document
$id = $this->getDocumentIdFromSlug(str_replace('version', '', $id));
$doc = DataObject::... | php | protected function getDocumentFromID($request)
{
$doc = null;
$id = Convert::raw2sql($request->param('ID'));
if (strpos($id, 'version') === 0) {
// Versioned document
$id = $this->getDocumentIdFromSlug(str_replace('version', '', $id));
$doc = DataObject::... | [
"protected",
"function",
"getDocumentFromID",
"(",
"$",
"request",
")",
"{",
"$",
"doc",
"=",
"null",
";",
"$",
"id",
"=",
"Convert",
"::",
"raw2sql",
"(",
"$",
"request",
"->",
"param",
"(",
"'ID'",
")",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"i... | Returns the document object from the request object's ID parameter.
Returns null, if no document found
@param SS_HTTPRequest $request
@return DMSDocument|null | [
"Returns",
"the",
"document",
"object",
"from",
"the",
"request",
"object",
"s",
"ID",
"parameter",
".",
"Returns",
"null",
"if",
"no",
"document",
"found"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument_Controller.php#L29-L46 |
188,038 | silverstripe/silverstripe-dms | code/model/DMSDocument_Controller.php | DMSDocument_Controller.getDocumentIdFromSlug | protected function getDocumentIdFromSlug($slug)
{
$parts = (array) sscanf($slug, '%d-%s');
$id = array_shift($parts);
if (is_numeric($id)) {
return (int) $id;
}
throw new InvalidArgumentException($slug . ' is not a valid DMSDocument URL');
} | php | protected function getDocumentIdFromSlug($slug)
{
$parts = (array) sscanf($slug, '%d-%s');
$id = array_shift($parts);
if (is_numeric($id)) {
return (int) $id;
}
throw new InvalidArgumentException($slug . ' is not a valid DMSDocument URL');
} | [
"protected",
"function",
"getDocumentIdFromSlug",
"(",
"$",
"slug",
")",
"{",
"$",
"parts",
"=",
"(",
"array",
")",
"sscanf",
"(",
"$",
"slug",
",",
"'%d-%s'",
")",
";",
"$",
"id",
"=",
"array_shift",
"(",
"$",
"parts",
")",
";",
"if",
"(",
"is_numer... | Get a document's ID from a "friendly" URL slug containing a numeric ID and slugged title
@param string $slug
@return int
@throws InvalidArgumentException if an invalid format is provided | [
"Get",
"a",
"document",
"s",
"ID",
"from",
"a",
"friendly",
"URL",
"slug",
"containing",
"a",
"numeric",
"ID",
"and",
"slugged",
"title"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/model/DMSDocument_Controller.php#L55-L63 |
188,039 | silverstripe/silverstripe-dms | code/cms/DMSDocumentAdmin.php | DMSDocumentAdmin.getEditForm | public function getEditForm($id = null, $fields = null)
{
/** @var CMSForm $form */
$form = parent::getEditForm($id, $fields);
$gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
return $this->modifyGridField($form, $gridField);
} | php | public function getEditForm($id = null, $fields = null)
{
/** @var CMSForm $form */
$form = parent::getEditForm($id, $fields);
$gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
return $this->modifyGridField($form, $gridField);
} | [
"public",
"function",
"getEditForm",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
")",
"{",
"/** @var CMSForm $form */",
"$",
"form",
"=",
"parent",
"::",
"getEditForm",
"(",
"$",
"id",
",",
"$",
"fields",
")",
";",
"$",
"gridField",
"... | Remove the default "add" button and replace it with a customised version for DMS
@return CMSForm | [
"Remove",
"the",
"default",
"add",
"button",
"and",
"replace",
"it",
"with",
"a",
"customised",
"version",
"for",
"DMS"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/cms/DMSDocumentAdmin.php#L26-L32 |
188,040 | silverstripe/silverstripe-dms | code/cms/DMSDocumentAdmin.php | DMSDocumentAdmin.modifyGridField | protected function modifyGridField(CMSForm $form, GridField $gridField)
{
$gridFieldConfig = $gridField->getConfig();
$gridFieldConfig->removeComponentsByType('GridFieldEditButton');
$gridFieldConfig->addComponent(new DMSGridFieldEditButton(), 'GridFieldDeleteAction');
if ($this->m... | php | protected function modifyGridField(CMSForm $form, GridField $gridField)
{
$gridFieldConfig = $gridField->getConfig();
$gridFieldConfig->removeComponentsByType('GridFieldEditButton');
$gridFieldConfig->addComponent(new DMSGridFieldEditButton(), 'GridFieldDeleteAction');
if ($this->m... | [
"protected",
"function",
"modifyGridField",
"(",
"CMSForm",
"$",
"form",
",",
"GridField",
"$",
"gridField",
")",
"{",
"$",
"gridFieldConfig",
"=",
"$",
"gridField",
"->",
"getConfig",
"(",
")",
";",
"$",
"gridFieldConfig",
"->",
"removeComponentsByType",
"(",
... | If the GridField is for DMSDocument then add a custom "add" button. If it's for DMSDocumentSet then
update the display fields to include some extra columns that are only for this ModelAdmin, so cannot
be added directly to the model's display fields.
@param CMSForm $form
@param GridField $gridField
@return CMSForm | [
"If",
"the",
"GridField",
"is",
"for",
"DMSDocument",
"then",
"add",
"a",
"custom",
"add",
"button",
".",
"If",
"it",
"s",
"for",
"DMSDocumentSet",
"then",
"update",
"the",
"display",
"fields",
"to",
"include",
"some",
"extra",
"columns",
"that",
"are",
"o... | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/cms/DMSDocumentAdmin.php#L43-L78 |
188,041 | silverstripe/silverstripe-dms | code/extensions/DMSDocumentTaxonomyExtension.php | DMSDocumentTaxonomyExtension.updateCMSFields | public function updateCMSFields(FieldList $fields)
{
$tags = $this->getAllTagsMap();
$tagField = ListboxField::create('Tags', _t('DMSDocumentTaxonomyExtension.TAGS', 'Tags'))
->setMultiple(true)
->setSource($tags);
if (empty($tags)) {
$tagField->setAttrib... | php | public function updateCMSFields(FieldList $fields)
{
$tags = $this->getAllTagsMap();
$tagField = ListboxField::create('Tags', _t('DMSDocumentTaxonomyExtension.TAGS', 'Tags'))
->setMultiple(true)
->setSource($tags);
if (empty($tags)) {
$tagField->setAttrib... | [
"public",
"function",
"updateCMSFields",
"(",
"FieldList",
"$",
"fields",
")",
"{",
"$",
"tags",
"=",
"$",
"this",
"->",
"getAllTagsMap",
"(",
")",
";",
"$",
"tagField",
"=",
"ListboxField",
"::",
"create",
"(",
"'Tags'",
",",
"_t",
"(",
"'DMSDocumentTaxon... | Push an autocomplete dropdown for the available tags in documents
@param FieldList $fields | [
"Push",
"an",
"autocomplete",
"dropdown",
"for",
"the",
"available",
"tags",
"in",
"documents"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/extensions/DMSDocumentTaxonomyExtension.php#L14-L26 |
188,042 | silverstripe/silverstripe-dms | code/tools/ShortCodeRelationFinder.php | ShortCodeRelationFinder.getShortcodeFields | public function getShortcodeFields($class)
{
$fields = array();
$ancestry = array_values(ClassInfo::dataClassesFor($class));
foreach ($ancestry as $ancestor) {
if (ClassInfo::classImplements($ancestor, 'TestOnly')) {
continue;
}
$ancField... | php | public function getShortcodeFields($class)
{
$fields = array();
$ancestry = array_values(ClassInfo::dataClassesFor($class));
foreach ($ancestry as $ancestor) {
if (ClassInfo::classImplements($ancestor, 'TestOnly')) {
continue;
}
$ancField... | [
"public",
"function",
"getShortcodeFields",
"(",
"$",
"class",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"$",
"ancestry",
"=",
"array_values",
"(",
"ClassInfo",
"::",
"dataClassesFor",
"(",
"$",
"class",
")",
")",
";",
"foreach",
"(",
"$",
... | Returns a filtered list of fields which could contain shortcodes.
@param String
@return Array Map of class names to an array of field names on these classes. | [
"Returns",
"a",
"filtered",
"list",
"of",
"fields",
"which",
"could",
"contain",
"shortcodes",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/tools/ShortCodeRelationFinder.php#L71-L95 |
188,043 | silverstripe/silverstripe-dms | code/forms/DMSJsonField.php | DMSJsonField.dataValue | public function dataValue()
{
$result = null;
if (is_array($this->value)) {
$this->value = $this->arrayFilterEmptyRecursive($this->value);
$result = (!empty($this->value)) ? Convert::array2json($this->value) : $result;
} else {
$result = parent::dataValue(... | php | public function dataValue()
{
$result = null;
if (is_array($this->value)) {
$this->value = $this->arrayFilterEmptyRecursive($this->value);
$result = (!empty($this->value)) ? Convert::array2json($this->value) : $result;
} else {
$result = parent::dataValue(... | [
"public",
"function",
"dataValue",
"(",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"value",
")",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"$",
"this",
"->",
"arrayFilterEmptyRecursive",
"(",
"$",
"this... | Overrides parent behaviour to remove empty elements
@return mixed|null|string | [
"Overrides",
"parent",
"behaviour",
"to",
"remove",
"empty",
"elements"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/forms/DMSJsonField.php#L79-L90 |
188,044 | silverstripe/silverstripe-dms | code/DMS.php | DMS.inst | public static function inst()
{
if (!self::$instance) {
self::$instance = new static();
$dmsPath = self::$instance->getStoragePath();
if (!is_dir($dmsPath)) {
self::$instance->createStorageFolder($dmsPath);
}
if (!file_exists($dm... | php | public static function inst()
{
if (!self::$instance) {
self::$instance = new static();
$dmsPath = self::$instance->getStoragePath();
if (!is_dir($dmsPath)) {
self::$instance->createStorageFolder($dmsPath);
}
if (!file_exists($dm... | [
"public",
"static",
"function",
"inst",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"instance",
")",
"{",
"self",
"::",
"$",
"instance",
"=",
"new",
"static",
"(",
")",
";",
"$",
"dmsPath",
"=",
"self",
"::",
"$",
"instance",
"->",
"getStorag... | Factory method that returns an instance of the DMS. This could be any class that implements the DMSInterface.
@return DMSInterface An instance of the Document Management System | [
"Factory",
"method",
"that",
"returns",
"an",
"instance",
"of",
"the",
"DMS",
".",
"This",
"could",
"be",
"any",
"class",
"that",
"implements",
"the",
"DMSInterface",
"."
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/DMS.php#L42-L69 |
188,045 | silverstripe/silverstripe-dms | code/DMS.php | DMS.transformFileToFilePath | public function transformFileToFilePath($file)
{
//confirm we have a file
$filePath = null;
if (is_string($file)) {
$filePath = $file;
} elseif (is_object($file) && $file->is_a("File")) {
$filePath = $file->Filename;
}
if (!$filePath) {
... | php | public function transformFileToFilePath($file)
{
//confirm we have a file
$filePath = null;
if (is_string($file)) {
$filePath = $file;
} elseif (is_object($file) && $file->is_a("File")) {
$filePath = $file->Filename;
}
if (!$filePath) {
... | [
"public",
"function",
"transformFileToFilePath",
"(",
"$",
"file",
")",
"{",
"//confirm we have a file",
"$",
"filePath",
"=",
"null",
";",
"if",
"(",
"is_string",
"(",
"$",
"file",
")",
")",
"{",
"$",
"filePath",
"=",
"$",
"file",
";",
"}",
"elseif",
"(... | Gets a file path from either a File or a string
@param string|File $file
@return string
@throws FileNotFoundException If an unexpected value was provided, or the filename was null | [
"Gets",
"a",
"file",
"path",
"from",
"either",
"a",
"File",
"or",
"a",
"string"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/DMS.php#L88-L103 |
188,046 | rexxars/html-validator | library/HtmlValidator/NodeWrapper.php | NodeWrapper.wrap | public function wrap($parser, $nodes, $charset = null) {
switch ($parser) {
case Validator::PARSER_XML:
case Validator::PARSER_XMLDTD:
return $this->wrapInXmlDocument($nodes, $charset);
case Validator::PARSER_HTML:
case Validator::PARSER_HTML5:
... | php | public function wrap($parser, $nodes, $charset = null) {
switch ($parser) {
case Validator::PARSER_XML:
case Validator::PARSER_XMLDTD:
return $this->wrapInXmlDocument($nodes, $charset);
case Validator::PARSER_HTML:
case Validator::PARSER_HTML5:
... | [
"public",
"function",
"wrap",
"(",
"$",
"parser",
",",
"$",
"nodes",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"parser",
")",
"{",
"case",
"Validator",
"::",
"PARSER_XML",
":",
"case",
"Validator",
"::",
"PARSER_XMLDTD",
":",
"ret... | Attempts to wrap a document in a surrounding document
@param string $parser Parser name (HtmlValidator\Validator::PARSER_*)
@param string $nodes Nodes to wrap
@param string $charset Charset to use
@throws UnknownParserException If the given parser is not known
@return string | [
"Attempts",
"to",
"wrap",
"a",
"document",
"in",
"a",
"surrounding",
"document"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/NodeWrapper.php#L33-L47 |
188,047 | rexxars/html-validator | library/HtmlValidator/NodeWrapper.php | NodeWrapper.wrapInXmlDocument | protected function wrapInXmlDocument($nodes, $charset = null) {
$charset = strtoupper($charset ?: Validator::CHARSET_UTF_8);
$document = '<?xml version="1.0" encoding="' . $charset . '"?>' . PHP_EOL;
$document .= '<root>' . $nodes . '</root>';
return $document;
} | php | protected function wrapInXmlDocument($nodes, $charset = null) {
$charset = strtoupper($charset ?: Validator::CHARSET_UTF_8);
$document = '<?xml version="1.0" encoding="' . $charset . '"?>' . PHP_EOL;
$document .= '<root>' . $nodes . '</root>';
return $document;
} | [
"protected",
"function",
"wrapInXmlDocument",
"(",
"$",
"nodes",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"$",
"charset",
"=",
"strtoupper",
"(",
"$",
"charset",
"?",
":",
"Validator",
"::",
"CHARSET_UTF_8",
")",
";",
"$",
"document",
"=",
"'<?xml versi... | Wraps a set of XML nodes in an XML-document
@param string $nodes One or more XML-nodes, as a string
@param string $charset Charset to specify in XML-document
@return string | [
"Wraps",
"a",
"set",
"of",
"XML",
"nodes",
"in",
"an",
"XML",
"-",
"document"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/NodeWrapper.php#L56-L63 |
188,048 | rexxars/html-validator | library/HtmlValidator/NodeWrapper.php | NodeWrapper.wrapInHtml5Document | protected function wrapInHtml5Document($nodes, $charset = null) {
$charset = strtolower($charset ?: Validator::CHARSET_UTF_8);
$document = '<!DOCTYPE html>' . PHP_EOL;
$document .= '<html><head>' . PHP_EOL;
$document .= '<meta charset="' . $charset . '">' . PHP_EOL;
$document .... | php | protected function wrapInHtml5Document($nodes, $charset = null) {
$charset = strtolower($charset ?: Validator::CHARSET_UTF_8);
$document = '<!DOCTYPE html>' . PHP_EOL;
$document .= '<html><head>' . PHP_EOL;
$document .= '<meta charset="' . $charset . '">' . PHP_EOL;
$document .... | [
"protected",
"function",
"wrapInHtml5Document",
"(",
"$",
"nodes",
",",
"$",
"charset",
"=",
"null",
")",
"{",
"$",
"charset",
"=",
"strtolower",
"(",
"$",
"charset",
"?",
":",
"Validator",
"::",
"CHARSET_UTF_8",
")",
";",
"$",
"document",
"=",
"'<!DOCTYPE... | Wraps a set of HTML nodes in an HTML5-document
@param string $nodes One or more HTML-nodes, as a string
@param string $charset Charset to specify in meta tag
@return string | [
"Wraps",
"a",
"set",
"of",
"HTML",
"nodes",
"in",
"an",
"HTML5",
"-",
"document"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/NodeWrapper.php#L72-L82 |
188,049 | rexxars/html-validator | library/HtmlValidator/NodeWrapper.php | NodeWrapper.wrapInHtml4Document | protected function wrapInHtml4Document($nodes, $charset = null, $parser = null) {
if ($parser === Validator::PARSER_HTML4TR) {
$doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
} else {
$doctype = '<!DOCTYPE HTML ... | php | protected function wrapInHtml4Document($nodes, $charset = null, $parser = null) {
if ($parser === Validator::PARSER_HTML4TR) {
$doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
} else {
$doctype = '<!DOCTYPE HTML ... | [
"protected",
"function",
"wrapInHtml4Document",
"(",
"$",
"nodes",
",",
"$",
"charset",
"=",
"null",
",",
"$",
"parser",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"parser",
"===",
"Validator",
"::",
"PARSER_HTML4TR",
")",
"{",
"$",
"doctype",
"=",
"'<!DOCTY... | Wraps a set of HTML nodes in an HTML4-document
@param string $nodes One or more HTML-nodes, as a string
@param string $charset Charset to specify in meta tag
@param string $parser Validator parser used
@return string | [
"Wraps",
"a",
"set",
"of",
"HTML",
"nodes",
"in",
"an",
"HTML4",
"-",
"document"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/NodeWrapper.php#L92-L108 |
188,050 | rexxars/html-validator | library/HtmlValidator/Validator.php | Validator.setParser | public function setParser($parser) {
switch ($parser) {
case self::PARSER_XML:
case self::PARSER_XMLDTD:
case self::PARSER_HTML:
case self::PARSER_HTML5:
case self::PARSER_HTML4:
case self::PARSER_HTML4TR:
$this->parser = $p... | php | public function setParser($parser) {
switch ($parser) {
case self::PARSER_XML:
case self::PARSER_XMLDTD:
case self::PARSER_HTML:
case self::PARSER_HTML5:
case self::PARSER_HTML4:
case self::PARSER_HTML4TR:
$this->parser = $p... | [
"public",
"function",
"setParser",
"(",
"$",
"parser",
")",
"{",
"switch",
"(",
"$",
"parser",
")",
"{",
"case",
"self",
"::",
"PARSER_XML",
":",
"case",
"self",
"::",
"PARSER_XMLDTD",
":",
"case",
"self",
"::",
"PARSER_HTML",
":",
"case",
"self",
"::",
... | Set parser to use for the given markup
@param string $parser Parser name (use Validator::PARSER_*)
@return Validator Returns current instance
@throws UnknownParserException If parser specified is not known | [
"Set",
"parser",
"to",
"use",
"for",
"the",
"given",
"markup"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/Validator.php#L156-L169 |
188,051 | rexxars/html-validator | library/HtmlValidator/Validator.php | Validator.getMimeTypeForParser | private function getMimeTypeForParser($parser) {
switch ($parser) {
case self::PARSER_XML:
return 'application/xml';
case self::PARSER_XMLDTD:
return 'application/xml-dtd';
case self::PARSER_HTML:
case self::PARSER_HTML5:
... | php | private function getMimeTypeForParser($parser) {
switch ($parser) {
case self::PARSER_XML:
return 'application/xml';
case self::PARSER_XMLDTD:
return 'application/xml-dtd';
case self::PARSER_HTML:
case self::PARSER_HTML5:
... | [
"private",
"function",
"getMimeTypeForParser",
"(",
"$",
"parser",
")",
"{",
"switch",
"(",
"$",
"parser",
")",
"{",
"case",
"self",
"::",
"PARSER_XML",
":",
"return",
"'application/xml'",
";",
"case",
"self",
"::",
"PARSER_XMLDTD",
":",
"return",
"'applicatio... | Get the correct mime-type for the given parser
@param string $parser Parser name
@return string | [
"Get",
"the",
"correct",
"mime",
"-",
"type",
"for",
"the",
"given",
"parser"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/Validator.php#L198-L210 |
188,052 | rexxars/html-validator | library/HtmlValidator/Validator.php | Validator.validateUrl | public function validateUrl($url, $options = []) {
try {
$query = [
'out' => 'json',
'parser' => $this->parser,
'doc' => (string) $url,
];
if (isset($options['checkErrorPages']) && $options['checkErrorPages'] ... | php | public function validateUrl($url, $options = []) {
try {
$query = [
'out' => 'json',
'parser' => $this->parser,
'doc' => (string) $url,
];
if (isset($options['checkErrorPages']) && $options['checkErrorPages'] ... | [
"public",
"function",
"validateUrl",
"(",
"$",
"url",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"query",
"=",
"[",
"'out'",
"=>",
"'json'",
",",
"'parser'",
"=>",
"$",
"this",
"->",
"parser",
",",
"'doc'",
"=>",
"(",
"string",
... | Validate a URL
@param string $url The absolute URL to the document
@param array $options Array of options:
'checkErrorPages' - Set to true if you want to validate pages that
return status codes which is not in the 2xx range
@return HtmlValidator\Response
@throws ServerException | [
"Validate",
"a",
"URL"
] | feebdfc624b6fef6f54d5c84489dff952fb3a3db | https://github.com/rexxars/html-validator/blob/feebdfc624b6fef6f54d5c84489dff952fb3a3db/library/HtmlValidator/Validator.php#L270-L290 |
188,053 | silverstripe/silverstripe-dms | code/tasks/MigrateToDocumentSetsTask.php | MigrateToDocumentSetsTask.createDefaultSet | protected function createDefaultSet()
{
$pages = SiteTree::get();
foreach ($pages as $page) {
// Only handle valid page types
if (!$page->config()->get('documents_enabled')) {
$this->addResult('Skipped: documents disabled');
continue;
... | php | protected function createDefaultSet()
{
$pages = SiteTree::get();
foreach ($pages as $page) {
// Only handle valid page types
if (!$page->config()->get('documents_enabled')) {
$this->addResult('Skipped: documents disabled');
continue;
... | [
"protected",
"function",
"createDefaultSet",
"(",
")",
"{",
"$",
"pages",
"=",
"SiteTree",
"::",
"get",
"(",
")",
";",
"foreach",
"(",
"$",
"pages",
"as",
"$",
"page",
")",
"{",
"// Only handle valid page types",
"if",
"(",
"!",
"$",
"page",
"->",
"confi... | Creates a default document set for any valid page that doesn't have one
@return $this | [
"Creates",
"a",
"default",
"document",
"set",
"for",
"any",
"valid",
"page",
"that",
"doesn",
"t",
"have",
"one"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/tasks/MigrateToDocumentSetsTask.php#L77-L96 |
188,054 | silverstripe/silverstripe-dms | code/tasks/MigrateToDocumentSetsTask.php | MigrateToDocumentSetsTask.reassignDocuments | protected function reassignDocuments()
{
$countCheck = SQLSelect::create('*', 'DMSDocument_Pages');
if (!$countCheck->count()) {
$this->output('There was no data to migrate. Finishing.');
return $this;
}
$query = SQLSelect::create(array('DMSDocumentID', 'Site... | php | protected function reassignDocuments()
{
$countCheck = SQLSelect::create('*', 'DMSDocument_Pages');
if (!$countCheck->count()) {
$this->output('There was no data to migrate. Finishing.');
return $this;
}
$query = SQLSelect::create(array('DMSDocumentID', 'Site... | [
"protected",
"function",
"reassignDocuments",
"(",
")",
"{",
"$",
"countCheck",
"=",
"SQLSelect",
"::",
"create",
"(",
"'*'",
",",
"'DMSDocument_Pages'",
")",
";",
"if",
"(",
"!",
"$",
"countCheck",
"->",
"count",
"(",
")",
")",
"{",
"$",
"this",
"->",
... | Reassign documents to the default document set, where they'd previously have been assigned to pages
@return $this | [
"Reassign",
"documents",
"to",
"the",
"default",
"document",
"set",
"where",
"they",
"d",
"previously",
"have",
"been",
"assigned",
"to",
"pages"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/tasks/MigrateToDocumentSetsTask.php#L103-L138 |
188,055 | silverstripe/silverstripe-dms | code/tasks/MigrateToDocumentSetsTask.php | MigrateToDocumentSetsTask.addDocumentToSet | protected function addDocumentToSet(DMSDocument $document, DMSDocumentSet $set)
{
if ($this->isDryrun()) {
return $this;
}
$set->Documents()->add($document);
return $this;
} | php | protected function addDocumentToSet(DMSDocument $document, DMSDocumentSet $set)
{
if ($this->isDryrun()) {
return $this;
}
$set->Documents()->add($document);
return $this;
} | [
"protected",
"function",
"addDocumentToSet",
"(",
"DMSDocument",
"$",
"document",
",",
"DMSDocumentSet",
"$",
"set",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDryrun",
"(",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"set",
"->",
"Documents",
... | Add the given document to the given document set
@param DMSDocument $document
@param DMSDocumentSet $set
@return $this | [
"Add",
"the",
"given",
"document",
"to",
"the",
"given",
"document",
"set"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/tasks/MigrateToDocumentSetsTask.php#L169-L177 |
188,056 | silverstripe/silverstripe-dms | code/tasks/MigrateToDocumentSetsTask.php | MigrateToDocumentSetsTask.outputResults | protected function outputResults()
{
$this->output();
$this->output('Finished:');
foreach ($this->results as $metric => $count) {
$this->output('+ ' . $metric . ': ' . $count);
}
return $this;
} | php | protected function outputResults()
{
$this->output();
$this->output('Finished:');
foreach ($this->results as $metric => $count) {
$this->output('+ ' . $metric . ': ' . $count);
}
return $this;
} | [
"protected",
"function",
"outputResults",
"(",
")",
"{",
"$",
"this",
"->",
"output",
"(",
")",
";",
"$",
"this",
"->",
"output",
"(",
"'Finished:'",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"results",
"as",
"$",
"metric",
"=>",
"$",
"count",
")"... | Output a "finished" notice and the results of what was done
@return $this | [
"Output",
"a",
"finished",
"notice",
"and",
"the",
"results",
"of",
"what",
"was",
"done"
] | 945119a1da62bb57cbbbea288fafdccdbd20cdce | https://github.com/silverstripe/silverstripe-dms/blob/945119a1da62bb57cbbbea288fafdccdbd20cdce/code/tasks/MigrateToDocumentSetsTask.php#L198-L206 |
188,057 | davidpiesse/facebook_messenger_php | src/Callback/EntryMessage.php | EntryMessage.updateEcho | private function updateEcho()
{
$this->isEcho = (!is_null(Helper::array_find($this->_message, 'is_echo')));
if ($this->isEcho) {
if (isset($this->message)) {
$this->message->app_id = Helper::array_find($this->_message, 'app_id');
$this->message->metadata =... | php | private function updateEcho()
{
$this->isEcho = (!is_null(Helper::array_find($this->_message, 'is_echo')));
if ($this->isEcho) {
if (isset($this->message)) {
$this->message->app_id = Helper::array_find($this->_message, 'app_id');
$this->message->metadata =... | [
"private",
"function",
"updateEcho",
"(",
")",
"{",
"$",
"this",
"->",
"isEcho",
"=",
"(",
"!",
"is_null",
"(",
"Helper",
"::",
"array_find",
"(",
"$",
"this",
"->",
"_message",
",",
"'is_echo'",
")",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"i... | ONLY run after message | [
"ONLY",
"run",
"after",
"message"
] | f2e123701664b78376c50fc4e4f30ff36e22a71c | https://github.com/davidpiesse/facebook_messenger_php/blob/f2e123701664b78376c50fc4e4f30ff36e22a71c/src/Callback/EntryMessage.php#L85-L97 |
188,058 | davidpiesse/facebook_messenger_php | src/Callback.php | Callback.textMessages | public function textMessages()
{
$result = [];
foreach ($this->entries as $entry) {
foreach ($entry->messages as $entryMessage) {
if ($entryMessage->isMessage) {
if ($entryMessage->message->isText && !$entryMessage->message->isQuickReply) {
... | php | public function textMessages()
{
$result = [];
foreach ($this->entries as $entry) {
foreach ($entry->messages as $entryMessage) {
if ($entryMessage->isMessage) {
if ($entryMessage->message->isText && !$entryMessage->message->isQuickReply) {
... | [
"public",
"function",
"textMessages",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"entries",
"as",
"$",
"entry",
")",
"{",
"foreach",
"(",
"$",
"entry",
"->",
"messages",
"as",
"$",
"entryMessage",
")",
"{",
... | Not Quick Replies | [
"Not",
"Quick",
"Replies"
] | f2e123701664b78376c50fc4e4f30ff36e22a71c | https://github.com/davidpiesse/facebook_messenger_php/blob/f2e123701664b78376c50fc4e4f30ff36e22a71c/src/Callback.php#L40-L53 |
188,059 | imbo/imbo | src/Image/Transformation/Resize.php | Resize.calculateSize | protected function calculateSize(array $params, array $imageSize) {
if (empty($params['width']) && empty($params['height'])) {
throw new TransformationException(
'Missing both width and height. You need to specify at least one of them',
400
);
}
... | php | protected function calculateSize(array $params, array $imageSize) {
if (empty($params['width']) && empty($params['height'])) {
throw new TransformationException(
'Missing both width and height. You need to specify at least one of them',
400
);
}
... | [
"protected",
"function",
"calculateSize",
"(",
"array",
"$",
"params",
",",
"array",
"$",
"imageSize",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"'width'",
"]",
")",
"&&",
"empty",
"(",
"$",
"params",
"[",
"'height'",
"]",
")",
")",
"{",... | Calculate output size of image
@param array $params
@param array $imageSize
@return array | [
"Calculate",
"output",
"size",
"of",
"image"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/Resize.php#L65-L92 |
188,060 | imbo/imbo | src/Model/Image.php | Image.setBlob | public function setBlob($blob) {
$this->blob = $blob;
$this->setFilesize(strlen($blob));
$this->setChecksum(md5($blob));
return $this;
} | php | public function setBlob($blob) {
$this->blob = $blob;
$this->setFilesize(strlen($blob));
$this->setChecksum(md5($blob));
return $this;
} | [
"public",
"function",
"setBlob",
"(",
"$",
"blob",
")",
"{",
"$",
"this",
"->",
"blob",
"=",
"$",
"blob",
";",
"$",
"this",
"->",
"setFilesize",
"(",
"strlen",
"(",
"$",
"blob",
")",
")",
";",
"$",
"this",
"->",
"setChecksum",
"(",
"md5",
"(",
"$... | Set the blob and update filesize and checksum properties
@param string $blob The binary data to set
@return Image | [
"Set",
"the",
"blob",
"and",
"update",
"filesize",
"and",
"checksum",
"properties"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Model/Image.php#L219-L225 |
188,061 | imbo/imbo | src/Model/Image.php | Image.hasBeenTransformed | public function hasBeenTransformed($flag = null) {
if ($flag === null) {
return $this->hasBeenTransformed;
}
$this->hasBeenTransformed = (bool) $flag;
return $this;
} | php | public function hasBeenTransformed($flag = null) {
if ($flag === null) {
return $this->hasBeenTransformed;
}
$this->hasBeenTransformed = (bool) $flag;
return $this;
} | [
"public",
"function",
"hasBeenTransformed",
"(",
"$",
"flag",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"flag",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"hasBeenTransformed",
";",
"}",
"$",
"this",
"->",
"hasBeenTransformed",
"=",
"(",
"bool",
... | Set or get the hasBeenTransformed flag
@param boolean|null $flag Skip the argument to get the current value
@return boolean|self | [
"Set",
"or",
"get",
"the",
"hasBeenTransformed",
"flag"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Model/Image.php#L422-L430 |
188,062 | imbo/imbo | src/EventListener/ImageVariations/Database/Doctrine.php | Doctrine.getConnection | private function getConnection() {
if ($this->connection === null) {
$this->connection = DriverManager::getConnection($this->params, new Configuration());
}
return $this->connection;
} | php | private function getConnection() {
if ($this->connection === null) {
$this->connection = DriverManager::getConnection($this->params, new Configuration());
}
return $this->connection;
} | [
"private",
"function",
"getConnection",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"connection",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"connection",
"=",
"DriverManager",
"::",
"getConnection",
"(",
"$",
"this",
"->",
"params",
",",
"new",
"Confi... | Get the Doctrine connection
@return Connection | [
"Get",
"the",
"Doctrine",
"connection"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageVariations/Database/Doctrine.php#L125-L131 |
188,063 | imbo/imbo | src/Image/ImagePreparation.php | ImagePreparation.prepareImage | public function prepareImage(EventInterface $event) {
$request = $event->getRequest();
// Fetch image data from input
$imageBlob = $request->getContent();
if (empty($imageBlob)) {
$e = new ImageException('No image attached', 400);
$e->setImboErrorCode(Exception:... | php | public function prepareImage(EventInterface $event) {
$request = $event->getRequest();
// Fetch image data from input
$imageBlob = $request->getContent();
if (empty($imageBlob)) {
$e = new ImageException('No image attached', 400);
$e->setImboErrorCode(Exception:... | [
"public",
"function",
"prepareImage",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"// Fetch image data from input",
"$",
"imageBlob",
"=",
"$",
"request",
"->",
"getContent",
"(",
")",
... | Prepare an image
This method should prepare an image object from php://input. The method must also figure out
the width, height, mime type and extension of the image.
@param EventInterface $event The current event
@throws ImageException | [
"Prepare",
"an",
"image"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/ImagePreparation.php#L49-L105 |
188,064 | imbo/imbo | src/Http/ContentNegotiation.php | ContentNegotiation.bestMatch | public function bestMatch(array $mimeTypes, array $acceptable) {
$maxQ = 0;
$match = false;
foreach ($mimeTypes as $mime) {
if (($q = $this->isAcceptable($mime, $acceptable)) && ($q > $maxQ)) {
$maxQ = $q;
$match = $mime;
}
}
... | php | public function bestMatch(array $mimeTypes, array $acceptable) {
$maxQ = 0;
$match = false;
foreach ($mimeTypes as $mime) {
if (($q = $this->isAcceptable($mime, $acceptable)) && ($q > $maxQ)) {
$maxQ = $q;
$match = $mime;
}
}
... | [
"public",
"function",
"bestMatch",
"(",
"array",
"$",
"mimeTypes",
",",
"array",
"$",
"acceptable",
")",
"{",
"$",
"maxQ",
"=",
"0",
";",
"$",
"match",
"=",
"false",
";",
"foreach",
"(",
"$",
"mimeTypes",
"as",
"$",
"mime",
")",
"{",
"if",
"(",
"("... | Pick the best match from a set of mime types matched against acceptable types
@param array $mimeTypes The mime types to find the best match from
@param array $acceptable Acceptable types to match against
@return boolean|string Returns false if none of the $mimetypes are acceptable or the best
match on success | [
"Pick",
"the",
"best",
"match",
"from",
"a",
"set",
"of",
"mime",
"types",
"matched",
"against",
"acceptable",
"types"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Http/ContentNegotiation.php#L28-L40 |
188,065 | imbo/imbo | src/Http/ContentNegotiation.php | ContentNegotiation.isAcceptable | public function isAcceptable($mimeType, array $acceptable) {
foreach ($acceptable as $type => $q) {
$pattern = '#^' . str_replace('*', '.*', $type) . '#';
if (preg_match($pattern, $mimeType)) {
return $q;
}
}
return false;
} | php | public function isAcceptable($mimeType, array $acceptable) {
foreach ($acceptable as $type => $q) {
$pattern = '#^' . str_replace('*', '.*', $type) . '#';
if (preg_match($pattern, $mimeType)) {
return $q;
}
}
return false;
} | [
"public",
"function",
"isAcceptable",
"(",
"$",
"mimeType",
",",
"array",
"$",
"acceptable",
")",
"{",
"foreach",
"(",
"$",
"acceptable",
"as",
"$",
"type",
"=>",
"$",
"q",
")",
"{",
"$",
"pattern",
"=",
"'#^'",
".",
"str_replace",
"(",
"'*'",
",",
"... | See if a mime type is accepted
@param string $mimeType The mime type to check, for instance "image/png"
@param array $acceptable An array of acceptable content types as keys and the quality as
value
@return boolean|double Returns the quality of the mime type if it is accepted, or false
otherwise | [
"See",
"if",
"a",
"mime",
"type",
"is",
"accepted"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Http/ContentNegotiation.php#L51-L61 |
188,066 | imbo/imbo | src/Auth/AccessControl/Adapter/ArrayAdapter.php | ArrayAdapter.getKeysFromAcl | private function getKeysFromAcl() {
$keys = [];
foreach ($this->accessList as $access) {
$keys[$access['publicKey']] = $access['privateKey'];
}
return $keys;
} | php | private function getKeysFromAcl() {
$keys = [];
foreach ($this->accessList as $access) {
$keys[$access['publicKey']] = $access['privateKey'];
}
return $keys;
} | [
"private",
"function",
"getKeysFromAcl",
"(",
")",
"{",
"$",
"keys",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"accessList",
"as",
"$",
"access",
")",
"{",
"$",
"keys",
"[",
"$",
"access",
"[",
"'publicKey'",
"]",
"]",
"=",
"$",
"acces... | Get an array of public => private key pairs defined in the ACL
@return array | [
"Get",
"an",
"array",
"of",
"public",
"=",
">",
"private",
"key",
"pairs",
"defined",
"in",
"the",
"ACL"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Auth/AccessControl/Adapter/ArrayAdapter.php#L145-L152 |
188,067 | imbo/imbo | src/Auth/AccessControl/Adapter/ArrayAdapter.php | ArrayAdapter.validateAccessList | private function validateAccessList() {
// Get all user lists
$declaredPublicKeys = array_map(function($acl) {
return $acl['publicKey'];
}, $this->accessList);
$publicKeys = [];
foreach ($declaredPublicKeys as $key) {
if (in_array($key, $publicKeys)) {
... | php | private function validateAccessList() {
// Get all user lists
$declaredPublicKeys = array_map(function($acl) {
return $acl['publicKey'];
}, $this->accessList);
$publicKeys = [];
foreach ($declaredPublicKeys as $key) {
if (in_array($key, $publicKeys)) {
... | [
"private",
"function",
"validateAccessList",
"(",
")",
"{",
"// Get all user lists",
"$",
"declaredPublicKeys",
"=",
"array_map",
"(",
"function",
"(",
"$",
"acl",
")",
"{",
"return",
"$",
"acl",
"[",
"'publicKey'",
"]",
";",
"}",
",",
"$",
"this",
"->",
"... | Validate access list data
@throws InvalidArgumentException | [
"Validate",
"access",
"list",
"data"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Auth/AccessControl/Adapter/ArrayAdapter.php#L159-L173 |
188,068 | imbo/imbo | src/EventManager/PriorityQueue.php | PriorityQueue.insert | public function insert($datum, $priority) {
if (is_int($priority)) {
$priority = [$priority, $this->queueOrder--];
}
parent::insert($datum, $priority);
} | php | public function insert($datum, $priority) {
if (is_int($priority)) {
$priority = [$priority, $this->queueOrder--];
}
parent::insert($datum, $priority);
} | [
"public",
"function",
"insert",
"(",
"$",
"datum",
",",
"$",
"priority",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"priority",
")",
")",
"{",
"$",
"priority",
"=",
"[",
"$",
"priority",
",",
"$",
"this",
"->",
"queueOrder",
"--",
"]",
";",
"}",
"p... | Add an entry to the queue
@param mixed $datum The entry to add
@param int $priority The priority of the entry in the queue | [
"Add",
"an",
"entry",
"to",
"the",
"queue"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventManager/PriorityQueue.php#L35-L41 |
188,069 | imbo/imbo | src/Resource/GlobalShortUrl.php | GlobalShortUrl.getImage | public function getImage(EventInterface $event) {
$request = $event->getRequest();
$route = $request->getRoute();
$params = $event->getDatabase()->getShortUrlParams($route->get('shortUrlId'));
if (!$params) {
throw new ResourceException('Image not found', 404);
}
... | php | public function getImage(EventInterface $event) {
$request = $event->getRequest();
$route = $request->getRoute();
$params = $event->getDatabase()->getShortUrlParams($route->get('shortUrlId'));
if (!$params) {
throw new ResourceException('Image not found', 404);
}
... | [
"public",
"function",
"getImage",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"route",
"=",
"$",
"request",
"->",
"getRoute",
"(",
")",
";",
"$",
"params",
"=",
"$",
"event... | Fetch an image via a short URL
@param EventInterface $event | [
"Fetch",
"an",
"image",
"via",
"a",
"short",
"URL"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/GlobalShortUrl.php#L47-L64 |
188,070 | imbo/imbo | src/EventListener/ImageVariations/Database/MongoDB.php | MongoDB.getCollection | private function getCollection() {
if ($this->collection === null) {
try {
$this->collection = $this->getMongoClient()->selectCollection(
$this->params['databaseName'],
'imagevariation'
);
} catch (MongoException $e)... | php | private function getCollection() {
if ($this->collection === null) {
try {
$this->collection = $this->getMongoClient()->selectCollection(
$this->params['databaseName'],
'imagevariation'
);
} catch (MongoException $e)... | [
"private",
"function",
"getCollection",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"collection",
"===",
"null",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"collection",
"=",
"$",
"this",
"->",
"getMongoClient",
"(",
")",
"->",
"selectCollection",
"(",
... | Get the mongo collection
@return MongoCollection | [
"Get",
"the",
"mongo",
"collection"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageVariations/Database/MongoDB.php#L151-L164 |
188,071 | imbo/imbo | src/EventListener/ImageVariations/Database/MongoDB.php | MongoDB.getMongoClient | private function getMongoClient() {
if ($this->mongoClient === null) {
try {
$this->mongoClient = new MongoClient($this->params['server'], $this->params['options']);
} catch (MongoException $e) {
throw new DatabaseException('Could not connect to database',... | php | private function getMongoClient() {
if ($this->mongoClient === null) {
try {
$this->mongoClient = new MongoClient($this->params['server'], $this->params['options']);
} catch (MongoException $e) {
throw new DatabaseException('Could not connect to database',... | [
"private",
"function",
"getMongoClient",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"mongoClient",
"===",
"null",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"mongoClient",
"=",
"new",
"MongoClient",
"(",
"$",
"this",
"->",
"params",
"[",
"'server'",
"]... | Get the mongo client instance
@return MongoClient | [
"Get",
"the",
"mongo",
"client",
"instance"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageVariations/Database/MongoDB.php#L171-L181 |
188,072 | imbo/imbo | src/Resource/Metadata.php | Metadata.put | public function put(EventInterface $event) {
$request = $event->getRequest();
$metadata = json_decode($request->getContent(), true);
$event->getManager()
->trigger('db.metadata.delete')
->trigger('db.metadata.update', [
'metadata' => $metadata,
... | php | public function put(EventInterface $event) {
$request = $event->getRequest();
$metadata = json_decode($request->getContent(), true);
$event->getManager()
->trigger('db.metadata.delete')
->trigger('db.metadata.update', [
'metadata' => $metadata,
... | [
"public",
"function",
"put",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"metadata",
"=",
"json_decode",
"(",
"$",
"request",
"->",
"getContent",
"(",
")",
",",
"true",
")",
... | Handle PUT requests
@param EventInterface $event The current event | [
"Handle",
"PUT",
"requests"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Metadata.php#L65-L79 |
188,073 | imbo/imbo | src/Resource/Metadata.php | Metadata.validateMetadata | public function validateMetadata(EventInterface $event) {
$request = $event->getRequest();
$metadata = $request->getContent();
if (empty($metadata)) {
throw new InvalidArgumentException('Missing JSON data', 400);
} else {
$metadata = json_decode($metadata, true);... | php | public function validateMetadata(EventInterface $event) {
$request = $event->getRequest();
$metadata = $request->getContent();
if (empty($metadata)) {
throw new InvalidArgumentException('Missing JSON data', 400);
} else {
$metadata = json_decode($metadata, true);... | [
"public",
"function",
"validateMetadata",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"metadata",
"=",
"$",
"request",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"empty",
... | Validate metadata found in the request body
@param EventInterface $event The event instance
@throws InvalidArgumentException | [
"Validate",
"metadata",
"found",
"in",
"the",
"request",
"body"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Metadata.php#L114-L135 |
188,074 | imbo/imbo | src/Storage/B2.php | B2.getClient | protected function getClient() {
if ($this->client === null) {
$this->client = new Client($this->getParam('accountId'), $this->getParam('applicationKey'));
}
return $this->client;
} | php | protected function getClient() {
if ($this->client === null) {
$this->client = new Client($this->getParam('accountId'), $this->getParam('applicationKey'));
}
return $this->client;
} | [
"protected",
"function",
"getClient",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"client",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"client",
"=",
"new",
"Client",
"(",
"$",
"this",
"->",
"getParam",
"(",
"'accountId'",
")",
",",
"$",
"this",
... | Get the current B2 client | [
"Get",
"the",
"current",
"B2",
"client"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Storage/B2.php#L189-L195 |
188,075 | imbo/imbo | src/Database/MongoDB.php | MongoDB.getCollection | private function getCollection($type) {
if ($this->collections[$type] === null) {
try {
$this->collections[$type] = $this->getMongoClient()->selectCollection(
$this->params['databaseName'],
$type
);
} catch (MongoExc... | php | private function getCollection($type) {
if ($this->collections[$type] === null) {
try {
$this->collections[$type] = $this->getMongoClient()->selectCollection(
$this->params['databaseName'],
$type
);
} catch (MongoExc... | [
"private",
"function",
"getCollection",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"collections",
"[",
"$",
"type",
"]",
"===",
"null",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"collections",
"[",
"$",
"type",
"]",
"=",
"$",
"this",
... | Get the mongo collection instance
@param string $type "image" or "shortUrl"
@return MongoCollection | [
"Get",
"the",
"mongo",
"collection",
"instance"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Database/MongoDB.php#L702-L715 |
188,076 | imbo/imbo | src/Resource.php | Resource.getReadOnlyResources | final public static function getReadOnlyResources() {
return [
self::USER_GET,
self::USER_HEAD,
self::USER_OPTIONS,
self::IMAGE_GET,
self::IMAGE_HEAD,
self::IMAGE_OPTIONS,
self::IMAGES_GET,
self::IMAGES_HEAD,
... | php | final public static function getReadOnlyResources() {
return [
self::USER_GET,
self::USER_HEAD,
self::USER_OPTIONS,
self::IMAGE_GET,
self::IMAGE_HEAD,
self::IMAGE_OPTIONS,
self::IMAGES_GET,
self::IMAGES_HEAD,
... | [
"final",
"public",
"static",
"function",
"getReadOnlyResources",
"(",
")",
"{",
"return",
"[",
"self",
"::",
"USER_GET",
",",
"self",
"::",
"USER_HEAD",
",",
"self",
"::",
"USER_OPTIONS",
",",
"self",
"::",
"IMAGE_GET",
",",
"self",
"::",
"IMAGE_HEAD",
",",
... | Returns a list of resources which should be accessible for read-only public keys
@return array | [
"Returns",
"a",
"list",
"of",
"resources",
"which",
"should",
"be",
"accessible",
"for",
"read",
"-",
"only",
"public",
"keys"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource.php#L84-L112 |
188,077 | imbo/imbo | src/Resource.php | Resource.getReadWriteResources | final public static function getReadWriteResources() {
return array_merge(
self::getReadOnlyResources(), [
self::IMAGE_DELETE,
self::IMAGES_POST,
self::METADATA_POST,
self::METADATA_DELETE,
self::METADATA_PUT,
... | php | final public static function getReadWriteResources() {
return array_merge(
self::getReadOnlyResources(), [
self::IMAGE_DELETE,
self::IMAGES_POST,
self::METADATA_POST,
self::METADATA_DELETE,
self::METADATA_PUT,
... | [
"final",
"public",
"static",
"function",
"getReadWriteResources",
"(",
")",
"{",
"return",
"array_merge",
"(",
"self",
"::",
"getReadOnlyResources",
"(",
")",
",",
"[",
"self",
"::",
"IMAGE_DELETE",
",",
"self",
"::",
"IMAGES_POST",
",",
"self",
"::",
"METADAT... | Returns a list of resources which should be accessible for read+write public keys
@return array | [
"Returns",
"a",
"list",
"of",
"resources",
"which",
"should",
"be",
"accessible",
"for",
"read",
"+",
"write",
"public",
"keys"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource.php#L119-L135 |
188,078 | imbo/imbo | src/Resource.php | Resource.getAllResources | final public static function getAllResources() {
return array_merge(
self::getReadWriteResources(), [
self::KEYS_PUT,
self::KEYS_HEAD,
self::KEYS_DELETE,
self::KEYS_OPTIONS,
self::ACCESS_RULE_GET,
self::... | php | final public static function getAllResources() {
return array_merge(
self::getReadWriteResources(), [
self::KEYS_PUT,
self::KEYS_HEAD,
self::KEYS_DELETE,
self::KEYS_OPTIONS,
self::ACCESS_RULE_GET,
self::... | [
"final",
"public",
"static",
"function",
"getAllResources",
"(",
")",
"{",
"return",
"array_merge",
"(",
"self",
"::",
"getReadWriteResources",
"(",
")",
",",
"[",
"self",
"::",
"KEYS_PUT",
",",
"self",
"::",
"KEYS_HEAD",
",",
"self",
"::",
"KEYS_DELETE",
",... | Returns a list of all resources available, including those which involves access control
@return array | [
"Returns",
"a",
"list",
"of",
"all",
"resources",
"available",
"including",
"those",
"which",
"involves",
"access",
"control"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource.php#L142-L171 |
188,079 | imbo/imbo | src/EventListener/ImageTransformationCache.php | ImageTransformationCache.loadFromCache | public function loadFromCache(EventInterface $event) {
$request = $event->getRequest();
$response = $event->getResponse();
// Generate the full file path to the response
$path = $this->getCacheFilePath($request);
if (is_file($path)) {
$data = @unserialize(file_get_c... | php | public function loadFromCache(EventInterface $event) {
$request = $event->getRequest();
$response = $event->getResponse();
// Generate the full file path to the response
$path = $this->getCacheFilePath($request);
if (is_file($path)) {
$data = @unserialize(file_get_c... | [
"public",
"function",
"loadFromCache",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"response",
"=",
"$",
"event",
"->",
"getResponse",
"(",
")",
";",
"// Generate the full file pat... | Load transformed images from the cache
@param EventInterface $event The current event | [
"Load",
"transformed",
"images",
"from",
"the",
"cache"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageTransformationCache.php#L102-L143 |
188,080 | imbo/imbo | src/EventListener/ImageTransformationCache.php | ImageTransformationCache.storeInCache | public function storeInCache(EventInterface $event) {
$request = $event->getRequest();
$response = $event->getResponse();
$model = $response->getModel();
if (!$model instanceof Image || $this->isCacheHit()) {
// Only store images in the cache, and don't try to rewrite on cac... | php | public function storeInCache(EventInterface $event) {
$request = $event->getRequest();
$response = $event->getResponse();
$model = $response->getModel();
if (!$model instanceof Image || $this->isCacheHit()) {
// Only store images in the cache, and don't try to rewrite on cac... | [
"public",
"function",
"storeInCache",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"response",
"=",
"$",
"event",
"->",
"getResponse",
"(",
")",
";",
"$",
"model",
"=",
"$",
... | Store transformed images in the cache
@param EventInterface $event The current event | [
"Store",
"transformed",
"images",
"in",
"the",
"cache"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageTransformationCache.php#L150-L197 |
188,081 | imbo/imbo | src/EventListener/ImageTransformationCache.php | ImageTransformationCache.deleteFromCache | public function deleteFromCache(EventInterface $event) {
$request = $event->getRequest();
$cacheDir = $this->getCacheDir($request->getUser(), $request->getImageIdentifier());
if (is_dir($cacheDir)) {
$this->rmdir($cacheDir);
}
} | php | public function deleteFromCache(EventInterface $event) {
$request = $event->getRequest();
$cacheDir = $this->getCacheDir($request->getUser(), $request->getImageIdentifier());
if (is_dir($cacheDir)) {
$this->rmdir($cacheDir);
}
} | [
"public",
"function",
"deleteFromCache",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"cacheDir",
"=",
"$",
"this",
"->",
"getCacheDir",
"(",
"$",
"request",
"->",
"getUser",
"(... | Delete cached images from the cache
@param EventInterface $event The current event | [
"Delete",
"cached",
"images",
"from",
"the",
"cache"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageTransformationCache.php#L204-L211 |
188,082 | imbo/imbo | src/EventListener/ImageTransformationCache.php | ImageTransformationCache.getCacheDir | protected function getCacheDir($user, $imageIdentifier) {
$userPath = str_pad($user, 3, '0', STR_PAD_LEFT);
return sprintf(
'%s/%s/%s/%s/%s/%s/%s/%s/%s',
$this->getPath(),
$userPath[0],
$userPath[1],
$userPath[2],
$user,
... | php | protected function getCacheDir($user, $imageIdentifier) {
$userPath = str_pad($user, 3, '0', STR_PAD_LEFT);
return sprintf(
'%s/%s/%s/%s/%s/%s/%s/%s/%s',
$this->getPath(),
$userPath[0],
$userPath[1],
$userPath[2],
$user,
... | [
"protected",
"function",
"getCacheDir",
"(",
"$",
"user",
",",
"$",
"imageIdentifier",
")",
"{",
"$",
"userPath",
"=",
"str_pad",
"(",
"$",
"user",
",",
"3",
",",
"'0'",
",",
"STR_PAD_LEFT",
")",
";",
"return",
"sprintf",
"(",
"'%s/%s/%s/%s/%s/%s/%s/%s/%s'",... | Get the path to the current image cache dir
@param string $user The user which the image belongs to
@param string $imageIdentifier The image identifier
@return string Returns the absolute path to the image cache dir | [
"Get",
"the",
"path",
"to",
"the",
"current",
"image",
"cache",
"dir"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageTransformationCache.php#L256-L270 |
188,083 | imbo/imbo | src/EventListener/ImageTransformationCache.php | ImageTransformationCache.getCacheFilePath | protected function getCacheFilePath(Request $request) {
$hash = $this->getCacheKey($request);
$dir = $this->getCacheDir($request->getUser(), $request->getImageIdentifier());
return sprintf(
'%s/%s/%s/%s/%s',
$dir,
$hash[0],
$hash[1],
$... | php | protected function getCacheFilePath(Request $request) {
$hash = $this->getCacheKey($request);
$dir = $this->getCacheDir($request->getUser(), $request->getImageIdentifier());
return sprintf(
'%s/%s/%s/%s/%s',
$dir,
$hash[0],
$hash[1],
$... | [
"protected",
"function",
"getCacheFilePath",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"hash",
"=",
"$",
"this",
"->",
"getCacheKey",
"(",
"$",
"request",
")",
";",
"$",
"dir",
"=",
"$",
"this",
"->",
"getCacheDir",
"(",
"$",
"request",
"->",
"get... | Get the absolute path to response in the cache
@param Request $request The current request instance
@return string Returns the absolute path to the cache file | [
"Get",
"the",
"absolute",
"path",
"to",
"response",
"in",
"the",
"cache"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/ImageTransformationCache.php#L278-L290 |
188,084 | imbo/imbo | src/CliCommand/GeneratePrivateKey.php | GeneratePrivateKey.generate | public function generate() {
$strong = false;
$i = 0;
while (!$strong && $this->maxTries > $i++) {
$data = openssl_random_pseudo_bytes(32, $strong);
}
if (!$strong) {
throw new RuntimeException('Could not generate private key');
}
// bas... | php | public function generate() {
$strong = false;
$i = 0;
while (!$strong && $this->maxTries > $i++) {
$data = openssl_random_pseudo_bytes(32, $strong);
}
if (!$strong) {
throw new RuntimeException('Could not generate private key');
}
// bas... | [
"public",
"function",
"generate",
"(",
")",
"{",
"$",
"strong",
"=",
"false",
";",
"$",
"i",
"=",
"0",
";",
"while",
"(",
"!",
"$",
"strong",
"&&",
"$",
"this",
"->",
"maxTries",
">",
"$",
"i",
"++",
")",
"{",
"$",
"data",
"=",
"openssl_random_ps... | Generate a private key
@return string | [
"Generate",
"a",
"private",
"key"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/CliCommand/GeneratePrivateKey.php#L54-L71 |
188,085 | imbo/imbo | src/Image/InputLoaderManager.php | InputLoaderManager.addLoaders | public function addLoaders(array $loaders) {
foreach ($loaders as $loader) {
if (is_string($loader)) {
$loader = new $loader();
}
if (!$loader instanceof InputLoaderInterface) {
$name = is_object($loader) ? get_class($loader) : (string) $loade... | php | public function addLoaders(array $loaders) {
foreach ($loaders as $loader) {
if (is_string($loader)) {
$loader = new $loader();
}
if (!$loader instanceof InputLoaderInterface) {
$name = is_object($loader) ? get_class($loader) : (string) $loade... | [
"public",
"function",
"addLoaders",
"(",
"array",
"$",
"loaders",
")",
"{",
"foreach",
"(",
"$",
"loaders",
"as",
"$",
"loader",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"loader",
")",
")",
"{",
"$",
"loader",
"=",
"new",
"$",
"loader",
"(",
")"... | Add a list of input loaders to the manager.
@param array<InputLoaderInterface|string> $loaders A list of loaders to add to the manager.
@return self | [
"Add",
"a",
"list",
"of",
"input",
"loaders",
"to",
"the",
"manager",
"."
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/InputLoaderManager.php#L64-L79 |
188,086 | imbo/imbo | src/Image/InputLoaderManager.php | InputLoaderManager.registerLoader | public function registerLoader(InputLoaderInterface $loader) {
foreach ($loader->getSupportedMimeTypes() as $mime => $extensions) {
if (!isset($this->loaders[$mime])) {
$this->loaders[$mime] = [];
}
if (!isset($this->mimeTypeToExtension[$mime])) {
... | php | public function registerLoader(InputLoaderInterface $loader) {
foreach ($loader->getSupportedMimeTypes() as $mime => $extensions) {
if (!isset($this->loaders[$mime])) {
$this->loaders[$mime] = [];
}
if (!isset($this->mimeTypeToExtension[$mime])) {
... | [
"public",
"function",
"registerLoader",
"(",
"InputLoaderInterface",
"$",
"loader",
")",
"{",
"foreach",
"(",
"$",
"loader",
"->",
"getSupportedMimeTypes",
"(",
")",
"as",
"$",
"mime",
"=>",
"$",
"extensions",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
... | Register a specific input loader for the manager to use.
@param InputLoaderInterface $loader InputLoader to register
@return self | [
"Register",
"a",
"specific",
"input",
"loader",
"for",
"the",
"manager",
"to",
"use",
"."
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/InputLoaderManager.php#L87-L109 |
188,087 | imbo/imbo | src/Image/InputLoaderManager.php | InputLoaderManager.load | public function load($mime, $blob) {
if (!isset($this->loaders[$mime])) {
return null;
}
foreach ($this->loaders[$mime] as $loader) {
$result = $loader->load($this->imagick, $blob, $mime);
// If the result is false, let the loop continue to try more loaders,... | php | public function load($mime, $blob) {
if (!isset($this->loaders[$mime])) {
return null;
}
foreach ($this->loaders[$mime] as $loader) {
$result = $loader->load($this->imagick, $blob, $mime);
// If the result is false, let the loop continue to try more loaders,... | [
"public",
"function",
"load",
"(",
"$",
"mime",
",",
"$",
"blob",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"loaders",
"[",
"$",
"mime",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"loader... | Load a binary blob as an image.
@param string $mime Mime type of the binary blob
@param string $blob Binary data to load / rasterize
@return boolean|null|Imagick Returns false if all the registered loaders was unable to load
the blob. If any of the loaders ends up with a result other than
false, the imagick instance w... | [
"Load",
"a",
"binary",
"blob",
"as",
"an",
"image",
"."
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/InputLoaderManager.php#L120-L150 |
188,088 | imbo/imbo | src/EventListener/AutoRotateImage.php | AutoRotateImage.autoRotate | public function autoRotate(EventInterface $event) {
$event->getTransformationManager()
->getTransformation('autoRotate')
->setImage($event->getRequest()->getImage())
->transform([]);
} | php | public function autoRotate(EventInterface $event) {
$event->getTransformationManager()
->getTransformation('autoRotate')
->setImage($event->getRequest()->getImage())
->transform([]);
} | [
"public",
"function",
"autoRotate",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"event",
"->",
"getTransformationManager",
"(",
")",
"->",
"getTransformation",
"(",
"'autoRotate'",
")",
"->",
"setImage",
"(",
"$",
"event",
"->",
"getRequest",
"(",
")",... | Autorotate images when new images are added to Imbo
@param EventInterface $event The triggered event | [
"Autorotate",
"images",
"when",
"new",
"images",
"are",
"added",
"to",
"Imbo"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/EventListener/AutoRotateImage.php#L37-L42 |
188,089 | imbo/imbo | src/Resource/Images/Query.php | Query.returnMetadata | public function returnMetadata($returnMetadata = null) {
if ($returnMetadata === null) {
return $this->returnMetadata;
}
$this->returnMetadata = (bool) $returnMetadata;
return $this;
} | php | public function returnMetadata($returnMetadata = null) {
if ($returnMetadata === null) {
return $this->returnMetadata;
}
$this->returnMetadata = (bool) $returnMetadata;
return $this;
} | [
"public",
"function",
"returnMetadata",
"(",
"$",
"returnMetadata",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"returnMetadata",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"returnMetadata",
";",
"}",
"$",
"this",
"->",
"returnMetadata",
"=",
"(",
... | Set or get the returnMetadata flag
@param boolean $returnMetadata Give this a value to set the returnMetadata flag
@return boolean|self | [
"Set",
"or",
"get",
"the",
"returnMetadata",
"flag"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Images/Query.php#L123-L131 |
188,090 | imbo/imbo | src/Resource/Images/Query.php | Query.imageIdentifiers | public function imageIdentifiers(array $imageIdentifiers = null) {
if ($imageIdentifiers === null) {
return $this->imageIdentifiers;
}
$this->imageIdentifiers = $imageIdentifiers;
return $this;
} | php | public function imageIdentifiers(array $imageIdentifiers = null) {
if ($imageIdentifiers === null) {
return $this->imageIdentifiers;
}
$this->imageIdentifiers = $imageIdentifiers;
return $this;
} | [
"public",
"function",
"imageIdentifiers",
"(",
"array",
"$",
"imageIdentifiers",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"imageIdentifiers",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"imageIdentifiers",
";",
"}",
"$",
"this",
"->",
"imageIdentifie... | Set or get the imageIdentifiers filter
@param array $imageIdentifiers Give this a value to set the property
@return array|self | [
"Set",
"or",
"get",
"the",
"imageIdentifiers",
"filter"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Images/Query.php#L171-L179 |
188,091 | imbo/imbo | src/Resource/Images/Query.php | Query.sort | public function sort(array $sort = null) {
if ($sort === null) {
return $this->sort;
}
$sortData = [];
foreach ($sort as $field) {
$field = trim($field);
$dir = 'asc';
if (empty($field)) {
throw new RuntimeException('Badl... | php | public function sort(array $sort = null) {
if ($sort === null) {
return $this->sort;
}
$sortData = [];
foreach ($sort as $field) {
$field = trim($field);
$dir = 'asc';
if (empty($field)) {
throw new RuntimeException('Badl... | [
"public",
"function",
"sort",
"(",
"array",
"$",
"sort",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"sort",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"sort",
";",
"}",
"$",
"sortData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"sort",
"a... | Set or get the sort data
@param array $sort Specify a value to set the sort property
@return array|self | [
"Set",
"or",
"get",
"the",
"sort",
"data"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Resource/Images/Query.php#L219-L253 |
188,092 | imbo/imbo | src/Auth/AccessControl/Adapter/MongoDB.php | MongoDB.getPublicKeyDetails | private function getPublicKeyDetails($publicKey) {
if (isset($this->publicKeys[$publicKey])) {
return $this->publicKeys[$publicKey];
}
// Not in cache, fetch from database
$pubkeyInfo = $this->getAclCollection()->findOne([
'publicKey' => $publicKey,
]);
... | php | private function getPublicKeyDetails($publicKey) {
if (isset($this->publicKeys[$publicKey])) {
return $this->publicKeys[$publicKey];
}
// Not in cache, fetch from database
$pubkeyInfo = $this->getAclCollection()->findOne([
'publicKey' => $publicKey,
]);
... | [
"private",
"function",
"getPublicKeyDetails",
"(",
"$",
"publicKey",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"publicKeys",
"[",
"$",
"publicKey",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"publicKeys",
"[",
"$",
"publicKey",
"]",
"... | Get details for a given public key
@param string $publicKey
@return array | [
"Get",
"details",
"for",
"a",
"given",
"public",
"key"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Auth/AccessControl/Adapter/MongoDB.php#L403-L422 |
188,093 | imbo/imbo | src/Auth/AccessControl/Adapter/MongoDB.php | MongoDB.getAclCollection | private function getAclCollection() {
if ($this->aclCollection === null) {
try {
$this->aclCollection = $this->getMongoClient()->selectCollection(
$this->params['databaseName'],
'accesscontrol'
);
} catch (MongoExcep... | php | private function getAclCollection() {
if ($this->aclCollection === null) {
try {
$this->aclCollection = $this->getMongoClient()->selectCollection(
$this->params['databaseName'],
'accesscontrol'
);
} catch (MongoExcep... | [
"private",
"function",
"getAclCollection",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"aclCollection",
"===",
"null",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"aclCollection",
"=",
"$",
"this",
"->",
"getMongoClient",
"(",
")",
"->",
"selectCollection",
... | Get the ACL mongo collection
@return MongoCollection | [
"Get",
"the",
"ACL",
"mongo",
"collection"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Auth/AccessControl/Adapter/MongoDB.php#L429-L442 |
188,094 | imbo/imbo | src/Auth/AccessControl/Adapter/MongoDB.php | MongoDB.getGroupsCollection | private function getGroupsCollection() {
if ($this->aclGroupCollection === null) {
try {
$this->aclGroupCollection = $this->getMongoClient()->selectCollection(
$this->params['databaseName'],
'accesscontrolgroup'
);
}... | php | private function getGroupsCollection() {
if ($this->aclGroupCollection === null) {
try {
$this->aclGroupCollection = $this->getMongoClient()->selectCollection(
$this->params['databaseName'],
'accesscontrolgroup'
);
}... | [
"private",
"function",
"getGroupsCollection",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"aclGroupCollection",
"===",
"null",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"aclGroupCollection",
"=",
"$",
"this",
"->",
"getMongoClient",
"(",
")",
"->",
"select... | Get the resource groups mongo collection
@return MongoCollection | [
"Get",
"the",
"resource",
"groups",
"mongo",
"collection"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Auth/AccessControl/Adapter/MongoDB.php#L449-L462 |
188,095 | imbo/imbo | src/Image/Transformation/MaxSize.php | MaxSize.calculateSize | protected function calculateSize(array $params, array $imageSize) {
$maxWidth = !empty($params['width']) ? (int) $params['width'] : 0;
$maxHeight = !empty($params['height']) ? (int) $params['height'] : 0;
$sourceWidth = $imageSize['width'];
$sourceHeight = $imageSize['height'];
... | php | protected function calculateSize(array $params, array $imageSize) {
$maxWidth = !empty($params['width']) ? (int) $params['width'] : 0;
$maxHeight = !empty($params['height']) ? (int) $params['height'] : 0;
$sourceWidth = $imageSize['width'];
$sourceHeight = $imageSize['height'];
... | [
"protected",
"function",
"calculateSize",
"(",
"array",
"$",
"params",
",",
"array",
"$",
"imageSize",
")",
"{",
"$",
"maxWidth",
"=",
"!",
"empty",
"(",
"$",
"params",
"[",
"'width'",
"]",
")",
"?",
"(",
"int",
")",
"$",
"params",
"[",
"'width'",
"]... | Calculate the output size based on the specified parameters
@param array $params
@param array $imageSize
@return array|boolean | [
"Calculate",
"the",
"output",
"size",
"based",
"on",
"the",
"specified",
"parameters"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/Transformation/MaxSize.php#L66-L92 |
188,096 | imbo/imbo | src/Image/TransformationManager.php | TransformationManager.getTransformation | public function getTransformation($name) {
if (isset($this->handlers[$name])) {
return $this->handlers[$name];
} else if (!isset($this->transformations[$name]) || !$this->transformations[$name]) {
return false;
}
// The listener has not been initialized
$... | php | public function getTransformation($name) {
if (isset($this->handlers[$name])) {
return $this->handlers[$name];
} else if (!isset($this->transformations[$name]) || !$this->transformations[$name]) {
return false;
}
// The listener has not been initialized
$... | [
"public",
"function",
"getTransformation",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"handlers",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"handlers",
"[",
"$",
"name",
"]",
";",
"}",
"else",
... | Get the transformation registered for the given transformation name
@param string $name Name of transformation
@return Transformation | [
"Get",
"the",
"transformation",
"registered",
"for",
"the",
"given",
"transformation",
"name"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/TransformationManager.php#L120-L145 |
188,097 | imbo/imbo | src/Image/TransformationManager.php | TransformationManager.applyTransformations | public function applyTransformations(EventInterface $event) {
$request = $event->getRequest();
$image = $event->getResponse()->getModel();
$presets = $event->getConfig()['transformationPresets'];
// Fetch transformations specifed in the query and transform the image
foreach ($re... | php | public function applyTransformations(EventInterface $event) {
$request = $event->getRequest();
$image = $event->getResponse()->getModel();
$presets = $event->getConfig()['transformationPresets'];
// Fetch transformations specifed in the query and transform the image
foreach ($re... | [
"public",
"function",
"applyTransformations",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"image",
"=",
"$",
"event",
"->",
"getResponse",
"(",
")",
"->",
"getModel",
"(",
")",... | Apply image transformations
@param EventInterface $event The current event | [
"Apply",
"image",
"transformations"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/TransformationManager.php#L152-L185 |
188,098 | imbo/imbo | src/Image/TransformationManager.php | TransformationManager.adjustImageTransformations | public function adjustImageTransformations(EventInterface $event) {
// If the image has not stepped through any input size transformations,
// we don't set any ratio, and it should be safe to assume no transformations
// parameters require any adjustment
if (!$event->hasArgument('ratio')... | php | public function adjustImageTransformations(EventInterface $event) {
// If the image has not stepped through any input size transformations,
// we don't set any ratio, and it should be safe to assume no transformations
// parameters require any adjustment
if (!$event->hasArgument('ratio')... | [
"public",
"function",
"adjustImageTransformations",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"// If the image has not stepped through any input size transformations,",
"// we don't set any ratio, and it should be safe to assume no transformations",
"// parameters require any adjustment",... | Adjust image transformations
@param EventInterface $event | [
"Adjust",
"image",
"transformations"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/TransformationManager.php#L313-L341 |
188,099 | imbo/imbo | src/Image/TransformationManager.php | TransformationManager.triggerTransformation | protected function triggerTransformation($name, array $params, EventInterface $event) {
$transformation = $this->getTransformation($name);
if (!$transformation) {
throw new TransformationException('Transformation "' . $name . '" not registered', 400);
}
$transformation
... | php | protected function triggerTransformation($name, array $params, EventInterface $event) {
$transformation = $this->getTransformation($name);
if (!$transformation) {
throw new TransformationException('Transformation "' . $name . '" not registered', 400);
}
$transformation
... | [
"protected",
"function",
"triggerTransformation",
"(",
"$",
"name",
",",
"array",
"$",
"params",
",",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"transformation",
"=",
"$",
"this",
"->",
"getTransformation",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
... | Trigger transformation with the given name, with the given parameters
@param string $name Name of transformation
@param array $params Transformation parameters
@param EventInterface $event Event that triggered the transformation chain
@throws TransformationException If the transformation fails or is not registered | [
"Trigger",
"transformation",
"with",
"the",
"given",
"name",
"with",
"the",
"given",
"parameters"
] | 22125d1c477d67e8308b9eae604d029d79fe7d1f | https://github.com/imbo/imbo/blob/22125d1c477d67e8308b9eae604d029d79fe7d1f/src/Image/TransformationManager.php#L351-L362 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.