403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.217.13
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/image-seo.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}
// Image SEO: Auto-generate alt/title/caption on upload, bulk edit
add_filter('wp_generate_attachment_metadata', 'clarity_seo_auto_image_alt', 10, 2);
function clarity_seo_auto_image_alt($metadata, $attachment_id) {
    if (get_option('clarity_seo_auto_image_alt', 'off') === 'on') {
        $attachment = get_post($attachment_id);
        if ($attachment && empty($attachment->post_title)) {
            // Simple auto: Use filename sans extension
            $title = pathinfo(get_attached_file($attachment_id), PATHINFO_FILENAME);
            $title = str_replace(['-', '_'], ' ', $title);
            wp_update_post(['ID' => $attachment_id, 'post_title' => ucwords($title), 'post_excerpt' => ucwords($title), 'post_content' => ucwords($title)]);
            update_post_meta($attachment_id, '_wp_attachment_image_alt', ucwords($title));
        }
    }
    return $metadata;
}

// Bulk find/replace alt in settings (add to settings.php if needed, but for now hook)
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