Plugin Directory

Changeset 1067071


Ignore:
Timestamp:
01/13/2015 01:47:37 PM (11 years ago)
Author:
aercolino
Message:

Spread @ (error control operator) all over the place to suppress notices when accessing undefined array keys. The value is null, which is pretty good for me, given that I need an empty string in such a case.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • enzymes/trunk/enzymes.2/enzymes.php

    r1064492 r1067071  
    113113    function do_inclusion()
    114114    {
    115         if( '' != $this->matches['template'] )
    116         {
    117             $file_path = ABSPATH . $this->templates_path . $this->matches['template'];
     115        if( '' != @$this->matches['template'] )
     116        {
     117            $file_path = ABSPATH . $this->templates_path . @$this->matches['template'];
    118118            if( file_exists( $file_path ) )
    119119            {
     
    139139    function build_pathway()
    140140    {
    141         if( '' != $this->matches['template'] )
    142         {
    143             if( '/' == $this->matches['tempType'] )
     141        if( '' != @$this->matches['template'] )
     142        {
     143            if( '/' == @$this->matches['tempType'] )
    144144            {
    145145                // slash template
     
    334334    {
    335335        $this->matches = $matches;
    336         if( '' == $matches['sub_block'] )
     336        if( '' == @$matches['sub_block'] )
    337337        {
    338338            // transclusion
    339339            $this->substrate = '';
    340             $this->enzyme = '' == $matches['value']
    341                     ? $this->item( $matches['id'], $matches['glue'], $matches['key'] )
     340            $this->enzyme = '' == @$matches['value']
     341                    ? $this->item( @$matches['id'], @$matches['glue'], @$matches['key'] )
    342342                    : $this->unquote( $matches['value'] );
    343343            $this->merging = 'append';
     
    346346        else {
    347347            // execution
    348             $this->substrate = '' == $matches['sub_value']
    349                     ? $this->item( $matches['sub_id'], $matches['sub_glue'], $matches['sub_key'] )
     348            $this->substrate = '' == @$matches['sub_value']
     349                    ? $this->item( @$matches['sub_id'], @$matches['sub_glue'], @$matches['sub_key'] )
    350350                    : $this->unquote( $matches['sub_value'] );
    351             $this->enzyme = $this->item( $matches['id'], $matches['glue'], $matches['key'] );
     351            $this->enzyme = $this->item( @$matches['id'], @$matches['glue'], @$matches['key'] );
    352352            $this->merging = '';
    353353            $this->do_evaluation();
     
    358358    function cb_strip_blanks( $matches )
    359359    {
    360         list( $all, $before, $quoted, $after ) = $matches;
     360        @list( $all, $before, $quoted, $after ) = $matches;
    361361        $outside = $quoted ? $before : $after;
    362362        //for some reason IE introduces C2 (hex) chars when writing a post
     
    402402                    $this->pathway = '';
    403403                    $matchesIn['rest'] = $sttmnt;
    404                     while( preg_match( '/'.$this->e['pathway1'].'/', $matchesIn['rest'], $matchesIn ) )
     404                    while( preg_match( '/'.$this->e['pathway1'].'/', @$matchesIn['rest'], $matchesIn ) )
    405405                    {
    406406                        $this->catalyze( $matchesIn );
     
    423423{
    424424    global $enzymes;
    425     add_filter('wp_title', array($enzymes, 'metabolism'), 10, 2);
    426     add_filter('the_title', array($enzymes, 'metabolism'), 10, 2);
    427     add_filter('the_title_rss', array($enzymes, 'metabolism'), 10, 2);
    428     add_filter('the_excerpt', array($enzymes, 'metabolism'), 10, 2);
    429     add_filter('the_excerpt_rss', array($enzymes, 'metabolism'), 10, 2);
    430     add_filter('the_content', array($enzymes, 'metabolism'), 10, 2);
     425    add_filter('wp_title', array($enzymes, 'metabolism'), 20, 2);
     426    add_filter('the_title', array($enzymes, 'metabolism'), 20, 2);
     427    add_filter('the_title_rss', array($enzymes, 'metabolism'), 20, 2);
     428    add_filter('the_excerpt', array($enzymes, 'metabolism'), 20, 2);
     429    add_filter('the_excerpt_rss', array($enzymes, 'metabolism'), 20, 2);
     430    add_filter('the_content', array($enzymes, 'metabolism'), 20, 2);
    431431}
    432432add_action('init', 'enzymes2_on_init', 10, 2);
Note: See TracChangeset for help on using the changeset viewer.