Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Štvrtok, 28. marec 2024

Rozdiely pre Metafox/lib/Platon.php medzi verziami 1.9 a 1.10

verzia 1.9, 2012/05/15 17:47:56 verzia 1.10, 2014/10/15 13:00:16
Riadok 24 
Riadok 24 
  * @access      public   * @access      public
  */   */
   
 /* $Platon: Metafox/lib/Platon.php,v 1.8 2011-06-17 13:56:38 igor Exp $ */  /* $Platon: Metafox/lib/Platon.php,v 1.9 2012-05-15 17:47:56 igor Exp $ */
   
 class Platon  class Platon
 {  {
Riadok 39  class Platon
Riadok 39  class Platon
      *                                  or false to skip extraction from QS       *                                  or false to skip extraction from QS
      * @return          parsed ID param       * @return          parsed ID param
      */       */
     function parse_id_param($key_name = 'id', $exploded_qs = true) /* {{{ */      static function parse_id_param($key_name = 'id', $exploded_qs = true) /* {{{ */
     {      {
         $ret = '';          $ret = '';
         if ($exploded_qs != false) {          if ($exploded_qs != false) {
Riadok 79  class Platon
Riadok 79  class Platon
      * @param   mixed   $default_value  what to return if variable not present       * @param   mixed   $default_value  what to return if variable not present
      * @return                          stripslashed value of CGI variable       * @return                          stripslashed value of CGI variable
      */       */
     function get_cgi_var($name, $default_value = null) /* {{{ */      static function get_cgi_var($name, $default_value = null) /* {{{ */
     {      {
         static $magic_quotes_gpc = null;          static $magic_quotes_gpc = null;
         if ($magic_quotes_gpc === null) {          if ($magic_quotes_gpc === null) {
Riadok 111  class Platon
Riadok 111  class Platon
      * @param   string  $dir    directory path       * @param   string  $dir    directory path
      * @return                  none       * @return                  none
      */       */
     function chdir_back($dir) /* {{{ */      static function chdir_back($dir) /* {{{ */
     {      {
         $dir_back = Platon::dir_back($dir);          $dir_back = Platon::dir_back($dir);
         if (strlen($dir_back) > 0)          if (strlen($dir_back) > 0)
Riadok 125  class Platon
Riadok 125  class Platon
      * @param   string  $dir    directory path       * @param   string  $dir    directory path
      * @return                  back directory of $dir (contains several '../')       * @return                  back directory of $dir (contains several '../')
      */       */
     function dir_back($dir) /* {{{ */      static function dir_back($dir) /* {{{ */
     {      {
         $dir_back = '';          $dir_back = '';
         $i = substr_count(Platon::append_slash($dir), '/');          $i = substr_count(Platon::append_slash($dir), '/');
Riadok 140  class Platon
Riadok 140  class Platon
      * @param   string  $mtime  microtime (optional)       * @param   string  $mtime  microtime (optional)
      * @return  int     current microtime       * @return  int     current microtime
      */       */
     function get_mtime($mtime = null) /* {{{ */      static function get_mtime($mtime = null) /* {{{ */
     {      {
         if ($mtime === null) {          if ($mtime === null) {
             $mtime = microtime();              $mtime = microtime();
Riadok 157  class Platon
Riadok 157  class Platon
      * @param   boolean $temporary  if such redirect is only temporary one       * @param   boolean $temporary  if such redirect is only temporary one
      * @todo    implement HTML page redirecting if output was aleady sent       * @todo    implement HTML page redirecting if output was aleady sent
      */       */
     function redirect($where, $temporary = false, $status_code = 301) /* {{{ */      static function redirect($where, $temporary = false, $status_code = 301) /* {{{ */
     {      {
         $url = '';          $url = '';
         if (! strncmp($where, "ftp://", 6)          if (! strncmp($where, "ftp://", 6)
Riadok 205  class Platon
Riadok 205  class Platon
      * @param   string  $old_http_host  source HTTP host (string or array)       * @param   string  $old_http_host  source HTTP host (string or array)
      *                                  empty string means any host       *                                  empty string means any host
      */       */
     function redirect_change_host($new_http_host, $old_http_host = '') /* {{{ */      static function redirect_change_host($new_http_host, $old_http_host = '') /* {{{ */
     {      {
         if (strlen($_SERVER['HTTP_HOST']) <= 0) {          if (strlen($_SERVER['HTTP_HOST']) <= 0) {
             return;              return;
Riadok 236  class Platon
Riadok 236  class Platon
      * @param   string  $url    url where to redirect       * @param   string  $url    url where to redirect
      * @return                  allways true       * @return                  allways true
      */       */
     function redirect_test($file, $url) /* {{{ */      static function redirect_test($file, $url) /* {{{ */
     {      {
         if (is_array($file)) {          if (is_array($file)) {
             foreach ($file as $one_file) {              foreach ($file as $one_file) {
Riadok 289  class Platon
Riadok 289  class Platon
      *                             if null, empty values will be skipped       *                             if null, empty values will be skipped
      * @return                     get HTML code of original variables       * @return                     get HTML code of original variables
      */       */
     function get_origvars_html($origvars, $method = 'POST', $default = '') /* {{{ */      static function get_origvars_html($origvars, $method = 'POST', $default = '') /* {{{ */
     {      {
         $ret    = '';          $ret    = '';
         $method = strtoupper($method);          $method = strtoupper($method);
Riadok 351  class Platon
Riadok 351  class Platon
      * @author  Nathan Codding       * @author  Nathan Codding
      * @date    24/Aug/2000       * @date    24/Aug/2000
      */       */
     function undo_htmlspecialchars($str) /* {{{ */      static function undo_htmlspecialchars($str) /* {{{ */
     {      {
         $str = preg_replace('/&gt;/i',   '>',  $str);          $str = preg_replace('/&gt;/i',   '>',  $str);
         $str = preg_replace('/&lt;/i',   '<',  $str);          $str = preg_replace('/&lt;/i',   '<',  $str);
Riadok 371  class Platon
Riadok 371  class Platon
      * @param   int     $uppercased     if to randomize letter case       * @param   int     $uppercased     if to randomize letter case
      * @author  Sebastien Cevey <seb@cine7.net>       * @author  Sebastien Cevey <seb@cine7.net>
      */       */
     function rand_pass /* {{{ */      static function rand_pass /* {{{ */
         ($array = null, $num_letters = 6, $max_letters = 10, $uppercased = 0)          ($array = null, $num_letters = 6, $max_letters = 10, $uppercased = 0)
     {      {
         // Pronounceable pieces of words          // Pronounceable pieces of words
Riadok 418  class Platon
Riadok 418  class Platon
      * @param   int     $len    length of string       * @param   int     $len    length of string
      * @return  string          generated random string       * @return  string          generated random string
      */       */
     function rand_str($len = 8) /* {{{ */      static function rand_str($len = 8) /* {{{ */
     {      {
         $s = '';          $s = '';
         for ($i = 0; $i < $len; $i++) {          for ($i = 0; $i < $len; $i++) {
Riadok 444  class Platon
Riadok 444  class Platon
      * @param   char    $char       character to append, slash by default       * @param   char    $char       character to append, slash by default
      * @return                      changed string on success, false on failure       * @return                      changed string on success, false on failure
      */       */
     function append_slash($string, $char = '/') /* {{{ */      static function append_slash($string, $char = '/') /* {{{ */
     {      {
         if (! is_string($string) || ! is_string($char)) {          if (! is_string($string) || ! is_string($char)) {
             return false;              return false;
Riadok 464  class Platon
Riadok 464  class Platon
      * @param   array   $substr_ar  substring arrays       * @param   array   $substr_ar  substring arrays
      * @return  mixed               value from $substr_ar or false       * @return  mixed               value from $substr_ar or false
      */       */
     function set_value_by_substr($string, $substr_ar) /* {{{ */      static function set_value_by_substr($string, $substr_ar) /* {{{ */
     {      {
         if (! is_array($substr_ar)) {          if (! is_array($substr_ar)) {
             return stristr($substr_ar, $string) != false ? $substr_ar : '';              return stristr($substr_ar, $string) != false ? $substr_ar : '';
Riadok 484  class Platon
Riadok 484  class Platon
      * @param   string  $subject    where perform replacement       * @param   string  $subject    where perform replacement
      * @return  string              string with replaced postfix       * @return  string              string with replaced postfix
      */       */
     function str_replace_postfix($search, $replace, $subject) /* {{{ */      static function str_replace_postfix($search, $replace, $subject) /* {{{ */
     {      {
         $idx = strlen($subject) - strlen($search);          $idx = strlen($subject) - strlen($search);
         if ($idx < 0) {          if ($idx < 0) {
Riadok 504  class Platon
Riadok 504  class Platon
      * @param   string  $subject    where perform replacement       * @param   string  $subject    where perform replacement
      * @return  string              string with replaced prefix       * @return  string              string with replaced prefix
      */       */
     function str_replace_prefix($search, $replace, $subject) /* {{{ */      static function str_replace_prefix($search, $replace, $subject) /* {{{ */
     {      {
         if (! strncmp($subject, $search, strlen($search))) {          if (! strncmp($subject, $search, strlen($search))) {
             return $replace . substr($subject, strlen($search));              return $replace . substr($subject, strlen($search));
Riadok 523  class Platon
Riadok 523  class Platon
      * @author  Frank Schmitt <frank.schmitt@vista.com>       * @author  Frank Schmitt <frank.schmitt@vista.com>
      * @date    May/2002       * @date    May/2002
      */       */
     function pretty_substr($string, $length, $slop = 4, $use_hellip = false) /* {{{ */      static function pretty_substr($string, $length, $slop = 4, $use_hellip = false) /* {{{ */
     {      {
         if (strlen($string) > $length) {          if (strlen($string) > $length) {
             $string    = substr($string, 0, $length - 1);              $string    = substr($string, 0, $length - 1);
Riadok 542  class Platon
Riadok 542  class Platon
 # set define off; -- makes it so SQL*Plus doesn't choke on the '&'  # set define off; -- makes it so SQL*Plus doesn't choke on the '&'
 #  #
 # create or replace  # create or replace
 # function pretty_substr  # static function pretty_substr
 # (  # (
 #     str       in    varchar2,  #     str       in    varchar2,
 #     len       in    number,  #     len       in    number,
Riadok 576  class Platon
Riadok 576  class Platon
      * @param   int     $number intput number       * @param   int     $number intput number
      * @return  string          output number       * @return  string          output number
      */       */
     function get_english_num($number) /* {{{ */      static function get_english_num($number) /* {{{ */
     {      {
         $number = intval($number);          $number = intval($number);
         switch ($number % 10) {          switch ($number % 10) {
Riadok 594  class Platon
Riadok 594  class Platon
      * @param   string  $str    string to escape       * @param   string  $str    string to escape
      * @return  string          HTML escaped string with spaces substitued       * @return  string          HTML escaped string with spaces substitued
      */       */
     function htmlspecialchars2($str) /* {{{ */      static function htmlspecialchars2($str) /* {{{ */
     {      {
         return str_replace(' ', '&nbsp;', htmlspecialchars($str));          return str_replace(' ', '&nbsp;', htmlspecialchars($str));
     } /* }}} */      } /* }}} */
Riadok 605  class Platon
Riadok 605  class Platon
      * @param   string  $str    input string       * @param   string  $str    input string
      * @return  string          replaced string       * @return  string          replaced string
      */       */
     function tilde_replace($str) /* {{{ */      static function tilde_replace($str) /* {{{ */
     {      {
         $str = str_replace('/~', '/<TILDE>', $str);          $str = str_replace('/~', '/<TILDE>', $str);
         $str = str_replace('~', '&nbsp;', $str);          $str = str_replace('~', '&nbsp;', $str);
Riadok 619  class Platon
Riadok 619  class Platon
      * @param  string  $file   filename       * @param  string  $file   filename
      * @return string          MD5sum of file or false if file not found       * @return string          MD5sum of file or false if file not found
      */       */
     function md5sum($file) /* {{{ */      static function md5sum($file) /* {{{ */
     {      {
         if (($fhandle = @fopen($file, 'r')) === false) {          if (($fhandle = @fopen($file, 'r')) === false) {
             return false;              return false;
Riadok 648  class Platon
Riadok 648  class Platon
      *                          attributes may be added       *                          attributes may be added
      * @return  string          escaped e-mail added       * @return  string          escaped e-mail added
      */       */
     function escape_email($email, $mode = 'hypertext_link', $attr = '')/* {{{ */      static function escape_email($email, $mode = 'hypertext_link', $attr = '')/* {{{ */
     {      {
         $ret = '';          $ret = '';
         switch ($mode) {          switch ($mode) {
Riadok 717  class Platon
Riadok 717  class Platon
      * @param   char    $sep                separator (default: &)       * @param   char    $sep                separator (default: &)
      * @return  string                      modified query string       * @return  string                      modified query string
      */       */
     function query_string_remove_param($query_string, $param, $sep = '&') /* {{{ */      static function query_string_remove_param($query_string, $param, $sep = '&') /* {{{ */
     {      {
         $regexp = $sep.$param.'=[^'.$sep.']*';          $regexp = $sep.$param.'=[^'.$sep.']*';
         $array  = preg_split("/$regexp/", $sep.$query_string);          $array  = preg_split("/$regexp/", $sep.$query_string);
Riadok 733  class Platon
Riadok 733  class Platon
      * @param   mixed   $url    string URL or array from Platon::glue_url()       * @param   mixed   $url    string URL or array from Platon::glue_url()
      * @return  string          path without scriptname       * @return  string          path without scriptname
      */       */
     function get_path_without_scriptname($url) /* {{{ */      static function get_path_without_scriptname($url) /* {{{ */
     {      {
         $path = is_array($url) ? $url['path'] : $url;          $path = is_array($url) ? $url['path'] : $url;
         $path = preg_replace('/http[s]?:\/\/[^\/]+/', '', $path);          $path = preg_replace('/http[s]?:\/\/[^\/]+/', '', $path);
Riadok 751  class Platon
Riadok 751  class Platon
      * @author  Tomas V.V.Cox <cox@idecnet.com>       * @author  Tomas V.V.Cox <cox@idecnet.com>
      * @date    19/Feb/2001       * @date    19/Feb/2001
      */       */
     function glue_url($url) /* {{{ */      static function glue_url($url) /* {{{ */
     {      {
         if (! is_array($url))          if (! is_array($url))
             return false;              return false;
Riadok 787  class Platon
Riadok 787  class Platon
      *                                 "en-us" does not result into "en")       *                                 "en-us" does not result into "en")
      * @return string  array of accepted languages according to Q       * @return string  array of accepted languages according to Q
      */       */
     function parse_HTTP_accept_language($accept_lang = null, $strict = 0) /* {{{ */      static function parse_HTTP_accept_language($accept_lang = null, $strict = 0) /* {{{ */
     {      {
         $accept_lang == null && $accept_lang = (string) @$_SERVER['HTTP_ACCEPT_LANGUAGE'];          $accept_lang == null && $accept_lang = (string) @$_SERVER['HTTP_ACCEPT_LANGUAGE'];
         $accept_lang = strtolower($accept_lang);          $accept_lang = strtolower($accept_lang);
Riadok 824  class Platon
Riadok 824  class Platon
      *                                  it will extracted from environment)       *                                  it will extracted from environment)
      * @return string  top level domain name       * @return string  top level domain name
      */       */
     function get_top_level_domain($remote_host = null) /* {{{ */      static function get_top_level_domain($remote_host = null) /* {{{ */
     {      {
         $remote_host == null && $remote_host = @$_SERVER['REMOTE_HOST'];          $remote_host == null && $remote_host = @$_SERVER['REMOTE_HOST'];
         if (empty($remote_host)) {          if (empty($remote_host)) {
Riadok 847  class Platon
Riadok 847  class Platon
      *                                  see Platon::get_top_level_domain()       *                                  see Platon::get_top_level_domain()
      * @return  string  negotiated language ($accepted array member)       * @return  string  negotiated language ($accepted array member)
      */       */
     function negotiate_language($l_core_ar, $accept_lang = null, $remote_host = null) /* {{{ */      static function negotiate_language($l_core_ar, $accept_lang = null, $remote_host = null) /* {{{ */
     {      {
         // Sanity check          // Sanity check
         if (count($l_core_ar) < 2) {          if (count($l_core_ar) < 2) {

Legend:
Odstranené z verzie1.9  
zmenené riadky
  Pridané vo verzii1.10

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok