Changeset 3209746
- Timestamp:
- 12/18/2024 10:04:10 AM (14 months ago)
- Location:
- outbrain-feed/trunk
- Files:
-
- 6 edited
-
includes/Admin.php (modified) (2 diffs)
-
includes/DB.php (modified) (1 diff)
-
includes/Frontend.php (modified) (3 diffs)
-
outbrain-feed.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
uninstall.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
outbrain-feed/trunk/includes/Admin.php
r3209068 r3209746 9 9 public function add_admin_menu() { 10 10 add_menu_page( 11 esc_html__('Outbrain Feed Settings', 'outbrain-feed'), // Escaping the title12 esc_html__('Outbrain Feed','outbrain-feed'), // Escaping the menu title11 __('Outbrain Feed Settings', OBFEED_TEXT_DOMAIN), 12 __('Outbrain Feed', OBFEED_TEXT_DOMAIN), 13 13 'manage_options', 14 14 'outbrain-feed', … … 22 22 23 23 echo '<div class="wrap">'; 24 // Use esc_html__() for safe output 25 echo '<h1>' . esc_html__('Outbrain Feed Settings', 'outbrain-feed') . '</h1>'; 24 echo '<h1>' . __('Outbrain Feed Settings', OBFEED_TEXT_DOMAIN) . '</h1>'; 26 25 27 26 if ($mode === 'basic') { 28 // Use esc_html__() for safe output 29 echo '<p>' . esc_html__('Outbrain Feed plugin was successfully installed and set up. This means that the Outbrain default widget (identified by Widget-ID GS_1) will be automatically injected at the end of each article/post and will be applied to all platforms—desktop and mobile.', 'outbrain-feed') . '</p>'; 30 echo '<p>' . esc_html__('Note: A new version of this plugin is planned to be released by the end of 2024. The new version will support advanced capabilities, such as the setup of multiple ad insertion rules utilizing different Widget-IDs and the possibility to control the platform (desktop or mobile) to which the widget applies.', 'outbrain-feed') . '</p>'; 27 echo '<p>' . __('Outbrain Feed plugin was successfully installed and set up. This means that the Outbrain default widget (identified by Widget-ID GS_1) will be automatically injected at the end of each article/post and will be applied to all platforms—desktop and mobile.', OBFEED_TEXT_DOMAIN) . '</p>'; 28 echo '<p>' . __('Note: A new version of this plugin is planned to be released by the end of 2024. The new version will support advanced capabilities, such as the setup of multiple ad insertion rules utilizing different Widget-IDs and the possibility to control the platform (desktop or mobile) to which the widget applies.', OBFEED_TEXT_DOMAIN) . '</p>'; 31 29 } else { 32 // For static strings not requiring translation or dynamic data, directly escape the output.33 echo '<p> ' . esc_html__('Advanced options will be available in future updates.', 'outbrain-feed') . '</p>';30 // Placeholder for Advanced mode functionality 31 echo '<p>Advanced options will be available in future updates.</p>'; 34 32 } 35 33 -
outbrain-feed/trunk/includes/DB.php
r3209381 r3209746 27 27 dbDelta($sql); 28 28 29 $wpdb->insert( 30 $table_name, 31 array( 32 'widget_id' => 'GS_1', 33 'placement' => 'after_post', 34 'external_id' => 'ob-wordpress-plugin-v1-0' 35 ) 36 ); 29 // Insert default ad snippet 30 $wpdb->insert($table_name, [ 31 'widget_id' => 'GS_1', 32 'placement' => 'after_post', 33 'external_id' => 'ob-wordpress-plugin-v1-0' 34 ]); 37 35 38 36 // Save default mode in wp_options -
outbrain-feed/trunk/includes/Frontend.php
r3209381 r3209746 8 8 $this->db = new DB(); 9 9 add_filter('the_content', [$this, 'inject_ad_content']); 10 add_action('wp_enqueue_scripts', [$this, 'enqueue_outbrain_script']);11 10 } 12 11 … … 16 15 global $wpdb; 17 16 $table_name = $wpdb->prefix . 'obfeed_snippets'; 18 19 $snippet = $wpdb->get_row("SELECT * FROM `{$table_name}` LIMIT 1"); 17 $snippet = $wpdb->get_row("SELECT * FROM $table_name LIMIT 1"); 20 18 21 19 if ($snippet) { 22 $ad_code = '<div class="OUTBRAIN" data-widget-id="' . esc_attr($snippet->widget_id) . '" data-external-id="' . esc_attr($snippet->external_id) . '" data-src="' . esc_url(get_permalink()) . '"></div>'; 20 $ad_code = '<div class="OUTBRAIN" data-widget-id="' . esc_attr($snippet->widget_id) . '" data-external-id="' . esc_attr($snippet->external_id) . '" data-src="' . esc_url(get_permalink()) . '"></div> 21 <script type="text/javascript" async src="https://widgets.outbrain.com/outbrain.js"></script>'; 23 22 $content .= $ad_code; 24 23 } … … 26 25 return $content; 27 26 } 28 29 public function enqueue_outbrain_script() {30 if (is_single()) { // Only enqueue the script on single post pages31 wp_enqueue_script(32 'outbrain-widgets',33 'https://widgets.outbrain.com/outbrain.js',34 array(),35 time(), // Use the plugin version36 true37 );38 }39 }40 27 } -
outbrain-feed/trunk/outbrain-feed.php
r3209412 r3209746 4 4 * Plugin URI: https://developer.outbrain.com/outbrain-wordpress-implementation-guide/ 5 5 * Description: Dynamically inserts Outbrain feed widgets into articles, with flexible configuration. 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 * Author: Outbrain Dev Team 8 8 * Author URI: -
outbrain-feed/trunk/readme.txt
r3209412 r3209746 4 4 Requires at least: 6.1 5 5 Tested up to: 6.7 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 Requires PHP: 7.1 8 8 License: GPLv2 or later -
outbrain-feed/trunk/uninstall.php
r3209068 r3209746 5 5 6 6 // Remove plugin options and custom tables 7 delete_option('obfeed_settings');8 7 global $wpdb; 9 8 $table_name = $wpdb->prefix . 'obfeed_snippets'; … … 13 12 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange 14 13 $wpdb->query("DROP TABLE IF EXISTS `{$table_name}`"); 14 15 delete_option('obfeed_plugin_mode'); 16 delete_option('obfeed_plugin_status');
Note: See TracChangeset
for help on using the changeset viewer.