Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/minify/lib/Minify/CommentPreserver.php
Go to the documentation of this file.
00001 <?php
00013 class Minify_CommentPreserver {
00014     
00020     public static $prepend = "\n";
00021     
00027     public static $append = "\n";
00028     
00043     public static function process($content, $processor, $args = array())
00044     {
00045         $ret = '';
00046         while (true) {
00047             list($beforeComment, $comment, $afterComment) = self::_nextComment($content);
00048             if ('' !== $beforeComment) {
00049                 $callArgs = $args;
00050                 array_unshift($callArgs, $beforeComment);
00051                 $ret .= call_user_func_array($processor, $callArgs);    
00052             }
00053             if (false === $comment) {
00054                 break;
00055             }
00056             $ret .= $comment;
00057             $content = $afterComment;
00058         }
00059         return $ret;
00060     }
00061     
00072     private static function _nextComment($in)
00073     {
00074         if (
00075             false === ($start = strpos($in, '', $start + 3))
00077         ) {
00078             return array($in, false, false);
00079         }
00080         $ret = array(
00081             substr($in, 0, $start)
00082             ,self::$prepend . '/*' . substr($in, $start + 3, $end - $start - 1) . self::$append
00083         );
00084         $endChars = (strlen($in) - $end - 2);
00085         $ret[] = (0 === $endChars)
00086             ? ''
00087             : substr($in, -$endChars);
00088         return $ret;
00089     }
00090 }
 All Data Structures Namespaces Files Functions Variables Enumerations