Skip to content

Commit 57b4591

Browse files
supertassuKrinkle
authored andcommitted
All: convert logo_link and description to WordPress site options
Allow these sites.php values to be set in Puppet, and reduce amount of custom logic.
1 parent d348cb2 commit 57b4591

File tree

3 files changed

+15
-42
lines changed

3 files changed

+15
-42
lines changed

sites.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function jquery_sites() {
1111
'cookie_domain' => '.jquery.com',
1212
'options' => array(
1313
'blogname' => 'jQuery',
14-
'description' => 'jQuery: The Write Less, Do More, JavaScript Library',
14+
'jquery_description' => 'jQuery: The Write Less, Do More, JavaScript Library',
1515
'stylesheet' => 'jquery.com',
1616
'active_plugins' => array(
1717
'jquery-static-index.php',
@@ -35,14 +35,14 @@ function jquery_sites() {
3535
'api.jquery.com' => array(
3636
'blog_id' => 3,
3737
'cookie_domain' => '.jquery.com',
38-
'logo_link' => 'https://jquery.com/',
3938
'options' => array(
4039
'blogname' => 'jQuery API Documentation',
4140
'stylesheet' => 'api.jquery.com',
4241
'active_plugins' => array(
4342
'jquery-api-category-listing.php',
4443
),
4544
'jquery_body_class' => 'jquery',
45+
'jquery_logo_link'=> 'https://jquery.com/',
4646
'jquery_docsearch_api_key' => '3cfde9aca378c8aab554d5bf1b23489b',
4747
'jquery_docsearch_index_name' => 'jquery',
4848
),
@@ -73,7 +73,7 @@ function jquery_sites() {
7373
'cookie_domain' => '.jqueryui.com',
7474
'options' => array(
7575
'blogname' => 'jQuery UI',
76-
'description' => 'jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you\'re building highly interactive web applications or you just need to add a date picker to a form control, jQuery UI is the perfect choice.',
76+
'jquery_description' => 'jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you\'re building highly interactive web applications or you just need to add a date picker to a form control, jQuery UI is the perfect choice.',
7777
'stylesheet' => 'jqueryui.com',
7878
'active_plugins' => array(
7979
'jquery-static-index.php',
@@ -96,22 +96,21 @@ function jquery_sites() {
9696
'subsites' => 1, // Has one level of sub-sites (api.jqueryui.com/([^/]+))
9797
'blog_id' => 8,
9898
'cookie_domain' => '.jqueryui.com',
99-
'logo_link' => 'https://jqueryui.com/',
10099
'options' => array(
101100
'blogname' => 'jQuery UI API Documentation',
102101
'stylesheet' => 'api.jqueryui.com',
103102
'active_plugins' => array(
104103
'jquery-api-category-listing.php',
105104
),
106105
'jquery_body_class' => 'jquery-ui',
106+
'jquery_logo_link'=> 'https://jqueryui.com/',
107107
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
108108
'jquery_docsearch_index_name' => 'jqueryui',
109109
),
110110
),
111111
'api.jqueryui.com/1.8' => array(
112112
'blog_id' => 17,
113113
'cookie_domain' => '.jqueryui.com',
114-
'logo_link' => 'https://jqueryui.com/',
115114
'options' => array(
116115
'blogname' => 'jQuery UI 1.8 Documentation',
117116
'stylesheet' => 'api.jqueryui.com',
@@ -120,14 +119,14 @@ function jquery_sites() {
120119
'jquery-api-versioned-links.php',
121120
),
122121
'jquery_body_class' => 'jquery-ui',
122+
'jquery_logo_link'=> 'https://jqueryui.com/',
123123
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
124124
'jquery_docsearch_index_name' => 'jqueryui',
125125
),
126126
),
127127
'api.jqueryui.com/1.9' => array(
128128
'blog_id' => 21,
129129
'cookie_domain' => '.jqueryui.com',
130-
'logo_link' => 'https://jqueryui.com/',
131130
'options' => array(
132131
'blogname' => 'jQuery UI 1.9 Documentation',
133132
'stylesheet' => 'api.jqueryui.com',
@@ -136,6 +135,7 @@ function jquery_sites() {
136135
'jquery-api-versioned-links.php',
137136
),
138137
'jquery_body_class' => 'jquery-ui',
138+
'jquery_logo_link'=> 'https://jqueryui.com/',
139139
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
140140
'jquery_docsearch_index_name' => 'jqueryui',
141141
),
@@ -172,14 +172,14 @@ function jquery_sites() {
172172
'subsites' => 1, // Has one level of sub-sites (api.jquerymobile.com/([^/]+))
173173
'blog_id' => 13,
174174
'cookie_domain' => '.jquerymobile.com',
175-
'logo_link' => 'https://jquerymobile.com/',
176175
'options' => array(
177176
'blogname' => 'jQuery Mobile API Documentation',
178177
'stylesheet' => 'api.jquerymobile.com',
179178
'active_plugins' => array(
180179
'jquery-api-category-listing.php',
181180
),
182181
'jquery_body_class' => 'jquery-mobile',
182+
'jquery_logo_link'=> 'https://jquerymobile.com/',
183183
'jquery_docsearch_api_key' => '207328b0f1c18555c9021d05157dd651',
184184
'jquery_docsearch_index_name' => 'jquerymobile',
185185
),
@@ -228,7 +228,6 @@ function jquery_sites() {
228228
'api.jquerymobile.com/1.3' => array(
229229
'blog_id' => 24,
230230
'cookie_domain' => '.jquerymobile.com',
231-
'logo_link' => 'https://jquerymobile.com/',
232231
'options' => array(
233232
'blogname' => 'jQuery Mobile 1.3 Documentation',
234233
'stylesheet' => 'api.jquerymobile.com',
@@ -237,14 +236,14 @@ function jquery_sites() {
237236
'jquery-api-versioned-links.php',
238237
),
239238
'jquery_body_class' => 'jquery-mobile',
239+
'jquery_logo_link'=> 'https://jquerymobile.com/',
240240
'jquery_docsearch_api_key' => '207328b0f1c18555c9021d05157dd651',
241241
'jquery_docsearch_index_name' => 'jquerymobile',
242242
),
243243
),
244244
'api.jqueryui.com/1.10' => array(
245245
'blog_id' => 25,
246246
'cookie_domain' => '.jqueryui.com',
247-
'logo_link' => 'https://jqueryui.com/',
248247
'options' => array(
249248
'blogname' => 'jQuery UI 1.10 Documentation',
250249
'stylesheet' => 'api.jqueryui.com',
@@ -253,14 +252,14 @@ function jquery_sites() {
253252
'jquery-api-versioned-links.php',
254253
),
255254
'jquery_body_class' => 'jquery-ui',
255+
'jquery_logo_link'=> 'https://jqueryui.com/',
256256
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
257257
'jquery_docsearch_index_name' => 'jqueryui',
258258
),
259259
),
260260
'api.jqueryui.com/1.12' => array(
261261
'blog_id' => 26,
262262
'cookie_domain' => '.jqueryui.com',
263-
'logo_link' => 'https://jqueryui.com/',
264263
'options' => array(
265264
'blogname' => 'jQuery UI 1.12 Documentation',
266265
'stylesheet' => 'api.jqueryui.com',
@@ -269,14 +268,14 @@ function jquery_sites() {
269268
'jquery-api-versioned-links.php',
270269
),
271270
'jquery_body_class' => 'jquery-ui',
271+
'jquery_logo_link'=> 'https://jqueryui.com/',
272272
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
273273
'jquery_docsearch_index_name' => 'jqueryui',
274274
),
275275
),
276276
'api.jqueryui.com/1.11' => array(
277277
'blog_id' => 27,
278278
'cookie_domain' => '.jqueryui.com',
279-
'logo_link' => 'https://jqueryui.com/',
280279
'options' => array(
281280
'blogname' => 'jQuery UI 1.11 Documentation',
282281
'stylesheet' => 'api.jqueryui.com',
@@ -285,14 +284,14 @@ function jquery_sites() {
285284
'jquery-api-versioned-links.php',
286285
),
287286
'jquery_body_class' => 'jquery-ui',
287+
'jquery_logo_link'=> 'https://jqueryui.com/',
288288
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
289289
'jquery_docsearch_index_name' => 'jqueryui',
290290
),
291291
),
292292
'api.jquerymobile.com/1.4' => array(
293293
'blog_id' => 28,
294294
'cookie_domain' => '.jquerymobile.com',
295-
'logo_link' => 'https://jquerymobile.com/',
296295
'options' => array(
297296
'blogname' => 'jQuery Mobile 1.4 Documentation',
298297
'stylesheet' => 'api.jquerymobile.com',
@@ -301,6 +300,7 @@ function jquery_sites() {
301300
'jquery-api-versioned-links.php',
302301
),
303302
'jquery_body_class' => 'jquery-mobile',
303+
'jquery_logo_link'=> 'https://jquerymobile.com/',
304304
'jquery_docsearch_api_key' => '207328b0f1c18555c9021d05157dd651',
305305
'jquery_docsearch_index_name' => 'jquerymobile',
306306
),
@@ -320,7 +320,6 @@ function jquery_sites() {
320320
'api.jqueryui.com/1.13' => array(
321321
'blog_id' => 30,
322322
'cookie_domain' => '.jqueryui.com',
323-
'logo_link' => 'https://jqueryui.com/',
324323
'options' => array(
325324
'blogname' => 'jQuery UI 1.13 Documentation',
326325
'stylesheet' => 'api.jqueryui.com',
@@ -329,6 +328,7 @@ function jquery_sites() {
329328
'jquery-api-versioned-links.php',
330329
),
331330
'jquery_body_class' => 'jquery-ui',
331+
'jquery_logo_link'=> 'https://jqueryui.com/',
332332
'jquery_docsearch_api_key' => '2fce35e56784bbb48c78d105739190c2',
333333
'jquery_docsearch_index_name' => 'jqueryui',
334334
),

themes/jquery/functions.jquery.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -163,33 +163,6 @@ function jq_post_heirarchy() {
163163
'</div>';
164164
}
165165

166-
function jq_logo_link() {
167-
// TODO: remove when blog.jquery.com-theme is gone
168-
if ( !function_exists( 'jquery_sites' ) ) {
169-
return '/';
170-
}
171-
172-
$sites = jquery_sites();
173-
return empty( $sites[ JQUERY_LIVE_SITE ][ 'logo_link' ] ) ? '/' :
174-
$sites[ JQUERY_LIVE_SITE ][ 'logo_link' ];
175-
}
176-
177-
/**
178-
* Meta description about current site
179-
* Setup descriptions in 'sites.php'
180-
*
181-
* @return [String] description
182-
*/
183-
function jq_meta_description() {
184-
if ( !function_exists( 'jquery_sites' ) ) {
185-
return '';
186-
}
187-
188-
$sites = jquery_sites();
189-
return empty( $sites[ JQUERY_LIVE_SITE ][ 'options' ][ 'description' ] ) ? '' :
190-
$sites[ JQUERY_LIVE_SITE ][ 'options' ][ 'description' ];
191-
}
192-
193166
/**
194167
* Fixes paging on a search page when Relevanssi plugin is used
195168
*/

themes/jquery/header.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
?></title>
1515

1616
<meta name="author" content="JS Foundation - js.foundation">
17-
<meta name="description" content="<?php echo jq_meta_description(); ?>">
17+
<meta name="description" content="<?php echo get_option( 'jquery_description', '' ); ?>">
1818

1919
<meta name="viewport" content="width=device-width">
2020

@@ -99,7 +99,7 @@
9999

100100
<div id="container">
101101
<div id="logo-events" class="constrain clearfix">
102-
<h2 class="logo"><a href="<?php echo jq_logo_link(); ?>" title="<?php bloginfo( 'name' ); ?>"><?php bloginfo( 'name' ); ?></a></h2>
102+
<h2 class="logo"><a href="<?php echo get_option( 'jquery_logo_link', '/' ); ?>" title="<?php bloginfo( 'name' ); ?>"><?php bloginfo( 'name' ); ?></a></h2>
103103

104104
<aside>
105105
<div id="broadcast"></div>

0 commit comments

Comments
 (0)