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,100
overtrue/wechat
src/Payment/Notify/Handler.php
Handler.getMessage
public function getMessage(): array { if (!empty($this->message)) { return $this->message; } try { $message = XML::parse(strval($this->app['request']->getContent())); } catch (\Throwable $e) { throw new Exception('Invalid request XML: '.$e->getMes...
php
public function getMessage(): array { if (!empty($this->message)) { return $this->message; } try { $message = XML::parse(strval($this->app['request']->getContent())); } catch (\Throwable $e) { throw new Exception('Invalid request XML: '.$e->getMes...
[ "public", "function", "getMessage", "(", ")", ":", "array", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "message", ")", ")", "{", "return", "$", "this", "->", "message", ";", "}", "try", "{", "$", "message", "=", "XML", "::", "parse", "...
Return the notify message from request. @return array @throws \EasyWeChat\Kernel\Exceptions\Exception
[ "Return", "the", "notify", "message", "from", "request", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Notify/Handler.php#L128-L149
208,101
overtrue/wechat
src/Kernel/Traits/InteractsWithCache.php
InteractsWithCache.getCache
public function getCache() { if ($this->cache) { return $this->cache; } if (property_exists($this, 'app') && $this->app instanceof ServiceContainer && isset($this->app['cache']) && $this->app['cache'] instanceof CacheInterface) { return $this->cache = $th...
php
public function getCache() { if ($this->cache) { return $this->cache; } if (property_exists($this, 'app') && $this->app instanceof ServiceContainer && isset($this->app['cache']) && $this->app['cache'] instanceof CacheInterface) { return $this->cache = $th...
[ "public", "function", "getCache", "(", ")", "{", "if", "(", "$", "this", "->", "cache", ")", "{", "return", "$", "this", "->", "cache", ";", "}", "if", "(", "property_exists", "(", "$", "this", ",", "'app'", ")", "&&", "$", "this", "->", "app", "...
Get cache instance. @return \Psr\SimpleCache\CacheInterface
[ "Get", "cache", "instance", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Traits/InteractsWithCache.php#L35-L47
208,102
overtrue/wechat
src/Kernel/AccessToken.php
AccessToken.sendRequest
protected function sendRequest(array $credentials): ResponseInterface { $options = [ ('GET' === $this->requestMethod) ? 'query' : 'json' => $credentials, ]; return $this->setHttpClient($this->app['http_client'])->request($this->getEndpoint(), $this->requestMethod, $options); ...
php
protected function sendRequest(array $credentials): ResponseInterface { $options = [ ('GET' === $this->requestMethod) ? 'query' : 'json' => $credentials, ]; return $this->setHttpClient($this->app['http_client'])->request($this->getEndpoint(), $this->requestMethod, $options); ...
[ "protected", "function", "sendRequest", "(", "array", "$", "credentials", ")", ":", "ResponseInterface", "{", "$", "options", "=", "[", "(", "'GET'", "===", "$", "this", "->", "requestMethod", ")", "?", "'query'", ":", "'json'", "=>", "$", "credentials", "...
Send http request. @param array $credentials @return ResponseInterface @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
[ "Send", "http", "request", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/AccessToken.php#L216-L223
208,103
overtrue/wechat
src/Kernel/Support/Arr.php
Arr.random
public static function random(array $array, int $amount = null) { if (is_null($amount)) { return $array[array_rand($array)]; } $keys = array_rand($array, $amount); $results = []; foreach ((array) $keys as $key) { $results[] = $array[$key]; }...
php
public static function random(array $array, int $amount = null) { if (is_null($amount)) { return $array[array_rand($array)]; } $keys = array_rand($array, $amount); $results = []; foreach ((array) $keys as $key) { $results[] = $array[$key]; }...
[ "public", "static", "function", "random", "(", "array", "$", "array", ",", "int", "$", "amount", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "amount", ")", ")", "{", "return", "$", "array", "[", "array_rand", "(", "$", "array", ")", "]",...
Get a 1 value from an array. @param array $array @param int|null $amount @return mixed @throws \InvalidArgumentException
[ "Get", "a", "1", "value", "from", "an", "array", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Support/Arr.php#L392-L407
208,104
overtrue/wechat
src/Payment/Refund/Client.php
Client.byOutTradeNumber
public function byOutTradeNumber(string $number, string $refundNumber, int $totalFee, int $refundFee, array $optional = []) { return $this->refund($refundNumber, $totalFee, $refundFee, array_merge($optional, ['out_trade_no' => $number])); }
php
public function byOutTradeNumber(string $number, string $refundNumber, int $totalFee, int $refundFee, array $optional = []) { return $this->refund($refundNumber, $totalFee, $refundFee, array_merge($optional, ['out_trade_no' => $number])); }
[ "public", "function", "byOutTradeNumber", "(", "string", "$", "number", ",", "string", "$", "refundNumber", ",", "int", "$", "totalFee", ",", "int", "$", "refundFee", ",", "array", "$", "optional", "=", "[", "]", ")", "{", "return", "$", "this", "->", ...
Refund by out trade number. @param string $number @param string $refundNumber @param int $totalFee @param int $refundFee @param array $optional @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Refund", "by", "out", "trade", "number", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Refund/Client.php#L31-L34
208,105
overtrue/wechat
src/Payment/Refund/Client.php
Client.query
protected function query(string $number, string $type) { $params = [ 'appid' => $this->app['config']->app_id, $type => $number, ]; return $this->request($this->wrap('pay/refundquery'), $params); }
php
protected function query(string $number, string $type) { $params = [ 'appid' => $this->app['config']->app_id, $type => $number, ]; return $this->request($this->wrap('pay/refundquery'), $params); }
[ "protected", "function", "query", "(", "string", "$", "number", ",", "string", "$", "type", ")", "{", "$", "params", "=", "[", "'appid'", "=>", "$", "this", "->", "app", "[", "'config'", "]", "->", "app_id", ",", "$", "type", "=>", "$", "number", "...
Query refund. @param string $number @param string $type @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Query", "refund", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Refund/Client.php#L146-L154
208,106
overtrue/wechat
src/OfficialAccount/ShakeAround/RelationClient.php
RelationClient.listByPageId
public function listByPageId(int $pageId, int $begin, int $count) { $params = [ 'type' => 2, 'page_id' => $pageId, 'begin' => $begin, 'count' => $count, ]; return $this->httpPostJson('shakearound/relation/search', $params); }
php
public function listByPageId(int $pageId, int $begin, int $count) { $params = [ 'type' => 2, 'page_id' => $pageId, 'begin' => $begin, 'count' => $count, ]; return $this->httpPostJson('shakearound/relation/search', $params); }
[ "public", "function", "listByPageId", "(", "int", "$", "pageId", ",", "int", "$", "begin", ",", "int", "$", "count", ")", "{", "$", "params", "=", "[", "'type'", "=>", "2", ",", "'page_id'", "=>", "$", "pageId", ",", "'begin'", "=>", "$", "begin", ...
Get devices by pageId. @param int $pageId @param int $begin @param int $count @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
[ "Get", "devices", "by", "pageId", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/ShakeAround/RelationClient.php#L67-L77
208,107
overtrue/wechat
src/OpenPlatform/Application.php
Application.officialAccount
public function officialAccount(string $appId, string $refreshToken = null, AccessToken $accessToken = null): OfficialAccount { $application = new OfficialAccount($this->getAuthorizerConfig($appId, $refreshToken), $this->getReplaceServices($accessToken) + [ 'encryptor' => $this['encryptor'], ...
php
public function officialAccount(string $appId, string $refreshToken = null, AccessToken $accessToken = null): OfficialAccount { $application = new OfficialAccount($this->getAuthorizerConfig($appId, $refreshToken), $this->getReplaceServices($accessToken) + [ 'encryptor' => $this['encryptor'], ...
[ "public", "function", "officialAccount", "(", "string", "$", "appId", ",", "string", "$", "refreshToken", "=", "null", ",", "AccessToken", "$", "accessToken", "=", "null", ")", ":", "OfficialAccount", "{", "$", "application", "=", "new", "OfficialAccount", "("...
Creates the officialAccount application. @param string $appId @param string|null $refreshToken @param \EasyWeChat\OpenPlatform\Authorizer\Auth\AccessToken|null $accessToken @return \EasyWeChat\OpenPlatform\Authorizer\Offi...
[ "Creates", "the", "officialAccount", "application", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Application.php#L71-L87
208,108
overtrue/wechat
src/OpenPlatform/Application.php
Application.miniProgram
public function miniProgram(string $appId, string $refreshToken = null, AccessToken $accessToken = null): MiniProgram { return new MiniProgram($this->getAuthorizerConfig($appId, $refreshToken), $this->getReplaceServices($accessToken) + [ 'encryptor' => function () { return new En...
php
public function miniProgram(string $appId, string $refreshToken = null, AccessToken $accessToken = null): MiniProgram { return new MiniProgram($this->getAuthorizerConfig($appId, $refreshToken), $this->getReplaceServices($accessToken) + [ 'encryptor' => function () { return new En...
[ "public", "function", "miniProgram", "(", "string", "$", "appId", ",", "string", "$", "refreshToken", "=", "null", ",", "AccessToken", "$", "accessToken", "=", "null", ")", ":", "MiniProgram", "{", "return", "new", "MiniProgram", "(", "$", "this", "->", "g...
Creates the miniProgram application. @param string $appId @param string|null $refreshToken @param \EasyWeChat\OpenPlatform\Authorizer\Auth\AccessToken|null $accessToken @return \EasyWeChat\OpenPlatform\Authorizer\MiniProg...
[ "Creates", "the", "miniProgram", "application", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Application.php#L98-L109
208,109
overtrue/wechat
src/OpenPlatform/Application.php
Application.getPreAuthorizationUrl
public function getPreAuthorizationUrl(string $callbackUrl, $optional = []): string { // 兼容旧版 API 设计 if (\is_string($optional)) { $optional = [ 'pre_auth_code' => $optional, ]; } else { $optional['pre_auth_code'] = $this->createPreAuthoriza...
php
public function getPreAuthorizationUrl(string $callbackUrl, $optional = []): string { // 兼容旧版 API 设计 if (\is_string($optional)) { $optional = [ 'pre_auth_code' => $optional, ]; } else { $optional['pre_auth_code'] = $this->createPreAuthoriza...
[ "public", "function", "getPreAuthorizationUrl", "(", "string", "$", "callbackUrl", ",", "$", "optional", "=", "[", "]", ")", ":", "string", "{", "// 兼容旧版 API 设计", "if", "(", "\\", "is_string", "(", "$", "optional", ")", ")", "{", "$", "optional", "=", "[...
Return the pre-authorization login page url. @param string $callbackUrl @param string|array|null $optional @return string
[ "Return", "the", "pre", "-", "authorization", "login", "page", "url", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Application.php#L119-L136
208,110
octobercms/october
modules/system/classes/SettingsManager.php
SettingsManager.listItems
public function listItems($context = null) { if ($this->items === null) { $this->loadItems(); } if ($context !== null) { return $this->filterByContext($this->groupedItems, $context); } return $this->groupedItems; }
php
public function listItems($context = null) { if ($this->items === null) { $this->loadItems(); } if ($context !== null) { return $this->filterByContext($this->groupedItems, $context); } return $this->groupedItems; }
[ "public", "function", "listItems", "(", "$", "context", "=", "null", ")", "{", "if", "(", "$", "this", "->", "items", "===", "null", ")", "{", "$", "this", "->", "loadItems", "(", ")", ";", "}", "if", "(", "$", "context", "!==", "null", ")", "{",...
Returns a collection of all settings by group, filtered by context @param string $context @return array
[ "Returns", "a", "collection", "of", "all", "settings", "by", "group", "filtered", "by", "context" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SettingsManager.php#L151-L162
208,111
octobercms/october
modules/system/classes/SettingsManager.php
SettingsManager.filterByContext
protected function filterByContext($items, $context) { $filteredItems = []; foreach ($items as $categoryName => $category) { $filteredCategory = []; foreach ($category as $item) { $itemContext = is_array($item->context) ? $item->context : [$item->context]; ...
php
protected function filterByContext($items, $context) { $filteredItems = []; foreach ($items as $categoryName => $category) { $filteredCategory = []; foreach ($category as $item) { $itemContext = is_array($item->context) ? $item->context : [$item->context]; ...
[ "protected", "function", "filterByContext", "(", "$", "items", ",", "$", "context", ")", "{", "$", "filteredItems", "=", "[", "]", ";", "foreach", "(", "$", "items", "as", "$", "categoryName", "=>", "$", "category", ")", "{", "$", "filteredCategory", "="...
Filters a set of items by a given context. @param array $items @param string $context @return array
[ "Filters", "a", "set", "of", "items", "by", "a", "given", "context", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SettingsManager.php#L170-L189
208,112
octobercms/october
modules/system/classes/SettingsManager.php
SettingsManager.addSettingItems
public function addSettingItems($owner, array $definitions) { foreach ($definitions as $code => $definition) { $this->addSettingItem($owner, $code, $definition); } }
php
public function addSettingItems($owner, array $definitions) { foreach ($definitions as $code => $definition) { $this->addSettingItem($owner, $code, $definition); } }
[ "public", "function", "addSettingItems", "(", "$", "owner", ",", "array", "$", "definitions", ")", "{", "foreach", "(", "$", "definitions", "as", "$", "code", "=>", "$", "definition", ")", "{", "$", "this", "->", "addSettingItem", "(", "$", "owner", ",",...
Dynamically add an array of setting items @param string $owner @param array $definitions
[ "Dynamically", "add", "an", "array", "of", "setting", "items" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SettingsManager.php#L239-L244
208,113
octobercms/october
modules/system/classes/SettingsManager.php
SettingsManager.addSettingItem
public function addSettingItem($owner, $code, array $definition) { $itemKey = $this->makeItemKey($owner, $code); if (isset($this->items[$itemKey])) { $definition = array_merge((array) $this->items[$itemKey], $definition); } $item = array_merge(self::$itemDefaults, array...
php
public function addSettingItem($owner, $code, array $definition) { $itemKey = $this->makeItemKey($owner, $code); if (isset($this->items[$itemKey])) { $definition = array_merge((array) $this->items[$itemKey], $definition); } $item = array_merge(self::$itemDefaults, array...
[ "public", "function", "addSettingItem", "(", "$", "owner", ",", "$", "code", ",", "array", "$", "definition", ")", "{", "$", "itemKey", "=", "$", "this", "->", "makeItemKey", "(", "$", "owner", ",", "$", "code", ")", ";", "if", "(", "isset", "(", "...
Dynamically add a single setting item @param string $owner @param string $code @param array $definitions
[ "Dynamically", "add", "a", "single", "setting", "item" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SettingsManager.php#L252-L286
208,114
octobercms/october
modules/system/classes/SettingsManager.php
SettingsManager.removeSettingItem
public function removeSettingItem($owner, $code) { if (!$this->items) { throw new SystemException('Unable to remove settings item before items are loaded.'); } $itemKey = $this->makeItemKey($owner, $code); unset($this->items[$itemKey]); if ($this->groupedItems) ...
php
public function removeSettingItem($owner, $code) { if (!$this->items) { throw new SystemException('Unable to remove settings item before items are loaded.'); } $itemKey = $this->makeItemKey($owner, $code); unset($this->items[$itemKey]); if ($this->groupedItems) ...
[ "public", "function", "removeSettingItem", "(", "$", "owner", ",", "$", "code", ")", "{", "if", "(", "!", "$", "this", "->", "items", ")", "{", "throw", "new", "SystemException", "(", "'Unable to remove settings item before items are loaded.'", ")", ";", "}", ...
Removes a single setting item
[ "Removes", "a", "single", "setting", "item" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SettingsManager.php#L291-L307
208,115
octobercms/october
modules/system/classes/SettingsManager.php
SettingsManager.setContext
public static function setContext($owner, $code) { $instance = self::instance(); $instance->contextOwner = strtolower($owner); $instance->contextItemCode = strtolower($code); }
php
public static function setContext($owner, $code) { $instance = self::instance(); $instance->contextOwner = strtolower($owner); $instance->contextItemCode = strtolower($code); }
[ "public", "static", "function", "setContext", "(", "$", "owner", ",", "$", "code", ")", "{", "$", "instance", "=", "self", "::", "instance", "(", ")", ";", "$", "instance", "->", "contextOwner", "=", "strtolower", "(", "$", "owner", ")", ";", "$", "i...
Sets the navigation context. @param string $owner Specifies the setting items owner plugin or module in the format Vendor.Module. @param string $code Specifies the settings item code.
[ "Sets", "the", "navigation", "context", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SettingsManager.php#L314-L320
208,116
octobercms/october
modules/system/classes/SettingsManager.php
SettingsManager.findSettingItem
public function findSettingItem($owner, $code) { if ($this->items === null) { $this->loadItems(); } $owner = strtolower($owner); $code = strtolower($code); foreach ($this->items as $item) { if (strtolower($item->owner) == $owner && strtolower($item->...
php
public function findSettingItem($owner, $code) { if ($this->items === null) { $this->loadItems(); } $owner = strtolower($owner); $code = strtolower($code); foreach ($this->items as $item) { if (strtolower($item->owner) == $owner && strtolower($item->...
[ "public", "function", "findSettingItem", "(", "$", "owner", ",", "$", "code", ")", "{", "if", "(", "$", "this", "->", "items", "===", "null", ")", "{", "$", "this", "->", "loadItems", "(", ")", ";", "}", "$", "owner", "=", "strtolower", "(", "$", ...
Locates a setting item object by it's owner and code @param string $owner @param string $code @return mixed The item object or FALSE if nothing is found
[ "Locates", "a", "setting", "item", "object", "by", "it", "s", "owner", "and", "code" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SettingsManager.php#L342-L358
208,117
octobercms/october
modules/backend/widgets/table/DataSourceBase.php
DataSourceBase.readRecords
public function readRecords($count = 10) { $result = $this->getRecords($this->offset, $count); $this->offset += count($result); return $result; }
php
public function readRecords($count = 10) { $result = $this->getRecords($this->offset, $count); $this->offset += count($result); return $result; }
[ "public", "function", "readRecords", "(", "$", "count", "=", "10", ")", "{", "$", "result", "=", "$", "this", "->", "getRecords", "(", "$", "this", "->", "offset", ",", "$", "count", ")", ";", "$", "this", "->", "offset", "+=", "count", "(", "$", ...
Returns a set of records from the data source. @param integer $count Specifies the number of records to return. @return array Returns the records. If there are no more records, returns an empty array.
[ "Returns", "a", "set", "of", "records", "from", "the", "data", "source", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/table/DataSourceBase.php#L79-L85
208,118
octobercms/october
modules/backend/models/ExportModel.php
ExportModel.download
public function download($name, $outputName = null) { if (!preg_match('/^oc[0-9a-z]*$/i', $name)) { throw new ApplicationException(Lang::get('backend::lang.import_export.file_not_found_error')); } $csvPath = temp_path() . '/' . $name; if (!file_exists($csvPath)) { ...
php
public function download($name, $outputName = null) { if (!preg_match('/^oc[0-9a-z]*$/i', $name)) { throw new ApplicationException(Lang::get('backend::lang.import_export.file_not_found_error')); } $csvPath = temp_path() . '/' . $name; if (!file_exists($csvPath)) { ...
[ "public", "function", "download", "(", "$", "name", ",", "$", "outputName", "=", "null", ")", "{", "if", "(", "!", "preg_match", "(", "'/^oc[0-9a-z]*$/i'", ",", "$", "name", ")", ")", "{", "throw", "new", "ApplicationException", "(", "Lang", "::", "get",...
Download a previously compiled export file. @return void
[ "Download", "a", "previously", "compiled", "export", "file", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/ExportModel.php#L54-L66
208,119
octobercms/october
modules/backend/models/ExportModel.php
ExportModel.processExportData
protected function processExportData($columns, $results, $options) { /* * Validate */ if (!$results) { throw new ApplicationException(Lang::get('backend::lang.import_export.empty_error')); } /* * Parse options */ $defaultOption...
php
protected function processExportData($columns, $results, $options) { /* * Validate */ if (!$results) { throw new ApplicationException(Lang::get('backend::lang.import_export.empty_error')); } /* * Parse options */ $defaultOption...
[ "protected", "function", "processExportData", "(", "$", "columns", ",", "$", "results", ",", "$", "options", ")", "{", "/*\n * Validate\n */", "if", "(", "!", "$", "results", ")", "{", "throw", "new", "ApplicationException", "(", "Lang", "::", ...
Converts a data collection to a CSV file.
[ "Converts", "a", "data", "collection", "to", "a", "CSV", "file", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/ExportModel.php#L71-L147
208,120
octobercms/october
modules/backend/models/ExportModel.php
ExportModel.getColumnHeaders
protected function getColumnHeaders($columns) { $headers = []; foreach ($columns as $column => $label) { $headers[] = Lang::get($label); } return $headers; }
php
protected function getColumnHeaders($columns) { $headers = []; foreach ($columns as $column => $label) { $headers[] = Lang::get($label); } return $headers; }
[ "protected", "function", "getColumnHeaders", "(", "$", "columns", ")", "{", "$", "headers", "=", "[", "]", ";", "foreach", "(", "$", "columns", "as", "$", "column", "=>", "$", "label", ")", "{", "$", "headers", "[", "]", "=", "Lang", "::", "get", "...
Extracts the headers from the column definitions.
[ "Extracts", "the", "headers", "from", "the", "column", "definitions", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/ExportModel.php#L160-L169
208,121
octobercms/october
modules/backend/models/ExportModel.php
ExportModel.matchDataToColumns
protected function matchDataToColumns($data, $columns) { $results = []; foreach ($columns as $column => $label) { $results[] = array_get($data, $column); } return $results; }
php
protected function matchDataToColumns($data, $columns) { $results = []; foreach ($columns as $column => $label) { $results[] = array_get($data, $column); } return $results; }
[ "protected", "function", "matchDataToColumns", "(", "$", "data", ",", "$", "columns", ")", "{", "$", "results", "=", "[", "]", ";", "foreach", "(", "$", "columns", "as", "$", "column", "=>", "$", "label", ")", "{", "$", "results", "[", "]", "=", "a...
Ensures the correct order of the column data.
[ "Ensures", "the", "correct", "order", "of", "the", "column", "data", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/ExportModel.php#L174-L183
208,122
octobercms/october
modules/system/models/Parameter.php
Parameter.afterSave
public function afterSave() { Cache::forget(implode('-', [$this->table, $this->namespace, $this->group, $this->item])); }
php
public function afterSave() { Cache::forget(implode('-', [$this->table, $this->namespace, $this->group, $this->item])); }
[ "public", "function", "afterSave", "(", ")", "{", "Cache", "::", "forget", "(", "implode", "(", "'-'", ",", "[", "$", "this", "->", "table", ",", "$", "this", "->", "namespace", ",", "$", "this", "->", "group", ",", "$", "this", "->", "item", "]", ...
Clear the cache after saving.
[ "Clear", "the", "cache", "after", "saving", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/Parameter.php#L34-L37
208,123
octobercms/october
modules/system/models/Parameter.php
Parameter.set
public static function set($key, $value = null) { if (is_array($key)) { foreach ($key as $_key => $_value) { static::set($_key, $_value); } return true; } $record = static::findRecord($key); if (!$record) { $record = ne...
php
public static function set($key, $value = null) { if (is_array($key)) { foreach ($key as $_key => $_value) { static::set($_key, $_value); } return true; } $record = static::findRecord($key); if (!$record) { $record = ne...
[ "public", "static", "function", "set", "(", "$", "key", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "foreach", "(", "$", "key", "as", "$", "_key", "=>", "$", "_value", ")", "{", "static", "::...
Stores a setting value to the database. @param string $key Specifies the setting key value, for example 'system:updates.check' @param mixed $value The setting value to store, serializable. @return bool
[ "Stores", "a", "setting", "value", "to", "the", "database", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/Parameter.php#L65-L88
208,124
octobercms/october
modules/system/models/Parameter.php
Parameter.reset
public function reset($key) { $record = static::findRecord($key); if (!$record) { return false; } $record->delete(); unset(static::$cache[$key]); return true; }
php
public function reset($key) { $record = static::findRecord($key); if (!$record) { return false; } $record->delete(); unset(static::$cache[$key]); return true; }
[ "public", "function", "reset", "(", "$", "key", ")", "{", "$", "record", "=", "static", "::", "findRecord", "(", "$", "key", ")", ";", "if", "(", "!", "$", "record", ")", "{", "return", "false", ";", "}", "$", "record", "->", "delete", "(", ")", ...
Resets a setting value by deleting the record. @param string $key Specifies the setting key value. @return bool
[ "Resets", "a", "setting", "value", "by", "deleting", "the", "record", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/Parameter.php#L95-L106
208,125
octobercms/october
modules/cms/classes/CmsCompoundObject.php
CmsCompoundObject.validateSettings
protected function validateSettings() { if (isset($this->attributes[SectionParser::ERROR_INI])) { CmsException::mask($this, 200); Ini::parse($this->attributes[SectionParser::ERROR_INI]); CmsException::unmask(); } }
php
protected function validateSettings() { if (isset($this->attributes[SectionParser::ERROR_INI])) { CmsException::mask($this, 200); Ini::parse($this->attributes[SectionParser::ERROR_INI]); CmsException::unmask(); } }
[ "protected", "function", "validateSettings", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "attributes", "[", "SectionParser", "::", "ERROR_INI", "]", ")", ")", "{", "CmsException", "::", "mask", "(", "$", "this", ",", "200", ")", ";", "In...
If the model is loaded with an invalid INI section, the invalid content will be passed as a special attribute. Look for it, then locate the failure reason. @return void
[ "If", "the", "model", "is", "loaded", "with", "an", "invalid", "INI", "section", "the", "invalid", "content", "will", "be", "passed", "as", "a", "special", "attribute", ".", "Look", "for", "it", "then", "locate", "the", "failure", "reason", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L119-L126
208,126
octobercms/october
modules/cms/classes/CmsCompoundObject.php
CmsCompoundObject.checkSafeMode
protected function checkSafeMode() { $safeMode = Config::get('cms.enableSafeMode', null); if ($safeMode === null) { $safeMode = !Config::get('app.debug', false); } if ($safeMode && $this->isDirty('code') && strlen(trim($this->code))) { throw new ApplicationEx...
php
protected function checkSafeMode() { $safeMode = Config::get('cms.enableSafeMode', null); if ($safeMode === null) { $safeMode = !Config::get('app.debug', false); } if ($safeMode && $this->isDirty('code') && strlen(trim($this->code))) { throw new ApplicationEx...
[ "protected", "function", "checkSafeMode", "(", ")", "{", "$", "safeMode", "=", "Config", "::", "get", "(", "'cms.enableSafeMode'", ",", "null", ")", ";", "if", "(", "$", "safeMode", "===", "null", ")", "{", "$", "safeMode", "=", "!", "Config", "::", "g...
This method checks if safe mode is enabled by config, and the code attribute is modified and populated. If so an exception is thrown. @return void
[ "This", "method", "checks", "if", "safe", "mode", "is", "enabled", "by", "config", "and", "the", "code", "attribute", "is", "modified", "and", "populated", ".", "If", "so", "an", "exception", "is", "thrown", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L144-L154
208,127
octobercms/october
modules/cms/classes/CmsCompoundObject.php
CmsCompoundObject.runComponents
public function runComponents() { foreach ($this->components as $component) { if ($event = $component->fireEvent('component.beforeRun', [], true)) { return $event; } if ($result = $component->onRun()) { return $result; } ...
php
public function runComponents() { foreach ($this->components as $component) { if ($event = $component->fireEvent('component.beforeRun', [], true)) { return $event; } if ($result = $component->onRun()) { return $result; } ...
[ "public", "function", "runComponents", "(", ")", "{", "foreach", "(", "$", "this", "->", "components", "as", "$", "component", ")", "{", "if", "(", "$", "event", "=", "$", "component", "->", "fireEvent", "(", "'component.beforeRun'", ",", "[", "]", ",", ...
Runs components defined in the settings Process halts if a component returns a value @return void
[ "Runs", "components", "defined", "in", "the", "settings", "Process", "halts", "if", "a", "component", "returns", "a", "value" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L165-L180
208,128
octobercms/october
modules/cms/classes/CmsCompoundObject.php
CmsCompoundObject.getComponent
public function getComponent($componentName) { if (!($componentSection = $this->hasComponent($componentName))) { return null; } return ComponentManager::instance()->makeComponent( $componentName, null, $this->settings['components'][$componentS...
php
public function getComponent($componentName) { if (!($componentSection = $this->hasComponent($componentName))) { return null; } return ComponentManager::instance()->makeComponent( $componentName, null, $this->settings['components'][$componentS...
[ "public", "function", "getComponent", "(", "$", "componentName", ")", "{", "if", "(", "!", "(", "$", "componentSection", "=", "$", "this", "->", "hasComponent", "(", "$", "componentName", ")", ")", ")", "{", "return", "null", ";", "}", "return", "Compone...
Returns a component by its name. This method is used only in the back-end and for internal system needs when the standard way to access components is not an option. @param string $componentName Specifies the component name. @return \Cms\Classes\ComponentBase Returns the component instance or null.
[ "Returns", "a", "component", "by", "its", "name", ".", "This", "method", "is", "used", "only", "in", "the", "back", "-", "end", "and", "for", "internal", "system", "needs", "when", "the", "standard", "way", "to", "access", "components", "is", "not", "an"...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L216-L227
208,129
octobercms/october
modules/cms/classes/CmsCompoundObject.php
CmsCompoundObject.hasComponent
public function hasComponent($componentName) { $componentManager = ComponentManager::instance(); $componentName = $componentManager->resolve($componentName); foreach ($this->settings['components'] as $sectionName => $values) { $result = $sectionName; if ($sectionNa...
php
public function hasComponent($componentName) { $componentManager = ComponentManager::instance(); $componentName = $componentManager->resolve($componentName); foreach ($this->settings['components'] as $sectionName => $values) { $result = $sectionName; if ($sectionNa...
[ "public", "function", "hasComponent", "(", "$", "componentName", ")", "{", "$", "componentManager", "=", "ComponentManager", "::", "instance", "(", ")", ";", "$", "componentName", "=", "$", "componentManager", "->", "resolve", "(", "$", "componentName", ")", "...
Checks if the object has a component with the specified name. @param string $componentName Specifies the component name. @return mixed Return false or the full component name used on the page (it could include the alias).
[ "Checks", "if", "the", "object", "has", "a", "component", "with", "the", "specified", "name", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L234-L264
208,130
octobercms/october
modules/cms/classes/CmsCompoundObject.php
CmsCompoundObject.getComponentProperties
public function getComponentProperties($componentName) { $key = md5($this->theme->getPath()).'component-properties'; if (self::$objectComponentPropertyMap !== null) { $objectComponentMap = self::$objectComponentPropertyMap; } else { $cached = Cache::get($key,...
php
public function getComponentProperties($componentName) { $key = md5($this->theme->getPath()).'component-properties'; if (self::$objectComponentPropertyMap !== null) { $objectComponentMap = self::$objectComponentPropertyMap; } else { $cached = Cache::get($key,...
[ "public", "function", "getComponentProperties", "(", "$", "componentName", ")", "{", "$", "key", "=", "md5", "(", "$", "this", "->", "theme", "->", "getPath", "(", ")", ")", ".", "'component-properties'", ";", "if", "(", "self", "::", "$", "objectComponent...
Returns component property names and values. This method implements caching and can be used in the run-time on the front-end. @param string $componentName Specifies the component name. @return array Returns an associative array with property names in the keys and property values in the values.
[ "Returns", "component", "property", "names", "and", "values", ".", "This", "method", "implements", "caching", "and", "can", "be", "used", "in", "the", "run", "-", "time", "on", "the", "front", "-", "end", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L272-L332
208,131
octobercms/october
modules/cms/classes/CmsCompoundObject.php
CmsCompoundObject.getViewBag
public function getViewBag() { if ($this->viewBagCache !== false) { return $this->viewBagCache; } $componentName = 'viewBag'; if (!isset($this->settings['components'][$componentName])) { $viewBag = new ViewBag(null, []); $viewBag->name = $compone...
php
public function getViewBag() { if ($this->viewBagCache !== false) { return $this->viewBagCache; } $componentName = 'viewBag'; if (!isset($this->settings['components'][$componentName])) { $viewBag = new ViewBag(null, []); $viewBag->name = $compone...
[ "public", "function", "getViewBag", "(", ")", "{", "if", "(", "$", "this", "->", "viewBagCache", "!==", "false", ")", "{", "return", "$", "this", "->", "viewBagCache", ";", "}", "$", "componentName", "=", "'viewBag'", ";", "if", "(", "!", "isset", "(",...
Returns the configured view bag component. This method is used only in the back-end and for internal system needs when the standard way to access components is not an option. @return \Cms\Components\ViewBag Returns the view bag component instance.
[ "Returns", "the", "configured", "view", "bag", "component", ".", "This", "method", "is", "used", "only", "in", "the", "back", "-", "end", "and", "for", "internal", "system", "needs", "when", "the", "standard", "way", "to", "access", "components", "is", "no...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L355-L371
208,132
octobercms/october
modules/cms/classes/CmsCompoundObject.php
CmsCompoundObject.fillViewBagArray
protected function fillViewBagArray() { $viewBag = $this->getViewBag(); foreach ($viewBag->getProperties() as $name => $value) { $this->viewBag[$name] = $value; } $this->fireEvent('cmsObject.fillViewBagArray'); }
php
protected function fillViewBagArray() { $viewBag = $this->getViewBag(); foreach ($viewBag->getProperties() as $name => $value) { $this->viewBag[$name] = $value; } $this->fireEvent('cmsObject.fillViewBagArray'); }
[ "protected", "function", "fillViewBagArray", "(", ")", "{", "$", "viewBag", "=", "$", "this", "->", "getViewBag", "(", ")", ";", "foreach", "(", "$", "viewBag", "->", "getProperties", "(", ")", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "t...
Copies view bag properties to the view bag array. This is required for the back-end editors. @return void
[ "Copies", "view", "bag", "properties", "to", "the", "view", "bag", "array", ".", "This", "is", "required", "for", "the", "back", "-", "end", "editors", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L378-L386
208,133
octobercms/october
modules/cms/classes/CmsCompoundObject.php
CmsCompoundObject.getTwigNodeTree
public function getTwigNodeTree($markup = false) { $loader = new TwigLoader(); $twig = new Twig_Environment($loader, []); $twig->addExtension(new CmsTwigExtension()); $twig->addExtension(new SystemTwigExtension); $stream = $twig->tokenize(new Twig_Source($markup === false ? ...
php
public function getTwigNodeTree($markup = false) { $loader = new TwigLoader(); $twig = new Twig_Environment($loader, []); $twig->addExtension(new CmsTwigExtension()); $twig->addExtension(new SystemTwigExtension); $stream = $twig->tokenize(new Twig_Source($markup === false ? ...
[ "public", "function", "getTwigNodeTree", "(", "$", "markup", "=", "false", ")", "{", "$", "loader", "=", "new", "TwigLoader", "(", ")", ";", "$", "twig", "=", "new", "Twig_Environment", "(", "$", "loader", ",", "[", "]", ")", ";", "$", "twig", "->", ...
Returns Twig node tree generated from the object's markup. This method is used by the system internally and shouldn't participate in the front-end request processing. @link http://twig.sensiolabs.org/doc/internals.html Twig internals @param mixed $markup Specifies the markup content. Use FALSE to load the content from ...
[ "Returns", "Twig", "node", "tree", "generated", "from", "the", "object", "s", "markup", ".", "This", "method", "is", "used", "by", "the", "system", "internally", "and", "shouldn", "t", "participate", "in", "the", "front", "-", "end", "request", "processing",...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L410-L419
208,134
octobercms/october
modules/cms/classes/Theme.php
Theme.exists
public static function exists($dirName) { $theme = static::load($dirName); $path = $theme->getPath(); return File::isDirectory($path); }
php
public static function exists($dirName) { $theme = static::load($dirName); $path = $theme->getPath(); return File::isDirectory($path); }
[ "public", "static", "function", "exists", "(", "$", "dirName", ")", "{", "$", "theme", "=", "static", "::", "load", "(", "$", "dirName", ")", ";", "$", "path", "=", "$", "theme", "->", "getPath", "(", ")", ";", "return", "File", "::", "isDirectory", ...
Determines if a theme with given directory name exists @param string $dirName The theme directory @return bool
[ "Determines", "if", "a", "theme", "with", "given", "directory", "name", "exists" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L112-L118
208,135
octobercms/october
modules/cms/classes/Theme.php
Theme.getActiveTheme
public static function getActiveTheme() { if (self::$activeThemeCache !== false) { return self::$activeThemeCache; } $theme = static::load(static::getActiveThemeCode()); if (!File::isDirectory($theme->getPath())) { return self::$activeThemeCache = null; ...
php
public static function getActiveTheme() { if (self::$activeThemeCache !== false) { return self::$activeThemeCache; } $theme = static::load(static::getActiveThemeCode()); if (!File::isDirectory($theme->getPath())) { return self::$activeThemeCache = null; ...
[ "public", "static", "function", "getActiveTheme", "(", ")", "{", "if", "(", "self", "::", "$", "activeThemeCache", "!==", "false", ")", "{", "return", "self", "::", "$", "activeThemeCache", ";", "}", "$", "theme", "=", "static", "::", "load", "(", "stati...
Returns the active theme object. @return \Cms\Classes\Theme Returns the loaded theme object. If the theme doesn't exist, returns null.
[ "Returns", "the", "active", "theme", "object", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L202-L215
208,136
octobercms/october
modules/cms/classes/Theme.php
Theme.setActiveTheme
public static function setActiveTheme($code) { self::resetCache(); Parameter::set(self::ACTIVE_KEY, $code); /** * @event cms.theme.setActiveTheme * Fires when the active theme has been changed. * * If a value is returned from this halting event, it will ...
php
public static function setActiveTheme($code) { self::resetCache(); Parameter::set(self::ACTIVE_KEY, $code); /** * @event cms.theme.setActiveTheme * Fires when the active theme has been changed. * * If a value is returned from this halting event, it will ...
[ "public", "static", "function", "setActiveTheme", "(", "$", "code", ")", "{", "self", "::", "resetCache", "(", ")", ";", "Parameter", "::", "set", "(", "self", "::", "ACTIVE_KEY", ",", "$", "code", ")", ";", "/**\n * @event cms.theme.setActiveTheme\n ...
Sets the active theme. The active theme code is stored in the database and overrides the configuration cms.activeTheme parameter. @param string $code Specifies the active theme code.
[ "Sets", "the", "active", "theme", ".", "The", "active", "theme", "code", "is", "stored", "in", "the", "database", "and", "overrides", "the", "configuration", "cms", ".", "activeTheme", "parameter", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L222-L241
208,137
octobercms/october
modules/cms/classes/Theme.php
Theme.getEditTheme
public static function getEditTheme() { if (self::$editThemeCache !== false) { return self::$editThemeCache; } $theme = static::load(static::getEditThemeCode()); if (!File::isDirectory($theme->getPath())) { return self::$editThemeCache = null; } ...
php
public static function getEditTheme() { if (self::$editThemeCache !== false) { return self::$editThemeCache; } $theme = static::load(static::getEditThemeCode()); if (!File::isDirectory($theme->getPath())) { return self::$editThemeCache = null; } ...
[ "public", "static", "function", "getEditTheme", "(", ")", "{", "if", "(", "self", "::", "$", "editThemeCache", "!==", "false", ")", "{", "return", "self", "::", "$", "editThemeCache", ";", "}", "$", "theme", "=", "static", "::", "load", "(", "static", ...
Returns the edit theme. @return \Cms\Classes\Theme Returns the loaded theme object.
[ "Returns", "the", "edit", "theme", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L286-L299
208,138
octobercms/october
modules/cms/classes/Theme.php
Theme.all
public static function all() { $it = new DirectoryIterator(themes_path()); $it->rewind(); $result = []; foreach ($it as $fileinfo) { if (!$fileinfo->isDir() || $fileinfo->isDot()) { continue; } $theme = static::load($fileinfo->get...
php
public static function all() { $it = new DirectoryIterator(themes_path()); $it->rewind(); $result = []; foreach ($it as $fileinfo) { if (!$fileinfo->isDir() || $fileinfo->isDot()) { continue; } $theme = static::load($fileinfo->get...
[ "public", "static", "function", "all", "(", ")", "{", "$", "it", "=", "new", "DirectoryIterator", "(", "themes_path", "(", ")", ")", ";", "$", "it", "->", "rewind", "(", ")", ";", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "it", "as"...
Returns a list of all themes. @return array Returns an array of the Theme objects.
[ "Returns", "a", "list", "of", "all", "themes", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L305-L322
208,139
octobercms/october
modules/cms/classes/Theme.php
Theme.getConfig
public function getConfig() { if ($this->configCache !== null) { return $this->configCache; } $path = $this->getPath().'/theme.yaml'; if (!File::exists($path)) { return $this->configCache = []; } $config = Yaml::parseFile($path); /**...
php
public function getConfig() { if ($this->configCache !== null) { return $this->configCache; } $path = $this->getPath().'/theme.yaml'; if (!File::exists($path)) { return $this->configCache = []; } $config = Yaml::parseFile($path); /**...
[ "public", "function", "getConfig", "(", ")", "{", "if", "(", "$", "this", "->", "configCache", "!==", "null", ")", "{", "return", "$", "this", "->", "configCache", ";", "}", "$", "path", "=", "$", "this", "->", "getPath", "(", ")", ".", "'/theme.yaml...
Reads the theme.yaml file and returns the theme configuration values. @return array Returns the parsed configuration file values.
[ "Reads", "the", "theme", ".", "yaml", "file", "and", "returns", "the", "theme", "configuration", "values", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L328-L359
208,140
octobercms/october
modules/cms/classes/Theme.php
Theme.getFormConfig
public function getFormConfig() { $config = $this->getConfigArray('form'); /** * @event cms.theme.extendFormConfig * Extend form field configuration supplied by the theme by returning an array. * * Note if you are planning on using `assetVar` to inject CSS variab...
php
public function getFormConfig() { $config = $this->getConfigArray('form'); /** * @event cms.theme.extendFormConfig * Extend form field configuration supplied by the theme by returning an array. * * Note if you are planning on using `assetVar` to inject CSS variab...
[ "public", "function", "getFormConfig", "(", ")", "{", "$", "config", "=", "$", "this", "->", "getConfigArray", "(", "'form'", ")", ";", "/**\n * @event cms.theme.extendFormConfig\n * Extend form field configuration supplied by the theme by returning an array.\n ...
Themes have a dedicated `form` option that provide form fields for customization, this is an immutable accessor for that and also an solid anchor point for extension. @return array
[ "Themes", "have", "a", "dedicated", "form", "option", "that", "provide", "form", "fields", "for", "customization", "this", "is", "an", "immutable", "accessor", "for", "that", "and", "also", "an", "solid", "anchor", "point", "for", "extension", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L367-L394
208,141
octobercms/october
modules/cms/classes/Theme.php
Theme.getConfigArray
public function getConfigArray($name) { $result = array_get($this->getConfig(), $name, []); if (is_string($result)) { $fileName = File::symbolizePath($result); if (File::isLocalPath($fileName)) { $path = $fileName; } else { ...
php
public function getConfigArray($name) { $result = array_get($this->getConfig(), $name, []); if (is_string($result)) { $fileName = File::symbolizePath($result); if (File::isLocalPath($fileName)) { $path = $fileName; } else { ...
[ "public", "function", "getConfigArray", "(", "$", "name", ")", "{", "$", "result", "=", "array_get", "(", "$", "this", "->", "getConfig", "(", ")", ",", "$", "name", ",", "[", "]", ")", ";", "if", "(", "is_string", "(", "$", "result", ")", ")", "...
Returns an array value from the theme configuration file by its name. If the value is a string, it is treated as a YAML file and loaded. @param string $name Specifies the configuration parameter name. @return array
[ "Returns", "an", "array", "value", "from", "the", "theme", "configuration", "file", "by", "its", "name", ".", "If", "the", "value", "is", "a", "string", "it", "is", "treated", "as", "a", "YAML", "file", "and", "loaded", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L414-L436
208,142
octobercms/october
modules/cms/classes/Theme.php
Theme.writeConfig
public function writeConfig($values = [], $overwrite = false) { if (!$overwrite) { $values = $values + (array) $this->getConfig(); } $path = $this->getPath().'/theme.yaml'; if (!File::exists($path)) { throw new ApplicationException('Path does not exist: '.$pa...
php
public function writeConfig($values = [], $overwrite = false) { if (!$overwrite) { $values = $values + (array) $this->getConfig(); } $path = $this->getPath().'/theme.yaml'; if (!File::exists($path)) { throw new ApplicationException('Path does not exist: '.$pa...
[ "public", "function", "writeConfig", "(", "$", "values", "=", "[", "]", ",", "$", "overwrite", "=", "false", ")", "{", "if", "(", "!", "$", "overwrite", ")", "{", "$", "values", "=", "$", "values", "+", "(", "array", ")", "$", "this", "->", "getC...
Writes to the theme.yaml file with the supplied array values. @param array $values Data to write @param array $overwrite If true, undefined values are removed. @return void
[ "Writes", "to", "the", "theme", ".", "yaml", "file", "with", "the", "supplied", "array", "values", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L444-L458
208,143
octobercms/october
modules/cms/classes/Theme.php
Theme.getPreviewImageUrl
public function getPreviewImageUrl() { $previewPath = $this->getConfigValue('previewImage', 'assets/images/theme-preview.png'); if (File::exists($this->getPath().'/'.$previewPath)) { return Url::asset('themes/'.$this->getDirName().'/'.$previewPath); } return Url::asset(...
php
public function getPreviewImageUrl() { $previewPath = $this->getConfigValue('previewImage', 'assets/images/theme-preview.png'); if (File::exists($this->getPath().'/'.$previewPath)) { return Url::asset('themes/'.$this->getDirName().'/'.$previewPath); } return Url::asset(...
[ "public", "function", "getPreviewImageUrl", "(", ")", "{", "$", "previewPath", "=", "$", "this", "->", "getConfigValue", "(", "'previewImage'", ",", "'assets/images/theme-preview.png'", ")", ";", "if", "(", "File", "::", "exists", "(", "$", "this", "->", "getP...
Returns the theme preview image URL. If the image file doesn't exist returns the placeholder image URL. @return string Returns the image URL.
[ "Returns", "the", "theme", "preview", "image", "URL", ".", "If", "the", "image", "file", "doesn", "t", "exist", "returns", "the", "placeholder", "image", "URL", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L465-L474
208,144
octobercms/october
modules/cms/classes/Theme.php
Theme.resetCache
public static function resetCache() { self::$activeThemeCache = false; self::$editThemeCache = false; Cache::forget(self::ACTIVE_KEY); Cache::forget(self::EDIT_KEY); }
php
public static function resetCache() { self::$activeThemeCache = false; self::$editThemeCache = false; Cache::forget(self::ACTIVE_KEY); Cache::forget(self::EDIT_KEY); }
[ "public", "static", "function", "resetCache", "(", ")", "{", "self", "::", "$", "activeThemeCache", "=", "false", ";", "self", "::", "$", "editThemeCache", "=", "false", ";", "Cache", "::", "forget", "(", "self", "::", "ACTIVE_KEY", ")", ";", "Cache", ":...
Resets any memory or cache involved with the active or edit theme. @return void
[ "Resets", "any", "memory", "or", "cache", "involved", "with", "the", "active", "or", "edit", "theme", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L480-L487
208,145
octobercms/october
modules/cms/classes/Theme.php
Theme.registerHalyconDatasource
public function registerHalyconDatasource() { $resolver = App::make('halcyon'); if (!$resolver->hasDatasource($this->dirName)) { $datasource = new FileDatasource($this->getPath(), App::make('files')); $resolver->addDatasource($this->dirName, $datasource); } }
php
public function registerHalyconDatasource() { $resolver = App::make('halcyon'); if (!$resolver->hasDatasource($this->dirName)) { $datasource = new FileDatasource($this->getPath(), App::make('files')); $resolver->addDatasource($this->dirName, $datasource); } }
[ "public", "function", "registerHalyconDatasource", "(", ")", "{", "$", "resolver", "=", "App", "::", "make", "(", "'halcyon'", ")", ";", "if", "(", "!", "$", "resolver", "->", "hasDatasource", "(", "$", "this", "->", "dirName", ")", ")", "{", "$", "dat...
Ensures this theme is registered as a Halcyon them datasource. @return void
[ "Ensures", "this", "theme", "is", "registered", "as", "a", "Halcyon", "them", "datasource", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L511-L519
208,146
octobercms/october
modules/cms/widgets/AssetList.php
AssetList.validateFileType
protected function validateFileType($name) { $extension = strtolower(File::extension($name)); if (!in_array($extension, $this->assetExtensions)) { return false; } return true; }
php
protected function validateFileType($name) { $extension = strtolower(File::extension($name)); if (!in_array($extension, $this->assetExtensions)) { return false; } return true; }
[ "protected", "function", "validateFileType", "(", "$", "name", ")", "{", "$", "extension", "=", "strtolower", "(", "File", "::", "extension", "(", "$", "name", ")", ")", ";", "if", "(", "!", "in_array", "(", "$", "extension", ",", "$", "this", "->", ...
Check for valid asset file extension @param string @return bool
[ "Check", "for", "valid", "asset", "file", "extension" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/widgets/AssetList.php#L603-L612
208,147
octobercms/october
modules/cms/twig/Loader.php
Loader.getSourceContext
public function getSourceContext($name) { if (!$this->validateCmsObject($name)) { return parent::getSourceContext($name); } $content = $this->obj->getTwigContent(); /** * @event cms.template.processTwigContent * Provides an oportunity to modify Twig co...
php
public function getSourceContext($name) { if (!$this->validateCmsObject($name)) { return parent::getSourceContext($name); } $content = $this->obj->getTwigContent(); /** * @event cms.template.processTwigContent * Provides an oportunity to modify Twig co...
[ "public", "function", "getSourceContext", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "validateCmsObject", "(", "$", "name", ")", ")", "{", "return", "parent", "::", "getSourceContext", "(", "$", "name", ")", ";", "}", "$", "content"...
Returns the Twig content string. This step is cached internally by Twig.
[ "Returns", "the", "Twig", "content", "string", ".", "This", "step", "is", "cached", "internally", "by", "Twig", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Loader.php#L41-L64
208,148
octobercms/october
modules/cms/twig/Loader.php
Loader.getCacheKey
public function getCacheKey($name) { if (!$this->validateCmsObject($name)) { return parent::getCacheKey($name); } return $this->obj->getTwigCacheKey(); }
php
public function getCacheKey($name) { if (!$this->validateCmsObject($name)) { return parent::getCacheKey($name); } return $this->obj->getTwigCacheKey(); }
[ "public", "function", "getCacheKey", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "validateCmsObject", "(", "$", "name", ")", ")", "{", "return", "parent", "::", "getCacheKey", "(", "$", "name", ")", ";", "}", "return", "$", "this",...
Returns the Twig cache key.
[ "Returns", "the", "Twig", "cache", "key", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Loader.php#L69-L76
208,149
octobercms/october
modules/cms/twig/Loader.php
Loader.isFresh
public function isFresh($name, $time) { if (!$this->validateCmsObject($name)) { return parent::isFresh($name, $time); } return $this->obj->mtime <= $time; }
php
public function isFresh($name, $time) { if (!$this->validateCmsObject($name)) { return parent::isFresh($name, $time); } return $this->obj->mtime <= $time; }
[ "public", "function", "isFresh", "(", "$", "name", ",", "$", "time", ")", "{", "if", "(", "!", "$", "this", "->", "validateCmsObject", "(", "$", "name", ")", ")", "{", "return", "parent", "::", "isFresh", "(", "$", "name", ",", "$", "time", ")", ...
Determines if the content is fresh.
[ "Determines", "if", "the", "content", "is", "fresh", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Loader.php#L81-L88
208,150
octobercms/october
modules/cms/twig/Loader.php
Loader.getFilename
public function getFilename($name) { if (!$this->validateCmsObject($name)) { return parent::getFilename($name); } return $this->obj->getFilePath(); }
php
public function getFilename($name) { if (!$this->validateCmsObject($name)) { return parent::getFilename($name); } return $this->obj->getFilePath(); }
[ "public", "function", "getFilename", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "validateCmsObject", "(", "$", "name", ")", ")", "{", "return", "parent", "::", "getFilename", "(", "$", "name", ")", ";", "}", "return", "$", "this",...
Returns the file name of the loaded template.
[ "Returns", "the", "file", "name", "of", "the", "loaded", "template", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Loader.php#L93-L100
208,151
octobercms/october
modules/cms/twig/Loader.php
Loader.exists
public function exists($name) { if (!$this->validateCmsObject($name)) { return parent::exists($name); } return $this->obj->exists; }
php
public function exists($name) { if (!$this->validateCmsObject($name)) { return parent::exists($name); } return $this->obj->exists; }
[ "public", "function", "exists", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "validateCmsObject", "(", "$", "name", ")", ")", "{", "return", "parent", "::", "exists", "(", "$", "name", ")", ";", "}", "return", "$", "this", "->", ...
Checks that the template exists.
[ "Checks", "that", "the", "template", "exists", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Loader.php#L105-L112
208,152
octobercms/october
modules/cms/twig/Loader.php
Loader.validateCmsObject
protected function validateCmsObject($name) { if ($name === $this->obj->getFilePath()) { return true; } if ($fallbackObj = $this->findFallbackObject($name)) { $this->obj = $fallbackObj; return true; } return false; }
php
protected function validateCmsObject($name) { if ($name === $this->obj->getFilePath()) { return true; } if ($fallbackObj = $this->findFallbackObject($name)) { $this->obj = $fallbackObj; return true; } return false; }
[ "protected", "function", "validateCmsObject", "(", "$", "name", ")", "{", "if", "(", "$", "name", "===", "$", "this", "->", "obj", "->", "getFilePath", "(", ")", ")", "{", "return", "true", ";", "}", "if", "(", "$", "fallbackObj", "=", "$", "this", ...
Internal method that checks if the template name matches the loaded object, with fallback support to partials. @return bool
[ "Internal", "method", "that", "checks", "if", "the", "template", "name", "matches", "the", "loaded", "object", "with", "fallback", "support", "to", "partials", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Loader.php#L120-L132
208,153
octobercms/october
modules/cms/twig/Loader.php
Loader.findFallbackObject
protected function findFallbackObject($name) { if (strpos($name, '::') !== false) { return false; } if (array_key_exists($name, $this->fallbackCache)) { return $this->fallbackCache[$name]; } return $this->fallbackCache[$name] = CmsPartial::find($name...
php
protected function findFallbackObject($name) { if (strpos($name, '::') !== false) { return false; } if (array_key_exists($name, $this->fallbackCache)) { return $this->fallbackCache[$name]; } return $this->fallbackCache[$name] = CmsPartial::find($name...
[ "protected", "function", "findFallbackObject", "(", "$", "name", ")", "{", "if", "(", "strpos", "(", "$", "name", ",", "'::'", ")", "!==", "false", ")", "{", "return", "false", ";", "}", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "thi...
Looks up a fallback CMS partial object. @return Cms\Classes\Partial
[ "Looks", "up", "a", "fallback", "CMS", "partial", "object", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Loader.php#L138-L149
208,154
octobercms/october
modules/backend/traits/FormModelWidget.php
FormModelWidget.getRelationModel
protected function getRelationModel() { list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom); if (!$model) { throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [ 'class' => get_class($this->model), 'relat...
php
protected function getRelationModel() { list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom); if (!$model) { throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [ 'class' => get_class($this->model), 'relat...
[ "protected", "function", "getRelationModel", "(", ")", "{", "list", "(", "$", "model", ",", "$", "attribute", ")", "=", "$", "this", "->", "resolveModelAttribute", "(", "$", "this", "->", "valueFrom", ")", ";", "if", "(", "!", "$", "model", ")", "{", ...
Returns the model of a relation type, supports nesting via HTML array. @return Relation
[ "Returns", "the", "model", "of", "a", "relation", "type", "supports", "nesting", "via", "HTML", "array", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/FormModelWidget.php#L44-L63
208,155
octobercms/october
modules/backend/traits/FormModelWidget.php
FormModelWidget.getRelationObject
protected function getRelationObject() { list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom); if (!$model) { throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [ 'class' => get_class($this->model), 'rela...
php
protected function getRelationObject() { list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom); if (!$model) { throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [ 'class' => get_class($this->model), 'rela...
[ "protected", "function", "getRelationObject", "(", ")", "{", "list", "(", "$", "model", ",", "$", "attribute", ")", "=", "$", "this", "->", "resolveModelAttribute", "(", "$", "this", "->", "valueFrom", ")", ";", "if", "(", "!", "$", "model", ")", "{", ...
Returns the value as a relation object from the model, supports nesting via HTML array. @return Relation
[ "Returns", "the", "value", "as", "a", "relation", "object", "from", "the", "model", "supports", "nesting", "via", "HTML", "array", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/FormModelWidget.php#L70-L89
208,156
octobercms/october
modules/backend/traits/FormModelWidget.php
FormModelWidget.getRelationType
protected function getRelationType() { list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom); return $model->getRelationType($attribute); }
php
protected function getRelationType() { list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom); return $model->getRelationType($attribute); }
[ "protected", "function", "getRelationType", "(", ")", "{", "list", "(", "$", "model", ",", "$", "attribute", ")", "=", "$", "this", "->", "resolveModelAttribute", "(", "$", "this", "->", "valueFrom", ")", ";", "return", "$", "model", "->", "getRelationType...
Returns the value as a relation type from the model, supports nesting via HTML array. @return Relation
[ "Returns", "the", "value", "as", "a", "relation", "type", "from", "the", "model", "supports", "nesting", "via", "HTML", "array", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/FormModelWidget.php#L96-L100
208,157
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.update
public function update() { $firstUp = !Schema::hasTable($this->getMigrationTableName()); if ($firstUp) { $this->repository->createRepository(); $this->note('Migration table created'); } /* * Update modules */ $modules = Config::get('...
php
public function update() { $firstUp = !Schema::hasTable($this->getMigrationTableName()); if ($firstUp) { $this->repository->createRepository(); $this->note('Migration table created'); } /* * Update modules */ $modules = Config::get('...
[ "public", "function", "update", "(", ")", "{", "$", "firstUp", "=", "!", "Schema", "::", "hasTable", "(", "$", "this", "->", "getMigrationTableName", "(", ")", ")", ";", "if", "(", "$", "firstUp", ")", "{", "$", "this", "->", "repository", "->", "cre...
Creates the migration table and updates @return self
[ "Creates", "the", "migration", "table", "and", "updates" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L133-L171
208,158
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.uninstall
public function uninstall() { /* * Rollback plugins */ $plugins = $this->pluginManager->getPlugins(); foreach ($plugins as $name => $plugin) { $this->rollbackPlugin($name); } /* * Register module migration files */ $pat...
php
public function uninstall() { /* * Rollback plugins */ $plugins = $this->pluginManager->getPlugins(); foreach ($plugins as $name => $plugin) { $this->rollbackPlugin($name); } /* * Register module migration files */ $pat...
[ "public", "function", "uninstall", "(", ")", "{", "/*\n * Rollback plugins\n */", "$", "plugins", "=", "$", "this", "->", "pluginManager", "->", "getPlugins", "(", ")", ";", "foreach", "(", "$", "plugins", "as", "$", "name", "=>", "$", "plugin"...
Roll back all modules and plugins. @return self
[ "Roll", "back", "all", "modules", "and", "plugins", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L327-L365
208,159
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.setBuildNumberManually
public function setBuildNumberManually() { $postData = []; if (Config::get('cms.edgeUpdates', false)) { $postData['edge'] = 1; } $result = $this->requestServerData('ping', $postData); $build = (int) array_get($result, 'pong', 420); $this->setBuild($bui...
php
public function setBuildNumberManually() { $postData = []; if (Config::get('cms.edgeUpdates', false)) { $postData['edge'] = 1; } $result = $this->requestServerData('ping', $postData); $build = (int) array_get($result, 'pong', 420); $this->setBuild($bui...
[ "public", "function", "setBuildNumberManually", "(", ")", "{", "$", "postData", "=", "[", "]", ";", "if", "(", "Config", "::", "get", "(", "'cms.edgeUpdates'", ",", "false", ")", ")", "{", "$", "postData", "[", "'edge'", "]", "=", "1", ";", "}", "$",...
Asks the gateway for the lastest build number and stores it. @return void
[ "Asks", "the", "gateway", "for", "the", "lastest", "build", "number", "and", "stores", "it", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L371-L386
208,160
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.migrateModule
public function migrateModule($module) { $this->migrator->run(base_path() . '/modules/'.strtolower($module).'/database/migrations'); $this->note($module); foreach ($this->migrator->getNotes() as $note) { $this->note(' - '.$note); } return $this; }
php
public function migrateModule($module) { $this->migrator->run(base_path() . '/modules/'.strtolower($module).'/database/migrations'); $this->note($module); foreach ($this->migrator->getNotes() as $note) { $this->note(' - '.$note); } return $this; }
[ "public", "function", "migrateModule", "(", "$", "module", ")", "{", "$", "this", "->", "migrator", "->", "run", "(", "base_path", "(", ")", ".", "'/modules/'", ".", "strtolower", "(", "$", "module", ")", ".", "'/database/migrations'", ")", ";", "$", "th...
Run migrations on a single module @param string $module Module name @return self
[ "Run", "migrations", "on", "a", "single", "module" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L406-L417
208,161
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.seedModule
public function seedModule($module) { $className = '\\'.$module.'\Database\Seeds\DatabaseSeeder'; if (!class_exists($className)) { return; } $seeder = App::make($className); $seeder->run(); $this->note(sprintf('<info>Seeded %s</info> ', $module)); ...
php
public function seedModule($module) { $className = '\\'.$module.'\Database\Seeds\DatabaseSeeder'; if (!class_exists($className)) { return; } $seeder = App::make($className); $seeder->run(); $this->note(sprintf('<info>Seeded %s</info> ', $module)); ...
[ "public", "function", "seedModule", "(", "$", "module", ")", "{", "$", "className", "=", "'\\\\'", ".", "$", "module", ".", "'\\Database\\Seeds\\DatabaseSeeder'", ";", "if", "(", "!", "class_exists", "(", "$", "className", ")", ")", "{", "return", ";", "}"...
Run seeds on a module @param string $module Module name @return self
[ "Run", "seeds", "on", "a", "module" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L424-L436
208,162
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.extractCore
public function extractCore() { $filePath = $this->getFilePath('core'); if (!Zip::extract($filePath, $this->baseDirectory)) { throw new ApplicationException(Lang::get('system::lang.zip.extract_failed', ['file' => $filePath])); } @unlink($filePath); }
php
public function extractCore() { $filePath = $this->getFilePath('core'); if (!Zip::extract($filePath, $this->baseDirectory)) { throw new ApplicationException(Lang::get('system::lang.zip.extract_failed', ['file' => $filePath])); } @unlink($filePath); }
[ "public", "function", "extractCore", "(", ")", "{", "$", "filePath", "=", "$", "this", "->", "getFilePath", "(", "'core'", ")", ";", "if", "(", "!", "Zip", "::", "extract", "(", "$", "filePath", ",", "$", "this", "->", "baseDirectory", ")", ")", "{",...
Extracts the core after it has been downloaded. @return void
[ "Extracts", "the", "core", "after", "it", "has", "been", "downloaded", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L452-L461
208,163
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.setBuild
public function setBuild($build, $hash = null) { $params = [ 'system::core.build' => $build ]; if ($hash) { $params['system::core.hash'] = $hash; } Parameter::set($params); }
php
public function setBuild($build, $hash = null) { $params = [ 'system::core.build' => $build ]; if ($hash) { $params['system::core.hash'] = $hash; } Parameter::set($params); }
[ "public", "function", "setBuild", "(", "$", "build", ",", "$", "hash", "=", "null", ")", "{", "$", "params", "=", "[", "'system::core.build'", "=>", "$", "build", "]", ";", "if", "(", "$", "hash", ")", "{", "$", "params", "[", "'system::core.hash'", ...
Sets the build number and hash @param string $hash @param string $build @return void
[ "Sets", "the", "build", "number", "and", "hash" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L469-L480
208,164
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.updatePlugin
public function updatePlugin($name) { /* * Update the plugin database and version */ if (!($plugin = $this->pluginManager->findByIdentifier($name))) { $this->note('<error>Unable to find:</error> ' . $name); return; } $this->note($name); ...
php
public function updatePlugin($name) { /* * Update the plugin database and version */ if (!($plugin = $this->pluginManager->findByIdentifier($name))) { $this->note('<error>Unable to find:</error> ' . $name); return; } $this->note($name); ...
[ "public", "function", "updatePlugin", "(", "$", "name", ")", "{", "/*\n * Update the plugin database and version\n */", "if", "(", "!", "(", "$", "plugin", "=", "$", "this", "->", "pluginManager", "->", "findByIdentifier", "(", "$", "name", ")", ")...
Runs update on a single plugin @param string $name Plugin name. @return self
[ "Runs", "update", "on", "a", "single", "plugin" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L511-L533
208,165
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.rollbackPlugin
public function rollbackPlugin($name) { /* * Remove the plugin database and version */ if (!($plugin = $this->pluginManager->findByIdentifier($name)) && $this->versionManager->purgePlugin($name) ) { $this->note('<info>Purged from database:</info> ' ....
php
public function rollbackPlugin($name) { /* * Remove the plugin database and version */ if (!($plugin = $this->pluginManager->findByIdentifier($name)) && $this->versionManager->purgePlugin($name) ) { $this->note('<info>Purged from database:</info> ' ....
[ "public", "function", "rollbackPlugin", "(", "$", "name", ")", "{", "/*\n * Remove the plugin database and version\n */", "if", "(", "!", "(", "$", "plugin", "=", "$", "this", "->", "pluginManager", "->", "findByIdentifier", "(", "$", "name", ")", ...
Removes an existing plugin @param string $name Plugin name. @return self
[ "Removes", "an", "existing", "plugin" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L540-L560
208,166
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.downloadPlugin
public function downloadPlugin($name, $hash, $installation = false) { $fileCode = $name . $hash; $this->requestServerFile('plugin/get', $fileCode, $hash, [ 'name' => $name, 'installation' => $installation ? 1 : 0 ]); }
php
public function downloadPlugin($name, $hash, $installation = false) { $fileCode = $name . $hash; $this->requestServerFile('plugin/get', $fileCode, $hash, [ 'name' => $name, 'installation' => $installation ? 1 : 0 ]); }
[ "public", "function", "downloadPlugin", "(", "$", "name", ",", "$", "hash", ",", "$", "installation", "=", "false", ")", "{", "$", "fileCode", "=", "$", "name", ".", "$", "hash", ";", "$", "this", "->", "requestServerFile", "(", "'plugin/get'", ",", "$...
Downloads a plugin from the update server. @param string $name Plugin name. @param string $hash Expected file hash. @param boolean $installation Indicates whether this is a plugin installation request. @return self
[ "Downloads", "a", "plugin", "from", "the", "update", "server", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L569-L576
208,167
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.extractPlugin
public function extractPlugin($name, $hash) { $fileCode = $name . $hash; $filePath = $this->getFilePath($fileCode); if (!Zip::extract($filePath, $this->baseDirectory . '/plugins/')) { throw new ApplicationException(Lang::get('system::lang.zip.extract_failed', ['file' => $filePat...
php
public function extractPlugin($name, $hash) { $fileCode = $name . $hash; $filePath = $this->getFilePath($fileCode); if (!Zip::extract($filePath, $this->baseDirectory . '/plugins/')) { throw new ApplicationException(Lang::get('system::lang.zip.extract_failed', ['file' => $filePat...
[ "public", "function", "extractPlugin", "(", "$", "name", ",", "$", "hash", ")", "{", "$", "fileCode", "=", "$", "name", ".", "$", "hash", ";", "$", "filePath", "=", "$", "this", "->", "getFilePath", "(", "$", "fileCode", ")", ";", "if", "(", "!", ...
Extracts a plugin after it has been downloaded.
[ "Extracts", "a", "plugin", "after", "it", "has", "been", "downloaded", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L581-L591
208,168
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.downloadTheme
public function downloadTheme($name, $hash) { $fileCode = $name . $hash; $this->requestServerFile('theme/get', $fileCode, $hash, ['name' => $name]); }
php
public function downloadTheme($name, $hash) { $fileCode = $name . $hash; $this->requestServerFile('theme/get', $fileCode, $hash, ['name' => $name]); }
[ "public", "function", "downloadTheme", "(", "$", "name", ",", "$", "hash", ")", "{", "$", "fileCode", "=", "$", "name", ".", "$", "hash", ";", "$", "this", "->", "requestServerFile", "(", "'theme/get'", ",", "$", "fileCode", ",", "$", "hash", ",", "[...
Downloads a theme from the update server. @param string $name Theme name. @param string $hash Expected file hash. @return self
[ "Downloads", "a", "theme", "from", "the", "update", "server", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L613-L618
208,169
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.extractTheme
public function extractTheme($name, $hash) { $fileCode = $name . $hash; $filePath = $this->getFilePath($fileCode); if (!Zip::extract($filePath, $this->baseDirectory . '/themes/')) { throw new ApplicationException(Lang::get('system::lang.zip.extract_failed', ['file' => $filePath]...
php
public function extractTheme($name, $hash) { $fileCode = $name . $hash; $filePath = $this->getFilePath($fileCode); if (!Zip::extract($filePath, $this->baseDirectory . '/themes/')) { throw new ApplicationException(Lang::get('system::lang.zip.extract_failed', ['file' => $filePath]...
[ "public", "function", "extractTheme", "(", "$", "name", ",", "$", "hash", ")", "{", "$", "fileCode", "=", "$", "name", ".", "$", "hash", ";", "$", "filePath", "=", "$", "this", "->", "getFilePath", "(", "$", "fileCode", ")", ";", "if", "(", "!", ...
Extracts a theme after it has been downloaded.
[ "Extracts", "a", "theme", "after", "it", "has", "been", "downloaded", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L623-L637
208,170
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.requestPopularProducts
public function requestPopularProducts($type = null) { if ($type != 'plugin' && $type != 'theme') { $type = 'plugin'; } $cacheKey = 'system-updates-popular-'.$type; if (Cache::has($cacheKey)) { return @unserialize(@base64_decode(Cache::get($cacheKey))) ?: []...
php
public function requestPopularProducts($type = null) { if ($type != 'plugin' && $type != 'theme') { $type = 'plugin'; } $cacheKey = 'system-updates-popular-'.$type; if (Cache::has($cacheKey)) { return @unserialize(@base64_decode(Cache::get($cacheKey))) ?: []...
[ "public", "function", "requestPopularProducts", "(", "$", "type", "=", "null", ")", "{", "if", "(", "$", "type", "!=", "'plugin'", "&&", "$", "type", "!=", "'theme'", ")", "{", "$", "type", "=", "'plugin'", ";", "}", "$", "cacheKey", "=", "'system-upda...
Returns popular themes found on the marketplace.
[ "Returns", "popular", "themes", "found", "on", "the", "marketplace", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L693-L716
208,171
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.note
protected function note($message) { if ($this->notesOutput !== null) { $this->notesOutput->writeln($message); } else { $this->notes[] = $message; } return $this; }
php
protected function note($message) { if ($this->notesOutput !== null) { $this->notesOutput->writeln($message); } else { $this->notes[] = $message; } return $this; }
[ "protected", "function", "note", "(", "$", "message", ")", "{", "if", "(", "$", "this", "->", "notesOutput", "!==", "null", ")", "{", "$", "this", "->", "notesOutput", "->", "writeln", "(", "$", "message", ")", ";", "}", "else", "{", "$", "this", "...
Raise a note event for the migrator. @param string $message @return self
[ "Raise", "a", "note", "event", "for", "the", "migrator", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L760-L770
208,172
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.requestServerData
public function requestServerData($uri, $postData = []) { $result = Http::post($this->createServerUrl($uri), function ($http) use ($postData) { $this->applyHttpAttributes($http, $postData); }); if ($result->code == 404) { throw new ApplicationException(Lang::get('sys...
php
public function requestServerData($uri, $postData = []) { $result = Http::post($this->createServerUrl($uri), function ($http) use ($postData) { $this->applyHttpAttributes($http, $postData); }); if ($result->code == 404) { throw new ApplicationException(Lang::get('sys...
[ "public", "function", "requestServerData", "(", "$", "uri", ",", "$", "postData", "=", "[", "]", ")", "{", "$", "result", "=", "Http", "::", "post", "(", "$", "this", "->", "createServerUrl", "(", "$", "uri", ")", ",", "function", "(", "$", "http", ...
Contacts the update server for a response. @param string $uri Gateway API URI @param array $postData Extra post data @return array
[ "Contacts", "the", "update", "server", "for", "a", "response", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L816-L848
208,173
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.requestServerFile
public function requestServerFile($uri, $fileCode, $expectedHash, $postData = []) { $filePath = $this->getFilePath($fileCode); $result = Http::post($this->createServerUrl($uri), function ($http) use ($postData, $filePath) { $this->applyHttpAttributes($http, $postData); $http...
php
public function requestServerFile($uri, $fileCode, $expectedHash, $postData = []) { $filePath = $this->getFilePath($fileCode); $result = Http::post($this->createServerUrl($uri), function ($http) use ($postData, $filePath) { $this->applyHttpAttributes($http, $postData); $http...
[ "public", "function", "requestServerFile", "(", "$", "uri", ",", "$", "fileCode", ",", "$", "expectedHash", ",", "$", "postData", "=", "[", "]", ")", "{", "$", "filePath", "=", "$", "this", "->", "getFilePath", "(", "$", "fileCode", ")", ";", "$", "r...
Downloads a file from the update server. @param string $uri Gateway API URI @param string $fileCode A unique code for saving the file. @param string $expectedHash The expected file hash of the file. @param array $postData Extra post data @return void
[ "Downloads", "a", "file", "from", "the", "update", "server", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L858-L875
208,174
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.createServerUrl
protected function createServerUrl($uri) { $gateway = Config::get('cms.updateServer', 'http://gateway.octobercms.com/api'); if (substr($gateway, -1) != '/') { $gateway .= '/'; } return $gateway . $uri; }
php
protected function createServerUrl($uri) { $gateway = Config::get('cms.updateServer', 'http://gateway.octobercms.com/api'); if (substr($gateway, -1) != '/') { $gateway .= '/'; } return $gateway . $uri; }
[ "protected", "function", "createServerUrl", "(", "$", "uri", ")", "{", "$", "gateway", "=", "Config", "::", "get", "(", "'cms.updateServer'", ",", "'http://gateway.octobercms.com/api'", ")", ";", "if", "(", "substr", "(", "$", "gateway", ",", "-", "1", ")", ...
Create a complete gateway server URL from supplied URI @param string $uri URI @return string URL
[ "Create", "a", "complete", "gateway", "server", "URL", "from", "supplied", "URI" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L904-L912
208,175
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.applyHttpAttributes
protected function applyHttpAttributes($http, $postData) { $postData['protocol_version'] = '1.1'; $postData['client'] = 'october'; $postData['server'] = base64_encode(serialize([ 'php' => PHP_VERSION, 'url' => Url::to('/'), 'since' => PluginVersion::o...
php
protected function applyHttpAttributes($http, $postData) { $postData['protocol_version'] = '1.1'; $postData['client'] = 'october'; $postData['server'] = base64_encode(serialize([ 'php' => PHP_VERSION, 'url' => Url::to('/'), 'since' => PluginVersion::o...
[ "protected", "function", "applyHttpAttributes", "(", "$", "http", ",", "$", "postData", ")", "{", "$", "postData", "[", "'protocol_version'", "]", "=", "'1.1'", ";", "$", "postData", "[", "'client'", "]", "=", "'october'", ";", "$", "postData", "[", "'serv...
Modifies the Network HTTP object with common attributes. @param Http $http Network object @param array $postData Post data @return void
[ "Modifies", "the", "Network", "HTTP", "object", "with", "common", "attributes", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L920-L951
208,176
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.createSignature
protected function createSignature($data, $secret) { return base64_encode(hash_hmac('sha512', http_build_query($data, '', '&'), base64_decode($secret), true)); }
php
protected function createSignature($data, $secret) { return base64_encode(hash_hmac('sha512', http_build_query($data, '', '&'), base64_decode($secret), true)); }
[ "protected", "function", "createSignature", "(", "$", "data", ",", "$", "secret", ")", "{", "return", "base64_encode", "(", "hash_hmac", "(", "'sha512'", ",", "http_build_query", "(", "$", "data", ",", "''", ",", "'&'", ")", ",", "base64_decode", "(", "$",...
Create a unique signature for transmission. @return string
[ "Create", "a", "unique", "signature", "for", "transmission", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L967-L970
208,177
octobercms/october
modules/backend/controllers/Files.php
Files.get
public function get($code = null) { try { return $this->findFileObject($code)->output('inline', true); } catch (Exception $ex) {} return Response::make(View::make('backend::404'), 404); }
php
public function get($code = null) { try { return $this->findFileObject($code)->output('inline', true); } catch (Exception $ex) {} return Response::make(View::make('backend::404'), 404); }
[ "public", "function", "get", "(", "$", "code", "=", "null", ")", "{", "try", "{", "return", "$", "this", "->", "findFileObject", "(", "$", "code", ")", "->", "output", "(", "'inline'", ",", "true", ")", ";", "}", "catch", "(", "Exception", "$", "ex...
Output file, or fall back on the 404 page
[ "Output", "file", "or", "fall", "back", "on", "the", "404", "page" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Files.php#L26-L34
208,178
octobercms/october
modules/backend/controllers/Files.php
Files.thumb
public function thumb($code = null, $width = 100, $height = 100, $mode = 'auto', $extension = 'auto') { try { return $this->findFileObject($code)->outputThumb( $width, $height, compact('mode', 'extension'), true ); ...
php
public function thumb($code = null, $width = 100, $height = 100, $mode = 'auto', $extension = 'auto') { try { return $this->findFileObject($code)->outputThumb( $width, $height, compact('mode', 'extension'), true ); ...
[ "public", "function", "thumb", "(", "$", "code", "=", "null", ",", "$", "width", "=", "100", ",", "$", "height", "=", "100", ",", "$", "mode", "=", "'auto'", ",", "$", "extension", "=", "'auto'", ")", "{", "try", "{", "return", "$", "this", "->",...
Output thumbnail, or fall back on the 404 page
[ "Output", "thumbnail", "or", "fall", "back", "on", "the", "404", "page" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Files.php#L39-L52
208,179
octobercms/october
modules/backend/controllers/Files.php
Files.getThumbUrl
public static function getThumbUrl($file, $width, $height, $options) { return Backend::url('backend/files/thumb/' . self::getUniqueCode($file)) . '/' . $width . '/' . $height . '/' . $options['mode'] . '/' . $options['extension']; }
php
public static function getThumbUrl($file, $width, $height, $options) { return Backend::url('backend/files/thumb/' . self::getUniqueCode($file)) . '/' . $width . '/' . $height . '/' . $options['mode'] . '/' . $options['extension']; }
[ "public", "static", "function", "getThumbUrl", "(", "$", "file", ",", "$", "width", ",", "$", "height", ",", "$", "options", ")", "{", "return", "Backend", "::", "url", "(", "'backend/files/thumb/'", ".", "self", "::", "getUniqueCode", "(", "$", "file", ...
Returns the URL for downloading a system file. @param $file System\Models\File @param $width int @param $height int @param $options array @return string
[ "Returns", "the", "URL", "for", "downloading", "a", "system", "file", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Files.php#L72-L75
208,180
octobercms/october
modules/backend/controllers/Files.php
Files.getUniqueCode
public static function getUniqueCode($file) { if (!$file) { return null; } $hash = md5($file->file_name . '!' . $file->disk_name); return base64_encode($file->id . '!' . $hash); }
php
public static function getUniqueCode($file) { if (!$file) { return null; } $hash = md5($file->file_name . '!' . $file->disk_name); return base64_encode($file->id . '!' . $hash); }
[ "public", "static", "function", "getUniqueCode", "(", "$", "file", ")", "{", "if", "(", "!", "$", "file", ")", "{", "return", "null", ";", "}", "$", "hash", "=", "md5", "(", "$", "file", "->", "file_name", ".", "'!'", ".", "$", "file", "->", "dis...
Returns a unique code used for masking the file identifier. @param $file System\Models\File @return string
[ "Returns", "a", "unique", "code", "used", "for", "masking", "the", "file", "identifier", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Files.php#L82-L90
208,181
octobercms/october
modules/backend/controllers/Files.php
Files.findFileObject
protected function findFileObject($code) { if (!$code) { throw new ApplicationException('Missing code'); } $parts = explode('!', base64_decode($code)); if (count($parts) < 2) { throw new ApplicationException('Invalid code'); } list($id, $hash...
php
protected function findFileObject($code) { if (!$code) { throw new ApplicationException('Missing code'); } $parts = explode('!', base64_decode($code)); if (count($parts) < 2) { throw new ApplicationException('Invalid code'); } list($id, $hash...
[ "protected", "function", "findFileObject", "(", "$", "code", ")", "{", "if", "(", "!", "$", "code", ")", "{", "throw", "new", "ApplicationException", "(", "'Missing code'", ")", ";", "}", "$", "parts", "=", "explode", "(", "'!'", ",", "base64_decode", "(...
Locates a file model based on the unique code. @param $code string @return System\Models\File
[ "Locates", "a", "file", "model", "based", "on", "the", "unique", "code", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Files.php#L97-L137
208,182
octobercms/october
modules/cms/controllers/ThemeOptions.php
ThemeOptions.formExtendFields
public function formExtendFields($form) { $model = $form->model; $theme = $this->findThemeObject($model->theme); $config = $theme->getFormConfig(); if ($fields = array_get($config, 'fields')) { $form->addFields($fields); } if ($fields = array_get($config...
php
public function formExtendFields($form) { $model = $form->model; $theme = $this->findThemeObject($model->theme); $config = $theme->getFormConfig(); if ($fields = array_get($config, 'fields')) { $form->addFields($fields); } if ($fields = array_get($config...
[ "public", "function", "formExtendFields", "(", "$", "form", ")", "{", "$", "model", "=", "$", "form", "->", "model", ";", "$", "theme", "=", "$", "this", "->", "findThemeObject", "(", "$", "model", "->", "theme", ")", ";", "$", "config", "=", "$", ...
Add form fields defined in theme.yaml
[ "Add", "form", "fields", "defined", "in", "theme", ".", "yaml" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/ThemeOptions.php#L84-L101
208,183
octobercms/october
modules/cms/controllers/ThemeOptions.php
ThemeOptions.getDirName
protected function getDirName($dirName = null) { /* * Only the active theme can be managed without this permission */ if ($dirName && !$this->user->hasAccess('cms.manage_themes')) { $dirName = null; } if ($dirName === null) { $dirName = CmsT...
php
protected function getDirName($dirName = null) { /* * Only the active theme can be managed without this permission */ if ($dirName && !$this->user->hasAccess('cms.manage_themes')) { $dirName = null; } if ($dirName === null) { $dirName = CmsT...
[ "protected", "function", "getDirName", "(", "$", "dirName", "=", "null", ")", "{", "/*\n * Only the active theme can be managed without this permission\n */", "if", "(", "$", "dirName", "&&", "!", "$", "this", "->", "user", "->", "hasAccess", "(", "'cm...
Default to the active theme if user doesn't have access to manage all themes
[ "Default", "to", "the", "active", "theme", "if", "user", "doesn", "t", "have", "access", "to", "manage", "all", "themes" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/ThemeOptions.php#L110-L124
208,184
octobercms/october
modules/backend/formwidgets/RichEditor.php
RichEditor.evalToolbarButtons
protected function evalToolbarButtons() { $buttons = $this->toolbarButtons; if (is_string($buttons)) { $buttons = array_map(function ($button) { return strlen($button) ? $button : '|'; }, explode('|', $buttons)); } return $buttons; }
php
protected function evalToolbarButtons() { $buttons = $this->toolbarButtons; if (is_string($buttons)) { $buttons = array_map(function ($button) { return strlen($button) ? $button : '|'; }, explode('|', $buttons)); } return $buttons; }
[ "protected", "function", "evalToolbarButtons", "(", ")", "{", "$", "buttons", "=", "$", "this", "->", "toolbarButtons", ";", "if", "(", "is_string", "(", "$", "buttons", ")", ")", "{", "$", "buttons", "=", "array_map", "(", "function", "(", "$", "button"...
Determine the toolbar buttons to use based on config. @return string
[ "Determine", "the", "toolbar", "buttons", "to", "use", "based", "on", "config", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/RichEditor.php#L106-L117
208,185
octobercms/october
modules/backend/formwidgets/RichEditor.php
RichEditor.getValidEditorLang
protected function getValidEditorLang() { $locale = App::getLocale(); // English is baked in if ($locale == 'en') { return null; } $locale = str_replace('-', '_', strtolower($locale)); $path = base_path('modules/backend/formwidgets/richeditor/assets/vend...
php
protected function getValidEditorLang() { $locale = App::getLocale(); // English is baked in if ($locale == 'en') { return null; } $locale = str_replace('-', '_', strtolower($locale)); $path = base_path('modules/backend/formwidgets/richeditor/assets/vend...
[ "protected", "function", "getValidEditorLang", "(", ")", "{", "$", "locale", "=", "App", "::", "getLocale", "(", ")", ";", "// English is baked in", "if", "(", "$", "locale", "==", "'en'", ")", "{", "return", "null", ";", "}", "$", "locale", "=", "str_re...
Returns a valid language code for Redactor. @return string|mixed
[ "Returns", "a", "valid", "language", "code", "for", "Redactor", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/RichEditor.php#L143-L156
208,186
octobercms/october
modules/backend/formwidgets/RichEditor.php
RichEditor.getPageLinkTypes
protected function getPageLinkTypes() { $result = []; $apiResult = Event::fire('backend.richeditor.listTypes'); if (is_array($apiResult)) { foreach ($apiResult as $typeList) { if (!is_array($typeList)) { continue; } ...
php
protected function getPageLinkTypes() { $result = []; $apiResult = Event::fire('backend.richeditor.listTypes'); if (is_array($apiResult)) { foreach ($apiResult as $typeList) { if (!is_array($typeList)) { continue; } ...
[ "protected", "function", "getPageLinkTypes", "(", ")", "{", "$", "result", "=", "[", "]", ";", "$", "apiResult", "=", "Event", "::", "fire", "(", "'backend.richeditor.listTypes'", ")", ";", "if", "(", "is_array", "(", "$", "apiResult", ")", ")", "{", "fo...
Returns a list of registered page link types. This is reserved functionality for separating the links by type. @return array Returns an array of registered page link types
[ "Returns", "a", "list", "of", "registered", "page", "link", "types", ".", "This", "is", "reserved", "functionality", "for", "separating", "the", "links", "by", "type", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/RichEditor.php#L163-L181
208,187
octobercms/october
modules/backend/formwidgets/RichEditor.php
RichEditor.getPageLinksArray
protected function getPageLinksArray() { $links = []; $types = $this->getPageLinkTypes(); $links[] = ['name' => Lang::get('backend::lang.pagelist.select_page'), 'url' => false]; $iterator = function ($links, $level = 0) use (&$iterator) { $result = []; forea...
php
protected function getPageLinksArray() { $links = []; $types = $this->getPageLinkTypes(); $links[] = ['name' => Lang::get('backend::lang.pagelist.select_page'), 'url' => false]; $iterator = function ($links, $level = 0) use (&$iterator) { $result = []; forea...
[ "protected", "function", "getPageLinksArray", "(", ")", "{", "$", "links", "=", "[", "]", ";", "$", "types", "=", "$", "this", "->", "getPageLinkTypes", "(", ")", ";", "$", "links", "[", "]", "=", "[", "'name'", "=>", "Lang", "::", "get", "(", "'ba...
Returns a single collection of available page links. This implementation has room to place links under different groups based on the link type. @return array
[ "Returns", "a", "single", "collection", "of", "available", "page", "links", ".", "This", "implementation", "has", "room", "to", "place", "links", "under", "different", "groups", "based", "on", "the", "link", "type", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/RichEditor.php#L208-L247
208,188
octobercms/october
modules/backend/formwidgets/FileUpload.php
FileUpload.getPromptText
protected function getPromptText() { if ($this->prompt === null) { $isMulti = ends_with($this->getDisplayMode(), 'multi'); $this->prompt = $isMulti ? 'backend::lang.fileupload.upload_file' : 'backend::lang.fileupload.default_prompt'; } ...
php
protected function getPromptText() { if ($this->prompt === null) { $isMulti = ends_with($this->getDisplayMode(), 'multi'); $this->prompt = $isMulti ? 'backend::lang.fileupload.upload_file' : 'backend::lang.fileupload.default_prompt'; } ...
[ "protected", "function", "getPromptText", "(", ")", "{", "if", "(", "$", "this", "->", "prompt", "===", "null", ")", "{", "$", "isMulti", "=", "ends_with", "(", "$", "this", "->", "getDisplayMode", "(", ")", ",", "'multi'", ")", ";", "$", "this", "->...
Returns the escaped and translated prompt text to display according to the type. @return string
[ "Returns", "the", "escaped", "and", "translated", "prompt", "text", "to", "display", "according", "to", "the", "type", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/FileUpload.php#L186-L196
208,189
octobercms/october
modules/backend/formwidgets/FileUpload.php
FileUpload.getCssDimensions
protected function getCssDimensions($mode = null) { if (!$this->imageWidth && !$this->imageHeight) { return ''; } $cssDimensions = ''; if ($mode == 'block') { $cssDimensions .= $this->imageWidth ? 'width: '.$this->imageWidth.'px;' ...
php
protected function getCssDimensions($mode = null) { if (!$this->imageWidth && !$this->imageHeight) { return ''; } $cssDimensions = ''; if ($mode == 'block') { $cssDimensions .= $this->imageWidth ? 'width: '.$this->imageWidth.'px;' ...
[ "protected", "function", "getCssDimensions", "(", "$", "mode", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "imageWidth", "&&", "!", "$", "this", "->", "imageHeight", ")", "{", "return", "''", ";", "}", "$", "cssDimensions", "=", "''", "...
Returns the CSS dimensions for the uploaded image, uses auto where no dimension is provided. @param string $mode @return string
[ "Returns", "the", "CSS", "dimensions", "for", "the", "uploaded", "image", "uses", "auto", "where", "no", "dimension", "is", "provided", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/FileUpload.php#L204-L232
208,190
octobercms/october
modules/backend/formwidgets/FileUpload.php
FileUpload.onRemoveAttachment
public function onRemoveAttachment() { $fileModel = $this->getRelationModel(); if (($fileId = post('file_id')) && ($file = $fileModel::find($fileId))) { $this->getRelationObject()->remove($file, $this->sessionKey); } }
php
public function onRemoveAttachment() { $fileModel = $this->getRelationModel(); if (($fileId = post('file_id')) && ($file = $fileModel::find($fileId))) { $this->getRelationObject()->remove($file, $this->sessionKey); } }
[ "public", "function", "onRemoveAttachment", "(", ")", "{", "$", "fileModel", "=", "$", "this", "->", "getRelationModel", "(", ")", ";", "if", "(", "(", "$", "fileId", "=", "post", "(", "'file_id'", ")", ")", "&&", "(", "$", "file", "=", "$", "fileMod...
Removes a file attachment.
[ "Removes", "a", "file", "attachment", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/FileUpload.php#L277-L283
208,191
octobercms/october
modules/backend/formwidgets/FileUpload.php
FileUpload.onSortAttachments
public function onSortAttachments() { if ($sortData = post('sortOrder')) { $ids = array_keys($sortData); $orders = array_values($sortData); $fileModel = $this->getRelationModel(); $fileModel->setSortableOrder($ids, $orders); } }
php
public function onSortAttachments() { if ($sortData = post('sortOrder')) { $ids = array_keys($sortData); $orders = array_values($sortData); $fileModel = $this->getRelationModel(); $fileModel->setSortableOrder($ids, $orders); } }
[ "public", "function", "onSortAttachments", "(", ")", "{", "if", "(", "$", "sortData", "=", "post", "(", "'sortOrder'", ")", ")", "{", "$", "ids", "=", "array_keys", "(", "$", "sortData", ")", ";", "$", "orders", "=", "array_values", "(", "$", "sortData...
Sorts file attachments.
[ "Sorts", "file", "attachments", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/FileUpload.php#L288-L297
208,192
octobercms/october
modules/backend/formwidgets/FileUpload.php
FileUpload.onLoadAttachmentConfig
public function onLoadAttachmentConfig() { $fileModel = $this->getRelationModel(); if (($fileId = post('file_id')) && ($file = $fileModel::find($fileId))) { $file = $this->decorateFileAttributes($file); $this->vars['file'] = $file; $this->vars['displayMode'] = $t...
php
public function onLoadAttachmentConfig() { $fileModel = $this->getRelationModel(); if (($fileId = post('file_id')) && ($file = $fileModel::find($fileId))) { $file = $this->decorateFileAttributes($file); $this->vars['file'] = $file; $this->vars['displayMode'] = $t...
[ "public", "function", "onLoadAttachmentConfig", "(", ")", "{", "$", "fileModel", "=", "$", "this", "->", "getRelationModel", "(", ")", ";", "if", "(", "(", "$", "fileId", "=", "post", "(", "'file_id'", ")", ")", "&&", "(", "$", "file", "=", "$", "fil...
Loads the configuration form for an attachment, allowing title and description to be set.
[ "Loads", "the", "configuration", "form", "for", "an", "attachment", "allowing", "title", "and", "description", "to", "be", "set", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/FileUpload.php#L302-L318
208,193
octobercms/october
modules/backend/formwidgets/FileUpload.php
FileUpload.onSaveAttachmentConfig
public function onSaveAttachmentConfig() { try { $fileModel = $this->getRelationModel(); if (($fileId = post('file_id')) && ($file = $fileModel::find($fileId))) { $file->title = post('title'); $file->description = post('description'); $...
php
public function onSaveAttachmentConfig() { try { $fileModel = $this->getRelationModel(); if (($fileId = post('file_id')) && ($file = $fileModel::find($fileId))) { $file->title = post('title'); $file->description = post('description'); $...
[ "public", "function", "onSaveAttachmentConfig", "(", ")", "{", "try", "{", "$", "fileModel", "=", "$", "this", "->", "getRelationModel", "(", ")", ";", "if", "(", "(", "$", "fileId", "=", "post", "(", "'file_id'", ")", ")", "&&", "(", "$", "file", "=...
Commit the changes of the attachment configuration form.
[ "Commit", "the", "changes", "of", "the", "attachment", "configuration", "form", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/FileUpload.php#L323-L340
208,194
octobercms/october
modules/backend/formwidgets/FileUpload.php
FileUpload.decorateFileAttributes
protected function decorateFileAttributes($file) { /* * File is protected, create a secure public path */ if (!$file->isPublic()) { $path = $thumb = FilesController::getDownloadUrl($file); if ($this->imageWidth || $this->imageHeight) { $thum...
php
protected function decorateFileAttributes($file) { /* * File is protected, create a secure public path */ if (!$file->isPublic()) { $path = $thumb = FilesController::getDownloadUrl($file); if ($this->imageWidth || $this->imageHeight) { $thum...
[ "protected", "function", "decorateFileAttributes", "(", "$", "file", ")", "{", "/*\n * File is protected, create a secure public path\n */", "if", "(", "!", "$", "file", "->", "isPublic", "(", ")", ")", "{", "$", "path", "=", "$", "thumb", "=", "Fi...
Adds the bespoke attributes used internally by this widget. - thumbUrl - pathUrl @return System\Models\File
[ "Adds", "the", "bespoke", "attributes", "used", "internally", "by", "this", "widget", ".", "-", "thumbUrl", "-", "pathUrl" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/FileUpload.php#L441-L468
208,195
octobercms/october
modules/cms/controllers/Index.php
Index.index
public function index() { $this->addJs('/modules/cms/assets/js/october.cmspage.js', 'core'); $this->addJs('/modules/cms/assets/js/october.dragcomponents.js', 'core'); $this->addJs('/modules/cms/assets/js/october.tokenexpander.js', 'core'); $this->addCss('/modules/cms/assets/css/octob...
php
public function index() { $this->addJs('/modules/cms/assets/js/october.cmspage.js', 'core'); $this->addJs('/modules/cms/assets/js/october.dragcomponents.js', 'core'); $this->addJs('/modules/cms/assets/js/october.tokenexpander.js', 'core'); $this->addCss('/modules/cms/assets/css/octob...
[ "public", "function", "index", "(", ")", "{", "$", "this", "->", "addJs", "(", "'/modules/cms/assets/js/october.cmspage.js'", ",", "'core'", ")", ";", "$", "this", "->", "addJs", "(", "'/modules/cms/assets/js/october.dragcomponents.js'", ",", "'core'", ")", ";", "...
Index page action @return void
[ "Index", "page", "action" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L103-L121
208,196
octobercms/october
modules/cms/controllers/Index.php
Index.index_onOpenTemplate
public function index_onOpenTemplate() { $this->validateRequestTheme(); $type = Request::input('type'); $template = $this->loadTemplate($type, Request::input('path')); $widget = $this->makeTemplateFormWidget($type, $template); $this->vars['templatePath'] = Request::input('p...
php
public function index_onOpenTemplate() { $this->validateRequestTheme(); $type = Request::input('type'); $template = $this->loadTemplate($type, Request::input('path')); $widget = $this->makeTemplateFormWidget($type, $template); $this->vars['templatePath'] = Request::input('p...
[ "public", "function", "index_onOpenTemplate", "(", ")", "{", "$", "this", "->", "validateRequestTheme", "(", ")", ";", "$", "type", "=", "Request", "::", "input", "(", "'type'", ")", ";", "$", "template", "=", "$", "this", "->", "loadTemplate", "(", "$",...
Opens an existing template from the index page @return array
[ "Opens", "an", "existing", "template", "from", "the", "index", "page" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L127-L152
208,197
octobercms/october
modules/cms/controllers/Index.php
Index.onSave
public function onSave() { $this->validateRequestTheme(); $type = Request::input('templateType'); $templatePath = trim(Request::input('templatePath')); $template = $templatePath ? $this->loadTemplate($type, $templatePath) : $this->createTemplate($type); $formWidget = $this->m...
php
public function onSave() { $this->validateRequestTheme(); $type = Request::input('templateType'); $templatePath = trim(Request::input('templatePath')); $template = $templatePath ? $this->loadTemplate($type, $templatePath) : $this->createTemplate($type); $formWidget = $this->m...
[ "public", "function", "onSave", "(", ")", "{", "$", "this", "->", "validateRequestTheme", "(", ")", ";", "$", "type", "=", "Request", "::", "input", "(", "'templateType'", ")", ";", "$", "templatePath", "=", "trim", "(", "Request", "::", "input", "(", ...
Saves the template currently open @return array
[ "Saves", "the", "template", "currently", "open" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L158-L242
208,198
octobercms/october
modules/cms/controllers/Index.php
Index.onCreateTemplate
public function onCreateTemplate() { $type = Request::input('type'); $template = $this->createTemplate($type); if ($type === 'asset') { $template->fileName = $this->widget->assetList->getCurrentRelativePath(); } $widget = $this->makeTemplateFormWidget($type, $te...
php
public function onCreateTemplate() { $type = Request::input('type'); $template = $this->createTemplate($type); if ($type === 'asset') { $template->fileName = $this->widget->assetList->getCurrentRelativePath(); } $widget = $this->makeTemplateFormWidget($type, $te...
[ "public", "function", "onCreateTemplate", "(", ")", "{", "$", "type", "=", "Request", "::", "input", "(", "'type'", ")", ";", "$", "template", "=", "$", "this", "->", "createTemplate", "(", "$", "type", ")", ";", "if", "(", "$", "type", "===", "'asse...
Create a new template @return array
[ "Create", "a", "new", "template" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L257-L279
208,199
octobercms/october
modules/cms/controllers/Index.php
Index.onDeleteTemplates
public function onDeleteTemplates() { $this->validateRequestTheme(); $type = Request::input('type'); $templates = Request::input('template'); $error = null; $deleted = []; try { foreach ($templates as $path => $selected) { if ($selected) ...
php
public function onDeleteTemplates() { $this->validateRequestTheme(); $type = Request::input('type'); $templates = Request::input('template'); $error = null; $deleted = []; try { foreach ($templates as $path => $selected) { if ($selected) ...
[ "public", "function", "onDeleteTemplates", "(", ")", "{", "$", "this", "->", "validateRequestTheme", "(", ")", ";", "$", "type", "=", "Request", "::", "input", "(", "'type'", ")", ";", "$", "templates", "=", "Request", "::", "input", "(", "'template'", "...
Deletes multiple templates at the same time @return array
[ "Deletes", "multiple", "templates", "at", "the", "same", "time" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L285-L330