Completed
Push — master ( 2e93c1...454de8 )
by Dimas
241:29 queued 225:13
created
src/JSLikeHTMLElement.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -37,83 +37,83 @@
 block discarded – undo
37 37
  */
38 38
 class JSLikeHTMLElement extends DOMElement
39 39
 {
40
-	/**
41
-	 * Used for setting innerHTML like it's done in JavaScript:.
42
-	 *
43
-	 * @code
44
-	 * $div->innerHTML = '<h2>Chapter 2</h2><p>The story begins...</p>';
45
-	 * @endcode
46
-	 */
47
-	public function __set($name, $value)
48
-	{
49
-		if ('innerHTML' == $name) {
50
-			// first, empty the element
51
-			for ($x = $this->childNodes->length - 1; $x >= 0; --$x) {
52
-				$this->removeChild($this->childNodes->item($x));
53
-			}
54
-			// $value holds our new inner HTML
55
-			if ('' != $value) {
56
-				$f = $this->ownerDocument->createDocumentFragment();
57
-				// appendXML() expects well-formed markup (XHTML)
58
-				$result = @$f->appendXML($value); // @ to suppress PHP warnings
59
-				if ($result) {
60
-					if ($f->hasChildNodes()) {
61
-						$this->appendChild($f);
62
-					}
63
-				} else {
64
-					// $value is probably ill-formed
65
-					$f = new DOMDocument();
66
-					$value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8');
67
-					// Using <htmlfragment> will generate a warning, but so will bad HTML
68
-					// (and by this point, bad HTML is what we've got).
69
-					// We use it (and suppress the warning) because an HTML fragment will
70
-					// be wrapped around <html><body> tags which we don't really want to keep.
71
-					// Note: despite the warning, if loadHTML succeeds it will return true.
72
-					$result = @$f->loadHTML('<htmlfragment>' . $value . '</htmlfragment>');
73
-					if ($result) {
74
-						$import = $f->getElementsByTagName('htmlfragment')->item(0);
75
-						foreach ($import->childNodes as $child) {
76
-							$importedNode = $this->ownerDocument->importNode($child, true);
77
-							$this->appendChild($importedNode);
78
-						}
79
-					} else {
80
-						// oh well, we tried, we really did. :(
81
-						// this element is now empty
82
-					}
83
-				}
84
-			}
85
-		} else {
86
-			$trace = debug_backtrace();
87
-			trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE);
88
-		}
89
-	}
40
+  /**
41
+   * Used for setting innerHTML like it's done in JavaScript:.
42
+   *
43
+   * @code
44
+   * $div->innerHTML = '<h2>Chapter 2</h2><p>The story begins...</p>';
45
+   * @endcode
46
+   */
47
+  public function __set($name, $value)
48
+  {
49
+    if ('innerHTML' == $name) {
50
+      // first, empty the element
51
+      for ($x = $this->childNodes->length - 1; $x >= 0; --$x) {
52
+        $this->removeChild($this->childNodes->item($x));
53
+      }
54
+      // $value holds our new inner HTML
55
+      if ('' != $value) {
56
+        $f = $this->ownerDocument->createDocumentFragment();
57
+        // appendXML() expects well-formed markup (XHTML)
58
+        $result = @$f->appendXML($value); // @ to suppress PHP warnings
59
+        if ($result) {
60
+          if ($f->hasChildNodes()) {
61
+            $this->appendChild($f);
62
+          }
63
+        } else {
64
+          // $value is probably ill-formed
65
+          $f = new DOMDocument();
66
+          $value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8');
67
+          // Using <htmlfragment> will generate a warning, but so will bad HTML
68
+          // (and by this point, bad HTML is what we've got).
69
+          // We use it (and suppress the warning) because an HTML fragment will
70
+          // be wrapped around <html><body> tags which we don't really want to keep.
71
+          // Note: despite the warning, if loadHTML succeeds it will return true.
72
+          $result = @$f->loadHTML('<htmlfragment>' . $value . '</htmlfragment>');
73
+          if ($result) {
74
+            $import = $f->getElementsByTagName('htmlfragment')->item(0);
75
+            foreach ($import->childNodes as $child) {
76
+              $importedNode = $this->ownerDocument->importNode($child, true);
77
+              $this->appendChild($importedNode);
78
+            }
79
+          } else {
80
+            // oh well, we tried, we really did. :(
81
+            // this element is now empty
82
+          }
83
+        }
84
+      }
85
+    } else {
86
+      $trace = debug_backtrace();
87
+      trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE);
88
+    }
89
+  }
90 90
 
91
-	/**
92
-	 * Used for getting innerHTML like it's done in JavaScript:.
93
-	 *
94
-	 * @code
95
-	 * $string = $div->innerHTML;
96
-	 * @endcode
97
-	 */
98
-	public function __get($name)
99
-	{
100
-		if ('innerHTML' == $name) {
101
-			$inner = '';
102
-			foreach ($this->childNodes as $child) {
103
-				$inner .= $this->ownerDocument->saveXML($child);
104
-			}
91
+  /**
92
+   * Used for getting innerHTML like it's done in JavaScript:.
93
+   *
94
+   * @code
95
+   * $string = $div->innerHTML;
96
+   * @endcode
97
+   */
98
+  public function __get($name)
99
+  {
100
+    if ('innerHTML' == $name) {
101
+      $inner = '';
102
+      foreach ($this->childNodes as $child) {
103
+        $inner .= $this->ownerDocument->saveXML($child);
104
+      }
105 105
 
106
-			return $inner;
107
-		}
106
+      return $inner;
107
+    }
108 108
 
109
-		$trace = debug_backtrace();
110
-		trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE);
109
+    $trace = debug_backtrace();
110
+    trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE);
111 111
 
112
-		return null;
113
-	}
112
+    return null;
113
+  }
114 114
 
115
-	public function __toString()
116
-	{
117
-		return '[' . $this->tagName . ']';
118
-	}
115
+  public function __toString()
116
+  {
117
+    return '[' . $this->tagName . ']';
118
+  }
119 119
 }
Please login to merge, or discard this patch.
assets/mdb-dashboard/js/modules/fullcalendar-3.4.0/demos/php/get-events.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 // Short-circuit if the client did not give us a date range.
16 16
 if (!isset($_GET['start']) || !isset($_GET['end'])) {
17
-	die("Please provide a date range.");
17
+  die("Please provide a date range.");
18 18
 }
19 19
 
20 20
 // Parse the start/end parameters.
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 // Parse the timezone parameter if it is present.
27 27
 $timezone = null;
28 28
 if (isset($_GET['timezone'])) {
29
-	$timezone = new DateTimeZone($_GET['timezone']);
29
+  $timezone = new DateTimeZone($_GET['timezone']);
30 30
 }
31 31
 
32 32
 // Read and parse our events JSON file into an array of event data arrays.
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 $output_arrays = array();
38 38
 foreach ($input_arrays as $array) {
39 39
 
40
-	// Convert the input array into a useful Event object
41
-	$event = new Event($array, $timezone);
40
+  // Convert the input array into a useful Event object
41
+  $event = new Event($array, $timezone);
42 42
 
43
-	// If the event is in-bounds, add it to the output
44
-	if ($event->isWithinDayRange($range_start, $range_end)) {
45
-		$output_arrays[] = $event->toArray();
46
-	}
43
+  // If the event is in-bounds, add it to the output
44
+  if ($event->isWithinDayRange($range_start, $range_end)) {
45
+    $output_arrays[] = $event->toArray();
46
+  }
47 47
 }
48 48
 
49 49
 // Send JSON to the client.
Please login to merge, or discard this patch.
assets/mdb-dashboard/js/modules/fullcalendar-3.4.0/demos/php/utils.php 1 patch
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -12,93 +12,93 @@  discard block
 block discarded – undo
12 12
 
13 13
 class Event {
14 14
 
15
-	// Tests whether the given ISO8601 string has a time-of-day or not
16
-	const ALL_DAY_REGEX = '/^\d{4}-\d\d-\d\d$/'; // matches strings like "2013-12-29"
17
-
18
-	public $title;
19
-	public $allDay; // a boolean
20
-	public $start; // a DateTime
21
-	public $end; // a DateTime, or null
22
-	public $properties = array(); // an array of other misc properties
23
-
24
-
25
-	// Constructs an Event object from the given array of key=>values.
26
-	// You can optionally force the timezone of the parsed dates.
27
-	public function __construct($array, $timezone=null) {
28
-
29
-		$this->title = $array['title'];
30
-
31
-		if (isset($array['allDay'])) {
32
-			// allDay has been explicitly specified
33
-			$this->allDay = (bool)$array['allDay'];
34
-		}
35
-		else {
36
-			// Guess allDay based off of ISO8601 date strings
37
-			$this->allDay = preg_match(self::ALL_DAY_REGEX, $array['start']) &&
38
-				(!isset($array['end']) || preg_match(self::ALL_DAY_REGEX, $array['end']));
39
-		}
40
-
41
-		if ($this->allDay) {
42
-			// If dates are allDay, we want to parse them in UTC to avoid DST issues.
43
-			$timezone = null;
44
-		}
45
-
46
-		// Parse dates
47
-		$this->start = parseDateTime($array['start'], $timezone);
48
-		$this->end = isset($array['end']) ? parseDateTime($array['end'], $timezone) : null;
49
-
50
-		// Record misc properties
51
-		foreach ($array as $name => $value) {
52
-			if (!in_array($name, array('title', 'allDay', 'start', 'end'))) {
53
-				$this->properties[$name] = $value;
54
-			}
55
-		}
56
-	}
57
-
58
-
59
-	// Returns whether the date range of our event intersects with the given all-day range.
60
-	// $rangeStart and $rangeEnd are assumed to be dates in UTC with 00:00:00 time.
61
-	public function isWithinDayRange($rangeStart, $rangeEnd) {
62
-
63
-		// Normalize our event's dates for comparison with the all-day range.
64
-		$eventStart = stripTime($this->start);
65
-
66
-		if (isset($this->end)) {
67
-			$eventEnd = stripTime($this->end); // normalize
68
-		}
69
-		else {
70
-			$eventEnd = $eventStart; // consider this a zero-duration event
71
-		}
72
-
73
-		// Check if the two whole-day ranges intersect.
74
-		return $eventStart < $rangeEnd && $eventEnd >= $rangeStart;
75
-	}
76
-
77
-
78
-	// Converts this Event object back to a plain data array, to be used for generating JSON
79
-	public function toArray() {
80
-
81
-		// Start with the misc properties (don't worry, PHP won't affect the original array)
82
-		$array = $this->properties;
83
-
84
-		$array['title'] = $this->title;
85
-
86
-		// Figure out the date format. This essentially encodes allDay into the date string.
87
-		if ($this->allDay) {
88
-			$format = 'Y-m-d'; // output like "2013-12-29"
89
-		}
90
-		else {
91
-			$format = 'c'; // full ISO8601 output, like "2013-12-29T09:00:00+08:00"
92
-		}
93
-
94
-		// Serialize dates into strings
95
-		$array['start'] = $this->start->format($format);
96
-		if (isset($this->end)) {
97
-			$array['end'] = $this->end->format($format);
98
-		}
99
-
100
-		return $array;
101
-	}
15
+  // Tests whether the given ISO8601 string has a time-of-day or not
16
+  const ALL_DAY_REGEX = '/^\d{4}-\d\d-\d\d$/'; // matches strings like "2013-12-29"
17
+
18
+  public $title;
19
+  public $allDay; // a boolean
20
+  public $start; // a DateTime
21
+  public $end; // a DateTime, or null
22
+  public $properties = array(); // an array of other misc properties
23
+
24
+
25
+  // Constructs an Event object from the given array of key=>values.
26
+  // You can optionally force the timezone of the parsed dates.
27
+  public function __construct($array, $timezone=null) {
28
+
29
+    $this->title = $array['title'];
30
+
31
+    if (isset($array['allDay'])) {
32
+      // allDay has been explicitly specified
33
+      $this->allDay = (bool)$array['allDay'];
34
+    }
35
+    else {
36
+      // Guess allDay based off of ISO8601 date strings
37
+      $this->allDay = preg_match(self::ALL_DAY_REGEX, $array['start']) &&
38
+        (!isset($array['end']) || preg_match(self::ALL_DAY_REGEX, $array['end']));
39
+    }
40
+
41
+    if ($this->allDay) {
42
+      // If dates are allDay, we want to parse them in UTC to avoid DST issues.
43
+      $timezone = null;
44
+    }
45
+
46
+    // Parse dates
47
+    $this->start = parseDateTime($array['start'], $timezone);
48
+    $this->end = isset($array['end']) ? parseDateTime($array['end'], $timezone) : null;
49
+
50
+    // Record misc properties
51
+    foreach ($array as $name => $value) {
52
+      if (!in_array($name, array('title', 'allDay', 'start', 'end'))) {
53
+        $this->properties[$name] = $value;
54
+      }
55
+    }
56
+  }
57
+
58
+
59
+  // Returns whether the date range of our event intersects with the given all-day range.
60
+  // $rangeStart and $rangeEnd are assumed to be dates in UTC with 00:00:00 time.
61
+  public function isWithinDayRange($rangeStart, $rangeEnd) {
62
+
63
+    // Normalize our event's dates for comparison with the all-day range.
64
+    $eventStart = stripTime($this->start);
65
+
66
+    if (isset($this->end)) {
67
+      $eventEnd = stripTime($this->end); // normalize
68
+    }
69
+    else {
70
+      $eventEnd = $eventStart; // consider this a zero-duration event
71
+    }
72
+
73
+    // Check if the two whole-day ranges intersect.
74
+    return $eventStart < $rangeEnd && $eventEnd >= $rangeStart;
75
+  }
76
+
77
+
78
+  // Converts this Event object back to a plain data array, to be used for generating JSON
79
+  public function toArray() {
80
+
81
+    // Start with the misc properties (don't worry, PHP won't affect the original array)
82
+    $array = $this->properties;
83
+
84
+    $array['title'] = $this->title;
85
+
86
+    // Figure out the date format. This essentially encodes allDay into the date string.
87
+    if ($this->allDay) {
88
+      $format = 'Y-m-d'; // output like "2013-12-29"
89
+    }
90
+    else {
91
+      $format = 'c'; // full ISO8601 output, like "2013-12-29T09:00:00+08:00"
92
+    }
93
+
94
+    // Serialize dates into strings
95
+    $array['start'] = $this->start->format($format);
96
+    if (isset($this->end)) {
97
+      $array['end'] = $this->end->format($format);
98
+    }
99
+
100
+    return $array;
101
+  }
102 102
 
103 103
 }
104 104
 
@@ -109,22 +109,22 @@  discard block
 block discarded – undo
109 109
 
110 110
 // Parses a string into a DateTime object, optionally forced into the given timezone.
111 111
 function parseDateTime($string, $timezone=null) {
112
-	$date = new DateTime(
113
-		$string,
114
-		$timezone ? $timezone : new DateTimeZone('UTC')
115
-			// Used only when the string is ambiguous.
116
-			// Ignored if string has a timezone offset in it.
117
-	);
118
-	if ($timezone) {
119
-		// If our timezone was ignored above, force it.
120
-		$date->setTimezone($timezone);
121
-	}
122
-	return $date;
112
+  $date = new DateTime(
113
+    $string,
114
+    $timezone ? $timezone : new DateTimeZone('UTC')
115
+      // Used only when the string is ambiguous.
116
+      // Ignored if string has a timezone offset in it.
117
+  );
118
+  if ($timezone) {
119
+    // If our timezone was ignored above, force it.
120
+    $date->setTimezone($timezone);
121
+  }
122
+  return $date;
123 123
 }
124 124
 
125 125
 
126 126
 // Takes the year/month/date values of the given DateTime and converts them to a new DateTime,
127 127
 // but in UTC.
128 128
 function stripTime($datetime) {
129
-	return new DateTime($datetime->format('Y-m-d'));
129
+  return new DateTime($datetime->format('Y-m-d'));
130 130
 }
Please login to merge, or discard this patch.
src/MVC/function.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  */
8 8
 function maintenance()
9 9
 {
10
-	include __DIR__ . '/maintenance.php';
11
-	exit;
10
+  include __DIR__ . '/maintenance.php';
11
+  exit;
12 12
 }
13 13
 /**
14 14
  * Debug Error
@@ -17,6 +17,6 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function show_error()
19 19
 {
20
-	error_reporting(E_ALL);
21
-	ini_set('display_errors', 'On');
20
+  error_reporting(E_ALL);
21
+  ini_set('display_errors', 'On');
22 22
 }
Please login to merge, or discard this patch.