Current File : /home/honehdyv/yours-toclaim.com/wp-content/plugins/LinkCloack/admin-settings.php
<?php
// Create a settings page.
function chapter_redirect_menu() {
    add_options_page('Chapter Redirect Button Settings', 'Chapter Redirect', 'manage_options', 'chapter-redirect-settings', 'chapter_redirect_settings_page');
}

add_action('admin_menu', 'chapter_redirect_menu');

// Display the settings page.
function chapter_redirect_settings_page() {
    ?>
    <div class="wrap">
        <h1>Chapter Redirect Button Settings</h1>
        <form method="post" action="options.php">
            <?php
            settings_fields('chapter_redirect_group');
            do_settings_sections('chapter-redirect-settings');
            submit_button();
            ?>
        </form>
    </div>
    <?php
}

// Register and add settings.
function chapter_redirect_settings_init() {
    register_setting('chapter_redirect_group', 'chapter_redirect_url');

    add_settings_section('chapter_redirect_section', 'Main Settings', null, 'chapter-redirect-settings');

    add_settings_field('chapter_redirect_url', 'Redirect URL', 'chapter_redirect_url_callback', 'chapter-redirect-settings', 'chapter_redirect_section');
}

add_action('admin_init', 'chapter_redirect_settings_init');

// Callback for the URL field.
function chapter_redirect_url_callback() {
    $url = esc_attr(get_option('chapter_redirect_url', 'https://newsbark.online/real-time-crypto-price/'));
    echo "<input type='text' name='chapter_redirect_url' value='{$url}' size='50'>";
	// echo '<h2>Copy and paste this code in your second website with ads: </h2>';
// 	echo "<p> Change the https://barbarianquestmanga.com/ with your current manga website in the next code.</p>";
// echo '<textarea cols="50" rows="50">';
// echo "\t&lt;?php\n";
// echo "if (isset(\$_GET['content'])) {\n";
// echo "    \$url = urldecode(\$_GET['content']);\n";
// echo "    \n";
// echo "    // Fetch the content\n";
// echo "    \$html = file_get_contents(\$url);\n";
// echo "    \n";
// echo "    // Parse the HTML content\n";
// echo "    \$dom = new DOMDocument();\n";
// echo "    libxml_use_internal_errors(true);  // Suppress warnings due to malformed HTML\n";
// echo "    \$dom->loadHTML(\$html);\n";
// echo "    libxml_clear_errors();\n";
// echo "    \n";
// echo "    // Modify the style of .entry-content:nth-of-type(2)\n";
// echo "    \$xpath = new DOMXPath(\$dom);\n";
// echo "    \$entryContentElements = \$xpath->query(\"//*[contains(concat(' ', normalize-space(@class), ' '), ' entry-content ')]\");\n";
// echo "    \n";
// echo "    if (\$entryContentElements->length > 1) {\n";
// echo "        \$secondElement = \$entryContentElements->item(1);\n";
// echo "        \$currentStyle = \$secondElement->getAttribute('style');\n";
// echo "        \$secondElement->setAttribute('style', \$currentStyle . ' display: block;');\n";
// echo "    }\n";
// echo "    \n";
// echo "    // Get element by ID 'chapter'\n";
// echo "    \$chapterElement = \$dom->getElementById('chapter');\n";
// echo "\n";
// echo "    echo '&lt;center&gt;&lt;a href=\"https://barbarianquestmanga.com/\"&gt;&lt;button style=\"margin-bottom:50px; background: tomato;color: white; font-size:30px;text-align:center; display:block; width: 100%\" &gt;Back to chapters&lt;/button&gt;&lt;/a&gt;\n";
// echo "&lt;/center&gt;';\n";
// echo "\n";
// echo "    // If the element exists, display its content\n";
// echo "    if (\$chapterElement) {\n";
// echo "        echo \$chapterElement->ownerDocument->saveHTML(\$chapterElement);\n";
// echo "    } else {\n";
// echo "        echo \"Element with ID 'chapter' not found.\";\n";
// echo "    }\n";
// echo "}\n";
// echo "</textarea>";

}
?>