mirror of
				https://github.com/getgrav/grav.git
				synced 2025-11-03 20:05:49 +01:00 
			
		
		
		
	Merge branches 'develop' and 'feature/refactor' of https://github.com/getgrav/grav into feature/refactor
# Conflicts: # CHANGELOG.md # composer.lock
This commit is contained in:
		
							
								
								
									
										47
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								CHANGELOG.md
									
									
									
									
									
								
							@@ -7,12 +7,55 @@
 | 
			
		||||
    * Data objects: Lazy load blueprints only if needed
 | 
			
		||||
    * Refactor Config classes
 | 
			
		||||
 | 
			
		||||
# v1.0.0-rc.5
 | 
			
		||||
# v1.0.0-rc.6
 | 
			
		||||
## XX/XX/2015
 | 
			
		||||
 | 
			
		||||
1. [](#bugfix)
 | 
			
		||||
    * Fixed help output for `bin/plugin`
 | 
			
		||||
 | 
			
		||||
# v1.0.0-rc.5
 | 
			
		||||
## 11/20/2015
 | 
			
		||||
 | 
			
		||||
1. [](#new)
 | 
			
		||||
    * Added **nonce** functionality for all admin forms for improved security
 | 
			
		||||
    * Implemented the ability for Plugins to provide their own CLI commands through `bin/plugin`
 | 
			
		||||
    * Fixed gzip compression making it to work correctly with all servers and browsers
 | 
			
		||||
    * Added Croatian translation
 | 
			
		||||
    * Added missing `umask_fix` property to `system.yaml`
 | 
			
		||||
    * Added current theme's config to global config. E.g. `config.theme.dropdown_enabled`
 | 
			
		||||
    * Added `append_url_extension` option to system config & page headers
 | 
			
		||||
    * Users have a new `state` property to allow disabling/banning
 | 
			
		||||
    * Added new `Page.relativePagePath()` helper method
 | 
			
		||||
    * Added new `|pad` Twig filter for strings (uses `str_pad()`)
 | 
			
		||||
    * Added `lighttpd.conf` for Lightly web server
 | 
			
		||||
1. [](#improved)
 | 
			
		||||
    * Clear previously applied operations when doing a reset on image media
 | 
			
		||||
    * Password no longer required when editing user
 | 
			
		||||
    * Improved support for trailing `/` URLs
 | 
			
		||||
    * Improved `.nginx.conf` configuration file
 | 
			
		||||
    * Improved `.htaccess` security
 | 
			
		||||
    * Updated vendor libs
 | 
			
		||||
    * Updated `composer.phar`
 | 
			
		||||
    * Use streams instead of paths for `clearCache()`
 | 
			
		||||
    * Use PCRE_UTF8 so unicode strings can be regexed in Truncator
 | 
			
		||||
    * Handle case when login plugin is disabled
 | 
			
		||||
    * Improved `quality` functionality in media handling
 | 
			
		||||
    * Added some missing translation strings
 | 
			
		||||
    * Deprecated `bin/grav newuser` in favor of `bin/plugin login new-user`
 | 
			
		||||
    * Moved fallback types to use any valid media type
 | 
			
		||||
    * Renamed `system.pages.fallback_types` to `system.media.allowed_fallback_types`
 | 
			
		||||
    * Removed version number in default `generator` meta tag
 | 
			
		||||
    * Disable time limit in case of slow downloads
 | 
			
		||||
    * Removed default hash in `system.yaml`
 | 
			
		||||
1. [](#bugfix)
 | 
			
		||||
    * Fix for media using absolute URLs causing broken links
 | 
			
		||||
    * Fix theme auto-loading #432
 | 
			
		||||
    * Don't create empty `<style>` or `<script>` scripts if no data
 | 
			
		||||
    * Code cleanups
 | 
			
		||||
    * Fix undefined variable in Config class
 | 
			
		||||
    * Fix exception message when label is not set
 | 
			
		||||
    * Check in `Plugins::get()` to ensure plugins exists
 | 
			
		||||
    * Fixed GZip compression making output buffering work correctly with all servers and browsers
 | 
			
		||||
    * Fixed date representation in system config
 | 
			
		||||
 | 
			
		||||
# v1.0.0-rc.4
 | 
			
		||||
## 10/29/2015
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@@ -44,7 +44,7 @@ $grav['plugins']->init();
 | 
			
		||||
$grav['themes']->init();
 | 
			
		||||
 | 
			
		||||
$app     = new Application('Grav Plugins Commands', GRAV_VERSION);
 | 
			
		||||
$pattern = '/([A-Z]\w+Command\.php)$/usm';
 | 
			
		||||
$pattern = '([A-Z]\w+Command\.php)';
 | 
			
		||||
 | 
			
		||||
// get arguments and  strip the application name
 | 
			
		||||
if (null === $argv) {
 | 
			
		||||
@@ -70,7 +70,7 @@ if (!$name) {
 | 
			
		||||
    $output->writeln('');
 | 
			
		||||
    $output->writeln("<red>Example:</red>");
 | 
			
		||||
    $output->writeln("  {$bin} error log -l 1 --trace");
 | 
			
		||||
    $list = Folder::all('plugins://', ['compare' => 'Pathname', 'pattern' => '\/cli\/' . $pattern]);
 | 
			
		||||
    $list = Folder::all('plugins://', ['compare' => 'Pathname', 'pattern' => '/\/cli\/' . $pattern . '$/usm']);
 | 
			
		||||
 | 
			
		||||
    if (count($list)) {
 | 
			
		||||
        $available = [];
 | 
			
		||||
@@ -101,7 +101,7 @@ if ($plugin === null) {
 | 
			
		||||
$path = 'plugins://' . $name . '/cli';
 | 
			
		||||
 | 
			
		||||
try {
 | 
			
		||||
    $commands = Folder::all($path, ['compare' => 'Filename', 'pattern' => $pattern]);
 | 
			
		||||
    $commands = Folder::all($path, ['compare' => 'Filename', 'pattern' => '/' . $pattern . '$/usm']);
 | 
			
		||||
} catch (\RuntimeException $e) {
 | 
			
		||||
    $output->writeln("<red>No Console Commands for <white>'{$name}'</white> where found in <white>'{$path}'</white></red>");
 | 
			
		||||
    exit;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							@@ -226,7 +226,7 @@
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
                "php": ">=5.3.0"
 | 
			
		||||
                "php": ">=5.3.3"
 | 
			
		||||
            },
 | 
			
		||||
            "require-dev": {
 | 
			
		||||
                "mockery/mockery": "0.9.*"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										48
									
								
								lighttpd.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								lighttpd.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
############# DO NOT FORGET TO CHANGE "grav_path" BY YOUR ACTUAL GRAV INSTALLATION FOLDER #############
 | 
			
		||||
############# IF GRAV IS AT THE ROOT OF YOUR WEBSITE, ie http://yoursite.tld POINTS TO    #############
 | 
			
		||||
############# GRAV DIRECTLY, THEN JUST REMOVE ANY "/grav_path/" MENTION BELOW. OTHERWISE  #############
 | 
			
		||||
############# WE ASSUME YOU RUN AN INSTALLATION SUCH AS http://yoursite.tld/grav_path/    #############
 | 
			
		||||
#######################################################################################################
 | 
			
		||||
### GRAV RULES FOR LIGHTTPD ###
 | 
			
		||||
###        By Mr3ase        ###
 | 
			
		||||
###  Last Rev. 2015/11/20   ###
 | 
			
		||||
 | 
			
		||||
#PREVENTING EXPLOITS
 | 
			
		||||
$HTTP["querystring"] =~ "base64_encode[^(]*\([^)]*\)" {
 | 
			
		||||
    url.redirect = (".*" => "/grav_path/index.php"       )
 | 
			
		||||
}
 | 
			
		||||
$HTTP["querystring"] =~ "(<|%3C)([^s]*s)+cript.*(>|%3E)" {
 | 
			
		||||
    url.redirect = (".*" => "/grav_path/index.php" )
 | 
			
		||||
}
 | 
			
		||||
$HTTP["querystring"] =~ "GLOBALS(=|\[|\%[0-9A-Z])" {
 | 
			
		||||
    url.redirect = (".*" => "/grav_path/index.php" )
 | 
			
		||||
}
 | 
			
		||||
$HTTP["querystring"] =~ "_REQUEST(=|\[|\%[0-9A-Z])" {
 | 
			
		||||
    url.redirect = (".*" => "/grav_path/index.php" )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#REROUTING TO THE INDEX PAGE
 | 
			
		||||
url.rewrite-if-not-file = (
 | 
			
		||||
    "^/grav_path/(.*)$" => "/grav_path/index.php"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
#IMPROVING SECURITY
 | 
			
		||||
$HTTP["url"] =~ "^/grav_path/(LICENSE|composer.json|composer.lock|nginx.conf|web.config)$" {
 | 
			
		||||
    url.access-deny = ("")
 | 
			
		||||
}
 | 
			
		||||
$HTTP["url"] =~ "^/grav_path/(.git|cache|bin|logs|backup)/(.*)" {
 | 
			
		||||
    url.access-deny = ("")
 | 
			
		||||
}
 | 
			
		||||
$HTTP["url"] =~ "^/grav_path/(system|user|vendor)/(.*)\.(txt|md|html|yaml|php|twig|sh|bat)$" {
 | 
			
		||||
    url.access-deny = ("")
 | 
			
		||||
}
 | 
			
		||||
$HTTP["url"] =~ "^/grav_path/(\.(.*))|(\.(.*)/)" {
 | 
			
		||||
    url.access-deny = ("")
 | 
			
		||||
}
 | 
			
		||||
url.access-deny = (".md","~",".inc")
 | 
			
		||||
 | 
			
		||||
#PREVENT BROWSING AND SET INDEXES
 | 
			
		||||
$HTTP["url"] =~ "^/grav_path($|/)" {
 | 
			
		||||
    dir-listing.activate = "disable"
 | 
			
		||||
    index-file.names = ( "index.php", "index.html" , "index.htm" )
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								robots.txt
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								robots.txt
									
									
									
									
									
								
							@@ -1,2 +1,11 @@
 | 
			
		||||
User-agent: *
 | 
			
		||||
Disallow:
 | 
			
		||||
Disallow: /backup/
 | 
			
		||||
Disallow: /bin/
 | 
			
		||||
Disallow: /cache/
 | 
			
		||||
Disallow: /grav/
 | 
			
		||||
Disallow: /logs/
 | 
			
		||||
Disallow: /system/
 | 
			
		||||
Disallow: /vendor/
 | 
			
		||||
Disallow: /user/
 | 
			
		||||
Allow: /user/pages/
 | 
			
		||||
Allow: /user/themes/
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
// Some standard defines
 | 
			
		||||
define('GRAV', true);
 | 
			
		||||
define('GRAV_VERSION', '1.0.0-rc.4');
 | 
			
		||||
define('GRAV_VERSION', '1.0.0-rc.5');
 | 
			
		||||
define('DS', '/');
 | 
			
		||||
 | 
			
		||||
// Directories and Paths
 | 
			
		||||
 
 | 
			
		||||
@@ -1,26 +1,60 @@
 | 
			
		||||
FRONTMATTER_ERROR_PAGE: "---\ntitle: %1$s\n---\n\n# Erreur : Frontmatter invalide\n\nPath: `%2$s`\n\n**%3$s**\n\n```\n%4$s\n```"
 | 
			
		||||
INFLECTOR_PLURALS:
 | 
			
		||||
    '/$/': 's'
 | 
			
		||||
    '/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)$/': '\1x'
 | 
			
		||||
    '/(bleu|émeu|landau|lieu|pneu|sarrau)$/': '\1s'
 | 
			
		||||
    '/(b|cor|ém|gemm|soupir|trav|vant|vitr)ail$/': '\1aux'
 | 
			
		||||
    '/(s|x|z)$/': '\1'
 | 
			
		||||
    '/ail$/': 'ails'
 | 
			
		||||
    '/al$/': 'aux'
 | 
			
		||||
    '/(quiz)$/i': '\1zes'
 | 
			
		||||
    '/^(ox)$/i': '\1en'
 | 
			
		||||
    '/([m|l])ouse$/i': '\1ice'
 | 
			
		||||
    '/(matr|vert|ind)ix|ex$/i': '\1ices'
 | 
			
		||||
    '/(x|ch|ss|sh)$/i': '\1es'
 | 
			
		||||
    '/([^aeiouy]|qu)ies$/i': '\1y'
 | 
			
		||||
    '/([^aeiouy]|qu)y$/i': '\1ies'
 | 
			
		||||
    '/(hive)$/i': '\1s'
 | 
			
		||||
    '/(?:([^f])fe|([lr])f)$/i': '\1\2ves'
 | 
			
		||||
    '/sis$/i': 'ses'
 | 
			
		||||
    '/([ti])um$/i': '\1a'
 | 
			
		||||
    '/(buffal|tomat)o$/i': '\1oes'
 | 
			
		||||
    '/(bu)s$/i': '\1ses'
 | 
			
		||||
    '/(alias|status)/i': '\1es'
 | 
			
		||||
    '/(octop|vir)us$/i': '\1i'
 | 
			
		||||
    '/(ax|test)is$/i': '\1es'
 | 
			
		||||
    '/s$/i': 's'
 | 
			
		||||
    '/$/': 's'
 | 
			
		||||
INFLECTOR_SINGULAR:
 | 
			
		||||
    '/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)x$/': '\1'
 | 
			
		||||
    '/(b|cor|ém|gemm|soupir|trav|vant|vitr)aux$/': '\1ail'
 | 
			
		||||
    '/(journ|chev)aux$/': '\1al'
 | 
			
		||||
    '/ails$/': 'ail'
 | 
			
		||||
    '/(quiz)zes$/i': '\1'
 | 
			
		||||
    '/(matr)ices$/i': '\1ix'
 | 
			
		||||
    '/(vert|ind)ices$/i': '\1ex'
 | 
			
		||||
    '/^(ox)en/i': '\1'
 | 
			
		||||
    '/(alias|status)es$/i': '\1'
 | 
			
		||||
    '/([octop|vir])i$/i': '\1us'
 | 
			
		||||
    '/(cris|ax|test)es$/i': '\1is'
 | 
			
		||||
    '/(shoe)s$/i': '\1'
 | 
			
		||||
    '/(o)es$/i': '\1'
 | 
			
		||||
    '/(bus)es$/i': '\1'
 | 
			
		||||
    '/([m|l])ice$/i': '\1ouse'
 | 
			
		||||
    '/(x|ch|ss|sh)es$/i': '\1'
 | 
			
		||||
    '/(m)ovies$/i': '\1ovie'
 | 
			
		||||
    '/(s)eries$/i': '\1eries'
 | 
			
		||||
    '/([^aeiouy]|qu)ies$/i': '\1y'
 | 
			
		||||
    '/([lr])ves$/i': '\1f'
 | 
			
		||||
    '/(tive)s$/i': '\1'
 | 
			
		||||
    '/(hive)s$/i': '\1'
 | 
			
		||||
    '/([^f])ves$/i': '\1fe'
 | 
			
		||||
    '/(^analy)ses$/i': '\1sis'
 | 
			
		||||
    '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i': '\1\2sis'
 | 
			
		||||
    '/([ti])a$/i': '\1um'
 | 
			
		||||
    '/(n)ews$/i': '\1ews'
 | 
			
		||||
    '/s$/i': ''
 | 
			
		||||
INFLECTOR_UNCOUNTABLE: ['équipment', 'information', 'riz', 'argent', 'espèces', 'séries', 'poisson', 'mouton']
 | 
			
		||||
INFLECTOR_IRREGULAR:
 | 
			
		||||
    'madame': 'mesdames'
 | 
			
		||||
    'mademoiselle': 'mesdemoiselles'
 | 
			
		||||
    'monsieur': 'messieurs'
 | 
			
		||||
    'person': 'personnes'
 | 
			
		||||
    'man': 'Hommes'
 | 
			
		||||
    'child': 'enfants'
 | 
			
		||||
    'sex': 'sexes'
 | 
			
		||||
    'move': 'déplacemements'
 | 
			
		||||
INFLECTOR_ORDINALS:
 | 
			
		||||
    'default': 'ème'
 | 
			
		||||
    'first': 'er'
 | 
			
		||||
    'second': 'nd'
 | 
			
		||||
    'third': 'ème'
 | 
			
		||||
NICETIME:
 | 
			
		||||
    NO_DATE_PROVIDED: Aucune date
 | 
			
		||||
    BAD_DATE: Date erronée
 | 
			
		||||
@@ -48,7 +82,7 @@ NICETIME:
 | 
			
		||||
    DAY_PLURAL: jours
 | 
			
		||||
    WEEK_PLURAL: semaines
 | 
			
		||||
    MONTH_PLURAL: mois
 | 
			
		||||
    YEAR_PLURAL: ans
 | 
			
		||||
    YEAR_PLURAL: années
 | 
			
		||||
    DECADE_PLURAL: décennies
 | 
			
		||||
    SEC_PLURAL: s
 | 
			
		||||
    MIN_PLURAL: m
 | 
			
		||||
@@ -58,3 +92,6 @@ NICETIME:
 | 
			
		||||
    MO_PLURAL: m
 | 
			
		||||
    YR_PLURAL: a
 | 
			
		||||
    DEC_PLURAL: d
 | 
			
		||||
FORM:
 | 
			
		||||
    VALIDATION_FAIL: <b>La validation a échoué :</b>
 | 
			
		||||
    INVALID_INPUT: Saisie non valide
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										52
									
								
								system/languages/hu.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								system/languages/hu.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
			
		||||
FRONTMATTER_ERROR_PAGE: "---\ncím: %1$s\n---\n\n# Hiba: Érvénytelen Frontmatter\n\nElérési út: `%2$s`\n\n**%3$s**\n\n```\n%4$s\n```"
 | 
			
		||||
INFLECTOR_IRREGULAR:
 | 
			
		||||
    'person': 'személyek'
 | 
			
		||||
    'man': 'férfiak'
 | 
			
		||||
    'child': 'gyerekek'
 | 
			
		||||
    'sex': 'nemek'
 | 
			
		||||
    'move': 'lépések'
 | 
			
		||||
INFLECTOR_ORDINALS:
 | 
			
		||||
    'default': '.'
 | 
			
		||||
    'first': '.'
 | 
			
		||||
    'second': '.'
 | 
			
		||||
    'third': '.'
 | 
			
		||||
NICETIME:
 | 
			
		||||
    NO_DATE_PROVIDED: Nincs dátum megadva
 | 
			
		||||
    BAD_DATE: Hibás dátum
 | 
			
		||||
    AGO: elteltével
 | 
			
		||||
    FROM_NOW: mostantól
 | 
			
		||||
    SECOND: másodperc
 | 
			
		||||
    MINUTE: perc
 | 
			
		||||
    HOUR: óra
 | 
			
		||||
    DAY: nap
 | 
			
		||||
    WEEK: hét
 | 
			
		||||
    MONTH: hónap
 | 
			
		||||
    YEAR: év
 | 
			
		||||
    DECADE: évtized
 | 
			
		||||
    SEC: mp
 | 
			
		||||
    MIN: p
 | 
			
		||||
    HR: ó
 | 
			
		||||
    DAY: nap
 | 
			
		||||
    WK: hét
 | 
			
		||||
    MO: hó
 | 
			
		||||
    YR: év
 | 
			
		||||
    DEC: évt
 | 
			
		||||
    SECOND_PLURAL: másodperc
 | 
			
		||||
    MINUTE_PLURAL: perc
 | 
			
		||||
    HOUR_PLURAL: óra
 | 
			
		||||
    DAY_PLURAL: nap
 | 
			
		||||
    WEEK_PLURAL: hét
 | 
			
		||||
    MONTH_PLURAL: hónap
 | 
			
		||||
    YEAR_PLURAL: év
 | 
			
		||||
    DECADE_PLURAL: évtized
 | 
			
		||||
    SEC_PLURAL: mp
 | 
			
		||||
    MIN_PLURAL: perc
 | 
			
		||||
    HR_PLURAL: ó
 | 
			
		||||
    DAY_PLURAL: nap
 | 
			
		||||
    WK_PLURAL: hét
 | 
			
		||||
    MO_PLURAL: hó
 | 
			
		||||
    YR_PLURAL: év
 | 
			
		||||
    DEC_PLURAL: évt
 | 
			
		||||
FORM:
 | 
			
		||||
    VALIDATION_FAIL: <b>A validáció hibát talált:</b>
 | 
			
		||||
    INVALID_INPUT: Az itt megadott érték érvénytelen:
 | 
			
		||||
@@ -1484,7 +1484,17 @@ class Page
 | 
			
		||||
     */
 | 
			
		||||
    public function filePathClean()
 | 
			
		||||
    {
 | 
			
		||||
        return str_replace(ROOT_DIR, '', $this->filePath());
 | 
			
		||||
        $path = str_replace(ROOT_DIR, '', $this->filePath());
 | 
			
		||||
        return $path;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the clean path to the page file
 | 
			
		||||
     */
 | 
			
		||||
    public function relativePagePath()
 | 
			
		||||
    {
 | 
			
		||||
        $path = str_replace('/'.$this->name, '', $this->filePathClean());
 | 
			
		||||
        return $path;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -70,6 +70,7 @@ class TwigExtension extends \Twig_Extension
 | 
			
		||||
            new \Twig_SimpleFilter('randomize', [$this,'randomizeFilter']),
 | 
			
		||||
            new \Twig_SimpleFilter('modulus', [$this,'modulusFilter']),
 | 
			
		||||
            new \Twig_SimpleFilter('rtrim', [$this, 'rtrimFilter']),
 | 
			
		||||
            new \Twig_SimpleFilter('pad', [$this, 'padFilter']),
 | 
			
		||||
            new \Twig_SimpleFilter('safe_email', [$this,'safeEmailFilter']),
 | 
			
		||||
            new \Twig_SimpleFilter('safe_truncate', ['\Grav\Common\Utils','safeTruncate']),
 | 
			
		||||
            new \Twig_SimpleFilter('safe_truncate_html', ['\Grav\Common\Utils','safeTruncateHTML']),
 | 
			
		||||
@@ -537,6 +538,22 @@ class TwigExtension extends \Twig_Extension
 | 
			
		||||
        return Utils::generateRandomString($count);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Pad a string to a certain length with another string
 | 
			
		||||
     *
 | 
			
		||||
     * @param        $input
 | 
			
		||||
     * @param        $pad_length
 | 
			
		||||
     * @param string $pad_string
 | 
			
		||||
     * @param int    $pad_type
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function padFilter($input, $pad_length, $pad_string = " ", $pad_type = STR_PAD_RIGHT)
 | 
			
		||||
    {
 | 
			
		||||
        return str_pad($input, (int) $pad_length, $pad_string, $pad_type);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Cast a value to array
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -100,6 +100,9 @@ abstract class Utils
 | 
			
		||||
        return (object)array_merge((array)$obj1, (array)$obj2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public static function dateFormats()
 | 
			
		||||
    {
 | 
			
		||||
        $now = new DateTime();
 | 
			
		||||
@@ -300,11 +303,19 @@ abstract class Utils
 | 
			
		||||
        return $root . implode('/', $ret);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param $function
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public static function isFunctionDisabled($function)
 | 
			
		||||
    {
 | 
			
		||||
        return in_array($function, explode(',', ini_get('disable_functions')));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public static function timezones()
 | 
			
		||||
    {
 | 
			
		||||
        $timezones = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL);
 | 
			
		||||
@@ -332,6 +343,12 @@ abstract class Utils
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param array $source
 | 
			
		||||
     * @param       $fn
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public static function arrayFilterRecursive(Array $source, $fn)
 | 
			
		||||
    {
 | 
			
		||||
        $result = array();
 | 
			
		||||
@@ -351,6 +368,11 @@ abstract class Utils
 | 
			
		||||
        return $result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param $string
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public static function pathPrefixedByLangCode($string)
 | 
			
		||||
    {
 | 
			
		||||
        $languages_enabled = self::getGrav()['config']->get('system.languages.supported', []);
 | 
			
		||||
@@ -362,6 +384,11 @@ abstract class Utils
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param $date
 | 
			
		||||
     *
 | 
			
		||||
     * @return int
 | 
			
		||||
     */
 | 
			
		||||
    public static function date2timestamp($date)
 | 
			
		||||
    {
 | 
			
		||||
        $config = self::getGrav()['config'];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user