403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.216.84
Web Server : nginx/1.28.1
System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User : root ( 0)
PHP Version : 8.2.28
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/wp.10/wp-content/plugins/clarity-seo/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/wp.10/wp-content/plugins/clarity-seo/includes/settings.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}
// Add settings page
function clarity_seo_add_settings_page() {
    $page_title = esc_html__( 'Clarity SEO Settings', 'clarity-seo' );
    $menu_title = esc_html__( 'SEO Optimizer', 'clarity-seo' );
    add_options_page(
        $page_title,
        $menu_title,
        'manage_options',
        'clarity-seo',
        'clarity_seo_settings_page'
    );
}
add_action('admin_menu', 'clarity_seo_add_settings_page');

// Settings page callback
function clarity_seo_settings_page() {
    $redirects = get_option('clarity_seo_redirects', []);
    $gsc_token = get_option('clarity_seo_gsc_access_token', '');
    $gsc_site = get_option('clarity_seo_gsc_site_url', '');
    if ( isset( $_POST['submit'] ) || isset( $_POST['add_redirect'] ) || isset( $_POST['delete_redirect'] ) ) {
        check_admin_referer( 'clarity_seo_settings_nonce' );
        if ( isset( $_POST['default_keywords'] ) ) {
            update_option( 'clarity_seo_default_keywords', sanitize_text_field( wp_unslash( $_POST['default_keywords'] ) ) );
        }
        if ( isset( $_POST['default_og_image'] ) ) {
            update_option( 'clarity_seo_default_og_image', esc_url_raw( wp_unslash( $_POST['default_og_image'] ) ) );
        }
        if ( isset( $_POST['logo_url'] ) ) {
            update_option( 'clarity_seo_logo_url', esc_url_raw( wp_unslash( $_POST['logo_url'] ) ) );
        }
        if ( isset( $_POST['organization_description'] ) ) {
            update_option( 'clarity_seo_organization_description', sanitize_textarea_field( wp_unslash( $_POST['organization_description'] ) ) );
        }
        if ( isset( $_POST['contact_phone'] ) ) {
            update_option( 'clarity_seo_contact_phone', sanitize_text_field( wp_unslash( $_POST['contact_phone'] ) ) );
        }
        if ( isset( $_POST['contact_type'] ) ) {
            update_option( 'clarity_seo_contact_type', sanitize_text_field( wp_unslash( $_POST['contact_type'] ) ) );
        }
        if ( isset( $_POST['social_links'] ) ) {
            update_option( 'clarity_seo_social_links', sanitize_text_field( wp_unslash( $_POST['social_links'] ) ) );
        }
        if ( isset( $_POST['gsc_access_token'] ) ) {
            update_option( 'clarity_seo_gsc_access_token', sanitize_text_field( wp_unslash( $_POST['gsc_access_token'] ) ) );
        }
        if ( isset( $_POST['gsc_site_url'] ) ) {
            update_option( 'clarity_seo_gsc_site_url', sanitize_text_field( wp_unslash( $_POST['gsc_site_url'] ) ) );
        }
        // Local SEO fields
        if ( isset( $_POST['local_address'] ) ) {
            update_option( 'clarity_seo_local_address', sanitize_textarea_field( wp_unslash( $_POST['local_address'] ) ) );
        }
        if ( isset( $_POST['local_geo'] ) ) {
            update_option( 'clarity_seo_local_geo', sanitize_text_field( wp_unslash( $_POST['local_geo'] ) ) );
        }
        // Image SEO toggle
        if ( isset( $_POST['auto_image_alt'] ) ) {
            update_option( 'clarity_seo_auto_image_alt', sanitize_text_field( wp_unslash( $_POST['auto_image_alt'] ) ) );
        }
        // Schema toggles
        if ( isset( $_POST['enable_organization'] ) ) {
            update_option( 'clarity_seo_enable_organization', sanitize_text_field( wp_unslash( $_POST['enable_organization'] ) ) );
        }
        if ( isset( $_POST['enable_faq'] ) ) {
            update_option( 'clarity_seo_enable_faq', sanitize_text_field( wp_unslash( $_POST['enable_faq'] ) ) );
        }
        if ( isset( $_POST['enable_video'] ) ) {
            update_option( 'clarity_seo_enable_video', sanitize_text_field( wp_unslash( $_POST['enable_video'] ) ) );
        }
        if ( isset( $_POST['enable_multiple'] ) ) {
            update_option( 'clarity_seo_enable_multiple', sanitize_text_field( wp_unslash( $_POST['enable_multiple'] ) ) );
        }
        // Tracked keywords
        if ( isset( $_POST['tracked_keywords'] ) ) {
            $keywords = array_map('trim', explode(',', sanitize_text_field( wp_unslash( $_POST['tracked_keywords'] ) )));
            update_option( 'clarity_seo_tracked_keywords', $keywords );
        }
        // Handle redirect add
        if ( isset( $_POST['old_url'] ) && isset( $_POST['new_url'] ) && !empty( $_POST['old_url'] ) && !empty( $_POST['new_url'] ) ) {
            $old_url = sanitize_text_field( wp_unslash( $_POST['old_url'] ) );
            $new_url = esc_url_raw( wp_unslash( $_POST['new_url'] ) );
            $redirects[$old_url] = $new_url;
            update_option( 'clarity_seo_redirects', $redirects );
        }
        // Handle redirect delete
        if ( isset( $_POST['delete_redirect'] ) && isset( $_POST['old_url_to_delete'] ) ) {
            $old_url = sanitize_text_field( wp_unslash( $_POST['old_url_to_delete'] ) );
            unset($redirects[$old_url]);
            update_option( 'clarity_seo_redirects', $redirects );
        }
    }
    // Bulk image replace (moved to separate action for clarity)
    ?>
    <div class="wrap">
        <h1><?php esc_html_e('Clarity SEO Settings', 'clarity-seo'); ?></h1>
        <form method="post">
            <?php wp_nonce_field('clarity_seo_settings_nonce'); ?>
            <table class="form-table">
                <tr>
                    <th><?php esc_html_e('Default Keywords', 'clarity-seo'); ?></th>
                    <td><input type="text" name="default_keywords" value="<?php echo esc_attr(get_option('clarity_seo_default_keywords', 'seo, schema, optimization, wordpress')); ?>" class="regular-text"></td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Default OG Image URL', 'clarity-seo'); ?></th>
                    <td><input type="url" name="default_og_image" value="<?php echo esc_attr(get_option('clarity_seo_default_og_image', '')); ?>" class="regular-text"></td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Organization Logo URL', 'clarity-seo'); ?></th>
                    <td><input type="url" name="logo_url" value="<?php echo esc_attr(get_option('clarity_seo_logo_url', '')); ?>" class="regular-text"></td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Organization Description', 'clarity-seo'); ?></th>
                    <td><textarea name="organization_description" rows="3" class="large-text"><?php echo esc_textarea(get_option('clarity_seo_organization_description', get_bloginfo('description'))); ?></textarea></td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Contact Phone', 'clarity-seo'); ?></th>
                    <td><input type="tel" name="contact_phone" value="<?php echo esc_attr(get_option('clarity_seo_contact_phone', '')); ?>" class="regular-text"></td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Contact Type', 'clarity-seo'); ?></th>
                    <td><input type="text" name="contact_type" value="<?php echo esc_attr(get_option('clarity_seo_contact_type', 'Customer Service')); ?>" class="regular-text"></td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Social Links (comma-separated)', 'clarity-seo'); ?></th>
                    <td><input type="text" name="social_links" value="<?php echo esc_attr(get_option('clarity_seo_social_links', '')); ?>" class="regular-text" placeholder="https://facebook.com/yoursite, https://twitter.com/yoursite"></td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Business Address', 'clarity-seo'); ?></th>
                    <td><textarea name="local_address" rows="3" class="large-text"><?php echo esc_textarea(get_option('clarity_seo_local_address', '')); ?></textarea></td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Geo Coordinates (lat,long)', 'clarity-seo'); ?></th>
                    <td><input type="text" name="local_geo" value="<?php echo esc_attr(get_option('clarity_seo_local_geo', '')); ?>" class="regular-text"></td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Auto Generate Image Alt/Titles', 'clarity-seo'); ?></th>
                    <td>
                        <select name="auto_image_alt">
                            <option value="on" <?php selected(get_option('clarity_seo_auto_image_alt', 'off'), 'on'); ?>>On</option>
                            <option value="off" <?php selected(get_option('clarity_seo_auto_image_alt', 'off'), 'off'); ?>>Off</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Schema Toggles', 'clarity-seo'); ?></th>
                    <td>
                        <label>Enable Organization: <select name="enable_organization"><option value="on" <?php selected(get_option('clarity_seo_enable_organization', 'on'), 'on'); ?>>On</option><option value="off">Off</option></select></label><br>
                        <label>Enable FAQ Auto: <select name="enable_faq"><option value="on" <?php selected(get_option('clarity_seo_enable_faq', 'on'), 'on'); ?>>On</option><option value="off">Off</option></select></label><br>
                        <label>Enable Video Auto: <select name="enable_video"><option value="on" <?php selected(get_option('clarity_seo_enable_video', 'on'), 'on'); ?>>On</option><option value="off">Off</option></select></label><br>
                        <label>Enable Multiple Types: <select name="enable_multiple"><option value="on" <?php selected(get_option('clarity_seo_enable_multiple', 'on'), 'on'); ?>>On</option><option value="off">Off</option></select></label>
                    </td>
                </tr>
                <tr>
                    <th><?php esc_html_e('Tracked Keywords (comma-separated)', 'clarity-seo'); ?></th>
                    <td><input type="text" name="tracked_keywords" value="<?php echo esc_attr(implode(', ', get_option('clarity_seo_tracked_keywords', []))); ?>" class="regular-text"></td>
                </tr>
                <tr>
                    <th colspan="2">
                        <h3><?php esc_html_e('Google Search Console Integration', 'clarity-seo'); ?></h3>
                        <p><?php esc_html_e('Enter GSC access token (OAuth) and site URL (e.g., sc-domain:example.com).', 'clarity-seo'); ?></p>
                        <label>Access Token: <input type="text" name="gsc_access_token" value="<?php echo esc_attr($gsc_token); ?>" class="regular-text"></label><br>
                        <label>Site URL: <input type="text" name="gsc_site_url" value="<?php echo esc_attr($gsc_site); ?>" class="regular-text" placeholder="sc-domain:example.com"></label>
                    </th>
                </tr>
                <tr>
                    <th colspan="2">
                        <h3><?php esc_html_e('Redirect Manager', 'clarity-seo'); ?></h3>
                        <p><?php esc_html_e('Add 301 redirects for old URLs (optional).', 'clarity-seo'); ?></p>
                        <input type="text" name="old_url" placeholder="Old URL (e.g., /old-page)" style="width: 40%;" />
                        →
                        <input type="url" name="new_url" placeholder="New URL (e.g., /new-page)" style="width: 40%;" />
                        <input type="submit" name="add_redirect" value="<?php esc_attr_e('Add Redirect', 'clarity-seo'); ?>" class="button" />
                    </th>
                </tr>
                <tr>
                    <th><?php esc_html_e('Current Redirects', 'clarity-seo'); ?></th>
                    <td>
                        <?php if (!empty($redirects)): ?>
                            <table class="wp-list-table widefat fixed striped">
                                <thead><tr><th>Old URL</th><th>New URL</th><th>Action</th></tr></thead>
                                <tbody>
                                    <?php foreach ($redirects as $old => $new): ?>
                                        <tr>
                                            <td><?php echo esc_html($old); ?></td>
                                            <td><?php echo esc_url($new); ?></td>
                                            <td>
                                                <form method="post">
                                                    <?php wp_nonce_field('clarity_seo_settings_nonce'); ?>
                                                    <input type="hidden" name="old_url_to_delete" value="<?php echo esc_attr($old); ?>">
                                                    <input type="submit" name="delete_redirect" value="Delete" class="button button-secondary">
                                                </form>
                                            </td>
                                        </tr>
                                    <?php endforeach; ?>
                                </tbody>
                            </table>
                        <?php else: ?>
                            <p><?php esc_html_e('No redirects yet.', 'clarity-seo'); ?></p>
                        <?php endif; ?>
                    </td>
                </tr>
                <tr>
                    <th colspan="2">
                        <h3><?php esc_html_e('Bulk Image Alt Replace', 'clarity-seo'); ?></h3>
                        <form method="post">
                            <?php wp_nonce_field('clarity_seo_settings_nonce'); ?>
                            <input type="text" name="find" placeholder="Find text" />
                            <input type="text" name="replace" placeholder="Replace with" />
                            <input type="submit" name="clarity_seo_bulk_image_replace" value="Bulk Replace" class="button" />
                        </form>
                    </th>
                </tr>
            </table>
            <?php submit_button(); ?>
        </form>
    </div>
    <?php
}

// Bulk find/replace alt in settings
add_action('admin_init', function() {
    if (isset($_POST['clarity_seo_bulk_image_replace']) && current_user_can('manage_options')) {
        check_admin_referer('clarity_seo_settings_nonce');
        if (isset($_POST['find']) && isset($_POST['replace'])) {
            $find = sanitize_text_field(wp_unslash($_POST['find']));
            $replace = sanitize_text_field(wp_unslash($_POST['replace']));
            $attachments = get_posts(['post_type' => 'attachment', 'numberposts' => -1]);
            foreach ($attachments as $attach) {
                $alt = get_post_meta($attach->ID, '_wp_attachment_image_alt', true);
                if (strpos($alt, $find) !== false) {
                    update_post_meta($attach->ID, '_wp_attachment_image_alt', str_replace($find, $replace, $alt));
                }
            }
        }
    }
});
?>

Youez - 2016 - github.com/yon3zu
LinuXploit