~hexmode/+junk/main

« back to all changes in this revision

Viewing changes to install-files/apps/phpmyadmin2.10.1/libraries/transformations/text_plain__substr.inc.php

  • Committer: Mark A. Hershberger
  • Date: 2008-01-05 19:38:56 UTC
  • Revision ID: hershberger@spawn-xp-20080105193856-6rnzgwa4nehue3qj
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/* $Id: text_plain__substr.inc.php 5523 2004-03-09 15:02:28Z nijel $ */
 
3
// vim: expandtab sw=4 ts=4 sts=4:
 
4
 
 
5
function PMA_transformation_text_plain__substr($buffer, $options = array(), $meta = '') {
 
6
    // possibly use a global transform and feed it with special options:
 
7
    // include('./libraries/transformations/global.inc.php');
 
8
 
 
9
    // further operations on $buffer using the $options[] array.
 
10
    if (!isset($options[0]) ||  $options[0] == '') {
 
11
        $options[0] = 0;
 
12
    }
 
13
 
 
14
    if (!isset($options[1]) ||  $options[1] == '') {
 
15
        $options[1] = 'all';
 
16
    }
 
17
 
 
18
    if (!isset($options[2]) || $options[2] == '') {
 
19
        $options[2] = '...';
 
20
    }
 
21
 
 
22
    $newtext = '';
 
23
    if ($options[1] != 'all') {
 
24
        $newtext = PMA_substr($buffer, $options[0], $options[1]);
 
25
    } else {
 
26
        $newtext = PMA_substr($buffer, $options[0]);
 
27
    }
 
28
 
 
29
    $length = strlen($newtext);
 
30
    $baselength = strlen($buffer);
 
31
    if ($length != $baselength) {
 
32
        if ($options[0] != 0) {
 
33
            $newtext = $options[2] . $newtext;
 
34
        }
 
35
 
 
36
        if (($length + $options[0]) != $baselength) {
 
37
            $newtext .= $options[2];
 
38
        }
 
39
    }
 
40
 
 
41
    return $newtext;
 
42
}
 
43
 
 
44
?>