| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Head Meta Data |
| 4 |
Plugin URI: https://perishablepress.com/head-metadata-plus/ |
| 5 |
Description: Adds a custom set of <meta> tags to the <head> section of all posts & pages. |
| 6 |
Tags: meta, metadata, head, header, tags, custom, custom content, author, publisher, language, wp_head |
| 7 |
Author: Jeff Starr |
| 8 |
Author URI: https://plugin-planet.com/ |
| 9 |
Donate link: https://monzillamedia.com/donate.html |
| 10 |
Contributors: specialk |
| 11 |
Requires at least: 4.6 |
| 12 |
Tested up to: 5.9 |
| 13 |
Stable tag: 20220113 |
| 14 |
Version: 20220113 |
| 15 |
Requires PHP: 5.6.20 |
| 16 |
Text Domain: head-meta-data |
| 17 |
Domain Path: /languages |
| 18 |
License: GPL v2 or later |
| 19 |
*/ |
| 20 |
|
| 21 |
/* |
| 22 |
This program is free software; you can redistribute it and/or |
| 23 |
modify it under the terms of the GNU General Public License |
| 24 |
as published by the Free Software Foundation; either version |
| 25 |
2 of the License, or (at your option) any later version. |
| 26 |
|
| 27 |
This program is distributed in the hope that it will be useful, |
| 28 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 29 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 30 |
GNU General Public License for more details. |
| 31 |
|
| 32 |
You should have received a copy of the GNU General Public License |
| 33 |
with this program. If not, visit: https://www.gnu.org/licenses/ |
| 34 |
|
| 35 |
Copyright 2022 Monzilla Media. All rights reserved. |
| 36 |
*/ |
| 37 |
|
| 38 |
if (!defined('ABSPATH')) die(); |
| 39 |
|
| 40 |
$hmd_wp_vers = '4.6'; |
| 41 |
$hmd_version = '20220113'; |
| 42 |
$hmd_plugin = esc_html__('Head Meta Data', 'head-meta-data'); |
| 43 |
$hmd_options = get_option('hmd_options'); |
| 44 |
$hmd_path = plugin_basename(__FILE__); // 'head-meta-data/head-meta-data.php'; |
| 45 |
$hmd_homeurl = 'https://perishablepress.com/head-metadata-plus/'; |
| 46 |
|
| 47 |
function hmd_i18n_init() { |
| 48 |
|
| 49 |
load_plugin_textdomain('head-meta-data', false, dirname(plugin_basename(__FILE__)) .'/languages/'); |
| 50 |
|
| 51 |
} |
| 52 |
add_action('init', 'hmd_i18n_init'); |
| 53 |
|
| 54 |
function hmd_require_wp_version() { |
| 55 |
|
| 56 |
global $hmd_path, $hmd_plugin, $hmd_wp_vers; |
| 57 |
|
| 58 |
if (isset($_GET['activate']) && $_GET['activate'] == 'true') { |
| 59 |
|
| 60 |
$wp_version = get_bloginfo('version'); |
| 61 |
|
| 62 |
if (version_compare($wp_version, $hmd_wp_vers, '<')) { |
| 63 |
|
| 64 |
if (is_plugin_active($hmd_path)) { |
| 65 |
|
| 66 |
deactivate_plugins($hmd_path); |
| 67 |
|
| 68 |
$msg = '<strong>' . $hmd_plugin . '</strong> ' . esc_html__('requires WordPress ', 'head-meta-data') . $hmd_wp_vers . esc_html__(' or higher, and has been deactivated!', 'head-meta-data') . '<br />'; |
| 69 |
$msg .= esc_html__('Please return to the', 'head-meta-data') . ' <a href="' . admin_url() . '">' . esc_html__('WordPress Admin area', 'head-meta-data') . '</a> ' . esc_html__('to upgrade WordPress and try again.', 'head-meta-data'); |
| 70 |
|
| 71 |
wp_die($msg); |
| 72 |
|
| 73 |
} |
| 74 |
|
| 75 |
} |
| 76 |
|
| 77 |
} |
| 78 |
|
| 79 |
} |
| 80 |
add_action('admin_init', 'hmd_require_wp_version'); |
| 81 |
|
| 82 |
function head_meta_data() { |
| 83 |
|
| 84 |
echo hmd_display_content(); |
| 85 |
|
| 86 |
} |
| 87 |
add_action('wp_head', 'head_meta_data'); |
| 88 |
|
| 89 |
function hmd_shortcode() { |
| 90 |
|
| 91 |
$get_meta_data = hmd_display_content(); |
| 92 |
|
| 93 |
$the_meta_data = str_replace(array('>', '<'), array('>','<'), $get_meta_data); |
| 94 |
|
| 95 |
return $the_meta_data; |
| 96 |
|
| 97 |
} |
| 98 |
add_shortcode('head_meta_data','hmd_shortcode'); |
| 99 |
|
| 100 |
function hmd_disable_default() { |
| 101 |
|
| 102 |
if (!is_singular()) return; |
| 103 |
|
| 104 |
global $post; |
| 105 |
|
| 106 |
return get_post_meta($post->ID, 'hmd_disable_default', true); |
| 107 |
|
| 108 |
} |
| 109 |
|
| 110 |
function hmd_display_custom() { |
| 111 |
|
| 112 |
if (!is_singular()) return; |
| 113 |
|
| 114 |
global $post; |
| 115 |
|
| 116 |
$custom = ''; |
| 117 |
|
| 118 |
$value = get_post_meta($post->ID, 'head-meta-data', false); |
| 119 |
|
| 120 |
if (is_array($value)) { |
| 121 |
|
| 122 |
foreach ($value as $v) { |
| 123 |
|
| 124 |
$custom .= $v . "\n"; |
| 125 |
|
| 126 |
} |
| 127 |
|
| 128 |
} |
| 129 |
|
| 130 |
return $custom; |
| 131 |
|
| 132 |
} |
| 133 |
|
| 134 |
function hmd_display_content() { |
| 135 |
|
| 136 |
global $hmd_options; |
| 137 |
|
| 138 |
$hmd_output = ''; |
| 139 |
|
| 140 |
$hmd_enable = isset($hmd_options['hmd_enable']) ? $hmd_options['hmd_enable'] : false; |
| 141 |
$hmd_format = isset($hmd_options['hmd_format']) ? $hmd_options['hmd_format'] : false; |
| 142 |
|
| 143 |
$close_tag = ($hmd_format == false) ? '" />' . "\n" : $close_tag = '">' . "\n"; |
| 144 |
|
| 145 |
if ($hmd_enable == true && !hmd_disable_default()) { |
| 146 |
|
| 147 |
if (isset($hmd_options['hmd_charset']) && $hmd_options['hmd_charset'] !== '') $hmd_output = "\t\t" .'<meta charset="' . $hmd_options['hmd_charset'] . $close_tag; |
| 148 |
if (isset($hmd_options['hmd_abstract']) && $hmd_options['hmd_abstract'] !== '') $hmd_output .= "\t\t" .'<meta name="abstract" content="' . $hmd_options['hmd_abstract'] . $close_tag; |
| 149 |
if (isset($hmd_options['hmd_author']) && $hmd_options['hmd_author'] !== '') $hmd_output .= "\t\t" .'<meta name="author" content="' . $hmd_options['hmd_author'] . $close_tag; |
| 150 |
if (isset($hmd_options['hmd_classify']) && $hmd_options['hmd_classify'] !== '') $hmd_output .= "\t\t" .'<meta name="classification" content="' . $hmd_options['hmd_classify'] . $close_tag; |
| 151 |
if (isset($hmd_options['hmd_copyright']) && $hmd_options['hmd_copyright'] !== '') $hmd_output .= "\t\t" .'<meta name="copyright" content="' . $hmd_options['hmd_copyright'] . $close_tag; |
| 152 |
if (isset($hmd_options['hmd_designer']) && $hmd_options['hmd_designer'] !== '') $hmd_output .= "\t\t" .'<meta name="designer" content="' . $hmd_options['hmd_designer'] . $close_tag; |
| 153 |
if (isset($hmd_options['hmd_distribute']) && $hmd_options['hmd_distribute'] !== '') $hmd_output .= "\t\t" .'<meta name="distribution" content="' . $hmd_options['hmd_distribute'] . $close_tag; |
| 154 |
if (isset($hmd_options['hmd_language']) && $hmd_options['hmd_language'] !== '') $hmd_output .= "\t\t" .'<meta name="language" content="' . $hmd_options['hmd_language'] . $close_tag; |
| 155 |
if (isset($hmd_options['hmd_publisher']) && $hmd_options['hmd_publisher'] !== '') $hmd_output .= "\t\t" .'<meta name="publisher" content="' . $hmd_options['hmd_publisher'] . $close_tag; |
| 156 |
if (isset($hmd_options['hmd_rating']) && $hmd_options['hmd_rating'] !== '') $hmd_output .= "\t\t" .'<meta name="rating" content="' . $hmd_options['hmd_rating'] . $close_tag; |
| 157 |
if (isset($hmd_options['hmd_resource']) && $hmd_options['hmd_resource'] !== '') $hmd_output .= "\t\t" .'<meta name="resource-type" content="' . $hmd_options['hmd_resource'] . $close_tag; |
| 158 |
if (isset($hmd_options['hmd_revisit']) && $hmd_options['hmd_revisit'] !== '') $hmd_output .= "\t\t" .'<meta name="revisit-after" content="' . $hmd_options['hmd_revisit'] . $close_tag; |
| 159 |
if (isset($hmd_options['hmd_subject']) && $hmd_options['hmd_subject'] !== '') $hmd_output .= "\t\t" .'<meta name="subject" content="' . $hmd_options['hmd_subject'] . $close_tag; |
| 160 |
if (isset($hmd_options['hmd_template']) && $hmd_options['hmd_template'] !== '') $hmd_output .= "\t\t" .'<meta name="template" content="' . $hmd_options['hmd_template'] . $close_tag; |
| 161 |
if (isset($hmd_options['hmd_robots']) && $hmd_options['hmd_robots'] !== '') $hmd_output .= "\t\t" .'<meta name="robots" content="' . $hmd_options['hmd_robots'] . $close_tag; |
| 162 |
} |
| 163 |
|
| 164 |
$hmd_output .= hmd_display_custom(); |
| 165 |
|
| 166 |
return $hmd_output; |
| 167 |
|
| 168 |
} |
| 169 |
|
| 170 |
function hmd_custom_shortcode() { |
| 171 |
|
| 172 |
global $hmd_options; |
| 173 |
|
| 174 |
if ($hmd_options['hmd_custom'] !== '') { |
| 175 |
|
| 176 |
$get_custom_data = $hmd_options['hmd_custom']; |
| 177 |
|
| 178 |
$the_custom_data = "\t\t" . str_replace(array('>', '<'), array('>','<'), $get_custom_data); |
| 179 |
|
| 180 |
return $the_custom_data; |
| 181 |
|
| 182 |
} |
| 183 |
|
| 184 |
} |
| 185 |
add_shortcode('hmd_custom','hmd_custom_shortcode'); |
| 186 |
|
| 187 |
function hmd_custom_content() { |
| 188 |
|
| 189 |
global $hmd_options, $post; |
| 190 |
|
| 191 |
if (empty($post)) return; |
| 192 |
|
| 193 |
$post_id = $post->ID; |
| 194 |
$author_id = $post->post_author; |
| 195 |
|
| 196 |
$custom = isset($hmd_options['hmd_custom']) ? $hmd_options['hmd_custom'] : ''; |
| 197 |
|
| 198 |
$format = apply_filters('hmd_date_format', 'Y-m-d'); |
| 199 |
|
| 200 |
if (is_singular()) { |
| 201 |
|
| 202 |
$post_excerpt = get_the_excerpt($post_id); // fyi: https://bit.ly/30uneVr |
| 203 |
$post_date = get_the_modified_date($format); |
| 204 |
$post_author = get_the_author_meta('display_name', $author_id); |
| 205 |
$post_title = get_the_title($post_id); |
| 206 |
$post_cats = get_the_category($post_id); |
| 207 |
$post_tags = get_the_tags($post_id); |
| 208 |
|
| 209 |
} else { |
| 210 |
|
| 211 |
$post_excerpt = get_bloginfo('description'); |
| 212 |
$post_date = hmd_latest_post_date($format); |
| 213 |
$post_author = get_bloginfo('name'); |
| 214 |
$post_title = get_bloginfo('description'); |
| 215 |
$post_cats = get_the_terms($post_id, 'category'); |
| 216 |
$post_tags = get_the_terms($post_id, 'post_tag'); |
| 217 |
|
| 218 |
} |
| 219 |
|
| 220 |
if ($post_excerpt && !is_wp_error($post_excerpt)) { |
| 221 |
|
| 222 |
$length = apply_filters('hmd_excerpt_length', 160); |
| 223 |
$post_excerpt = wp_strip_all_tags($post_excerpt, true); |
| 224 |
$post_excerpt = substr($post_excerpt, 0, $length); |
| 225 |
|
| 226 |
} else { |
| 227 |
|
| 228 |
$post_excerpt = get_bloginfo('description'); |
| 229 |
|
| 230 |
} |
| 231 |
|
| 232 |
if ($post_cats && !is_wp_error($post_cats)) { |
| 233 |
|
| 234 |
$names = wp_list_pluck($post_cats, 'name'); |
| 235 |
$post_cats = implode(', ', $names); |
| 236 |
|
| 237 |
} else { |
| 238 |
|
| 239 |
$post_cats = get_bloginfo('name'); |
| 240 |
|
| 241 |
} |
| 242 |
|
| 243 |
if ($post_tags && !is_wp_error($post_tags)) { |
| 244 |
|
| 245 |
$names = wp_list_pluck($post_tags, 'name'); |
| 246 |
$post_tags = implode(', ', $names); |
| 247 |
|
| 248 |
} else { |
| 249 |
|
| 250 |
$post_tags = get_bloginfo('name'); |
| 251 |
|
| 252 |
} |
| 253 |
|
| 254 |
$patterns = array(); |
| 255 |
$patterns[0] = "/\[hmd_tab\]/"; |
| 256 |
$patterns[1] = "/\[hmd_post_excerpt\]/"; |
| 257 |
$patterns[2] = "/\[hmd_post_date\]/"; |
| 258 |
$patterns[3] = "/\[hmd_post_author\]/"; |
| 259 |
$patterns[4] = "/\[hmd_post_title\]/"; |
| 260 |
$patterns[5] = "/\[hmd_post_cats\]/"; |
| 261 |
$patterns[6] = "/\[hmd_post_tags\]/"; |
| 262 |
$patterns[7] = "/\[hmd_year\]/"; |
| 263 |
|
| 264 |
$replacements = array(); |
| 265 |
$replacements[0] = "\t"; |
| 266 |
$replacements[1] = $post_excerpt; |
| 267 |
$replacements[2] = $post_date; |
| 268 |
$replacements[3] = $post_author; |
| 269 |
$replacements[4] = $post_title; |
| 270 |
$replacements[5] = $post_cats; |
| 271 |
$replacements[6] = $post_tags; |
| 272 |
$replacements[7] = date('Y'); |
| 273 |
|
| 274 |
$custom = preg_replace($patterns, $replacements, $custom); |
| 275 |
|
| 276 |
echo "\t\t" . $custom . "\n"; |
| 277 |
|
| 278 |
} |
| 279 |
add_action('wp_head', 'hmd_custom_content'); |
| 280 |
|
| 281 |
function hmd_latest_post_date($format) { |
| 282 |
|
| 283 |
$args = array( |
| 284 |
'posts_per_page' => 1, |
| 285 |
'orderby' => 'date', |
| 286 |
'post_status' => 'publish', |
| 287 |
); |
| 288 |
$posts = get_posts($args); |
| 289 |
|
| 290 |
$updated = ''; |
| 291 |
|
| 292 |
foreach ($posts as $post) { |
| 293 |
|
| 294 |
setup_postdata($post); |
| 295 |
|
| 296 |
$updated = get_the_modified_date($format); |
| 297 |
|
| 298 |
} |
| 299 |
|
| 300 |
wp_reset_postdata(); |
| 301 |
|
| 302 |
return $updated; |
| 303 |
|
| 304 |
} |
| 305 |
|
| 306 |
function hmd_plugin_action_links($links, $file) { |
| 307 |
global $hmd_path; |
| 308 |
if ($file == $hmd_path && (current_user_can('manage_options'))) { |
| 309 |
$hmd_links = '<a href="' . get_admin_url() . 'options-general.php?page=' . $hmd_path . '">' . esc_html__('Settings', 'head-meta-data') .'</a>'; |
| 310 |
array_unshift($links, $hmd_links); |
| 311 |
} |
| 312 |
return $links; |
| 313 |
} |
| 314 |
add_filter ('plugin_action_links', 'hmd_plugin_action_links', 10, 2); |
| 315 |
|
| 316 |
function add_hmd_links($links, $file) { |
| 317 |
if ($file == plugin_basename(__FILE__)) { |
| 318 |
|
| 319 |
$home_href = 'https://perishablepress.com/head-metadata-plus/'; |
| 320 |
$home_title = esc_attr__('Plugin Homepage', 'head-meta-data'); |
| 321 |
$home_text = esc_html__('Homepage', 'head-meta-data'); |
| 322 |
|
| 323 |
$links[] = '<a target="_blank" rel="noopener noreferrer" href="'. $home_href .'" title="'. $home_title .'">'. $home_text .'</a>'; |
| 324 |
|
| 325 |
$href = 'https://wordpress.org/support/plugin/head-meta-data/reviews/?rate=5#new-post'; |
| 326 |
$title = esc_html__('Give us a 5-star rating at WordPress.org', 'head-meta-data'); |
| 327 |
$text = esc_html__('Rate this plugin', 'head-meta-data') .' »'; |
| 328 |
|
| 329 |
$links[] = '<a target="_blank" rel="noopener noreferrer" href="'. $href .'" title="'. $title .'">'. $text .'</a>'; |
| 330 |
|
| 331 |
} |
| 332 |
return $links; |
| 333 |
} |
| 334 |
add_filter('plugin_row_meta', 'add_hmd_links', 10, 2); |
| 335 |
|
| 336 |
function hmd_delete_plugin_options() { |
| 337 |
delete_option('hmd_options'); |
| 338 |
} |
| 339 |
if (isset($hmd_options['default_options']) && $hmd_options['default_options'] == 1) { |
| 340 |
register_uninstall_hook (__FILE__, 'hmd_delete_plugin_options'); |
| 341 |
} |
| 342 |
|
| 343 |
function hmd_add_defaults() { |
| 344 |
// meta subject |
| 345 |
$args = array('orderby'=>'name', 'order'=>'ASC'); |
| 346 |
$categories = get_categories($args); |
| 347 |
$num_cats = count($categories); |
| 348 |
$subjects = ''; |
| 349 |
$i = 0; |
| 350 |
foreach ($categories as $category) { |
| 351 |
$subjects .= $category->name; |
| 352 |
if (++$i !== $num_cats) { |
| 353 |
$subjects .= ', '; |
| 354 |
} |
| 355 |
} |
| 356 |
// name, description, language |
| 357 |
$site_name = get_bloginfo('name'); |
| 358 |
$site_desc = get_bloginfo('description'); |
| 359 |
$site_lang = get_bloginfo('language'); |
| 360 |
// template and designer |
| 361 |
$get_theme = wp_get_theme(); |
| 362 |
$the_theme = $get_theme->Name; |
| 363 |
$designer = $get_theme->display('Author', FALSE);; |
| 364 |
// author name |
| 365 |
$user_info = get_userdata(1); |
| 366 |
if ($user_info == true) { |
| 367 |
$admin_name = $user_info->user_login; |
| 368 |
} else { |
| 369 |
$admin_name = 'Perishable'; |
| 370 |
} |
| 371 |
$tmp = get_option('hmd_options'); |
| 372 |
|
| 373 |
if ((isset($tmp['default_options']) && $tmp['default_options'] == '1') || (!is_array($tmp))) { |
| 374 |
$arr = array( |
| 375 |
'default_options' => 0, |
| 376 |
'hmd_charset' => 'utf-8', |
| 377 |
'hmd_abstract' => $site_desc, |
| 378 |
'hmd_author' => $admin_name, |
| 379 |
'hmd_classify' => $subjects, |
| 380 |
'hmd_copyright' => 'Copyright ' . $site_name . ' - All rights Reserved.', |
| 381 |
'hmd_designer' => $designer, |
| 382 |
'hmd_distribute' => 'Global', |
| 383 |
'hmd_language' => $site_lang, |
| 384 |
'hmd_publisher' => $site_name, |
| 385 |
'hmd_rating' => 'General', |
| 386 |
'hmd_resource' => 'Document', |
| 387 |
'hmd_revisit' => '3', |
| 388 |
'hmd_subject' => $subjects, |
| 389 |
'hmd_template' => $the_theme, |
| 390 |
'hmd_enable' => 1, |
| 391 |
'hmd_custom' => '<meta name="example" content="custom: [hmd_post_date]">', |
| 392 |
'hmd_format' => 1, |
| 393 |
'hmd_robots' => 'index,follow', |
| 394 |
); |
| 395 |
update_option('hmd_options', $arr); |
| 396 |
} |
| 397 |
} |
| 398 |
register_activation_hook (__FILE__, 'hmd_add_defaults'); |
| 399 |
|
| 400 |
function hmd_init() { |
| 401 |
register_setting('hmd_plugin_options', 'hmd_options', 'hmd_validate_options'); |
| 402 |
} |
| 403 |
add_action ('admin_init', 'hmd_init'); |
| 404 |
|
| 405 |
function hmd_validate_options($input) { |
| 406 |
|
| 407 |
if (!isset($input['default_options'])) $input['default_options'] = null; |
| 408 |
$input['default_options'] = ($input['default_options'] == 1 ? 1 : 0); |
| 409 |
|
| 410 |
$input['hmd_charset'] = esc_attr($input['hmd_charset']); |
| 411 |
$input['hmd_abstract'] = esc_attr($input['hmd_abstract']); |
| 412 |
$input['hmd_author'] = esc_attr($input['hmd_author']); |
| 413 |
$input['hmd_classify'] = esc_attr($input['hmd_classify']); |
| 414 |
$input['hmd_copyright'] = esc_attr($input['hmd_copyright']); |
| 415 |
$input['hmd_designer'] = esc_attr($input['hmd_designer']); |
| 416 |
$input['hmd_distribute'] = esc_attr($input['hmd_distribute']); |
| 417 |
$input['hmd_language'] = esc_attr($input['hmd_language']); |
| 418 |
$input['hmd_publisher'] = esc_attr($input['hmd_publisher']); |
| 419 |
$input['hmd_rating'] = esc_attr($input['hmd_rating']); |
| 420 |
$input['hmd_resource'] = esc_attr($input['hmd_resource']); |
| 421 |
$input['hmd_revisit'] = esc_attr($input['hmd_revisit']); |
| 422 |
$input['hmd_subject'] = esc_attr($input['hmd_subject']); |
| 423 |
$input['hmd_template'] = esc_attr($input['hmd_template']); |
| 424 |
$input['hmd_robots'] = esc_attr($input['hmd_robots']); |
| 425 |
|
| 426 |
if (!isset($input['hmd_enable'])) $input['hmd_enable'] = null; |
| 427 |
$input['hmd_enable'] = ($input['hmd_enable'] == 1 ? 1 : 0); |
| 428 |
|
| 429 |
// dealing with kses |
| 430 |
global $allowedposttags; |
| 431 |
$allowed_atts = array( |
| 432 |
'align'=>array(), 'class'=>array(), 'id'=>array(), 'dir'=>array(), 'lang'=>array(), 'style'=>array(), 'label'=>array(), 'url'=>array(), |
| 433 |
'xml:lang'=>array(), 'src'=>array(), 'alt'=>array(), 'name'=>array(), 'content'=>array(), 'http-equiv'=>array(), 'profile'=>array(), |
| 434 |
'href'=>array(), 'property'=>array(), 'title'=>array(), 'rel'=>array(), 'type'=>array(), 'charset'=>array(), 'media'=>array(), 'rev'=>array(), |
| 435 |
); |
| 436 |
$allowedposttags['strong'] = $allowed_atts; |
| 437 |
$allowedposttags['script'] = $allowed_atts; |
| 438 |
$allowedposttags['style'] = $allowed_atts; |
| 439 |
$allowedposttags['small'] = $allowed_atts; |
| 440 |
$allowedposttags['span'] = $allowed_atts; |
| 441 |
$allowedposttags['meta'] = $allowed_atts; |
| 442 |
$allowedposttags['item'] = $allowed_atts; |
| 443 |
$allowedposttags['base'] = $allowed_atts; |
| 444 |
$allowedposttags['link'] = $allowed_atts; |
| 445 |
$allowedposttags['abbr'] = $allowed_atts; |
| 446 |
$allowedposttags['code'] = $allowed_atts; |
| 447 |
$allowedposttags['div'] = $allowed_atts; |
| 448 |
$allowedposttags['img'] = $allowed_atts; |
| 449 |
$allowedposttags['h1'] = $allowed_atts; |
| 450 |
$allowedposttags['h2'] = $allowed_atts; |
| 451 |
$allowedposttags['h3'] = $allowed_atts; |
| 452 |
$allowedposttags['h4'] = $allowed_atts; |
| 453 |
$allowedposttags['h5'] = $allowed_atts; |
| 454 |
$allowedposttags['ol'] = $allowed_atts; |
| 455 |
$allowedposttags['ul'] = $allowed_atts; |
| 456 |
$allowedposttags['li'] = $allowed_atts; |
| 457 |
$allowedposttags['em'] = $allowed_atts; |
| 458 |
$allowedposttags['p'] = $allowed_atts; |
| 459 |
$allowedposttags['a'] = $allowed_atts; |
| 460 |
|
| 461 |
$input['hmd_custom'] = wp_kses($input['hmd_custom'], $allowedposttags); |
| 462 |
|
| 463 |
if (!isset($input['hmd_format'])) $input['hmd_format'] = null; |
| 464 |
$input['hmd_format'] = ($input['hmd_format'] == 1 ? 1 : 0); |
| 465 |
|
| 466 |
return $input; |
| 467 |
} |
| 468 |
|
| 469 |
function hmd_add_options_page() { |
| 470 |
global $hmd_plugin; |
| 471 |
add_options_page($hmd_plugin, $hmd_plugin, 'manage_options', __FILE__, 'hmd_render_form'); |
| 472 |
} |
| 473 |
add_action ('admin_menu', 'hmd_add_options_page'); |
| 474 |
|
| 475 |
function hmd_render_form() { |
| 476 |
global $hmd_plugin, $hmd_options, $hmd_path, $hmd_homeurl, $hmd_version; ?> |
| 477 |
|
| 478 |
<style type="text/css"> |
| 479 |
#mm-plugin-options .mm-panel-overview { |
| 480 |
padding: 0 15px 15px 140px; |
| 481 |
background-image: url(<?php echo plugins_url(); ?>/head-meta-data/hmd-logo.jpg); |
| 482 |
background-repeat: no-repeat; background-position: 15px 0; background-size: 120px 88px; |
| 483 |
} |
| 484 |
#mm-plugin-options .mm-panel-toggle { margin: 5px 0; } |
| 485 |
#mm-plugin-options .mm-credit-info { margin: -10px 0 10px 5px; font-size: 12px; } |
| 486 |
#mm-plugin-options .button-primary { margin: 0 0 15px 15px; } |
| 487 |
|
| 488 |
#mm-plugin-options #setting-error-settings_updated { margin: 5px 0 15px 0; } |
| 489 |
#mm-plugin-options #setting-error-settings_updated p { margin: 7px 0 6px 0; } |
| 490 |
|
| 491 |
#mm-plugin-options .mm-table-wrap { margin: 15px; } |
| 492 |
#mm-plugin-options .mm-table-wrap td { padding: 5px 10px; vertical-align: middle; } |
| 493 |
#mm-plugin-options .mm-table-wrap .mm-table { padding: 10px 0; } |
| 494 |
#mm-plugin-options .mm-table-wrap .widefat th { padding: 10px 15px; vertical-align: middle; } |
| 495 |
#mm-plugin-options .mm-table-wrap .widefat td { padding: 10px; vertical-align: middle; } |
| 496 |
|
| 497 |
#mm-plugin-options h1 small { line-height: 12px; font-size: 12px; color: #bbb; } |
| 498 |
#mm-plugin-options h2 { margin: 0; padding: 12px 0 12px 15px; font-size: 16px; cursor: pointer; } |
| 499 |
#mm-plugin-options h3 { margin: 20px 15px; font-size: 14px; } |
| 500 |
#mm-plugin-options p { margin-left: 15px; } |
| 501 |
#mm-plugin-options ul { margin: 15px 15px 20px 40px; line-height: 16px; } |
| 502 |
#mm-plugin-options li { margin: 8px 0; list-style-type: disc; } |
| 503 |
|
| 504 |
#mm-plugin-options textarea { width: 80%; } |
| 505 |
#mm-plugin-options input[type=text] { width: 60%; } |
| 506 |
#mm-plugin-options input[type=checkbox] { margin-top: -3px; } |
| 507 |
#mm-plugin-options .mm-radio-inputs { margin: 5px 0; } |
| 508 |
#mm-plugin-options .mm-code { |
| 509 |
display: inline-block; margin: 0 1px; padding: 3px; direction: ltr; unicode-bidi: embed; |
| 510 |
color: #333; background-color: #eaeaea; background-color: rgba(0,0,0,0.07); |
| 511 |
font-size: 13px; font-family: Consolas, Monaco, monospace; |
| 512 |
} |
| 513 |
#mm-plugin-options .mm-item-caption { margin: 3px 0 0 3px; line-height: 17px; font-size: 12px; color: #777; } |
| 514 |
#mm-plugin-options .mm-item-caption code { margin: 0; padding: 3px; font-size: 12px; background: #f2f2f2; background-color: rgba(0,0,0,0.05); } |
| 515 |
#mm-plugin-options .mm-item-caption-nomargin { margin: 0; } |
| 516 |
#mm-plugin-options textarea + .mm-item-caption { margin: 0 0 0 3px; } |
| 517 |
|
| 518 |
#mm-plugin-options .mm-code-example { margin: 10px 0 20px 0; } |
| 519 |
#mm-plugin-options .mm-code-example div { margin-left: 15px; } |
| 520 |
#mm-plugin-options .mm-code-example pre { |
| 521 |
box-sizing: border-box; width: 90%; overflow: auto; margin: 10px 20px; padding: 10px; |
| 522 |
border: 1px solid #efefef; background-color: #fffeee; |
| 523 |
} |
| 524 |
|
| 525 |
@media (max-width: 1000px) { |
| 526 |
#mm-plugin-options input[type=text] { width: 80%; } |
| 527 |
#mm-plugin-options textarea { width: 90%; } |
| 528 |
} |
| 529 |
@media (max-width: 782px) { |
| 530 |
#mm-plugin-options .mm-radio-inputs { margin: 10px 0; } |
| 531 |
} |
| 532 |
@media (max-width: 600px) { |
| 533 |
#mm-plugin-options input[type=text], |
| 534 |
#mm-plugin-options textarea { width: 98%; } |
| 535 |
} |
| 536 |
</style> |
| 537 |
|
| 538 |
<div id="mm-plugin-options" class="wrap"> |
| 539 |
<h1><?php echo $hmd_plugin; ?> <small><?php echo 'v' . $hmd_version; ?></small></h1> |
| 540 |
<div class="mm-panel-toggle"><a href="<?php get_admin_url() . 'options-general.php?page=' . $hmd_path; ?>"><?php esc_html_e('Toggle all panels', 'head-meta-data'); ?></a></div> |
| 541 |
|
| 542 |
<form method="post" action="options.php"> |
| 543 |
<?php $hmd_options = get_option('hmd_options'); settings_fields('hmd_plugin_options'); ?> |
| 544 |
|
| 545 |
<div class="metabox-holder"> |
| 546 |
<div class="meta-box-sortables ui-sortable"> |
| 547 |
|
| 548 |
<div id="mm-panel-overview" class="postbox"> |
| 549 |
<h2><?php esc_html_e('Overview', 'head-meta-data'); ?></h2> |
| 550 |
<div class="toggle<?php if (isset($_GET["settings-updated"])) { echo ' default-hidden'; } ?>"> |
| 551 |
<div class="mm-panel-overview"> |
| 552 |
<p> |
| 553 |
<strong><?php echo $hmd_plugin; ?></strong> <?php esc_html_e('(HMD) adds a custom set of', 'head-meta-data'); ?> |
| 554 |
<code><meta></code> <?php esc_html_e('tags to the', 'head-meta-data'); ?> |
| 555 |
<code><head></code> <?php esc_html_e('section of all posts and pages.', 'head-meta-data'); ?> |
| 556 |
</p> |
| 557 |
<ul> |
| 558 |
<li><a id="mm-panel-primary-link" href="#mm-panel-primary"><?php esc_html_e('Plugin Settings', 'head-meta-data'); ?></a></li> |
| 559 |
<li><a id="mm-panel-secondary-link" href="#mm-panel-secondary"><?php esc_html_e('Live Preview', 'head-meta-data'); ?></a></li> |
| 560 |
<li><a target="_blank" rel="noopener noreferrer" href="https://wordpress.org/plugins/head-meta-data/"><?php esc_html_e('Plugin Homepage', 'head-meta-data'); ?></a></li> |
| 561 |
</ul> |
| 562 |
<p> |
| 563 |
<?php esc_html_e('If you like this plugin, please', 'head-meta-data'); ?> |
| 564 |
<a target="_blank" rel="noopener noreferrer" href="https://wordpress.org/support/plugin/head-meta-data/reviews/?rate=5#new-post" title="<?php esc_attr_e('THANK YOU for your support!', 'head-meta-data'); ?>"><?php esc_html_e('give it a 5-star rating', 'head-meta-data'); ?> »</a> |
| 565 |
</p> |
| 566 |
</div> |
| 567 |
</div> |
| 568 |
</div> |
| 569 |
|
| 570 |
<div id="mm-panel-primary" class="postbox"> |
| 571 |
<h2><?php esc_html_e('Plugin Settings', 'head-meta-data'); ?></h2> |
| 572 |
<div class="toggle<?php if (!isset($_GET["settings-updated"])) { echo ' default-hidden'; } ?>"> |
| 573 |
<h3><?php esc_html_e('Meta Tags', 'head-meta-data'); ?></h3> |
| 574 |
<p> |
| 575 |
<?php esc_html_e('Here you may define your', 'head-meta-data'); ?> <code><meta></code> <?php esc_html_e('tags. To disable any tag, leave it blank.', 'head-meta-data'); ?> |
| 576 |
<?php esc_html_e('To add more tags, visit the option “Custom Content” below.', 'head-meta-data'); ?> |
| 577 |
</p> |
| 578 |
<div class="mm-table-wrap"> |
| 579 |
<table class="widefat mm-table"> |
| 580 |
<tr> |
| 581 |
<th scope="row"><label for="hmd_options[hmd_enable]"><?php esc_html_e('Enable tags', 'head-meta-data'); ?></label></th> |
| 582 |
<td><input type="checkbox" name="hmd_options[hmd_enable]" value="1" <?php if (isset($hmd_options['hmd_enable'])) checked('1', $hmd_options['hmd_enable']); ?>> |
| 583 |
<span><?php esc_html_e('Enable meta tags', 'head-meta-data'); ?></span></td> |
| 584 |
</tr> |
| 585 |
<tr> |
| 586 |
<th scope="row"><label for="hmd_options[hmd_format]"><?php esc_html_e('HTML format', 'head-meta-data'); ?></label></th> |
| 587 |
<td><input type="checkbox" name="hmd_options[hmd_format]" value="1" <?php if (isset($hmd_options['hmd_format'])) checked('1', $hmd_options['hmd_format']); ?>> |
| 588 |
<span><?php esc_html_e('Check box for HTML format (default), or leave unchecked for XHTML format', 'head-meta-data'); ?></span></td> |
| 589 |
</tr> |
| 590 |
<tr> |
| 591 |
<th scope="row"><label for="hmd_options[hmd_charset]"><?php esc_html_e('Meta Charset', 'head-meta-data'); ?></label></th> |
| 592 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_charset]" value="<?php if (isset($hmd_options['hmd_charset'])) echo esc_attr($hmd_options['hmd_charset']); ?>"> |
| 593 |
<div class="mm-item-caption"><?php esc_html_e('Specify the character encoding for your web pages (default: utf-8)', 'head-meta-data'); ?></div></td> |
| 594 |
</tr> |
| 595 |
<tr> |
| 596 |
<th scope="row"><label for="hmd_options[hmd_abstract]"><?php esc_html_e('Meta abstract', 'head-meta-data'); ?></label></th> |
| 597 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_abstract]" value="<?php if (isset($hmd_options['hmd_abstract'])) echo esc_attr($hmd_options['hmd_abstract']); ?>"> |
| 598 |
<div class="mm-item-caption"><?php esc_html_e('Summarize your site’s content in a short sentence', 'head-meta-data'); ?></div></td> |
| 599 |
</tr> |
| 600 |
<tr> |
| 601 |
<th scope="row"><label for="hmd_options[hmd_author]"><?php esc_html_e('Meta author', 'head-meta-data'); ?></label></th> |
| 602 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_author]" value="<?php if (isset($hmd_options['hmd_author'])) echo esc_attr($hmd_options['hmd_author']); ?>"> |
| 603 |
<div class="mm-item-caption"><?php esc_html_e('Indicate your site’s author(s)', 'head-meta-data'); ?></div></td> |
| 604 |
</tr> |
| 605 |
<tr> |
| 606 |
<th scope="row"><label for="hmd_options[hmd_classify]"><?php esc_html_e('Meta classification', 'head-meta-data'); ?></label></th> |
| 607 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_classify]" value="<?php if (isset($hmd_options['hmd_classify'])) echo esc_attr($hmd_options['hmd_classify']); ?>"> |
| 608 |
<div class="mm-item-caption"><?php esc_html_e('Classify your site, examples: Shopping, Movies, Food', 'head-meta-data'); ?></div></td> |
| 609 |
</tr> |
| 610 |
<tr> |
| 611 |
<th scope="row"><label for="hmd_options[hmd_copyright]"><?php esc_html_e('Meta copyright', 'head-meta-data'); ?></label></th> |
| 612 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_copyright]" value="<?php if (isset($hmd_options['hmd_copyright'])) echo esc_attr($hmd_options['hmd_copyright']); ?>"> |
| 613 |
<div class="mm-item-caption"><?php esc_html_e('Indicate your site’s copyright information', 'head-meta-data'); ?></div></td> |
| 614 |
</tr> |
| 615 |
<tr> |
| 616 |
<th scope="row"><label for="hmd_options[hmd_designer]"><?php esc_html_e('Meta designer', 'head-meta-data'); ?></label></th> |
| 617 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_designer]" value="<?php if (isset($hmd_options['hmd_designer'])) echo esc_attr($hmd_options['hmd_designer']); ?>"> |
| 618 |
<div class="mm-item-caption"><?php esc_html_e('Indicate your site’s designer/developer', 'head-meta-data'); ?></div></td> |
| 619 |
</tr> |
| 620 |
<tr> |
| 621 |
<th scope="row"><label for="hmd_options[hmd_distribute]"><?php esc_html_e('Meta distribution', 'head-meta-data'); ?></label></th> |
| 622 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_distribute]" value="<?php if (isset($hmd_options['hmd_distribute'])) echo esc_attr($hmd_options['hmd_distribute']); ?>"> |
| 623 |
<div class="mm-item-caption"><?php esc_html_e('Indicate your site’s distribution level, examples: Global, Regional, Local', 'head-meta-data'); ?></div></td> |
| 624 |
</tr> |
| 625 |
<tr> |
| 626 |
<th scope="row"><label for="hmd_options[hmd_language]"><?php esc_html_e('Meta language', 'head-meta-data'); ?></label></th> |
| 627 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_language]" value="<?php if (isset($hmd_options['hmd_language'])) echo esc_attr($hmd_options['hmd_language']); ?>"> |
| 628 |
<div class="mm-item-caption"><?php esc_html_e('Indicate your site’s primary language, examples: EN-US, EN, FR', 'head-meta-data'); ?></div></td> |
| 629 |
</tr> |
| 630 |
<tr> |
| 631 |
<th scope="row"><label for="hmd_options[hmd_publisher]"><?php esc_html_e('Meta publisher', 'head-meta-data'); ?></label></th> |
| 632 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_publisher]" value="<?php if (isset($hmd_options['hmd_publisher'])) echo esc_attr($hmd_options['hmd_publisher']); ?>"> |
| 633 |
<div class="mm-item-caption"><?php esc_html_e('Indicate your site’s publisher', 'head-meta-data'); ?></div></td> |
| 634 |
</tr> |
| 635 |
<tr> |
| 636 |
<th scope="row"><label for="hmd_options[hmd_rating]"><?php esc_html_e('Meta rating', 'head-meta-data'); ?></label></th> |
| 637 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_rating]" value="<?php if (isset($hmd_options['hmd_rating'])) echo esc_attr($hmd_options['hmd_rating']); ?>"> |
| 638 |
<div class="mm-item-caption"><?php esc_html_e('Indicate the rating of your site’s content, examples: General, Mature, Restricted', 'head-meta-data'); ?></div></td> |
| 639 |
</tr> |
| 640 |
<tr> |
| 641 |
<th scope="row"><label for="hmd_options[hmd_resource]"><?php esc_html_e('Meta resource-type', 'head-meta-data'); ?></label></th> |
| 642 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_resource]" value="<?php if (isset($hmd_options['hmd_resource'])) echo esc_attr($hmd_options['hmd_resource']); ?>"> |
| 643 |
<div class="mm-item-caption"><?php esc_html_e('Indicate your site’s primary resource type, examples: Document', 'head-meta-data'); ?></div></td> |
| 644 |
</tr> |
| 645 |
<tr> |
| 646 |
<th scope="row"><label for="hmd_options[hmd_revisit]"><?php esc_html_e('Meta revisit-after', 'head-meta-data'); ?></label></th> |
| 647 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_revisit]" value="<?php if (isset($hmd_options['hmd_revisit'])) echo esc_attr($hmd_options['hmd_revisit']); ?>"> |
| 648 |
<div class="mm-item-caption"><?php esc_html_e('Frequency (in days) for search engines to revisit your site for re-indexing, examples: 1, 2, 3', 'head-meta-data'); ?></div></td> |
| 649 |
</tr> |
| 650 |
<tr> |
| 651 |
<th scope="row"><label for="hmd_options[hmd_subject]"><?php esc_html_e('Meta subject', 'head-meta-data'); ?></label></th> |
| 652 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_subject]" value="<?php if (isset($hmd_options['hmd_subject'])) echo esc_attr($hmd_options['hmd_subject']); ?>"> |
| 653 |
<div class="mm-item-caption"><?php esc_html_e('Indicate your site’s primary subject(s), examples: Photography, Sports, Pancakes', 'head-meta-data'); ?></div></td> |
| 654 |
</tr> |
| 655 |
<tr> |
| 656 |
<th scope="row"><label for="hmd_options[hmd_template]"><?php esc_html_e('Meta template', 'head-meta-data'); ?></label></th> |
| 657 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_template]" value="<?php if (isset($hmd_options['hmd_template'])) echo esc_attr($hmd_options['hmd_template']); ?>"> |
| 658 |
<div class="mm-item-caption"><?php esc_html_e('Indicate any template used by your site, example: Awesome WordPress Theme', 'head-meta-data'); ?></div></td> |
| 659 |
</tr> |
| 660 |
<tr> |
| 661 |
<th scope="row"><label for="hmd_options[hmd_robots]"><?php esc_html_e('Meta Robots', 'head-meta-data'); ?></label></th> |
| 662 |
<td><input type="text" size="50" maxlength="200" name="hmd_options[hmd_robots]" value="<?php if (isset($hmd_options['hmd_robots'])) echo esc_attr($hmd_options['hmd_robots']); ?>"> |
| 663 |
<div class="mm-item-caption"><?php esc_html_e('Indicate any robots directives for your site, example: index,follow', 'head-meta-data'); ?></div></td> |
| 664 |
</tr> |
| 665 |
<tr> |
| 666 |
<th scope="row"><label><?php esc_html_e('More tags', 'head-meta-data'); ?></label></th> |
| 667 |
<td> |
| 668 |
<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/support/#contact" title="<?php esc_html_e('Contact the developer via contact form', 'head-meta-data'); ?>"> |
| 669 |
<?php esc_html_e('Suggest more meta tags', 'head-meta-data'); ?> »</a> |
| 670 |
</td> |
| 671 |
</tr> |
| 672 |
</table> |
| 673 |
</div> |
| 674 |
<h3><?php esc_html_e('Custom Content', 'head-meta-data'); ?></h3> |
| 675 |
<p> |
| 676 |
<?php esc_html_e('Here you may define any custom content that should be included in the head section of your pages. You also can add custom tags to specific posts and pages. Check the', 'head-meta-data'); ?> |
| 677 |
<a target="_blank" rel="noopener noreferrer" href="https://wordpress.org/plugins/head-meta-data/#installation"><?php esc_html_e('Installation docs', 'head-meta-data'); ?></a> <?php esc_html_e('(under “Custom meta tags”) for more details.', 'head-meta-data'); ?> |
| 678 |
</p> |
| 679 |
<p> |
| 680 |
<?php esc_html_e('In the next setting, you can include any of the following shortcodes to display dynamic information:', 'head-meta-data'); ?> |
| 681 |
<span class="mm-code">[hmd_post_excerpt]</span>, <span class="mm-code">[hmd_post_date]</span>, <span class="mm-code">[hmd_post_author]</span>, <span class="mm-code">[hmd_post_title]</span>, |
| 682 |
<span class="mm-code">[hmd_post_cats]</span>, <span class="mm-code">[hmd_post_tags]</span>, <span class="mm-code">[hmd_year]</span>, <span class="mm-code">[hmd_tab]</span> = tab/space. |
| 683 |
</p> |
| 684 |
<div class="mm-table-wrap"> |
| 685 |
<table class="widefat mm-table"> |
| 686 |
<tr> |
| 687 |
<th scope="row"><label for="hmd_options[hmd_custom]"><?php esc_html_e('Custom content', 'head-meta-data'); ?></label></th> |
| 688 |
<td> |
| 689 |
<textarea class="large-text code" type="textarea" rows="7" cols="55" name="hmd_options[hmd_custom]"><?php if (isset($hmd_options['hmd_custom'])) echo esc_textarea($hmd_options['hmd_custom']); ?></textarea> |
| 690 |
<div class="mm-item-caption"> |
| 691 |
<?php esc_html_e('Optional tags/markup for the', 'head-meta-data'); ?> <code><head></code> |
| 692 |
<?php esc_html_e('section (leave blank to disable). For more ideas, check out', 'head-meta-data'); ?> |
| 693 |
<a target="_blank" rel="noopener noreferrer" href="https://perishablepress.com/xhtml-document-header-resource/"><?php esc_html_e('this article at Perishable Press', 'head-meta-data'); ?> »</a> |
| 694 |
</div> |
| 695 |
</td> |
| 696 |
</tr> |
| 697 |
</table> |
| 698 |
</div> |
| 699 |
<input type="submit" class="button-primary" value="<?php esc_attr_e('Save Settings', 'head-meta-data'); ?>"> |
| 700 |
</div> |
| 701 |
</div> |
| 702 |
|
| 703 |
<div id="mm-panel-secondary" class="postbox"> |
| 704 |
<h2><?php esc_html_e('Live Preview', 'head-meta-data'); ?></h2> |
| 705 |
<div class="toggle default-hidden"> |
| 706 |
<p><?php esc_html_e('Here is a preview of your meta tags and custom content. Note that any special characters will be encoded in the actual page markup.', 'head-meta-data'); ?></p> |
| 707 |
<div class="mm-code-example"> |
| 708 |
|
| 709 |
<h3><?php esc_html_e('Meta tags', 'head-meta-data'); ?></h3> |
| 710 |
<p><?php esc_html_e('When meta tags are enabled, the following code will be added to the head section of your web pages.', 'head-meta-data'); ?></p> |
| 711 |
<pre><?php echo do_shortcode('[head_meta_data]', 'head-meta-data'); ?></pre> |
| 712 |
|
| 713 |
<h3><?php esc_html_e('Custom content', 'head-meta-data'); ?></h3> |
| 714 |
<p><?php esc_html_e('Visit your front-end pages to view any dynamic shortcode output.', 'head-meta-data'); ?></p> |
| 715 |
<pre><?php echo do_shortcode('[hmd_custom]', 'head-meta-data'); ?></pre> |
| 716 |
|
| 717 |
<h3><?php esc_html_e('More infos', 'head-meta-data'); ?></h3> |
| 718 |
<ul> |
| 719 |
<li> |
| 720 |
<?php esc_html_e('For more information on document headers:', 'head-meta-data'); ?> |
| 721 |
<a target="_blank" rel="noopener noreferrer" href="https://m0n.co/c" title="<?php esc_attr_e('XHTML Document Header Resource', 'head-meta-data'); ?>">https://m0n.co/c</a> |
| 722 |
</li> |
| 723 |
<li> |
| 724 |
<?php esc_html_e('And more specifically the section on meta tags:', 'head-meta-data'); ?> |
| 725 |
<a target="_blank" rel="noopener noreferrer" href="https://m0n.co/d" title="<?php esc_attr_e('XHTML Document Header Resource: meta tags', 'head-meta-data'); ?>">https://m0n.co/d</a> |
| 726 |
</li> |
| 727 |
</ul> |
| 728 |
</div> |
| 729 |
</div> |
| 730 |
</div> |
| 731 |
|
| 732 |
<div id="mm-restore-settings" class="postbox"> |
| 733 |
<h2><?php esc_html_e('Restore Defaults', 'head-meta-data'); ?></h2> |
| 734 |
<div class="toggle<?php if (!isset($_GET["settings-updated"])) { echo ' default-hidden'; } ?>"> |
| 735 |
<p> |
| 736 |
<input name="hmd_options[default_options]" type="checkbox" value="1" id="mm_restore_defaults" <?php if (isset($hmd_options['default_options'])) { checked('1', $hmd_options['default_options']); } ?>> |
| 737 |
<?php esc_html_e('Restore default options upon plugin deactivation/reactivation.', 'head-meta-data'); ?> |
| 738 |
</p> |
| 739 |
<p> |
| 740 |
<span class="mm-item-caption mm-item-caption-nomargin"> |
| 741 |
<strong><?php esc_html_e('Tip:', 'head-meta-data'); ?></strong> |
| 742 |
<?php esc_html_e('leave this option unchecked to remember your settings. Or, to go ahead and restore all default options, check the box, save your settings, and then deactivate/reactivate the plugin.', 'head-meta-data'); ?> |
| 743 |
</span> |
| 744 |
</p> |
| 745 |
<input type="submit" class="button-primary" value="<?php esc_attr_e('Save Settings', 'head-meta-data'); ?>"> |
| 746 |
</div> |
| 747 |
</div> |
| 748 |
|
| 749 |
<div id="mm-panel-current" class="postbox"> |
| 750 |
<h2><?php esc_html_e('Show Support', 'head-meta-data'); ?></h2> |
| 751 |
<div class="toggle"> |
| 752 |
<?php require_once('support-panel.php'); ?> |
| 753 |
</div> |
| 754 |
</div> |
| 755 |
|
| 756 |
</div> |
| 757 |
</div> |
| 758 |
|
| 759 |
<div class="mm-credit-info"> |
| 760 |
<a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url($hmd_homeurl); ?>" title="<?php esc_attr_e('Plugin Homepage', 'head-meta-data'); ?>"><?php echo esc_html($hmd_plugin); ?></a> <?php esc_html_e('by', 'head-meta-data'); ?> |
| 761 |
<a target="_blank" rel="noopener noreferrer" href="https://twitter.com/perishable" title="<?php esc_attr_e('Jeff Starr on Twitter', 'head-meta-data'); ?>">Jeff Starr</a> @ |
| 762 |
<a target="_blank" rel="noopener noreferrer" href="https://monzillamedia.com/" title="<?php esc_attr_e('Obsessive Web Design & Development', 'head-meta-data'); ?>">Monzilla Media</a> |
| 763 |
</div> |
| 764 |
|
| 765 |
</form> |
| 766 |
</div> |
| 767 |
|
| 768 |
<script type="text/javascript"> |
| 769 |
jQuery(document).ready(function(){ |
| 770 |
// toggle panels |
| 771 |
jQuery('.default-hidden').hide(); |
| 772 |
jQuery('.mm-panel-toggle a').click(function(){ |
| 773 |
jQuery('.toggle').slideToggle(300); |
| 774 |
return false; |
| 775 |
}); |
| 776 |
jQuery('h2').click(function(){ |
| 777 |
jQuery(this).next().slideToggle(300); |
| 778 |
}); |
| 779 |
jQuery('#mm-panel-primary-link').click(function(){ |
| 780 |
jQuery('.toggle').hide(); |
| 781 |
jQuery('#mm-panel-primary .toggle').slideToggle(300); |
| 782 |
return true; |
| 783 |
}); |
| 784 |
jQuery('#mm-panel-secondary-link').click(function(){ |
| 785 |
jQuery('.toggle').hide(); |
| 786 |
jQuery('#mm-panel-secondary .toggle').slideToggle(300); |
| 787 |
return true; |
| 788 |
}); |
| 789 |
// prevent accidents |
| 790 |
if(!jQuery("#mm_restore_defaults").is(":checked")){ |
| 791 |
jQuery('#mm_restore_defaults').click(function(event){ |
| 792 |
var r = confirm("<?php esc_html_e('Are you sure you want to restore all default options?', 'head-meta-data'); ?>"); |
| 793 |
if (r == true){ |
| 794 |
jQuery("#mm_restore_defaults").attr('checked', true); |
| 795 |
} else { |
| 796 |
jQuery("#mm_restore_defaults").attr('checked', false); |
| 797 |
} |
| 798 |
}); |
| 799 |
} |
| 800 |
}); |
| 801 |
</script> |
| 802 |
|
| 803 |
<?php } |
| 804 |
|