Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F211281
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Subscribers
None
View Options
diff --git a/Engines/Templates/Smarty/Plugins/modifier.romanize.php b/Engines/Templates/Smarty/Plugins/modifier.romanize.php
index 022156b..1d23131 100644
--- a/Engines/Templates/Smarty/Plugins/modifier.romanize.php
+++ b/Engines/Templates/Smarty/Plugins/modifier.romanize.php
@@ -1,88 +1,101 @@
<?php
/**
* Smarty plugin
-*
+*
* @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty romanize modifier plugin
-*
+*
* Type: modifier<br>
* Name: romanize<br>
* Purpose: prints a number in roman
-*
-* @param int $
-* @return string
+*
+* @param int $
+* @return string
*/
-function smarty_modifier_romanize ($number) {
+function smarty_modifier_romanize ($number) : string {
return romanize($number);
}
-function romanize ($number) {
+function romanize ($number) : string {
switch ($number) {
- //Avoid return 'v' . romanize($number - 5); to speed up
- case 1: return 'i';
- case 2: return 'ii';
- case 3: return 'iii';
- case 4: return 'iv';
- case 5: return 'v';
- case 6: return 'vi';
- case 7: return 'vii';
- case 8: return 'viii';
- case 9: return 'ix';
- case 10: return 'x';
-
- case 50: return 'l';
- case 100: return 'c';
- case 500: return 'd';
- case 1000: return 'm';
+ case 1:
+ return 'i';
+ case 2:
+ return 'ii';
+ case 3:
+ return 'iii';
+ case 4:
+ return 'iv';
+ case 5:
+ return 'v';
+ case 6:
+ return 'vi';
+ case 7:
+ return 'vii';
+ case 8:
+ return 'viii';
+ case 9:
+ return 'ix';
+ case 10:
+ return 'x';
+
+ case 50:
+ return 'l';
+ case 100:
+ return 'c';
+ case 500:
+ return 'd';
+ case 1000:
+ return 'm';
default:
- if ($number < 21)
- return 'x' . romanize($number - 10);
- elseif ($number < 30)
- return 'xx' . romanize($number - 20);
- elseif ($number < 40)
- return 'xxx' . romanize($number - 30);
- elseif ($number < 50)
- return 'xl' . romanize($number - 40);
- elseif ($number < 60)
- return 'l' . romanize($number - 50);
- elseif ($number < 70)
- return 'lx' . romanize($number - 60);
- elseif ($number < 80)
- return 'lxx' . romanize($number - 70);
- elseif ($number < 90)
- return 'lxxx' . romanize($number - 80);
- elseif ($number < 100)
- return 'xc' . romanize($number - 90);
- elseif ($number < 200)
- return 'c' . romanize($number - 100);
- elseif ($number < 300)
- return 'cc' . romanize($number - 200);
- elseif ($number < 400)
- return 'ccc' . romanize($number - 300);
- elseif ($number < 500)
- return 'cd' . romanize($number - 400);
- elseif ($number < 600)
- return 'd' . romanize($number - 500);
- elseif ($number < 700)
- return 'dc' . romanize($number - 600);
- elseif ($number < 800)
- return 'dcc' . romanize($number - 700);
- elseif ($number < 900)
- return 'dccc' . romanize($number - 800);
- elseif ($number < 1000)
- return 'cm' . romanize($number - 800);
- elseif (is_numeric($number)) {
- $m = floor($number / 1000);
- return str_repeat('m', $m) . romanize($number - $m);
- }
- else
- return $number; //Not a arab number
+ if ($number < 21) {
+ return 'x' . romanize($number - 10);
+ } elseif ($number < 30) {
+ return 'xx' . romanize($number - 20);
+ } elseif ($number < 40) {
+ return 'xxx' . romanize($number - 30);
+ } elseif ($number < 50) {
+ return 'xl' . romanize($number - 40);
+ } elseif ($number < 60) {
+ return 'l' . romanize($number - 50);
+ } elseif ($number < 70) {
+ return 'lx' . romanize($number - 60);
+ } elseif ($number < 80) {
+ return 'lxx' . romanize($number - 70);
+ } elseif ($number < 90) {
+ return 'lxxx' . romanize($number - 80);
+ } elseif ($number < 100) {
+ return 'xc' . romanize($number - 90);
+ } elseif ($number < 200) {
+ return 'c' . romanize($number - 100);
+ } elseif ($number < 300) {
+ return 'cc' . romanize($number - 200);
+ } elseif ($number < 400) {
+ return 'ccc' . romanize($number - 300);
+ } elseif ($number < 500) {
+ return 'cd' . romanize($number - 400);
+ } elseif ($number < 600) {
+ return 'd' . romanize($number - 500);
+ } elseif ($number < 700) {
+ return 'dc' . romanize($number - 600);
+ } elseif ($number < 800) {
+ return 'dcc' . romanize($number - 700);
+ } elseif ($number < 900) {
+ return 'dccc' . romanize($number - 800);
+ } elseif ($number < 1000) {
+ return 'cm' . romanize($number - 800);
+ } elseif (is_numeric($number)) {
+ $m = floor($number / 1000);
+
+ return str_repeat('m', $m) . romanize($number - $m);
+ }
+
+ // Not a arab number, return as is
+ return $number;
}
}
-
-?>
diff --git a/Engines/Templates/Smarty/Plugins/modifier.text2html.php b/Engines/Templates/Smarty/Plugins/modifier.text2html.php
index 3244a91..3a02396 100644
--- a/Engines/Templates/Smarty/Plugins/modifier.text2html.php
+++ b/Engines/Templates/Smarty/Plugins/modifier.text2html.php
@@ -1,38 +1,42 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
- * Smarty lower modifier plugin
+ * Smarty text to HTML modifier plugin
*
* Type: modifier<br>
- * Name: yyyymmdd<br>
- * Purpose: Appends dashes to yyyymmdd string to output yyyy-mm-dd
+ * Name: text2html<br>
+ * Purpose: HTML representation for Azhàr profiles
* @author Wolfaeym
* @param string
* @return string
*/
-function smarty_modifier_text2html($string)
-{
+function smarty_modifier_text2html ($string) {
//HTML entities
$string = htmlspecialchars($string, ENT_QUOTES);
-
+
//E-mail -> mailto links
- $string = preg_replace("/([_a-z0-9-]+(\._a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)/i", "<a href=\"mailto:\\1\">\\1</A>", $string);
+ $string = preg_replace(
+ "/([_a-z0-9-]+(\._a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)/i",
+ "<a href=\"mailto:\\1\">\\1</A>",
+ $string
+ );
//Linkify URLs
//TODO handle www.
//TODO Relative links for current domain
- $string = preg_replace("@([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])@i", "<a href=\"\\1://\\2\\3\">\\1://\\2\\3</a>", $string);
-
+ $string = preg_replace(
+ "@([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])@i",
+ "<a href=\"\\1://\\2\\3\">\\1://\\2\\3</a>", $string
+ );
+
//\n -> <br />
$string = nl2br($string);
-
+
return $string;
}
-
-?>
diff --git a/Engines/Templates/Smarty/Plugins/modifier.yyyymmdd.php b/Engines/Templates/Smarty/Plugins/modifier.yyyymmdd.php
index 11320a5..0065498 100644
--- a/Engines/Templates/Smarty/Plugins/modifier.yyyymmdd.php
+++ b/Engines/Templates/Smarty/Plugins/modifier.yyyymmdd.php
@@ -1,25 +1,22 @@
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty lower modifier plugin
*
* Type: modifier<br>
* Name: yyyymmdd<br>
* Purpose: Appends dashes to yyyymmdd string to output yyyy-mm-dd
* @author Wolfaeym
* @param string
* @return string
*/
-function smarty_modifier_yyyymmdd($string)
-{
+function smarty_modifier_yyyymmdd($string) {
return substr($string, 0, 4) . '-' . substr($string, 4, 2)
. '-' . substr($string, 6, 2);
}
-
-?>
\ No newline at end of file
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 23, 09:44 (1 d, 4 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
21117
Default Alt Text
(8 KB)
Attached To
rZED Zed
Event Timeline
Log In to Comment