PluginProbe
Independent Analytics – WordPress Analytics Plugin / 1.22.1
Independent Analytics – WordPress Analytics Plugin v1.22.1
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 All 120 releases
independent-analytics / freemius / includes / customizer / class-fs-customizer-support-section.php
class-fs-customizer-support-section.php
102 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.2.2.7
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Class Zerif_Customizer_Theme_Info_Main
15 *
16 * @since 1.0.0
17 * @access public
18 */
19 class FS_Customizer_Support_Section extends WP_Customize_Section {
20
21 function __construct( $manager, $id, $args = array() ) {
22 $manager->register_section_type( 'FS_Customizer_Support_Section' );
23
24 parent::__construct( $manager, $id, $args );
25 }
26
27 /**
28 * The type of customize section being rendered.
29 *
30 * @since 1.0.0
31 * @access public
32 * @var string
33 */
34 public $type = 'freemius-support-section';
35
36 /**
37 * @var Freemius
38 */
39 public $fs = null;
40
41 /**
42 * Add custom parameters to pass to the JS via JSON.
43 *
44 * @since 1.0.0
45 */
46 public function json() {
47 $json = parent::json();
48
49 $is_contact_visible = $this->fs->is_page_visible( 'contact' );
50 $is_support_visible = $this->fs->is_page_visible( 'support' );
51
52 $json['theme_title'] = $this->fs->get_plugin_name();
53
54 if ( $is_contact_visible && $is_support_visible ) {
55 $json['theme_title'] .= ' ' . $this->fs->get_text_inline( 'Support', 'support' );
56 }
57
58 if ( $is_contact_visible ) {
59 $json['contact'] = array(
60 'label' => $this->fs->get_text_inline( 'Contact Us', 'contact-us' ),
61 'url' => $this->fs->contact_url(),
62 );
63 }
64
65 if ( $is_support_visible ) {
66 $json['support'] = array(
67 'label' => $this->fs->get_text_inline( 'Support Forum', 'support-forum' ),
68 'url' => $this->fs->get_support_forum_url()
69 );
70 }
71
72 return $json;
73 }
74
75 /**
76 * Outputs the Underscore.js template.
77 *
78 * @since 1.0.0
79 */
80 protected function render_template() {
81 ?>
82 <li id="fs_customizer_support"
83 class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
84 <h3 class="accordion-section-title">
85 <span>{{ data.theme_title }}</span>
86 <# if ( data.contact && data.support ) { #>
87 <div class="button-group">
88 <# } #>
89 <# if ( data.contact ) { #>
90 <a class="button" href="{{ data.contact.url }}" target="_blank" rel="noopener noreferrer">{{ data.contact.label }} </a>
91 <# } #>
92 <# if ( data.support ) { #>
93 <a class="button" href="{{ data.support.url }}" target="_blank" rel="noopener noreferrer">{{ data.support.label }} </a>
94 <# } #>
95 <# if ( data.contact && data.support ) { #>
96 </div>
97 <# } #>
98 </h3>
99 </li>
100 <?php
101 }
102 }