Changeset 1307
- Timestamp:
- 11/22/07 17:21:31 (9 months ago)
- Files:
-
- devel/index.php (modified) (1 diff)
- devel/lib/elgglib.php (modified) (2 diffs)
- devel/lib/templates.php (modified) (1 diff)
- devel/login/index.php (modified) (1 diff)
- devel/mod/generic_comments/lib.php (modified) (1 diff)
- devel/profile/edit.php (modified) (1 diff)
- devel/profile/index.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/index.php
r614 r1307 6 6 templates_page_setup(); 7 7 if (logged_on) { 8 $body = templates_draw(array( 9 'context' => 'frontpage_loggedin' 10 ) 11 ); 8 templates_page_output($CFG->sitename, null, 'frontpage_loggedin'); 12 9 } else { 13 $body = templates_draw(array( 14 'context' => 'frontpage_loggedout' 15 ) 16 ); 10 templates_page_output($CFG->sitename, null, 'frontpage_loggedout'); 17 11 } 18 19 echo templates_page_draw( array(20 $CFG->sitename,21 $body22 )23 );24 12 25 13 ?> devel/lib/elgglib.php
r1288 r1307 1073 1073 * @return string The remote IP address 1074 1074 */ 1075 function getremoteaddr() {1075 function getremoteaddr() { 1076 1076 if (!empty($_SERVER['HTTP_CLIENT_IP'])) { 1077 1077 return cleanremoteaddr($_SERVER['HTTP_CLIENT_IP']); … … 4371 4371 } 4372 4372 4373 /** 4374 * Returns an array of results from each relevant module 4375 * 4376 * This function runs the specified hook function for each module 4377 * that has the hook (possibly restricted to a supplied list of module names). 4378 * 4379 * @param string $hook the name of the module hook we want to invoke 4380 * @param int $object_id the object id to apply the hook to (can be empty) 4381 * @param string $object_type the type of the object to apply the hook to (can be empty) 4382 * @param array $modules an array of module names (can be empty) 4383 * @param array $modules an array of values keyed by keyed by parameter names to pass to the hook function (can be empty) 4384 * @return array an array of results keyed by module name 4385 */ 4386 4387 function action($hook,$object_id=0, $object_type='', $modules = NULL, $parameters = NULL ) { 4388 global $CFG; 4389 4390 $results = array(); 4391 if (!$modules) { 4392 //if (!$CFG->plugins) { 4393 $CFG->plugins = get_list_of_plugins('mod'); 4394 //} 4395 $modules = $CFG->plugins; 4396 } 4397 foreach ($modules as $mod) { 4398 $mod_function = $mod . '_'.$hook; 4399 if (function_exists($mod_function)) { 4400 if ($parameters) { 4401 $results[$mod] = $mod_function($object_id,$object_type,$parameters); 4402 } else { 4403 $results[$mod] = $mod_function($object_id,$object_type); 4404 } 4405 } 4406 } 4407 4408 return $results; 4409 } 4410 4373 4411 ?> devel/lib/templates.php
r1278 r1307 1589 1589 } 1590 1590 1591 /** 1592 * Outputs html page 1593 * @param string $title The title of the page 1594 * @param string $body The body of the content 1595 * @param string $context Optional template context 1596 * @param string $sidebar Optional sidebar content 1597 */ 1598 function templates_page_output($title, $body, $context='contentholder', $sidebar=null) { 1599 // hook pre-output page 1600 // @rho i think no needed because there is already 1601 // _init and _pagesetup 1602 1603 // allow title with html tags or specialchars 1604 $body = templates_draw(array( 1605 'context' => $context, 1606 'title' => $title, 1607 'body' => $body, 1608 )); 1609 1610 // clean title for <title> tag 1611 $title = htmlspecialchars_decode(strip_tags($title), ENT_COMPAT); 1612 1613 // print output! 1614 echo templates_page_draw(array($title, $body, $sidebar)); 1615 1616 // hook post-output 1617 action('end'); 1618 1619 // end execution 1620 exit(); 1621 } 1622 1623 // backward compatiblity for php < 5 1624 if (!function_exists('htmlspecialchars_decode')) { 1625 function htmlspecialchars_decode($string, $quote_style=ENT_COMPAT) { 1626 return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS/*, $quote_style*/))); 1627 } 1628 } 1629 1630 1591 1631 ?> devel/login/index.php
r659 r1307 50 50 templates_page_setup(); 51 51 // display the form. 52 echo templates_page_draw( array( 53 sitename, 54 templates_draw(array( 55 'body' => $body, 56 'title' => __gettext('Log On'), 57 'context' => 'contentholder' 58 ) 59 ) 60 ) 61 ); 52 templates_page_output($CFG->sitename, $body); 62 53 63 54 ?> devel/mod/generic_comments/lib.php
r1278 r1307 601 601 } 602 602 603 // this is a temporary location - the code should be moved into elgglib604 605 /**606 * Returns an array of results from each relevant module607 *608 * This function runs the specified hook function for each module609 * that has the hook (possibly restricted to a supplied list of module names).610 *611 * @param string $hook the name of the module hook we want to invoke612 * @param int $object_id the object id to apply the hook to (can be empty)613 * @param string $object_type the type of the object to apply the hook to (can be empty)614 * @param array $modules an array of module names (can be empty)615 * @param array $modules an array of values keyed by keyed by parameter names to pass to the hook function (can be empty)616 * @return array an array of results keyed by module name617 */618 619 function action($hook,$object_id=0, $object_type='', $modules = NULL, $parameters = NULL ) {620 global $CFG;621 622 $results = array();623 if (!$modules) {624 //if (!$CFG->plugins) {625 $CFG->plugins = get_list_of_plugins('mod');626 //}627 $modules = $CFG->plugins;628 }629 foreach ($modules as $mod) {630 $mod_function = $mod . '_'.$hook;631 if (function_exists($mod_function)) {632 if ($parameters) {633 $results[$mod] = $mod_function($object_id,$object_type,$parameters);634 } else {635 $results[$mod] = $mod_function($object_id,$object_type);636 }637 }638 }639 640 return $results;641 }642 643 603 644 604 /** devel/profile/edit.php
r1054 r1307 54 54 $body = $profile->display_form(); 55 55 } 56 $body = templates_draw(array( 'context' => 'contentholder',57 'title' => $title,58 'body' => $body ));59 56 60 print templates_page_draw(array($title, $body)); 61 62 57 templates_page_output($title, $body); 63 58 64 59 function profile_update($profile_new) { devel/profile/index.php
r1215 r1307 309 309 $view = $profile->view(); 310 310 311 $body = templates_draw( array( 312 'context' => 'contentholder', 313 'title' => $title, 314 'body' => $view['body'], 315 )); 316 317 //echo templates_page_draw(array($title, $body, NULL, $view['widgets'])); 318 echo templates_page_draw(array($title, $body)); 311 templates_page_output($title, $view['body']); 319 312 320 313 ?>
