Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3754313
D722.id1811.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D722.id1811.diff
View Options
diff --git a/page.php b/page.php
--- a/page.php
+++ b/page.php
@@ -357,6 +357,23 @@
/// DATES
///
+ /**
+ * @param string $toParse The date to parse
+ * @param string $tz The timezone to use [optional]
+ */
+ function dateFromDateParse ($toParse, $tz = 'Europe/Paris') {
+ $old_tz = date_default_timezone_get();
+ date_default_timezone_set($tz);
+
+ $date = date_parse($toParse);
+ $this->yyyy = $date['year'];
+ $this->mm = $date['month'];
+ $this->dd = $date['day'];
+ $this->unixtime = mktime($date['hour'], $date['minute'], $date['second'], $date['month'], $date['day'], $date['year']);
+
+ date_default_timezone_set($old_tz);
+ }
+
function extractYYYYMMDDDateFromURL() {
$pattern = "@/([12][0-9]{3})\-([0-9]{2})\-([0-9]{2})/@";
if (preg_match($pattern, $this->url, $matches)) {
diff --git a/pages/leschroniquesautomatiques.php b/pages/leschroniquesautomatiques.php
--- a/pages/leschroniquesautomatiques.php
+++ b/pages/leschroniquesautomatiques.php
@@ -8,15 +8,9 @@
//Hardcoded known info
$this->site = "Les Chroniques Automatiques";
$this->author = "Dat’";
- $this->skipYMD = true;
//Gets date
- $old_tz = date_default_timezone_get();
- date_default_timezone_set('Europe/Paris');
- $date = date_parse(trim(self::between('This entry was posted on', 'and is filed under')));
- $this->unixtime = mktime($date['hour'], $date['minute'], $date['second'], $date['month'], $date['day'], $date['year']);
- $this->date = strftime(LONG_DATE_FORMAT, $this->unixtime);
- $new_tz = date_default_timezone_set($old_tz);
+ $this->dateFromDateParse(trim(self::between('This entry was posted on', 'and is filed under')));
}
function get_title () {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 06:24 (20 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2252089
Default Alt Text
D722.id1811.diff (1 KB)
Attached To
Mode
D722: Page::dateFromDateParse
Attached
Detach File
Event Timeline
Log In to Comment