<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[7374] sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/page-download-counter.php: Main: Itroduce download counter page template.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/7374">7374</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/7374","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>obenland</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-07-05 21:49:07 +0000 (Thu, 05 Jul 2018)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Main: Itroduce download counter page template.
See <a href="http://meta.trac.wordpress.org/ticket/3673">#3673</a>.</pre>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgmainpagedownloadcounterphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/page-download-counter.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgmainpagedownloadcounterphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/page-download-counter.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/page-download-counter.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/page-download-counter.php 2018-07-05 21:49:07 UTC (rev 7374)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,264 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Template Name: Download -> Counter
+ *
+ * Page template for displaying the download counter.
+ *
+ * @package WordPressdotorg\MainTheme
+ */
+
+// phpcs:disable WordPress.WP.EnqueuedResources, WordPress.CSRF.NonceVerification.NoNonceVerification, WordPress.VIP.SuperGlobalInputUsage.AccessDetected
+
+$branch = WP_CORE_STABLE_BRANCH;
+
+if (
+ isset( $_GET['branch'] )
+ && preg_match( '/^[0-9]\.[0-9]$/', wp_unslash( $_GET['branch'] ), $matches ) // phpcs:ignore WordPress.VIP
+ && version_compare( WP_CORE_STABLE_BRANCH, $matches[0], '>' )
+) {
+ $branch = $matches[0];
+}
+
+// phpcs:ignore WordPress.VIP.DirectDatabaseQuery
+$num = $wpdb->get_var( $wpdb->prepare(
+ 'SELECT SUM(downloads) FROM download_counts WHERE `release` LIKE %s AND `release` NOT LIKE %s',
+ $wpdb->esc_like( $branch ) . '%',
+ '%-%'
+) );
+
+if ( ! empty( $_GET['ajaxupdate'] ) ) {
+ die( esc_html( number_format_i18n( $num ) ) );
+}
+
+if ( ! empty( $_GET['json'] ) ) {
+ ?>
+ {"wpcounter": {
+ "branch": "<?php echo esc_js( $branch ); ?>",
+ "downloads": "<?php echo esc_js( $num ); ?>"
+ }}
+ <?php
+ die;
+}
+
+if ( WP_CORE_STABLE_BRANCH === $branch ) {
+ /* translators: 1: version number; 2: download count; */
+ $text = __( 'WordPress %1$s has been downloaded %2$s times', 'wporg' );
+} else {
+ /* translators: 1: version number; 2: download count; */
+ $text = __( 'WordPress %1$s was downloaded %2$s times', 'wporg' );
+}
+?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta content="charset=utf-8"/>
+ <title><?php echo esc_html( wp_get_document_title() ); ?></title>
+ <link href="//fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet" type="text/css">
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
+ <style type="text/css">
+ html,
+ body {
+ height: 100%;
+ margin: 0;
+ }
+
+ body {
+ color: #464646;
+ font-family: "Open Sans", sans-serif;
+ font-weight: 300;
+ font-size: 1em;
+ background: #f1f1f1;
+ }
+
+ a {
+ color: #0074a2;
+ font-size: 0.7em;
+ text-decoration: none;
+ }
+
+ a:hover {
+ color: #2ea2cc;
+ }
+
+ h2 {
+ font-weight: normal;
+ }
+
+ #numnumnum, #numnumnum2 {
+ color: #2ea2cc;
+ float: none;
+ font-family: Georgia, "Times New Roman", Times, serif;
+ margin: 0 auto;
+ position: absolute;
+ left: 0;
+ right: 0;
+ text-align: center;
+ width: 100%;
+ }
+
+ #numnumnum2 {
+ display: none;
+ }
+
+ #wrap {
+ color: black;
+ height: 1.35em;
+ font-size: 2.25em;
+ font-weight: normal;
+ margin: 0.25em 0;
+ position: relative;
+ }
+
+ .something-semantic {
+ display: table;
+ height: 100%;
+ width: 100%;
+ }
+
+ .something-else-semantic {
+ display: table-cell;
+ text-align: center;
+ vertical-align: middle;
+ }
+
+ .counter-inner {
+ border: 1px solid #e5e5e5;
+ -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
+ background: #fff;
+ display: inline-block;
+ margin: 0 4%;
+ padding: 6% 10%;
+ }
+
+ @media screen and (min-width: 360px) and (min-height: 400px) {
+ body {
+ font-size: 125%;
+ }
+ }
+
+ @media screen and (min-width: 500px) and (min-height: 400px) {
+ body {
+ font-size: 150%;
+ }
+ }
+
+ @media screen and (min-width: 600px) and (min-height: 500px) {
+ body {
+ font-size: 175%;
+ }
+ }
+
+ @media screen and (min-width: 700px) and (min-height: 700px) {
+ body {
+ font-size: 200%;
+ }
+ }
+
+ @media screen and (min-width: 900px) and (min-height: 900px) {
+ body {
+ font-size: 225%;
+ }
+
+ #wrap {
+ font-size: 2.5em;
+ }
+ }
+
+ @media screen and (min-width: 1200px) and (min-height: 1000px) {
+ body {
+ font-size: 300%;
+ }
+
+ .counter-inner {
+ padding: 4% 10%;
+ }
+ }
+
+ @media screen and (min-width: 1800px) and (min-height: 1200px) {
+ body {
+ font-size: 350%;
+ }
+
+ .counter-inner {
+ padding: 4% 10%;
+ }
+ }
+ </style>
+</head>
+
+<body>
+ <div class="something-semantic">
+ <div class="something-else-semantic">
+ <div class="counter-inner">
+ <h2>
+ <?php
+ printf(
+ esc_html( $text ),
+ esc_html( $branch ),
+ wp_kses_post( '<div id="wrap"><span id="numnumnum">' . number_format_i18n( $num ) . '</span><span id="numnumnum2"></span></div>' )
+ );
+ ?>
+ </h2>
+ <p>
+ <a href="<?php echo esc_url( home_url( '/download/' ) ); ?>"><?php esc_html_e( '← Back to WordPress.org', 'wporg' ); ?></a>
+ </p>
+ </div>
+ </div>
+ </div>
+
+ <script type="text/javascript" src="//code.jquery.com/jquery-latest.js"></script>
+ <script type="text/javascript">
+ jQuery( function( $ ) {
+ var numnums = $( '#numnumnum, #numnumnum2' ),
+ numnumpos = $( '#numnumnum' ).position(),
+ dataLen = $( '#numnumnum' ).text().length,
+
+ recenter = function( data ) {
+ var visible = numnums.filter( ':visible' );
+
+ visible.fadeOut( 500 ).queue( function() {
+ visible.css( {
+ position: 'absolute',
+ display: 'inline',
+ visibility: 'hidden',
+ } ).html( data );
+
+ numnumpos = visible.position();
+
+ numnums.css( {
+ position: 'absolute',
+ display: 'none',
+ visibility: 'visible',
+ } );
+
+ visible.dequeue();
+ } ).fadeIn( 350 );
+ };
+
+ numnums.css( {
+ position: 'absolute',
+ } );
+
+ <?php if ( WP_CORE_STABLE_BRANCH === $branch ) : ?>
+ setInterval( function() {
+ $.post( '/download/counter/?ajaxupdate=1', function( data ) {
+ if ( data.length !== dataLen ) {
+ recenter( data );
+ dataLen = data.length;
+ } else {
+ if ( $( '#numnumnum2' ).is( ':hidden' ) ) {
+ $( '#numnumnum' ).fadeOut( 500 );
+ $( '#numnumnum2' ).html( data ).fadeIn( 350 );
+ } else {
+ $( '#numnumnum2' ).fadeOut( 500 );
+ $( '#numnumnum' ).html( data ).fadeIn( 350 );
+ }
+ }
+ } );
+ }, 4000 );
+ <?php endif; ?>
+ } );
+ </script>
+</body>
+</html>
</ins></span></pre>
</div>
</div>
</body>
</html>