function wistia_wordpress_update_anti_mangler_default() { // This is required for `is_plugin_active`. include_once ABSPATH . 'wp-admin/includes/plugin.php'; // If wistia_wordpress_anti_mangler isn't defined on upgrade/install, let's // define it. If you're upgrading from an older version where the option // didn't exist, default it to ON so nothing changes. New installs, however, // should default to OFF. $wistia_wordpress_anti_mangler = get_wistia_wordpress_option('anti_mangler'); $plugin_already_activated = is_plugin_active(wistia_wordpress_plugin_file()); if (empty($wistia_wordpress_anti_mangler)) { if ($plugin_already_activated) { set_wistia_wordpress_option('anti_mangler', 'on'); } else { set_wistia_wordpress_option('anti_mangler', 'off'); } } // Record version in database for future upgrade path pivoting. $current_plugin_data = get_plugin_data(wistia_wordpress_plugin_file()); $current_wistia_wordpress_version = $current_plugin_data['Version']; set_wistia_wordpress_option('version', $current_wistia_wordpress_version); }
value='off'> Off </label> <?php } function wistia_wordpress_settings_section_callback() { echo __('<p>The Wistia WordPress plugin enables oEmbeds to work in WordPress.</p> <p>There is also some legacy functionality which allows raw HTML, which we recommend turning OFF. It\'s better to use oEmbed!</p>', 'wordpress'); } function wistia_wordpress_options_page() { ?> <form action='options.php' method='post'> <h2>Wistia WordPress</h2> <?php settings_fields('pluginPage'); do_settings_sections('pluginPage'); submit_button(); ?> </form> <?php } // Link to Settings page from the Plugins page next to Deactivate | Edit. $plugin = plugin_basename(wistia_wordpress_plugin_file()); function wistia_wordpress_add_settings_link($links) { $settings_link = '<a href="options-general.php?page=wistia_wordpress">' . __('Settings') . '</a>'; array_push($links, $settings_link); return $links; } add_filter("plugin_action_links_{$plugin}", 'wistia_wordpress_add_settings_link');