Ejemplo n.º 1
0
    /**
     * Output tracking code
     *
     * @since 1.0.0
     *
     */
    public function print_front_scripts()
    {
        $formworks = options::get_single('formworks');
        if (!empty($formworks['external']['ga'])) {
            ?>
			<script>
			(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
			(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
			m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
			})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

			ga('create', '<?php 
            echo $formworks['external']['ga'];
            ?>
', 'auto');
			ga('send', 'pageview');
			</script>
			<?php 
        }
    }
Ejemplo n.º 2
0
 /**
  * Builds an export file
  *
  * @uses "init" hook
  *
  * @since 0.0.1
  */
 public function check_exporter()
 {
     if (!empty($_REQUEST['download']) && !empty($_REQUEST['formworks-export']) && wp_verify_nonce($_REQUEST['formworks-export'], 'formworks')) {
         $can = options::can();
         if (!$can) {
             status_header(500);
             wp_die(esc_html__('Access denied', 'formworks'));
         }
         $data = options::get_single($_REQUEST['download']);
         header('Content-Type: application/json');
         header('Content-Disposition: attachment; filename="formworks-export.json"');
         echo wp_json_encode($data);
         exit;
     }
 }