Changeset 2215006
- Timestamp:
- 12/19/2019 11:15:32 AM (6 years ago)
- Location:
- the-insertr
- Files:
-
- 4 added
- 1 deleted
- 1 edited
-
tags/1.3.0 (added)
-
tags/1.3.0/index.php (added)
-
tags/1.3.0/readme.txt (added)
-
tags/1.3.0/the-insertr.php (added)
-
trunk/templates (deleted)
-
trunk/the-insertr.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
the-insertr/trunk/the-insertr.php
r2211669 r2215006 6 6 * Description: Wordpress dynamic keyword insertion plugin. 7 7 * Author: Herdl 8 * Version: 1. 2.08 * Version: 1.3.0 9 9 * Author URI: https://herdl.com 10 10 */ … … 12 12 if (!defined('WPINC')) { 13 13 die('No direct access allowed'); 14 }15 16 function theinsertr_register_settings() {17 add_submenu_page('options-general.php', 'TheInsertr', 'TheInsertr', 'manage_options', 'theinsertr', 'theinsertr_settings');18 }19 20 function theinsertr_settings() {21 if (!current_user_can('administrator')) {22 echo '<p>Sorry, you are not allowed to access this page.</p>';23 return;24 }25 26 if (isset($_REQUEST['submit'])) {27 if (!isset($_REQUEST['theinsertr_nonce'])) {28 $errorMessage = 'nonce field is missing. Settings NOT saved.';29 } elseif (!wp_verify_nonce($_REQUEST['theinsertr_nonce'], 'theinsertr')) {30 $errorMessage = 'Invalid nonce specified. Settings NOT saved.';31 } else {32 update_option('theinsertr_acf_enable', isset($_REQUEST['theinsertr_acf_enable']) ? 'yes' : 'no');33 update_option('theinsertr_yoast_title_enable', isset($_REQUEST['theinsertr_yoast_title_enable']) ? 'yes' : 'no');34 35 $message = 'Settings Saved.';36 }37 }38 39 include_once(__DIR__ . '/templates/settings.php');40 }41 42 if (get_option('theinsertr_acf_enable') === 'yes') {43 add_filter('acf/format_value', 'my_acf_format_value');44 45 function my_acf_format_value($value, $post_id, $field) {46 if (!is_array($value)) {47 $value = do_shortcode($value);48 }49 50 return $value;51 }52 }53 54 if (get_option('theinsertr_yoast_title_enable') === 'yes') {55 add_filter('wpseo_title', 'my_wpseo_title');56 57 function my_wpseo_title($title) {58 return do_shortcode($title);59 }60 14 } 61 15 … … 78 32 } 79 33 80 add_action('admin_menu', 'theinsertr_register_settings');81 add_action('wp_footer', 'theinsertr_render_script');82 34 add_shortcode('insertr', 'insertr_function');
Note: See TracChangeset
for help on using the changeset viewer.