Jump to content

Convert Procedural Program into Class


Tsalagi

Recommended Posts

I have some code that I think would be best off in a class or some other more efficient practice but I'm not versed in OOP so I'm looking for suggestions. The three lines of code here represent a whole block of code. In that block the functions can be repeated several times with the arguments always different. Any suggestions?

I've commented to code to explain it's relation.

register_setting( 'features', THEME.' Features', 'validate_features' );
//There may be many of these functions related to only one register_setting() function
add_settings_section('main_section', 'Main Settings', 'section_cb', __FILE__);
//There may be many of these related to only one add_settings_section() function. Note the final argument "main_section" drawing the relationship    
add_settings_field('banner_heading', 'Banner Heading:', 'banner_heading_setting', __FILE__, 'main_section');
add_settings_field('footer_text', 'Footer Text:', 'footer_text_setting', __FILE__, 'main_section');

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/213327-convert-procedural-program-into-class/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.