コード例 #1
0
    /**
     * add script to footer override underscore templateSettings, localize validator message
     */
    function override_template_setting()
    {
        ?>
        <!-- override underscore template settings -->
        <script type="text/javascript">
            _.templateSettings = {
                evaluate: /\<\#(.+?)\#\>/g,
                interpolate: /\{\{=(.+?)\}\}/g,
                escape: /\{\{-(.+?)\}\}/g
            };
        </script>
        <!-- localize validator -->
        <script type="text/javascript">
            (function ($) {
                if(typeof $.validator !== 'undefined' ) {
                    $.extend($.validator.messages, {
                        required: "<?php 
        _e("This field is required.", 'aecore-class-ae-framework-backend');
        ?>
",
                        email: "<?php 
        _e("Please enter a valid email address.", 'aecore-class-ae-framework-backend');
        ?>
",
                        url: "<?php 
        _e("Please enter a valid URL.", 'aecore-class-ae-framework-backend');
        ?>
",
                        number: "<?php 
        _e("Please enter a valid number.", 'aecore-class-ae-framework-backend');
        ?>
",
                        digits: "<?php 
        _e("Please enter only digits.", 'aecore-class-ae-framework-backend');
        ?>
",
                        equalTo: "<?php 
        _e("Please enter the same value again.", 'aecore-class-ae-framework-backend');
        ?>
"
                    });
                }
                

            })(jQuery);
        </script>

    <?php 
        // print google analytics code
        if (!is_admin()) {
            echo stripslashes(ae_get_option('google_analytics'));
            // user confirm scripts
            if (isset($_GET['act']) && $_GET['act'] == "confirm" && $_GET['key']) {
                $user_id = AE_Users::confirm($_GET['key']);
                if ($user_id) {
                    $mail = AE_Mailing::get_instance();
                    $mail->confirmed_mail($user_id);
                    ?>
                    <script type="text/javascript" id="user-confirm">
                        (function ($ , Views, Models, AE) {
                            $(document).ready(function(){
                                AE.pubsub.trigger('ae:notification', {
                                    msg: "<?php 
                    _e("Your account has been confirmed successfully!", 'aecore-class-ae-framework-backend');
                    ?>
",
                                    notice_type: 'success',
                                }); 
                                window.location.href = "<?php 
                    echo home_url();
                    ?>
"                                        
                            });
                        })(jQuery, AE.Views, AE.Models, window.AE);
                    </script>   
                <?php 
                }
            }
        }
    }
コード例 #2
0
ファイル: framework.php プロジェクト: maratdev/alllancer
    /**
     * add script to footer override underscore templateSettings, localize validator message
     */
    function override_template_setting()
    {
        ?>
        <!-- localize validator -->
        <script type="text/javascript">
            (function ($) {
                if(typeof $.validator !== 'undefined' ) {
                    $.extend($.validator.messages, {
                        required: "<?php 
        _e("This field is required.", ET_DOMAIN);
        ?>
",
                        email: "<?php 
        _e("Please enter a valid email address.", ET_DOMAIN);
        ?>
",
                        url: "<?php 
        _e("Please enter a valid URL.", ET_DOMAIN);
        ?>
",
                        number: "<?php 
        _e("Please enter a valid number.", ET_DOMAIN);
        ?>
",
                        digits: "<?php 
        _e("Please enter only digits.", ET_DOMAIN);
        ?>
",
                        equalTo: "<?php 
        _e("Please enter the same value again.", ET_DOMAIN);
        ?>
", 
                        date: "<?php 
        _e("Please enter a valid date.", ET_DOMAIN);
        ?>
",
                        creditcard: "<?php 
        _e("Please enter a valid credit card number.", ET_DOMAIN);
        ?>
",
                        accept: "<?php 
        _e("Please enter a value with a valid extension.", ET_DOMAIN);
        ?>
",

                        maxlength: $.validator.format("<?php 
        _e("Please enter no more than {0} characters.", ET_DOMAIN);
        ?>
"),
                        minlength: $.validator.format("<?php 
        _e("Please enter at least {0} characters.", ET_DOMAIN);
        ?>
"),
                        rangelength: $.validator.format("<?php 
        _e("Please enter a value between {0} and {1} characters long.", ET_DOMAIN);
        ?>
"),
                        range: jQuery.validator.format("<?php 
        _e("Please enter a value between {0} and {1}.", ET_DOMAIN);
        ?>
"),
                        min : $.validator.format("<?php 
        _e("Please enter a value greater than or equal to {0}.", ET_DOMAIN);
        ?>
"),
                        max : $.validator.format("<?php 
        _e("Please enter a value less than or equal to {0}.", ET_DOMAIN);
        ?>
")
                    });
                }
                

            })(jQuery);
        </script>

    <?php 
        // print google analytics code
        if (!is_admin()) {
            echo stripslashes(ae_get_option('google_analytics'));
            // user confirm scripts
            if (isset($_GET['act']) && $_GET['act'] == "confirm" && $_GET['key']) {
                $user_id = AE_Users::confirm($_GET['key']);
                if ($user_id) {
                    $mail = AE_Mailing::get_instance();
                    $mail->confirmed_mail($user_id);
                    ?>
                    <script type="text/javascript" id="user-confirm">
                        (function ($ , Views, Models, AE) {
                            $(document).ready(function(){
                                AE.pubsub.trigger('ae:notification', {
                                    msg: "<?php 
                    _e("Your account has been confirmed successfully!", ET_DOMAIN);
                    ?>
",
                                    notice_type: 'success',
                                }); 
                                window.location.href = "<?php 
                    echo home_url();
                    ?>
"                                        
                            });
                        })(jQuery, AE.Views, AE.Models, window.AE);
                    </script>   
                <?php 
                }
            }
        }
    }