/products/photocrati_nextgen/modules/mvc/package.module.mvc.php

  1. <?php 
  2. /** 
  3. * Class A_MVC_Factory 
  4. * @mixin C_Component_Factory 
  5. * @adapts I_Component_Factory 
  6. */ 
  7. class A_MVC_Factory extends Mixin 
  8. function mvc_view($template, $params = array(), $engine = 'php', $context = FALSE) 
  9. return new C_MVC_View($template, $params, $engine, $context); 
  10. /** 
  11. * Class A_MVC_Fs 
  12. * @mixin C_Fs 
  13. * @adapts I_Fs 
  14. */ 
  15. class A_MVC_Fs extends Mixin 
  16. static $_lookups = array(); 
  17. static $_non_minified_modules = array(); 
  18. function _get_cache_key() 
  19. return C_Photocrati_Transient_Manager::create_key('MVC', 'find_static_abspath'); 
  20. function initialize() 
  21. register_shutdown_function(array(&$this, 'cache_lookups')); 
  22. //self::$_lookups = C_Photocrati_Transient_Manager::fetch($this->_get_cache_key(), array()); 
  23. self::$_non_minified_modules = apply_filters('ngg_non_minified_modules', array()); 
  24. function cache_lookups() 
  25. C_Photocrati_Transient_Manager::update($this->_get_cache_key(), self::$_lookups); 
  26. /** 
  27. * Gets the absolute path to a static resource. If it doesn't exist, then NULL is returned 
  28. * 
  29. * @param string $path 
  30. * @param string $module 
  31. * @param string $relative 
  32. * @return string|NULL 
  33. */ 
  34. function find_static_abspath($path, $module = FALSE, $relative = FALSE, &$found_root = FALSE) 
  35. $retval = NULL; 
  36. $key = $this->_get_static_abspath_key($path, $module, $relative); 
  37. // Have we looked up this resource before? 
  38. if (isset(self::$_lookups[$key])) { 
  39. $retval = self::$_lookups[$key]; 
  40. } else { 
  41. // Get the module if we haven't got one yet 
  42. if (!$module) { 
  43. list($path, $module) = $this->object->parse_formatted_path($path); 
  44. // Lookup the module directory 
  45. $mod_dir = $this->object->get_registry()->get_module_dir($module); 
  46. $filter = has_filter('ngg_non_minified_files') ? apply_filters('ngg_non_minified_files', $path, $module) : FALSE; 
  47. if (!defined('SCRIPT_DEBUG')) { 
  48. define('SCRIPT_DEBUG', FALSE); 
  49. if (!SCRIPT_DEBUG && !in_array($module, self::$_non_minified_modules) && strpos($path, 'min.') === FALSE && strpos($path, 'pack.') === FALSE && strpos($path, 'packed.') === FALSE && preg_match('/\\.(js|css)$/', $path) && !$filter) { 
  50. $path = preg_replace("#\\.[^\\.]+\$#", ".min\\0", $path); 
  51. // In case NextGen is in a symlink we make $mod_dir relative to the NGG root and then rebuild it 
  52. // using WP_PLUGIN_DIR; without this NGG-in-symlink creates URL that reference the file abspath 
  53. if (is_link($this->object->join_paths(WP_PLUGIN_DIR, basename(NGG_PLUGIN_DIR)))) { 
  54. $mod_dir = str_replace(dirname(NGG_PLUGIN_DIR), '', $mod_dir); 
  55. $mod_dir = $this->object->join_paths(WP_PLUGIN_DIR, $mod_dir); 
  56. // Create the absolute path to the file 
  57. $path = $this->object->join_paths($mod_dir, C_NextGen_Settings::get_instance()->get('mvc_static_dirname'), $path); 
  58. if ($relative) { 
  59. $original_length = strlen($path); 
  60. $roots = array('plugins', 'plugins_mu', 'templates', 'stylesheets'); 
  61. $found_root = FALSE; 
  62. foreach ($roots as $root) { 
  63. $path = str_replace($this->object->get_document_root($root), '', $path); 
  64. if (strlen($path) != $original_length) { 
  65. $found_root = $root; 
  66. break; 
  67. // Cache result 
  68. $retval = self::$_lookups[$key] = $path; 
  69. return $retval; 
  70. function _get_static_abspath_key($path, $module = FALSE, $relative = FALSE) 
  71. $key = $path; 
  72. if ($module) { 
  73. $key .= '|' . $module; 
  74. if ($relative) { 
  75. $key .= 'r'; 
  76. global $wpdb; 
  77. if ($wpdb) { 
  78. $key .= '|' . $wpdb->blogid; 
  79. return $key; 
  80. /** 
  81. * Gets the relative path to a static resource. If it doesn't exist, then NULL is returned 
  82. * 
  83. * @param string $path 
  84. * @param string $module 
  85. * @return string|NULL 
  86. */ 
  87. function find_static_relpath($path, $module = FALSE) 
  88. return $this->object->find_static_abspath($path, $module, TRUE); 
  89. /** 
  90. * Class A_MVC_Router 
  91. * @mixin C_Router 
  92. * @adapts I_Router 
  93. */ 
  94. class A_MVC_Router extends Mixin 
  95. static $_lookups = array(); 
  96. function initialize() 
  97. register_shutdown_function(array(&$this, 'cache_lookups')); 
  98. self::$_lookups = C_Photocrati_Transient_Manager::fetch($this->_get_cache_key(), array()); 
  99. function _get_cache_key() 
  100. return C_Photocrati_Transient_Manager::create_key('MVC', 'get_static_url'); 
  101. function cache_lookups() 
  102. C_Photocrati_Transient_Manager::update($this->_get_cache_key(), self::$_lookups); 
  103. function _get_static_url_key($path, $module = FALSE) 
  104. $parts = array($path, $module, $this->object->get_base_url('plugins'), $this->object->get_base_url('plugins_mu'), $this->object->get_base_url('templates'), $this->object->get_base_url('stylesheets')); 
  105. return implode('|', $parts); 
  106. /** 
  107. * First tries to find the static file in the 'static' folder 
  108. * @param string $path 
  109. * @param string $module 
  110. * @return string 
  111. */ 
  112. function get_static_url($path, $module = FALSE) 
  113. $retval = NULL; 
  114. $key = $this->object->_get_static_url_key($path, $module); 
  115. // Have we looked up this url before? 
  116. if (isset(self::$_lookups[$key])) { 
  117. $retval = self::$_lookups[$key]; 
  118. $fs = C_Fs::get_instance(); 
  119. // Check for a user-supplied override 
  120. if (NULL === $retval) { 
  121. $formatted_path = $fs->parse_formatted_path($path); 
  122. $abspath = $fs->join_paths($this->object->get_static_override_dir($formatted_path[1]), $formatted_path[0]); 
  123. if (@is_file($abspath)) { 
  124. $abspath = str_replace($fs->get_document_root('content'), '', $abspath); 
  125. $retval = self::$_lookups[$key] = $this->object->join_paths($this->object->get_base_url('content'), str_replace("\\", '/', $abspath)); 
  126. // We'll have to calculate the url from our own modules 
  127. if (NULL === $retval) { 
  128. $path = $fs->find_static_abspath($path, $module); 
  129. $original_length = strlen($path); 
  130. $roots = array('plugins', 'plugins_mu', 'templates', 'stylesheets'); 
  131. $found_root = FALSE; 
  132. foreach ($roots as $root) { 
  133. $path = str_replace($fs->get_document_root($root), '', $path); 
  134. if (strlen($path) != $original_length) { 
  135. $found_root = $root; 
  136. break; 
  137. // We found the root so we know what base url to prepend 
  138. if ($found_root) { 
  139. $retval = self::$_lookups[$key] = $this->object->join_paths($this->object->get_base_url($found_root), str_replace("\\", '/', $path)); 
  140. } else { 
  141. $retval = self::$_lookups[$key] = $this->object->join_paths($this->object->get_base_url('root'), str_replace("\\", '/', $path)); 
  142. // For the "Sage" theme and others using the "Soil" plugin "Roots" theme was re-branded to "Sage" theme 
  143. // 2015-02-25; see https://roots.io/new-website-sage-and-the-future/ 
  144. if ((current_theme_supports('soil-relative-urls') || current_theme_supports('root-relative-urls')) && strpos($retval, '/') !== 0) { 
  145. $retval = '/' . $retval; 
  146. return $retval; 
  147. /** 
  148. * @param string $module_id 
  149. * 
  150. * @return string $dir 
  151. */ 
  152. function get_static_override_dir($module_id = NULL) 
  153. $fs = C_Fs::get_instance(); 
  154. $dir = $fs->join_paths(WP_CONTENT_DIR, 'ngg'); 
  155. if (!@file_exists($dir)) { 
  156. wp_mkdir_p($dir); 
  157. $dir = $fs->join_paths($dir, 'modules'); 
  158. if (!@file_exists($dir)) { 
  159. wp_mkdir_p($dir); 
  160. if ($module_id) { 
  161. $dir = $fs->join_paths($dir, $module_id); 
  162. if (!@file_exists($dir)) { 
  163. wp_mkdir_p($dir); 
  164. $dir = $fs->join_paths($dir, 'static'); 
  165. if (!@file_exists($dir)) { 
  166. wp_mkdir_p($dir); 
  167. return $dir; 
  168. if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { 
  169. die('You are not allowed to call this page directly.'); 
  170. class Mixin_MVC_Controller_Defaults extends Mixin 
  171. // Provide a default view 
  172. function index_action($return = FALSE) 
  173. return $this->render_view('photocrati-mvc#index', array(), $return); 
  174. /** 
  175. * Provides actions that are executed based on the requested url 
  176. * @mixin Mixin_MVC_Controller_Defaults 
  177. * @mixin Mixin_MVC_Controller_Instance_Methods 
  178. * @implements I_MVC_Controller 
  179. */ 
  180. abstract class C_MVC_Controller extends C_Component 
  181. var $_content_type = 'text/html'; 
  182. var $message = ''; 
  183. var $debug = FALSE; 
  184. function define($context = FALSE) 
  185. parent::define($context); 
  186. $this->add_mixin('Mixin_MVC_Controller_Defaults'); 
  187. $this->add_mixin('Mixin_MVC_Controller_Instance_Methods'); 
  188. $this->implement('I_MVC_Controller'); 
  189. /** 
  190. * Adds methods for MVC Controller 
  191. */ 
  192. class Mixin_MVC_Controller_Instance_Methods extends Mixin 
  193. function set_content_type($type) 
  194. switch ($type) { 
  195. case 'html': 
  196. case 'xhtml': 
  197. $type = 'text/html'; 
  198. break; 
  199. case 'xml': 
  200. $type = 'text/xml'; 
  201. break; 
  202. case 'rss': 
  203. case 'rss2': 
  204. $type = 'application/rss+xml'; 
  205. break; 
  206. case 'css': 
  207. $type = 'text/css'; 
  208. break; 
  209. case 'javascript': 
  210. case 'jscript': 
  211. case 'emcascript': 
  212. $type = 'text/javascript'; 
  213. break; 
  214. case 'json': 
  215. $type = 'application/json'; 
  216. break; 
  217. case 'jpeg': 
  218. case 'jpg': 
  219. case 'jpe': 
  220. $type = 'image/jpeg'; 
  221. break; 
  222. case 'gif': 
  223. $type = 'image/gif'; 
  224. break; 
  225. case 'png': 
  226. $type = 'image/x-png'; 
  227. break; 
  228. case 'tiff': 
  229. case 'tif': 
  230. $type = 'image/tiff'; 
  231. break; 
  232. case 'pdf': 
  233. $type = 'application/pdf'; 
  234. break; 
  235. $this->object->_content_type = $type; 
  236. return $type; 
  237. function do_not_cache() 
  238. if (!headers_sent()) { 
  239. header('Cache-Control: no-cache'); 
  240. header('Pragma: no-cache'); 
  241. function expires($time) 
  242. $time = strtotime($time); 
  243. if (!headers_sent()) { 
  244. header('Expires: ' . strftime("%a, %d %b %Y %H:%M:%S %Z", $time)); 
  245. function http_error($message, $code = 501) 
  246. $this->message = $message; 
  247. $method = "http_{$code}_action"; 
  248. $this->{$method}(); 
  249. function is_valid_request($method) 
  250. return TRUE; 
  251. function is_post_request() 
  252. return "POST" == $this->object->get_router()->get_request_method(); 
  253. function is_get_request() 
  254. return "GET" == $this->object->get_router()->get_request_method(); 
  255. function is_delete_request() 
  256. return "DELETE" == $this->object->get_router()->get_request_method(); 
  257. function is_put_request() 
  258. return "PUT" == $this->object->get_router()->get_request_method(); 
  259. function is_custom_request($type) 
  260. return strtolower($type) == strtolower($this->object->get_router()->get_request_method()); 
  261. function get_router() 
  262. return C_Router::get_instance(); 
  263. function get_routed_app() 
  264. return $this->object->get_router()->get_routed_app(); 
  265. /** 
  266. * Returns the value of a parameters 
  267. * @param string $key 
  268. * @return mixed 
  269. */ 
  270. function param($key, $prefix = NULL, $default = NULL) 
  271. return $this->object->get_routed_app()->get_parameter($key, $prefix, $default); 
  272. function set_param($key, $value, $id = NULL, $use_prefix = FALSE) 
  273. return $this->object->get_routed_app()->set_parameter($key, $value, $id, $use_prefix); 
  274. function set_param_for($url, $key, $value, $id = NULL, $use_prefix = FALSE) 
  275. return $this->object->get_routed_app()->set_parameter($key, $value, $id, $use_prefix, $url); 
  276. function remove_param($key, $id = NULL) 
  277. return $this->object->get_routed_app()->remove_parameter($key, $id); 
  278. function remove_param_for($url, $key, $id = NULL) 
  279. $app = $this->object->get_routed_app(); 
  280. $retval = $app->remove_parameter($key, $id, $url); 
  281. return $retval; 
  282. /** 
  283. * Gets the routed url, generated by the Routing App 
  284. * @return string 
  285. */ 
  286. function get_routed_url($with_qs = FALSE) 
  287. return $this->object->get_routed_app()->get_app_url(FALSE, $with_qs); 
  288. /** 
  289. * Gets the absolute path of a static resource 
  290. * @param string $path 
  291. * @param string $module 
  292. * @param boolean $relative 
  293. * @return string 
  294. */ 
  295. function get_static_abspath($path, $module = FALSE, $relative = FALSE) 
  296. return C_Fs::get_instance()->find_static_abspath($path, $module); 
  297. /** 
  298. * Gets the relative path of a static resource 
  299. * @param string $path 
  300. * @param string $module 
  301. * @return string 
  302. */ 
  303. function get_static_relpath($path, $module = FALSE) 
  304. return C_Fs::get_instance()->find_static_abspath($path, $module, TRUE); 
  305. function get_static_url($path, $module = FALSE) 
  306. return C_Router::get_instance()->get_static_url($path, $module); 
  307. /** 
  308. * Renders a template and outputs the response headers 
  309. * @param string $name 
  310. * @param array $vars 
  311. */ 
  312. function render_view($name, $vars = array(), $return = FALSE) 
  313. $this->object->render(); 
  314. return $this->object->render_partial($name, $vars, $return); 
  315. /** 
  316. * Outputs the response headers 
  317. */ 
  318. function render() 
  319. if (!headers_sent()) { 
  320. header('Content-Type: ' . $this->object->_content_type . '; charset=' . get_option('blog_charset'), true); 
  321. /** 
  322. * Renders a view 
  323. */ 
  324. function render_partial($template, $params = array(), $return = FALSE, $context = NULL) 
  325. // We'll use the name of the view as the context if one hasn't been provided 
  326. if (is_null($context)) { 
  327. $context = $template; 
  328. $view = $this->object->create_view($template, $params, $context); 
  329. return $view->render($return); 
  330. function create_view($template, $params = array(), $context = NULL) 
  331. $factory = C_Component_Factory::get_instance(); 
  332. $view = $factory->create('mvc_view', $template, $params, NULL, $context); 
  333. return $view; 
  334. /** 
  335. * Class C_MVC_View 
  336. * @mixin Mixin_Mvc_View_Instance_Methods 
  337. * @implements I_MVC_View 
  338. */ 
  339. class C_MVC_View extends C_Component 
  340. var $_template = ''; 
  341. var $_engine = ''; 
  342. var $_params = array(); 
  343. var $_queue = array(); 
  344. function __construct($template, $params = array(), $engine = 'php', $context = FALSE) 
  345. $this->_template = $template; 
  346. $this->_params = (array) $params; 
  347. $this->_engine = $engine; 
  348. parent::__construct(); 
  349. function define($context = FALSE) 
  350. parent::define($context); 
  351. $this->implement('I_MVC_View'); 
  352. $this->add_mixin('Mixin_Mvc_View_Instance_Methods'); 
  353. class Mixin_Mvc_View_Instance_Methods extends Mixin 
  354. /** 
  355. * Returns the variables to be used in the template 
  356. * @return array 
  357. */ 
  358. function get_template_vars() 
  359. $retval = array(); 
  360. foreach ($this->object->_params as $key => $value) { 
  361. if (strpos($key, '_template') !== FALSE) { 
  362. $value = $this->object->get_template_abspath($value); 
  363. $retval[$key] = $value; 
  364. return $retval; 
  365. /** 
  366. * Returns the abspath of the template to be rendered 
  367. * @param string $key 
  368. * @return string 
  369. */ 
  370. function get_template_abspath($value = NULL) 
  371. if (!$value) { 
  372. $value = $this->object->_template; 
  373. if ($value[0] == '/' && @file_exists($value)) { 
  374. // key is already abspath 
  375. } else { 
  376. $value = $this->object->find_template_abspath($value); 
  377. return $value; 
  378. /** 
  379. * Renders the view (template) 
  380. * @param string $__return 
  381. * @return string|NULL 
  382. */ 
  383. function render($return = FALSE) 
  384. $element = $this->object->render_object(); 
  385. $content = $this->object->rasterize_object($element); 
  386. if (!$return) { 
  387. echo $content; 
  388. return $content; 
  389. function render_object() 
  390. // We use underscores to prefix local variables to avoid conflicts wth 
  391. // template vars 
  392. $__element = $this->start_element($this->object->_template, 'template', $this->object); 
  393. extract($this->object->get_template_vars()); 
  394. include $this->object->get_template_abspath(); 
  395. $this->end_element(); 
  396. return $__element; 
  397. function rasterize_object($element) 
  398. return $element->rasterize(); 
  399. function start_element($id, $type = null, $context = null) 
  400. if ($type == null) { 
  401. $type = 'element'; 
  402. $count = count($this->object->_queue); 
  403. $element = new C_MVC_View_Element($id, $type); 
  404. if ($context != null) { 
  405. if (!is_array($context)) { 
  406. $context = array('object' => $context); 
  407. foreach ($context as $context_name => $context_value) { 
  408. $element->set_context($context_name, $context_value); 
  409. $this->object->_queue[] = $element; 
  410. if ($count > 0) { 
  411. $old_element = $this->object->_queue[$count - 1]; 
  412. $content = ob_get_contents(); 
  413. ob_clean(); 
  414. $old_element->append($content); 
  415. $old_element->append($element); 
  416. ob_start(); 
  417. return $element; 
  418. function end_element() 
  419. $content = ob_get_clean(); 
  420. $element = array_pop($this->object->_queue); 
  421. if ($content != null) { 
  422. $element->append($content); 
  423. return $element; 
  424. /** 
  425. * Renders a sub-template for the view 
  426. * @param string $__template 
  427. * @param array $__params 
  428. * @param string $__return 
  429. * @return NULL 
  430. */ 
  431. function include_template($__template, $__params = null, $__return = FALSE) 
  432. // We use underscores to prefix local variables to avoid conflicts wth 
  433. // template vars 
  434. if ($__params == null) { 
  435. $__params = array(); 
  436. $__params['template_origin'] = $this->object->_template; 
  437. $__target = $this->object->get_template_abspath($__template); 
  438. $__origin_target = $this->object->get_template_abspath($this->object->_template); 
  439. $__image_before_target = $this->object->get_template_abspath('photocrati-nextgen_gallery_display#image/before'); 
  440. $__image_after_target = $this->object->get_template_abspath('photocrati-nextgen_gallery_display#image/after'); 
  441. if ($__origin_target != $__target) { 
  442. if ($__target == $__image_before_target) { 
  443. $__image = isset($__params['image']) ? $__params['image'] : null; 
  444. $this->start_element('nextgen_gallery.image_panel', 'item', $__image); 
  445. if ($__target == $__image_after_target) { 
  446. $this->end_element(); 
  447. extract($__params); 
  448. include $__target; 
  449. if ($__target == $__image_before_target) { 
  450. $__image = isset($__params['image']) ? $__params['image'] : null; 
  451. $this->start_element('nextgen_gallery.image', 'item', $__image); 
  452. if ($__target == $__image_after_target) { 
  453. $this->end_element(); 
  454. /** 
  455. * Gets the absolute path of an MVC template file 
  456. * 
  457. * @param string $path 
  458. * @param string $module 
  459. * @return string 
  460. */ 
  461. function find_template_abspath($path, $module = FALSE) 
  462. $fs = C_Fs::get_instance(); 
  463. $settings = C_NextGen_Settings::get_instance(); 
  464. // We also accept module_name#path, which needs parsing. 
  465. if (!$module) { 
  466. list($path, $module) = $fs->parse_formatted_path($path); 
  467. // Append the suffix 
  468. $path = $path . '.php'; 
  469. // First check if the template is in the override dir 
  470. if (!($retval = $this->object->get_template_override_abspath($module, $path))) { 
  471. $retval = $fs->join_paths($this->object->get_registry()->get_module_dir($module), $settings->mvc_template_dirname, $path); 
  472. if (!@file_exists($retval)) { 
  473. throw new RuntimeException("{$retval} is not a valid MVC template"); 
  474. return $retval; 
  475. function get_template_override_dir($module = NULL) 
  476. $fs = C_Fs::get_instance(); 
  477. $dir = $fs->join_paths(WP_CONTENT_DIR, 'ngg'); 
  478. if (!@file_exists($dir)) { 
  479. wp_mkdir_p($dir); 
  480. $dir = $fs->join_paths($dir, 'modules'); 
  481. if (!@file_exists($dir)) { 
  482. wp_mkdir_p($dir); 
  483. if ($module) { 
  484. $dir = $fs->join_paths($dir, $module); 
  485. if (!@file_exists($dir)) { 
  486. wp_mkdir_p($dir); 
  487. $dir = $fs->join_paths($dir, 'templates'); 
  488. if (!@file_exists($dir)) { 
  489. wp_mkdir_p($dir); 
  490. return $dir; 
  491. function get_template_override_abspath($module, $filename) 
  492. $fs = C_Fs::get_instance(); 
  493. $retval = NULL; 
  494. $abspath = $fs->join_paths($this->object->get_template_override_dir($module), $filename); 
  495. if (@file_exists($abspath)) { 
  496. $retval = $abspath; 
  497. return $retval; 
  498. /** 
  499. * Adds a template parameter 
  500. * @param $key 
  501. * @param $value 
  502. */ 
  503. function set_param($key, $value) 
  504. $this->object->_params[$key] = $value; 
  505. /** 
  506. * Removes a template parameter 
  507. * @param $key 
  508. */ 
  509. function remove_param($key) 
  510. unset($this->object->_params[$key]); 
  511. /** 
  512. * Gets the value of a template parameter 
  513. * @param $key 
  514. * @param null $default 
  515. * @return mixed 
  516. */ 
  517. function get_param($key, $default = NULL) 
  518. if (isset($this->object->_params[$key])) { 
  519. return $this->object->_params[$key]; 
  520. } else { 
  521. return $default; 
  522. class C_MVC_View_Element 
  523. var $_id; 
  524. var $_type; 
  525. var $_list; 
  526. var $_context; 
  527. function __construct($id, $type = null) 
  528. $this->_id = $id; 
  529. $this->_type = $type; 
  530. $this->_list = array(); 
  531. $this->_context = array(); 
  532. function get_id() 
  533. return $this->_id; 
  534. function append($child) 
  535. $this->_list[] = $child; 
  536. function insert($child, $position = 0) 
  537. array_splice($this->_list, $position, 0, $child); 
  538. function delete($child) 
  539. $index = array_search($child, $this->_list); 
  540. if ($index !== false) { 
  541. array_splice($this->_list, $index, 1); 
  542. function find($id, $recurse = false) 
  543. $list = array(); 
  544. $this->_find($list, $id, $recurse); 
  545. return $list; 
  546. function _find(array &$list, $id, $recurse = false) 
  547. foreach ($this->_list as $index => $element) { 
  548. if ($element instanceof C_MVC_View_Element) { 
  549. if ($element->get_id() == $id) { 
  550. $list[] = $element; 
  551. if ($recurse) { 
  552. $element->_find($list, $id, $recurse); 
  553. function get_context($name) 
  554. if (isset($this->_context[$name])) { 
  555. return $this->_context[$name]; 
  556. return null; 
  557. function set_context($name, $value) 
  558. $this->_context[$name] = $value; 
  559. function get_object() 
  560. return $this->get_context('object'); 
  561. // XXX not implemented 
  562. function parse() 
  563. function rasterize() 
  564. $ret = null; 
  565. foreach ($this->_list as $index => $element) { 
  566. if ($element instanceof C_MVC_View_Element) { 
  567. $ret .= $element->rasterize(); 
  568. } else { 
  569. $ret .= (string) $element; 
  570. return $ret; 
.