-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathclass-connector-wordpress-seo.php
612 lines (550 loc) · 26.4 KB
/
class-connector-wordpress-seo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
<?php
/**
* Connector for WordPress SEO
*
* @package WP_Stream
*/
namespace WP_Stream;
/**
* Class - Connector_WordPress_SEO
*/
class Connector_WordPress_SEO extends Connector {
/**
* Connector slug
*
* @var string
*/
public $name = 'wordpressseo';
/**
* Holds tracked plugin minimum version required
*
* @const string
*/
const PLUGIN_MIN_VERSION = '1.5.3.3';
/**
* Actions registered for this connector
*
* @var array
*/
public $actions = array(
'wpseo_handle_import',
'wpseo_import',
'seo_page_wpseo_files',
'added_post_meta',
'updated_post_meta',
'deleted_post_meta',
);
/**
* Tracking registered Settings, with overridden data
*
* @var array
*/
public $option_groups = array();
/**
* Check if plugin dependencies are satisfied and add an admin notice if not
*
* @return bool
*/
public function is_dependency_satisfied() {
if ( defined( 'WPSEO_VERSION' ) && version_compare( WPSEO_VERSION, self::PLUGIN_MIN_VERSION, '>=' ) ) {
return true;
}
return false;
}
/**
* Return translated connector label
*
* @return string Translated connector label
*/
public function get_label() {
return esc_html_x( 'WordPress SEO', 'wordpress-seo', 'stream' );
}
/**
* Return translated action labels
*
* @return array Action label translations
*/
public function get_action_labels() {
return array(
'created' => esc_html_x( 'Created', 'wordpress-seo', 'stream' ),
'updated' => esc_html_x( 'Updated', 'wordpress-seo', 'stream' ),
'added' => esc_html_x( 'Added', 'wordpress-seo', 'stream' ),
'deleted' => esc_html_x( 'Deleted', 'wordpress-seo', 'stream' ),
'exported' => esc_html_x( 'Exported', 'wordpress-seo', 'stream' ),
'imported' => esc_html_x( 'Imported', 'wordpress-seo', 'stream' ),
);
}
/**
* Return translated context labels
*
* @return array Context label translations
*/
public function get_context_labels() {
return array(
'wpseo_dashboard' => esc_html_x( 'Dashboard', 'wordpress-seo', 'stream' ),
'wpseo_titles' => _x( 'Titles & Metas', 'wordpress-seo', 'stream' ),
'wpseo_social' => esc_html_x( 'Social', 'wordpress-seo', 'stream' ),
'wpseo_xml' => esc_html_x( 'XML Sitemaps', 'wordpress-seo', 'stream' ),
'wpseo_permalinks' => esc_html_x( 'Permalinks', 'wordpress-seo', 'stream' ),
'wpseo_internal-links' => esc_html_x( 'Internal Links', 'wordpress-seo', 'stream' ),
'wpseo_advanced' => esc_html_x( 'Advanced', 'wordpress-seo', 'stream' ),
'wpseo_rss' => esc_html_x( 'RSS', 'wordpress-seo', 'stream' ),
'wpseo_import' => esc_html_x( 'Import & Export', 'wordpress-seo', 'stream' ),
'wpseo_bulk-title-editor' => esc_html_x( 'Bulk Title Editor', 'wordpress-seo', 'stream' ),
'wpseo_bulk-description-editor' => esc_html_x( 'Bulk Description Editor', 'wordpress-seo', 'stream' ),
'wpseo_files' => esc_html_x( 'Files', 'wordpress-seo', 'stream' ),
'wpseo_meta' => esc_html_x( 'Content', 'wordpress-seo', 'stream' ),
);
}
/**
* Add action links to Stream drop row in admin list screen
*
* @filter wp_stream_action_links_{connector}
*
* @param array $links Previous links registered.
* @param Record $record Stream record.
*
* @return array Action links
*/
public function action_links( $links, $record ) {
// Options.
$option = $record->get_meta( 'option', true );
if ( $option ) {
$key = $record->get_meta( 'option_key', true );
$links[ esc_html__( 'Edit', 'stream' ) ] = add_query_arg(
array(
'page' => $record->context,
),
admin_url( 'admin.php' )
) . '#stream-highlight-' . esc_attr( $key );
} elseif ( 'wpseo_files' === $record->context ) {
$links[ esc_html__( 'Edit', 'stream' ) ] = add_query_arg(
array(
'page' => $record->context,
),
admin_url( 'admin.php' )
);
} elseif ( 'wpseo_meta' === $record->context ) {
$post = get_post( $record->object_id );
if ( $post ) {
$posts_connector = new Connector_Posts();
$post_type_name = $posts_connector->get_post_type_name( get_post_type( $post->ID ) );
if ( 'trash' === $post->post_status ) {
$untrash = wp_nonce_url(
add_query_arg(
array(
'action' => 'untrash',
'post' => $post->ID,
),
admin_url( 'post.php' )
),
sprintf( 'untrash-post_%d', $post->ID )
);
$delete = wp_nonce_url(
add_query_arg(
array(
'action' => 'delete',
'post' => $post->ID,
),
admin_url( 'post.php' )
),
sprintf( 'delete-post_%d', $post->ID )
);
/* translators: %s: a post type singular name (e.g. "Post") */
$links[ sprintf( esc_html_x( 'Restore %s', 'Post type singular name', 'stream' ), $post_type_name ) ] = $untrash;
/* translators: %s: a post type singular name (e.g. "Post") */
$links[ sprintf( esc_html_x( 'Delete %s Permanently', 'Post type singular name', 'stream' ), $post_type_name ) ] = $delete;
} else {
/* translators: %s: a post type singular name (e.g. "Post") */
$links[ sprintf( esc_html_x( 'Edit %s', 'Post type singular name', 'stream' ), $post_type_name ) ] = get_edit_post_link( $post->ID );
$view_link = get_permalink( $post->ID );
if ( $view_link ) {
$links[ esc_html__( 'View', 'stream' ) ] = $view_link;
}
$revision_id = $record->get_meta( 'revision_id', true );
if ( $revision_id ) {
$links[ esc_html__( 'Revision', 'stream' ) ] = get_edit_post_link( $revision_id );
}
}
}
}
return $links;
}
/**
* Register connection
*/
public function register() {
if ( is_network_admin() && ! is_plugin_active_for_network( 'wordpress-seo/wordpress-seo-main.php' ) ) {
return;
}
parent::register();
foreach ( \WPSEO_Options::$options as $class ) {
/**
* WPSEO Options object.
*
* @var WPSEO_Options $class
*/
$this->option_groups[ $class::get_instance()->group_name ] = array(
'class' => $class,
'name' => $class::get_instance()->option_name,
);
}
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
add_filter( 'wp_stream_log_data', array( $this, 'log_override' ) );
}
/**
* Register admin scripts.
*
* @param string $hook Current hook.
*/
public function admin_enqueue_scripts( $hook ) {
if ( 0 === strpos( $hook, 'seo_page_' ) ) {
$stream = wp_stream_get_instance();
$src = $stream->locations['url'] . '/ui/js/wpseo-admin.js';
wp_enqueue_script(
'stream-connector-wpseo',
$src,
array( 'jquery' ),
$stream->get_version(),
false
);
}
}
/**
* Track importing settings from other plugins
*
* @action wpseo_handle_import
*/
public function callback_wpseo_handle_import() {
$imports = array(
'importheadspace' => esc_html__( 'HeadSpace2', 'stream' ), // type = checkbox.
'importaioseo' => esc_html__( 'All-in-One SEO', 'stream' ), // type = checkbox.
'importaioseoold' => esc_html__( 'OLD All-in-One SEO', 'stream' ), // type = checkbox.
'importwoo' => esc_html__( 'WooThemes SEO framework', 'stream' ), // type = checkbox.
'importrobotsmeta' => esc_html__( 'Robots Meta (by Yoast)', 'stream' ), // type = checkbox.
'importrssfooter' => esc_html__( 'RSS Footer (by Yoast)', 'stream' ), // type = checkbox.
'importbreadcrumbs' => esc_html__( 'Yoast Breadcrumbs', 'stream' ), // type = checkbox.
);
$opts = wp_stream_filter_input( INPUT_POST, 'wpseo' );
foreach ( $imports as $key => $name ) {
if ( isset( $opts[ $key ] ) ) {
$this->log(
sprintf(
/* translators: %1$s: an import method, %2$s: an extra string (sometimes blank) (e.g. "HeadSpace2", ", and deleted old data") */
__( 'Imported settings from %1$s%2$s', 'stream' ),
$name,
isset( $opts['deleteolddata'] ) ? esc_html__( ', and deleted old data', 'stream' ) : ''
),
array(
'key' => $key,
'deleteolddata' => isset( $opts['deleteolddata'] ),
),
null,
'wpseo_import',
'imported'
);
}
}
}
/**
* Track importing settings
*
* @callback wpseo_import
*/
public function callback_wpseo_import() {
$opts = wp_stream_filter_input( INPUT_POST, 'wpseo' );
if ( wp_stream_filter_input( INPUT_POST, 'wpseo_export' ) ) {
$this->log(
sprintf(
/* translators: %s: an extra string (sometimes blank) (e.g. ", including taxonomy meta") */
__( 'Exported settings%s', 'stream' ),
isset( $opts['include_taxonomy_meta'] ) ? esc_html__( ', including taxonomy meta', 'stream' ) : ''
),
array(
'include_taxonomy_meta' => isset( $opts['include_taxonomy_meta'] ),
),
null,
'wpseo_import',
'exported'
);
} elseif ( isset( $_FILES['settings_import_file']['name'] ) ) { // phpcs: input var okay.
$this->log(
sprintf(
/* translators: %s: a filename (e.g. "test.xml") */
__( 'Tried importing settings from "%s"', 'stream' ),
sanitize_text_field( wp_unslash( $_FILES['settings_import_file']['name'] ) ) // phpcs: input var okay.
),
array(
'file' => sanitize_text_field( wp_unslash( $_FILES['settings_import_file']['name'] ) ), // phpcs: input var okay.
),
null,
'wpseo_import',
'exported'
);
}
}
/**
* Tracks creation of SEO-related files.
*
* @action seo_page_wpseo_files
*/
public function callback_seo_page_wpseo_files() {
if ( wp_stream_filter_input( INPUT_POST, 'create_robots' ) ) {
$message = esc_html__( 'Tried creating robots.txt file', 'stream' );
} elseif ( wp_stream_filter_input( INPUT_POST, 'submitrobots' ) ) {
$message = esc_html__( 'Tried updating robots.txt file', 'stream' );
} elseif ( wp_stream_filter_input( INPUT_POST, 'submithtaccess' ) ) {
$message = esc_html__( 'Tried updating htaccess file', 'stream' );
}
if ( isset( $message ) ) {
$this->log(
$message,
array(),
null,
'wpseo_files',
'updated'
);
}
}
/**
* Tracks the creation of WordPress SEO post meta
*
* @action added_post_meta
*
* @param int $meta_id Meta ID.
* @param int $object_id Object ID.
* @param string $meta_key Meta key.
* @param string $meta_value Meta value.
*/
public function callback_added_post_meta( $meta_id, $object_id, $meta_key, $meta_value ) {
unset( $meta_id );
$this->meta( $object_id, $meta_key, $meta_value );
}
/**
* Tracks the updates to WordPress SEO post meta
*
* @action updated_post_meta
*
* @param int $meta_id Meta ID.
* @param int $object_id Object ID.
* @param string $meta_key Meta key.
* @param string $meta_value Meta value.
*/
public function callback_updated_post_meta( $meta_id, $object_id, $meta_key, $meta_value ) {
unset( $meta_id );
$this->meta( $object_id, $meta_key, $meta_value );
}
/**
* Tracks the deletions of WordPress SEO post meta
*
* @action deleted_post_meta
*
* @param int $meta_id Meta ID.
* @param int $object_id Object ID.
* @param string $meta_key Meta key.
* @param string $meta_value Meta value.
*/
public function callback_deleted_post_meta( $meta_id, $object_id, $meta_key, $meta_value ) {
unset( $meta_id );
$this->meta( $object_id, $meta_key, $meta_value );
}
/**
* Logs WordPress SEO meta activity
*
* @param int $object_id Object ID.
* @param int $meta_key Meta key.
* @param string $meta_value Meta value.
*/
private function meta( $object_id, $meta_key, $meta_value ) {
$prefix = \WPSEO_Meta::$meta_prefix;
\WPSEO_Metabox::translate_meta_boxes();
if ( 0 !== strpos( $meta_key, $prefix ) ) {
return;
}
$key = str_replace( $prefix, '', $meta_key );
foreach ( \WPSEO_Meta::$meta_fields as $tab => $fields ) {
if ( isset( $fields[ $key ] ) ) {
$field = $fields[ $key ];
break;
}
}
if ( ! isset( $field, $field['title'], $tab ) || '' === $field['title'] ) {
return;
}
$post = get_post( $object_id );
$post_type_label = get_post_type_labels( get_post_type_object( $post->post_type ) )->singular_name;
$this->log(
sprintf(
/* translators: %1$s: a meta field title, %2$s: a post title, %3$s: a post type (e.g. "Description", "Hello World", "Post") */
__( 'Updated "%1$s" of "%2$s" %3$s', 'stream' ),
$field['title'],
$post->post_title,
$post_type_label
),
array(
'meta_key' => $meta_key,
'meta_value' => $meta_value,
'post_type' => $post->post_type,
),
$object_id,
'wpseo_meta',
'updated'
);
}
/**
* Override connector log for our own Settings / Actions
*
* @param array $data Record data.
*
* @return array|bool
*/
public function log_override( $data ) {
if ( ! is_array( $data ) ) {
return $data;
}
global $pagenow;
if ( 'options.php' === $pagenow && 'settings' === $data['connector'] && wp_stream_filter_input( INPUT_POST, '_wp_http_referer' ) ) {
if ( ! isset( $data['args']['context'] ) || ! isset( $this->option_groups[ $data['args']['context'] ] ) ) {
return $data;
}
$page = preg_match( '#page=([^&]*)#', wp_stream_filter_input( INPUT_POST, '_wp_http_referer' ), $match ) ? $match[1] : '';
$labels = $this->get_context_labels();
if ( ! isset( $labels[ $page ] ) ) {
return $data;
}
$label = $this->settings_labels( $data['args']['option_key'] );
if ( ! $label ) {
/* translators: %s: a context (e.g. "Dashboard") */
$data['message'] = esc_html__( '%s settings updated', 'stream' );
$label = $labels[ $page ];
}
$data['args']['label'] = $label;
$data['args']['context'] = $page;
$data['context'] = $page;
$data['connector'] = $this->name;
}
return $data;
}
/**
* Return the labels
*
* @param string $option Name of option to be retrieved.
*
* @return array|bool.
*/
private function settings_labels( $option ) {
$labels = array(
// wp-content/plugins/wordpress-seo/admin/pages/dashboard.php:.
'yoast_tracking' => esc_html_x( "Allow tracking of this WordPress install's anonymous data.", 'wordpress-seo', 'stream' ), // type = checkbox.
'disableadvanced_meta' => esc_html_x( 'Disable the Advanced part of the WordPress SEO meta box', 'wordpress-seo', 'stream' ), // type = checkbox.
'alexaverify' => esc_html_x( 'Alexa Verification ID', 'wordpress-seo', 'stream' ), // type = textinput.
'msverify' => esc_html_x( 'Bing Webmaster Tools', 'wordpress-seo', 'stream' ), // type = textinput.
'googleverify' => esc_html_x( 'Google Webmaster Tools', 'wordpress-seo', 'stream' ), // type = textinput.
'pinterestverify' => esc_html_x( 'Pinterest', 'wordpress-seo', 'stream' ), // type = textinput.
'yandexverify' => esc_html_x( 'Yandex Webmaster Tools', 'wordpress-seo', 'stream' ), // type = textinput.
// wp-content/plugins/wordpress-seo/admin/pages/advanced.php:.
'breadcrumbs-enable' => esc_html_x( 'Enable Breadcrumbs', 'wordpress-seo', 'stream' ), // type = checkbox.
'breadcrumbs-sep' => esc_html_x( 'Separator between breadcrumbs', 'wordpress-seo', 'stream' ), // type = textinput.
'breadcrumbs-home' => esc_html_x( 'Anchor text for the Homepage', 'wordpress-seo', 'stream' ), // type = textinput.
'breadcrumbs-prefix' => esc_html_x( 'Prefix for the breadcrumb path', 'wordpress-seo', 'stream' ), // type = textinput.
'breadcrumbs-archiveprefix' => esc_html_x( 'Prefix for Archive breadcrumbs', 'wordpress-seo', 'stream' ), // type = textinput.
'breadcrumbs-searchprefix' => esc_html_x( 'Prefix for Search Page breadcrumbs', 'wordpress-seo', 'stream' ), // type = textinput.
'breadcrumbs-404crumb' => esc_html_x( 'Breadcrumb for 404 Page', 'wordpress-seo', 'stream' ), // type = textinput.
'breadcrumbs-blog-remove' => esc_html_x( 'Remove Blog page from Breadcrumbs', 'wordpress-seo', 'stream' ), // type = checkbox.
'breadcrumbs-boldlast' => esc_html_x( 'Bold the last page in the breadcrumb', 'wordpress-seo', 'stream' ), // type = checkbox.
'post_types-post-maintax' => esc_html_x( 'Taxonomy to show in breadcrumbs for post types', 'wordpress-seo', 'stream' ), // type = select.
// wp-content/plugins/wordpress-seo/admin/pages/metas.php:.
'forcerewritetitle' => esc_html_x( 'Force rewrite titles', 'wordpress-seo', 'stream' ), // type = checkbox.
'noindex-subpages-wpseo' => esc_html_x( 'Noindex subpages of archives', 'wordpress-seo', 'stream' ), // type = checkbox.
'usemetakeywords' => _x( 'Use <code>meta</code> keywords tag?', 'wordpress-seo', 'stream' ), // type = checkbox.
'noodp' => _x( 'Add <code>noodp</code> meta robots tag sitewide', 'wordpress-seo', 'stream' ), // type = checkbox.
'noydir' => _x( 'Add <code>noydir</code> meta robots tag sitewide', 'wordpress-seo', 'stream' ), // type = checkbox.
'hide-rsdlink' => esc_html_x( 'Hide RSD Links', 'wordpress-seo', 'stream' ), // type = checkbox.
'hide-wlwmanifest' => esc_html_x( 'Hide WLW Manifest Links', 'wordpress-seo', 'stream' ), // type = checkbox.
'hide-shortlink' => esc_html_x( 'Hide Shortlink for posts', 'wordpress-seo', 'stream' ), // type = checkbox.
'hide-feedlinks' => esc_html_x( 'Hide RSS Links', 'wordpress-seo', 'stream' ), // type = checkbox.
'disable-author' => esc_html_x( 'Disable the author archives', 'wordpress-seo', 'stream' ), // type = checkbox.
'disable-date' => esc_html_x( 'Disable the date-based archives', 'wordpress-seo', 'stream' ), // type = checkbox.
// wp-content/plugins/wordpress-seo/admin/pages/network.php:.
'access' => esc_html_x( 'Who should have access to the WordPress SEO settings', 'wordpress-seo', 'stream' ), // type = select.
'defaultblog' => esc_html_x( 'New blogs get the SEO settings from this blog', 'wordpress-seo', 'stream' ), // type = textinput.
'restoreblog' => esc_html_x( 'Blog ID', 'wordpress-seo', 'stream' ), // type = textinput.
// wp-content/plugins/wordpress-seo/admin/pages/permalinks.php:.
'stripcategorybase' => _x( 'Strip the category base (usually <code>/category/</code>) from the category URL.', 'wordpress-seo', 'stream' ), // type = checkbox.
'trailingslash' => esc_html_x( "Enforce a trailing slash on all category and tag URL's", 'wordpress-seo', 'stream' ), // type = checkbox.
'cleanslugs' => esc_html_x( 'Remove stop words from slugs.', 'wordpress-seo', 'stream' ), // type = checkbox.
'redirectattachment' => esc_html_x( "Redirect attachment URL's to parent post URL.", 'wordpress-seo', 'stream' ), // type = checkbox.
'cleanreplytocom' => _x( 'Remove the <code>?replytocom</code> variables.', 'wordpress-seo', 'stream' ), // type = checkbox.
'cleanpermalinks' => esc_html_x( "Redirect ugly URL's to clean permalinks. (Not recommended in many cases!)", 'wordpress-seo', 'stream' ), // type = checkbox.
'force_transport' => esc_html_x( 'Force Transport', 'wordpress-seo', 'stream' ), // type = select.
'cleanpermalink-googlesitesearch' => esc_html_x( "Prevent cleaning out Google Site Search URL's.", 'wordpress-seo', 'stream' ), // type = checkbox.
'cleanpermalink-googlecampaign' => esc_html_x( 'Prevent cleaning out Google Analytics Campaign & Google AdWords Parameters.', 'wordpress-seo', 'stream' ), // type = checkbox.
'cleanpermalink-extravars' => esc_html_x( 'Other variables not to clean', 'wordpress-seo', 'stream' ), // type = textinput.
// wp-content/plugins/wordpress-seo/admin/pages/social.php:.
'opengraph' => esc_html_x( 'Add Open Graph meta data', 'wordpress-seo', 'stream' ), // type = checkbox.
'facebook_site' => esc_html_x( 'Facebook Page URL', 'wordpress-seo', 'stream' ), // type = textinput.
'instagram_url' => esc_html_x( 'Instagram URL', 'wordpress-seo', 'stream' ), // type = textinput.
'linkedin_url' => esc_html_x( 'LinkedIn URL', 'wordpress-seo', 'stream' ), // type = textinput.
'myspace_url' => esc_html_x( 'MySpace URL', 'wordpress-seo', 'stream' ), // type = textinput.
'pinterest_url' => esc_html_x( 'Pinterest URL', 'wordpress-seo', 'stream' ), // type = textinput.
'youtube_url' => esc_html_x( 'YouTube URL', 'wordpress-seo', 'stream' ), // type = textinput.
'google_plus_url' => esc_html_x( 'Google+ URL', 'wordpress-seo', 'stream' ), // type = textinput.
'og_frontpage_image' => esc_html_x( 'Image URL', 'wordpress-seo', 'stream' ), // type = textinput.
'og_frontpage_desc' => esc_html_x( 'Description', 'wordpress-seo', 'stream' ), // type = textinput.
'og_frontpage_title' => esc_html_x( 'Title', 'wordpress-seo', 'stream' ), // type = textinput.
'og_default_image' => esc_html_x( 'Image URL', 'wordpress-seo', 'stream' ), // type = textinput.
'twitter' => esc_html_x( 'Add Twitter card meta data', 'wordpress-seo', 'stream' ), // type = checkbox.
'twitter_site' => esc_html_x( 'Site Twitter Username', 'wordpress-seo', 'stream' ), // type = textinput.
'twitter_card_type' => esc_html_x( 'The default card type to use', 'wordpress-seo', 'stream' ), // type = select.
'googleplus' => esc_html_x( 'Add Google+ specific post meta data (excluding author metadata)', 'wordpress-seo', 'stream' ), // type = checkbox.
'plus-publisher' => esc_html_x( 'Google Publisher Page', 'wordpress-seo', 'stream' ), // type = textinput.
'fbadminapp' => esc_html_x( 'Facebook App ID', 'wordpress-seo', 'stream' ), // type = textinput.
// wp-content/plugins/wordpress-seo/admin/pages/xml-sitemaps.php:.
'enablexmlsitemap' => esc_html_x( 'Check this box to enable XML sitemap functionality.', 'wordpress-seo', 'stream' ), // type = checkbox.
'disable_author_sitemap' => esc_html_x( 'Disable author/user sitemap', 'wordpress-seo', 'stream' ), // type = checkbox.
'disable_author_noposts' => esc_html_x( 'Users with zero posts', 'wordpress-seo', 'stream' ), // type = checkbox.
'user_role-administrator-not_in_sitemap' => esc_html_x( 'Filter specific user roles - Administrator', 'wordpress-seo', 'stream' ), // type = checkbox.
'user_role-editor-not_in_sitemap' => esc_html_x( 'Filter specific user roles - Editor', 'wordpress-seo', 'stream' ), // type = checkbox.
'user_role-author-not_in_sitemap' => esc_html_x( 'Filter specific user roles - Author', 'wordpress-seo', 'stream' ), // type = checkbox.
'user_role-contributor-not_in_sitemap' => esc_html_x( 'Filter specific user roles - Contributor', 'wordpress-seo', 'stream' ), // type = checkbox.
'user_role-subscriber-not_in_sitemap' => esc_html_x( 'Filter specific user roles - Subscriber', 'wordpress-seo', 'stream' ), // type = checkbox.
'xml_ping_yahoo' => esc_html_x( 'Ping Yahoo!', 'wordpress-seo', 'stream' ), // type = checkbox.
'xml_ping_ask' => esc_html_x( 'Ping Ask.com', 'wordpress-seo', 'stream' ), // type = checkbox.
'entries-per-page' => esc_html_x( 'Max entries per sitemap page', 'wordpress-seo', 'stream' ), // type = textinput.
'excluded-posts' => esc_html_x( 'Posts to exclude', 'wordpress-seo', 'stream' ), // type = textinput.
'post_types-post-not_in_sitemap' => _x( 'Post Types Posts (<code>post</code>)', 'wordpress-seo', 'stream' ), // type = checkbox.
'post_types-page-not_in_sitemap' => _x( 'Post Types Pages (<code>page</code>)', 'wordpress-seo', 'stream' ), // type = checkbox.
'post_types-attachment-not_in_sitemap' => _x( 'Post Types Media (<code>attachment</code>)', 'wordpress-seo', 'stream' ), // type = checkbox.
'taxonomies-category-not_in_sitemap' => _x( 'Taxonomies Categories (<code>category</code>)', 'wordpress-seo', 'stream' ), // type = checkbox.
'taxonomies-post_tag-not_in_sitemap' => _x( 'Taxonomies Tags (<code>post_tag</code>)', 'wordpress-seo', 'stream' ), // type = checkbox.
// Added manually.
'rssbefore' => esc_html_x( 'Content to put before each post in the feed', 'wordpress-seo', 'stream' ),
'rssafter' => esc_html_x( 'Content to put after each post', 'wordpress-seo', 'stream' ),
);
$ast_labels = array(
'title-' => esc_html_x( 'Title template', 'wordpress-seo', 'stream' ), // type = textinput.
'metadesc-' => esc_html_x( 'Meta description template', 'wordpress-seo', 'stream' ), // type = textarea.
'metakey-' => esc_html_x( 'Meta keywords template', 'wordpress-seo', 'stream' ), // type = textinput.
'noindex-' => esc_html_x( 'Meta Robots', 'wordpress-seo', 'stream' ), // type = checkbox.
'noauthorship-' => esc_html_x( 'Authorship', 'wordpress-seo', 'stream' ), // type = checkbox.
'showdate-' => esc_html_x( 'Show date in snippet preview?', 'wordpress-seo', 'stream' ), // type = checkbox.
'hideeditbox-' => esc_html_x( 'WordPress SEO Meta Box', 'wordpress-seo', 'stream' ), // type = checkbox.
'bctitle-' => esc_html_x( 'Breadcrumbs Title', 'wordpress-seo', 'stream' ), // type = textinput.
'post_types-' => esc_html_x( 'Post types', 'wordpress-seo', 'stream' ), // type = checkbox.
'taxonomies-' => esc_html_x( 'Taxonomies', 'wordpress-seo', 'stream' ), // type = checkbox.
);
if ( $option ) {
if ( isset( $labels[ $option ] ) ) {
return $labels[ $option ];
} else {
foreach ( $ast_labels as $key => $trans ) {
if ( 0 === strpos( $option, $key ) ) {
return $trans;
}
}
return false;
}
}
return $labels;
}
}