• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List

system/classes/postinfo.php

00001 <?php
00007 namespace Habari;
00008 
00012 class PostInfo extends InfoRecords
00013 {
00014   function __construct( $post_id = null )
00015   {
00016     parent::__construct( DB::table( 'postinfo' ), "post_id", $post_id ); // call parent with appropriate  parameters
00017   }
00018   
00019   public function __get( $name )
00020   {
00021     
00022     // if there is a _ in the name, there is a filter at the end
00023     if ( strpos( $name, '_' ) !== false ) {
00024       // pick off the last _'d piece
00025       preg_match( '/^(.*)_([^_]+)$/', $name, $matches );
00026       list( $junk, $name, $filter ) = $matches;
00027       
00028       // so that we don't break every info value that has a _ in it, only _out is an acceptable filter name
00029       if ( $filter != 'out' ) {
00030         // put it back together
00031         $name = $name . '_' . $filter;
00032         
00033         // turn off the filter
00034         $filter = false;
00035       }
00036       
00037     }
00038     else {
00039       $filter = false;
00040     }
00041     
00042     // get the value by calling our parent function directly
00043     $value = parent::__get( $name );
00044     
00045     // apply the main filter so values can be altered regardless of any _filter
00046     $value = Plugins::filter( "post_info_{$name}", $value );
00047     
00048     // if there is a filter, apply that specific one too
00049     if ( $filter ) {
00050       $value = Plugins::filter( "post_info_{$name}_{$filter}", $value );
00051     }
00052     
00053     return $value;
00054     
00055   }
00056 }
00057 ?>

Generated on Sun Aug 4 2013 12:51:43 for Habari by  doxygen 1.7.1