/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. // Exit if accessed directly
  12. if ( ! defined( 'ABSPATH' ) ) {
  13. exit;
  14. }
  15. /**
  16. * Callback for displaying the UI for general settings tab.
  17. *
  18. * @since 6.0.0
  19. * @access public
  20. *
  21. * @return void
  22. */
  23. function monsterinsights_settings_tracking_tab() {
  24. // Get settings
  25. ?>
  26. <div id="monsterinsights-settings-tracking" class="monsterinsights-sub-nav-area">
  27. <!-- Tabs -->
  28. <h1 id="monsterinsights-settings-page-sub-nav" class="monsterinsights-sub-nav-container monsterinsights-nav-container" data-container="#monsterinsights-settings-sub-pages">
  29. <?php
  30. $i = 0;
  31. $class = '';
  32. $is_pro = monsterinsights_is_pro_version();
  33. foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
  34. if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
  35. continue;
  36. }
  37. $class = ( 0 === $i ? 'monsterinsights-active' : '' );
  38. ?>
  39. <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'] ); ?>">
  40. <?php echo esc_html( $item['title'] ); ?>
  41. </a>
  42. <?php
  43. $i++;
  44. }
  45. ?>
  46. </h1>
  47. <h1 class="monsterinsights-hideme"></h1><!-- so wp notices are below the nav bar -->
  48. <?php
  49. // Output any notices now
  50. /**
  51. * Developer Alert:
  52. *
  53. * Per the README, this is considered an internal hook and should
  54. * not be used by other developers. This hook's behavior may be modified
  55. * or the hook may be removed at any time, without warning.
  56. */
  57. do_action( 'monsterinsights_settings_tracking_tab_notice' );
  58. ?>
  59. <!-- Tab Panels -->
  60. <div id="monsterinsights-settings-sub-pages" class="monsterinsights-sub-nav-tabs monsterinsights-nav-tabs" data-navigation="#monsterinsights-settings-page-sub-nav">
  61. <?php
  62. $i = 0;
  63. foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
  64. if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
  65. continue;
  66. }
  67. $class = ( 0 === $i ? ' monsterinsights-active' : '' );
  68. $i++;
  69. ?>
  70. <div id="monsterinsights-sub-tab-<?php echo esc_attr( $id ); ?>" class="monsterinsights-sub-nav-tab monsterinsights-nav-tab<?php echo esc_attr( $class ); ?>">
  71. <?php if ( $item['level'] === 'lite' || $is_pro ) { ?>
  72. <?php echo '<h2 class="monsterinsights-sub-tab-header">' . esc_html( $item['title'] ) . '</h2>'; ?>
  73. <?php } ?>
  74. <div class="monsterinsights-subtab-settings-notices">
  75. <?php
  76. // Output any notices now
  77. /**
  78. * Developer Alert:
  79. *
  80. * Per the README, this is considered an internal hook and should
  81. * not be used by other developers. This hook's behavior may be modified
  82. * or the hook may be removed at any time, without warning.
  83. */
  84. do_action( 'monsterinsights_tracking_' . $id . '_tab_notice' );
  85. ?>
  86. </div>
  87. <!-- Settings Form -->
  88. <?php $class = ( $item['level'] !== 'lite' && ! $is_pro ) ? 'monsterinsights-no-settings-shown' : ''; ?>
  89. <form id="monsterinsights-tracking-<?php echo esc_attr( $id );?>-tab" class="<?php echo $class; ?>" method="post">
  90. <table class="form-table">
  91. <tbody>
  92. <?php
  93. //do_action( 'monsterinsights_settings_tab_top_' . $id );
  94. echo monsterinsights_get_section_settings( $id, 'tracking' );
  95. //do_action( 'monsterinsights_settings_tab_bottom_' . $id );
  96. ?>
  97. </tbody>
  98. </table>
  99. <?php echo monsterinsights_render_submit_field( $id, 'tracking' ); ?>
  100. <?php if ( $item['level'] === 'lite' && !$is_pro ) { ?>
  101. <div class="monsterinsights-upsell-under-box">
  102. <h2><?php esc_html_e( "Want even more fine tuned control over your website analytics?", 'google-analytics-for-wordpress' ); ?></h2>
  103. <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>
  104. <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>
  105. <?php } ?>
  106. </form>
  107. </div>
  108. <?php
  109. }
  110. ?>
  111. </div>
  112. </div>
  113. <?php
  114. }
  115. add_action( 'monsterinsights_tab_settings_tracking', 'monsterinsights_settings_tracking_tab' );