/**
 * Smarty {google_tools} function plugin
 *
 * Type:     function
 * Name:     google_tools
 * Date:     Décember 18, 2009
 * Update:   09 Septembre, 2014
 * Purpose:  
 * Examples: {google_tools tools="webmaster"}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.5
 * @param array
 * @param Smarty
 * @return string
 *
 */
function smarty_function_google_tools($params, $template)
{
    $type = $params['tools'];
    if (!isset($type)) {
        trigger_error("type: missing 'type' parameter");
        return;
    }
    switch ($type) {
        case 'analytics':
            $analyticsdata = frontend_model_setting::select_uniq_setting('analytics');
            $analytics = $analyticsdata['setting_value'];
            if ($analytics != null) {
                $tools = <<<EOT
<script type="text/javascript">
  (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', '{$analytics}', 'auto');
  ga('send', 'pageview');
</script>
EOT;
            } else {
                $tools = '';
            }
            break;
        case 'webmaster':
            $webmasterdata = frontend_model_setting::select_uniq_setting('webmaster');
            $tools = $webmasterdata['setting_value'];
            break;
        case 'robots':
            $robotsdata = frontend_model_setting::select_uniq_setting('robots');
            $tools = $robotsdata['setting_value'];
    }
    return $tools;
}
Example #2
0
 /**
  *
  */
 function __construct()
 {
     $this->setting = frontend_model_setting::select_uniq_setting('css_inliner');
     $this->mail = new magixglobal_model_mail('mail');
     if (magixcjquery_filter_request::isGet('add_cart')) {
         $this->add_cart = magixcjquery_form_helpersforms::inputNumeric($_GET['add_cart']);
     }
     if (magixcjquery_filter_request::isGet('delete_item')) {
         $this->delete_item = magixcjquery_form_helpersforms::inputNumeric($_GET['delete_item']);
     }
     if (magixcjquery_filter_request::isGet('get_nbr_items')) {
         $this->get_nbr_items = magixcjquery_form_helpersforms::inputClean($_GET['get_nbr_items']);
     }
     if (magixcjquery_filter_request::isGet('get_price_items')) {
         $this->get_price_items = magixcjquery_form_helpersforms::inputClean($_GET['get_price_items']);
     }
     if (magixcjquery_filter_request::isGet('get_amount_to_pay')) {
         $this->get_amount_to_pay = magixcjquery_form_helpersforms::inputNumeric($_GET['get_amount_to_pay']);
     }
     if (magixcjquery_filter_request::isGet('json_cart')) {
         $this->json_cart = magixcjquery_form_helpersforms::inputNumeric($_GET['json_cart']);
     }
     if (magixcjquery_filter_request::isPost('item_to_delete')) {
         $this->item_to_delete = magixcjquery_form_helpersforms::inputNumeric($_POST['item_to_delete']);
     }
     if (magixcjquery_filter_request::isPost('id_cart_to_send')) {
         $this->id_cart_to_send = magixcjquery_form_helpersforms::inputClean($_POST['id_cart_to_send']);
     }
     if (magixcjquery_filter_request::isGet('send_devis')) {
         $this->devis_to_send = magixcjquery_form_helpersforms::inputClean($_GET['send_devis']);
     }
     if (magixcjquery_filter_request::isGet('booking')) {
         $this->booking = magixcjquery_form_helpersforms::inputClean($_GET['booking']);
     }
     if (magixcjquery_filter_request::isGet('pstring1')) {
         $this->pstring1 = magixcjquery_form_helpersforms::inputClean($_GET['pstring1']);
     }
     if (magixcjquery_filter_request::isPost('idcatalog')) {
         $this->idcatalog = magixcjquery_form_helpersforms::inputNumeric($_POST['idcatalog']);
     }
     if (magixcjquery_filter_request::isPost('booking_quantity')) {
         $this->booking_quantity = magixcjquery_form_helpersforms::inputNumeric($_POST['booking_quantity']);
     }
     if (magixcjquery_filter_request::isPost('quantity_qty')) {
         $this->quantity_qty = magixcjquery_form_helpersforms::inputNumeric($_POST['quantity_qty']);
     }
     if (magixcjquery_filter_request::isPost('attr')) {
         $this->attr = magixcjquery_form_helpersforms::inputNumeric($_POST['attr']);
     }
     if (magixcjquery_filter_request::isPost('item_qty')) {
         $this->item_qty = magixcjquery_form_helpersforms::inputNumeric($_POST['item_qty']);
     }
     if (magixcjquery_filter_request::isPost('item_attr')) {
         $this->item_attr = magixcjquery_form_helpersforms::inputNumeric($_POST['item_attr']);
     }
     if (magixcjquery_filter_request::isGet('pstring2')) {
         $this->pstring2 = magixcjquery_form_helpersforms::inputClean($_GET['pstring2']);
     }
     //
     if (magixcjquery_filter_request::isPost('tva_country')) {
         $this->tva_country = magixcjquery_form_helpersforms::inputClean($_POST['tva_country']);
     }
     //IMAGE
     if (isset($_FILES['logo_perso']["name"])) {
         $this->logo_perso = magixcjquery_url_clean::rplMagixString($_FILES['logo_perso']["name"]);
     }
     if (magixcjquery_filter_request::isPost('logo')) {
         $this->logo = magixcjquery_form_helpersforms::inputClean($_POST['logo']);
     }
     if (magixcjquery_filter_request::isSession('idprofil')) {
         $this->idprofil_session = magixcjquery_form_helpersforms::inputNumeric($_SESSION['idprofil']);
     }
     // template
     $this->template = new frontend_controller_plugins();
     //Frais de transport
     $this->shipping_price = $this->template->getTplVars('shipping');
     //Frais de transport offert au dessus du montant
     $this->free_shipping_amount = '0.00';
     //Montant de la TVA
     $this->tva_amount = 00;
     $this->modelSystem = new magixglobal_model_system();
     // Module
     if (class_exists('plugins_cartpay_module')) {
         $this->module = new plugins_cartpay_module();
     }
     if (magixcjquery_filter_request::isGet('mod')) {
         $this->mod = magixcjquery_form_helpersforms::inputClean($_GET['mod']);
     }
     if (magixcjquery_filter_request::isGet('action')) {
         $this->action = magixcjquery_form_helpersforms::inputClean($_GET['action']);
     }
 }
/**
 * Smarty {google_tools} function plugin
 *
 * Type:     function
 * Name:     google_tools
 * Date:     Décember 18, 2009
 * Update:   11 Octobre, 2010
 * Purpose:  
 * Examples: {google_tools tools="webmaster"}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.2
 * @param array
 * @param Smarty
 * @return string
 *
 */
function smarty_function_google_tools($params, $template)
{
    $type = $params['tools'];
    if (!isset($type)) {
        trigger_error("type: missing 'type' parameter");
        return;
    }
    switch ($type) {
        case 'analytics':
            $analyticsdata = frontend_model_setting::select_uniq_setting('analytics');
            $analytics = $analyticsdata['setting_value'];
            if ($analytics != null) {
                $tools = <<<EOT
<script type="text/javascript">
    //<![CDATA[
    // Google Analytics for Magix CMS
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', '{$analytics}']);
    _gaq.push(['_trackPageview']);
    (function () {
        var ga = document.createElement('script');
        ga.type = 'text/javascript';
        ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ga, s);
    })();
    //]]>
</script>
EOT;
            } else {
                $tools = '';
            }
            break;
        case 'webmaster':
            $webmasterdata = frontend_model_setting::select_uniq_setting('webmaster');
            $tools = $webmasterdata['setting_value'];
            break;
        case 'robots':
            $robotsdata = frontend_model_setting::select_uniq_setting('robots');
            $tools = $robotsdata['setting_value'];
    }
    return $tools;
}