[xiph-commits] r14953 - in branches/dir.xiph.org/inc: . smarty-plugins
balbinus at svn.xiph.org
balbinus at svn.xiph.org
Sun May 25 14:32:19 PDT 2008
Author: balbinus
Date: 2008-05-25 14:32:18 -0700 (Sun, 25 May 2008)
New Revision: 14953
Added:
branches/dir.xiph.org/inc/smarty-plugins/modifier.get_media_type_url.php
Modified:
branches/dir.xiph.org/inc/lib.dir.php
branches/dir.xiph.org/inc/lib.utils.php
Log:
Only one IP, please + new modifier that returns media type URL.
Modified: branches/dir.xiph.org/inc/lib.dir.php
===================================================================
--- branches/dir.xiph.org/inc/lib.dir.php 2008-05-25 10:11:19 UTC (rev 14952)
+++ branches/dir.xiph.org/inc/lib.dir.php 2008-05-25 21:32:18 UTC (rev 14953)
@@ -91,6 +91,41 @@
* Inverse of content_type_lookup.
*
* @param int $type_id
+ * @return string
+ */
+function get_media_type_url($type_id)
+{
+ $type = 'Unknown';
+ switch ($type_id)
+ {
+ case CONTENT_TYPE_OGG_VORBIS:
+ $type = 'Ogg_Vorbis';
+ break;
+ case CONTENT_TYPE_OGG_THEORA:
+ $type = 'Ogg_Theora';
+ break;
+ case CONTENT_TYPE_MP3:
+ $type = 'MP3';
+ break;
+ case CONTENT_TYPE_NSV:
+ $type = 'NSV';
+ break;
+ case CONTENT_TYPE_AAC:
+ $type = 'AAC';
+ break;
+ case CONTENT_TYPE_AACPLUS:
+ $type = 'AAC+';
+ break;
+ }
+
+ return $type;
+}
+
+
+/**
+ * Inverse of content_type_lookup.
+ *
+ * @param int $type_id
* @param bool $full_type If set to true, will return application/ogg+vorbis as
* MIME type for Ogg Vorbis
* @return string
Modified: branches/dir.xiph.org/inc/lib.utils.php
===================================================================
--- branches/dir.xiph.org/inc/lib.utils.php 2008-05-25 10:11:19 UTC (rev 14952)
+++ branches/dir.xiph.org/inc/lib.utils.php 2008-05-25 21:32:18 UTC (rev 14953)
@@ -37,6 +37,7 @@
{
$ip = $_SERVER['REMOTE_ADDR'];
}
+ $ip = preg_replace('/^(([0-9]{1,3}\.){3}[0-9]{1,3}).*$/', '$1', $ip);
return $ip;
}
Added: branches/dir.xiph.org/inc/smarty-plugins/modifier.get_media_type_url.php
===================================================================
--- branches/dir.xiph.org/inc/smarty-plugins/modifier.get_media_type_url.php (rev 0)
+++ branches/dir.xiph.org/inc/smarty-plugins/modifier.get_media_type_url.php 2008-05-25 21:32:18 UTC (rev 14953)
@@ -0,0 +1,16 @@
+<?php
+
+include_once(dirname(__FILE__).'/../lib.dir.php');
+
+/**
+ * template_lite capitalize modifier plugin
+ *
+ * Type: modifier
+ * Name: get_media_type
+ * Purpose: Return the media type from the media type ID
+ */
+function smarty_modifier_get_media_type_url($id)
+{
+ return get_media_type_url($id);
+}
+?>
More information about the commits
mailing list