'; esc_html_e('Thank you for using the Admin Rss Feed plugin! Go to Plugin ', 'admin-dashboard-rss-feed'); echo '' . esc_html_e('Settings Page', 'admin-dashboard-rss-feed') . ''; echo '

'; ?>
' . __('Settings', 'admin-dashboard-rss-feed') . ''; return $wsx_rss_feed_link; } // Create custom plugin settings menu add_action('admin_menu', 'wsx_rss_feed_admin_page'); function wsx_rss_feed_admin_page() { // create new top-level menu add_options_page('Admin Dashboard RSS Feed Plugin Settings', 'Admin Dashboard RSS Feed', 'manage_options', 'wsx-rss-feed-settings', 'wsx_rss_feed_admin_settings_page'); // call register settings function add_action('admin_init', 'wsx_rss_feed_admin_settings'); } function wsx_rss_feed_styles() { wp_register_style('wsx-rss-styles', plugin_dir_url(__FILE__) . 'admin/css/style.css', array(), '3.5'); wp_enqueue_style('wsx-rss-styles'); // Enqueue WordPress media uploader wp_enqueue_media(); // Load script only on the desired admin page wp_enqueue_script( 'custom-admin-js', plugin_dir_url(__FILE__) . 'admin/js/admin.js', // Adjust path if using a plugin array('jquery'), // jQuery dependency '3.5', true // Load in footer ); // Pass PHP variables to JavaScript wp_localize_script('custom-admin-js', 'rssFeedVars', array( 'attachment_id' => get_option('wsx_rss_feed_image_attachment_id', 0) )); } add_action('admin_enqueue_scripts', 'wsx_rss_feed_styles'); function wsx_rss_feed_admin_settings() { // Ensure request method is set before using it if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') { if (!isset($_POST['wsx_rss_feed_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['wsx_rss_feed_nonce'])), 'wsx_rss_feed_nonce_action')) { wp_die(esc_html__('Security check failed', 'admin-dashboard-rss-feed')); } // Save attachment ID if (isset($_POST['image_attachment_id'])) { update_option('wsx_rss_feed_image_attachment_id', absint($_POST['image_attachment_id'])); } } if (!empty($_GET['page']) && $_GET['page'] == "admin-dashboard-rss-feed/admin-rss-feed.php") { wp_enqueue_media(); } // Register settings register_setting('wsx-rss-feed-settings-group', 'wsx_logo_title', 'sanitize_text_field'); register_setting('wsx-rss-feed-settings-group', 'wsx_logo_target_link', 'esc_url_raw'); register_setting('wsx-rss-feed-settings-group', 'wsx_rss_feed_url', 'esc_url_raw'); register_setting('wsx-rss-feed-settings-group', 'wsx_rss_feed_count', 'absint'); } //add_action('admin_init', 'wsx_rss_feed_admin_settings'); function wsx_rss_feed_admin_settings_page() { ?>

Admin Dashboard RSS Feed Settings

Your Company Name:
Your Company Logo:
'image-preview', 'class' =>'clsImagePreview', 'height' => '100')); ?>
(We suggest 64 pixels wide x 64 pixels high) '>
Your Company Website:
Your Company RSS Feed URL:
Number of items to display: (You can show between 1 to 10)
"") { $rss_feed_url = esc_attr(get_option('wsx_rss_feed_url')); } else { echo "Enter a valid news feed URL."; } $wsx_logo_url = esc_url(wp_get_attachment_url(get_option('wsx_rss_feed_image_attachment_id'))); $wsx_logo_title = esc_attr(get_option('wsx_logo_title')); $wsx_logo_target_link = esc_attr(get_option('wsx_logo_target_link')); $wsx_logo_id = get_option('wsx_rss_feed_image_attachment_id'); echo '
'; if ($wsx_logo_url <> "" && $wsx_logo_target_link <> "" && $wsx_logo_title <> "") { $title = 'title="' . $wsx_logo_title . '"'; $alt = 'alt="' . $wsx_logo_title . '"'; echo "
"; echo ''; echo ''; echo ''; echo '
' . esc_attr($wsx_logo_title) . ''; echo '' . esc_url($wsx_logo_target_link) . '
'; } else if ($wsx_logo_url <> "" && $wsx_logo_target_link <> "") { //echo "
"; if ($wsx_logo_id) { echo esc_html("'; } echo '' . esc_url($wsx_logo_target_link) . '
'; } else if ($wsx_logo_url <> "" && $wsx_logo_title <> "") { $alt = 'alt="' . $wsx_logo_title . '"'; echo "
"; echo '
' . esc_attr($wsx_logo_title) . '
'; } else if ($wsx_logo_title <> "" && $wsx_logo_target_link <> "") { echo '
' . esc_attr($wsx_logo_title) . '

'; echo '' . esc_url($wsx_logo_target_link) . '
'; } else { if ($wsx_logo_url <> "") { echo "
"; echo wp_get_attachment_image($wsx_logo_id, 'full', false, ['alt' => esc_attr__('Logo', 'admin-dashboard-rss-feed')]); echo "
"; } if ($wsx_logo_title <> "") { echo '
' . esc_attr($wsx_logo_title) . '
'; } if ($wsx_logo_target_link <> "") { echo ""; } } echo '
'; echo ''; } ?>