WordPress.org

Make WordPress Core

Ticket #6965: gears.patch

File gears.patch, 16.9 KB (added by azaozz, 6 years ago)
  • wp-admin/gears-manifest.php

     
     1<?php 
     2@ require('../wp-config.php'); 
     3 
     4if ( ! defined('WP_ADMIN') ) 
     5        define('WP_ADMIN', true); 
     6 
     7if ( ! is_a($wp_scripts, 'WP_Scripts') )  
     8        $wp_scripts = new WP_Scripts(); 
     9 
     10$default_js = $version = ''; 
     11foreach ( $wp_scripts->scripts as $script ) { 
     12        if ( empty($script->src) || strpos($script->src, 'tiny_mce_config.php') ) continue; 
     13        $src = str_replace( '/wp-admin/', '', $script->src ); 
     14        $src = str_replace( '/wp-includes/', '../wp-includes/', $src ); 
     15        $default_js .= '{ "url" : "' . $src . '?ver=' . $script->ver . '" },' . "\n"; 
     16        $version .= $script->ver; 
     17} 
     18 
     19$version = md5($version); 
     20 
     21nocache_headers(); 
     22header( 'Content-Type: application/x-javascript; charset=UTF-8' ); // application/json text/plain ? 
     23?> 
     24{ 
     25"betaManifestVersion" : 1, 
     26"version" : "<?php echo $version; ?>_20080511", 
     27"entries" : [ 
     28<?php echo $default_js; ?> 
     29 
     30{ "url" : "wp-admin.css?version=2.6-bleeding" }, 
     31{ "url" : "rtl.css?version=2.6-bleeding" }, 
     32{ "url" : "../wp-includes/js/thickbox/thickbox.css?ver=20080430" }, 
     33{ "url" : "css/colors-classic-rtl.css?version=2.6-bleeding" }, 
     34{ "url" : "css/colors-classic.css?version=2.6-bleeding" }, 
     35{ "url" : "css/colors-fresh-rtl.css?version=2.6-bleeding" }, 
     36{ "url" : "css/colors-fresh.css?version=2.6-bleeding" }, 
     37{ "url" : "css/dashboard-rtl.css?version=2.6-bleeding" }, 
     38{ "url" : "css/dashboard.css?version=2.6-bleeding" }, 
     39{ "url" : "css/global.css?version=2.6-bleeding" }, 
     40{ "url" : "css/global-rtl.css?version=2.6-bleeding" }, 
     41{ "url" : "css/ie-rtl.css?version=2.6-bleeding" }, 
     42{ "url" : "css/ie.css?version=2.6-bleeding" }, 
     43{ "url" : "css/install-rtl.css?version=2.6-bleeding" }, 
     44{ "url" : "css/install.css?version=2.6-bleeding" }, 
     45{ "url" : "css/login-rtl.css?version=2.6-bleeding" }, 
     46{ "url" : "css/login.css?version=2.6-bleeding" }, 
     47{ "url" : "css/media-rtl.css?version=2.6-bleeding" }, 
     48{ "url" : "css/media.css?version=2.6-bleeding" }, 
     49{ "url" : "css/theme-editor-rtl.css?version=2.6-bleeding" }, 
     50{ "url" : "css/theme-editor.css?version=2.6-bleeding" }, 
     51{ "url" : "css/upload-rtl.css?version=2.6-bleeding" }, 
     52{ "url" : "css/widgets-rtl.css?version=2.6-bleeding" }, 
     53{ "url" : "css/widgets.css?version=2.6-bleeding" }, 
     54 
     55{ "url" : "images/align-center.png" }, 
     56{ "url" : "images/align-left.png" }, 
     57{ "url" : "images/align-none.png" }, 
     58{ "url" : "images/align-right.png" }, 
     59{ "url" : "images/bubble_bg.gif" }, 
     60{ "url" : "images/comment-grey-bubble.png" }, 
     61{ "url" : "images/comment-pill.gif" }, 
     62{ "url" : "images/comment-stalk-classic.gif" }, 
     63{ "url" : "images/comment-stalk-fresh.gif" }, 
     64{ "url" : "images/comment-stalk-rtl.gif" }, 
     65{ "url" : "images/date-button.gif" }, 
     66{ "url" : "images/fade-butt.png" }, 
     67{ "url" : "images/logo-ghost.png" }, 
     68{ "url" : "images/logo-login.gif" }, 
     69{ "url" : "images/media-button-gallery.gif" }, 
     70{ "url" : "images/media-button-image.gif" }, 
     71{ "url" : "images/media-button-music.gif" }, 
     72{ "url" : "images/media-button-other.gif" }, 
     73{ "url" : "images/media-button-video.gif" }, 
     74{ "url" : "images/media-buttons.gif" }, 
     75{ "url" : "images/tail.gif" }, 
     76{ "url" : "images/toggle-arrow-rtl.gif" }, 
     77{ "url" : "images/toggle-arrow.gif" }, 
     78{ "url" : "images/wordpress-logo.png" }, 
     79{ "url" : "images/xit.gif" }, 
     80{ "url" : "../wp-includes/images/crystal/archive.png" }, 
     81{ "url" : "../wp-includes/images/crystal/audio.png" }, 
     82{ "url" : "../wp-includes/images/crystal/code.png" }, 
     83{ "url" : "../wp-includes/images/crystal/default.png" }, 
     84{ "url" : "../wp-includes/images/crystal/document.png" }, 
     85{ "url" : "../wp-includes/images/crystal/interactive.png" }, 
     86{ "url" : "../wp-includes/images/crystal/text.png" }, 
     87{ "url" : "../wp-includes/images/crystal/video.png" }, 
     88{ "url" : "../wp-includes/images/crystal/spreadsheet.png" }, 
     89{ "url" : "../wp-includes/images/rss.png" }, 
     90{ "url" : "../wp-includes/js/thickbox/loadingAnimation.gif" }, 
     91{ "url" : "../wp-includes/js/thickbox/tb-close.png" }, 
     92{ "url" : "../wp-includes/js/swfupload/swfupload_f9.swf" }, 
     93 
     94{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js?v=307" }, 
     95{ "url" : "../wp-includes/js/tinymce/utils/mctabs.js?v=307" }, 
     96{ "url" : "../wp-includes/js/tinymce/utils/validate.js?v=307" }, 
     97{ "url" : "../wp-includes/js/tinymce/utils/form_utils.js?v=307" }, 
     98{ "url" : "../wp-includes/js/tinymce/utils/editable_selects.js?v=307" }, 
     99{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pasteword.js?v=307" }, 
     100{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pastetext.js?v=307" }, 
     101{ "url" : "../wp-includes/js/tinymce/plugins/media/js/media.js?v=307" }, 
     102{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/color_picker.js?v=307" }, 
     103{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/charmap.js?v=307" }, 
     104{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/image.js?v=307" }, 
     105{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?v=307" }, 
     106{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?v=307" }, 
     107{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?v=307" }, 
     108 
     109{ "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?v=307" }, 
     110{ "url" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm?v=307" }, 
     111{ "url" : "../wp-includes/js/tinymce/themes/advanced/image.htm?v=307" }, 
     112{ "url" : "../wp-includes/js/tinymce/themes/advanced/link.htm?v=307" }, 
     113{ "url" : "../wp-includes/js/tinymce/themes/advanced/color_picker.htm?v=307" }, 
     114{ "url" : "../wp-includes/js/tinymce/themes/advanced/charmap.htm?v=307" }, 
     115{ "url" : "../wp-includes/js/tinymce/plugins/media/media.htm?v=307" }, 
     116{ "url" : "../wp-includes/js/tinymce/plugins/paste/pasteword.htm?v=307" }, 
     117{ "url" : "../wp-includes/js/tinymce/plugins/paste/blank.htm?v=307" }, 
     118{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?v=307" }, 
     119{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?v=307" }, 
     120{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?v=307" }, 
     121{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?v=307" }, 
     122 
     123{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?v=307" }, 
     124{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css?v=307" }, 
     125{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?v=307" }, 
     126{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css?v=307" }, 
     127{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/css/content.css?v=307" }, 
     128{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/css/content.css?v=307" }, 
     129{ "url" : "../wp-includes/js/tinymce/plugins/media/css/content.css?v=307" }, 
     130{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?v=307" }, 
     131{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?v=307" }, 
     132{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?v=307" }, 
     133{ "url" : "../wp-includes/js/tinymce/wordpress.css?v=307" }, 
     134 
     135{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/icons.gif" }, 
     136{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg" }, 
     137{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/fm.gif" }, 
     138{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png" }, 
     139{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/sflogo.png" }, 
     140{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png" }, 
     141{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png" }, 
     142{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif" }, 
     143{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif" }, 
     144{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif" }, 
     145{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif" }, 
     146{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif" }, 
     147{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif" }, 
     148{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif" }, 
     149{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif" }, 
     150{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif" }, 
     151{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif" }, 
     152{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif" }, 
     153{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif" }, 
     154{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif" }, 
     155{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flash.gif" }, 
     156{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flv_player.swf" }, 
     157{ "url" : "../wp-includes/js/tinymce/plugins/media/img/quicktime.gif" }, 
     158{ "url" : "../wp-includes/js/tinymce/plugins/media/img/realmedia.gif" }, 
     159{ "url" : "../wp-includes/js/tinymce/plugins/media/img/shockwave.gif" }, 
     160{ "url" : "../wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif" }, 
     161{ "url" : "../wp-includes/js/tinymce/plugins/media/img/trans.gif" }, 
     162{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more.gif" }, 
     163{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif" }, 
     164{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page.gif" }, 
     165{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif" }, 
     166{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif" }, 
     167{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" } 
     168]} 
  • wp-admin/index.php

     
    3232add_action( 'admin_head', 'index_css' ); 
    3333 
    3434wp_enqueue_script( 'jquery' ); 
     35wp_enqueue_script( 'wp-gears' ); 
    3536 
    3637$title = __('Dashboard'); 
    3738$parent_file = 'index.php'; 
     
    117118        <?php update_right_now_message(); ?> 
    118119</p> 
    119120 
     121<?php 
     122if ( ($is_gecko || $is_winIE) && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'webkit') === false ) {  
     123        if ( ! isset($current_user) ) 
     124                $current_user = wp_get_current_user(); 
     125 
     126        if ( ! isset($current_user->gearsinfobox) ) { 
     127                update_usermeta($current_user->ID, 'gearsinfobox', '1'); ?> 
     128 
     129        <div id="gears-info-box" class="info-box"> 
     130        <h3 class="dashboard-widget-title"><?php _e('Install offline storage for WordPress'); ?></h3> 
     131        <p><?php _e('WordPress has support for Google Gears that adds new features to your web browser.'); ?> <a href="http://gears.google.com/" target="_blank" style="font-weight:normal;"><?php _e('More information...'); ?></a></p> 
     132        <p><?php _e('After installing and enabling it, most of the WordPress images, scripts and CSS files will be stored on this computer. This will speed up page loading considerably.'); ?></p> 
     133        <p><strong><?php _e('Please make sure you are not using a public or shared computer.'); ?></strong></p> 
     134        <div class="submit"><a href="http://gears.google.com/?action=install&return=<?php echo get_option('siteurl') . '/wp-admin/'; ?>" class="button"><?php _e('Install Now'); ?></a><a href="#" class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';return false;">Cancel</a></div> 
     135        </div> 
     136<?php } ?> 
     137 
     138        <div id="gears-msg1"><p><?php _e('WordPress has support for Google Gears that adds new features to your web browser.'); ?> <a href="http://gears.google.com/" target="_blank" style="font-weight:normal;"><?php _e('More information...'); ?></a><br /> 
     139        <?php _e('After installing and enabling it, most of the WordPress images, scripts and CSS files will be stored on this computer. This will speed up page loading considerably.'); ?></p> 
     140        <p><a href="http://gears.google.com/?action=install&return=<?php echo get_option('siteurl') . '/wp-admin/'; ?>" class="rbutton"><?php _e('Install Google Gears'); ?></a> <strong><?php _e('Please make sure you are not using a public or shared computer.'); ?></strong></p></div> 
     141         
     142        <p id="gears-msg2" style="display:none;"><?php _e('Google Gears is installed on this computer but is not enabled for use with WordPress. To enable it, make sure this web site is not on the denied list under Tools - Google Gears Settings menu of your browser, then reload this page and allow the site to use Google Gears on this computer.'); ?><br /> 
     143        <strong><?php _e('However if this is a public or shared computer, Google Gears should not be enabled.'); ?></strong></p> 
     144         
     145        <p id="gears-msg3" style="display:none;"><?php _e('Google Gears is installed and enabled on this computer. You can disable it from your browser Tools menu.'); ?><br /> 
     146        <?php _e('Status:'); ?> <span id="gears-wait"><span style="color:#fff;background-color:#f00;"><?php _e('Please wait! Updating files:'); ?></span> <span id="gears-upd-number"></span></span></p> 
     147<?php } ?> 
    120148<?php do_action( 'rightnow_end' ); ?> 
    121149<?php do_action( 'activity_box_end' ); ?> 
    122150</div><!-- rightnow --> 
  • wp-admin/js/wp-gears.js

     
     1 
     2wpGears = { 
     3 
     4        init : function() { 
     5                if ( 'undefined' != typeof google && google.gears ) { 
     6                        try {  
     7                                localServer = google.gears.factory.create("beta.localserver"); 
     8                                this.createStore(); 
     9                        } catch(e) { // silence if canceled 
     10                                this.message(); 
     11                        } 
     12                } 
     13        }, 
     14 
     15        createStore : function() { 
     16                if ( 'undefined' == typeof google || ! google.gears ) return; 
     17 
     18                store = localServer.createManagedStore(this.storeName()); 
     19                store.manifestUrl = "gears-manifest.php"; 
     20                store.checkForUpdate(); 
     21                this.message(); 
     22        }, 
     23 
     24        removeStore : function() { 
     25                if ( 'undefined' == typeof google || ! google.gears ) return; 
     26 
     27                localServer.removeManagedStore(this.storeName()); 
     28                this.message(); 
     29        }, 
     30 
     31        storeName : function() { 
     32      var name = window.location.protocol + window.location.host; 
     33 
     34      name = name.replace(/[\/\\:*"?<>|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name 
     35          name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars 
     36 
     37      return name; 
     38    }, 
     39 
     40    message : function() { 
     41                var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), num = t.I('gears-upd-number'), wait = t.I('gears-wait'); 
     42 
     43                if ( ! msg1 ) return; 
     44 
     45        if ( 'undefined' != typeof store ) { 
     46                        msg1.style.display = msg2.style.display = 'none'; 
     47                        msg3.style.display = 'block'; 
     48 
     49                        store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);}; 
     50                        store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);}; 
     51                        store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);}; 
     52        } else if ( 'undefined' != typeof google && google.gears ) { 
     53                        msg1.style.display = 'none'; 
     54                        msg2.style.display = 'block'; 
     55                } 
     56        }, 
     57         
     58        I : function(id) { 
     59                return document.getElementById(id); 
     60        } 
     61} 
     62 
     63addLoadEvent( function(){wpGears.init()} ); 
     64 
     65function gearsInit() { 
     66        if ( 'undefined' != typeof google && google.gears ) return; 
     67 
     68        var gf = false; 
     69        if ( 'undefined' != typeof GearsFactory ) { // Firefox 
     70                gf = new GearsFactory(); 
     71        } else { // IE 
     72                try { 
     73                        gf = new ActiveXObject('Gears.Factory'); 
     74                } catch (e) {} 
     75        } 
     76 
     77        if ( ! gf ) return; 
     78        if ( 'undefined' == typeof google ) google = {}; 
     79        if ( ! google.gears ) google.gears = { factory : gf }; 
     80} 
     81 
     82gearsInit(); 
  • wp-admin/wp-admin.css

     
    15181518        padding: 0; 
    15191519        margin: 0; 
    15201520} 
     1521 
     1522.info-box { 
     1523        top: 120px; 
     1524        left: 50%; 
     1525        margin-left: -200px; 
     1526        height: 300px; 
     1527        width: 400px; 
     1528        border: 5px solid #ddd; 
     1529        background: #f8f8f8; 
     1530        position: absolute; 
     1531        padding: 15px 15px 10px; 
     1532        z-index: 1000; 
     1533} 
     1534 
     1535.info-box .submit { 
     1536        position: absolute; 
     1537        bottom: 15px; 
     1538        width: 400px; 
     1539        padding: 20px 0 5px; 
     1540} 
  • wp-includes/script-loader.php

     
    198198                        $this->localize( 'word-count', 'wordCountL10n', array( 
    199199                                'count' => __('Word count: %d') 
    200200                        )); 
     201                         
     202                        $this->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20080511' ); 
     203                        $this->localize( 'wp-gears', 'wpGearsL10n', array( 
     204                                'updateCompleted' => __('Update completed.'), 
     205                                'error' => __('Error:') 
     206                        )); 
    201207                } 
    202208        } 
    203209