Ticket #2701: 2701b.diff
File 2701b.diff, 13.7 KB (added by , 19 years ago) |
---|
-
wp-includes/default-filters.php
86 86 add_action('wp_head', 'rsd_link'); 87 87 add_action('publish_future_post', 'wp_publish_post', 10, 1); 88 88 add_action('wp_head', 'noindex', 1); 89 add_action('wp_head', 'wp_print_scripts'); 89 90 if(!defined('DOING_CRON')) 90 91 add_action('init', 'wp_cron'); 91 92 add_action('do_feed_rdf', 'do_feed_rdf', 10, 1); -
wp-includes/template-functions-general.php
703 703 if ( ! get_option('blog_public') ) 704 704 echo '<meta name="robots" content="noindex,nofollow" />' . "\n"; 705 705 } 706 707 class WP_Scripts { 708 var $scripts = array(); 709 var $queue = array(); 710 var $printed = array(); 711 712 function WP_Scripts() { 713 $this->default_scripts(); 714 } 715 716 // Could move these to an option. 717 function default_scripts() { 718 $this->add( 'dbx', '/wp-includes/js/dbx.js', false, '2.02' ); 719 $this->add( 'dbx-key', '/wp-includes/js/dbx-key.js', false, '3651' ); 720 $this->add( 'fat', '/wp-includes/js/fat.js', false, '1.0-RC1_3660' ); 721 $this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' ); 722 $this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3517' ); 723 $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' ); 724 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '04162006' ); 725 $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '04162006' ); 726 if ( is_admin() ) { 727 $this->add( 'listman', '/wp-admin/list-manipulation-js.php', array('sack', 'fat'), '3733' ); 728 $this->add( 'ajaxcat', '/wp-admin/cat-js.php', array('listman'), '3684' ); 729 $this->add( 'admin-categories', '/wp-admin/categories.js', array('listman'), '3684' ); 730 $this->add( 'admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733' ); 731 $this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3736' ); 732 $this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '3684' ); 733 $this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' ); 734 } 735 } 736 737 // Takes nothing, (string) handle or (array of strings) handles. 738 function print_scripts( $handles = false ) { 739 global $wp_db_version; 740 741 // Print the queue if nothini is passed. If a string is passed, print that script. If an array is passed, print those scripts. 742 $handles = false === $handles ? $this->queue : (array) $handles; 743 $handles = $this->all_deps( $handles ); 744 foreach ( (array) $handles as $handle ) 745 if ( !in_array($handle, $this->printed) && isset($this->scripts[$handle]) ) { 746 $ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version; 747 echo "<script type='text/javascript' src='{$this->scripts[$handle]->src}?ver=$ver'></script>\n"; 748 $this->printed[] = $handle; 749 } 750 return $this->printed; 751 } 752 753 // Recursively finds all dependencies. Does NOT catch infinite loops. 754 function all_deps( $handles ) { 755 $return = (array) $handles; 756 foreach ( (array) $handles as $handle ) 757 if ( $this->scripts[$handle]->deps ) 758 $return = array_merge($this->all_deps( $this->scripts[$handle]->deps ), $return); 759 return array_unique($return); 760 } 761 762 function add( $handle, $src, $deps = array(), $ver = false ) { 763 if ( isset($this->scripts[$handle]) ) 764 return false; 765 $this->scripts[$handle] = new _WP_Script( $handle, $src, $deps, $ver ); 766 return true; 767 } 768 769 function remove( $handles ) { 770 foreach ( (array) $handles as $handle ) 771 unset($this->scripts[$handle]); 772 } 773 774 function enqueue( $handles ) { 775 foreach ( (array) $handles as $handle ) 776 if ( !in_array($handle, $this->queue) && isset($this->scripts[$handle]) ) 777 $this->queue[] = $handle; 778 } 779 780 function dequeue( $handles ) { 781 foreach ( (array) $handles as $handle ) 782 unset( $this->queue[$handle] ); 783 } 784 785 function query( $handle, $list = 'scripts' ) { // scripts, queue, or printed 786 switch ( $list ) : 787 case 'scripts': 788 if ( isset($this->scripts[$handle]) ) 789 return $this->scripts[$handle]; 790 break; 791 default: 792 if ( in_array($handle, $this->$list) ) 793 return true; 794 break; 795 endswitch; 796 return false; 797 } 798 799 } 800 801 class _WP_Script { 802 var $handle; 803 var $src; 804 var $deps = array(); 805 var $ver = false; 806 807 function _WP_Script() { 808 @list($this->handle, $this->src, $this->deps, $this->ver) = func_get_args(); 809 if ( !$this->deps ) 810 $this->deps = array(); 811 if ( !$this->ver ) 812 $this->ver = false; 813 } 814 } 815 816 function wp_print_scripts( $handles = false ) { 817 global $wp_scripts; 818 if ( !is_a($wp_scripts, 'WP_Scripts') ) { 819 if ( !$handles ) 820 return array(); // No need to instantiate if nothing's there. 821 else 822 $wp_scripts = new WP_Scripts(); 823 } 824 825 do_action( 'wp_print_scripts' ); 826 return $wp_scripts->print_scripts( $handles ); 827 } 828 829 function wp_register_script( $handle, $src, $deps = array(), $ver = false ) { 830 global $wp_scripts; 831 if ( !is_a($wp_scripts, 'WP_Scripts') ) 832 $wp_scripts = new WP_Scripts(); 833 834 $wp_scripts->add( $handle, $src, $deps, $ver ); 835 } 836 837 function wp_deregister_script( $handle ) { 838 global $wp_scripts; 839 if ( !is_a($wp_scripts, 'WP_Scripts') ) 840 $wp_scripts = new WP_Scripts(); 841 842 $wp_scripts->remove( $handle ); 843 } 844 845 //Registers if src provided (does NOT overwrite) and enqueues 846 function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false ) { 847 global $wp_scripts; 848 if ( !is_a($wp_scripts, 'WP_Scripts') ) 849 $wp_scripts = new WP_Scripts(); 850 851 if ( $src ) 852 $wp_scripts->add( $handle, $src, $deps, $ver ); 853 $wp_scripts->enqueue( $handle ); 854 } 855 706 856 ?> -
wp-includes/functions-post.php
1032 1032 } 1033 1033 1034 1034 /** 1035 * Places two script links in <head>: one to get tinyMCE (big), one to configure and start it (small)1035 * Deprecated. Use wp_print_scripts() or WP_Scripts instead. 1036 1036 */ 1037 1037 function tinymce_include() { 1038 $ver = '04162006'; 1039 $src1 = get_settings('siteurl') . "/wp-includes/js/tinymce/tiny_mce_gzip.php?ver=$ver"; 1040 $src2 = get_settings('siteurl') . "/wp-includes/js/tinymce/tiny_mce_config.php?ver=$ver"; 1041 1042 echo "<script type='text/javascript' src='$src1'></script>\n"; 1043 echo "<script type='text/javascript' src='$src2'></script>\n"; 1038 wp_print_script( 'wp_tiny_mce' ); 1044 1039 } 1045 1040 1046 1041 /** -
wp-admin/users.php
143 143 } 144 144 145 145 default: 146 wp_enqueue_script( 'admin-users' ); 146 147 147 $list_js = true;148 $users_js = true;149 150 148 include ('admin-header.php'); 151 149 152 150 $userids = $wpdb->get_col("SELECT ID FROM $wpdb->users;"); -
wp-admin/edit-comments.php
3 3 4 4 $title = __('Edit Comments'); 5 5 $parent_file = 'edit.php'; 6 $list_js = true;6 wp_enqueue_script( 'admin-comments' ); 7 7 8 8 require_once('admin-header.php'); 9 9 if (empty($_GET['mode'])) $mode = 'view'; -
wp-admin/admin.php
40 40 } 41 41 } 42 42 43 $xfn_js = $sack_js = $list_js = $cat_js = $users_js = $dbx_js = $pmeta_js = $editing = false;43 wp_enqueue_script( 'fat' ); 44 44 45 $editing = false; 46 45 47 require(ABSPATH . '/wp-admin/menu.php'); 46 48 47 49 // Handle plugin admin pages. -
wp-admin/moderation.php
3 3 4 4 $title = __('Moderate comments'); 5 5 $parent_file = 'edit.php'; 6 $list_js = true;6 wp_enqueue_script( 'listman' ); 7 7 8 8 $wpvarstoreset = array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky'); 9 9 for ($i=0; $i<count($wpvarstoreset); $i += 1) { … … 229 229 230 230 include('admin-footer.php'); 231 231 232 ?> 233 No newline at end of file 232 ?> -
wp-admin/admin-header.php
2 2 @header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); 3 3 if (!isset($_GET["page"])) require_once('admin.php'); 4 4 if ( $editing ) { 5 $dbx_js = true; 6 $pmeta_js = true; 7 $list_js = true; 8 if ( current_user_can('manage_categories') ) { 9 $cat_js = true; 10 } 5 wp_enqueue_script( array('dbx','admin-custom-fields') ); 6 if ( current_user_can('manage_categories') ) 7 wp_enqueue_script( 'ajaxcat' ); 8 if ( user_can_richedit() ) 9 wp_enqueue_script( 'wp_tiny_mce' ); 11 10 } 12 if ( $list_js )13 $sack_js = true;14 11 ?> 15 12 <?php get_admin_page_title(); ?> 16 13 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> … … 24 21 function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}} 25 22 //]]> 26 23 </script> 27 <script type="text/javascript" src="../wp-includes/js/fat.js"></script> 28 <?php if ( $xfn_js ) { ?> 29 <script type="text/javascript" src="xfn.js"></script> 30 <?php } ?> 31 <?php if ( $sack_js ) { ?> 32 <script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script> 33 <?php } ?> 34 <?php if ( $list_js ) { ?> 35 <script type="text/javascript" src="list-manipulation-js.php"></script> 36 <?php } ?> 37 <?php if ( $pmeta_js ) { ?> 38 <script type="text/javascript" src="custom-fields.js"></script> 39 <?php } ?> 40 <?php if ( 'categories.php' == $pagenow && 'edit' != $action ) { ?> 41 <script type="text/javascript" src="categories.js"></script> 42 <?php } ?> 43 <?php if ( $users_js ) { ?> 44 <script type="text/javascript" src="users.js"></script> 45 <?php } ?> 46 <?php if ( 'edit-comments.php' == $pagenow || ( 'edit.php' == $pagenow && 1 == $_GET['c'] ) ) { ?> 47 <script type="text/javascript" src="edit-comments.js"></script> 48 <?php } ?> 49 <?php if ( $dbx_js ) { ?> 50 <script type="text/javascript" src="../wp-includes/js/dbx.js"></script> 24 <?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') ) : ?> 25 <style type="text/css">* html { overflow-x: hidden; }</style> 26 <?php endif; $printed_scripts = wp_print_scripts(); ?> 27 <?php if ( in_array('dbx', $printed_scripts) ) { ?> 51 28 <script type="text/javascript"> 52 29 //<![CDATA[ 53 30 addLoadEvent( function() { … … 63 40 </script> 64 41 <script type="text/javascript" src="../wp-includes/js/dbx-key.js"></script> 65 42 <?php } ?> 66 <?php if ( $editing && user_can_richedit() ) { tinymce_include(); } ?>67 <?php if ( $cat_js ) { ?>68 <script type="text/javascript" src="cat-js.php"></script>69 <?php } ?>70 <?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') ) : ?>71 <style type="text/css">* html { overflow-x: hidden; }</style>72 <?php endif; ?>73 43 <?php do_action('admin_head'); ?> 74 44 </head> 75 45 <body> -
wp-admin/link-add.php
25 25 } 26 26 } 27 27 28 $xfn_js = true;28 wp_enqueue_script( 'xfn' ); 29 29 $editing = true; 30 30 require('admin-header.php'); 31 31 ?> -
wp-admin/edit.php
3 3 4 4 $title = __('Posts'); 5 5 $parent_file = 'edit.php'; 6 $list_js = true;6 wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' ); 7 7 require_once('admin-header.php'); 8 8 9 9 $_GET['m'] = (int) $_GET['m']; -
wp-admin/link.php
102 102 break; 103 103 104 104 case 'edit' : 105 $xfn_js = true;105 wp_enqueue_script( 'xfn' ); 106 106 $editing = true; 107 107 $parent_file = 'link-manager.php'; 108 108 $submenu_file = 'link-manager.php'; … … 124 124 } 125 125 126 126 include ('admin-footer.php'); 127 ?> 128 No newline at end of file 127 ?> -
wp-admin/link-manager.php
8 8 9 9 $title = __('Manage Bookmarks'); 10 10 $this_file = $parent_file = 'link-manager.php'; 11 $list_js = true;11 wp_enqueue_script( 'listman' ); 12 12 13 13 $wpvarstoreset = array ('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'); 14 14 -
wp-admin/edit-pages.php
2 2 require_once('admin.php'); 3 3 $title = __('Pages'); 4 4 $parent_file = 'edit.php'; 5 $list_js = true;5 wp_enqueue_script( 'listman' ); 6 6 require_once('admin-header.php'); 7 7 ?> 8 8 -
wp-admin/categories.php
112 112 113 113 default: 114 114 115 $list_js = true;115 wp_enqueue_script( 'admin-categories' ); 116 116 require_once ('admin-header.php'); 117 117 118 118 $messages[1] = __('Category added.'); … … 182 182 183 183 include('admin-footer.php'); 184 184 185 ?> 186 No newline at end of file 185 ?>