File "options.php"

Full path: /home/kosmetik/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/robots-txt/options.php
File size: 2.04 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

use RankMath\Robots_Txt;
use RankMath\Helper;
defined('ABSPATH') || exit;
$data = Robots_Txt::get_robots_data();
$attributes = ['data-gramm' => 'false'];
$desc = '';
if ($data['exists']) {
    $attributes['readonly'] = 'readonly';
    $attributes['value'] = $data['default'];
    $desc = esc_html__('Contents are locked because a robots.txt file is present in the root folder.', 'rank-math');
} else {
    $attributes['placeholder'] = $data['default'];
}
if (isset($data['writable']) && false === $data['writable']) {
    $attributes['placeholder'] = $data['default'];
    $desc = esc_html__('Rank Math could not detect if a robots.txt file exists or not because of a filesystem issue. The file contents entered here may not be applied.', 'rank-math');
    unset($attributes['readonly'], $attributes['value']);
}
if (0 === $data['public']) {
    $attributes['readonly'] = 'readonly';
}
if (!Helper::is_edit_allowed()) {
    $cmb->add_field(['id' => 'edit_disabled', 'type' => 'notice', 'what' => 'error', 'content' => __('robots.txt file is not writable.', 'rank-math')]);
    $attributes['disabled'] = 'disabled';
}
$cmb->add_field(['id' => 'robots_txt_content', 'type' => 'textarea', 'attributes' => $attributes, 'classes' => 'nob rank-math-code-box', 'sanitization_cb' => ['\\RankMath\\CMB2', 'sanitize_robots_text']]);
if ($desc) {
    $cmb->add_field(['id' => 'robots_locked', 'type' => 'notice', 'what' => 'warning', 'classes' => 'nob nopt rank-math-notice', 'content' => wp_kses_post($desc)]);
    return;
} elseif (0 === $data['public']) {
    $cmb->add_field(['id' => 'site_not_public', 'type' => 'notice', 'what' => 'warning', 'classes' => 'nob nopt rank-math-notice', 'content' => wp_kses_post(sprintf(__('<strong>Warning:</strong> your site\'s search engine visibility is set to Hidden in <a href="%1$s" target="_blank">Settings &gt; Reading</a>. This means that the changes you make here will not take effect. Set the search engine visibility to Public to be able to change the robots.txt content.', 'rank-math'), admin_url('options-reading.php')))]);
    return;
}