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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
208,300 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.itemTypeToIconClass | protected function itemTypeToIconClass($item, $itemType)
{
if ($item->type == MediaLibraryItem::TYPE_FOLDER) {
return 'icon-folder';
}
switch ($itemType) {
case MediaLibraryItem::FILE_TYPE_IMAGE: return "icon-picture-o";
case MediaLibraryItem::FILE_TYPE_V... | php | protected function itemTypeToIconClass($item, $itemType)
{
if ($item->type == MediaLibraryItem::TYPE_FOLDER) {
return 'icon-folder';
}
switch ($itemType) {
case MediaLibraryItem::FILE_TYPE_IMAGE: return "icon-picture-o";
case MediaLibraryItem::FILE_TYPE_V... | [
"protected",
"function",
"itemTypeToIconClass",
"(",
"$",
"item",
",",
"$",
"itemType",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"type",
"==",
"MediaLibraryItem",
"::",
"TYPE_FOLDER",
")",
"{",
"return",
"'icon-folder'",
";",
"}",
"switch",
"(",
"$",
"itemT... | Returns an icon for the item type
@param System\Classes\MediaLibraryItem $item
@param string $itemType
@return string | [
"Returns",
"an",
"icon",
"for",
"the",
"item",
"type"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1087-L1099 |
208,301 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.splitPathToSegments | protected function splitPathToSegments($path)
{
$path = MediaLibrary::validatePath($path, true);
$path = explode('/', ltrim($path, '/'));
$result = [];
while (count($path) > 0) {
$folder = array_pop($path);
$result[$folder] = implode('/', $path).'/'.$folder;... | php | protected function splitPathToSegments($path)
{
$path = MediaLibrary::validatePath($path, true);
$path = explode('/', ltrim($path, '/'));
$result = [];
while (count($path) > 0) {
$folder = array_pop($path);
$result[$folder] = implode('/', $path).'/'.$folder;... | [
"protected",
"function",
"splitPathToSegments",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"MediaLibrary",
"::",
"validatePath",
"(",
"$",
"path",
",",
"true",
")",
";",
"$",
"path",
"=",
"explode",
"(",
"'/'",
",",
"ltrim",
"(",
"$",
"path",
",",
... | Splits a path in to segments
@param string $path
@return array | [
"Splits",
"a",
"path",
"in",
"to",
"segments"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1106-L1122 |
208,302 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.setViewMode | protected function setViewMode($viewMode)
{
if (!in_array($viewMode, [
self::VIEW_MODE_GRID,
self::VIEW_MODE_LIST,
self::VIEW_MODE_TILES
])) {
throw new ApplicationException('Invalid input data');
}
$this->putSession('view_mode', $view... | php | protected function setViewMode($viewMode)
{
if (!in_array($viewMode, [
self::VIEW_MODE_GRID,
self::VIEW_MODE_LIST,
self::VIEW_MODE_TILES
])) {
throw new ApplicationException('Invalid input data');
}
$this->putSession('view_mode', $view... | [
"protected",
"function",
"setViewMode",
"(",
"$",
"viewMode",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"viewMode",
",",
"[",
"self",
"::",
"VIEW_MODE_GRID",
",",
"self",
"::",
"VIEW_MODE_LIST",
",",
"self",
"::",
"VIEW_MODE_TILES",
"]",
")",
")",
... | Stores a view mode in the session
@param string $viewMode
@return void | [
"Stores",
"a",
"view",
"mode",
"in",
"the",
"session"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1129-L1140 |
208,303 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.getThumbnailParams | protected function getThumbnailParams($viewMode = null)
{
$result = [
'mode' => 'crop',
'ext' => 'png'
];
if ($viewMode) {
if ($viewMode == self::VIEW_MODE_LIST) {
$result['width'] = 75;
$result['height'] = 75;
... | php | protected function getThumbnailParams($viewMode = null)
{
$result = [
'mode' => 'crop',
'ext' => 'png'
];
if ($viewMode) {
if ($viewMode == self::VIEW_MODE_LIST) {
$result['width'] = 75;
$result['height'] = 75;
... | [
"protected",
"function",
"getThumbnailParams",
"(",
"$",
"viewMode",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"[",
"'mode'",
"=>",
"'crop'",
",",
"'ext'",
"=>",
"'png'",
"]",
";",
"if",
"(",
"$",
"viewMode",
")",
"{",
"if",
"(",
"$",
"viewMode",
"=... | Returns thumbnail parameters
@param string $viewMode
@return array | [
"Returns",
"thumbnail",
"parameters"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1156-L1175 |
208,304 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.getThumbnailImagePath | protected function getThumbnailImagePath($thumbnailParams, $itemPath, $lastModified)
{
$itemSignature = md5($itemPath).$lastModified;
$thumbFile = 'thumb_' .
$itemSignature . '_' .
$thumbnailParams['width'] . 'x' .
$thumbnailParams['height'] . '_' .
$... | php | protected function getThumbnailImagePath($thumbnailParams, $itemPath, $lastModified)
{
$itemSignature = md5($itemPath).$lastModified;
$thumbFile = 'thumb_' .
$itemSignature . '_' .
$thumbnailParams['width'] . 'x' .
$thumbnailParams['height'] . '_' .
$... | [
"protected",
"function",
"getThumbnailImagePath",
"(",
"$",
"thumbnailParams",
",",
"$",
"itemPath",
",",
"$",
"lastModified",
")",
"{",
"$",
"itemSignature",
"=",
"md5",
"(",
"$",
"itemPath",
")",
".",
"$",
"lastModified",
";",
"$",
"thumbFile",
"=",
"'thum... | Generates a thumbnail image path
@param array|null $thumbnailParams
@param string $itemPath
@param int $lastModified
@return string | [
"Generates",
"a",
"thumbnail",
"image",
"path"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1184-L1198 |
208,305 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.thumbnailExists | protected function thumbnailExists($thumbnailParams, $itemPath, $lastModified)
{
$thumbnailPath = $this->getThumbnailImagePath($thumbnailParams, $itemPath, $lastModified);
$fullPath = temp_path(ltrim($thumbnailPath, '/'));
if (File::exists($fullPath)) {
return $thumbnailPath;
... | php | protected function thumbnailExists($thumbnailParams, $itemPath, $lastModified)
{
$thumbnailPath = $this->getThumbnailImagePath($thumbnailParams, $itemPath, $lastModified);
$fullPath = temp_path(ltrim($thumbnailPath, '/'));
if (File::exists($fullPath)) {
return $thumbnailPath;
... | [
"protected",
"function",
"thumbnailExists",
"(",
"$",
"thumbnailParams",
",",
"$",
"itemPath",
",",
"$",
"lastModified",
")",
"{",
"$",
"thumbnailPath",
"=",
"$",
"this",
"->",
"getThumbnailImagePath",
"(",
"$",
"thumbnailParams",
",",
"$",
"itemPath",
",",
"$... | Check if a thumbnail exists
@param array|null $thumbnailParams
@param string $itemPath
@param int $lastModified
@return bool | [
"Check",
"if",
"a",
"thumbnail",
"exists"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1217-L1228 |
208,306 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.thumbnailIsError | protected function thumbnailIsError($thumbnailPath)
{
$fullPath = temp_path(ltrim($thumbnailPath, '/'));
return hash_file('crc32', $fullPath) == $this->getBrokenImageHash();
} | php | protected function thumbnailIsError($thumbnailPath)
{
$fullPath = temp_path(ltrim($thumbnailPath, '/'));
return hash_file('crc32', $fullPath) == $this->getBrokenImageHash();
} | [
"protected",
"function",
"thumbnailIsError",
"(",
"$",
"thumbnailPath",
")",
"{",
"$",
"fullPath",
"=",
"temp_path",
"(",
"ltrim",
"(",
"$",
"thumbnailPath",
",",
"'/'",
")",
")",
";",
"return",
"hash_file",
"(",
"'crc32'",
",",
"$",
"fullPath",
")",
"==",... | Check if a thumbnail has caused an error
@param string $thumbnailPath
@return bool | [
"Check",
"if",
"a",
"thumbnail",
"has",
"caused",
"an",
"error"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1235-L1240 |
208,307 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.getLocalTempFilePath | protected function getLocalTempFilePath($fileName)
{
$fileName = md5($fileName.uniqid().microtime());
$mediaFolder = Config::get('cms.storage.media.folder', 'media');
$path = temp_path() . MediaLibrary::validatePath($mediaFolder, true);
if (!File::isDirectory($path)) {
... | php | protected function getLocalTempFilePath($fileName)
{
$fileName = md5($fileName.uniqid().microtime());
$mediaFolder = Config::get('cms.storage.media.folder', 'media');
$path = temp_path() . MediaLibrary::validatePath($mediaFolder, true);
if (!File::isDirectory($path)) {
... | [
"protected",
"function",
"getLocalTempFilePath",
"(",
"$",
"fileName",
")",
"{",
"$",
"fileName",
"=",
"md5",
"(",
"$",
"fileName",
".",
"uniqid",
"(",
")",
".",
"microtime",
"(",
")",
")",
";",
"$",
"mediaFolder",
"=",
"Config",
"::",
"get",
"(",
"'cm... | Get temporary local file path
@param string $fileName
@return string | [
"Get",
"temporary",
"local",
"file",
"path"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1247-L1260 |
208,308 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.getBrokenImageHash | protected function getBrokenImageHash()
{
if ($this->brokenImageHash) {
return $this->brokenImageHash;
}
$fullPath = $this->getBrokenImagePath();
return $this->brokenImageHash = hash_file('crc32', $fullPath);
} | php | protected function getBrokenImageHash()
{
if ($this->brokenImageHash) {
return $this->brokenImageHash;
}
$fullPath = $this->getBrokenImagePath();
return $this->brokenImageHash = hash_file('crc32', $fullPath);
} | [
"protected",
"function",
"getBrokenImageHash",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"brokenImageHash",
")",
"{",
"return",
"$",
"this",
"->",
"brokenImageHash",
";",
"}",
"$",
"fullPath",
"=",
"$",
"this",
"->",
"getBrokenImagePath",
"(",
")",
";",... | Returns a CRC32 hash for a broken image
@return string | [
"Returns",
"a",
"CRC32",
"hash",
"for",
"a",
"broken",
"image"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1415-L1424 |
208,309 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.copyBrokenImage | protected function copyBrokenImage($path)
{
try {
$thumbnailDir = dirname($path);
if (!File::isDirectory($thumbnailDir) && File::makeDirectory($thumbnailDir, 0777, true) === false) {
return;
}
File::copy($this->getBrokenImagePath(), $path);
... | php | protected function copyBrokenImage($path)
{
try {
$thumbnailDir = dirname($path);
if (!File::isDirectory($thumbnailDir) && File::makeDirectory($thumbnailDir, 0777, true) === false) {
return;
}
File::copy($this->getBrokenImagePath(), $path);
... | [
"protected",
"function",
"copyBrokenImage",
"(",
"$",
"path",
")",
"{",
"try",
"{",
"$",
"thumbnailDir",
"=",
"dirname",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"File",
"::",
"isDirectory",
"(",
"$",
"thumbnailDir",
")",
"&&",
"File",
"::",
"makeDi... | Copy broken image to destination
@param string $path
@return void | [
"Copy",
"broken",
"image",
"to",
"destination"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1431-L1444 |
208,310 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.getTargetDimensions | protected function getTargetDimensions($width, $height, $originalImagePath)
{
$originalDimensions = [$width, $height];
try {
$dimensions = getimagesize($originalImagePath);
if (!$dimensions) {
return $originalDimensions;
}
if ($dimens... | php | protected function getTargetDimensions($width, $height, $originalImagePath)
{
$originalDimensions = [$width, $height];
try {
$dimensions = getimagesize($originalImagePath);
if (!$dimensions) {
return $originalDimensions;
}
if ($dimens... | [
"protected",
"function",
"getTargetDimensions",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"originalImagePath",
")",
"{",
"$",
"originalDimensions",
"=",
"[",
"$",
"width",
",",
"$",
"height",
"]",
";",
"try",
"{",
"$",
"dimensions",
"=",
"getimagesi... | Get target dimensions
@param int $width
@param int $height
@param string $originalImagePath
@return void | [
"Get",
"target",
"dimensions"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1453-L1472 |
208,311 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.checkUploadPostback | protected function checkUploadPostback()
{
if ($this->readOnly) {
return;
}
$fileName = null;
$quickMode = false;
if (
(!($uniqueId = Request::header('X-OCTOBER-FILEUPLOAD')) || $uniqueId != $this->getId()) &&
(!$quickMode = post('X_OCTOB... | php | protected function checkUploadPostback()
{
if ($this->readOnly) {
return;
}
$fileName = null;
$quickMode = false;
if (
(!($uniqueId = Request::header('X-OCTOBER-FILEUPLOAD')) || $uniqueId != $this->getId()) &&
(!$quickMode = post('X_OCTOB... | [
"protected",
"function",
"checkUploadPostback",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"readOnly",
")",
"{",
"return",
";",
"}",
"$",
"fileName",
"=",
"null",
";",
"$",
"quickMode",
"=",
"false",
";",
"if",
"(",
"(",
"!",
"(",
"$",
"uniqueId",
... | Detect the upload post flag
@return void | [
"Detect",
"the",
"upload",
"post",
"flag"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1478-L1576 |
208,312 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.validateFileName | protected function validateFileName($name)
{
if (!preg_match('/^[\w@\.\s_\-]+$/iu', $name)) {
return false;
}
if (strpos($name, '..') !== false) {
return false;
}
return true;
} | php | protected function validateFileName($name)
{
if (!preg_match('/^[\w@\.\s_\-]+$/iu', $name)) {
return false;
}
if (strpos($name, '..') !== false) {
return false;
}
return true;
} | [
"protected",
"function",
"validateFileName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/^[\\w@\\.\\s_\\-]+$/iu'",
",",
"$",
"name",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"name",
",",
"'..'",
"... | Validate a proposed media item file name.
@param string
@return bool | [
"Validate",
"a",
"proposed",
"media",
"item",
"file",
"name",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1583-L1594 |
208,313 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.getCropEditImageUrlAndSize | protected function getCropEditImageUrlAndSize($path, $cropSessionKey, $params = null)
{
$sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey);
$fullSessionDirectoryPath = temp_path($sessionDirectoryPath);
$sessionDirectoryCreated = false;
if (!File::isDirectory($full... | php | protected function getCropEditImageUrlAndSize($path, $cropSessionKey, $params = null)
{
$sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey);
$fullSessionDirectoryPath = temp_path($sessionDirectoryPath);
$sessionDirectoryCreated = false;
if (!File::isDirectory($full... | [
"protected",
"function",
"getCropEditImageUrlAndSize",
"(",
"$",
"path",
",",
"$",
"cropSessionKey",
",",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"sessionDirectoryPath",
"=",
"$",
"this",
"->",
"getCropSessionDirPath",
"(",
"$",
"cropSessionKey",
")",
";",
... | Prepares an image for cropping and returns payload containing a URL
@param string $path
@param string $cropSessionKey
@param array $params
@return array | [
"Prepares",
"an",
"image",
"for",
"cropping",
"and",
"returns",
"payload",
"containing",
"a",
"URL"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1658-L1734 |
208,314 | octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.removeCropEditDir | protected function removeCropEditDir($cropSessionKey)
{
$sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey);
$fullSessionDirectoryPath = temp_path($sessionDirectoryPath);
if (File::isDirectory($fullSessionDirectoryPath)) {
@File::deleteDirectory($fullSessionDir... | php | protected function removeCropEditDir($cropSessionKey)
{
$sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey);
$fullSessionDirectoryPath = temp_path($sessionDirectoryPath);
if (File::isDirectory($fullSessionDirectoryPath)) {
@File::deleteDirectory($fullSessionDir... | [
"protected",
"function",
"removeCropEditDir",
"(",
"$",
"cropSessionKey",
")",
"{",
"$",
"sessionDirectoryPath",
"=",
"$",
"this",
"->",
"getCropSessionDirPath",
"(",
"$",
"cropSessionKey",
")",
";",
"$",
"fullSessionDirectoryPath",
"=",
"temp_path",
"(",
"$",
"se... | Cleans up the directory used for cropping based on the session key
@param string $cropSessionKey
@return void | [
"Cleans",
"up",
"the",
"directory",
"used",
"for",
"cropping",
"based",
"on",
"the",
"session",
"key"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1741-L1749 |
208,315 | octobercms/october | modules/system/models/MailTemplate.php | MailTemplate.listAllTemplates | public static function listAllTemplates()
{
$fileTemplates = (array) MailManager::instance()->listRegisteredTemplates();
$dbTemplates = (array) self::lists('code', 'code');
$templates = $fileTemplates + $dbTemplates;
ksort($templates);
return $templates;
} | php | public static function listAllTemplates()
{
$fileTemplates = (array) MailManager::instance()->listRegisteredTemplates();
$dbTemplates = (array) self::lists('code', 'code');
$templates = $fileTemplates + $dbTemplates;
ksort($templates);
return $templates;
} | [
"public",
"static",
"function",
"listAllTemplates",
"(",
")",
"{",
"$",
"fileTemplates",
"=",
"(",
"array",
")",
"MailManager",
"::",
"instance",
"(",
")",
"->",
"listRegisteredTemplates",
"(",
")",
";",
"$",
"dbTemplates",
"=",
"(",
"array",
")",
"self",
... | Returns an array of template codes and descriptions.
@return array | [
"Returns",
"an",
"array",
"of",
"template",
"codes",
"and",
"descriptions",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/MailTemplate.php#L52-L59 |
208,316 | octobercms/october | modules/system/models/MailTemplate.php | MailTemplate.allTemplates | public static function allTemplates()
{
$result = [];
$codes = array_keys(self::listAllTemplates());
foreach ($codes as $code) {
$result[] = self::findOrMakeTemplate($code);
}
return $result;
} | php | public static function allTemplates()
{
$result = [];
$codes = array_keys(self::listAllTemplates());
foreach ($codes as $code) {
$result[] = self::findOrMakeTemplate($code);
}
return $result;
} | [
"public",
"static",
"function",
"allTemplates",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"codes",
"=",
"array_keys",
"(",
"self",
"::",
"listAllTemplates",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"codes",
"as",
"$",
"code",
")",
"{",
... | Returns a list of all mail templates.
@return array Returns an array of the MailTemplate objects. | [
"Returns",
"a",
"list",
"of",
"all",
"mail",
"templates",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/MailTemplate.php#L65-L75 |
208,317 | octobercms/october | modules/system/models/MailTemplate.php | MailTemplate.syncAll | public static function syncAll()
{
MailLayout::createLayouts();
MailPartial::createPartials();
$templates = MailManager::instance()->listRegisteredTemplates();
$dbTemplates = self::lists('is_custom', 'code');
$newTemplates = array_diff_key($templates, $dbTemplates);
... | php | public static function syncAll()
{
MailLayout::createLayouts();
MailPartial::createPartials();
$templates = MailManager::instance()->listRegisteredTemplates();
$dbTemplates = self::lists('is_custom', 'code');
$newTemplates = array_diff_key($templates, $dbTemplates);
... | [
"public",
"static",
"function",
"syncAll",
"(",
")",
"{",
"MailLayout",
"::",
"createLayouts",
"(",
")",
";",
"MailPartial",
"::",
"createPartials",
"(",
")",
";",
"$",
"templates",
"=",
"MailManager",
"::",
"instance",
"(",
")",
"->",
"listRegisteredTemplates... | Syncronise all file templates to the database.
@return void | [
"Syncronise",
"all",
"file",
"templates",
"to",
"the",
"database",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/MailTemplate.php#L81-L118 |
208,318 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getRecords | protected function getRecords()
{
$query = $this->prepareQuery();
if ($this->showTree) {
$records = $query->getNested();
}
elseif ($this->showPagination) {
$method = $this->showPageNumbers ? 'paginate' : 'simplePaginate';
$currentPageNu... | php | protected function getRecords()
{
$query = $this->prepareQuery();
if ($this->showTree) {
$records = $query->getNested();
}
elseif ($this->showPagination) {
$method = $this->showPageNumbers ? 'paginate' : 'simplePaginate';
$currentPageNu... | [
"protected",
"function",
"getRecords",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"prepareQuery",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"showTree",
")",
"{",
"$",
"records",
"=",
"$",
"query",
"->",
"getNested",
"(",
")",
";",
"}",... | Returns all the records from the supplied model, after filtering.
@return Collection | [
"Returns",
"all",
"the",
"records",
"from",
"the",
"supplied",
"model",
"after",
"filtering",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L579-L619 |
208,319 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getCurrentPageNumber | protected function getCurrentPageNumber($query)
{
$currentPageNumber = $this->currentPageNumber;
if (!$currentPageNumber && empty($this->searchTerm)) {
// Restore the last visited page from the session if available.
$currentPageNumber = $this->getSession('lastVisitedPage');
... | php | protected function getCurrentPageNumber($query)
{
$currentPageNumber = $this->currentPageNumber;
if (!$currentPageNumber && empty($this->searchTerm)) {
// Restore the last visited page from the session if available.
$currentPageNumber = $this->getSession('lastVisitedPage');
... | [
"protected",
"function",
"getCurrentPageNumber",
"(",
"$",
"query",
")",
"{",
"$",
"currentPageNumber",
"=",
"$",
"this",
"->",
"currentPageNumber",
";",
"if",
"(",
"!",
"$",
"currentPageNumber",
"&&",
"empty",
"(",
"$",
"this",
"->",
"searchTerm",
")",
")",... | Returns the current page number for the list.
This will override the current page number provided by the user if it is past the last page of available records.
@param object $query
@return int | [
"Returns",
"the",
"current",
"page",
"number",
"for",
"the",
"list",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L629-L650 |
208,320 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getRecordUrl | public function getRecordUrl($record)
{
if (isset($this->recordOnClick)) {
return 'javascript:;';
}
if (!isset($this->recordUrl)) {
return null;
}
$url = RouterHelper::replaceParameters($record, $this->recordUrl);
return Backend::url($url);
... | php | public function getRecordUrl($record)
{
if (isset($this->recordOnClick)) {
return 'javascript:;';
}
if (!isset($this->recordUrl)) {
return null;
}
$url = RouterHelper::replaceParameters($record, $this->recordUrl);
return Backend::url($url);
... | [
"public",
"function",
"getRecordUrl",
"(",
"$",
"record",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"recordOnClick",
")",
")",
"{",
"return",
"'javascript:;'",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"recordUrl",
")",
"... | Returns the record URL address for a list row.
@param Model $record
@return string | [
"Returns",
"the",
"record",
"URL",
"address",
"for",
"a",
"list",
"row",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L657-L669 |
208,321 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getRecordOnClick | public function getRecordOnClick($record)
{
if (!isset($this->recordOnClick)) {
return null;
}
$recordOnClick = RouterHelper::replaceParameters($record, $this->recordOnClick);
return Html::attributes(['onclick' => $recordOnClick]);
} | php | public function getRecordOnClick($record)
{
if (!isset($this->recordOnClick)) {
return null;
}
$recordOnClick = RouterHelper::replaceParameters($record, $this->recordOnClick);
return Html::attributes(['onclick' => $recordOnClick]);
} | [
"public",
"function",
"getRecordOnClick",
"(",
"$",
"record",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"recordOnClick",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"recordOnClick",
"=",
"RouterHelper",
"::",
"replaceParameters",
"(",
... | Returns the onclick event for a list row.
@param Model $record
@return string | [
"Returns",
"the",
"onclick",
"event",
"for",
"a",
"list",
"row",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L676-L684 |
208,322 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getVisibleColumns | public function getVisibleColumns()
{
$definitions = $this->defineListColumns();
$columns = [];
/*
* Supplied column list
*/
if ($this->columnOverride === null) {
$this->columnOverride = $this->getSession('visible', null);
}
if ($this->... | php | public function getVisibleColumns()
{
$definitions = $this->defineListColumns();
$columns = [];
/*
* Supplied column list
*/
if ($this->columnOverride === null) {
$this->columnOverride = $this->getSession('visible', null);
}
if ($this->... | [
"public",
"function",
"getVisibleColumns",
"(",
")",
"{",
"$",
"definitions",
"=",
"$",
"this",
"->",
"defineListColumns",
"(",
")",
";",
"$",
"columns",
"=",
"[",
"]",
";",
"/*\n * Supplied column list\n */",
"if",
"(",
"$",
"this",
"->",
"col... | Returns the list columns that are visible by list settings or default | [
"Returns",
"the",
"list",
"columns",
"that",
"are",
"visible",
"by",
"list",
"settings",
"or",
"default"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L708-L750 |
208,323 | octobercms/october | modules/backend/widgets/Lists.php | Lists.defineListColumns | protected function defineListColumns()
{
if (!isset($this->columns) || !is_array($this->columns) || !count($this->columns)) {
$class = get_class($this->model instanceof Model ? $this->model : $this->controller);
throw new ApplicationException(Lang::get('backend::lang.list.missing_col... | php | protected function defineListColumns()
{
if (!isset($this->columns) || !is_array($this->columns) || !count($this->columns)) {
$class = get_class($this->model instanceof Model ? $this->model : $this->controller);
throw new ApplicationException(Lang::get('backend::lang.list.missing_col... | [
"protected",
"function",
"defineListColumns",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"columns",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"columns",
")",
"||",
"!",
"count",
"(",
"$",
"this",
"->",
"columns",
")",
... | Builds an array of list columns with keys as the column name and values as a ListColumn object. | [
"Builds",
"an",
"array",
"of",
"list",
"columns",
"with",
"keys",
"as",
"the",
"column",
"name",
"and",
"values",
"as",
"a",
"ListColumn",
"object",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L755-L834 |
208,324 | octobercms/october | modules/backend/widgets/Lists.php | Lists.addColumns | public function addColumns(array $columns)
{
/*
* Build a final collection of list column objects
*/
foreach ($columns as $columnName => $config) {
$this->allColumns[$columnName] = $this->makeListColumn($columnName, $config);
}
} | php | public function addColumns(array $columns)
{
/*
* Build a final collection of list column objects
*/
foreach ($columns as $columnName => $config) {
$this->allColumns[$columnName] = $this->makeListColumn($columnName, $config);
}
} | [
"public",
"function",
"addColumns",
"(",
"array",
"$",
"columns",
")",
"{",
"/*\n * Build a final collection of list column objects\n */",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"columnName",
"=>",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"all... | Programatically add columns, used internally and for extensibility.
@param array $columns Column definitions | [
"Programatically",
"add",
"columns",
"used",
"internally",
"and",
"for",
"extensibility",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L840-L848 |
208,325 | octobercms/october | modules/backend/widgets/Lists.php | Lists.makeListColumn | protected function makeListColumn($name, $config)
{
if (is_string($config)) {
$label = $config;
}
elseif (isset($config['label'])) {
$label = $config['label'];
}
else {
$label = studly_case($name);
}
/*
* Auto conf... | php | protected function makeListColumn($name, $config)
{
if (is_string($config)) {
$label = $config;
}
elseif (isset($config['label'])) {
$label = $config['label'];
}
else {
$label = studly_case($name);
}
/*
* Auto conf... | [
"protected",
"function",
"makeListColumn",
"(",
"$",
"name",
",",
"$",
"config",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"config",
")",
")",
"{",
"$",
"label",
"=",
"$",
"config",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"config",
"[",
"'lab... | Creates a list column object from it's name and configuration. | [
"Creates",
"a",
"list",
"column",
"object",
"from",
"it",
"s",
"name",
"and",
"configuration",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L864-L907 |
208,326 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getTotalColumns | protected function getTotalColumns()
{
$columns = $this->visibleColumns ?: $this->getVisibleColumns();
$total = count($columns);
if ($this->showCheckboxes) {
$total++;
}
if ($this->showSetup) {
$total++;
}
return $total;
} | php | protected function getTotalColumns()
{
$columns = $this->visibleColumns ?: $this->getVisibleColumns();
$total = count($columns);
if ($this->showCheckboxes) {
$total++;
}
if ($this->showSetup) {
$total++;
}
return $total;
} | [
"protected",
"function",
"getTotalColumns",
"(",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"visibleColumns",
"?",
":",
"$",
"this",
"->",
"getVisibleColumns",
"(",
")",
";",
"$",
"total",
"=",
"count",
"(",
"$",
"columns",
")",
";",
"if",
"(",
... | Calculates the total columns used in the list, including checkboxes
and other additions. | [
"Calculates",
"the",
"total",
"columns",
"used",
"in",
"the",
"list",
"including",
"checkboxes",
"and",
"other",
"additions",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L913-L927 |
208,327 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getHeaderValue | public function getHeaderValue($column)
{
$value = Lang::get($column->label);
/**
* @event backend.list.overrideHeaderValue
* Overrides the column header value in a list widget.
*
* If a value is returned from this event, it will be used as the value for the prov... | php | public function getHeaderValue($column)
{
$value = Lang::get($column->label);
/**
* @event backend.list.overrideHeaderValue
* Overrides the column header value in a list widget.
*
* If a value is returned from this event, it will be used as the value for the prov... | [
"public",
"function",
"getHeaderValue",
"(",
"$",
"column",
")",
"{",
"$",
"value",
"=",
"Lang",
"::",
"get",
"(",
"$",
"column",
"->",
"label",
")",
";",
"/**\n * @event backend.list.overrideHeaderValue\n * Overrides the column header value in a list widget... | Looks up the column header | [
"Looks",
"up",
"the",
"column",
"header"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L932-L959 |
208,328 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getColumnValueRaw | public function getColumnValueRaw($record, $column)
{
$columnName = $column->columnName;
/*
* Handle taking value from model relation.
*/
if ($column->valueFrom && $column->relation) {
$columnName = $column->relation;
if (!array_key_exists($columnN... | php | public function getColumnValueRaw($record, $column)
{
$columnName = $column->columnName;
/*
* Handle taking value from model relation.
*/
if ($column->valueFrom && $column->relation) {
$columnName = $column->relation;
if (!array_key_exists($columnN... | [
"public",
"function",
"getColumnValueRaw",
"(",
"$",
"record",
",",
"$",
"column",
")",
"{",
"$",
"columnName",
"=",
"$",
"column",
"->",
"columnName",
";",
"/*\n * Handle taking value from model relation.\n */",
"if",
"(",
"$",
"column",
"->",
"valu... | Returns a raw column value
@return string | [
"Returns",
"a",
"raw",
"column",
"value"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L965-L1035 |
208,329 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getColumnValue | public function getColumnValue($record, $column)
{
$value = $this->getColumnValueRaw($record, $column);
if (method_exists($this, 'eval'. studly_case($column->type) .'TypeValue')) {
$value = $this->{'eval'. studly_case($column->type) .'TypeValue'}($record, $column, $value);
}
... | php | public function getColumnValue($record, $column)
{
$value = $this->getColumnValueRaw($record, $column);
if (method_exists($this, 'eval'. studly_case($column->type) .'TypeValue')) {
$value = $this->{'eval'. studly_case($column->type) .'TypeValue'}($record, $column, $value);
}
... | [
"public",
"function",
"getColumnValue",
"(",
"$",
"record",
",",
"$",
"column",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getColumnValueRaw",
"(",
"$",
"record",
",",
"$",
"column",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
... | Returns a column value, with filters applied
@return string | [
"Returns",
"a",
"column",
"value",
"with",
"filters",
"applied"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1041-L1082 |
208,330 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getRowClass | public function getRowClass($record)
{
$value = '';
/**
* @event backend.list.injectRowClass
* Provides opportunity to inject a custom CSS row class
*
* If a value is returned from this event, it will be used as the value for the row class.
* `$value` is... | php | public function getRowClass($record)
{
$value = '';
/**
* @event backend.list.injectRowClass
* Provides opportunity to inject a custom CSS row class
*
* If a value is returned from this event, it will be used as the value for the row class.
* `$value` is... | [
"public",
"function",
"getRowClass",
"(",
"$",
"record",
")",
"{",
"$",
"value",
"=",
"''",
";",
"/**\n * @event backend.list.injectRowClass\n * Provides opportunity to inject a custom CSS row class\n *\n * If a value is returned from this event, it will be ... | Adds a custom CSS class string to a record row
@param Model $record Populated model
@return string | [
"Adds",
"a",
"custom",
"CSS",
"class",
"string",
"to",
"a",
"record",
"row"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1089-L1116 |
208,331 | octobercms/october | modules/backend/widgets/Lists.php | Lists.evalCustomListType | protected function evalCustomListType($type, $record, $column, $value)
{
$plugins = PluginManager::instance()->getRegistrationMethodValues('registerListColumnTypes');
foreach ($plugins as $availableTypes) {
if (!isset($availableTypes[$type])) {
continue;
}
... | php | protected function evalCustomListType($type, $record, $column, $value)
{
$plugins = PluginManager::instance()->getRegistrationMethodValues('registerListColumnTypes');
foreach ($plugins as $availableTypes) {
if (!isset($availableTypes[$type])) {
continue;
}
... | [
"protected",
"function",
"evalCustomListType",
"(",
"$",
"type",
",",
"$",
"record",
",",
"$",
"column",
",",
"$",
"value",
")",
"{",
"$",
"plugins",
"=",
"PluginManager",
"::",
"instance",
"(",
")",
"->",
"getRegistrationMethodValues",
"(",
"'registerListColu... | Process a custom list types registered by plugins. | [
"Process",
"a",
"custom",
"list",
"types",
"registered",
"by",
"plugins",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1125-L1142 |
208,332 | octobercms/october | modules/backend/widgets/Lists.php | Lists.evalTextTypeValue | protected function evalTextTypeValue($record, $column, $value)
{
if (is_array($value) && count($value) == count($value, COUNT_RECURSIVE)) {
$value = implode(', ', $value);
}
if (is_string($column->format) && !empty($column->format)) {
$value = sprintf($column->format... | php | protected function evalTextTypeValue($record, $column, $value)
{
if (is_array($value) && count($value) == count($value, COUNT_RECURSIVE)) {
$value = implode(', ', $value);
}
if (is_string($column->format) && !empty($column->format)) {
$value = sprintf($column->format... | [
"protected",
"function",
"evalTextTypeValue",
"(",
"$",
"record",
",",
"$",
"column",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"&&",
"count",
"(",
"$",
"value",
")",
"==",
"count",
"(",
"$",
"value",
",",
"COUNT_REC... | Process as text, escape the value | [
"Process",
"as",
"text",
"escape",
"the",
"value"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1147-L1158 |
208,333 | octobercms/october | modules/backend/widgets/Lists.php | Lists.evalRelationTypeValue | protected function evalRelationTypeValue($record, $column, $value)
{
traceLog(sprintf('Warning: List column type "relation" for class "%s" is not valid.', get_class($record)));
return $this->evalTextTypeValue($record, $column, $value);
} | php | protected function evalRelationTypeValue($record, $column, $value)
{
traceLog(sprintf('Warning: List column type "relation" for class "%s" is not valid.', get_class($record)));
return $this->evalTextTypeValue($record, $column, $value);
} | [
"protected",
"function",
"evalRelationTypeValue",
"(",
"$",
"record",
",",
"$",
"column",
",",
"$",
"value",
")",
"{",
"traceLog",
"(",
"sprintf",
"(",
"'Warning: List column type \"relation\" for class \"%s\" is not valid.'",
",",
"get_class",
"(",
"$",
"record",
")"... | Common mistake, relation is not a valid list column.
@deprecated Remove if year >= 2018 | [
"Common",
"mistake",
"relation",
"is",
"not",
"a",
"valid",
"list",
"column",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1172-L1176 |
208,334 | octobercms/october | modules/backend/widgets/Lists.php | Lists.evalPartialTypeValue | protected function evalPartialTypeValue($record, $column, $value)
{
return $this->controller->makePartial($column->path ?: $column->columnName, [
'listColumn' => $column,
'listRecord' => $record,
'listValue' => $value,
'column' => $column,
're... | php | protected function evalPartialTypeValue($record, $column, $value)
{
return $this->controller->makePartial($column->path ?: $column->columnName, [
'listColumn' => $column,
'listRecord' => $record,
'listValue' => $value,
'column' => $column,
're... | [
"protected",
"function",
"evalPartialTypeValue",
"(",
"$",
"record",
",",
"$",
"column",
",",
"$",
"value",
")",
"{",
"return",
"$",
"this",
"->",
"controller",
"->",
"makePartial",
"(",
"$",
"column",
"->",
"path",
"?",
":",
"$",
"column",
"->",
"column... | Process as partial reference | [
"Process",
"as",
"partial",
"reference"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1181-L1191 |
208,335 | octobercms/october | modules/backend/widgets/Lists.php | Lists.evalSwitchTypeValue | protected function evalSwitchTypeValue($record, $column, $value)
{
$contents = '';
if ($value) {
$contents = Lang::get('backend::lang.list.column_switch_true');
}
else {
$contents = Lang::get('backend::lang.list.column_switch_false');
}
retur... | php | protected function evalSwitchTypeValue($record, $column, $value)
{
$contents = '';
if ($value) {
$contents = Lang::get('backend::lang.list.column_switch_true');
}
else {
$contents = Lang::get('backend::lang.list.column_switch_false');
}
retur... | [
"protected",
"function",
"evalSwitchTypeValue",
"(",
"$",
"record",
",",
"$",
"column",
",",
"$",
"value",
")",
"{",
"$",
"contents",
"=",
"''",
";",
"if",
"(",
"$",
"value",
")",
"{",
"$",
"contents",
"=",
"Lang",
"::",
"get",
"(",
"'backend::lang.lis... | Process as boolean switch | [
"Process",
"as",
"boolean",
"switch"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1196-L1208 |
208,336 | octobercms/october | modules/backend/widgets/Lists.php | Lists.evalDatetimeTypeValue | protected function evalDatetimeTypeValue($record, $column, $value)
{
if ($value === null) {
return null;
}
$dateTime = $this->validateDateTimeValue($value, $column);
if ($column->format !== null) {
$value = $dateTime->format($column->format);
}
... | php | protected function evalDatetimeTypeValue($record, $column, $value)
{
if ($value === null) {
return null;
}
$dateTime = $this->validateDateTimeValue($value, $column);
if ($column->format !== null) {
$value = $dateTime->format($column->format);
}
... | [
"protected",
"function",
"evalDatetimeTypeValue",
"(",
"$",
"record",
",",
"$",
"column",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"$",
"dateTime",
"=",
"$",
"this",
"->",
"validateDateT... | Process as a datetime value | [
"Process",
"as",
"a",
"datetime",
"value"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1213-L1239 |
208,337 | octobercms/october | modules/backend/widgets/Lists.php | Lists.validateDateTimeValue | protected function validateDateTimeValue($value, $column)
{
$value = DateTimeHelper::makeCarbon($value, false);
if (!$value instanceof Carbon) {
throw new ApplicationException(Lang::get(
'backend::lang.list.invalid_column_datetime',
['column' => $column->... | php | protected function validateDateTimeValue($value, $column)
{
$value = DateTimeHelper::makeCarbon($value, false);
if (!$value instanceof Carbon) {
throw new ApplicationException(Lang::get(
'backend::lang.list.invalid_column_datetime',
['column' => $column->... | [
"protected",
"function",
"validateDateTimeValue",
"(",
"$",
"value",
",",
"$",
"column",
")",
"{",
"$",
"value",
"=",
"DateTimeHelper",
"::",
"makeCarbon",
"(",
"$",
"value",
",",
"false",
")",
";",
"if",
"(",
"!",
"$",
"value",
"instanceof",
"Carbon",
"... | Validates a column type as a date | [
"Validates",
"a",
"column",
"type",
"as",
"a",
"date"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1359-L1371 |
208,338 | octobercms/october | modules/backend/widgets/Lists.php | Lists.setSearchTerm | public function setSearchTerm($term)
{
if (!empty($term)) {
$this->showTree = false;
}
$this->searchTerm = $term;
} | php | public function setSearchTerm($term)
{
if (!empty($term)) {
$this->showTree = false;
}
$this->searchTerm = $term;
} | [
"public",
"function",
"setSearchTerm",
"(",
"$",
"term",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"term",
")",
")",
"{",
"$",
"this",
"->",
"showTree",
"=",
"false",
";",
"}",
"$",
"this",
"->",
"searchTerm",
"=",
"$",
"term",
";",
"}"
] | Applies a search term to the list results, searching will disable tree
view if a value is supplied.
@param string $term | [
"Applies",
"a",
"search",
"term",
"to",
"the",
"list",
"results",
"searching",
"will",
"disable",
"tree",
"view",
"if",
"a",
"value",
"is",
"supplied",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1391-L1398 |
208,339 | octobercms/october | modules/backend/widgets/Lists.php | Lists.setSearchOptions | public function setSearchOptions($options = [])
{
extract(array_merge([
'mode' => null,
'scope' => null
], $options));
$this->searchMode = $mode;
$this->searchScope = $scope;
} | php | public function setSearchOptions($options = [])
{
extract(array_merge([
'mode' => null,
'scope' => null
], $options));
$this->searchMode = $mode;
$this->searchScope = $scope;
} | [
"public",
"function",
"setSearchOptions",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"extract",
"(",
"array_merge",
"(",
"[",
"'mode'",
"=>",
"null",
",",
"'scope'",
"=>",
"null",
"]",
",",
"$",
"options",
")",
")",
";",
"$",
"this",
"->",
"search... | Applies a search options to the list search.
@param array $options | [
"Applies",
"a",
"search",
"options",
"to",
"the",
"list",
"search",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1404-L1413 |
208,340 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getSearchableColumns | protected function getSearchableColumns()
{
$columns = $this->getColumns();
$searchable = [];
foreach ($columns as $column) {
if (!$column->searchable) {
continue;
}
$searchable[] = $column;
}
return $searchable;
} | php | protected function getSearchableColumns()
{
$columns = $this->getColumns();
$searchable = [];
foreach ($columns as $column) {
if (!$column->searchable) {
continue;
}
$searchable[] = $column;
}
return $searchable;
} | [
"protected",
"function",
"getSearchableColumns",
"(",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"getColumns",
"(",
")",
";",
"$",
"searchable",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"column",
")",
"{",
"if",
"(",
"!",... | Returns a collection of columns which can be searched.
@return array | [
"Returns",
"a",
"collection",
"of",
"columns",
"which",
"can",
"be",
"searched",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1419-L1433 |
208,341 | octobercms/october | modules/backend/widgets/Lists.php | Lists.applySearchToQuery | protected function applySearchToQuery($query, $columns, $boolean = 'and')
{
$term = $this->searchTerm;
if ($scopeMethod = $this->searchScope) {
$searchMethod = $boolean == 'and' ? 'where' : 'orWhere';
$query->$searchMethod(function ($q) use ($term, $columns, $scopeMethod) {
... | php | protected function applySearchToQuery($query, $columns, $boolean = 'and')
{
$term = $this->searchTerm;
if ($scopeMethod = $this->searchScope) {
$searchMethod = $boolean == 'and' ? 'where' : 'orWhere';
$query->$searchMethod(function ($q) use ($term, $columns, $scopeMethod) {
... | [
"protected",
"function",
"applySearchToQuery",
"(",
"$",
"query",
",",
"$",
"columns",
",",
"$",
"boolean",
"=",
"'and'",
")",
"{",
"$",
"term",
"=",
"$",
"this",
"->",
"searchTerm",
";",
"if",
"(",
"$",
"scopeMethod",
"=",
"$",
"this",
"->",
"searchSc... | Applies the search constraint to a query. | [
"Applies",
"the",
"search",
"constraint",
"to",
"a",
"query",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1438-L1452 |
208,342 | octobercms/october | modules/backend/widgets/Lists.php | Lists.onSort | public function onSort()
{
if ($column = post('sortColumn')) {
/*
* Toggle the sort direction and set the sorting column
*/
$sortOptions = ['column' => $this->getSortColumn(), 'direction' => $this->sortDirection];
if ($column != $sortOptions['c... | php | public function onSort()
{
if ($column = post('sortColumn')) {
/*
* Toggle the sort direction and set the sorting column
*/
$sortOptions = ['column' => $this->getSortColumn(), 'direction' => $this->sortDirection];
if ($column != $sortOptions['c... | [
"public",
"function",
"onSort",
"(",
")",
"{",
"if",
"(",
"$",
"column",
"=",
"post",
"(",
"'sortColumn'",
")",
")",
"{",
"/*\n * Toggle the sort direction and set the sorting column\n */",
"$",
"sortOptions",
"=",
"[",
"'column'",
"=>",
"$",
... | Event handler for sorting the list. | [
"Event",
"handler",
"for",
"sorting",
"the",
"list",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1461-L1488 |
208,343 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getSortColumn | protected function getSortColumn()
{
if (!$this->isSortable()) {
return false;
}
if ($this->sortColumn !== null) {
return $this->sortColumn;
}
/*
* User preference
*/
if ($this->showSorting && ($sortOptions = $this->getSessi... | php | protected function getSortColumn()
{
if (!$this->isSortable()) {
return false;
}
if ($this->sortColumn !== null) {
return $this->sortColumn;
}
/*
* User preference
*/
if ($this->showSorting && ($sortOptions = $this->getSessi... | [
"protected",
"function",
"getSortColumn",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isSortable",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"sortColumn",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"... | Returns the current sorting column, saved in a session or cached. | [
"Returns",
"the",
"current",
"sorting",
"column",
"saved",
"in",
"a",
"session",
"or",
"cached",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1493-L1536 |
208,344 | octobercms/october | modules/backend/widgets/Lists.php | Lists.isSortable | protected function isSortable($column = null)
{
if ($column === null) {
return (count($this->getSortableColumns()) > 0);
}
return array_key_exists($column, $this->getSortableColumns());
} | php | protected function isSortable($column = null)
{
if ($column === null) {
return (count($this->getSortableColumns()) > 0);
}
return array_key_exists($column, $this->getSortableColumns());
} | [
"protected",
"function",
"isSortable",
"(",
"$",
"column",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"column",
"===",
"null",
")",
"{",
"return",
"(",
"count",
"(",
"$",
"this",
"->",
"getSortableColumns",
"(",
")",
")",
">",
"0",
")",
";",
"}",
"retu... | Returns true if the column can be sorted. | [
"Returns",
"true",
"if",
"the",
"column",
"can",
"be",
"sorted",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1541-L1548 |
208,345 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getSortableColumns | protected function getSortableColumns()
{
if ($this->sortableColumns !== null) {
return $this->sortableColumns;
}
$columns = $this->getColumns();
$sortable = array_filter($columns, function ($column) {
return $column->sortable;
});
return $th... | php | protected function getSortableColumns()
{
if ($this->sortableColumns !== null) {
return $this->sortableColumns;
}
$columns = $this->getColumns();
$sortable = array_filter($columns, function ($column) {
return $column->sortable;
});
return $th... | [
"protected",
"function",
"getSortableColumns",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"sortableColumns",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"sortableColumns",
";",
"}",
"$",
"columns",
"=",
"$",
"this",
"->",
"getColumns",
"(",
"... | Returns a collection of columns which are sortable. | [
"Returns",
"a",
"collection",
"of",
"columns",
"which",
"are",
"sortable",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1553-L1565 |
208,346 | octobercms/october | modules/backend/widgets/Lists.php | Lists.onLoadSetup | public function onLoadSetup()
{
$this->vars['columns'] = $this->getSetupListColumns();
$this->vars['perPageOptions'] = $this->getSetupPerPageOptions();
$this->vars['recordsPerPage'] = $this->recordsPerPage;
return $this->makePartial('setup_form');
} | php | public function onLoadSetup()
{
$this->vars['columns'] = $this->getSetupListColumns();
$this->vars['perPageOptions'] = $this->getSetupPerPageOptions();
$this->vars['recordsPerPage'] = $this->recordsPerPage;
return $this->makePartial('setup_form');
} | [
"public",
"function",
"onLoadSetup",
"(",
")",
"{",
"$",
"this",
"->",
"vars",
"[",
"'columns'",
"]",
"=",
"$",
"this",
"->",
"getSetupListColumns",
"(",
")",
";",
"$",
"this",
"->",
"vars",
"[",
"'perPageOptions'",
"]",
"=",
"$",
"this",
"->",
"getSet... | Event handler to display the list set up. | [
"Event",
"handler",
"to",
"display",
"the",
"list",
"set",
"up",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1574-L1580 |
208,347 | octobercms/october | modules/backend/widgets/Lists.php | Lists.onApplySetup | public function onApplySetup()
{
if (($visibleColumns = post('visible_columns')) && is_array($visibleColumns)) {
$this->columnOverride = $visibleColumns;
$this->putSession('visible', $this->columnOverride);
}
$this->recordsPerPage = post('records_per_page', $this->re... | php | public function onApplySetup()
{
if (($visibleColumns = post('visible_columns')) && is_array($visibleColumns)) {
$this->columnOverride = $visibleColumns;
$this->putSession('visible', $this->columnOverride);
}
$this->recordsPerPage = post('records_per_page', $this->re... | [
"public",
"function",
"onApplySetup",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"visibleColumns",
"=",
"post",
"(",
"'visible_columns'",
")",
")",
"&&",
"is_array",
"(",
"$",
"visibleColumns",
")",
")",
"{",
"$",
"this",
"->",
"columnOverride",
"=",
"$",
"visi... | Event handler to apply the list set up. | [
"Event",
"handler",
"to",
"apply",
"the",
"list",
"set",
"up",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1585-L1596 |
208,348 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getSetupPerPageOptions | protected function getSetupPerPageOptions()
{
$perPageOptions = [20, 40, 80, 100, 120];
if (!in_array($this->recordsPerPage, $perPageOptions)) {
$perPageOptions[] = $this->recordsPerPage;
}
sort($perPageOptions);
return $perPageOptions;
} | php | protected function getSetupPerPageOptions()
{
$perPageOptions = [20, 40, 80, 100, 120];
if (!in_array($this->recordsPerPage, $perPageOptions)) {
$perPageOptions[] = $this->recordsPerPage;
}
sort($perPageOptions);
return $perPageOptions;
} | [
"protected",
"function",
"getSetupPerPageOptions",
"(",
")",
"{",
"$",
"perPageOptions",
"=",
"[",
"20",
",",
"40",
",",
"80",
",",
"100",
",",
"120",
"]",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"this",
"->",
"recordsPerPage",
",",
"$",
"perPageOpt... | Returns an array of allowable records per page. | [
"Returns",
"an",
"array",
"of",
"allowable",
"records",
"per",
"page",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1601-L1610 |
208,349 | octobercms/october | modules/backend/widgets/Lists.php | Lists.getSetupListColumns | protected function getSetupListColumns()
{
/*
* Force all columns invisible
*/
$columns = $this->defineListColumns();
foreach ($columns as $column) {
$column->invisible = true;
}
return array_merge($columns, $this->getVisibleColumns());
} | php | protected function getSetupListColumns()
{
/*
* Force all columns invisible
*/
$columns = $this->defineListColumns();
foreach ($columns as $column) {
$column->invisible = true;
}
return array_merge($columns, $this->getVisibleColumns());
} | [
"protected",
"function",
"getSetupListColumns",
"(",
")",
"{",
"/*\n * Force all columns invisible\n */",
"$",
"columns",
"=",
"$",
"this",
"->",
"defineListColumns",
"(",
")",
";",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"column",
")",
"{",
"$"... | Returns all the list columns used for list set up. | [
"Returns",
"all",
"the",
"list",
"columns",
"used",
"for",
"list",
"set",
"up",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1615-L1626 |
208,350 | octobercms/october | modules/backend/widgets/Lists.php | Lists.validateTree | public function validateTree()
{
if (!$this->showTree) {
return;
}
$this->showSorting = $this->showPagination = false;
if (!$this->model->methodExists('getChildren')) {
throw new ApplicationException(
'To display list as a tree, the specified... | php | public function validateTree()
{
if (!$this->showTree) {
return;
}
$this->showSorting = $this->showPagination = false;
if (!$this->model->methodExists('getChildren')) {
throw new ApplicationException(
'To display list as a tree, the specified... | [
"public",
"function",
"validateTree",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"showTree",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"showSorting",
"=",
"$",
"this",
"->",
"showPagination",
"=",
"false",
";",
"if",
"(",
"!",
"$",
"t... | Validates the model and settings if showTree is used
@return void | [
"Validates",
"the",
"model",
"and",
"settings",
"if",
"showTree",
"is",
"used"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1636-L1655 |
208,351 | octobercms/october | modules/backend/widgets/Lists.php | Lists.isColumnRelated | protected function isColumnRelated($column, $multi = false)
{
if (!isset($column->relation) || $this->isColumnPivot($column)) {
return false;
}
if (!$this->model->hasRelation($column->relation)) {
throw new ApplicationException(Lang::get(
'backend::la... | php | protected function isColumnRelated($column, $multi = false)
{
if (!isset($column->relation) || $this->isColumnPivot($column)) {
return false;
}
if (!$this->model->hasRelation($column->relation)) {
throw new ApplicationException(Lang::get(
'backend::la... | [
"protected",
"function",
"isColumnRelated",
"(",
"$",
"column",
",",
"$",
"multi",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"column",
"->",
"relation",
")",
"||",
"$",
"this",
"->",
"isColumnPivot",
"(",
"$",
"column",
")",
")",
"{"... | Check if column refers to a relation of the model
@param ListColumn $column List column object
@param boolean $multi If set, returns true only if the relation is a "multiple relation type"
@return boolean | [
"Check",
"if",
"column",
"refers",
"to",
"a",
"relation",
"of",
"the",
"model"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1688-L1716 |
208,352 | octobercms/october | modules/backend/behaviors/ImportExportController.php | ImportExportController.exportFromList | public function exportFromList($definition = null, $options = [])
{
$lists = $this->controller->makeLists();
$widget = $lists[$definition] ?? reset($lists);
/*
* Parse options
*/
$defaultOptions = [
'fileName' => $this->exportFileName,
'del... | php | public function exportFromList($definition = null, $options = [])
{
$lists = $this->controller->makeLists();
$widget = $lists[$definition] ?? reset($lists);
/*
* Parse options
*/
$defaultOptions = [
'fileName' => $this->exportFileName,
'del... | [
"public",
"function",
"exportFromList",
"(",
"$",
"definition",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"lists",
"=",
"$",
"this",
"->",
"controller",
"->",
"makeLists",
"(",
")",
";",
"$",
"widget",
"=",
"$",
"lists",
"[",
... | Outputs the list results as a CSV export.
@param string $definition
@param array $options
@return void | [
"Outputs",
"the",
"list",
"results",
"as",
"a",
"CSV",
"export",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/ImportExportController.php#L589-L649 |
208,353 | octobercms/october | modules/backend/behaviors/ImportExportController.php | ImportExportController.getFormatOptionsFromPost | protected function getFormatOptionsFromPost()
{
$presetMode = post('format_preset');
$options = [
'delimiter' => null,
'enclosure' => null,
'escape' => null,
'encoding' => null
];
if ($presetMode == 'custom') {
$options['d... | php | protected function getFormatOptionsFromPost()
{
$presetMode = post('format_preset');
$options = [
'delimiter' => null,
'enclosure' => null,
'escape' => null,
'encoding' => null
];
if ($presetMode == 'custom') {
$options['d... | [
"protected",
"function",
"getFormatOptionsFromPost",
"(",
")",
"{",
"$",
"presetMode",
"=",
"post",
"(",
"'format_preset'",
")",
";",
"$",
"options",
"=",
"[",
"'delimiter'",
"=>",
"null",
",",
"'enclosure'",
"=>",
"null",
",",
"'escape'",
"=>",
"null",
",",... | Returns the file format options from postback. This method
can be used to define presets.
@return array | [
"Returns",
"the",
"file",
"format",
"options",
"from",
"postback",
".",
"This",
"method",
"can",
"be",
"used",
"to",
"define",
"presets",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/ImportExportController.php#L797-L816 |
208,354 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.findFiles | public function findFiles($searchTerm, $sortBy = 'title', $filter = null)
{
$words = explode(' ', Str::lower($searchTerm));
$result = [];
$findInFolder = function ($folder) use (&$findInFolder, $words, &$result, $sortBy, $filter) {
$folderContents = $this->listFolderContents($fo... | php | public function findFiles($searchTerm, $sortBy = 'title', $filter = null)
{
$words = explode(' ', Str::lower($searchTerm));
$result = [];
$findInFolder = function ($folder) use (&$findInFolder, $words, &$result, $sortBy, $filter) {
$folderContents = $this->listFolderContents($fo... | [
"public",
"function",
"findFiles",
"(",
"$",
"searchTerm",
",",
"$",
"sortBy",
"=",
"'title'",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"$",
"words",
"=",
"explode",
"(",
"' '",
",",
"Str",
"::",
"lower",
"(",
"$",
"searchTerm",
")",
")",
";",
"$... | Finds files in the Library.
@param string $searchTerm Specifies the search term.
@param mixed $sortBy Determines the sorting preference.
Supported values are 'title', 'size', 'lastModified' (see SORT_BY_XXX class constants), FALSE (to disable sorting), or an associative array with a 'by' key and a 'direction' key: ['by... | [
"Finds",
"files",
"in",
"the",
"Library",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L174-L203 |
208,355 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.deleteFiles | public function deleteFiles($paths)
{
$fullPaths = [];
foreach ($paths as $path) {
$path = self::validatePath($path);
$fullPaths[] = $this->getMediaPath($path);
}
return $this->getStorageDisk()->delete($fullPaths);
} | php | public function deleteFiles($paths)
{
$fullPaths = [];
foreach ($paths as $path) {
$path = self::validatePath($path);
$fullPaths[] = $this->getMediaPath($path);
}
return $this->getStorageDisk()->delete($fullPaths);
} | [
"public",
"function",
"deleteFiles",
"(",
"$",
"paths",
")",
"{",
"$",
"fullPaths",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"self",
"::",
"validatePath",
"(",
"$",
"path",
")",
";",
"$",
"f... | Deletes a file from the Library.
@param array $paths A list of file paths relative to the Library root to delete. | [
"Deletes",
"a",
"file",
"from",
"the",
"Library",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L209-L218 |
208,356 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.deleteFolder | public function deleteFolder($path)
{
$path = self::validatePath($path);
$fullPaths = $this->getMediaPath($path);
return $this->getStorageDisk()->deleteDirectory($fullPaths);
} | php | public function deleteFolder($path)
{
$path = self::validatePath($path);
$fullPaths = $this->getMediaPath($path);
return $this->getStorageDisk()->deleteDirectory($fullPaths);
} | [
"public",
"function",
"deleteFolder",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"self",
"::",
"validatePath",
"(",
"$",
"path",
")",
";",
"$",
"fullPaths",
"=",
"$",
"this",
"->",
"getMediaPath",
"(",
"$",
"path",
")",
";",
"return",
"$",
"this",... | Deletes a folder from the Library.
@param string $path Specifies the folder path relative to the Library root. | [
"Deletes",
"a",
"folder",
"from",
"the",
"Library",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L224-L230 |
208,357 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.exists | public function exists($path)
{
$path = self::validatePath($path);
$fullPath = $this->getMediaPath($path);
return $this->getStorageDisk()->exists($fullPath);
} | php | public function exists($path)
{
$path = self::validatePath($path);
$fullPath = $this->getMediaPath($path);
return $this->getStorageDisk()->exists($fullPath);
} | [
"public",
"function",
"exists",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"self",
"::",
"validatePath",
"(",
"$",
"path",
")",
";",
"$",
"fullPath",
"=",
"$",
"this",
"->",
"getMediaPath",
"(",
"$",
"path",
")",
";",
"return",
"$",
"this",
"->"... | Determines if a file with the specified path exists in the library.
@param string $path Specifies the file path relative the the Library root.
@return boolean Returns TRUE if the file exists. | [
"Determines",
"if",
"a",
"file",
"with",
"the",
"specified",
"path",
"exists",
"in",
"the",
"library",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L237-L243 |
208,358 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.folderExists | public function folderExists($path)
{
$folderName = basename($path);
$folderPath = dirname($path);
$path = self::validatePath($folderPath);
$fullPath = $this->getMediaPath($path);
$folders = $this->getStorageDisk()->directories($fullPath);
foreach ($folders as $fold... | php | public function folderExists($path)
{
$folderName = basename($path);
$folderPath = dirname($path);
$path = self::validatePath($folderPath);
$fullPath = $this->getMediaPath($path);
$folders = $this->getStorageDisk()->directories($fullPath);
foreach ($folders as $fold... | [
"public",
"function",
"folderExists",
"(",
"$",
"path",
")",
"{",
"$",
"folderName",
"=",
"basename",
"(",
"$",
"path",
")",
";",
"$",
"folderPath",
"=",
"dirname",
"(",
"$",
"path",
")",
";",
"$",
"path",
"=",
"self",
"::",
"validatePath",
"(",
"$",... | Determines if a folder with the specified path exists in the library.
@param string $path Specifies the folder path relative the the Library root.
@return boolean Returns TRUE if the folder exists. | [
"Determines",
"if",
"a",
"folder",
"with",
"the",
"specified",
"path",
"exists",
"in",
"the",
"library",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L250-L266 |
208,359 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.listAllDirectories | public function listAllDirectories($exclude = [])
{
$fullPath = $this->getMediaPath('/');
$folders = $this->getStorageDisk()->allDirectories($fullPath);
$folders = array_unique($folders, SORT_LOCALE_STRING);
$result = [];
foreach ($folders as $folder) {
$folde... | php | public function listAllDirectories($exclude = [])
{
$fullPath = $this->getMediaPath('/');
$folders = $this->getStorageDisk()->allDirectories($fullPath);
$folders = array_unique($folders, SORT_LOCALE_STRING);
$result = [];
foreach ($folders as $folder) {
$folde... | [
"public",
"function",
"listAllDirectories",
"(",
"$",
"exclude",
"=",
"[",
"]",
")",
"{",
"$",
"fullPath",
"=",
"$",
"this",
"->",
"getMediaPath",
"(",
"'/'",
")",
";",
"$",
"folders",
"=",
"$",
"this",
"->",
"getStorageDisk",
"(",
")",
"->",
"allDirec... | Returns a list of all directories in the Library, optionally excluding some of them.
@param array $exclude A list of folders to exclude from the result list.
The folder paths should be specified relative to the Library root.
@return array | [
"Returns",
"a",
"list",
"of",
"all",
"directories",
"in",
"the",
"Library",
"optionally",
"excluding",
"some",
"of",
"them",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L274-L302 |
208,360 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.get | public function get($path)
{
$path = self::validatePath($path);
$fullPath = $this->getMediaPath($path);
return $this->getStorageDisk()->get($fullPath);
} | php | public function get($path)
{
$path = self::validatePath($path);
$fullPath = $this->getMediaPath($path);
return $this->getStorageDisk()->get($fullPath);
} | [
"public",
"function",
"get",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"self",
"::",
"validatePath",
"(",
"$",
"path",
")",
";",
"$",
"fullPath",
"=",
"$",
"this",
"->",
"getMediaPath",
"(",
"$",
"path",
")",
";",
"return",
"$",
"this",
"->",
... | Returns a file contents.
@param string $path Specifies the file path relative the the Library root.
@return string Returns the file contents | [
"Returns",
"a",
"file",
"contents",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L309-L314 |
208,361 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.put | public function put($path, $contents)
{
$path = self::validatePath($path);
$fullPath = $this->getMediaPath($path);
return $this->getStorageDisk()->put($fullPath, $contents);
} | php | public function put($path, $contents)
{
$path = self::validatePath($path);
$fullPath = $this->getMediaPath($path);
return $this->getStorageDisk()->put($fullPath, $contents);
} | [
"public",
"function",
"put",
"(",
"$",
"path",
",",
"$",
"contents",
")",
"{",
"$",
"path",
"=",
"self",
"::",
"validatePath",
"(",
"$",
"path",
")",
";",
"$",
"fullPath",
"=",
"$",
"this",
"->",
"getMediaPath",
"(",
"$",
"path",
")",
";",
"return"... | Puts a file to the library.
@param string $path Specifies the file path relative the the Library root.
@param string $contents Specifies the file contents.
@return boolean | [
"Puts",
"a",
"file",
"to",
"the",
"library",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L322-L327 |
208,362 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.moveFile | public function moveFile($oldPath, $newPath, $isRename = false)
{
$oldPath = self::validatePath($oldPath);
$fullOldPath = $this->getMediaPath($oldPath);
$newPath = self::validatePath($newPath);
$fullNewPath = $this->getMediaPath($newPath);
return $this->getStorageDisk()->mo... | php | public function moveFile($oldPath, $newPath, $isRename = false)
{
$oldPath = self::validatePath($oldPath);
$fullOldPath = $this->getMediaPath($oldPath);
$newPath = self::validatePath($newPath);
$fullNewPath = $this->getMediaPath($newPath);
return $this->getStorageDisk()->mo... | [
"public",
"function",
"moveFile",
"(",
"$",
"oldPath",
",",
"$",
"newPath",
",",
"$",
"isRename",
"=",
"false",
")",
"{",
"$",
"oldPath",
"=",
"self",
"::",
"validatePath",
"(",
"$",
"oldPath",
")",
";",
"$",
"fullOldPath",
"=",
"$",
"this",
"->",
"g... | Moves a file to another location.
@param string $oldPath Specifies the original path of the file.
@param string $newPath Specifies the new path of the file.
@return boolean | [
"Moves",
"a",
"file",
"to",
"another",
"location",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L335-L344 |
208,363 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.copyFolder | public function copyFolder($originalPath, $newPath)
{
$disk = $this->getStorageDisk();
$copyDirectory = function ($srcPath, $destPath) use (&$copyDirectory, $disk) {
$srcPath = self::validatePath($srcPath);
$fullSrcPath = $this->getMediaPath($srcPath);
$destPath... | php | public function copyFolder($originalPath, $newPath)
{
$disk = $this->getStorageDisk();
$copyDirectory = function ($srcPath, $destPath) use (&$copyDirectory, $disk) {
$srcPath = self::validatePath($srcPath);
$fullSrcPath = $this->getMediaPath($srcPath);
$destPath... | [
"public",
"function",
"copyFolder",
"(",
"$",
"originalPath",
",",
"$",
"newPath",
")",
"{",
"$",
"disk",
"=",
"$",
"this",
"->",
"getStorageDisk",
"(",
")",
";",
"$",
"copyDirectory",
"=",
"function",
"(",
"$",
"srcPath",
",",
"$",
"destPath",
")",
"u... | Copies a folder.
@param string $originalPath Specifies the original path of the folder.
@param string $newPath Specifies the new path of the folder.
@return boolean | [
"Copies",
"a",
"folder",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L352-L387 |
208,364 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.validatePath | public static function validatePath($path, $normalizeOnly = false)
{
$path = str_replace('\\', '/', $path);
$path = '/'.trim($path, '/');
if ($normalizeOnly) {
return $path;
}
/*
* Validate folder names
*/
$regexWhitelist = [
... | php | public static function validatePath($path, $normalizeOnly = false)
{
$path = str_replace('\\', '/', $path);
$path = '/'.trim($path, '/');
if ($normalizeOnly) {
return $path;
}
/*
* Validate folder names
*/
$regexWhitelist = [
... | [
"public",
"static",
"function",
"validatePath",
"(",
"$",
"path",
",",
"$",
"normalizeOnly",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"path",
")",
";",
"$",
"path",
"=",
"'/'",
".",
"trim",
"(",
... | Checks if file path doesn't contain any substrings that would pose a security threat.
Throws an exception if the path is not valid.
@param string $path Specifies the path.
@param boolean $normalizeOnly Specifies if only the normalization, without validation should be performed.
@return string Returns a normalized path. | [
"Checks",
"if",
"file",
"path",
"doesn",
"t",
"contain",
"any",
"substrings",
"that",
"would",
"pose",
"a",
"security",
"threat",
".",
"Throws",
"an",
"exception",
"if",
"the",
"path",
"is",
"not",
"valid",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L463-L517 |
208,365 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.getPathUrl | public function getPathUrl($path)
{
$path = $this->validatePath($path);
$fullPath = $this->storagePath.implode("/", array_map("rawurlencode", explode("/", $path)));
return Url::to($fullPath);
} | php | public function getPathUrl($path)
{
$path = $this->validatePath($path);
$fullPath = $this->storagePath.implode("/", array_map("rawurlencode", explode("/", $path)));
return Url::to($fullPath);
} | [
"public",
"function",
"getPathUrl",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"validatePath",
"(",
"$",
"path",
")",
";",
"$",
"fullPath",
"=",
"$",
"this",
"->",
"storagePath",
".",
"implode",
"(",
"\"/\"",
",",
"array_map",
"... | Returns a public file URL.
@param string $path Specifies the file path relative the the Library root.
@return string | [
"Returns",
"a",
"public",
"file",
"URL",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L534-L541 |
208,366 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.getMediaRelativePath | protected function getMediaRelativePath($path)
{
$path = self::validatePath($path, true);
if (substr($path, 0, $this->storageFolderNameLength) == $this->storageFolder) {
return substr($path, $this->storageFolderNameLength);
}
throw new SystemException(sprintf('Cannot co... | php | protected function getMediaRelativePath($path)
{
$path = self::validatePath($path, true);
if (substr($path, 0, $this->storageFolderNameLength) == $this->storageFolder) {
return substr($path, $this->storageFolderNameLength);
}
throw new SystemException(sprintf('Cannot co... | [
"protected",
"function",
"getMediaRelativePath",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"self",
"::",
"validatePath",
"(",
"$",
"path",
",",
"true",
")",
";",
"if",
"(",
"substr",
"(",
"$",
"path",
",",
"0",
",",
"$",
"this",
"->",
"storageFol... | Returns path relative to the Library root folder.
@param string $path Specifies a path relative to the Library disk root.
@return string Returns the updated path. | [
"Returns",
"path",
"relative",
"to",
"the",
"Library",
"root",
"folder",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L558-L567 |
208,367 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.initLibraryItem | protected function initLibraryItem($path, $itemType)
{
$relativePath = $this->getMediaRelativePath($path);
if (!$this->isVisible($relativePath)) {
return;
}
/*
* S3 doesn't allow getting the last modified timestamp for folders,
* so this feature is dis... | php | protected function initLibraryItem($path, $itemType)
{
$relativePath = $this->getMediaRelativePath($path);
if (!$this->isVisible($relativePath)) {
return;
}
/*
* S3 doesn't allow getting the last modified timestamp for folders,
* so this feature is dis... | [
"protected",
"function",
"initLibraryItem",
"(",
"$",
"path",
",",
"$",
"itemType",
")",
"{",
"$",
"relativePath",
"=",
"$",
"this",
"->",
"getMediaRelativePath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isVisible",
"(",
"$",
"re... | Initializes a library item from a path and item type.
@param string $path Specifies the item path relative to the storage disk root.
@param string $itemType Specifies the item type.
@return mixed Returns the MediaLibraryItem object or NULL if the item is not visible. | [
"Initializes",
"a",
"library",
"item",
"from",
"a",
"path",
"and",
"item",
"type",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L597-L626 |
208,368 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.getFolderItemCount | protected function getFolderItemCount($path)
{
$folderItems = array_merge(
$this->getStorageDisk()->files($path),
$this->getStorageDisk()->directories($path)
);
$size = 0;
foreach ($folderItems as $folderItem) {
if ($this->isVisible($folderItem)) ... | php | protected function getFolderItemCount($path)
{
$folderItems = array_merge(
$this->getStorageDisk()->files($path),
$this->getStorageDisk()->directories($path)
);
$size = 0;
foreach ($folderItems as $folderItem) {
if ($this->isVisible($folderItem)) ... | [
"protected",
"function",
"getFolderItemCount",
"(",
"$",
"path",
")",
"{",
"$",
"folderItems",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"getStorageDisk",
"(",
")",
"->",
"files",
"(",
"$",
"path",
")",
",",
"$",
"this",
"->",
"getStorageDisk",
"(",
")... | Returns a number of items on a folder.
@param string $path Specifies the folder path relative to the storage disk root.
@return integer Returns the number of items in the folder. | [
"Returns",
"a",
"number",
"of",
"items",
"on",
"a",
"folder",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L633-L648 |
208,369 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.scanFolderContents | protected function scanFolderContents($fullFolderPath)
{
$result = [
'files' => [],
'folders' => []
];
$files = $this->getStorageDisk()->files($fullFolderPath);
foreach ($files as $file) {
if ($libraryItem = $this->initLibraryItem($file, MediaLibr... | php | protected function scanFolderContents($fullFolderPath)
{
$result = [
'files' => [],
'folders' => []
];
$files = $this->getStorageDisk()->files($fullFolderPath);
foreach ($files as $file) {
if ($libraryItem = $this->initLibraryItem($file, MediaLibr... | [
"protected",
"function",
"scanFolderContents",
"(",
"$",
"fullFolderPath",
")",
"{",
"$",
"result",
"=",
"[",
"'files'",
"=>",
"[",
"]",
",",
"'folders'",
"=>",
"[",
"]",
"]",
";",
"$",
"files",
"=",
"$",
"this",
"->",
"getStorageDisk",
"(",
")",
"->",... | Fetches the contents of a folder from the Library.
@param string $fullFolderPath Specifies the folder path relative the the storage disk root.
@return array Returns an array containing two elements - 'files' and 'folders', each is an array of MediaLibraryItem objects. | [
"Fetches",
"the",
"contents",
"of",
"a",
"folder",
"from",
"the",
"Library",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L655-L677 |
208,370 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.sortItemList | protected function sortItemList(&$itemList, $sortSettings)
{
$files = [];
$folders = [];
// Convert string $sortBy to array
if (is_string($sortSettings)) {
$sortSettings = [
'by' => $sortSettings,
'direction' => self::SORT_DIRECTION_ASC,
... | php | protected function sortItemList(&$itemList, $sortSettings)
{
$files = [];
$folders = [];
// Convert string $sortBy to array
if (is_string($sortSettings)) {
$sortSettings = [
'by' => $sortSettings,
'direction' => self::SORT_DIRECTION_ASC,
... | [
"protected",
"function",
"sortItemList",
"(",
"&",
"$",
"itemList",
",",
"$",
"sortSettings",
")",
"{",
"$",
"files",
"=",
"[",
"]",
";",
"$",
"folders",
"=",
"[",
"]",
";",
"// Convert string $sortBy to array",
"if",
"(",
"is_string",
"(",
"$",
"sortSetti... | Sorts the item list by title, size or last modified date.
@param array $itemList Specifies the item list to sort.
@param mixed $sortSettings Determines the sorting preference.
Supported values are 'title', 'size', 'lastModified' (see SORT_BY_XXX class constants) or an associative array with a 'by' key and a 'direction'... | [
"Sorts",
"the",
"item",
"list",
"by",
"title",
"size",
"or",
"last",
"modified",
"date",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L685-L728 |
208,371 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.filterItemList | protected function filterItemList(&$itemList, $filter)
{
if (!$filter)
return;
$result = [];
foreach ($itemList as $item) {
if ($item->getFileType() == $filter) {
$result[] = $item;
}
}
$itemList = $result;
} | php | protected function filterItemList(&$itemList, $filter)
{
if (!$filter)
return;
$result = [];
foreach ($itemList as $item) {
if ($item->getFileType() == $filter) {
$result[] = $item;
}
}
$itemList = $result;
} | [
"protected",
"function",
"filterItemList",
"(",
"&",
"$",
"itemList",
",",
"$",
"filter",
")",
"{",
"if",
"(",
"!",
"$",
"filter",
")",
"return",
";",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"itemList",
"as",
"$",
"item",
")",
"{",
... | Filters item list by file type.
@param array $itemList Specifies the item list to sort.
@param string $filter Determines the document type filtering preference.
Supported values are 'image', 'video', 'audio', 'document' (see FILE_TYPE_XXX constants of MediaLibraryItem class). | [
"Filters",
"item",
"list",
"by",
"file",
"type",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L736-L749 |
208,372 | octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.pathMatchesSearch | protected function pathMatchesSearch($path, $words)
{
$path = Str::lower($path);
foreach ($words as $word) {
$word = trim($word);
if (!strlen($word)) {
continue;
}
if (!Str::contains($path, $word)) {
return false;
... | php | protected function pathMatchesSearch($path, $words)
{
$path = Str::lower($path);
foreach ($words as $word) {
$word = trim($word);
if (!strlen($word)) {
continue;
}
if (!Str::contains($path, $word)) {
return false;
... | [
"protected",
"function",
"pathMatchesSearch",
"(",
"$",
"path",
",",
"$",
"words",
")",
"{",
"$",
"path",
"=",
"Str",
"::",
"lower",
"(",
"$",
"path",
")",
";",
"foreach",
"(",
"$",
"words",
"as",
"$",
"word",
")",
"{",
"$",
"word",
"=",
"trim",
... | Determines if file path contains all words form the search term.
@param string $path Specifies a path to examine.
@param array $words A list of words to check against.
@return boolean | [
"Determines",
"if",
"file",
"path",
"contains",
"all",
"words",
"form",
"the",
"search",
"term",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L775-L791 |
208,373 | octobercms/october | modules/system/models/EventLog.php | EventLog.getSummaryAttribute | public function getSummaryAttribute()
{
if (preg_match("/with message '(.+)' in/", $this->message, $match)) {
return $match[1];
}
return Str::limit($this->message, 100);
} | php | public function getSummaryAttribute()
{
if (preg_match("/with message '(.+)' in/", $this->message, $match)) {
return $match[1];
}
return Str::limit($this->message, 100);
} | [
"public",
"function",
"getSummaryAttribute",
"(",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"/with message '(.+)' in/\"",
",",
"$",
"this",
"->",
"message",
",",
"$",
"match",
")",
")",
"{",
"return",
"$",
"match",
"[",
"1",
"]",
";",
"}",
"return",
"Str... | Creates a shorter version of the message attribute,
extracts the exception message or limits by 100 characters.
@return string | [
"Creates",
"a",
"shorter",
"version",
"of",
"the",
"message",
"attribute",
"extracts",
"the",
"exception",
"message",
"or",
"limits",
"by",
"100",
"characters",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/EventLog.php#L81-L88 |
208,374 | octobercms/october | modules/cms/helpers/Cms.php | Cms.url | public function url($path = null)
{
$routeAction = 'Cms\Classes\CmsController@run';
if (self::$actionExists === null) {
self::$actionExists = Route::getRoutes()->getByAction($routeAction) !== null;
}
if (substr($path, 0, 1) == '/') {
$path = substr($path, 1)... | php | public function url($path = null)
{
$routeAction = 'Cms\Classes\CmsController@run';
if (self::$actionExists === null) {
self::$actionExists = Route::getRoutes()->getByAction($routeAction) !== null;
}
if (substr($path, 0, 1) == '/') {
$path = substr($path, 1)... | [
"public",
"function",
"url",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"routeAction",
"=",
"'Cms\\Classes\\CmsController@run'",
";",
"if",
"(",
"self",
"::",
"$",
"actionExists",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"actionExists",
"=",
"Route",... | Returns a URL in context of the Frontend | [
"Returns",
"a",
"URL",
"in",
"context",
"of",
"the",
"Frontend"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/helpers/Cms.php#L20-L37 |
208,375 | octobercms/october | modules/system/helpers/DateTime.php | DateTime.makeCarbon | public static function makeCarbon($value, $throwException = true)
{
if ($value instanceof Carbon) {
// Do nothing
}
elseif ($value instanceof PhpDateTime) {
$value = Carbon::instance($value);
}
elseif (is_numeric($value)) {
$value = Carbon:... | php | public static function makeCarbon($value, $throwException = true)
{
if ($value instanceof Carbon) {
// Do nothing
}
elseif ($value instanceof PhpDateTime) {
$value = Carbon::instance($value);
}
elseif (is_numeric($value)) {
$value = Carbon:... | [
"public",
"static",
"function",
"makeCarbon",
"(",
"$",
"value",
",",
"$",
"throwException",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"Carbon",
")",
"{",
"// Do nothing",
"}",
"elseif",
"(",
"$",
"value",
"instanceof",
"PhpDateTime",
"... | Converts mixed inputs to a Carbon object.
@return Carbon\Carbon | [
"Converts",
"mixed",
"inputs",
"to",
"a",
"Carbon",
"object",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/helpers/DateTime.php#L54-L79 |
208,376 | octobercms/october | modules/system/helpers/DateTime.php | DateTime.momentFormat | public static function momentFormat($format)
{
$replacements = [
'd' => 'DD',
'D' => 'ddd',
'j' => 'D',
'l' => 'dddd',
'N' => 'E',
'S' => 'o',
'w' => 'e',
'z' => 'DDD',
'W' => 'W',
'F' => ... | php | public static function momentFormat($format)
{
$replacements = [
'd' => 'DD',
'D' => 'ddd',
'j' => 'D',
'l' => 'dddd',
'N' => 'E',
'S' => 'o',
'w' => 'e',
'z' => 'DDD',
'W' => 'W',
'F' => ... | [
"public",
"static",
"function",
"momentFormat",
"(",
"$",
"format",
")",
"{",
"$",
"replacements",
"=",
"[",
"'d'",
"=>",
"'DD'",
",",
"'D'",
"=>",
"'ddd'",
",",
"'j'",
"=>",
"'D'",
",",
"'l'",
"=>",
"'dddd'",
",",
"'N'",
"=>",
"'E'",
",",
"'S'",
"... | Converts a PHP date format to "Moment.js" format.
@param string $format
@return string | [
"Converts",
"a",
"PHP",
"date",
"format",
"to",
"Moment",
".",
"js",
"format",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/helpers/DateTime.php#L86-L133 |
208,377 | octobercms/october | modules/backend/formwidgets/Relation.php | Relation.makeRenderFormField | protected function makeRenderFormField()
{
return $this->renderFormField = RelationBase::noConstraints(function () {
$field = clone $this->formField;
$relationObject = $this->getRelationObject();
$query = $relationObject->newQuery();
list($model, $attribute)... | php | protected function makeRenderFormField()
{
return $this->renderFormField = RelationBase::noConstraints(function () {
$field = clone $this->formField;
$relationObject = $this->getRelationObject();
$query = $relationObject->newQuery();
list($model, $attribute)... | [
"protected",
"function",
"makeRenderFormField",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"renderFormField",
"=",
"RelationBase",
"::",
"noConstraints",
"(",
"function",
"(",
")",
"{",
"$",
"field",
"=",
"clone",
"$",
"this",
"->",
"formField",
";",
"$",
... | Makes the form object used for rendering a simple field type | [
"Makes",
"the",
"form",
"object",
"used",
"for",
"rendering",
"a",
"simple",
"field",
"type"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/Relation.php#L93-L155 |
208,378 | octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.rebuild | protected function rebuild($path)
{
$uniqueName = str_replace('.', '', uniqid('', true)).'_'.md5(mt_rand());
$className = 'Cms'.$uniqueName.'Class';
$body = $this->object->code;
$body = preg_replace('/^\s*function/m', 'public function', $body);
$codeNamespaces = [];
... | php | protected function rebuild($path)
{
$uniqueName = str_replace('.', '', uniqid('', true)).'_'.md5(mt_rand());
$className = 'Cms'.$uniqueName.'Class';
$body = $this->object->code;
$body = preg_replace('/^\s*function/m', 'public function', $body);
$codeNamespaces = [];
... | [
"protected",
"function",
"rebuild",
"(",
"$",
"path",
")",
"{",
"$",
"uniqueName",
"=",
"str_replace",
"(",
"'.'",
",",
"''",
",",
"uniqid",
"(",
"''",
",",
"true",
")",
")",
".",
"'_'",
".",
"md5",
"(",
"mt_rand",
"(",
")",
")",
";",
"$",
"class... | Rebuilds the current file cache.
@param string The path in which the cached file should be stored | [
"Rebuilds",
"the",
"current",
"file",
"cache",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L123-L159 |
208,379 | octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.source | public function source($page, $layout, $controller)
{
$data = $this->parse();
$className = $data['className'];
if (!class_exists($className)) {
require_once $data['filePath'];
}
if (!class_exists($className) && ($data = $this->handleCorruptCache($data))) {
... | php | public function source($page, $layout, $controller)
{
$data = $this->parse();
$className = $data['className'];
if (!class_exists($className)) {
require_once $data['filePath'];
}
if (!class_exists($className) && ($data = $this->handleCorruptCache($data))) {
... | [
"public",
"function",
"source",
"(",
"$",
"page",
",",
"$",
"layout",
",",
"$",
"controller",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"parse",
"(",
")",
";",
"$",
"className",
"=",
"$",
"data",
"[",
"'className'",
"]",
";",
"if",
"(",
"!",... | Runs the object's PHP file and returns the corresponding object.
@param \Cms\Classes\Page $page Specifies the CMS page.
@param \Cms\Classes\Layout $layout Specifies the CMS layout.
@param \Cms\Classes\Controller $controller Specifies the CMS controller.
@return mixed | [
"Runs",
"the",
"object",
"s",
"PHP",
"file",
"and",
"returns",
"the",
"corresponding",
"object",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L168-L182 |
208,380 | octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.handleCorruptCache | protected function handleCorruptCache($data)
{
$path = array_get($data, 'filePath', $this->getCacheFilePath());
if (is_file($path)) {
if (($className = $this->extractClassFromFile($path)) && class_exists($className)) {
$data['className'] = $className;
ret... | php | protected function handleCorruptCache($data)
{
$path = array_get($data, 'filePath', $this->getCacheFilePath());
if (is_file($path)) {
if (($className = $this->extractClassFromFile($path)) && class_exists($className)) {
$data['className'] = $className;
ret... | [
"protected",
"function",
"handleCorruptCache",
"(",
"$",
"data",
")",
"{",
"$",
"path",
"=",
"array_get",
"(",
"$",
"data",
",",
"'filePath'",
",",
"$",
"this",
"->",
"getCacheFilePath",
"(",
")",
")",
";",
"if",
"(",
"is_file",
"(",
"$",
"path",
")",
... | In some rare cases the cache file will not contain the class
name we expect. When this happens, destroy the corrupt file,
flush the request cache, and repeat the cycle.
@return void | [
"In",
"some",
"rare",
"cases",
"the",
"cache",
"file",
"will",
"not",
"contain",
"the",
"class",
"name",
"we",
"expect",
".",
"When",
"this",
"happens",
"destroy",
"the",
"corrupt",
"file",
"flush",
"the",
"request",
"cache",
"and",
"repeat",
"the",
"cycle... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L190-L206 |
208,381 | octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.storeCachedInfo | protected function storeCachedInfo($result)
{
$cacheItem = $result;
$cacheItem['mtime'] = $this->object->mtime;
$cached = $this->getCachedInfo() ?: [];
$cached[$this->filePath] = $cacheItem;
Cache::put($this->dataCacheKey, base64_encode(serialize($cached)), 1440);
... | php | protected function storeCachedInfo($result)
{
$cacheItem = $result;
$cacheItem['mtime'] = $this->object->mtime;
$cached = $this->getCachedInfo() ?: [];
$cached[$this->filePath] = $cacheItem;
Cache::put($this->dataCacheKey, base64_encode(serialize($cached)), 1440);
... | [
"protected",
"function",
"storeCachedInfo",
"(",
"$",
"result",
")",
"{",
"$",
"cacheItem",
"=",
"$",
"result",
";",
"$",
"cacheItem",
"[",
"'mtime'",
"]",
"=",
"$",
"this",
"->",
"object",
"->",
"mtime",
";",
"$",
"cached",
"=",
"$",
"this",
"->",
"... | Stores result data inside cache.
@param array $result
@return void | [
"Stores",
"result",
"data",
"inside",
"cache",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L217-L228 |
208,382 | octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.getCacheFilePath | protected function getCacheFilePath()
{
$hash = md5($this->filePath);
$result = storage_path().'/cms/cache/';
$result .= substr($hash, 0, 2).'/';
$result .= substr($hash, 2, 2).'/';
$result .= basename($this->filePath);
$result .= '.php';
return $result;
... | php | protected function getCacheFilePath()
{
$hash = md5($this->filePath);
$result = storage_path().'/cms/cache/';
$result .= substr($hash, 0, 2).'/';
$result .= substr($hash, 2, 2).'/';
$result .= basename($this->filePath);
$result .= '.php';
return $result;
... | [
"protected",
"function",
"getCacheFilePath",
"(",
")",
"{",
"$",
"hash",
"=",
"md5",
"(",
"$",
"this",
"->",
"filePath",
")",
";",
"$",
"result",
"=",
"storage_path",
"(",
")",
".",
"'/cms/cache/'",
";",
"$",
"result",
".=",
"substr",
"(",
"$",
"hash",... | Returns path to the cached parsed file
@return string | [
"Returns",
"path",
"to",
"the",
"cached",
"parsed",
"file"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L234-L244 |
208,383 | octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.getCachedInfo | protected function getCachedInfo()
{
$cached = Cache::get($this->dataCacheKey, false);
if (
$cached !== false &&
($cached = @unserialize(@base64_decode($cached))) !== false
) {
return $cached;
}
return null;
} | php | protected function getCachedInfo()
{
$cached = Cache::get($this->dataCacheKey, false);
if (
$cached !== false &&
($cached = @unserialize(@base64_decode($cached))) !== false
) {
return $cached;
}
return null;
} | [
"protected",
"function",
"getCachedInfo",
"(",
")",
"{",
"$",
"cached",
"=",
"Cache",
"::",
"get",
"(",
"$",
"this",
"->",
"dataCacheKey",
",",
"false",
")",
";",
"if",
"(",
"$",
"cached",
"!==",
"false",
"&&",
"(",
"$",
"cached",
"=",
"@",
"unserial... | Returns information about all cached files.
@return mixed Returns an array representing the cached data or NULL. | [
"Returns",
"information",
"about",
"all",
"cached",
"files",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L250-L262 |
208,384 | octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.getCachedFileInfo | protected function getCachedFileInfo()
{
$cached = $this->getCachedInfo();
if ($cached !== null && array_key_exists($this->filePath, $cached)) {
return $cached[$this->filePath];
}
return null;
} | php | protected function getCachedFileInfo()
{
$cached = $this->getCachedInfo();
if ($cached !== null && array_key_exists($this->filePath, $cached)) {
return $cached[$this->filePath];
}
return null;
} | [
"protected",
"function",
"getCachedFileInfo",
"(",
")",
"{",
"$",
"cached",
"=",
"$",
"this",
"->",
"getCachedInfo",
"(",
")",
";",
"if",
"(",
"$",
"cached",
"!==",
"null",
"&&",
"array_key_exists",
"(",
"$",
"this",
"->",
"filePath",
",",
"$",
"cached",... | Returns information about a cached file
@return integer | [
"Returns",
"information",
"about",
"a",
"cached",
"file"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L268-L277 |
208,385 | octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.extractClassFromFile | protected function extractClassFromFile($path)
{
$fileContent = file_get_contents($path);
$matches = [];
$pattern = '/Cms\S+_\S+Class/';
preg_match($pattern, $fileContent, $matches);
if (!empty($matches[0])) {
return $matches[0];
}
return null;
... | php | protected function extractClassFromFile($path)
{
$fileContent = file_get_contents($path);
$matches = [];
$pattern = '/Cms\S+_\S+Class/';
preg_match($pattern, $fileContent, $matches);
if (!empty($matches[0])) {
return $matches[0];
}
return null;
... | [
"protected",
"function",
"extractClassFromFile",
"(",
"$",
"path",
")",
"{",
"$",
"fileContent",
"=",
"file_get_contents",
"(",
"$",
"path",
")",
";",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"pattern",
"=",
"'/Cms\\S+_\\S+Class/'",
";",
"preg_match",
"(",
... | Extracts the class name from a cache file
@return string | [
"Extracts",
"the",
"class",
"name",
"from",
"a",
"cache",
"file"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L296-L308 |
208,386 | octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.writeContentSafe | protected function writeContentSafe($path, $content)
{
$count = 0;
$tmpFile = tempnam(dirname($path), basename($path));
if (@file_put_contents($tmpFile, $content) === false) {
throw new SystemException(Lang::get('system::lang.file.create_fail', ['name'=>$tmpFile]));
}
... | php | protected function writeContentSafe($path, $content)
{
$count = 0;
$tmpFile = tempnam(dirname($path), basename($path));
if (@file_put_contents($tmpFile, $content) === false) {
throw new SystemException(Lang::get('system::lang.file.create_fail', ['name'=>$tmpFile]));
}
... | [
"protected",
"function",
"writeContentSafe",
"(",
"$",
"path",
",",
"$",
"content",
")",
"{",
"$",
"count",
"=",
"0",
";",
"$",
"tmpFile",
"=",
"tempnam",
"(",
"dirname",
"(",
"$",
"path",
")",
",",
"basename",
"(",
"$",
"path",
")",
")",
";",
"if"... | Writes content with concurrency support and cache busting
This work is based on the Twig_Cache_Filesystem class | [
"Writes",
"content",
"with",
"concurrency",
"support",
"and",
"cache",
"busting",
"This",
"work",
"is",
"based",
"on",
"the",
"Twig_Cache_Filesystem",
"class"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L314-L344 |
208,387 | octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.makeDirectorySafe | protected function makeDirectorySafe($dir)
{
$count = 0;
if (is_dir($dir)) {
if (!is_writable($dir)) {
throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir]));
}
return;
}
while (!is_dir($dir) &... | php | protected function makeDirectorySafe($dir)
{
$count = 0;
if (is_dir($dir)) {
if (!is_writable($dir)) {
throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir]));
}
return;
}
while (!is_dir($dir) &... | [
"protected",
"function",
"makeDirectorySafe",
"(",
"$",
"dir",
")",
"{",
"$",
"count",
"=",
"0",
";",
"if",
"(",
"is_dir",
"(",
"$",
"dir",
")",
")",
"{",
"if",
"(",
"!",
"is_writable",
"(",
"$",
"dir",
")",
")",
"{",
"throw",
"new",
"SystemExcepti... | Make directory with concurrency support | [
"Make",
"directory",
"with",
"concurrency",
"support"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L349-L370 |
208,388 | octobercms/october | modules/backend/models/Preference.php | Preference.setAppLocale | public static function setAppLocale()
{
if (Session::has('locale')) {
App::setLocale(Session::get('locale'));
}
elseif (
($user = BackendAuth::getUser()) &&
($locale = static::get('locale'))
) {
Session::put('locale', $locale);
... | php | public static function setAppLocale()
{
if (Session::has('locale')) {
App::setLocale(Session::get('locale'));
}
elseif (
($user = BackendAuth::getUser()) &&
($locale = static::get('locale'))
) {
Session::put('locale', $locale);
... | [
"public",
"static",
"function",
"setAppLocale",
"(",
")",
"{",
"if",
"(",
"Session",
"::",
"has",
"(",
"'locale'",
")",
")",
"{",
"App",
"::",
"setLocale",
"(",
"Session",
"::",
"get",
"(",
"'locale'",
")",
")",
";",
"}",
"elseif",
"(",
"(",
"$",
"... | Set the application's locale based on the user preference.
@return void | [
"Set",
"the",
"application",
"s",
"locale",
"based",
"on",
"the",
"user",
"preference",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/Preference.php#L79-L91 |
208,389 | octobercms/october | modules/backend/models/Preference.php | Preference.setAppFallbackLocale | public static function setAppFallbackLocale()
{
if (Session::has('fallback_locale')) {
Lang::setFallback(Session::get('fallback_locale'));
}
elseif (
($user = BackendAuth::getUser()) &&
($locale = static::get('fallback_locale'))
) {
Ses... | php | public static function setAppFallbackLocale()
{
if (Session::has('fallback_locale')) {
Lang::setFallback(Session::get('fallback_locale'));
}
elseif (
($user = BackendAuth::getUser()) &&
($locale = static::get('fallback_locale'))
) {
Ses... | [
"public",
"static",
"function",
"setAppFallbackLocale",
"(",
")",
"{",
"if",
"(",
"Session",
"::",
"has",
"(",
"'fallback_locale'",
")",
")",
"{",
"Lang",
"::",
"setFallback",
"(",
"Session",
"::",
"get",
"(",
"'fallback_locale'",
")",
")",
";",
"}",
"else... | Same as setAppLocale except for the fallback definition.
@return void | [
"Same",
"as",
"setAppLocale",
"except",
"for",
"the",
"fallback",
"definition",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/Preference.php#L97-L109 |
208,390 | octobercms/october | modules/backend/models/Preference.php | Preference.applyConfigValues | public static function applyConfigValues()
{
$settings = self::instance();
Config::set('app.locale', $settings->locale);
Config::set('app.fallback_locale', $settings->fallback_locale);
} | php | public static function applyConfigValues()
{
$settings = self::instance();
Config::set('app.locale', $settings->locale);
Config::set('app.fallback_locale', $settings->fallback_locale);
} | [
"public",
"static",
"function",
"applyConfigValues",
"(",
")",
"{",
"$",
"settings",
"=",
"self",
"::",
"instance",
"(",
")",
";",
"Config",
"::",
"set",
"(",
"'app.locale'",
",",
"$",
"settings",
"->",
"locale",
")",
";",
"Config",
"::",
"set",
"(",
"... | Overrides the config with the user's preference.
@return void | [
"Overrides",
"the",
"config",
"with",
"the",
"user",
"s",
"preference",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/Preference.php#L145-L150 |
208,391 | octobercms/october | modules/backend/models/Preference.php | Preference.getFallbackLocale | protected function getFallbackLocale($locale)
{
if ($position = strpos($locale, '-')) {
$target = substr($locale, 0, $position);
$available = $this->getLocaleOptions();
if (isset($available[$target])) {
return $target;
}
}
retu... | php | protected function getFallbackLocale($locale)
{
if ($position = strpos($locale, '-')) {
$target = substr($locale, 0, $position);
$available = $this->getLocaleOptions();
if (isset($available[$target])) {
return $target;
}
}
retu... | [
"protected",
"function",
"getFallbackLocale",
"(",
"$",
"locale",
")",
"{",
"if",
"(",
"$",
"position",
"=",
"strpos",
"(",
"$",
"locale",
",",
"'-'",
")",
")",
"{",
"$",
"target",
"=",
"substr",
"(",
"$",
"locale",
",",
"0",
",",
"$",
"position",
... | Attempt to extract the language from the locale,
otherwise use the configuration.
@return string | [
"Attempt",
"to",
"extract",
"the",
"language",
"from",
"the",
"locale",
"otherwise",
"use",
"the",
"configuration",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/Preference.php#L161-L172 |
208,392 | octobercms/october | modules/backend/models/Preference.php | Preference.getTimezoneOptions | public function getTimezoneOptions()
{
$timezoneIdentifiers = DateTimeZone::listIdentifiers();
$utcTime = new DateTime('now', new DateTimeZone('UTC'));
$tempTimezones = [];
foreach ($timezoneIdentifiers as $timezoneIdentifier) {
$currentTimezone = new DateTimeZone($timez... | php | public function getTimezoneOptions()
{
$timezoneIdentifiers = DateTimeZone::listIdentifiers();
$utcTime = new DateTime('now', new DateTimeZone('UTC'));
$tempTimezones = [];
foreach ($timezoneIdentifiers as $timezoneIdentifier) {
$currentTimezone = new DateTimeZone($timez... | [
"public",
"function",
"getTimezoneOptions",
"(",
")",
"{",
"$",
"timezoneIdentifiers",
"=",
"DateTimeZone",
"::",
"listIdentifiers",
"(",
")",
";",
"$",
"utcTime",
"=",
"new",
"DateTime",
"(",
"'now'",
",",
"new",
"DateTimeZone",
"(",
"'UTC'",
")",
")",
";",... | Returns all available timezone options.
@return array | [
"Returns",
"all",
"available",
"timezone",
"options",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/Preference.php#L235-L265 |
208,393 | octobercms/october | modules/backend/models/Preference.php | Preference.getEditorThemeOptions | public function getEditorThemeOptions()
{
$themeDir = new DirectoryIterator("modules/backend/formwidgets/codeeditor/assets/vendor/ace/");
$themes = [];
// Iterate through the themes
foreach ($themeDir as $node) {
// If this file is a theme (starting by "theme-")
... | php | public function getEditorThemeOptions()
{
$themeDir = new DirectoryIterator("modules/backend/formwidgets/codeeditor/assets/vendor/ace/");
$themes = [];
// Iterate through the themes
foreach ($themeDir as $node) {
// If this file is a theme (starting by "theme-")
... | [
"public",
"function",
"getEditorThemeOptions",
"(",
")",
"{",
"$",
"themeDir",
"=",
"new",
"DirectoryIterator",
"(",
"\"modules/backend/formwidgets/codeeditor/assets/vendor/ace/\"",
")",
";",
"$",
"themes",
"=",
"[",
"]",
";",
"// Iterate through the themes",
"foreach",
... | Returns the theme options for the backend editor.
@return array | [
"Returns",
"the",
"theme",
"options",
"for",
"the",
"backend",
"editor",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/Preference.php#L271-L296 |
208,394 | octobercms/october | modules/cms/classes/ComponentPartial.php | ComponentPartial.loadOverrideCached | public static function loadOverrideCached($theme, $component, $fileName)
{
$partial = Partial::loadCached($theme, strtolower($component->alias) . '/' . $fileName);
if ($partial === null) {
$partial = Partial::loadCached($theme, $component->alias . '/' . $fileName);
}
re... | php | public static function loadOverrideCached($theme, $component, $fileName)
{
$partial = Partial::loadCached($theme, strtolower($component->alias) . '/' . $fileName);
if ($partial === null) {
$partial = Partial::loadCached($theme, $component->alias . '/' . $fileName);
}
re... | [
"public",
"static",
"function",
"loadOverrideCached",
"(",
"$",
"theme",
",",
"$",
"component",
",",
"$",
"fileName",
")",
"{",
"$",
"partial",
"=",
"Partial",
"::",
"loadCached",
"(",
"$",
"theme",
",",
"strtolower",
"(",
"$",
"component",
"->",
"alias",
... | Checks if a partial override exists in the supplied theme and returns it.
Since the beginning of time, October inconsistently checked for overrides
using the component alias exactly, resulting in a folder with uppercase
characters, subsequently this method checks for both variants.
@param \Cms\Classes\Theme $theme
@pa... | [
"Checks",
"if",
"a",
"partial",
"override",
"exists",
"in",
"the",
"supplied",
"theme",
"and",
"returns",
"it",
".",
"Since",
"the",
"beginning",
"of",
"time",
"October",
"inconsistently",
"checked",
"for",
"overrides",
"using",
"the",
"component",
"alias",
"e... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentPartial.php#L102-L111 |
208,395 | octobercms/october | modules/cms/classes/ComponentPartial.php | ComponentPartial.check | public static function check(ComponentBase $component, $fileName)
{
$partial = new static($component);
$filePath = $partial->getFilePath($fileName);
if (!strlen(File::extension($filePath))) {
$filePath .= '.'.$partial->getDefaultExtension();
}
return File::isFile... | php | public static function check(ComponentBase $component, $fileName)
{
$partial = new static($component);
$filePath = $partial->getFilePath($fileName);
if (!strlen(File::extension($filePath))) {
$filePath .= '.'.$partial->getDefaultExtension();
}
return File::isFile... | [
"public",
"static",
"function",
"check",
"(",
"ComponentBase",
"$",
"component",
",",
"$",
"fileName",
")",
"{",
"$",
"partial",
"=",
"new",
"static",
"(",
"$",
"component",
")",
";",
"$",
"filePath",
"=",
"$",
"partial",
"->",
"getFilePath",
"(",
"$",
... | Returns true if the specific component contains a matching partial.
@param \Cms\Classes\ComponentBase $component Specifies a component the file belongs to.
@param string $fileName Specifies the file name to check.
@return bool | [
"Returns",
"true",
"if",
"the",
"specific",
"component",
"contains",
"a",
"matching",
"partial",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentPartial.php#L145-L154 |
208,396 | octobercms/october | modules/cms/classes/ComponentPartial.php | ComponentPartial.validateFileName | protected function validateFileName($fileName)
{
if (!FileHelper::validatePath($fileName, $this->maxNesting)) {
throw new ApplicationException(Lang::get('cms::lang.cms_object.invalid_file', [
'name' => $fileName
]));
}
if (!strlen(File::extension($fil... | php | protected function validateFileName($fileName)
{
if (!FileHelper::validatePath($fileName, $this->maxNesting)) {
throw new ApplicationException(Lang::get('cms::lang.cms_object.invalid_file', [
'name' => $fileName
]));
}
if (!strlen(File::extension($fil... | [
"protected",
"function",
"validateFileName",
"(",
"$",
"fileName",
")",
"{",
"if",
"(",
"!",
"FileHelper",
"::",
"validatePath",
"(",
"$",
"fileName",
",",
"$",
"this",
"->",
"maxNesting",
")",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"Lang",
... | Checks the supplied file name for validity.
@param string $fileName
@return string | [
"Checks",
"the",
"supplied",
"file",
"name",
"for",
"validity",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentPartial.php#L161-L174 |
208,397 | octobercms/october | modules/cms/classes/ComponentPartial.php | ComponentPartial.getBaseFileName | public function getBaseFileName()
{
$pos = strrpos($this->fileName, '.');
if ($pos === false) {
return $this->fileName;
}
return substr($this->fileName, 0, $pos);
} | php | public function getBaseFileName()
{
$pos = strrpos($this->fileName, '.');
if ($pos === false) {
return $this->fileName;
}
return substr($this->fileName, 0, $pos);
} | [
"public",
"function",
"getBaseFileName",
"(",
")",
"{",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"this",
"->",
"fileName",
",",
"'.'",
")",
";",
"if",
"(",
"$",
"pos",
"===",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"fileName",
";",
"}",
"retur... | Returns the file name without the extension.
@return string | [
"Returns",
"the",
"file",
"name",
"without",
"the",
"extension",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentPartial.php#L225-L233 |
208,398 | octobercms/october | modules/system/classes/SystemController.php | SystemController.combine | public function combine($name)
{
try {
if (!strpos($name, '-')) {
throw new ApplicationException(Lang::get('system::lang.combiner.not_found', ['name' => $name]));
}
$parts = explode('-', $name);
$cacheId = $parts[0];
$combiner = ... | php | public function combine($name)
{
try {
if (!strpos($name, '-')) {
throw new ApplicationException(Lang::get('system::lang.combiner.not_found', ['name' => $name]));
}
$parts = explode('-', $name);
$cacheId = $parts[0];
$combiner = ... | [
"public",
"function",
"combine",
"(",
"$",
"name",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"strpos",
"(",
"$",
"name",
",",
"'-'",
")",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"Lang",
"::",
"get",
"(",
"'system::lang.combiner.not_found'",
",... | Combines JavaScript and StyleSheet assets.
@param string $name Combined file code
@return string Combined content. | [
"Combines",
"JavaScript",
"and",
"StyleSheet",
"assets",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SystemController.php#L23-L41 |
208,399 | octobercms/october | modules/system/classes/MarkupManager.php | MarkupManager.listExtensions | public function listExtensions($type)
{
$results = [];
if ($this->items === null) {
$this->loadExtensions();
}
if (isset($this->items[$type]) && is_array($this->items[$type])) {
$results = $this->items[$type];
}
if ($this->transactionItems !... | php | public function listExtensions($type)
{
$results = [];
if ($this->items === null) {
$this->loadExtensions();
}
if (isset($this->items[$type]) && is_array($this->items[$type])) {
$results = $this->items[$type];
}
if ($this->transactionItems !... | [
"public",
"function",
"listExtensions",
"(",
"$",
"type",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"items",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"loadExtensions",
"(",
")",
";",
"}",
"if",
"(",
"isset",
"... | Returns a list of the registered Twig extensions of a type.
@param $type string The Twig extension type
@return array | [
"Returns",
"a",
"list",
"of",
"the",
"registered",
"Twig",
"extensions",
"of",
"a",
"type",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MarkupManager.php#L172-L189 |
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.