Profile controllers cannot be classes

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Profile controllers cannot be classes
« on June 10th, 2013, 09:20 AM »
The profile area (and all other areas) are limited by the old method of procedural function calls, checked by function_exists(). I'd like to ask for this to be changed to is_callable and call_user_func_array throughout.

I already made this change to the profile area like so:

Code: [Select]
@@ -529,7 +529,7 @@
  }
 
  // Make sure that the area function does exist!
- if (!isset($profile_include_data['function']) || !function_exists($profile_include_data['function']))
+ if (!isset($profile_include_data['function']) || !is_callable($profile_include_data['function']))
  {
  destroyMenu();
  fatal_lang_error('no_access', false);
@@ -696,7 +696,7 @@
  redirectexit('action=profile' . (we::$user['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area);
 
  // Call the appropriate subaction function.
- $profile_include_data['function']($memID);
+ call_user_func_array($profile_include_data['function'], array($memID));
 
  // Set the page title if it's not already set...
  if (!isset($context['page_title']))

Sample code to make use of this:

Code: [Select]
'function' => array('Awards\Profile', 'showAwards'),
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670