Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/wp-content/plugins/yandexmetrika/yandexmetrika.php b/wp-content/plugins/yandexmetrika/yandexmetrika.php
- index 196d18a..cb12568 100644
- --- a/wp-content/plugins/yandexmetrika/yandexmetrika.php
- +++ b/wp-content/plugins/yandexmetrika/yandexmetrika.php
- @@ -21,7 +21,7 @@ if ( ! class_exists( 'YM_Admin' ) ) {
- class YM_Admin {
- function add_config_page() {
- - $plugin_page = add_submenu_page('options-general.php', 'Настройка Яндекс.Метрика', 'Яндекс.Метрика', 9, basename(__FILE__), array('YM_Admin','config_page'));
- + $plugin_page = add_submenu_page('options-general.php', 'Настройка Яндекс.Метрика', 'Яндекс.Метрика', 'activate_plugins', basename(__FILE__), array('YM_Admin','config_page'));
- add_action( 'admin_head-'. $plugin_page, array('YM_Admin','config_page_head') );
- add_filter( 'plugin_action_links', array( 'YM_Admin', 'filter_plugin_actions'), 10, 2 );
- } // end add_YM_config_page()
- @@ -106,7 +106,7 @@ if ( ! class_exists( 'YM_Admin' ) ) {
- <small><a href="#" id="explain">Что это?</a></small>
- </th>
- <td>
- - <input id="uastring" name="uastring" type="text" size="20" maxlength="40" value="<?php echo $options['uastring']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /><br/>
- + <input id="uastring" name="uastring" type="text" size="20" maxlength="40" value="<?php echo ( isset($options['uastring']) ? $options['uastring'] : null ); ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /><br/>
- </td>
- </tr>
- <tr id="explanation">
- @@ -138,7 +138,7 @@ if ( ! class_exists( 'YM_Admin' ) ) {
- <label for="admintracking">Учитывать администраторов</label>
- </th>
- <td>
- - <input type="checkbox" id="admintracking" name="admintracking" <?php if ($options['admintracking']) echo ' checked="checked" '; ?>/>
- + <input type="checkbox" id="admintracking" name="admintracking" <?php if (isset($options['admintracking']) AND $options['admintracking']) echo ' checked="checked" '; ?>/>
- </td>
- </tr>
- </table>
- @@ -191,13 +191,29 @@ if ( ! class_exists( 'YM_Filter' ) ) {
- if ($options["uastring"] != "" && (!current_user_can('edit_users') || $options["admintracking"]) && !is_preview() ) { ?>
- - <!-- Яндекс.Метрика -->
- -<script src="//mc.yandex.ru/resource/watch.js" type="text/javascript"></script>
- +<!-- Яндекс.Метрика -->
- <script type="text/javascript">
- -try { var yaCounter<?php echo $options["uastring"]; ?> = new Ya.Metrika(<?php echo $options["uastring"]; ?>); } catch(e){}
- +(function (d, w, c) {
- + (w[c] = w[c] || []).push(function() {
- + try {
- + w.yaCounter12714532 = new Ya.Metrika({id:<?php echo $options['uastring'];?>, enableAll: true, webvisor:true});
- + } catch(e) { }
- + });
- +
- + var n = d.getElementsByTagName("script")[0],
- + s = d.createElement("script"),
- + f = function () { n.parentNode.insertBefore(s, n); };
- + s.type = "text/javascript";
- + s.async = true;
- + s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";
- +
- + if (w.opera == "[object Opera]") {
- + d.addEventListener("DOMContentLoaded", f);
- + } else { f(); }
- +})(document, window, "yandex_metrika_callbacks");
- </script>
- -<noscript><div style="position: absolute;"><img src="//mc.yandex.ru/watch/<?php echo $options["uastring"]; ?>" alt="" /></div></noscript>
- - <!-- Яндекс.Метрика -->
- +<noscript><div><img src="//mc.yandex.ru/watch/<?php echo $options['uastring'];?>" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
- +<!-- Яндекс.Метрика -->
- <?php
- } else if ((current_user_can('edit_users') && !$options["admintracking"])) {
- echo "<!-- Код счётчика Яндекс.Метрика не отображается, т.к. учёт администраторов запрещён -->";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement