Example #1
0
  public function __call($name, $arguments) {
    
    global $wf;

    $res = parent::__call($name, $arguments);

    if (is_woof_silent($res)) {

      if (is_multisite()) {

        // for unknown methods switch the blog and access this property on WOOF
    
        if (switch_to_blog( $this->id(), true )) {

			    if (method_exists($wf, $name)) {
			      $res = call_user_func_array (array($wf, $name), $arguments); 
			    } else {
				  	$res = $wf->__call($name, $arguments);
					}
					
          restore_current_blog();

          if (!is_woof_silent($res)) {
            return $res;
          }
        }
    
      }
    
    }
    
    return $res;
    
  }
Example #2
0
 public function __get($name) {
   
   global $wf;
   
   // try to find a post type with this name, to get posts for this term
   
   $singular = WOOF_Inflector::singularize($name);
   
   $type = $wf->type($singular);
   
   if ($type->exists()) {
     return $this->posts(array("post_type" => $singular));
   }
   
   return parent::__call($name, array());
   
 }
Example #3
0
    public function __get($name) {

      $type = $this->type($name);
      
      if ($type->exists()) {
        return $type;        
      }
      
      $singular = WOOF_Inflector::singularize($name);
      
      $type = $this->type($singular);
      
      if ($type->exists()) {
        return $type;
      }
      
      // next look for a taxonomy

      $tax = $this->taxonomy($name);
      
      if ($tax->exists()) {
        return $tax;
      }
      
      $tax = $this->taxonomy($singular);
      
      if ($tax->exists()) {
        return $tax;
      }
      
      // now try to call a method on the current wordpress object
      // this way, extension classes can work correctly without needing to call $wf->the.
      
      $obj = $this->object();
      
      if (method_exists($obj, $name)) {
        return call_user_func( array($obj, $name) );
      }
      
      return parent::__get($name);

    }
Example #4
0
 public function __construct($item = null) {
   WOOF_Wrap::__construct($item);
 }
Example #5
0
 public function __get($name) {
   if (isset($this->_meta[$name])) {
     return $this->_meta[$name];
   }
   
   return parent::__get($name);
 }
Example #6
0
 public function __get($name) {
   
   global $wf;
   
   // try to find a taxonomy whose plural name is this $name
   
   $singular = WOOF_Inflector::singularize($name);
   
   $tax = $wf->taxonomy($singular);
   
   if ($tax->exists()) {
     return $this->terms($singular);  
   }
   
   return parent::__get($name);
   
 }