views_php_plugin_wrapper.inc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * A helper class that wraps around the actual views plugin.
  4. *
  5. * @see views_php_plugin_query
  6. * @see views_php_plugin_pager
  7. */
  8. class views_php_plugin_wrapper {
  9. protected $wrapped;
  10. protected $wrapped_link;
  11. public function php_wrap(&$link) {
  12. $this->wrapped_link = &$link;
  13. $this->wrapped = $link;
  14. $link = $this;
  15. }
  16. public function php_unwrap() {
  17. $this->wrapped_link = $this->wrapped;
  18. unset($this->wrapped);
  19. unset($this->wrapped_link);
  20. }
  21. public function &__get($name) {
  22. return $this->wrapped->$name;
  23. }
  24. public function __set($name, $value) {
  25. return $this->wrapped->$name = $value;
  26. }
  27. public function __isset($name) {
  28. return isset($this->wrapped->$name);
  29. }
  30. public function __unset($name) {
  31. unset($this->wrapped->$name);
  32. }
  33. public function __call($name, $arguments) {
  34. return call_user_func_array(array($this->wrapped, $name), $arguments);
  35. }
  36. /** As of PHP 5.3.0 */
  37. public static function __callStatic($name, $arguments) {
  38. return call_user_func_array(array(get_class($this->wrapped), $name), $arguments);
  39. }
  40. }