Ticket #19552 (new enhancement)

Opened 2 months ago

Last modified 6 days ago

Split functions.php

Reported by: ryan Owned by:
Priority: normal Milestone: 3.4
Component: General Version: 3.3
Severity: normal Keywords:
Cc: mikeschinkel@…, info@…, xoodrew@…, eddie.moya+wptrac@…, azizur

Description

It's big, too big. Options/settings/transients, for example, could move to a new file. To maintain back-compat for those including functions.php separately, new files should be required from functions.php rather than wp-settings.php.

Attachments

19552.diff Download (149.6 KB) - added by ryan 2 months ago.
file.php Download (21.5 KB) - added by ryan 7 weeks ago.
file.php

Change History

ryan2 months ago

List of functions in functions.php:

mysql2date()
current_time()
date_i18n()
number_format_i18n()
size_format()
get_weekstartend()
maybe_unserialize()
is_serialized()
is_serialized_string()
get_option()
wp_protect_special_option()
form_option()
wp_load_alloptions()
wp_load_core_site_options()
update_option()
add_option()
delete_option()
delete_transient()
get_transient()
set_transient()
wp_user_settings()
get_user_setting()
set_user_setting()
delete_user_setting()
get_all_user_settings()
wp_set_all_user_settings()
delete_all_user_settings()
maybe_serialize()
xmlrpc_getposttitle()
xmlrpc_getpostcategory()
xmlrpc_removepostdata()
debug_fopen()
debug_fwrite()
debug_fclose()
do_enclose()
wp_get_http()
wp_get_http_headers()
is_new_day()
build_query()
_http_build_query()
add_query_arg()
remove_query_arg()
add_magic_quotes()
wp_remote_fopen()
wp()
get_status_header_desc()
status_header()
wp_get_nocache_headers()
nocache_headers()
cache_javascript_headers()
get_num_queries()
bool_from_yn()
do_feed()
do_feed_rdf()
do_feed_rss()
do_feed_rss2()
do_feed_atom()
do_robots()
is_blog_installed()
wp_nonce_url()
wp_nonce_field()
wp_referer_field()
wp_original_referer_field()
wp_get_referer()
wp_get_original_referer()
wp_mkdir_p()
path_is_absolute()
path_join()
get_temp_dir()
wp_upload_dir()
wp_unique_filename()
wp_upload_bits()
wp_ext2type()
wp_check_filetype()
wp_check_filetype_and_ext()
get_allowed_mime_types()
wp_explain_nonce()
wp_nonce_ays()
wp_die()
_default_wp_die_handler()
_xmlrpc_wp_die_handler()
_xmlrpc_wp_die_filter()
_config_wp_home()
_config_wp_siteurl()
_mce_set_direction()
smilies_init()
wp_parse_args()
wp_parse_id_list()
wp_array_slice_assoc()
wp_filter_object_list()
wp_list_filter()
wp_list_pluck()
wp_maybe_load_widgets()
wp_widgets_add_menu()
wp_ob_end_flush_all()
dead_db()
absint()
url_is_accessable_via_ssl()
_deprecated_function()
_deprecated_file()
_deprecated_argument()
_doing_it_wrong()
is_lighttpd_before_150()
apache_mod_loaded()
iis7_supports_permalinks()
validate_file()
is_ssl()
force_ssl_login()
force_ssl_admin()
wp_guess_url()
wp_suspend_cache_addition()
wp_suspend_cache_invalidation()
get_site_option()
add_site_option()
delete_site_option()
update_site_option()
delete_site_transient()
get_site_transient()
set_site_transient()
is_main_site()
global_terms_enabled()
wp_timezone_override_offset()
_wp_timezone_choice_usort_callback()
wp_timezone_choice()
_cleanup_header_comment()
wp_scheduled_delete()
get_file_data()
_search_terms_tidy()
__return_true()
__return_false()
__return_zero()
__return_empty_array()
send_nosniff_header()
_wp_mysql_week()
wp_find_hierarchy_loop()
wp_find_hierarchy_loop_tortoise_hare()
send_frame_options_header()
wp_allowed_protocols()

19552.diff moves setting/option/transient functions to option.php. It does an svn copy to preserve history. The functions are left in the same order as they currently are in functions.php to make the diff more readable. They can be reorganized in a follow-up commit.

General patterns I'm seeing:

  • option functions, including *_option, *_transient, *_site_option, *_site_transient, other option functions, and potentially the *_user_setting(s) functions.
  • date/time/timezone functions
  • remote functions, including do_enclose(), xmlrpc_*, debug_f*, wp_get_http*.
  • security-related functions, including nonces, referers, wp_die(), SSL functions, frames, protocols, magic quotes
  • upload-functions, including filetype/mime/ext
  • lots of utility functions
  • internal debug functions — _deprecated*, _doing_it_wrong
  • boot functions including _config_wp_home|siteurl, wp_maybe_load_widgets/wp_widgets_add_menu, dead_db, is_blog_installed.
  • Cc mikeschinkel@… added
  • Cc info@… added
  • Cc xoodrew@… added
  • Type changed from defect (bug) to enhancement

In [19602]:

Move option, setting, and transient functions from functions.php to option.php. see #19552

  • Cc eddie.moya+wptrac@… added

ryan7 weeks ago

file.php

  • Cc azizur added
Note: See TracTickets for help on using tickets.