| @@ -1,65 +1,50 @@ | ||
| 1 | -<?php | |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 3 | -function tcmp_ui_track() { | |
| 4 | - global $tcmp; | |
| 5 | - | |
| 6 | - $track = tcmp_sqs( 'track', '' ); | |
| 7 | - if ( '' != $track ) { | |
| 8 | - // This GET toggle changes a setting AND triggers an outbound telemetry | |
| 9 | - // transmission, so it must be protected against CSRF with a nonce (F-02). | |
| 10 | - if ( ! $tcmp->check->nonce( 'tcmp_track' ) ) { | |
| 11 | - wp_die( esc_html( $tcmp->lang->L( 'Invalid nonce' ) ) ); | |
| 12 | - } | |
| 13 | - $track = intval( $track ); | |
| 14 | - $tcmp->options->setTrackingEnable( $track ); | |
| 15 | - $tcmp->tracking->sendTracking( true ); | |
| 16 | - } | |
| 17 | - | |
| 18 | - $uri = TCMP_TAB_SETTINGS_URI . '&track='; | |
| 19 | - if ( $tcmp->options->isTrackingEnable() ) { | |
| 20 | - $uri .= '0'; | |
| 21 | - $uri = wp_nonce_url( $uri, 'tcmp_track' ); | |
| 22 | - $tcmp->options->pushSuccessMessage( 'EnableAllowTrackingNotice', $uri ); | |
| 23 | - } else { | |
| 24 | - $uri .= '1'; | |
| 25 | - $uri = wp_nonce_url( $uri, 'tcmp_track' ); | |
| 26 | - $tcmp->options->pushErrorMessage( 'DisableAllowTrackingNotice', $uri ); | |
| 27 | - } | |
| 28 | - $tcmp->options->writeMessages(); | |
| 29 | -} | |
| 30 | -function tcmp_ui_settings() { | |
| 31 | - global $tcmp; | |
| 32 | - | |
| 33 | - $tcmp->form->prefix = 'License'; | |
| 34 | - if ( $tcmp->check->nonce( 'tcmp_license' ) ) { | |
| 35 | - $options = $tcmp->options->getMetaboxPostTypes(); | |
| 36 | - foreach ( $options as $k => $v ) { | |
| 37 | - $v = tcmp_isqs( 'metabox_' . $k, 0 ); | |
| 38 | - $options[ $k ] = $v; | |
| 39 | - } | |
| 40 | - $tcmp->options->setMetaboxPostTypes( $options ); | |
| 41 | - | |
| 42 | - $tcmp->options->setHookPriority( $tcmp->utils->iqs( 'tcmpHookPriority', TCMP_HOOK_PRIORITY_DEFAULT ) ); | |
| 43 | - } | |
| 44 | - | |
| 45 | - $tcmp->form->form_starts(); | |
| 46 | - $tcmp->form->prefix = 'Priority'; | |
| 47 | - $tcmp->form->p( 'PrioritySection' ); | |
| 48 | - $tcmp->form->number( 'tcmpHookPriority', $tcmp->options->getHookPriority() ); | |
| 49 | - | |
| 50 | - $tcmp->form->prefix = 'License'; | |
| 51 | - $tcmp->form->p( 'MetaboxSection' ); | |
| 52 | - $metaboxes = $tcmp->options->getMetaboxPostTypes(); | |
| 53 | - | |
| 54 | - $types = $tcmp->utils->query( TCMP_QUERY_POST_TYPES ); | |
| 55 | - foreach ( $types as $v ) { | |
| 56 | - $v = $v['id']; | |
| 57 | - //$tcmp->form->tags=TRUE; | |
| 58 | - //$tcmp->form->premium=!in_array($v, array('post', 'page')); | |
| 59 | - $tcmp->form->checkbox( 'metabox_' . $v, $metaboxes[ $v ] ); | |
| 60 | - } | |
| 61 | - $tcmp->form->nonce( 'tcmp_license' ); | |
| 62 | - $tcmp->form->br(); | |
| 63 | - $tcmp->form->submit( 'Save' ); | |
| 64 | - $tcmp->form->form_ends(); | |
| 65 | -} | |
| 1 | +<?php | |
| 2 | +function tcmp_ui_track() { | |
| 3 | + global $tcmp; | |
| 4 | + | |
| 5 | + $track=TCMP_SQS('track', ''); | |
| 6 | + if($track!='') { | |
| 7 | + $track=intval($track); | |
| 8 | + $tcmp->Options->setTrackingEnable($track); | |
| 9 | + $tcmp->Tracking->sendTracking(TRUE); | |
| 10 | + } | |
| 11 | + | |
| 12 | + $uri=TCMP_TAB_SETTINGS_URI.'&track='; | |
| 13 | + if($tcmp->Options->isTrackingEnable()) { | |
| 14 | + $uri.='0'; | |
| 15 | + $tcmp->Options->pushSuccessMessage('EnableAllowTrackingNotice', $uri); | |
| 16 | + } else { | |
| 17 | + $uri.='1'; | |
| 18 | + $tcmp->Options->pushErrorMessage('DisableAllowTrackingNotice', $uri); | |
| 19 | + } | |
| 20 | + $tcmp->Options->writeMessages(); | |
| 21 | +} | |
| 22 | +function tcmp_ui_settings() { | |
| 23 | + global $tcmp; | |
| 24 | + | |
| 25 | + $tcmp->Form->prefix='License'; | |
| 26 | + if($tcmp->Check->nonce('tcmp_license')) { | |
| 27 | + $options=$tcmp->Options->getMetaboxPostTypes(); | |
| 28 | + foreach ($options as $k => $v) { | |
| 29 | + $v=TCMP_ISQS('metabox_' . $k, 0); | |
| 30 | + $options[$k]=$v; | |
| 31 | + } | |
| 32 | + $tcmp->Options->setMetaboxPostTypes($options); | |
| 33 | + } | |
| 34 | + | |
| 35 | + $tcmp->Form->formStarts(); | |
| 36 | + $tcmp->Form->p('MetaboxSection'); | |
| 37 | + $metaboxes=$tcmp->Options->getMetaboxPostTypes(); | |
| 38 | + | |
| 39 | + $types=$tcmp->Utils->query(TCMP_QUERY_POST_TYPES); | |
| 40 | + foreach ($types as $v) { | |
| 41 | + $v=$v['id']; | |
| 42 | + //$tcmp->Form->tags=TRUE; | |
| 43 | + //$tcmp->Form->premium=!in_array($v, array('post', 'page')); | |
| 44 | + $tcmp->Form->checkbox('metabox_'.$v, $metaboxes[$v]); | |
| 45 | + } | |
| 46 | + $tcmp->Form->nonce('tcmp_license'); | |
| 47 | + $tcmp->Form->br(); | |
| 48 | + $tcmp->Form->submit('Save'); | |
| 49 | + $tcmp->Form->formEnds(); | |
| 50 | +} | |