summaryrefslogtreecommitdiff
path: root/modules/atom
diff options
context:
space:
mode:
Diffstat (limited to 'modules/atom')
-rw-r--r--modules/atom/helpers/atom.php52
-rw-r--r--modules/atom/libraries/Atom_Author.php1
-rw-r--r--modules/atom/libraries/Atom_Base.php1
-rw-r--r--modules/atom/libraries/Atom_Entry.php1
-rw-r--r--modules/atom/libraries/Atom_Feed.php1
-rw-r--r--modules/atom/libraries/Atom_Link.php1
6 files changed, 57 insertions, 0 deletions
diff --git a/modules/atom/helpers/atom.php b/modules/atom/helpers/atom.php
new file mode 100644
index 00000000..fed15eb7
--- /dev/null
+++ b/modules/atom/helpers/atom.php
@@ -0,0 +1,52 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2008 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+class atom_Core {
+
+ /**
+ * Converts a Unix timestamp to an Internet timestamp as defined in RFC3339.
+ * http://www.ietf.org/rfc/rfc3339.txt
+ *
+ * @todo Check if time zone is correct.
+ * @todo Write test.
+ *
+ * @param int Unix timestamp
+ * @return string Internet timestamp
+ */
+ public static function unix_to_internet_timestamp($timestamp) {
+ return sprintf("%sZ", date("Y-m-d\TH:i:s", $timestamp));
+ }
+
+ /**
+ *
+ */
+ public static function get_absolute_url() {
+ $base_url = atom::get_base_url();
+ $absolute_url = html::specialchars($base_url . url::current(true));
+ return $absolute_url;
+ }
+
+ /**
+ *
+ */
+ public static function get_base_url() {
+ return sprintf("http://%s%s", $_SERVER["HTTP_HOST"], url::base(true));
+ }
+}
diff --git a/modules/atom/libraries/Atom_Author.php b/modules/atom/libraries/Atom_Author.php
index ec3c61aa..3ee4df41 100644
--- a/modules/atom/libraries/Atom_Author.php
+++ b/modules/atom/libraries/Atom_Author.php
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
class Atom_Author_Core extends Atom_Base {
public function name($name) {
$this->element->appendChild($this->dom->createElement("name", $name));
diff --git a/modules/atom/libraries/Atom_Base.php b/modules/atom/libraries/Atom_Base.php
index bf115033..0cb33b0b 100644
--- a/modules/atom/libraries/Atom_Base.php
+++ b/modules/atom/libraries/Atom_Base.php
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
class Atom_Base_Core {
protected $dom;
protected $element;
diff --git a/modules/atom/libraries/Atom_Entry.php b/modules/atom/libraries/Atom_Entry.php
index d566f49b..345755c2 100644
--- a/modules/atom/libraries/Atom_Entry.php
+++ b/modules/atom/libraries/Atom_Entry.php
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
class Atom_Entry_Core extends Atom_Base {
public function id($id) {
$this->element->appendChild($this->dom->createElement("id", $id));
diff --git a/modules/atom/libraries/Atom_Feed.php b/modules/atom/libraries/Atom_Feed.php
index 0b667e88..8efeb4f2 100644
--- a/modules/atom/libraries/Atom_Feed.php
+++ b/modules/atom/libraries/Atom_Feed.php
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
class Atom_Feed_Core extends Atom_Base {
public function id($id) {
$this->element->appendChild($this->dom->createElement("id", $id));
diff --git a/modules/atom/libraries/Atom_Link.php b/modules/atom/libraries/Atom_Link.php
index 5fff30f2..723675c1 100644
--- a/modules/atom/libraries/Atom_Link.php
+++ b/modules/atom/libraries/Atom_Link.php
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
class Atom_Link_Core extends Atom_Base {
public function rel($rel) {
$this->element->setAttribute("rel", $rel);