PluginProbe ʕ •ᴥ•ʔ
Tracking Code Manager / 2.8.0
Tracking Code Manager v2.8.0
2.8.0 2.7.0 trunk 1.11.8 1.11.9 1.12.0 1.12.1 1.12.2 1.12.3 1.4 1.5 2.0.0 2.0.1 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0
tracking-code-manager / includes / admin / manager.php
tracking-code-manager / includes / admin Last commit date
AdminOptions.php 3 months ago editor.php 1 month ago manager.php 1 month ago metabox.php 1 month ago settings.php 1 month ago whatsnew.php 1 month ago
manager.php
118 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3 function tcmp_ui_manager() {
4 global $tcmp;
5
6 $id = tcmp_isqs( 'id', 0 );
7 if ( tcmp_sqs( 'action' ) === 'delete' && $id > 0 && wp_verify_nonce( tcmp_qs( 'tcmp_nonce' ), 'tcmp_delete' ) ) {
8 $snippet = $tcmp->manager->get( $id );
9 if ( $tcmp->manager->remove( $id ) ) {
10 $tcmp->options->pushSuccessMessage( 'CodeDeleteNotice', $id, esc_html( $snippet['name'] ) );
11 }
12 } elseif ( '' != $id && 0 != $id ) {
13 $snippet = $tcmp->manager->get( $id );
14 if ( $tcmp->utils->is( 'action', 'toggle' ) && $id > 0 && wp_verify_nonce( tcmp_qs( 'tcmp_nonce' ), 'tcmp_toggle' ) ) {
15 $snippet['active'] = ( 0 === $snippet['active'] ? 1 : 0 );
16 $tcmp->manager->put( $snippet['id'], $snippet );
17 }
18 $tcmp->options->pushSuccessMessage( 'CodeUpdateNotice', $id, esc_html( $snippet['name'] ) );
19 }
20
21 $tcmp->manager->is_limit_reached( true );
22 $tcmp->options->writeMessages();
23
24 //controllo che faccio per essere retrocompatibile con la prima versione
25 //dove non avevo un id e salvavo tutto con il con il nome quindi una stringa
26 $snippets = $tcmp->manager->keys();
27 foreach ( $snippets as $v ) {
28 $snippet = $tcmp->manager->get( $v, false, true );
29 if ( ! $snippet ) {
30 $tcmp->manager->remove( $v );
31 } elseif ( ! is_numeric( $v ) ) {
32 $tcmp->manager->remove( $v );
33 $tcmp->manager->put( '', $snippet );
34 }
35 }
36 $snippets = $tcmp->manager->values();
37 if ( count( $snippets ) > 0 ) { ?>
38 <div style="float:left;">
39 <form method="get" action="" style="margin:5px; float:left;">
40 <input type="hidden" name="page" value="<?php echo esc_attr( TCMP_PLUGIN_SLUG ); ?>" />
41 <input type="hidden" name="tab" value="<?php echo esc_attr( TCMP_TAB_EDITOR ); ?>" />
42 <input type="submit" class="button-primary" value="<?php $tcmp->lang->P( 'Button.Add' ); ?>" />
43 </form>
44 </div>
45 <div style="clear:both;"></div>
46
47 <table class="widefat fixed" style="width:100%" id="tblSortable">
48 <thead>
49 <tr>
50 <th style="width:30px;">#N</th>
51 <th style="width:50px; text-align:center;"><?php $tcmp->lang->P( 'Active?' ); ?></th>
52 <th><?php $tcmp->lang->P( 'Name' ); ?></th>
53 <th><?php $tcmp->lang->P( 'Where?' ); ?></th>
54 <th style="text-align:center;"><?php $tcmp->lang->P( 'Shortcode' ); ?></th>
55 <th style="text-align:center;"><?php $tcmp->lang->P( 'Actions' ); ?></th>
56 </tr>
57 </thead>
58 <tbody class="table-body">
59 <?php
60 $i = 1;
61 foreach ( $snippets as $snippet ) {
62 global $tcmp_allowed_html_tags;
63 $bClass = ( ( $i % 2 ) === 1 ? 'odd' : 'even' );
64 ?>
65 <tr class="<?php echo esc_attr( $bClass ); ?>" id="row_<?php echo esc_attr( $snippet['id'] ); ?>">
66 <td>#<?php echo esc_html( $i++ ); ?></td>
67 <td style="text-align:center;">
68 <?php
69 $color = 'red';
70 $text = 'No';
71 $question = 'QuestionActiveOn';
72 if ( 1 == $snippet['active'] ) {
73 $color = 'green';
74 $text = 'Yes';
75 $question = 'QuestionActiveOff';
76 }
77 $text = '<span style="font-weight:bold; color:' . $color . '">' . $tcmp->lang->L( $text ) . '</span>';
78 $toggle_url = TCMP_TAB_MANAGER_URI . '&tcmp_nonce=' . wp_create_nonce( 'tcmp_toggle' ) . '&action=toggle&id=' . $snippet['id'];
79 ?>
80 <a onclick="return confirm('<?php echo esc_js( $tcmp->lang->L( $question ) ); ?>');" href="<?php echo esc_url( $toggle_url ); ?>">
81 <?php echo wp_kses( $text, $tcmp_allowed_html_tags ); ?>
82 </a>
83 </td>
84 <td><?php echo esc_html( $snippet['name'] ); ?></td>
85 <td>
86 <?php
87 if ( $tcmp->manager->is_mode_script( $snippet ) ) {
88 if ( $tcmp->manager->is_page_everywhere( $snippet ) ) {
89 $text = 'Everywhere';
90 } else {
91 $text = 'Specific Pages';
92 }
93 } else {
94 $text = 'Conversion';
95 }
96 $tcmp->lang->P( $text );
97 ?>
98 </td>
99 <td style="text-align:center;">
100 <input type="text" style="width:110px; text-align:center;" value='[tcm id="<?php echo esc_html( $snippet['id'] ); ?>"]' readonly="readonly" class="tcmp-select-onfocus" />
101 </td>
102 <td style="text-align:center;">
103 <input type="button" class="button button-secondary" value="<?php $tcmp->lang->P( 'Edit' ); ?>" onclick="location.href='<?php echo esc_url( TCMP_TAB_EDITOR_URI . '&id=' . $snippet['id'] ); ?>';"/>
104 <input type="button" class="button button-secondary" value="<?php $tcmp->lang->P( 'Delete?' ); ?>" onclick="TCMP_btnDeleteClick(<?php echo esc_attr( $snippet['id'] ); ?>)"/>
105 </td>
106 </tr>
107 <?php } ?>
108 </tbody>
109 </table>
110 <?php
111 tcmp_notice_pro_features();
112 } else {
113 ?>
114 <h2><?php $tcmp->lang->P( 'EmptyTrackingList', TCMP_TAB_EDITOR_URI ); ?></h2>
115 <?php
116 }
117 }
118