Changeset 34052

Show
Ignore:
Timestamp:
03/07/08 02:54:42 (5 months ago)
Author:
mtekk
Message:

Hopefully we have a fix to the "Warning: strpos() [function.strpos]: Offset not contained in string. in……" that some versions of PHP4 throw.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • breadcrumb-navxt/trunk/breadcrumb_navxt_api.php

    r31132 r34052  
    88 * @author Tom Klingenberg 
    99 * 
    10  * 
     10 * 2008-03-06: 
     11 * FIX: bcn_get                                 -     Reworked the conditions for when spaces 
     12 *                                                          will be preserved. 
    1113 * 2008-02-07: 
    12  * ADD: bcn_get_option_inputvalue - Escape Option Values to be used inside  
    13  *                                  (X)HTML Element Attribute Values. 
    14  * FIX: bcn_get                   - fixed issue solved inside wordpress main  
    15  *                                  codebase in 2007-09. 
    16  *                                  see http://trac.wordpress.org/ticket/4781 
     14 * ADD: bcn_get_option_inputvalue   -     Escape Option Values to be used inside  
     15 *                                        (X)HTML Element Attribute Values. 
     16 * FIX: bcn_get                     -     fixed issue solved inside wordpress main  
     17 *                                        codebase in 2007-09. 
     18 *                                        see http://trac.wordpress.org/ticket/4781 
    1719 */ 
    1820 
     
    4547 * Based off of the suggestions and code of Tom Klingenberg 
    4648 * 
    47  * Removes Faulty Adding Slashes 
     49 * Removes Faulty Adding Slashes and Preserves leading and trailing spaces 
    4850 * 
    4951 * Wordpress adds slashes to Request Variables by Default (before 
     
    6870            return ""; 
    6971      } 
    70       //Preserving the front space if exists 
    71       if(strpos($bcn_value, " ") === 0) 
     72      //Only if we have a string should we check for spaces 
     73      if(is_string($bcn_value)) 
    7274      { 
    73             $bcn_value = " " . ltrim($bcn_value); 
    74       } 
    75       //Preserv the end space if exists 
    76       $bcn_length = strlen($bcn_value) - 1; 
    77       if(strpos($bcn_value, " ", $bcn_length - 1) === $bcn_length) 
    78       { 
    79             $bcn_value = rtrim($bcn_value) . " "; 
     75            //Preserving the front space if exists 
     76            if(strpos($bcn_value, " ") === 0) 
     77            { 
     78                  $bcn_value = " " . ltrim($bcn_value); 
     79            } 
     80            //Preserv the end space if exists 
     81            $bcn_length = strlen($bcn_value) - 1; 
     82            if(strpos($bcn_value, " ", $bcn_length - 1) === $bcn_length) 
     83            { 
     84                  $bcn_value = rtrim($bcn_value) . " "; 
     85            } 
    8086      } 
    8187      //Remove by faulty-wordpress-code added slashes