]> git.mxchange.org Git - friendica-addons.git/commitdiff
Changed:
authorRoland Häder <roland@mxchange.org>
Wed, 22 Jun 2022 23:47:32 +0000 (01:47 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 22 Jun 2022 23:48:01 +0000 (01:48 +0200)
- removed discouraged ?>
- changed double-quotes to single

convert/UnitConvertor.php [deleted file]
convert/convert.php
diaspora/diasphp.php
leistungsschutzrecht/leistungsschutzrecht.php
libravatar/Services/Libravatar.php
statusnet/library/codebirdsn.php
webrtc/webrtc.php

diff --git a/convert/UnitConvertor.php b/convert/UnitConvertor.php
deleted file mode 100644 (file)
index d7933a8..0000000
+++ /dev/null
@@ -1,283 +0,0 @@
-<?php\r
-// +----------------------------------------------------------------------+\r
-// | PHP version 4.0                                                      |\r
-// +----------------------------------------------------------------------+\r
-// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group             |\r
-// +----------------------------------------------------------------------+\r
-// | This source file is subject to version 2.0 of the PHP license,       |\r
-// | that is bundled with this package in the file LICENSE, and is        |\r
-// | available at through the world-wide-web at                           |\r
-// | http://www.php.net/license/2_02.txt.                                 |\r
-// | If you did not receive a copy of the PHP license and are unable to   |\r
-// | obtain it through the world-wide-web, please send a note to          |\r
-// | license@php.net so we can mail you a copy immediately.               |\r
-// +----------------------------------------------------------------------+\r
-// | Authors: Stanislav Okhvat <stanis@ngs.ru>                            |\r
-// | Co-authored by : CVH, Chris Hansel <chris@cpi-service.com>                                  |\r
-// +----------------------------------------------------------------------+\r
-//\r
-// $Id: UnitConvertor.php,v 1.00 2002/02/20 11:40:00 stasokhvat Exp $\r
-\r
-/**\r
-* UnitConvertor is able to convert between different units and currencies.\r
-*\r
-* @author   Stanislav Okhvat <stanis@sibfair.nsk.su, stanis@ngs.ru>\r
-* @version  $Id: UnitConvertor.php,v 1.00 2002/03/01 17:00:00 stasokhvat Exp $\r
-* @package  UnitConvertor\r
-* @access   public\r
-* @history  01.03.2002  Implemented the code for regular and offset-based\r
-*           conversions\r
-*\r
-*           13.12.2004\r
-*           By Chris Hansel (CVH): changed getConvSpecs in order to have it look up \r
-*           intermediary conversions (also see comments in check_key).\r
-*\r
-*           Intermediary conversions are useful when no conversion ratio is specified\r
-*           between two units when we calculate between the two. For example, we want\r
-*           to convert between Fahrenheit and Kelvin, and we have only\r
-*           specified how to convert Centigrade<->Fahrenheit and\r
-*           Centigrade<->Kelvin. While a direct (Fahrenheit->Kelvin) or\r
-*           reverse (Kelvin->Fahrenheit) lookups fail, looking for an intermediary\r
-*           unit linking the two (Centigrade) helps us do the conversion.\r
-*\r
-*           13.12.2004\r
-*           Chris Hansel (CVH): $to_array argument of addConversion method can now\r
-*           contain units as 'unit1/unit2/unit3', when all units stand for the same\r
-*           thing. See examples in unitconv.php\r
-*/\r
-class UnitConvertor\r
-{\r
-    /**\r
-    * Stores conversion ratios.\r
-    *\r
-    * @var      array\r
-    * @access   private\r
-    */\r
-       var $conversion_table = array();\r
-\r
-    /**\r
-    * Decimal point character (default is "." - American - set in constructor).\r
-    *\r
-    * @var      string\r
-    * @access   private\r
-    */\r
-       var $decimal_point;\r
-\r
-    /**\r
-    * Thousands separator (default is "," - American - set in constructor).\r
-    *\r
-    * @var      string\r
-    * @access   private\r
-    */\r
-       var $thousand_separator;\r
-\r
-    /**\r
-    * For future use\r
-    *\r
-    * @var      array\r
-    * @access   private\r
-    */\r
-       var $bases = array();\r
-\r
-    /**\r
-    * Constructor. Initializes the UnitConvertor object with the most important\r
-       * properties.\r
-    *\r
-    * @param    string    decimal point character\r
-       * @param    string    thousand separator character\r
-    * @return   void\r
-    * @access   public\r
-    */\r
-       function UnitConvertor($dec_point = '.', $thousand_sep = ',')\r
-       {\r
-               $this->decimal_point = $dec_point;\r
-               $this->thousand_separator = $thousand_sep;\r
-\r
-       } // end func UnitConvertor\r
-\r
-    /**\r
-    * Adds a conversion ratio to the conversion table.\r
-    *\r
-    * @param    string    the name of unit from which to convert\r
-       * @param    array     array(\r
-    *                                          "pound"=>array("ratio"=>'', "offset"=>'')\r
-    *                                    )\r
-    *                                    "pound" - name of unit to set conversion ration to\r
-    *                                    "ratio" - 'double' conversion ratio which, when\r
-    *                                    multiplied by the number of $from_unit units produces\r
-    *                                    the result\r
-    *                                    "offset" - an offset from 0 which will be added to\r
-    *                                    the result when converting (needed for temperature\r
-    *                                    conversions and defaults to 0).\r
-    * @return   boolean   true if successful, false otherwise\r
-    * @access   public\r
-    */\r
-       function addConversion($from_unit, $to_array)\r
-       {\r
-               if (!isset($this->conversion_table[$from_unit])) {\r
-                       while(list($key, $val) = each($to_array))\r
-                       {\r
-                               if (strstr($key, '/'))\r
-                               {\r
-                                       $to_units = explode('/', $key);\r
-                                       foreach ($to_units as $to_unit)\r
-                                       {\r
-                                               $this->bases[$from_unit][] = $to_unit;\r
-\r
-                                               if (!is_array($val))\r
-                                               {\r
-                                                       $this->conversion_table[$from_unit."_".$to_unit] = array("ratio"=>$val, "offset"=>0);\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       $this->conversion_table[$from_unit."_".$to_unit] =\r
-                                                               array(\r
-                                                                       "ratio"=>$val['ratio'],\r
-                                                                       "offset"=>(isset($val['offset']) ? $val['offset'] : 0)\r
-                                                               );\r
-                                               }\r
-                                       }\r
-                               }\r
-                               else\r
-                               {\r
-                                       $this->bases[$from_unit][] = $key;\r
-\r
-                                       if (!is_array($val))\r
-                                       {\r
-                                               $this->conversion_table[$from_unit."_".$key] = array("ratio"=>$val, "offset"=>0);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               $this->conversion_table[$from_unit."_".$key] =\r
-                                               array(\r
-                                                       "ratio"=>$val['ratio'],\r
-                                                       "offset"=>(isset($val['offset']) ? $val['offset'] : 0)\r
-                                               );\r
-                                       }\r
-                               }\r
-                       }\r
-                       return true;\r
-               }\r
-               return false;\r
-\r
-       } // end func addConversion\r
-\r
-    /**\r
-    * Converts from one unit to another using specified precision.\r
-    *\r
-    * @param    double    value to convert\r
-       * @param    string    name of the source unit from which to convert\r
-    * @param    string    name of the target unit to which we are converting\r
-    * @param    integer   double precision of the end result\r
-    * @return   void\r
-    * @access   public\r
-    */\r
-       function convert($value, $from_unit, $to_unit, $precision)\r
-       {\r
-               if ($this->getConvSpecs($from_unit, $to_unit, $value, $converted ))\r
-               {\r
-                       return number_format($converted , (int)$precision, $this->decimal_point, $this->thousand_separator);\r
-               } else {\r
-                       return false;\r
-               }\r
-       } // end func\r
-\r
-       /**\r
-       * CVH : changed this Function getConvSpecs in order to have it look up \r
-       * intermediary Conversions from the \r
-       * "base" unit being that one that has the highest hierarchical order in one\r
-       * "logical" Conversion_Array\r
-       * when taking $conv->addConversion('km',\r
-       * array('meter'=>1000, 'dmeter'=>10000, 'centimeter'=>100000,\r
-       * 'millimeter'=>1000000, 'mile'=>0.62137, 'naut.mile'=>0.53996,\r
-       * 'inch(es)/zoll'=>39370, 'ft/foot/feet'=>3280.8, 'yd/yard'=>1093.6));\r
-       * "km" would be the logical base unit for all units of dinstance, thus, \r
-       * if the function fails to find a direct or reverse conversion in the table \r
-       * it is only logical to suspect that if there is a chance \r
-       * converting the value it only is via the "base" unit, and so \r
-       * there is not even a need for a recursive search keeping the perfomance \r
-       * acceptable and the ressource small...\r
-       *\r
-       * CVH check_key checks for a key in the Conversiontable and returns a value\r
-       */\r
-       function  check_key( $key) {\r
-               if ( array_key_exists ($key,$this->conversion_table)) {\r
-                       if (! empty($this->conversion_table[$key])) {\r
-                               return $this->conversion_table[$key];\r
-                       }\r
-               }\r
-               return false;\r
-       }\r
-\r
-       /**\r
-    * Key function. Finds the conversion ratio and offset from one unit to another.\r
-    *\r
-       * @param    string    name of the source unit from which to convert\r
-    * @param    string    name of the target unit to which we are converting\r
-    * @param    double    conversion ratio found. Returned by reference.\r
-    * @param    double    offset which needs to be added (or subtracted, if negative)\r
-       *                     to the result to convert correctly. \r
-       *                     For temperature or some scientific conversions,\r
-    *                                    i.e. Fahrenheit -> Celcius\r
-    * @return   boolean   true if ratio and offset are found for the supplied\r
-    *                                    units, false otherwise\r
-    * @access   private\r
-    */\r
-       function getConvSpecs($from_unit, $to_unit, $value, &$converted)\r
-       {\r
-               $key = $from_unit."_".$to_unit;\r
-               $revkey = $to_unit."_".$from_unit;\r
-               $found = false;\r
-               if ($ct_arr = $this->check_key($key)) {\r
-                       // Conversion Specs found directly\r
-                       $ratio = (double)$ct_arr['ratio'];\r
-                       $offset = $ct_arr['offset']; \r
-                       $converted = (double)(($value  * $ratio)+ $offset);\r
-                       \r
-                       return true;\r
-               }       // not found in direct order, try reverse order\r
-               elseif ($ct_arr = $this->check_key($revkey)) {\r
-                       $ratio = (double)(1/$ct_arr['ratio']);\r
-                       $offset = -$ct_arr['offset'];\r
-                       $converted = (double)(($value  + $offset) *  $ratio);\r
-                       \r
-                       return true;\r
-               }       // not found test for intermediary conversion\r
-               else {\r
-                       // return ratio = 1 if keyparts match\r
-                       if ($key == $revkey) {\r
-                                           $ratio = 1;\r
-                                               $offset = 0;\r
-                                               $converted = $value;\r
-                                               return true;\r
-                       }               \r
-                       // otherwise search intermediary\r
-                       reset($this->conversion_table);\r
-                       while (list($convk, $i1_value) = each($this->conversion_table)) {\r
-                               // split the key into parts\r
-                               $keyparts = preg_split("/_/",$convk);\r
-                               // return ratio = 1 if keyparts match\r
-                       \r
-                               // Now test if either part matches the from or to unit\r
-                               if ($keyparts[1] == $to_unit && ($i2_value = $this->check_key($keyparts[0]."_".$from_unit))) {\r
-                                               // an intermediary $keyparts[0] was found\r
-                                               // now let us put things together intermediary 1 and 2\r
-                                               $converted = (double)(((($value - $i2_value['offset']) / $i2_value['ratio']) * $i1_value['ratio'])+ $i1_value['offset']);\r
-\r
-                                               $found = true;\r
-                                               \r
-                               } elseif ($keyparts[1] == $from_unit && ($i2_value = $this->check_key($keyparts[0]."_".$to_unit))) {\r
-                                               // an intermediary $keyparts[0] was found\r
-                                               // now let us put things together intermediary 2 and 1\r
-                                               $converted = (double)(((($value - $i1_value['offset']) / $i1_value['ratio']) + $i2_value['offset']) * $i2_value['ratio']);\r
-\r
-                                               $found = true;                  \r
-                               } \r
-                       }\r
-                       return $found;          \r
-               }\r
-\r
-       } // end func getConvSpecs\r
-       \r
-} // end class UnitConvertor\r
-?>
\ No newline at end of file
index 5449cc14bc0f1f683ccdfc7a1a915880f348f9e0..1385731cd8705aef9de083de6e6a0344aeed1087 100644 (file)
@@ -18,12 +18,6 @@ function convert_app_menu($a,&$b) {
 
 function convert_module() {}
 
-
-
-
-
-
-
 function convert_content($app) {
 
 include("UnitConvertor.php");
@@ -85,92 +79,90 @@ include("UnitConvertor.php");
        }
 }
 
-
 $conv = new TP_Converter('en');
 
-
 $conversions = [
-       'Temperature'=>['base' =>'Celsius',
-               'conv'=>[
-                       'Fahrenheit'=>['ratio'=>1.8, 'offset'=>32],
-                       'Kelvin'=>['ratio'=>1, 'offset'=>273],
-                       'Reaumur'=>0.8
+       'Temperature' => ['base'  => 'Celsius',
+               'conv' => [
+                       'Fahrenheit' => ['ratio' => 1.8, 'offset' => 32],
+                       'Kelvin' => ['ratio' => 1, 'offset' => 273],
+                       'Reaumur' => 0.8
                ]
        ],
-       'Weight' => ['base' =>'kg',
-               'conv'=>[
-                       'g'=>1000,
-                       'mg'=>1000000,
-                       't'=>0.001,
-                       'grain'=>15432,
-                       'oz'=>35.274,
-                       'lb'=>2.2046,
-                       'cwt(UK)'       => 0.019684,
-                       'cwt(US)'       => 0.022046,
-                       'ton (US)'      => 0.0011023,
-                       'ton (UK)'      => 0.0009842
+       'Weight'  =>  ['base'  => 'kg',
+               'conv' => [
+                       'g' => 1000,
+                       'mg' => 1000000,
+                       't' => 0.001,
+                       'grain' => 15432,
+                       'oz' => 35.274,
+                       'lb' => 2.2046,
+                       'cwt(UK)'        =>  0.019684,
+                       'cwt(US)'        =>  0.022046,
+                       'ton (US)'       =>  0.0011023,
+                       'ton (UK)'       =>  0.0009842
                ]
        ],
-       'Distance' => ['base' =>'km',
-               'conv'=>[
-                       'm'=>1000,
-                       'dm'=>10000,
-                       'cm'=>100000,
-                       'mm'=>1000000,
-                       'mile'=>0.62137,
-                       'naut.mile'=>0.53996,
-                       'inch(es)'=>39370,
-                       'ft'=>3280.8,
-                       'yd'=>1093.6,
-                       'furlong'=>4.970969537898672,
-                       'fathom'=>546.8066491688539
+       'Distance'  =>  ['base'  => 'km',
+               'conv' => [
+                       'm' => 1000,
+                       'dm' => 10000,
+                       'cm' => 100000,
+                       'mm' => 1000000,
+                       'mile' => 0.62137,
+                       'naut.mile' => 0.53996,
+                       'inch(es)' => 39370,
+                       'ft' => 3280.8,
+                       'yd' => 1093.6,
+                       'furlong' => 4.970969537898672,
+                       'fathom' => 546.8066491688539
                ]
        ],
-       'Area' => ['base' =>'km 2',
-               'conv'=>[
-                       'ha'=>100,
-                       'acre'=>247.105,
-                       'm 2'=>pow(1000,2),
-                       'dm 2'=>pow(10000,2),
-                       'cm 2'=>pow(100000,2),
-                       'mm 2'=>pow(1000000,2),
-                       'mile 2'=>pow(0.62137,2),
-                       'naut.miles 2'=>pow(0.53996,2),
-                       'in 2'=>pow(39370,2),
-                       'ft 2'=>pow(3280.8,2),
-                       'yd 2'=>pow(1093.6,2),
+       'Area'  =>  ['base'  => 'km 2',
+               'conv' => [
+                       'ha' => 100,
+                       'acre' => 247.105,
+                       'm 2' => pow(1000,2),
+                       'dm 2' => pow(10000,2),
+                       'cm 2' => pow(100000,2),
+                       'mm 2' => pow(1000000,2),
+                       'mile 2' => pow(0.62137,2),
+                       'naut.miles 2' => pow(0.53996,2),
+                       'in 2' => pow(39370,2),
+                       'ft 2' => pow(3280.8,2),
+                       'yd 2' => pow(1093.6,2),
                ]
        ],
-       'Volume' => ['base' =>'m 3',
-               'conv'=>[
-                       'in 3'=>61023.6,
-                       'ft 3'=>35.315,
-                       'cm 3'=>pow(10,6),
-                       'dm 3'=>1000,
-                       'litre'=>1000,
-                       'hl'=>10,
-                       'yd 3'=>1.30795,
-                       'gal(US)'=>264.172,
-                       'gal(UK)'=>219.969,
-                       'pint' => 2113.376,
-                       'quart' => 1056.688,
-                       'cup' => 4266.753,
-                       'fl oz' => 33814.02,
-                       'tablespoon' => 67628.04,
-                       'teaspoon' => 202884.1,
-                       'pt (UK)'=>1000/0.56826,
-                       'barrel petroleum'=>1000/158.99,
-                       'Register Tons'=>2.832,
-                       'Ocean Tons'=>1.1327
+       'Volume'  =>  ['base'  => 'm 3',
+               'conv' => [
+                       'in 3' => 61023.6,
+                       'ft 3' => 35.315,
+                       'cm 3' => pow(10,6),
+                       'dm 3' => 1000,
+                       'litre' => 1000,
+                       'hl' => 10,
+                       'yd 3' => 1.30795,
+                       'gal(US)' => 264.172,
+                       'gal(UK)' => 219.969,
+                       'pint'  =>  2113.376,
+                       'quart'  =>  1056.688,
+                       'cup'  =>  4266.753,
+                       'fl oz'  =>  33814.02,
+                       'tablespoon'  =>  67628.04,
+                       'teaspoon'  =>  202884.1,
+                       'pt (UK)' => 1000/0.56826,
+                       'barrel petroleum' => 1000/158.99,
+                       'Register Tons' => 2.832,
+                       'Ocean Tons' => 1.1327
                ]
        ],
-       'Speed' =>['base' =>'kmph',
-               'conv'=>[
-                       'mps'=>0.0001726031,
-                       'milesph'=>0.62137,
-                       'knots'=>0.53996,
-                       'mach STP'=>0.0008380431,
-                       'c (warp)'=>9.265669e-10
+       'Speed'  => ['base'  => 'kmph',
+               'conv' => [
+                       'mps' => 0.0001726031,
+                       'milesph' => 0.62137,
+                       'knots' => 0.53996,
+                       'mach STP' => 0.0008380431,
+                       'c (warp)' => 9.265669e-10
                ]
        ]
 ];
@@ -188,24 +180,21 @@ while (list($key,$val) = each($conversions)) {
 
 
        if (isset($_POST['from_unit']) && isset($_POST['value'])) {
-       $_POST['value'] = $_POST['value'] + 0;
-
-
+               $_POST['value'] = $_POST['value'] + 0;
                $o .= ($conv->getTable($_POST['value'], $_POST['from_unit'], $_POST['to_unit'], 5))."</p>";
        } else {
                $o .= "<p>Select:</p>";
        }
 
-       if(isset($_POST['value']))
+       if (isset($_POST['value'])) {
                $value = $_POST['value'];
-       else
+       } else {
                $value = '';
+       }
 
        $o .= '<form action="convert" method="post" name="conversion">';
-    $o .= '<input name="value" type="text" id="value" value="' . $value . '" size="10" maxlength="10" />';
-    $o .= '<select name="from_unit" size="12">';
-
-
+       $o .= '<input name="value" type="text" id="value" value="' . $value . '" size="10" maxlength="10" />';
+       $o .= '<select name="from_unit" size="12">';
 
        reset($list);
        while(list($key,$val) = each($list)) {
@@ -218,8 +207,7 @@ while (list($key,$val) = each($conversions)) {
        }
 
        $o .= '</select>';
-
-    $o .= '<input type="submit" name="Submit" value="Submit" /></form>';
+       $o .= '<input type="submit" name="Submit" value="Submit" /></form>';
 
        return $o;
 }
index 4225353e64742c6ac69cbdc5e8314c1bc5ddb71c..1588b58233b05ddf0cc4989ade24e84d7e0211ca 100644 (file)
@@ -110,4 +110,3 @@ class Diasphp {
                return true;
        }
 }
-?>
index c0e93f0c669bca25ac77f4ea8daf2ee5d0ad048e..7024c73a98be602cb0fc270907ae52824e4b91b0 100644 (file)
@@ -166,4 +166,3 @@ function leistungsschutzrecht_cron($a,$b) {
        leistungsschutzrecht_fetchsites();
        DI::config()->set('leistungsschutzrecht','last_poll', time());
 }
-?>
index c679ca9da34d6fb30ec3a903066db4a83f580d2d..18aa5c90284c50b5a011c37c55b03836c5dbf29a 100644 (file)
@@ -667,5 +667,3 @@ class Services_Libravatar
  * c-hanging-comment-ender-p: nil
  * End:
  */
-
-?>
index e5e281b9a38a03d473e10cf201f8fa4f91a4ebf6..020c69c4896bd898274fc803bc8cfbbdd6b8fda6 100644 (file)
@@ -1055,5 +1055,3 @@ class CodebirdSN
         return $parsed;
     }
 }
-
-?>
index 194425d58e213103944abd4eda112f91a41bbec0..4597fb1a6933efd2a5129660018330b8888e4e85 100644 (file)
@@ -52,4 +52,3 @@ function webrtc_content(&$a) {
 
         return $o;
 }
-?>