Plugin Directory

Changeset 3422724


Ignore:
Timestamp:
12/18/2025 10:28:23 AM (3 months ago)
Author:
domainsupport
Message:

Tagging version 1.4.2

Location:
template-editor
Files:
4 edited
5 copied

Legend:

Unmodified
Added
Removed
  • template-editor/tags/1.4.2/includes/class-te-common.php

    r2986060 r3422724  
    11<?php
    22/*
    3  * Version: 1.3.9
     3 * Version: 1.4.4
    44 */
    55
     
    4343        public static function plugin_text_domain() {
    4444
    45             return self::$plugin_text_domain;
     45            return 'template-editor';
    4646
    4747        }
     
    6161        public static function support_url() {
    6262
    63             return 'https://wordpress.org/support/plugin/' . self::$plugin_text_domain . '/';
     63            return 'https://wordpress.org/support/plugin/' . 'template-editor' . '/';
    6464
    6565        }
     
    6767        public static function control_upgrade_text() {
    6868
    69             $upgrade_text = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name)) . '">' . sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name) . '</a>';
     69/* translators: name of the plugin */
     70            $upgrade_text = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Upgrade now to %s Premium', 'template-editor'), self::$plugin_name)) . '">' . sprintf(__('Upgrade now to %s Premium', 'template-editor'), self::$plugin_name) . '</a>';
    7071
    7172            if (!class_exists(self::$plugin_premium_class) || !get_option(self::$plugin_prefix . '_purchased')) {
     
    7374                if (!class_exists(self::$plugin_premium_class)) {
    7475
    75                     $upgrade_text .= sprintf(wp_kses(__(' or <a href="%s" title="Download Free Trial">trial it for 7 days</a>', self::$plugin_text_domain), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::premium_link()));
     76/* translators: link to the premium upgrade */
     77                    $upgrade_text .= sprintf(wp_kses(__(' or <a href="%s" title="Download Free Trial">trial it for 7 days</a>', 'template-editor'), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::premium_link()));
    7678
    7779                }
     
    8587        public static function control_section_description() {
    8688
    87             $default_description = sprintf(wp_kses(__('If you have any requests for new features, please <a href="%s" title="Support Forum">let us know in the support forum</a>.', self::$plugin_text_domain), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::support_url()));
     89/* translators: link to the plugin's support forum */
     90            $default_description = sprintf(wp_kses(__('If you have any requests for new features, please <a href="%s" title="Support Forum">let us know in the support forum</a>.', 'template-editor'), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::support_url()));
    8891
    8992            if (self::$plugin_premium_class) {
     
    9598                    if (!class_exists(self::$plugin_premium_class)) {
    9699
    97                         $section_description = '<strong>' . __('For even more options', self::$plugin_text_domain) . '</strong>' . ' ' . $upgrade_text;
     100                        $section_description = '<strong>' . __('For even more options', 'template-editor') . '</strong>' . ' ' . $upgrade_text;
    98101
    99102                    } else {
    100103
    101                         $section_description = '<strong>' . __('To keep using premium options', self::$plugin_text_domain) . '</strong>' . ' ' . $upgrade_text;
     104                        $section_description = '<strong>' . __('To keep using premium options', 'template-editor') . '</strong>' . ' ' . $upgrade_text;
    102105
    103106                    }
     
    119122                $section_description .= ' ' . sprintf(
    120123                    wp_kses(
     124/* translators: link to plugin install page */
    121125                        __(
    122126                            '<strong>To reset this section of options to default settings</strong> without affecting other sections in the customizer, install <a href="%s" title="Reset Customizer">Reset Customizer</a>.',
    123                             self::$plugin_text_domain
     127                            'template-editor'
    124128                        ),
    125129                        array('strong' => array(), 'a' => array('href' => array(), 'title' => array()))
     
    145149        public static function control_setting_upgrade_nag() {
    146150
    147             $upgrade_nag = self::control_upgrade_text() . __(' to use this option.', self::$plugin_text_domain);
     151            $upgrade_nag = self::control_upgrade_text() . __(' to use this option.', 'template-editor');
    148152
    149153            return $upgrade_nag;
     
    234238
    235239                $generated_css = sprintf('%s { %s: %s; }', $selector, $style, $prefix.$mod.$postfix);
    236                 echo $generated_css;
     240
     241// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     242                echo wp_strip_all_tags($generated_css);
    237243
    238244            } elseif ($mod) {
    239245
    240246                $generated_css = sprintf('%s { %s:%s; }', $selector, $style, $prefix.$value.$postfix);
    241                 echo $generated_css;
     247
     248// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     249                echo wp_strip_all_tags($generated_css);
    242250
    243251            }
     
    249257            if (self::$plugin_premium_class) {
    250258
    251                 return add_query_arg('url', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'], 'https://webd.uk/product/' . self::$plugin_text_domain . '-upgrade/');
    252 
     259                if (isset($_SERVER['HTTP_HOST'])) {
     260
     261                    return add_query_arg('url', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . filter_var(wp_unslash($_SERVER['HTTP_HOST'], FILTER_SANITIZE_URL)), 'https://webd.uk/product/' . 'template-editor' . '-upgrade/');
     262
     263                } else {
     264
     265                    return 'https://webd.uk/product/' . 'template-editor' . '-upgrade/';
     266
     267                }
    253268
    254269            } else {
     
    276291            $settings_links = array();
    277292
    278             $settings_links[] = '<a href="' . esc_url($settings_link) . '" title="' . esc_attr(__('Settings', self::$plugin_text_domain)) . '">' . __('Settings', self::$plugin_text_domain) . '</a>';
     293            $settings_links[] = '<a href="' . esc_url($settings_link) . '" title="' . esc_attr(__('Settings', 'template-editor')) . '">' . __('Settings', 'template-editor') . '</a>';
    279294
    280295            if (!get_option(self::$plugin_prefix . '_purchased')) {
     
    284299                    if (self::$plugin_upgrade) {
    285300
    286                         $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s Premium', self::$plugin_text_domain), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', self::$plugin_text_domain) . '</a>';
     301/* translators: name of the plugin */
     302                        $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s Premium', 'template-editor'), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', 'template-editor') . '</a>';
    287303
    288304                    } else {
    289305
    290                         $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s', self::$plugin_text_domain), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', self::$plugin_text_domain) . '</a>';
     306/* translators: name of the plugin */
     307                        $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s', 'template-editor'), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', 'template-editor') . '</a>';
    291308
    292309                    }
     
    294311                } else {
    295312
    296                     $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr((self::$plugin_premium_class ? sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name) : sprintf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name))) . '" style="color: orange; font-weight: bold;">' . (self::$plugin_premium_class ? __('Upgrade', self::$plugin_text_domain) : __('Support Us', self::$plugin_text_domain)) . '</a>';
     313/* translators: name of the plugin */
     314                    $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr((self::$plugin_premium_class ? sprintf(__('Upgrade now to %s Premium', 'template-editor'), self::$plugin_name) : sprintf(__('Contribute to %s', 'template-editor'), self::$plugin_name))) . '" style="color: orange; font-weight: bold;">' . (self::$plugin_premium_class ? __('Upgrade', 'template-editor') : __('Support Us', 'template-editor')) . '</a>';
    297315
    298316                }
     
    300318                if ($premium) {
    301319
    302                     $settings_links[] = '<a href="' . wp_nonce_url('?activate-' . self::$plugin_prefix . '=true', self::$plugin_prefix . '_activate') . '" id="' . self::$plugin_prefix . '_activate_upgrade" title="' . esc_attr(__('Activate Purchase', self::$plugin_text_domain)) . '" onclick="jQuery(this).append(&#39; <img src=&#34;/wp-admin/images/loading.gif&#34; style=&#34;float: none; width: auto; height: auto;&#34; />&#39;); setTimeout(function(){document.getElementById(\'' . self::$plugin_prefix . '_activate_upgrade\').removeAttribute(\'href\');},1); return true;">' . __('Activate Purchase', self::$plugin_text_domain) . '</a>';
    303 
    304                 } elseif (self::$plugin_trial && !is_plugin_active(self::$plugin_text_domain . '-premium/' . self::$plugin_text_domain . '-premium.php')) {
    305 
    306                     $settings_links[] = '<a href="' . esc_url(self::premium_link()) . '" title="' . esc_attr(sprintf(__('Trial %s Premium', self::$plugin_text_domain), self::$plugin_name)) . ' for 7 days">' . __('Download Trial', self::$plugin_text_domain) . '</a>';
     320                    $settings_links[] = '<a href="' . wp_nonce_url('?activate-' . self::$plugin_prefix . '=true', self::$plugin_prefix . '_activate') . '" id="' . self::$plugin_prefix . '_activate_upgrade" title="' . esc_attr(__('Activate Purchase', 'template-editor')) . '" onclick="jQuery(this).append(&#39; <img src=&#34;/wp-admin/images/loading.gif&#34; style=&#34;float: none; width: auto; height: auto;&#34; />&#39;); setTimeout(function(){document.getElementById(\'' . self::$plugin_prefix . '_activate_upgrade\').removeAttribute(\'href\');},1); return true;">' . __('Activate Purchase', 'template-editor') . '</a>';
     321
     322                } elseif (self::$plugin_trial && !is_plugin_active('template-editor' . '-premium/' . 'template-editor' . '-premium.php')) {
     323
     324/* translators: name of the plugin */
     325                    $settings_links[] = '<a href="' . esc_url(self::premium_link()) . '" title="' . esc_attr(sprintf(__('Trial %s Premium', 'template-editor'), self::$plugin_name)) . ' for 7 days">' . __('Download Trial', 'template-editor') . '</a>';
    307326
    308327                }
     
    310329            } elseif ($premium) {
    311330
    312                 $settings_links[] = '<strong style="color: green; display: inline;">' . __('Purchase Confirmed', self::$plugin_text_domain) . '</strong>';
     331                $settings_links[] = '<strong style="color: green; display: inline;">' . __('Purchase Confirmed', 'template-editor') . '</strong>';
    313332
    314333            }
     
    320339        public static function plugin_row_meta($plugin_meta, $plugin_file, $plugin_data, $status) {
    321340
    322             if ($plugin_file === self::$plugin_text_domain . '/' . self::$plugin_text_domain . '.php') {
    323 
    324                 $plugin_meta[] = '<a href="' . esc_url(self::support_url()) . '" title="' . __('Problems? We are here to help!', self::$plugin_text_domain) . '" style="color: orange; font-weight: bold;">' . __('Need help?', self::$plugin_text_domain) . '</a>';
    325                 $plugin_meta[] = '<a href="https://wordpress.org/support/plugin/' . self::$plugin_text_domain . '/reviews/#new-post" title="' . esc_attr(sprintf(__('If you like %s, please leave a review!', self::$plugin_text_domain), self::$plugin_name)) . '">' . __('Review plugin', self::$plugin_text_domain) . '</a>';
     341            if ($plugin_file === 'template-editor' . '/' . 'template-editor' . '.php') {
     342
     343                $plugin_meta[] = '<a href="' . esc_url(self::support_url()) . '" title="' . __('Problems? We are here to help!', 'template-editor') . '" style="color: orange; font-weight: bold;">' . __('Need help?', 'template-editor') . '</a>';
     344/* translators: name of the plugin */
     345                $plugin_meta[] = '<a href="https://wordpress.org/support/plugin/' . 'template-editor' . '/reviews/#new-post" title="' . esc_attr(sprintf(__('If you like %s, please leave a review!', 'template-editor'), self::$plugin_name)) . '">' . __('Review plugin', 'template-editor') . '</a>';
    326346
    327347            }
     
    353373            if (self::$plugin_premium_class) {
    354374
    355                 if (get_option(self::$plugin_prefix . '_purchased') && !class_exists(self::$plugin_premium_class) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()) {
    356 
    357 ?>
    358 
    359 <div class="notice notice-error is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    360 
    361 <p><strong><?php echo self::$plugin_name; ?></strong><br />
    362 <?php esc_html_e('In order to use the premium features, you need to install the premium version of the plugin ...', self::$plugin_text_domain); ?></p>
    363 
    364 <p><a href="<?php echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Download %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Download %s Premium', self::$plugin_text_domain), self::$plugin_name); ?></a></p>
     375                if (
     376                    get_option(self::$plugin_prefix . '_purchased') &&
     377                    !class_exists(self::$plugin_premium_class) &&
     378                    get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()
     379                ) {
     380
     381?>
     382
     383<div class="notice notice-error is-dismissible <?php echo esc_html(self::$plugin_prefix); ?>-notice">
     384
     385<p><strong><?php echo esc_html(self::$plugin_name); ?></strong><br />
     386<?php esc_html_e('In order to use the premium features, you need to install the premium version of the plugin ...', 'template-editor'); ?></p>
     387
     388<p><a href="<?php
     389/* translators: name of the plugin */
     390echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Download %s Premium', 'template-editor'), self::$plugin_name)); ?>" class="button-primary"><?php printf(esc_html(__('Download %s Premium', 'template-editor')), esc_html(self::$plugin_name)); ?></a></p>
    365391
    366392</div>
    367393
    368394<script type="text/javascript">
    369     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     395    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    370396        jQuery.ajax({
    371397            url: ajaxurl,
    372398            data: {
    373                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    374                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     399                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     400                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    375401            }
    376402        });
     
    380406<?php
    381407
    382                 } elseif (!class_exists(self::$plugin_premium_class) && time() > (strtotime('+1 hour', filectime(__DIR__))) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()) {
    383 
    384 ?>
    385 
    386 <div class="notice notice-info is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    387 
    388 <p><strong><?php printf(__('Thank you for using %s plugin', self::$plugin_text_domain), self::$plugin_name); ?></strong><br />
     408                } elseif (
     409                    !class_exists(self::$plugin_premium_class) &&
     410                    time() > (strtotime('+1 hour', filectime(__DIR__))) &&
     411                    get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()
     412                ) {
     413
     414?>
     415
     416<div class="notice notice-info is-dismissible <?php echo esc_attr(self::$plugin_prefix); ?>-notice">
     417
     418    <p style="font-size:15px;"><strong><?php
     419/* translators: name of the plugin */
     420printf(esc_html(__('Thank you for using %s plugin', 'template-editor')), esc_html(self::$plugin_name)); ?></strong></p>
    389421<?php
    390422
    391423                    if (self::$plugin_trial == true) {
    392424
    393                         _e('Would you like to try even more features? Download your 7 day free trial now!', self::$plugin_text_domain);
     425?>
     426
     427    <p><?php echo esc_html(__('Would you like to try even more features? Download your 7 day free trial now!', 'template-editor')); ?></p>
     428<?php
    394429
    395430                    } else {
    396431
    397                         echo sprintf(__('Upgrade now to %s Premium to enable more options and features and contribute to the further development of this plugin.', self::$plugin_text_domain), self::$plugin_name);
     432?>
     433
     434    <p>
     435        <?php
     436/* translators: name of the plugin */
     437                        echo esc_html(sprintf(__('Upgrade now to %s Premium to enable more options and features and contribute to the further development of this plugin.', 'template-editor'), self::$plugin_name)); ?>
     438    </p>
     439<?php
    398440
    399441                    }
    400442
    401 ?></p>
    402 
    403 <p><?php
     443?>
     444
     445    <p><?php
    404446
    405447                    if (self::$plugin_trial == true) {
     
    407449?>
    408450
    409 <a href="<?php echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Try %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Trial %s Premium for 7 days', self::$plugin_text_domain), self::$plugin_name); ?></a>
    410 
     451        <a href="<?php echo esc_url(self::premium_link()); ?>"
     452           title="<?php
     453/* translators: name of the plugin */
     454echo esc_attr(sprintf(__('Try %s Premium', 'template-editor'), self::$plugin_name)); ?>"
     455           class="button-secondary">
     456           <?php echo esc_html(__('Try premium plugin free for 7 days', 'template-editor')); ?>
     457        </a>
    411458<?php
    412459
     
    414461
    415462?>
    416 <a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php echo esc_attr(sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name); ?></a></p>
     463
     464        <a href="<?php echo esc_url(self::upgrade_link()); ?>"
     465           title="<?php
     466/* translators: name of the plugin */
     467echo esc_attr(sprintf(__('Upgrade now to %s Premium', 'template-editor'), self::$plugin_name)); ?>"
     468           class="button-primary">
     469           <?php echo esc_html(__('Upgrade now to premium plugin', 'template-editor')); ?>
     470        </a>
     471
     472    </p>
     473
     474    <hr style="margin:12px 0;">
     475
     476    <p>
     477        <strong>✨ Need help with your WordPress site?</strong>
     478        🚀 Slow, want new features, or need a glow-up?
     479        <a href="https://webd.uk/services/?utm_campaign=notice&utm_term=template-editor" class="button-secondary" style="margin-left:6px; vertical-align: middle;">Explore our services</a>
     480    </p>
    417481
    418482</div>
    419483
    420484<script type="text/javascript">
    421     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     485    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    422486        jQuery.ajax({
    423487            url: ajaxurl,
    424488            data: {
    425                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    426                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     489                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     490                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    427491            }
    428492        });
     
    434498                }
    435499
    436             } elseif (time() > (strtotime('+1 hour', filectime(__DIR__))) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version() && !get_option(self::$plugin_prefix . '_donated')) {
    437 
    438 ?>
    439 
    440 <div class="notice notice-info is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    441 <p><strong><?php printf(__('Thank you for using %s plugin', self::$plugin_text_domain), self::$plugin_name); ?></strong></p>
    442 <?php
    443 
     500            } elseif (
     501                time() > (strtotime('+1 hour', filectime(__DIR__))) &&
     502                get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version() &&
     503                !get_option(self::$plugin_prefix . '_donated')
     504            ) {
     505
     506?>
     507
     508<div class="notice notice-info is-dismissible <?php echo esc_attr(self::$plugin_prefix); ?>-notice">
     509
     510    <p><strong><?php
     511/* translators: name of the plugin */
     512printf(esc_html(__('Thank you for using %s plugin', 'template-editor')), esc_html(self::$plugin_name)); ?></strong></p>
     513<?php
     514
     515// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
    444516                do_action(self::$plugin_prefix . '_admin_notice_donate');
    445517
    446518?>
    447 <p><?php esc_html_e('Funding plugins like this one with small financial contributions is essential to pay the developers to continue to do what they do. Please take a moment to give a small amount ...', self::$plugin_text_domain); ?></p>
    448 <p><a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php echo esc_attr(sprintf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name); ?></a> <a href="#" id="<?php echo self::$plugin_prefix; ?>-already-paid" title="<?php echo esc_attr(__('Aleady Contributed!', self::$plugin_text_domain)); ?>" class="button-primary"><?php esc_html_e('Aleady Contributed!', self::$plugin_text_domain); ?></a></p>
     519
     520    <p><?php esc_html_e('Funding plugins like this one with small financial contributions is essential to pay the developers to continue to do what they do. Please take a moment to give a small amount ...', 'template-editor'); ?></p>
     521
     522    <p><a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php
     523/* translators: name of the plugin */
     524echo esc_attr(sprintf(__('Contribute to %s', 'template-editor'), self::$plugin_name)); ?>" class="button-primary"><?php echo esc_html(__('Buy us a coffee ☕️', 'template-editor')); ?></a> <a href="#" id="<?php echo esc_attr(self::$plugin_prefix); ?>-already-paid" title="<?php echo esc_attr(__('Aleady Contributed!', 'template-editor')); ?>" class="button-secondary"><?php esc_html_e('Aleady Contributed!', 'template-editor'); ?></a></p>
     525
     526    <hr style="margin:12px 0;">
     527
     528    <p>
     529        <strong>✨ Need help with your WordPress site?</strong>
     530        🚀 Slow, want new features, or need a glow-up?
     531        <a href="https://webd.uk/services/?utm_campaign=notice&utm_term=template-editor" class="button-secondary" style="margin-left:6px; vertical-align: middle;">Explore our services</a>
     532    </p>
     533
    449534</div>
    450535
    451536<script type="text/javascript">
    452     jQuery(document).on('click', '#<?php echo self::$plugin_prefix; ?>-already-paid', function() {
    453         if (confirm(<?php echo json_encode(__('Have you really? Press "Cancel" if you forgot to 🙂', self::$plugin_text_domain)); ?>)) {
    454             alert(<?php echo json_encode(__('Thank you!', self::$plugin_text_domain)); ?>);
    455             jQuery('.<?php echo self::$plugin_prefix; ?>-notice').fadeTo(100, 0, function() {
    456                 jQuery('.<?php echo self::$plugin_prefix; ?>-notice').slideUp(100, function() {
    457                     jQuery('.<?php echo self::$plugin_prefix; ?>-notice').remove()
     537    jQuery(document).on('click', '#<?php echo esc_attr(self::$plugin_prefix); ?>-already-paid', function() {
     538        if (confirm(<?php echo json_encode(__('Have you really? Press "Cancel" if you forgot to 🙂', 'template-editor')); ?>)) {
     539            alert(<?php echo json_encode(__('Thank you!', 'template-editor')); ?>);
     540            jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').fadeTo(100, 0, function() {
     541                jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').slideUp(100, function() {
     542                    jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').remove()
    458543                });
    459544            });
     
    461546                url: ajaxurl,
    462547                data: {
    463                     action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
     548                    action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
    464549                    donated: 'true',
    465                     _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     550                    _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    466551                }
    467552            });
    468553        } else {
    469             window.location.assign('<?php echo self::upgrade_link(); ?>');
     554            window.location.assign('<?php echo esc_url(self::upgrade_link()); ?>');
    470555        }
    471556    });
    472     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     557    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    473558        jQuery.ajax({
    474559            url: ajaxurl,
    475560            data: {
    476                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    477                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     561                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     562                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    478563            }
    479564        });
     
    509594                    is_admin() &&
    510595                    $pagenow === 'customize.php' &&
    511                     isset($_GET['theme']) &&
    512                     !in_array($_GET['theme'], $themes, true)
     596                    isset($_GET['theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     597                    !in_array($_GET['theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    513598                ) && !(
    514599                    !is_admin() &&
    515600                    $pagenow === 'index.php' &&
    516                     isset($_GET['customize_theme']) &&
    517                     isset($_GET['customize_changeset_uuid']) &&
    518                     !in_array($_GET['customize_theme'], $themes, true)
     601                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     602                    isset($_GET['customize_changeset_uuid']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     603                    !in_array($_GET['customize_theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    519604                )
    520605            ) {
     
    530615                    is_admin() &&
    531616                    $pagenow === 'customize.php' &&
    532                     isset($_GET['theme']) &&
    533                     in_array($_GET['theme'], $themes, true)
     617                    isset($_GET['theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     618                    in_array($_GET['theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    534619                ) || (
    535620                    !is_admin() &&
    536621                    $pagenow === 'index.php' &&
    537                     isset($_GET['customize_theme']) &&
    538                     isset($_GET['customize_changeset_uuid']) &&
    539                     in_array($_GET['customize_theme'], $themes, true)
     622                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     623                    isset($_GET['customize_changeset_uuid']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     624                    in_array($_GET['customize_theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    540625                ))
    541626            ) {
     
    549634                    !is_admin() &&
    550635                    $pagenow === 'index.php' &&
    551                     isset($_GET['customize_theme']) &&
    552                     isset($_GET['customize_changeset_uuid'])
     636                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     637                    isset($_GET['customize_changeset_uuid']) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    553638               
    554639            ) {
    555640
    556                 $child = wp_get_theme($_GET['customize_theme']);
     641                $child = wp_get_theme(sanitize_file_name(wp_unslash($_GET['customize_theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    557642
    558643                if (isset($child->template) && in_array($child->template, $themes, true)) {
     
    568653                is_admin() &&
    569654                ($pagenow === 'customize.php' || $pagenow === 'admin-ajax.php') &&
    570                 isset($_GET['theme']) || (isset($_POST['customize_theme']) && isset($_POST['customize_changeset_uuid']))
     655                (
     656                    isset($_GET['theme']) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     657                    (
     658                        isset($_POST['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Missing
     659                        isset($_POST['customize_changeset_uuid']) // phpcs:ignore WordPress.Security.NonceVerification.Missing
     660                    )
     661                )
    571662            ) {
    572663
    573                 if (isset($_GET['theme'])) {
    574 
    575                     $child = wp_get_theme($_GET['theme']);
     664                if (isset($_GET['theme'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     665
     666                    $child = wp_get_theme(sanitize_file_name(wp_unslash($_GET['theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    576667
    577668                } else {
    578669
    579                     $child = wp_get_theme($_POST['customize_theme']);
     670                    $child = wp_get_theme(sanitize_file_name(wp_unslash($_POST['customize_theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Missing
    580671
    581672                }
     
    599690if (!function_exists('webd_customize_register')) {
    600691
     692// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
    601693    function webd_customize_register($wp_customize) {
    602694
    603695        if (!class_exists('webd_Customize_Control_Checkbox_Multiple')) {
    604696
     697// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
    605698            class webd_Customize_Control_Checkbox_Multiple extends WP_Customize_Control {
    606699
     
    622715
    623716?>
    624 <span class="description customize-control-description"><?php echo $this->description; ?></span>
     717<span class="description customize-control-description"><?php echo esc_html($this->description); ?></span>
    625718<?php
    626719
     
    647740?>
    648741        </ul>
    649         <input type="hidden" id="_customize-input-<?php echo $this->id; ?>" <?php $this->link(); ?> value="<?php echo esc_attr(implode(',', $multi_values)); ?>" />
     742        <input type="hidden" id="_customize-input-<?php echo esc_attr($this->id); ?>" <?php $this->link(); ?> value="<?php echo esc_attr(implode(',', $multi_values)); ?>" />
    650743<?php
    651744
  • template-editor/tags/1.4.2/readme.txt

    r3409463 r3422724  
    22Contributors: domainsupport
    33Donate link: https://webd.uk/product/support-us/
    4 Tags: block theme, templates, template parts, google fonts, global styles
     4Tags: block theme, templates, template parts, block options, global styles
    55Requires at least: 5.8
    66Tested up to: 6.9
    77Requires PHP: 5.6
    8 Stable tag: 1.4.1
     8Stable tag: 1.4.2
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 Import / Export global styles, templates and template parts to Full Site Editing / Block Themes without a child theme!
     12Adds options to core blocks and allows import / export of global styles, templates and template parts!
    1313
    1414== Description ==
    15 = Template Editor =
    16 
    17 With WordPress v5.9 the first default theme with Full Site Editing was launched ... Twenty Twenty-Two.
    18 
    19 This plugin expands on the functionality to manage (export / import) templates that are not part of the theme without having to have a child theme.
    20 
    21 Having a block theme also removes links to the Customizer. This plugin changes that!
     15= Options for Block Themes =
     16
     17With WordPress v5.9 the first default block theme with Full Site Editing was launched ... Twenty Twenty-Two.
     18
     19This plugin expands on the functionality to manage (export / import / delete) templates and template parts that are not part of the theme without having to have a child theme.
     20
     21Having a block theme also removes links to the legacy Customizer. This plugin allows you to change that!
    2222
    2323This plugin will also enable the Template Editor in Gutenberg for full site editing for any theme!
     
    2727- Option to enable expandable submenus to the Navigation Block modal.
    2828- Option to add full block link option to Group and Cover Blocks.
    29 - Option to close other Details Blocks when selected one is opened giving the Details Block basic accordion functionality.
     29- Option to close other Details Blocks when selected one is opened giving the Details Block a basic "accordion" functionality.
    3030
    3131= Conditional Block Logic =
     
    7575Enable an option to shrink the header site logo when you scroll down the page.
    7676
    77 = Add Google Fonts to Editor =
    78 
    79 NB: This is only relevant to WordPress v5.8 - v6.4 and classic themes as the Font Library was introduced into core in v6.5
    80 
    81 Choose Google Fonts and add them to the full screen editor global styles options!
    82 
    83 = Remove Block Theme Fonts =
    84 
    85 NB: This is only relevant to WordPress v5.8 - v6.4 as the Font Library was introduced into core in v6.5
    86 
    87 This plugin will allow you to choose which theme fonts are included in the FSE editor and if not required will prevent them from being loaded on the front end.
    88 
    8977== Installation ==
    9078
    9179Easily use this plugin to enable the Template Editor on your site ...
    9280
    93 1) Install "Template Editor" automatically or by uploading the ZIP file.
     811) Install "Options for Block Themes" automatically or by uploading the .zip file.
    94822) Activate the plugin through the "Plugins" menu in WordPress.
    95 3) Start using the Template Editor with your theme.
     833) Start using the Options for Block Themes.
    9684
    9785== Changelog ==
     86
     87= 1.4.2 =
     88* General housekeeping preparing for "Plugin Check" code review
    9889
    9990= 1.4.1 =
     
    225216== Upgrade Notice ==
    226217
    227 = 1.4.1 =
    228 * Fixed a margin / block spacing bug with "Full Block Link" option
     218= 1.4.2 =
     219* General housekeeping preparing for "Plugin Check" code review
  • template-editor/tags/1.4.2/template-editor.php

    r3409463 r3422724  
    22/*
    33 * Plugin Name: Options for Block Themes
    4  * Version: 1.4.1
     4 * Version: 1.4.2
    55 * Plugin URI: https://webd.uk/support/
    6  * Description: Import / Export global styles, templates and template parts to Full Site Editing / Block Themes without a child theme!
     6 * Description: Adds options to core blocks and allows import / export of global styles, templates and template parts!
    77 * Author: Webd Ltd
    88 * Author URI: https://webd.uk
     9 * License: GPLv2 or later
     10 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    911 * Text Domain: template-editor
    1012 */
     
    2224    class template_editor_class {
    2325
    24         public static $version = '1.4.1';
     26        public static $version = '1.4.2';
    2527        public $is_block_theme = false;
    2628
     
    385387                        unset($submenu['themes.php'][7]);
    386388
     389                    } elseif (isset($_SERVER['REQUEST_URI'])) {
     390
     391                        $customize_url = add_query_arg(
     392                            'return',
     393                            urlencode(remove_query_arg(wp_removable_query_args(), sanitize_url(wp_unslash($_SERVER['REQUEST_URI'])))),
     394                            'customize.php'
     395                        );
     396                        $submenu['themes.php'][7] = array(__('Customize','template-editor'), 'customize', esc_url($customize_url), '', 'hide-if-no-customize');
     397
    387398                    } else {
    388399
    389                         $customize_url = add_query_arg('return', urlencode(remove_query_arg(wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI']))), 'customize.php');
    390                         $submenu['themes.php'][7] = array(__('Customize','template-editor'), 'customize', esc_url($customize_url), '', 'hide-if-no-customize');
     400                        $submenu['themes.php'][7] = array(__('Customize','template-editor'), 'customize', esc_url('customize.php'), '', 'hide-if-no-customize');
    391401
    392402                    }
     
    423433        public static function settings_page() {
    424434
     435// phpcs:ignore WordPress.Security.NonceVerification.Recommended
    425436            if (isset($_GET['tab']) && in_array(sanitize_key($_GET['tab']), array('theme_options', 'manage_template_parts'))) {
    426437
     438// phpcs:ignore WordPress.Security.NonceVerification.Recommended
    427439                $current_tab = sanitize_key($_GET['tab']);
    428440
     
    449461
    450462?>
    451 <a id="<?php echo esc_attr($tab); ?>" class="nav-tab<?php echo $class; ?>" href="#" title="<?php echo esc_attr($title); ?>"><?php echo esc_html($title); ?></a>
     463<a id="<?php echo esc_attr($tab); ?>" class="nav-tab<?php echo esc_attr($class); ?>" href="#" title="<?php echo esc_attr($title); ?>"><?php echo esc_html($title); ?></a>
    452464<?php
    453465
     
    460472    $('#adminmenu li.current').addClass('manage_templates');
    461473    $('#adminmenu .current').removeClass('current');
    462     $('#adminmenu .<?php echo $current_tab; ?>').addClass('current');
     474    $('#adminmenu .<?php echo esc_attr($current_tab); ?>').addClass('current');
    463475    $('.nav-tab-wrapper .nav-tab').click(function() {
    464476        $('.tab_content').hide();
     
    482494<p><?php esc_html_e('You can then rename the slug (and title / description) of the edited template to whatever you require and either save it or save it as a copy if you want to keep the original.', 'template-editor'); ?></p>
    483495<p><?php esc_html_e('Using this plugin you can create new templates outside of those that are available by default <strong>without</strong> having to create a child them! :)', 'template-editor'); ?></p>
    484 <h2><?php printf(__('Active Theme (%s) Templates', 'template-editor'), $active_theme); ?></h2>
     496<h2><?php
     497/* translators: active theme slug */
     498printf(esc_html__('Active Theme (%s) Templates', 'template-editor'), esc_html($active_theme)); ?></h2>
    485499<?php
    486500
     
    549563
    550564?>
    551 <h2><?php printf(__('Other Theme Templates', 'template-editor'), $active_theme); ?></h2>
     565<h2><?php printf(esc_html__('Other Theme Templates', 'template-editor'), esc_html($active_theme)); ?></h2>
    552566<?php
    553567
     
    632646<th scope="row"><label for="te_post_name"><?php esc_html_e( 'Template Name', 'template-editor' ); ?></label></th>
    633647<td><input name="te_post_name" type="text" id="te_post_name" value="" class="regular-text">.html<br />
    634 <?php printf(__('<strong>This is the important bit!</strong> The template name <i>has</i> to match the slug that you would expect WordPress to look for in the <a href="%1$s" title="%2$s" target="_blank">Template Heirachy</a>','template-editor'),'https://developer.wordpress.org/themes/basics/template-hierarchy/', __('Template Heirachy','template-editor')); ?></td>
     648<?php
     649/* translators: link to template documentation */
     650printf(wp_kses(__('<strong>This is the important bit!</strong> The template name <i>has</i> to match the slug that you would expect WordPress to look for in the <a href="%s" title="Template Heirachy" target="_blank">Template Heirachy</a>','template-editor'), 'post'),'https://developer.wordpress.org/themes/basics/template-hierarchy/'); ?></td>
    635651</tr>
    636652<tr>
     
    660676    $('#te_save_as_copy').click(function() { save_template(1); });
    661677    function save_template(saveAsCopy) {
    662         if (confirm('<?php _e('Are you sure you want to save your changes to the template?', 'template-editor'); ?>')) {
     678        if (confirm('<?php esc_html_e('Are you sure you want to save your changes to the template?', 'template-editor'); ?>')) {
    663679            $('#te_save').unbind('click')
    664680            var data = {
    665681                action: 'te_save',
    666                 _ajax_nonce: '<?php echo wp_create_nonce('template-editor-save'); ?>',
     682                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('template-editor-save')); ?>',
    667683                post_id: $('#te_post_id').val(),
    668684                post_title: $('#te_post_title').val(),
     
    677693                success: function(response) {
    678694                    if ('success' in response && response.success) {
    679                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     695                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    680696                    } else {
    681                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    682                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     697                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     698                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    683699                    }
    684700                },
    685701                error: function() {
    686                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    687                     window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     702                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     703                    window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    688704                }
    689705            });
     
    693709        var data = {
    694710            action: 'te_download_wp_template',
    695             _ajax_nonce: '<?php echo wp_create_nonce('download-wp-template'); ?>',
     711            _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('download-wp-template')); ?>',
    696712            post_id: $(this).data('template').ID,
    697713            post_name: $(this).data('template').post_name
     
    729745            },
    730746            error: function() {
    731                 alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
     747                alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
    732748            }
    733749        });
    734750    });
    735751    $('.te-delete').click(function() {
    736         if (confirm('<?php _e('Are you sure you want to delete the template?', 'template-editor'); ?>')) {
     752        if (confirm('<?php esc_html_e('Are you sure you want to delete the template?', 'template-editor'); ?>')) {
    737753            $('#te-delete').unbind('click')
    738754            var data = {
    739755                action: 'te_delete',
    740                 _ajax_nonce: '<?php echo wp_create_nonce('template-editor-delete'); ?>',
     756                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('template-editor-delete')); ?>',
    741757                post_id: $(this).data('template')
    742758            };
     
    747763                success: function(response) {
    748764                    if ('success' in response && response.success) {
    749                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     765                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    750766                    } else {
    751                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    752                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     767                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     768                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    753769                    }
    754770                },
    755771                error: function() {
    756                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    757                     window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     772                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     773                    window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    758774                }
    759775            });
     
    764780    });
    765781    $('#te-json-file').change(function() {
    766         var confirmText = '<?php _e('Are you sure you want to upload %s as an active theme template?', 'template-editor'); ?>';
     782        var confirmText = '<?php
     783/* translators: filename */
     784esc_html_e('Are you sure you want to upload %s as an active theme template?', 'template-editor'); ?>';
    767785        if (confirm(confirmText.replace('%s', $('#te-json-file').prop('files')[0].name))) {
    768786            var data = new FormData();
    769787            data.append('action', 'te_upload_wp_template');
    770             data.append('_ajax_nonce', '<?php echo wp_create_nonce('upload-wp-template'); ?>');
     788            data.append('_ajax_nonce', '<?php echo esc_attr(wp_create_nonce('upload-wp-template')); ?>');
    771789            data.append('file', $('#te-json-file').prop('files')[0]);
    772790            $.ajax({
     
    778796                success: function(response) {
    779797                    if ('success' in response && response.success) {
    780                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     798                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    781799                    } else {
    782                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    783                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     800                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     801                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    784802                    }
    785803                },
    786804                error: function() {
    787                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    788                     window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     805                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     806                    window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    789807                }
    790808            });
     
    797815<h1><?php esc_html_e('Manage Template Parts', 'template-editor'); ?></h1>
    798816<p><?php esc_html_e('Every theme default template part (header, footer, etc) you have edited is listed here ...', 'template-editor'); ?></p>
    799 <h2><?php printf(esc_html__('Active Theme (%s) Template Parts', 'template-editor'), $active_theme); ?></h2>
     817<h2><?php
     818/* translators: active theme slug */
     819printf(esc_html__('Active Theme (%s) Template Parts', 'template-editor'), esc_html($active_theme)); ?></h2>
    800820<?php
    801821
     
    863883
    864884?>
    865 <h2><?php printf(__('Other Theme Template Parts', 'template-editor'), $active_theme); ?></h2>
     885<h2><?php printf(esc_html__('Other Theme Template Parts', 'template-editor'), esc_html($active_theme)); ?></h2>
    866886<?php
    867887
     
    942962        var data = {
    943963            action: 'te_download_wp_template',
    944             _ajax_nonce: '<?php echo wp_create_nonce('download-wp-template'); ?>',
     964            _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('download-wp-template')); ?>',
    945965            post_id: $(this).data('template-part').ID,
    946966            post_name: $(this).data('template-part').post_name
     
    978998            },
    979999            error: function() {
    980                 alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
     1000                alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
    9811001            }
    9821002        });
    9831003    });
    9841004    $('.te-part-delete').click(function() {
    985         if (confirm('<?php _e('Are you sure you want to delete the template part?', 'template-editor'); ?>')) {
     1005        if (confirm('<?php esc_html_e('Are you sure you want to delete the template part?', 'template-editor'); ?>')) {
    9861006            $('#te-part-delete').unbind('click')
    9871007            var data = {
    9881008                action: 'te_delete',
    989                 _ajax_nonce: '<?php echo wp_create_nonce('template-editor-delete'); ?>',
     1009                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('template-editor-delete')); ?>',
    9901010                post_id: $(this).data('template-part')
    9911011            };
     
    9961016                success: function(response) {
    9971017                    if ('success' in response && response.success) {
    998                         window.location.href = '<?php echo add_query_arg(array(
     1018                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    9991019                            'page' => 'template_editor',
    10001020                            'tab' => 'manage_template_parts'
    1001                         ), admin_url('themes.php')); ?>';
     1021                        ), admin_url('themes.php'))); ?>';
    10021022                    } else {
    1003                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1004                         window.location.href = '<?php echo add_query_arg(array(
     1023                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1024                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    10051025                            'page' => 'template_editor',
    10061026                            'tab' => 'manage_template_parts'
    1007                         ), admin_url('themes.php')); ?>';
     1027                        ), admin_url('themes.php'))); ?>';
    10081028                    }
    10091029                },
    10101030                error: function() {
    1011                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1012                     window.location.href = '<?php echo add_query_arg(array(
     1031                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1032                    window.location.href = '<?php echo esc_url(add_query_arg(array(
    10131033                            'page' => 'template_editor',
    10141034                            'tab' => 'manage_template_parts'
    1015                         ), admin_url('themes.php')); ?>';
     1035                        ), admin_url('themes.php'))); ?>';
    10161036                }
    10171037            });
     
    10221042    });
    10231043    $('#te-part-json-file').change(function() {
    1024         var confirmText = '<?php _e('Are you sure you want to upload %s as an active theme template part?', 'template-editor'); ?>';
     1044        var confirmText = '<?php
     1045/* translators: filename */
     1046esc_html_e('Are you sure you want to upload %s as an active theme template part?', 'template-editor'); ?>';
    10251047        if (confirm(confirmText.replace('%s', $('#te-part-json-file').prop('files')[0].name))) {
    10261048            var data = new FormData();
    10271049            data.append('action', 'te_upload_wp_template_part');
    1028             data.append('_ajax_nonce', '<?php echo wp_create_nonce('upload-wp-template-part'); ?>');
     1050            data.append('_ajax_nonce', '<?php echo esc_attr(wp_create_nonce('upload-wp-template-part')); ?>');
    10291051            data.append('file', $('#te-part-json-file').prop('files')[0]);
    10301052            $.ajax({
     
    10361058                success: function(response) {
    10371059                    if ('success' in response && response.success) {
    1038                         window.location.href = '<?php echo add_query_arg(array(
     1060                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    10391061                            'page' => 'template_editor',
    10401062                            'tab' => 'manage_template_parts'
    1041                         ), admin_url('themes.php')); ?>';
     1063                        ), admin_url('themes.php'))); ?>';
    10421064                    } else {
    1043                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1044                         window.location.href = '<?php echo add_query_arg(array(
     1065                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1066                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    10451067                            'page' => 'template_editor',
    10461068                            'tab' => 'manage_template_parts'
    1047                         ), admin_url('themes.php')); ?>';
     1069                        ), admin_url('themes.php'))); ?>';
    10481070                    }
    10491071                },
    10501072                error: function() {
    1051                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1052                     window.location.href = '<?php echo add_query_arg(array(
     1073                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1074                    window.location.href = '<?php echo esc_url(add_query_arg(array(
    10531075                            'page' => 'template_editor',
    10541076                            'tab' => 'manage_template_parts'
    1055                         ), admin_url('themes.php')); ?>';
     1077                        ), admin_url('themes.php'))); ?>';
    10561078                }
    10571079            });
     
    11301152        var data = {
    11311153            action: 'te_download_wp_global_styles',
    1132             _ajax_nonce: '<?php echo wp_create_nonce('download-wp-global-styles'); ?>',
     1154            _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('download-wp-global-styles')); ?>',
    11331155            post_id: $(this).data('global-styles').ID,
    11341156            theme: $(this).data('global-styles').theme
     
    11661188            },
    11671189            error: function() {
    1168                 alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
     1190                alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
    11691191            }
    11701192        });
    11711193    });
    11721194    $('.te-styles-delete').click(function() {
    1173         if (confirm('<?php _e('Are you sure you want to delete the selected global styles?', 'template-editor'); ?>')) {
     1195        if (confirm('<?php esc_html_e('Are you sure you want to delete the selected global styles?', 'template-editor'); ?>')) {
    11741196            $('#te-styles-delete').unbind('click')
    11751197            var data = {
    11761198                action: 'te_global_styles_delete',
    1177                 _ajax_nonce: '<?php echo wp_create_nonce('template-editor-delete'); ?>',
     1199                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('template-editor-delete')); ?>',
    11781200                post_id: $(this).data('global-styles')
    11791201            };
     
    11841206                success: function(response) {
    11851207                    if ('success' in response && response.success) {
    1186                         window.location.href = '<?php echo add_query_arg(array(
     1208                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    11871209                            'page' => 'template_editor',
    11881210                            'tab' => 'manage_global_styles'
    1189                         ), admin_url('themes.php')); ?>';
     1211                        ), admin_url('themes.php'))); ?>';
    11901212                    } else {
    1191                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1192                         window.location.href = '<?php echo add_query_arg(array(
     1213                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1214                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    11931215                            'page' => 'template_editor',
    11941216                            'tab' => 'manage_global_styles'
    1195                         ), admin_url('themes.php')); ?>';
     1217                        ), admin_url('themes.php'))); ?>';
    11961218                    }
    11971219                },
    11981220                error: function() {
    1199                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1200                     window.location.href = '<?php echo add_query_arg(array(
     1221                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1222                    window.location.href = '<?php echo esc_url(add_query_arg(array(
    12011223                            'page' => 'template_editor',
    12021224                            'tab' => 'manage_global_styles'
    1203                         ), admin_url('themes.php')); ?>';
     1225                        ), admin_url('themes.php'))); ?>';
    12041226                }
    12051227            });
     
    12101232    });
    12111233    $('#te-styles-json-file').change(function() {
    1212         var confirmText = '<?php _e('Are you sure you want to upload %s as the active theme\\\'s global styles?', 'template-editor'); ?>';
     1234        var confirmText = '<?php
     1235/* translators: filename */
     1236esc_html_e('Are you sure you want to upload %s as the active theme\\\'s global styles?', 'template-editor'); ?>';
    12131237        if (confirm(confirmText.replace('%s', $('#te-styles-json-file').prop('files')[0].name))) {
    12141238            var data = new FormData();
    12151239            data.append('action', 'te_upload_wp_global_styles');
    1216             data.append('_ajax_nonce', '<?php echo wp_create_nonce('upload-wp-global-styles'); ?>');
     1240            data.append('_ajax_nonce', '<?php echo esc_attr(wp_create_nonce('upload-wp-global-styles')); ?>');
    12171241            data.append('file', $('#te-styles-json-file').prop('files')[0]);
    12181242            $.ajax({
     
    12241248                success: function(response) {
    12251249                    if ('success' in response && response.success) {
    1226                         window.location.href = '<?php echo add_query_arg(array(
     1250                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    12271251                            'page' => 'template_editor',
    12281252                            'tab' => 'manage_global_styles'
    1229                         ), admin_url('themes.php')); ?>';
     1253                        ), admin_url('themes.php'))); ?>';
    12301254                    } else {
    1231                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1232                         window.location.href = '<?php echo add_query_arg(array(
     1255                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1256                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    12331257                            'page' => 'template_editor',
    12341258                            'tab' => 'manage_global_styles'
    1235                         ), admin_url('themes.php')); ?>';
     1259                        ), admin_url('themes.php'))); ?>';
    12361260                    }
    12371261                },
    12381262                error: function() {
    1239                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1240                     window.location.href = '<?php echo add_query_arg(array(
     1263                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1264                    window.location.href = '<?php echo esc_url(add_query_arg(array(
    12411265                            'page' => 'template_editor',
    12421266                            'tab' => 'manage_global_styles'
    1243                         ), admin_url('themes.php')); ?>';
     1267                        ), admin_url('themes.php'))); ?>';
    12441268                }
    12451269            });
     
    12741298                current_user_can('manage_options') &&
    12751299                isset($_POST['post_id']) && absint($_POST['post_id']) &&
    1276                 isset($_POST['post_title']) && sanitize_text_field($_POST['post_title']) &&
    1277                 isset($_POST['post_name']) && sanitize_title($_POST['post_name']) &&
    1278                 isset($_POST['post_excerpt']) && sanitize_text_field($_POST['post_excerpt']) &&
     1300                isset($_POST['post_title']) && sanitize_text_field(wp_unslash($_POST['post_title'])) &&
     1301                isset($_POST['post_name']) && sanitize_title(wp_unslash($_POST['post_name'])) &&
     1302                isset($_POST['post_excerpt']) && sanitize_text_field(wp_unslash($_POST['post_excerpt'])) &&
    12791303                isset($_POST['save_as_copy']) && in_array($_POST['save_as_copy'], ['0', '1'], true)
    12801304            ) {
    12811305
    12821306                $post_id = absint($_POST['post_id']);
    1283                 $post_title = sanitize_text_field($_POST['post_title']);
    1284                 $post_name = sanitize_title($_POST['post_name']);
    1285                 $post_excerpt = sanitize_text_field($_POST['post_excerpt']);
     1307                $post_title = sanitize_text_field(wp_unslash($_POST['post_title']));
     1308                $post_name = sanitize_title(wp_unslash($_POST['post_name']));
     1309                $post_excerpt = sanitize_text_field(wp_unslash($_POST['post_excerpt']));
    12861310                $save_as_copy = absint($_POST['save_as_copy']);
    12871311
     
    14541478            ) {
    14551479
    1456                 $json_data = file_get_contents($_FILES['file']['tmp_name']);
     1480                $json_data = file_get_contents(sanitize_text_field($_FILES['file']['tmp_name']));
    14571481                $template = false;
    14581482
     
    15321556            ) {
    15331557
    1534                 $json_data = file_get_contents($_FILES['file']['tmp_name']);
     1558                $json_data = file_get_contents(sanitize_text_field($_FILES['file']['tmp_name']));
    15351559                $global_styles = false;
    15361560
     
    16171641            ) {
    16181642
    1619                 $json_data = file_get_contents($_FILES['file']['tmp_name']);
     1643                $json_data = file_get_contents(sanitize_text_field($_FILES['file']['tmp_name']));
    16201644                $template = false;
    16211645
     
    17191743            } else {
    17201744
    1721                 add_settings_section('te_options', __('Fonts', 'template-editor'), 'template_editor_class::fonts_text_new', 'te_fonts');
     1745                $options = get_option('te_options');
     1746
     1747                if (
     1748                    isset($options['inject_google_fonts']) &&
     1749                    is_array($options['inject_google_fonts']) &&
     1750                    $options['inject_google_fonts']
     1751                ) {
     1752
     1753                    add_settings_section('te_options', __('Fonts', 'template-editor'), 'template_editor_class::fonts_text_new', 'te_fonts');
     1754
     1755                }
    17221756
    17231757            }
     
    17281762
    17291763?>
    1730 <p><?php echo sprintf(wp_kses(__('Here are some options for Full Site Editor themes. If you\'d like to see more options here, <a href="%s">let us know in the support forum</a>.', 'template-editor'), array('a' => array('href' => array(), 'class' => array()))), esc_url('https://wordpress.org/support/plugin/template-editor/')); ?></p>
     1764<p><?php
     1765/* translators: link to plugin support forum */
     1766echo sprintf(wp_kses(__('Here are some options for Full Site Editor themes. If you\'d like to see more options here, <a href="%s">let us know in the support forum</a>.', 'template-editor'), array('a' => array('href' => array(), 'class' => array()))), esc_url('https://wordpress.org/support/plugin/template-editor/')); ?></p>
    17311767<?php
    17321768
     
    17951831
    17961832?>
    1797 <p><?php echo __('We\'ve worked out how to inject Google Fonts into the Full Site Editor without modifying the theme or creating a child theme!', 'template-editor'); ?></p>
     1833<p><?php esc_html_e('We\'ve worked out how to inject Google Fonts into the Full Site Editor without modifying the theme or creating a child theme!', 'template-editor'); ?></p>
    17981834<?php
    17991835
     
    18051841
    18061842?>
    1807 <p><?php echo __('With the launch of WordPress v6.5 came the new "Font Library". This awesome core update allows you to manage fonts from the Site Editor.', 'template-editor'); ?></p>
    1808 <?php
    1809 
    1810             if (isset($options['inject_google_fonts']) && is_array($options['inject_google_fonts']) && $options['inject_google_fonts']) {
    1811 
    1812 ?>
    1813 <p style="color: red;"><strong><?php echo __('We notice that you use this plugin to inject the following Google fonts. If you haven\'t already you should use the Site Editor to add these fonts again:', 'template-editor'); ?>
    1814 <?php
    1815 
    1816                 $count_fonts = 0;
    1817 
    1818                 foreach ($options['inject_google_fonts'] as $font => $styles) {
    1819 
    1820                     if (!is_array($styles)) { $styles = array($styles); }
    1821 
    1822                     foreach ($styles as $key => $style) {
     1843<p><?php esc_html_e('With the launch of WordPress v6.5 came the new "Font Library". This awesome core update allows you to manage fonts from the Site Editor.', 'template-editor'); ?></p>
     1844<p style="color: red;"><strong><?php esc_html_e('We notice that you use this plugin to inject the following Google fonts. If you haven\'t already you should use the Site Editor to add these fonts again:', 'template-editor'); ?>
     1845<?php
     1846
     1847            $count_fonts = 0;
     1848
     1849            foreach ($options['inject_google_fonts'] as $font => $styles) {
     1850
     1851                if (!is_array($styles)) { $styles = array($styles); }
     1852
     1853                foreach ($styles as $key => $style) {
    18231854
    18241855?>
     
    18261857<?php
    18271858
    1828                         $count_fonts++;
    1829 
    1830                     }
    1831 
    1832                 }
     1859                    $count_fonts++;
     1860
     1861                }
     1862
     1863            }
    18331864
    18341865?>
    18351866</strong></p>
    1836 <p><?php echo __('Go to "Dashboard - Appearance - Editor - Styles - <edit pencil icon> - Typography". From there click on any font to enter the "Font Library". It is important that you first remove the above Google fonts then re-install them using the "Install Fonts" tab of the "Font Library".', 'template-editor'); ?></p>
    1837 <?php
    1838 
    1839             }
     1867<p><?php esc_html_e('Go to "Dashboard - Appearance - Editor - Styles - <edit pencil icon> - Typography". From there click on any font to enter the "Font Library". It is important that you first remove the above Google fonts then re-install them using the "Install Fonts" tab of the "Font Library".', 'template-editor'); ?></p>
     1868<?php
    18401869
    18411870        }
     
    19882017                'block' => esc_html__('"block" - Wait until the font has loaded before drawing the text.', 'template-editor'),
    19892018                'swap' => esc_html__('"swap" - Draw the text straight away then re-draw the text when the font has loaded.', 'template-editor'),
    1990                 'fallback' => sprintf(esc_html__('"fallback" - Waits for a %1$svery%2$s short time before drawing the text anyway if the font hasn\'t yet loaded then re-draws the text if the font loads shortly after.', 'template-editor'),'<strong>','</strong>'),
    1991                 'optional' => sprintf(esc_html__('"optional" - Waits for a %1$svery%2$s short time before drawing the text anyway but %1$sdoesn\'t%2$s re-draw when the font loads.', 'template-editor'),'<strong>','</strong>')
     2019                'fallback' => wp_kses(sprintf('%1$s<strong>%2$s</strong>%3$s', __('"fallback" - Waits for a ', 'template-editor'), __('very', 'template-editor'), __(' short time before drawing the text anyway if the font hasn\'t yet loaded then re-draws the text if the font loads shortly after.', 'template-editor')), 'post'),
     2020                'optional' => wp_kses(sprintf('%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>%5$s', __('"optional" - Waits for a ', 'template-editor'), __('very', 'template-editor'), __(' short time before drawing the text anyway but ', 'template-editor'), __('doesn\'t', 'template-editor'), __(' re-draw when the font loads.', 'template-editor')), 'post'),
    19922021            );
    19932022
     
    20012030
    20022031?>
    2003 <label for="google-font-display-<?php echo $key; ?>">
    2004 <input type="radio" id="google-font-display-<?php echo $key; ?>" name="te_options[google_font_display]" value="<?php echo $key; ?>"<?php if (isset($options['google_font_display'])) { checked($options['google_font_display'], $key); } else { checked('auto', $key); } ?>>
    2005 <?php echo $value ?>
     2032<label for="google-font-display-<?php echo esc_attr($key); ?>">
     2033<input type="radio" id="google-font-display-<?php echo esc_attr($key); ?>" name="te_options[google_font_display]" value="<?php echo esc_attr($key); ?>"<?php if (isset($options['google_font_display'])) { checked($options['google_font_display'], $key); } else { checked('auto', $key); } ?>>
     2034<?php echo esc_html($value) ?>
    20062035</label>
    20072036<?php
     
    20362065
    20372066                remove_filter('wp_theme_json_data_theme', 'template_editor_class::wp_theme_json_data_theme');
     2067// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
    20382068                $theme_json = apply_filters('wp_theme_json_data_theme', new WP_Theme_JSON_Data($theme_json_data, 'theme'));
    20392069                add_filter('wp_theme_json_data_theme', 'template_editor_class::wp_theme_json_data_theme');
     
    23792409                    $css_import_string .= '&display=' . (isset($options['google_font_display']) ? sanitize_key($options['google_font_display']) : 'auto');
    23802410
    2381                     $google_request = wp_safe_remote_get($css_import_string,  array(
    2382                         'user-agent' => $_SERVER['HTTP_USER_AGENT']
    2383                     ));
     2411                    $google_request = wp_safe_remote_get($css_import_string,  (isset($_SERVER['HTTP_USER_AGENT']) ? array(
     2412                        'user-agent' => sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT']))
     2413                    ) : array()));
    23842414
    23852415                    $abort_font_download = false;
     
    23982428                            $google_fonts = array_unique($google_fonts[1]);
    23992429
     2430                            global $wp_filesystem;
     2431
     2432                            if (!$wp_filesystem) {
     2433
     2434                                require_once (ABSPATH . '/wp-admin/includes/file.php');
     2435
     2436                                WP_Filesystem();
     2437
     2438                            }
     2439
    24002440                            if (!is_dir($filepath)) {
    24012441
    2402                                 mkdir($filepath);
     2442                                $wp_filesystem->mkdir($filepath);
    24032443
    24042444                            } else {
     
    24062446                                $fileSystemDirect = new WP_Filesystem_Direct(false);
    24072447                                $fileSystemDirect->rmdir($filepath, true);
    2408                                 mkdir($filepath);
     2448                                $wp_filesystem->mkdir($filepath);
    24092449
    24102450                            }
     
    24142454                            foreach ($google_fonts as $google_font_url) {
    24152455
    2416                                 $google_font = wp_safe_remote_get($google_font_url,  array(
    2417                                     'user-agent' => $_SERVER['HTTP_USER_AGENT']
    2418                                 ));
     2456                                $google_font = wp_safe_remote_get($google_font_url,  (isset($_SERVER['HTTP_USER_AGENT']) ? array(
     2457                                    'user-agent' => sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT']))
     2458                                ) : array()));
    24192459
    24202460                                if (
     
    24272467                                    $google_font_filename = wp_basename($google_font_url);
    24282468                                    $wp_filesystem->put_contents($filepath . $google_font_filename, $google_font['body']);
    2429                                     $parse_url = parse_url($upload_dir['baseurl']);
     2469                                    $parse_url = wp_parse_url($upload_dir['baseurl']);
    24302470
    24312471                                    $google_font_css = str_replace(
     
    25972637                        headerWrapper.classList.add('shrink-logo');
    25982638                        if ('undefined' !== customLogo.length) {
    2599                             customLogo.style.width = '<?php echo $new_logo_width; ?>px';
    2600                             customLogo.style.height = '<?php echo (false !== $new_logo_height ? $new_logo_height : 48); ?>px';
     2639                            customLogo.style.width = '<?php echo esc_attr($new_logo_width); ?>px';
     2640                            customLogo.style.height = '<?php echo esc_attr(false !== $new_logo_height ? $new_logo_height : 48); ?>px';
    26012641                        }
    26022642                    }
     
    27572797                return str_replace(
    27582798                    '[HTTP_HOST]',
    2759                     'http' . (is_ssl() ? 's' : '') . '://' . $_SERVER['HTTP_HOST'],
     2799                    'http' . (is_ssl() ? 's' : '') . '://' . (isset($_SERVER['HTTP_HOST']) ? sanitize_url(wp_unslash($_SERVER['HTTP_HOST'])) : gethostname()),
    27602800                    $options['google_font_css']
    27612801                );
     
    28952935    if (version_compare(get_bloginfo('version'), '5.8', '>=')) {
    28962936
    2897         $template_editor_object = new template_editor_class();
     2937        new template_editor_class();
    28982938
    28992939    } else {
     
    29152955<div class="notice notice-error">
    29162956
    2917 <p><strong><?php esc_html_e('Template Editor Plugin Error', 'template-editor'); ?></strong><br />
     2957<p><strong><?php esc_html_e('Options for Block Themes Plugin Error', 'template-editor'); ?></strong><br />
    29182958<?php
    29192959
    29202960        printf(
    2921             __('This plugin requires at least WordPress v5.8 to be installed in order to function. Your WordPress version "%s" is not compatible.', 'template-editor'),
    2922             get_bloginfo('version')
     2961/* translators: WordPress version */
     2962            esc_html(__('This plugin requires at least WordPress v5.8 to be installed in order to function. Your WordPress version "%s" is not compatible.', 'template-editor')),
     2963            esc_html(get_bloginfo('version'))
    29232964        );
    29242965
     
    29262967
    29272968<p><a class="button" href="<?php echo esc_url(admin_url('update-core.php')); ?>" title="<?php esc_attr_e('WordPress Updates', 'template-editor'); ?>"><?php
    2928         _e('WordPress Updates', 'template-editor');
     2969        esc_html_e('WordPress Updates', 'template-editor');
    29292970?></a>.</p>
    29302971
  • template-editor/trunk/includes/class-te-common.php

    r2986060 r3422724  
    11<?php
    22/*
    3  * Version: 1.3.9
     3 * Version: 1.4.4
    44 */
    55
     
    4343        public static function plugin_text_domain() {
    4444
    45             return self::$plugin_text_domain;
     45            return 'template-editor';
    4646
    4747        }
     
    6161        public static function support_url() {
    6262
    63             return 'https://wordpress.org/support/plugin/' . self::$plugin_text_domain . '/';
     63            return 'https://wordpress.org/support/plugin/' . 'template-editor' . '/';
    6464
    6565        }
     
    6767        public static function control_upgrade_text() {
    6868
    69             $upgrade_text = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name)) . '">' . sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name) . '</a>';
     69/* translators: name of the plugin */
     70            $upgrade_text = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Upgrade now to %s Premium', 'template-editor'), self::$plugin_name)) . '">' . sprintf(__('Upgrade now to %s Premium', 'template-editor'), self::$plugin_name) . '</a>';
    7071
    7172            if (!class_exists(self::$plugin_premium_class) || !get_option(self::$plugin_prefix . '_purchased')) {
     
    7374                if (!class_exists(self::$plugin_premium_class)) {
    7475
    75                     $upgrade_text .= sprintf(wp_kses(__(' or <a href="%s" title="Download Free Trial">trial it for 7 days</a>', self::$plugin_text_domain), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::premium_link()));
     76/* translators: link to the premium upgrade */
     77                    $upgrade_text .= sprintf(wp_kses(__(' or <a href="%s" title="Download Free Trial">trial it for 7 days</a>', 'template-editor'), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::premium_link()));
    7678
    7779                }
     
    8587        public static function control_section_description() {
    8688
    87             $default_description = sprintf(wp_kses(__('If you have any requests for new features, please <a href="%s" title="Support Forum">let us know in the support forum</a>.', self::$plugin_text_domain), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::support_url()));
     89/* translators: link to the plugin's support forum */
     90            $default_description = sprintf(wp_kses(__('If you have any requests for new features, please <a href="%s" title="Support Forum">let us know in the support forum</a>.', 'template-editor'), array('a' => array('href' => array(), 'title' => array()))), esc_url(self::support_url()));
    8891
    8992            if (self::$plugin_premium_class) {
     
    9598                    if (!class_exists(self::$plugin_premium_class)) {
    9699
    97                         $section_description = '<strong>' . __('For even more options', self::$plugin_text_domain) . '</strong>' . ' ' . $upgrade_text;
     100                        $section_description = '<strong>' . __('For even more options', 'template-editor') . '</strong>' . ' ' . $upgrade_text;
    98101
    99102                    } else {
    100103
    101                         $section_description = '<strong>' . __('To keep using premium options', self::$plugin_text_domain) . '</strong>' . ' ' . $upgrade_text;
     104                        $section_description = '<strong>' . __('To keep using premium options', 'template-editor') . '</strong>' . ' ' . $upgrade_text;
    102105
    103106                    }
     
    119122                $section_description .= ' ' . sprintf(
    120123                    wp_kses(
     124/* translators: link to plugin install page */
    121125                        __(
    122126                            '<strong>To reset this section of options to default settings</strong> without affecting other sections in the customizer, install <a href="%s" title="Reset Customizer">Reset Customizer</a>.',
    123                             self::$plugin_text_domain
     127                            'template-editor'
    124128                        ),
    125129                        array('strong' => array(), 'a' => array('href' => array(), 'title' => array()))
     
    145149        public static function control_setting_upgrade_nag() {
    146150
    147             $upgrade_nag = self::control_upgrade_text() . __(' to use this option.', self::$plugin_text_domain);
     151            $upgrade_nag = self::control_upgrade_text() . __(' to use this option.', 'template-editor');
    148152
    149153            return $upgrade_nag;
     
    234238
    235239                $generated_css = sprintf('%s { %s: %s; }', $selector, $style, $prefix.$mod.$postfix);
    236                 echo $generated_css;
     240
     241// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     242                echo wp_strip_all_tags($generated_css);
    237243
    238244            } elseif ($mod) {
    239245
    240246                $generated_css = sprintf('%s { %s:%s; }', $selector, $style, $prefix.$value.$postfix);
    241                 echo $generated_css;
     247
     248// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     249                echo wp_strip_all_tags($generated_css);
    242250
    243251            }
     
    249257            if (self::$plugin_premium_class) {
    250258
    251                 return add_query_arg('url', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'], 'https://webd.uk/product/' . self::$plugin_text_domain . '-upgrade/');
    252 
     259                if (isset($_SERVER['HTTP_HOST'])) {
     260
     261                    return add_query_arg('url', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . filter_var(wp_unslash($_SERVER['HTTP_HOST'], FILTER_SANITIZE_URL)), 'https://webd.uk/product/' . 'template-editor' . '-upgrade/');
     262
     263                } else {
     264
     265                    return 'https://webd.uk/product/' . 'template-editor' . '-upgrade/';
     266
     267                }
    253268
    254269            } else {
     
    276291            $settings_links = array();
    277292
    278             $settings_links[] = '<a href="' . esc_url($settings_link) . '" title="' . esc_attr(__('Settings', self::$plugin_text_domain)) . '">' . __('Settings', self::$plugin_text_domain) . '</a>';
     293            $settings_links[] = '<a href="' . esc_url($settings_link) . '" title="' . esc_attr(__('Settings', 'template-editor')) . '">' . __('Settings', 'template-editor') . '</a>';
    279294
    280295            if (!get_option(self::$plugin_prefix . '_purchased')) {
     
    284299                    if (self::$plugin_upgrade) {
    285300
    286                         $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s Premium', self::$plugin_text_domain), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', self::$plugin_text_domain) . '</a>';
     301/* translators: name of the plugin */
     302                        $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s Premium', 'template-editor'), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', 'template-editor') . '</a>';
    287303
    288304                    } else {
    289305
    290                         $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s', self::$plugin_text_domain), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', self::$plugin_text_domain) . '</a>';
     306/* translators: name of the plugin */
     307                        $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr(sprintf(__('Buy %s', 'template-editor'), self::$plugin_name)) . '" style="color: orange; font-weight: bold;">' . __('Buy Now', 'template-editor') . '</a>';
    291308
    292309                    }
     
    294311                } else {
    295312
    296                     $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr((self::$plugin_premium_class ? sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name) : sprintf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name))) . '" style="color: orange; font-weight: bold;">' . (self::$plugin_premium_class ? __('Upgrade', self::$plugin_text_domain) : __('Support Us', self::$plugin_text_domain)) . '</a>';
     313/* translators: name of the plugin */
     314                    $settings_links[] = '<a href="' . esc_url(self::upgrade_link()) . '" title="' . esc_attr((self::$plugin_premium_class ? sprintf(__('Upgrade now to %s Premium', 'template-editor'), self::$plugin_name) : sprintf(__('Contribute to %s', 'template-editor'), self::$plugin_name))) . '" style="color: orange; font-weight: bold;">' . (self::$plugin_premium_class ? __('Upgrade', 'template-editor') : __('Support Us', 'template-editor')) . '</a>';
    297315
    298316                }
     
    300318                if ($premium) {
    301319
    302                     $settings_links[] = '<a href="' . wp_nonce_url('?activate-' . self::$plugin_prefix . '=true', self::$plugin_prefix . '_activate') . '" id="' . self::$plugin_prefix . '_activate_upgrade" title="' . esc_attr(__('Activate Purchase', self::$plugin_text_domain)) . '" onclick="jQuery(this).append(&#39; <img src=&#34;/wp-admin/images/loading.gif&#34; style=&#34;float: none; width: auto; height: auto;&#34; />&#39;); setTimeout(function(){document.getElementById(\'' . self::$plugin_prefix . '_activate_upgrade\').removeAttribute(\'href\');},1); return true;">' . __('Activate Purchase', self::$plugin_text_domain) . '</a>';
    303 
    304                 } elseif (self::$plugin_trial && !is_plugin_active(self::$plugin_text_domain . '-premium/' . self::$plugin_text_domain . '-premium.php')) {
    305 
    306                     $settings_links[] = '<a href="' . esc_url(self::premium_link()) . '" title="' . esc_attr(sprintf(__('Trial %s Premium', self::$plugin_text_domain), self::$plugin_name)) . ' for 7 days">' . __('Download Trial', self::$plugin_text_domain) . '</a>';
     320                    $settings_links[] = '<a href="' . wp_nonce_url('?activate-' . self::$plugin_prefix . '=true', self::$plugin_prefix . '_activate') . '" id="' . self::$plugin_prefix . '_activate_upgrade" title="' . esc_attr(__('Activate Purchase', 'template-editor')) . '" onclick="jQuery(this).append(&#39; <img src=&#34;/wp-admin/images/loading.gif&#34; style=&#34;float: none; width: auto; height: auto;&#34; />&#39;); setTimeout(function(){document.getElementById(\'' . self::$plugin_prefix . '_activate_upgrade\').removeAttribute(\'href\');},1); return true;">' . __('Activate Purchase', 'template-editor') . '</a>';
     321
     322                } elseif (self::$plugin_trial && !is_plugin_active('template-editor' . '-premium/' . 'template-editor' . '-premium.php')) {
     323
     324/* translators: name of the plugin */
     325                    $settings_links[] = '<a href="' . esc_url(self::premium_link()) . '" title="' . esc_attr(sprintf(__('Trial %s Premium', 'template-editor'), self::$plugin_name)) . ' for 7 days">' . __('Download Trial', 'template-editor') . '</a>';
    307326
    308327                }
     
    310329            } elseif ($premium) {
    311330
    312                 $settings_links[] = '<strong style="color: green; display: inline;">' . __('Purchase Confirmed', self::$plugin_text_domain) . '</strong>';
     331                $settings_links[] = '<strong style="color: green; display: inline;">' . __('Purchase Confirmed', 'template-editor') . '</strong>';
    313332
    314333            }
     
    320339        public static function plugin_row_meta($plugin_meta, $plugin_file, $plugin_data, $status) {
    321340
    322             if ($plugin_file === self::$plugin_text_domain . '/' . self::$plugin_text_domain . '.php') {
    323 
    324                 $plugin_meta[] = '<a href="' . esc_url(self::support_url()) . '" title="' . __('Problems? We are here to help!', self::$plugin_text_domain) . '" style="color: orange; font-weight: bold;">' . __('Need help?', self::$plugin_text_domain) . '</a>';
    325                 $plugin_meta[] = '<a href="https://wordpress.org/support/plugin/' . self::$plugin_text_domain . '/reviews/#new-post" title="' . esc_attr(sprintf(__('If you like %s, please leave a review!', self::$plugin_text_domain), self::$plugin_name)) . '">' . __('Review plugin', self::$plugin_text_domain) . '</a>';
     341            if ($plugin_file === 'template-editor' . '/' . 'template-editor' . '.php') {
     342
     343                $plugin_meta[] = '<a href="' . esc_url(self::support_url()) . '" title="' . __('Problems? We are here to help!', 'template-editor') . '" style="color: orange; font-weight: bold;">' . __('Need help?', 'template-editor') . '</a>';
     344/* translators: name of the plugin */
     345                $plugin_meta[] = '<a href="https://wordpress.org/support/plugin/' . 'template-editor' . '/reviews/#new-post" title="' . esc_attr(sprintf(__('If you like %s, please leave a review!', 'template-editor'), self::$plugin_name)) . '">' . __('Review plugin', 'template-editor') . '</a>';
    326346
    327347            }
     
    353373            if (self::$plugin_premium_class) {
    354374
    355                 if (get_option(self::$plugin_prefix . '_purchased') && !class_exists(self::$plugin_premium_class) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()) {
    356 
    357 ?>
    358 
    359 <div class="notice notice-error is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    360 
    361 <p><strong><?php echo self::$plugin_name; ?></strong><br />
    362 <?php esc_html_e('In order to use the premium features, you need to install the premium version of the plugin ...', self::$plugin_text_domain); ?></p>
    363 
    364 <p><a href="<?php echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Download %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Download %s Premium', self::$plugin_text_domain), self::$plugin_name); ?></a></p>
     375                if (
     376                    get_option(self::$plugin_prefix . '_purchased') &&
     377                    !class_exists(self::$plugin_premium_class) &&
     378                    get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()
     379                ) {
     380
     381?>
     382
     383<div class="notice notice-error is-dismissible <?php echo esc_html(self::$plugin_prefix); ?>-notice">
     384
     385<p><strong><?php echo esc_html(self::$plugin_name); ?></strong><br />
     386<?php esc_html_e('In order to use the premium features, you need to install the premium version of the plugin ...', 'template-editor'); ?></p>
     387
     388<p><a href="<?php
     389/* translators: name of the plugin */
     390echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Download %s Premium', 'template-editor'), self::$plugin_name)); ?>" class="button-primary"><?php printf(esc_html(__('Download %s Premium', 'template-editor')), esc_html(self::$plugin_name)); ?></a></p>
    365391
    366392</div>
    367393
    368394<script type="text/javascript">
    369     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     395    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    370396        jQuery.ajax({
    371397            url: ajaxurl,
    372398            data: {
    373                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    374                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     399                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     400                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    375401            }
    376402        });
     
    380406<?php
    381407
    382                 } elseif (!class_exists(self::$plugin_premium_class) && time() > (strtotime('+1 hour', filectime(__DIR__))) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()) {
    383 
    384 ?>
    385 
    386 <div class="notice notice-info is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    387 
    388 <p><strong><?php printf(__('Thank you for using %s plugin', self::$plugin_text_domain), self::$plugin_name); ?></strong><br />
     408                } elseif (
     409                    !class_exists(self::$plugin_premium_class) &&
     410                    time() > (strtotime('+1 hour', filectime(__DIR__))) &&
     411                    get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version()
     412                ) {
     413
     414?>
     415
     416<div class="notice notice-info is-dismissible <?php echo esc_attr(self::$plugin_prefix); ?>-notice">
     417
     418    <p style="font-size:15px;"><strong><?php
     419/* translators: name of the plugin */
     420printf(esc_html(__('Thank you for using %s plugin', 'template-editor')), esc_html(self::$plugin_name)); ?></strong></p>
    389421<?php
    390422
    391423                    if (self::$plugin_trial == true) {
    392424
    393                         _e('Would you like to try even more features? Download your 7 day free trial now!', self::$plugin_text_domain);
     425?>
     426
     427    <p><?php echo esc_html(__('Would you like to try even more features? Download your 7 day free trial now!', 'template-editor')); ?></p>
     428<?php
    394429
    395430                    } else {
    396431
    397                         echo sprintf(__('Upgrade now to %s Premium to enable more options and features and contribute to the further development of this plugin.', self::$plugin_text_domain), self::$plugin_name);
     432?>
     433
     434    <p>
     435        <?php
     436/* translators: name of the plugin */
     437                        echo esc_html(sprintf(__('Upgrade now to %s Premium to enable more options and features and contribute to the further development of this plugin.', 'template-editor'), self::$plugin_name)); ?>
     438    </p>
     439<?php
    398440
    399441                    }
    400442
    401 ?></p>
    402 
    403 <p><?php
     443?>
     444
     445    <p><?php
    404446
    405447                    if (self::$plugin_trial == true) {
     
    407449?>
    408450
    409 <a href="<?php echo esc_url(self::premium_link()); ?>" title="<?php echo esc_attr(sprintf(__('Try %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Trial %s Premium for 7 days', self::$plugin_text_domain), self::$plugin_name); ?></a>
    410 
     451        <a href="<?php echo esc_url(self::premium_link()); ?>"
     452           title="<?php
     453/* translators: name of the plugin */
     454echo esc_attr(sprintf(__('Try %s Premium', 'template-editor'), self::$plugin_name)); ?>"
     455           class="button-secondary">
     456           <?php echo esc_html(__('Try premium plugin free for 7 days', 'template-editor')); ?>
     457        </a>
    411458<?php
    412459
     
    414461
    415462?>
    416 <a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php echo esc_attr(sprintf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Upgrade now to %s Premium', self::$plugin_text_domain), self::$plugin_name); ?></a></p>
     463
     464        <a href="<?php echo esc_url(self::upgrade_link()); ?>"
     465           title="<?php
     466/* translators: name of the plugin */
     467echo esc_attr(sprintf(__('Upgrade now to %s Premium', 'template-editor'), self::$plugin_name)); ?>"
     468           class="button-primary">
     469           <?php echo esc_html(__('Upgrade now to premium plugin', 'template-editor')); ?>
     470        </a>
     471
     472    </p>
     473
     474    <hr style="margin:12px 0;">
     475
     476    <p>
     477        <strong>✨ Need help with your WordPress site?</strong>
     478        🚀 Slow, want new features, or need a glow-up?
     479        <a href="https://webd.uk/services/?utm_campaign=notice&utm_term=template-editor" class="button-secondary" style="margin-left:6px; vertical-align: middle;">Explore our services</a>
     480    </p>
    417481
    418482</div>
    419483
    420484<script type="text/javascript">
    421     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     485    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    422486        jQuery.ajax({
    423487            url: ajaxurl,
    424488            data: {
    425                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    426                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     489                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     490                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    427491            }
    428492        });
     
    434498                }
    435499
    436             } elseif (time() > (strtotime('+1 hour', filectime(__DIR__))) && get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version() && !get_option(self::$plugin_prefix . '_donated')) {
    437 
    438 ?>
    439 
    440 <div class="notice notice-info is-dismissible <?php echo self::$plugin_prefix; ?>-notice">
    441 <p><strong><?php printf(__('Thank you for using %s plugin', self::$plugin_text_domain), self::$plugin_name); ?></strong></p>
    442 <?php
    443 
     500            } elseif (
     501                time() > (strtotime('+1 hour', filectime(__DIR__))) &&
     502                get_user_meta(get_current_user_id(), self::$plugin_prefix . '-notice-dismissed', true) != self::plugin_version() &&
     503                !get_option(self::$plugin_prefix . '_donated')
     504            ) {
     505
     506?>
     507
     508<div class="notice notice-info is-dismissible <?php echo esc_attr(self::$plugin_prefix); ?>-notice">
     509
     510    <p><strong><?php
     511/* translators: name of the plugin */
     512printf(esc_html(__('Thank you for using %s plugin', 'template-editor')), esc_html(self::$plugin_name)); ?></strong></p>
     513<?php
     514
     515// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
    444516                do_action(self::$plugin_prefix . '_admin_notice_donate');
    445517
    446518?>
    447 <p><?php esc_html_e('Funding plugins like this one with small financial contributions is essential to pay the developers to continue to do what they do. Please take a moment to give a small amount ...', self::$plugin_text_domain); ?></p>
    448 <p><a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php echo esc_attr(sprintf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name)); ?>" class="button-primary"><?php printf(__('Contribute to %s', self::$plugin_text_domain), self::$plugin_name); ?></a> <a href="#" id="<?php echo self::$plugin_prefix; ?>-already-paid" title="<?php echo esc_attr(__('Aleady Contributed!', self::$plugin_text_domain)); ?>" class="button-primary"><?php esc_html_e('Aleady Contributed!', self::$plugin_text_domain); ?></a></p>
     519
     520    <p><?php esc_html_e('Funding plugins like this one with small financial contributions is essential to pay the developers to continue to do what they do. Please take a moment to give a small amount ...', 'template-editor'); ?></p>
     521
     522    <p><a href="<?php echo esc_url(self::upgrade_link()); ?>" title="<?php
     523/* translators: name of the plugin */
     524echo esc_attr(sprintf(__('Contribute to %s', 'template-editor'), self::$plugin_name)); ?>" class="button-primary"><?php echo esc_html(__('Buy us a coffee ☕️', 'template-editor')); ?></a> <a href="#" id="<?php echo esc_attr(self::$plugin_prefix); ?>-already-paid" title="<?php echo esc_attr(__('Aleady Contributed!', 'template-editor')); ?>" class="button-secondary"><?php esc_html_e('Aleady Contributed!', 'template-editor'); ?></a></p>
     525
     526    <hr style="margin:12px 0;">
     527
     528    <p>
     529        <strong>✨ Need help with your WordPress site?</strong>
     530        🚀 Slow, want new features, or need a glow-up?
     531        <a href="https://webd.uk/services/?utm_campaign=notice&utm_term=template-editor" class="button-secondary" style="margin-left:6px; vertical-align: middle;">Explore our services</a>
     532    </p>
     533
    449534</div>
    450535
    451536<script type="text/javascript">
    452     jQuery(document).on('click', '#<?php echo self::$plugin_prefix; ?>-already-paid', function() {
    453         if (confirm(<?php echo json_encode(__('Have you really? Press "Cancel" if you forgot to 🙂', self::$plugin_text_domain)); ?>)) {
    454             alert(<?php echo json_encode(__('Thank you!', self::$plugin_text_domain)); ?>);
    455             jQuery('.<?php echo self::$plugin_prefix; ?>-notice').fadeTo(100, 0, function() {
    456                 jQuery('.<?php echo self::$plugin_prefix; ?>-notice').slideUp(100, function() {
    457                     jQuery('.<?php echo self::$plugin_prefix; ?>-notice').remove()
     537    jQuery(document).on('click', '#<?php echo esc_attr(self::$plugin_prefix); ?>-already-paid', function() {
     538        if (confirm(<?php echo json_encode(__('Have you really? Press "Cancel" if you forgot to 🙂', 'template-editor')); ?>)) {
     539            alert(<?php echo json_encode(__('Thank you!', 'template-editor')); ?>);
     540            jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').fadeTo(100, 0, function() {
     541                jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').slideUp(100, function() {
     542                    jQuery('.<?php echo esc_attr(self::$plugin_prefix); ?>-notice').remove()
    458543                });
    459544            });
     
    461546                url: ajaxurl,
    462547                data: {
    463                     action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
     548                    action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
    464549                    donated: 'true',
    465                     _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     550                    _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    466551                }
    467552            });
    468553        } else {
    469             window.location.assign('<?php echo self::upgrade_link(); ?>');
     554            window.location.assign('<?php echo esc_url(self::upgrade_link()); ?>');
    470555        }
    471556    });
    472     jQuery(document).on('click', '.<?php echo self::$plugin_prefix; ?>-notice .notice-dismiss', function() {
     557    jQuery(document).on('click', '.<?php echo esc_attr(self::$plugin_prefix); ?>-notice .notice-dismiss', function() {
    473558        jQuery.ajax({
    474559            url: ajaxurl,
    475560            data: {
    476                 action: 'dismiss_<?php echo self::$plugin_prefix; ?>_notice_handler',
    477                 _ajax_nonce: '<?php echo wp_create_nonce(self::$plugin_prefix . '-ajax-nonce'); ?>'
     561                action: 'dismiss_<?php echo esc_attr(self::$plugin_prefix); ?>_notice_handler',
     562                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce(self::$plugin_prefix . '-ajax-nonce')); ?>'
    478563            }
    479564        });
     
    509594                    is_admin() &&
    510595                    $pagenow === 'customize.php' &&
    511                     isset($_GET['theme']) &&
    512                     !in_array($_GET['theme'], $themes, true)
     596                    isset($_GET['theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     597                    !in_array($_GET['theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    513598                ) && !(
    514599                    !is_admin() &&
    515600                    $pagenow === 'index.php' &&
    516                     isset($_GET['customize_theme']) &&
    517                     isset($_GET['customize_changeset_uuid']) &&
    518                     !in_array($_GET['customize_theme'], $themes, true)
     601                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     602                    isset($_GET['customize_changeset_uuid']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     603                    !in_array($_GET['customize_theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    519604                )
    520605            ) {
     
    530615                    is_admin() &&
    531616                    $pagenow === 'customize.php' &&
    532                     isset($_GET['theme']) &&
    533                     in_array($_GET['theme'], $themes, true)
     617                    isset($_GET['theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     618                    in_array($_GET['theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    534619                ) || (
    535620                    !is_admin() &&
    536621                    $pagenow === 'index.php' &&
    537                     isset($_GET['customize_theme']) &&
    538                     isset($_GET['customize_changeset_uuid']) &&
    539                     in_array($_GET['customize_theme'], $themes, true)
     622                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     623                    isset($_GET['customize_changeset_uuid']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     624                    in_array($_GET['customize_theme'], $themes, true) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    540625                ))
    541626            ) {
     
    549634                    !is_admin() &&
    550635                    $pagenow === 'index.php' &&
    551                     isset($_GET['customize_theme']) &&
    552                     isset($_GET['customize_changeset_uuid'])
     636                    isset($_GET['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     637                    isset($_GET['customize_changeset_uuid']) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    553638               
    554639            ) {
    555640
    556                 $child = wp_get_theme($_GET['customize_theme']);
     641                $child = wp_get_theme(sanitize_file_name(wp_unslash($_GET['customize_theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    557642
    558643                if (isset($child->template) && in_array($child->template, $themes, true)) {
     
    568653                is_admin() &&
    569654                ($pagenow === 'customize.php' || $pagenow === 'admin-ajax.php') &&
    570                 isset($_GET['theme']) || (isset($_POST['customize_theme']) && isset($_POST['customize_changeset_uuid']))
     655                (
     656                    isset($_GET['theme']) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     657                    (
     658                        isset($_POST['customize_theme']) && // phpcs:ignore WordPress.Security.NonceVerification.Missing
     659                        isset($_POST['customize_changeset_uuid']) // phpcs:ignore WordPress.Security.NonceVerification.Missing
     660                    )
     661                )
    571662            ) {
    572663
    573                 if (isset($_GET['theme'])) {
    574 
    575                     $child = wp_get_theme($_GET['theme']);
     664                if (isset($_GET['theme'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     665
     666                    $child = wp_get_theme(sanitize_file_name(wp_unslash($_GET['theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
    576667
    577668                } else {
    578669
    579                     $child = wp_get_theme($_POST['customize_theme']);
     670                    $child = wp_get_theme(sanitize_file_name(wp_unslash($_POST['customize_theme']))); // phpcs:ignore WordPress.Security.NonceVerification.Missing
    580671
    581672                }
     
    599690if (!function_exists('webd_customize_register')) {
    600691
     692// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
    601693    function webd_customize_register($wp_customize) {
    602694
    603695        if (!class_exists('webd_Customize_Control_Checkbox_Multiple')) {
    604696
     697// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
    605698            class webd_Customize_Control_Checkbox_Multiple extends WP_Customize_Control {
    606699
     
    622715
    623716?>
    624 <span class="description customize-control-description"><?php echo $this->description; ?></span>
     717<span class="description customize-control-description"><?php echo esc_html($this->description); ?></span>
    625718<?php
    626719
     
    647740?>
    648741        </ul>
    649         <input type="hidden" id="_customize-input-<?php echo $this->id; ?>" <?php $this->link(); ?> value="<?php echo esc_attr(implode(',', $multi_values)); ?>" />
     742        <input type="hidden" id="_customize-input-<?php echo esc_attr($this->id); ?>" <?php $this->link(); ?> value="<?php echo esc_attr(implode(',', $multi_values)); ?>" />
    650743<?php
    651744
  • template-editor/trunk/readme.txt

    r3409463 r3422724  
    22Contributors: domainsupport
    33Donate link: https://webd.uk/product/support-us/
    4 Tags: block theme, templates, template parts, google fonts, global styles
     4Tags: block theme, templates, template parts, block options, global styles
    55Requires at least: 5.8
    66Tested up to: 6.9
    77Requires PHP: 5.6
    8 Stable tag: 1.4.1
     8Stable tag: 1.4.2
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 Import / Export global styles, templates and template parts to Full Site Editing / Block Themes without a child theme!
     12Adds options to core blocks and allows import / export of global styles, templates and template parts!
    1313
    1414== Description ==
    15 = Template Editor =
    16 
    17 With WordPress v5.9 the first default theme with Full Site Editing was launched ... Twenty Twenty-Two.
    18 
    19 This plugin expands on the functionality to manage (export / import) templates that are not part of the theme without having to have a child theme.
    20 
    21 Having a block theme also removes links to the Customizer. This plugin changes that!
     15= Options for Block Themes =
     16
     17With WordPress v5.9 the first default block theme with Full Site Editing was launched ... Twenty Twenty-Two.
     18
     19This plugin expands on the functionality to manage (export / import / delete) templates and template parts that are not part of the theme without having to have a child theme.
     20
     21Having a block theme also removes links to the legacy Customizer. This plugin allows you to change that!
    2222
    2323This plugin will also enable the Template Editor in Gutenberg for full site editing for any theme!
     
    2727- Option to enable expandable submenus to the Navigation Block modal.
    2828- Option to add full block link option to Group and Cover Blocks.
    29 - Option to close other Details Blocks when selected one is opened giving the Details Block basic accordion functionality.
     29- Option to close other Details Blocks when selected one is opened giving the Details Block a basic "accordion" functionality.
    3030
    3131= Conditional Block Logic =
     
    7575Enable an option to shrink the header site logo when you scroll down the page.
    7676
    77 = Add Google Fonts to Editor =
    78 
    79 NB: This is only relevant to WordPress v5.8 - v6.4 and classic themes as the Font Library was introduced into core in v6.5
    80 
    81 Choose Google Fonts and add them to the full screen editor global styles options!
    82 
    83 = Remove Block Theme Fonts =
    84 
    85 NB: This is only relevant to WordPress v5.8 - v6.4 as the Font Library was introduced into core in v6.5
    86 
    87 This plugin will allow you to choose which theme fonts are included in the FSE editor and if not required will prevent them from being loaded on the front end.
    88 
    8977== Installation ==
    9078
    9179Easily use this plugin to enable the Template Editor on your site ...
    9280
    93 1) Install "Template Editor" automatically or by uploading the ZIP file.
     811) Install "Options for Block Themes" automatically or by uploading the .zip file.
    94822) Activate the plugin through the "Plugins" menu in WordPress.
    95 3) Start using the Template Editor with your theme.
     833) Start using the Options for Block Themes.
    9684
    9785== Changelog ==
     86
     87= 1.4.2 =
     88* General housekeeping preparing for "Plugin Check" code review
    9889
    9990= 1.4.1 =
     
    225216== Upgrade Notice ==
    226217
    227 = 1.4.1 =
    228 * Fixed a margin / block spacing bug with "Full Block Link" option
     218= 1.4.2 =
     219* General housekeeping preparing for "Plugin Check" code review
  • template-editor/trunk/template-editor.php

    r3409463 r3422724  
    22/*
    33 * Plugin Name: Options for Block Themes
    4  * Version: 1.4.1
     4 * Version: 1.4.2
    55 * Plugin URI: https://webd.uk/support/
    6  * Description: Import / Export global styles, templates and template parts to Full Site Editing / Block Themes without a child theme!
     6 * Description: Adds options to core blocks and allows import / export of global styles, templates and template parts!
    77 * Author: Webd Ltd
    88 * Author URI: https://webd.uk
     9 * License: GPLv2 or later
     10 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    911 * Text Domain: template-editor
    1012 */
     
    2224    class template_editor_class {
    2325
    24         public static $version = '1.4.1';
     26        public static $version = '1.4.2';
    2527        public $is_block_theme = false;
    2628
     
    385387                        unset($submenu['themes.php'][7]);
    386388
     389                    } elseif (isset($_SERVER['REQUEST_URI'])) {
     390
     391                        $customize_url = add_query_arg(
     392                            'return',
     393                            urlencode(remove_query_arg(wp_removable_query_args(), sanitize_url(wp_unslash($_SERVER['REQUEST_URI'])))),
     394                            'customize.php'
     395                        );
     396                        $submenu['themes.php'][7] = array(__('Customize','template-editor'), 'customize', esc_url($customize_url), '', 'hide-if-no-customize');
     397
    387398                    } else {
    388399
    389                         $customize_url = add_query_arg('return', urlencode(remove_query_arg(wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI']))), 'customize.php');
    390                         $submenu['themes.php'][7] = array(__('Customize','template-editor'), 'customize', esc_url($customize_url), '', 'hide-if-no-customize');
     400                        $submenu['themes.php'][7] = array(__('Customize','template-editor'), 'customize', esc_url('customize.php'), '', 'hide-if-no-customize');
    391401
    392402                    }
     
    423433        public static function settings_page() {
    424434
     435// phpcs:ignore WordPress.Security.NonceVerification.Recommended
    425436            if (isset($_GET['tab']) && in_array(sanitize_key($_GET['tab']), array('theme_options', 'manage_template_parts'))) {
    426437
     438// phpcs:ignore WordPress.Security.NonceVerification.Recommended
    427439                $current_tab = sanitize_key($_GET['tab']);
    428440
     
    449461
    450462?>
    451 <a id="<?php echo esc_attr($tab); ?>" class="nav-tab<?php echo $class; ?>" href="#" title="<?php echo esc_attr($title); ?>"><?php echo esc_html($title); ?></a>
     463<a id="<?php echo esc_attr($tab); ?>" class="nav-tab<?php echo esc_attr($class); ?>" href="#" title="<?php echo esc_attr($title); ?>"><?php echo esc_html($title); ?></a>
    452464<?php
    453465
     
    460472    $('#adminmenu li.current').addClass('manage_templates');
    461473    $('#adminmenu .current').removeClass('current');
    462     $('#adminmenu .<?php echo $current_tab; ?>').addClass('current');
     474    $('#adminmenu .<?php echo esc_attr($current_tab); ?>').addClass('current');
    463475    $('.nav-tab-wrapper .nav-tab').click(function() {
    464476        $('.tab_content').hide();
     
    482494<p><?php esc_html_e('You can then rename the slug (and title / description) of the edited template to whatever you require and either save it or save it as a copy if you want to keep the original.', 'template-editor'); ?></p>
    483495<p><?php esc_html_e('Using this plugin you can create new templates outside of those that are available by default <strong>without</strong> having to create a child them! :)', 'template-editor'); ?></p>
    484 <h2><?php printf(__('Active Theme (%s) Templates', 'template-editor'), $active_theme); ?></h2>
     496<h2><?php
     497/* translators: active theme slug */
     498printf(esc_html__('Active Theme (%s) Templates', 'template-editor'), esc_html($active_theme)); ?></h2>
    485499<?php
    486500
     
    549563
    550564?>
    551 <h2><?php printf(__('Other Theme Templates', 'template-editor'), $active_theme); ?></h2>
     565<h2><?php printf(esc_html__('Other Theme Templates', 'template-editor'), esc_html($active_theme)); ?></h2>
    552566<?php
    553567
     
    632646<th scope="row"><label for="te_post_name"><?php esc_html_e( 'Template Name', 'template-editor' ); ?></label></th>
    633647<td><input name="te_post_name" type="text" id="te_post_name" value="" class="regular-text">.html<br />
    634 <?php printf(__('<strong>This is the important bit!</strong> The template name <i>has</i> to match the slug that you would expect WordPress to look for in the <a href="%1$s" title="%2$s" target="_blank">Template Heirachy</a>','template-editor'),'https://developer.wordpress.org/themes/basics/template-hierarchy/', __('Template Heirachy','template-editor')); ?></td>
     648<?php
     649/* translators: link to template documentation */
     650printf(wp_kses(__('<strong>This is the important bit!</strong> The template name <i>has</i> to match the slug that you would expect WordPress to look for in the <a href="%s" title="Template Heirachy" target="_blank">Template Heirachy</a>','template-editor'), 'post'),'https://developer.wordpress.org/themes/basics/template-hierarchy/'); ?></td>
    635651</tr>
    636652<tr>
     
    660676    $('#te_save_as_copy').click(function() { save_template(1); });
    661677    function save_template(saveAsCopy) {
    662         if (confirm('<?php _e('Are you sure you want to save your changes to the template?', 'template-editor'); ?>')) {
     678        if (confirm('<?php esc_html_e('Are you sure you want to save your changes to the template?', 'template-editor'); ?>')) {
    663679            $('#te_save').unbind('click')
    664680            var data = {
    665681                action: 'te_save',
    666                 _ajax_nonce: '<?php echo wp_create_nonce('template-editor-save'); ?>',
     682                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('template-editor-save')); ?>',
    667683                post_id: $('#te_post_id').val(),
    668684                post_title: $('#te_post_title').val(),
     
    677693                success: function(response) {
    678694                    if ('success' in response && response.success) {
    679                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     695                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    680696                    } else {
    681                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    682                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     697                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     698                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    683699                    }
    684700                },
    685701                error: function() {
    686                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    687                     window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     702                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     703                    window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    688704                }
    689705            });
     
    693709        var data = {
    694710            action: 'te_download_wp_template',
    695             _ajax_nonce: '<?php echo wp_create_nonce('download-wp-template'); ?>',
     711            _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('download-wp-template')); ?>',
    696712            post_id: $(this).data('template').ID,
    697713            post_name: $(this).data('template').post_name
     
    729745            },
    730746            error: function() {
    731                 alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
     747                alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
    732748            }
    733749        });
    734750    });
    735751    $('.te-delete').click(function() {
    736         if (confirm('<?php _e('Are you sure you want to delete the template?', 'template-editor'); ?>')) {
     752        if (confirm('<?php esc_html_e('Are you sure you want to delete the template?', 'template-editor'); ?>')) {
    737753            $('#te-delete').unbind('click')
    738754            var data = {
    739755                action: 'te_delete',
    740                 _ajax_nonce: '<?php echo wp_create_nonce('template-editor-delete'); ?>',
     756                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('template-editor-delete')); ?>',
    741757                post_id: $(this).data('template')
    742758            };
     
    747763                success: function(response) {
    748764                    if ('success' in response && response.success) {
    749                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     765                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    750766                    } else {
    751                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    752                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     767                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     768                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    753769                    }
    754770                },
    755771                error: function() {
    756                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    757                     window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     772                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     773                    window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    758774                }
    759775            });
     
    764780    });
    765781    $('#te-json-file').change(function() {
    766         var confirmText = '<?php _e('Are you sure you want to upload %s as an active theme template?', 'template-editor'); ?>';
     782        var confirmText = '<?php
     783/* translators: filename */
     784esc_html_e('Are you sure you want to upload %s as an active theme template?', 'template-editor'); ?>';
    767785        if (confirm(confirmText.replace('%s', $('#te-json-file').prop('files')[0].name))) {
    768786            var data = new FormData();
    769787            data.append('action', 'te_upload_wp_template');
    770             data.append('_ajax_nonce', '<?php echo wp_create_nonce('upload-wp-template'); ?>');
     788            data.append('_ajax_nonce', '<?php echo esc_attr(wp_create_nonce('upload-wp-template')); ?>');
    771789            data.append('file', $('#te-json-file').prop('files')[0]);
    772790            $.ajax({
     
    778796                success: function(response) {
    779797                    if ('success' in response && response.success) {
    780                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     798                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    781799                    } else {
    782                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    783                         window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     800                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     801                        window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    784802                    }
    785803                },
    786804                error: function() {
    787                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    788                     window.location.href = '<?php echo add_query_arg('page', 'template_editor', admin_url('themes.php')); ?>';
     805                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     806                    window.location.href = '<?php echo esc_url(add_query_arg('page', 'template_editor', admin_url('themes.php'))); ?>';
    789807                }
    790808            });
     
    797815<h1><?php esc_html_e('Manage Template Parts', 'template-editor'); ?></h1>
    798816<p><?php esc_html_e('Every theme default template part (header, footer, etc) you have edited is listed here ...', 'template-editor'); ?></p>
    799 <h2><?php printf(esc_html__('Active Theme (%s) Template Parts', 'template-editor'), $active_theme); ?></h2>
     817<h2><?php
     818/* translators: active theme slug */
     819printf(esc_html__('Active Theme (%s) Template Parts', 'template-editor'), esc_html($active_theme)); ?></h2>
    800820<?php
    801821
     
    863883
    864884?>
    865 <h2><?php printf(__('Other Theme Template Parts', 'template-editor'), $active_theme); ?></h2>
     885<h2><?php printf(esc_html__('Other Theme Template Parts', 'template-editor'), esc_html($active_theme)); ?></h2>
    866886<?php
    867887
     
    942962        var data = {
    943963            action: 'te_download_wp_template',
    944             _ajax_nonce: '<?php echo wp_create_nonce('download-wp-template'); ?>',
     964            _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('download-wp-template')); ?>',
    945965            post_id: $(this).data('template-part').ID,
    946966            post_name: $(this).data('template-part').post_name
     
    978998            },
    979999            error: function() {
    980                 alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
     1000                alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
    9811001            }
    9821002        });
    9831003    });
    9841004    $('.te-part-delete').click(function() {
    985         if (confirm('<?php _e('Are you sure you want to delete the template part?', 'template-editor'); ?>')) {
     1005        if (confirm('<?php esc_html_e('Are you sure you want to delete the template part?', 'template-editor'); ?>')) {
    9861006            $('#te-part-delete').unbind('click')
    9871007            var data = {
    9881008                action: 'te_delete',
    989                 _ajax_nonce: '<?php echo wp_create_nonce('template-editor-delete'); ?>',
     1009                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('template-editor-delete')); ?>',
    9901010                post_id: $(this).data('template-part')
    9911011            };
     
    9961016                success: function(response) {
    9971017                    if ('success' in response && response.success) {
    998                         window.location.href = '<?php echo add_query_arg(array(
     1018                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    9991019                            'page' => 'template_editor',
    10001020                            'tab' => 'manage_template_parts'
    1001                         ), admin_url('themes.php')); ?>';
     1021                        ), admin_url('themes.php'))); ?>';
    10021022                    } else {
    1003                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1004                         window.location.href = '<?php echo add_query_arg(array(
     1023                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1024                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    10051025                            'page' => 'template_editor',
    10061026                            'tab' => 'manage_template_parts'
    1007                         ), admin_url('themes.php')); ?>';
     1027                        ), admin_url('themes.php'))); ?>';
    10081028                    }
    10091029                },
    10101030                error: function() {
    1011                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1012                     window.location.href = '<?php echo add_query_arg(array(
     1031                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1032                    window.location.href = '<?php echo esc_url(add_query_arg(array(
    10131033                            'page' => 'template_editor',
    10141034                            'tab' => 'manage_template_parts'
    1015                         ), admin_url('themes.php')); ?>';
     1035                        ), admin_url('themes.php'))); ?>';
    10161036                }
    10171037            });
     
    10221042    });
    10231043    $('#te-part-json-file').change(function() {
    1024         var confirmText = '<?php _e('Are you sure you want to upload %s as an active theme template part?', 'template-editor'); ?>';
     1044        var confirmText = '<?php
     1045/* translators: filename */
     1046esc_html_e('Are you sure you want to upload %s as an active theme template part?', 'template-editor'); ?>';
    10251047        if (confirm(confirmText.replace('%s', $('#te-part-json-file').prop('files')[0].name))) {
    10261048            var data = new FormData();
    10271049            data.append('action', 'te_upload_wp_template_part');
    1028             data.append('_ajax_nonce', '<?php echo wp_create_nonce('upload-wp-template-part'); ?>');
     1050            data.append('_ajax_nonce', '<?php echo esc_attr(wp_create_nonce('upload-wp-template-part')); ?>');
    10291051            data.append('file', $('#te-part-json-file').prop('files')[0]);
    10301052            $.ajax({
     
    10361058                success: function(response) {
    10371059                    if ('success' in response && response.success) {
    1038                         window.location.href = '<?php echo add_query_arg(array(
     1060                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    10391061                            'page' => 'template_editor',
    10401062                            'tab' => 'manage_template_parts'
    1041                         ), admin_url('themes.php')); ?>';
     1063                        ), admin_url('themes.php'))); ?>';
    10421064                    } else {
    1043                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1044                         window.location.href = '<?php echo add_query_arg(array(
     1065                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1066                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    10451067                            'page' => 'template_editor',
    10461068                            'tab' => 'manage_template_parts'
    1047                         ), admin_url('themes.php')); ?>';
     1069                        ), admin_url('themes.php'))); ?>';
    10481070                    }
    10491071                },
    10501072                error: function() {
    1051                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1052                     window.location.href = '<?php echo add_query_arg(array(
     1073                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1074                    window.location.href = '<?php echo esc_url(add_query_arg(array(
    10531075                            'page' => 'template_editor',
    10541076                            'tab' => 'manage_template_parts'
    1055                         ), admin_url('themes.php')); ?>';
     1077                        ), admin_url('themes.php'))); ?>';
    10561078                }
    10571079            });
     
    11301152        var data = {
    11311153            action: 'te_download_wp_global_styles',
    1132             _ajax_nonce: '<?php echo wp_create_nonce('download-wp-global-styles'); ?>',
     1154            _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('download-wp-global-styles')); ?>',
    11331155            post_id: $(this).data('global-styles').ID,
    11341156            theme: $(this).data('global-styles').theme
     
    11661188            },
    11671189            error: function() {
    1168                 alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
     1190                alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
    11691191            }
    11701192        });
    11711193    });
    11721194    $('.te-styles-delete').click(function() {
    1173         if (confirm('<?php _e('Are you sure you want to delete the selected global styles?', 'template-editor'); ?>')) {
     1195        if (confirm('<?php esc_html_e('Are you sure you want to delete the selected global styles?', 'template-editor'); ?>')) {
    11741196            $('#te-styles-delete').unbind('click')
    11751197            var data = {
    11761198                action: 'te_global_styles_delete',
    1177                 _ajax_nonce: '<?php echo wp_create_nonce('template-editor-delete'); ?>',
     1199                _ajax_nonce: '<?php echo esc_attr(wp_create_nonce('template-editor-delete')); ?>',
    11781200                post_id: $(this).data('global-styles')
    11791201            };
     
    11841206                success: function(response) {
    11851207                    if ('success' in response && response.success) {
    1186                         window.location.href = '<?php echo add_query_arg(array(
     1208                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    11871209                            'page' => 'template_editor',
    11881210                            'tab' => 'manage_global_styles'
    1189                         ), admin_url('themes.php')); ?>';
     1211                        ), admin_url('themes.php'))); ?>';
    11901212                    } else {
    1191                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1192                         window.location.href = '<?php echo add_query_arg(array(
     1213                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1214                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    11931215                            'page' => 'template_editor',
    11941216                            'tab' => 'manage_global_styles'
    1195                         ), admin_url('themes.php')); ?>';
     1217                        ), admin_url('themes.php'))); ?>';
    11961218                    }
    11971219                },
    11981220                error: function() {
    1199                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1200                     window.location.href = '<?php echo add_query_arg(array(
     1221                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1222                    window.location.href = '<?php echo esc_url(add_query_arg(array(
    12011223                            'page' => 'template_editor',
    12021224                            'tab' => 'manage_global_styles'
    1203                         ), admin_url('themes.php')); ?>';
     1225                        ), admin_url('themes.php'))); ?>';
    12041226                }
    12051227            });
     
    12101232    });
    12111233    $('#te-styles-json-file').change(function() {
    1212         var confirmText = '<?php _e('Are you sure you want to upload %s as the active theme\\\'s global styles?', 'template-editor'); ?>';
     1234        var confirmText = '<?php
     1235/* translators: filename */
     1236esc_html_e('Are you sure you want to upload %s as the active theme\\\'s global styles?', 'template-editor'); ?>';
    12131237        if (confirm(confirmText.replace('%s', $('#te-styles-json-file').prop('files')[0].name))) {
    12141238            var data = new FormData();
    12151239            data.append('action', 'te_upload_wp_global_styles');
    1216             data.append('_ajax_nonce', '<?php echo wp_create_nonce('upload-wp-global-styles'); ?>');
     1240            data.append('_ajax_nonce', '<?php echo esc_attr(wp_create_nonce('upload-wp-global-styles')); ?>');
    12171241            data.append('file', $('#te-styles-json-file').prop('files')[0]);
    12181242            $.ajax({
     
    12241248                success: function(response) {
    12251249                    if ('success' in response && response.success) {
    1226                         window.location.href = '<?php echo add_query_arg(array(
     1250                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    12271251                            'page' => 'template_editor',
    12281252                            'tab' => 'manage_global_styles'
    1229                         ), admin_url('themes.php')); ?>';
     1253                        ), admin_url('themes.php'))); ?>';
    12301254                    } else {
    1231                         alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1232                         window.location.href = '<?php echo add_query_arg(array(
     1255                        alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1256                        window.location.href = '<?php echo esc_url(add_query_arg(array(
    12331257                            'page' => 'template_editor',
    12341258                            'tab' => 'manage_global_styles'
    1235                         ), admin_url('themes.php')); ?>';
     1259                        ), admin_url('themes.php'))); ?>';
    12361260                    }
    12371261                },
    12381262                error: function() {
    1239                     alert('<?php _e('Something went wrong!', 'template-editor'); ?>');
    1240                     window.location.href = '<?php echo add_query_arg(array(
     1263                    alert('<?php esc_html_e('Something went wrong!', 'template-editor'); ?>');
     1264                    window.location.href = '<?php echo esc_url(add_query_arg(array(
    12411265                            'page' => 'template_editor',
    12421266                            'tab' => 'manage_global_styles'
    1243                         ), admin_url('themes.php')); ?>';
     1267                        ), admin_url('themes.php'))); ?>';
    12441268                }
    12451269            });
     
    12741298                current_user_can('manage_options') &&
    12751299                isset($_POST['post_id']) && absint($_POST['post_id']) &&
    1276                 isset($_POST['post_title']) && sanitize_text_field($_POST['post_title']) &&
    1277                 isset($_POST['post_name']) && sanitize_title($_POST['post_name']) &&
    1278                 isset($_POST['post_excerpt']) && sanitize_text_field($_POST['post_excerpt']) &&
     1300                isset($_POST['post_title']) && sanitize_text_field(wp_unslash($_POST['post_title'])) &&
     1301                isset($_POST['post_name']) && sanitize_title(wp_unslash($_POST['post_name'])) &&
     1302                isset($_POST['post_excerpt']) && sanitize_text_field(wp_unslash($_POST['post_excerpt'])) &&
    12791303                isset($_POST['save_as_copy']) && in_array($_POST['save_as_copy'], ['0', '1'], true)
    12801304            ) {
    12811305
    12821306                $post_id = absint($_POST['post_id']);
    1283                 $post_title = sanitize_text_field($_POST['post_title']);
    1284                 $post_name = sanitize_title($_POST['post_name']);
    1285                 $post_excerpt = sanitize_text_field($_POST['post_excerpt']);
     1307                $post_title = sanitize_text_field(wp_unslash($_POST['post_title']));
     1308                $post_name = sanitize_title(wp_unslash($_POST['post_name']));
     1309                $post_excerpt = sanitize_text_field(wp_unslash($_POST['post_excerpt']));
    12861310                $save_as_copy = absint($_POST['save_as_copy']);
    12871311
     
    14541478            ) {
    14551479
    1456                 $json_data = file_get_contents($_FILES['file']['tmp_name']);
     1480                $json_data = file_get_contents(sanitize_text_field($_FILES['file']['tmp_name']));
    14571481                $template = false;
    14581482
     
    15321556            ) {
    15331557
    1534                 $json_data = file_get_contents($_FILES['file']['tmp_name']);
     1558                $json_data = file_get_contents(sanitize_text_field($_FILES['file']['tmp_name']));
    15351559                $global_styles = false;
    15361560
     
    16171641            ) {
    16181642
    1619                 $json_data = file_get_contents($_FILES['file']['tmp_name']);
     1643                $json_data = file_get_contents(sanitize_text_field($_FILES['file']['tmp_name']));
    16201644                $template = false;
    16211645
     
    17191743            } else {
    17201744
    1721                 add_settings_section('te_options', __('Fonts', 'template-editor'), 'template_editor_class::fonts_text_new', 'te_fonts');
     1745                $options = get_option('te_options');
     1746
     1747                if (
     1748                    isset($options['inject_google_fonts']) &&
     1749                    is_array($options['inject_google_fonts']) &&
     1750                    $options['inject_google_fonts']
     1751                ) {
     1752
     1753                    add_settings_section('te_options', __('Fonts', 'template-editor'), 'template_editor_class::fonts_text_new', 'te_fonts');
     1754
     1755                }
    17221756
    17231757            }
     
    17281762
    17291763?>
    1730 <p><?php echo sprintf(wp_kses(__('Here are some options for Full Site Editor themes. If you\'d like to see more options here, <a href="%s">let us know in the support forum</a>.', 'template-editor'), array('a' => array('href' => array(), 'class' => array()))), esc_url('https://wordpress.org/support/plugin/template-editor/')); ?></p>
     1764<p><?php
     1765/* translators: link to plugin support forum */
     1766echo sprintf(wp_kses(__('Here are some options for Full Site Editor themes. If you\'d like to see more options here, <a href="%s">let us know in the support forum</a>.', 'template-editor'), array('a' => array('href' => array(), 'class' => array()))), esc_url('https://wordpress.org/support/plugin/template-editor/')); ?></p>
    17311767<?php
    17321768
     
    17951831
    17961832?>
    1797 <p><?php echo __('We\'ve worked out how to inject Google Fonts into the Full Site Editor without modifying the theme or creating a child theme!', 'template-editor'); ?></p>
     1833<p><?php esc_html_e('We\'ve worked out how to inject Google Fonts into the Full Site Editor without modifying the theme or creating a child theme!', 'template-editor'); ?></p>
    17981834<?php
    17991835
     
    18051841
    18061842?>
    1807 <p><?php echo __('With the launch of WordPress v6.5 came the new "Font Library". This awesome core update allows you to manage fonts from the Site Editor.', 'template-editor'); ?></p>
    1808 <?php
    1809 
    1810             if (isset($options['inject_google_fonts']) && is_array($options['inject_google_fonts']) && $options['inject_google_fonts']) {
    1811 
    1812 ?>
    1813 <p style="color: red;"><strong><?php echo __('We notice that you use this plugin to inject the following Google fonts. If you haven\'t already you should use the Site Editor to add these fonts again:', 'template-editor'); ?>
    1814 <?php
    1815 
    1816                 $count_fonts = 0;
    1817 
    1818                 foreach ($options['inject_google_fonts'] as $font => $styles) {
    1819 
    1820                     if (!is_array($styles)) { $styles = array($styles); }
    1821 
    1822                     foreach ($styles as $key => $style) {
     1843<p><?php esc_html_e('With the launch of WordPress v6.5 came the new "Font Library". This awesome core update allows you to manage fonts from the Site Editor.', 'template-editor'); ?></p>
     1844<p style="color: red;"><strong><?php esc_html_e('We notice that you use this plugin to inject the following Google fonts. If you haven\'t already you should use the Site Editor to add these fonts again:', 'template-editor'); ?>
     1845<?php
     1846
     1847            $count_fonts = 0;
     1848
     1849            foreach ($options['inject_google_fonts'] as $font => $styles) {
     1850
     1851                if (!is_array($styles)) { $styles = array($styles); }
     1852
     1853                foreach ($styles as $key => $style) {
    18231854
    18241855?>
     
    18261857<?php
    18271858
    1828                         $count_fonts++;
    1829 
    1830                     }
    1831 
    1832                 }
     1859                    $count_fonts++;
     1860
     1861                }
     1862
     1863            }
    18331864
    18341865?>
    18351866</strong></p>
    1836 <p><?php echo __('Go to "Dashboard - Appearance - Editor - Styles - <edit pencil icon> - Typography". From there click on any font to enter the "Font Library". It is important that you first remove the above Google fonts then re-install them using the "Install Fonts" tab of the "Font Library".', 'template-editor'); ?></p>
    1837 <?php
    1838 
    1839             }
     1867<p><?php esc_html_e('Go to "Dashboard - Appearance - Editor - Styles - <edit pencil icon> - Typography". From there click on any font to enter the "Font Library". It is important that you first remove the above Google fonts then re-install them using the "Install Fonts" tab of the "Font Library".', 'template-editor'); ?></p>
     1868<?php
    18401869
    18411870        }
     
    19882017                'block' => esc_html__('"block" - Wait until the font has loaded before drawing the text.', 'template-editor'),
    19892018                'swap' => esc_html__('"swap" - Draw the text straight away then re-draw the text when the font has loaded.', 'template-editor'),
    1990                 'fallback' => sprintf(esc_html__('"fallback" - Waits for a %1$svery%2$s short time before drawing the text anyway if the font hasn\'t yet loaded then re-draws the text if the font loads shortly after.', 'template-editor'),'<strong>','</strong>'),
    1991                 'optional' => sprintf(esc_html__('"optional" - Waits for a %1$svery%2$s short time before drawing the text anyway but %1$sdoesn\'t%2$s re-draw when the font loads.', 'template-editor'),'<strong>','</strong>')
     2019                'fallback' => wp_kses(sprintf('%1$s<strong>%2$s</strong>%3$s', __('"fallback" - Waits for a ', 'template-editor'), __('very', 'template-editor'), __(' short time before drawing the text anyway if the font hasn\'t yet loaded then re-draws the text if the font loads shortly after.', 'template-editor')), 'post'),
     2020                'optional' => wp_kses(sprintf('%1$s<strong>%2$s</strong>%3$s<strong>%4$s</strong>%5$s', __('"optional" - Waits for a ', 'template-editor'), __('very', 'template-editor'), __(' short time before drawing the text anyway but ', 'template-editor'), __('doesn\'t', 'template-editor'), __(' re-draw when the font loads.', 'template-editor')), 'post'),
    19922021            );
    19932022
     
    20012030
    20022031?>
    2003 <label for="google-font-display-<?php echo $key; ?>">
    2004 <input type="radio" id="google-font-display-<?php echo $key; ?>" name="te_options[google_font_display]" value="<?php echo $key; ?>"<?php if (isset($options['google_font_display'])) { checked($options['google_font_display'], $key); } else { checked('auto', $key); } ?>>
    2005 <?php echo $value ?>
     2032<label for="google-font-display-<?php echo esc_attr($key); ?>">
     2033<input type="radio" id="google-font-display-<?php echo esc_attr($key); ?>" name="te_options[google_font_display]" value="<?php echo esc_attr($key); ?>"<?php if (isset($options['google_font_display'])) { checked($options['google_font_display'], $key); } else { checked('auto', $key); } ?>>
     2034<?php echo esc_html($value) ?>
    20062035</label>
    20072036<?php
     
    20362065
    20372066                remove_filter('wp_theme_json_data_theme', 'template_editor_class::wp_theme_json_data_theme');
     2067// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
    20382068                $theme_json = apply_filters('wp_theme_json_data_theme', new WP_Theme_JSON_Data($theme_json_data, 'theme'));
    20392069                add_filter('wp_theme_json_data_theme', 'template_editor_class::wp_theme_json_data_theme');
     
    23792409                    $css_import_string .= '&display=' . (isset($options['google_font_display']) ? sanitize_key($options['google_font_display']) : 'auto');
    23802410
    2381                     $google_request = wp_safe_remote_get($css_import_string,  array(
    2382                         'user-agent' => $_SERVER['HTTP_USER_AGENT']
    2383                     ));
     2411                    $google_request = wp_safe_remote_get($css_import_string,  (isset($_SERVER['HTTP_USER_AGENT']) ? array(
     2412                        'user-agent' => sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT']))
     2413                    ) : array()));
    23842414
    23852415                    $abort_font_download = false;
     
    23982428                            $google_fonts = array_unique($google_fonts[1]);
    23992429
     2430                            global $wp_filesystem;
     2431
     2432                            if (!$wp_filesystem) {
     2433
     2434                                require_once (ABSPATH . '/wp-admin/includes/file.php');
     2435
     2436                                WP_Filesystem();
     2437
     2438                            }
     2439
    24002440                            if (!is_dir($filepath)) {
    24012441
    2402                                 mkdir($filepath);
     2442                                $wp_filesystem->mkdir($filepath);
    24032443
    24042444                            } else {
     
    24062446                                $fileSystemDirect = new WP_Filesystem_Direct(false);
    24072447                                $fileSystemDirect->rmdir($filepath, true);
    2408                                 mkdir($filepath);
     2448                                $wp_filesystem->mkdir($filepath);
    24092449
    24102450                            }
     
    24142454                            foreach ($google_fonts as $google_font_url) {
    24152455
    2416                                 $google_font = wp_safe_remote_get($google_font_url,  array(
    2417                                     'user-agent' => $_SERVER['HTTP_USER_AGENT']
    2418                                 ));
     2456                                $google_font = wp_safe_remote_get($google_font_url,  (isset($_SERVER['HTTP_USER_AGENT']) ? array(
     2457                                    'user-agent' => sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT']))
     2458                                ) : array()));
    24192459
    24202460                                if (
     
    24272467                                    $google_font_filename = wp_basename($google_font_url);
    24282468                                    $wp_filesystem->put_contents($filepath . $google_font_filename, $google_font['body']);
    2429                                     $parse_url = parse_url($upload_dir['baseurl']);
     2469                                    $parse_url = wp_parse_url($upload_dir['baseurl']);
    24302470
    24312471                                    $google_font_css = str_replace(
     
    25972637                        headerWrapper.classList.add('shrink-logo');
    25982638                        if ('undefined' !== customLogo.length) {
    2599                             customLogo.style.width = '<?php echo $new_logo_width; ?>px';
    2600                             customLogo.style.height = '<?php echo (false !== $new_logo_height ? $new_logo_height : 48); ?>px';
     2639                            customLogo.style.width = '<?php echo esc_attr($new_logo_width); ?>px';
     2640                            customLogo.style.height = '<?php echo esc_attr(false !== $new_logo_height ? $new_logo_height : 48); ?>px';
    26012641                        }
    26022642                    }
     
    27572797                return str_replace(
    27582798                    '[HTTP_HOST]',
    2759                     'http' . (is_ssl() ? 's' : '') . '://' . $_SERVER['HTTP_HOST'],
     2799                    'http' . (is_ssl() ? 's' : '') . '://' . (isset($_SERVER['HTTP_HOST']) ? sanitize_url(wp_unslash($_SERVER['HTTP_HOST'])) : gethostname()),
    27602800                    $options['google_font_css']
    27612801                );
     
    28952935    if (version_compare(get_bloginfo('version'), '5.8', '>=')) {
    28962936
    2897         $template_editor_object = new template_editor_class();
     2937        new template_editor_class();
    28982938
    28992939    } else {
     
    29152955<div class="notice notice-error">
    29162956
    2917 <p><strong><?php esc_html_e('Template Editor Plugin Error', 'template-editor'); ?></strong><br />
     2957<p><strong><?php esc_html_e('Options for Block Themes Plugin Error', 'template-editor'); ?></strong><br />
    29182958<?php
    29192959
    29202960        printf(
    2921             __('This plugin requires at least WordPress v5.8 to be installed in order to function. Your WordPress version "%s" is not compatible.', 'template-editor'),
    2922             get_bloginfo('version')
     2961/* translators: WordPress version */
     2962            esc_html(__('This plugin requires at least WordPress v5.8 to be installed in order to function. Your WordPress version "%s" is not compatible.', 'template-editor')),
     2963            esc_html(get_bloginfo('version'))
    29232964        );
    29242965
     
    29262967
    29272968<p><a class="button" href="<?php echo esc_url(admin_url('update-core.php')); ?>" title="<?php esc_attr_e('WordPress Updates', 'template-editor'); ?>"><?php
    2928         _e('WordPress Updates', 'template-editor');
     2969        esc_html_e('WordPress Updates', 'template-editor');
    29292970?></a>.</p>
    29302971
Note: See TracChangeset for help on using the changeset viewer.