PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 0ms RepoModel.GetById 2ms app.codeStats 0ms

/wp-content/plugins/google-analytics-for-wordpress/includes/admin/settings/tab-tracking.php

https://bitbucket.org/carloskikea/helpet
PHP | 120 lines | 78 code | 5 blank | 37 comment | 12 complexity | d9a8e25caaa35eda55ae6a7fb33a2583 MD5 | raw file
  1<?php
  2/**
  3 * General Settings Tab.
  4 *
  5 * @since 6.0.0
  6 *
  7 * @package MonsterInsights
  8 * @subpackage Settings
  9 * @author  Chris Christoff
 10 */
 11
 12// Exit if accessed directly
 13if ( ! defined( 'ABSPATH' ) ) {
 14    exit;
 15}
 16
 17/**
 18 * Callback for displaying the UI for general settings tab.
 19 *
 20 * @since 6.0.0
 21 * @access public
 22 *
 23 * @return void
 24 */
 25function monsterinsights_settings_tracking_tab() {
 26    // Get settings
 27    ?>
 28    <div id="monsterinsights-settings-tracking" class="monsterinsights-sub-nav-area">
 29        <!-- Tabs -->
 30        <h1 id="monsterinsights-settings-page-sub-nav" class="monsterinsights-sub-nav-container monsterinsights-nav-container" data-container="#monsterinsights-settings-sub-pages">
 31            <?php 
 32            $i      = 0;
 33            $class  = '';
 34            $is_pro = monsterinsights_is_pro_version();
 35            foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
 36                if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
 37                    continue;
 38                }
 39                $class = ( 0 === $i ? 'monsterinsights-active' : '' );
 40                ?>
 41                <a class="monsterinsights-sub-nav-item monsterinsights-nav-item monstericon-<?php echo esc_attr( $id ); ?> <?php echo esc_attr( $class ); ?>" href="#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-<?php echo esc_attr( $id ); ?>" title="<?php echo esc_attr( $item['title'] ); ?>">
 42                    <?php echo esc_html( $item['title'] ); ?>
 43                </a>
 44                <?php 
 45                $i++; 
 46            }
 47            ?>
 48        </h1>
 49
 50        <h1 class="monsterinsights-hideme"></h1><!-- so wp notices are below the nav bar -->
 51
 52        <?php 
 53        // Output any notices now
 54        /** 
 55         * Developer Alert:
 56         *
 57         * Per the README, this is considered an internal hook and should
 58         * not be used by other developers. This hook's behavior may be modified
 59         * or the hook may be removed at any time, without warning.
 60         */
 61        do_action( 'monsterinsights_settings_tracking_tab_notice' );
 62        ?>
 63
 64        <!-- Tab Panels -->
 65        <div id="monsterinsights-settings-sub-pages" class="monsterinsights-sub-nav-tabs monsterinsights-nav-tabs" data-navigation="#monsterinsights-settings-page-sub-nav">
 66            <?php 
 67            $i = 0; 
 68            foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
 69                if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
 70                    continue;
 71                }
 72                $class = ( 0 === $i ? ' monsterinsights-active' : '' ); 
 73                $i++;
 74                ?>
 75                 <div id="monsterinsights-sub-tab-<?php echo esc_attr( $id ); ?>" class="monsterinsights-sub-nav-tab monsterinsights-nav-tab<?php echo esc_attr( $class ); ?>">
 76                    <?php if ( $item['level'] === 'lite' ||  $is_pro ) { ?>
 77                    <?php echo '<h2 class="monsterinsights-sub-tab-header">' . esc_html( $item['title'] ) . '</h2>'; ?>
 78                    <?php } ?>
 79                     <div class="monsterinsights-subtab-settings-notices">
 80                        <?php 
 81                        // Output any notices now
 82                        /** 
 83                         * Developer Alert:
 84                         *
 85                         * Per the README, this is considered an internal hook and should
 86                         * not be used by other developers. This hook's behavior may be modified
 87                         * or the hook may be removed at any time, without warning.
 88                         */
 89                        do_action( 'monsterinsights_tracking_' . $id . '_tab_notice' );
 90                        ?>
 91                    </div>
 92                    <!-- Settings Form -->
 93                    <?php $class = ( $item['level'] !== 'lite' && ! $is_pro ) ? 'monsterinsights-no-settings-shown' : ''; ?>
 94                    <form id="monsterinsights-tracking-<?php echo esc_attr( $id );?>-tab" class="<?php echo $class; ?>" method="post">
 95                        <table class="form-table">
 96                            <tbody>
 97                                <?php
 98                                //do_action( 'monsterinsights_settings_tab_top_' . $id  );
 99                                echo monsterinsights_get_section_settings( $id, 'tracking' );
100                                //do_action( 'monsterinsights_settings_tab_bottom_' . $id  );
101                                ?>
102                            </tbody>
103                        </table>
104                        <?php echo monsterinsights_render_submit_field( $id, 'tracking' ); ?>
105                        <?php if ( $item['level'] === 'lite' && !$is_pro ) { ?>
106                            <div class="monsterinsights-upsell-under-box">
107                                <h2><?php esc_html_e( "Want even more fine tuned control over your website analytics?", 'google-analytics-for-wordpress' ); ?></h2>
108                                <p class="monsterinsights-upsell-lite-text"><?php esc_html_e( "By upgrading to MonsterInsights Pro, you get access to numerous addons and tools that help you better understand what people are doing on your website, so you can keep doing more of what's working. Some of the features include: Ecommerce tracking, Author tracking, Post Type tracking, Ads tracking, Google AMP tracking, Performance optimization, and so much more!", 'google-analytics-for-wordpress' ); ?></p>
109                                <p class="monsterinsights-upsell-button-par"><a href="https://www.monsterinsights.com/lite/" class="button button-primary"><?php esc_html_e( "Click here to Upgrade", 'google-analytics-for-wordpress' ); ?></a></p></div>
110                        <?php } ?>
111                    </form>
112                </div>
113                <?php
114            }
115            ?>
116        </div>
117    </div>
118    <?php
119}
120add_action( 'monsterinsights_tab_settings_tracking', 'monsterinsights_settings_tracking_tab' );