diff options
author | Pascal Chevrel <pascal@chevrel.org> | 2012-03-08 16:12:49 +0100 |
---|---|---|
committer | Pascal Chevrel <pascal@chevrel.org> | 2012-03-08 16:12:49 +0100 |
commit | 66c2ad84d4d493865fbc5a5fbfbbc61ff0bb3edf (patch) | |
tree | d1b6c32e313f0420d7099ea3eadf427955490a5e /app | |
parent | 781e77848b95e81c9865212385bab22f3013061e (diff) | |
download | planet-66c2ad84d4d493865fbc5a5fbfbbc61ff0bb3edf.tar planet-66c2ad84d4d493865fbc5a5fbfbbc61ff0bb3edf.tar.gz planet-66c2ad84d4d493865fbc5a5fbfbbc61ff0bb3edf.tar.bz2 planet-66c2ad84d4d493865fbc5a5fbfbbc61ff0bb3edf.tar.xz planet-66c2ad84d4d493865fbc5a5fbfbbc61ff0bb3edf.zip |
remove lib.String.php and lib.http.php which are included in the archive but not used anywhere
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/lib.String.php | 134 | ||||
-rw-r--r-- | app/lib/lib.http.php | 52 |
2 files changed, 0 insertions, 186 deletions
diff --git a/app/lib/lib.String.php b/app/lib/lib.String.php deleted file mode 100644 index 151d122..0000000 --- a/app/lib/lib.String.php +++ /dev/null @@ -1,134 +0,0 @@ -<?php
-/*
-* Smarty plugin
-*
--------------------------------------------------------------
-* File: modifier.html_substr.php
-* Type: modifier
-* Name: html_substr
-* Version: 1.0
-* Date: June 19th, 2003
-* Purpose: Cut a string preserving any tag nesting and matching.
-* Install: Drop into the plugin directory.
-* Author: Original Javascript Code: Benjamin Lupu <lupufr@aol.com>
-* Translation to PHP & Smarty: Edward Dale <scompt@scompt.com>
-* Modification to add a string: Sebastian Kuhlmann <sebastiankuhlmann@web.de>
-*
--------------------------------------------------------------
-*/ -function smarty_modifier_html_substr($string, $length, $addstring="") -{ - $addstring = " " . $addstring; - - if (strlen($string) > $length) { - if( !empty( $string ) && $length>0 ) { - $addtext = false; - $isText = true; - $ret = ""; - $i = 0; - - $currentChar = ""; - $lastSpacePosition = -1; - $lastChar = ""; - - $tagsArray = array(); - $currentTag = ""; - $tagLevel = 0; - - $noTagLength = strlen( strip_tags( $string ) ); - - // Parser loop - for( $j=0; $j<strlen( $string ); $j++ ) { - - $currentChar = substr( $string, $j, 1 ); - $ret .= $currentChar; - - // Lesser than event - if( $currentChar == "<") $isText = false; - - // Character handler - if( $isText ) { - - // Memorize last space position - if( $currentChar == " " ) { $lastSpacePosition = $j; } - else { $lastChar = $currentChar; } - - $i++; - } else { - $currentTag .= $currentChar; - } - - // Greater than event - if( $currentChar == ">" ) { - $isText = true; - - // Opening tag handler - if( ( strpos( $currentTag, "<" ) !== FALSE ) && - ( strpos( $currentTag, "/>" ) === FALSE ) && - ( strpos( $currentTag, "</") === FALSE ) ) { - - // Tag has attribute(s) - if( strpos( $currentTag, " " ) !== FALSE ) { - $currentTag = substr( $currentTag, 1, strpos( $currentTag, " " ) - 1 ); - } else { - // Tag doesn't have attribute(s) - $currentTag = substr( $currentTag, 1, -1 ); - } - - array_push( $tagsArray, $currentTag ); - - } else if( strpos( $currentTag, "</" ) !== FALSE ) { - array_pop( $tagsArray ); - } - - $currentTag = ""; - } - - if( $i >= $length) { - $addtext = true; - break; - } - } - - // Cut HTML string at last space position - if( $length < $noTagLength ) { - if( $lastSpacePosition != -1 ) { - $ret = substr( $string, 0, $lastSpacePosition ); - } else { - $ret = substr( $string, 0, $j ); - } - } - - // Close broken XHTML elements - while( sizeof( $tagsArray ) != 0 ) { - $aTag = array_pop( $tagsArray ); - $ret .= "</" . $aTag . ">\n"; - } - - } else { - $ret = ""; - } - - // only add string if text was cut - if ( $addtext ) { - return( $ret.$addstring ); - } - else { - return ( $ret ); - } - } else { - return ( $string ); - } -}
-
-//truncate a string
-function string_truncate($string, $length){
- if (strlen($string) < $length){
- return $string;
- }
- else{
- return substr($string, 0, $length)."…";
- }
-}
-
-?>
\ No newline at end of file diff --git a/app/lib/lib.http.php b/app/lib/lib.http.php deleted file mode 100644 index 5fa8193..0000000 --- a/app/lib/lib.http.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * Send HTTP 304 when needed, set ETag and Last-Modified else - * Source : http://annevankesteren.nl/2005/05/http-304 - */ -function http_modified($last_modified, $identifier){ - $etag = '"'.md5($last_modified.$identifier).'"'; - $client_etag = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? trim($_SERVER['HTTP_IF_NONE_MATCH']) : false; - $client_last_modified = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? trim($_SERVER['HTTP_IF_MODIFIED_SINCE']) : 0; - $client_last_modified_timestamp = strtotime($client_last_modified); - $last_modified_timestamp = strtotime($last_modified); - - if(($client_last_modified && $client_etag) ? (($client_last_modified_timestamp == $last_modified_timestamp) && ($client_etag == $etag)) : (($client_last_modified_timestamp == $last_modified_timestamp) || ($client_etag == $etag))){ - header('Not Modified',true,304); - exit(); - }else{ - header('Last-Modified:'.$last_modified); - header('ETag:'.$etag); - } -} - -//http://simonwillison.net/2003/Apr/23/conditionalGet/ -function doConditionalGet($timestamp) { - // A PHP implementation of conditional get, see - // http://fishbowl.pastiche.org/archives/001132.html - $last_modified = substr(date('r', $timestamp), 0, -5).'GMT'; - $etag = '"'.md5($last_modified).'"'; - // Send the headers - header("Last-Modified: $last_modified"); - header("ETag: $etag"); - // See if the client has provided the required headers - $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? - stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : - false; - $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? - stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : - false; - if (!$if_modified_since && !$if_none_match) { - return; - } - // At least one of the headers is there - check them - if ($if_none_match && $if_none_match != $etag) { - return; // etag is there but doesn't match - } - if ($if_modified_since && $if_modified_since != $last_modified) { - return; // if-modified-since is there but doesn't match - } - // Nothing has changed since their last request - serve a 304 and exit - header('HTTP/1.0 304 Not Modified'); - exit; -} -?>
\ No newline at end of file |