Changeset 176

Show
Ignore:
Timestamp:
06/12/08 20:50:10 (4 months ago)
Author:
llaumgui
Message:

Tidy POWA ! ! !

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ez_publish/myutils/trunk/cronjobs/planet.php

    r149 r176  
    482482            $objectAttribute->setContent( $keyword ); 
    483483        } break; 
     484         
     485        case 'eztext': 
     486        { 
     487                setEZTXTAttribute( $objectAttribute, $value ); 
     488        } break; 
    484489 
    485490        default: 
     
    515520} 
    516521 
     522 
     523function setEZTXTAttribute( $attribute, $attributeValue, $link = false ) 
     524{ 
     525        /* Nettoyage tidy */ 
     526        if ( class_exists( 'tidy' ) ) 
     527        { 
     528                $tidy           = new tidy; 
     529                $config   = array(      'show-body-only'     => true, 
     530                                                        'output-xhtml'       => true, 
     531                                                        'wrap'               => 0, 
     532                                                        'alt-text'           => "" 
     533                               ); 
     534                $tidy->parseString( $attributeValue, $config, 'utf8' ); 
     535                $tidy->cleanRepair(); 
     536                $attributeValue = $tidy; 
     537        } 
     538         
     539        /* Liens relatifs dans un flux RSS ! */ 
     540        $attributeValue = preg_replace( '#<img src="/(.+?)" alt="(.?)" />#is',  '', $attributeValue );   
     541         
     542        /* Et hop ! Dans eZ */ 
     543    $attribute->setAttribute( 'data_text', $attributeValue ); 
     544    $attribute->store(); 
     545} 
     546 
     547 
    517548?>