예제 #1
0
function cforms2_admin_enqueue_scripts()
{
    global $localversion;
    $suffix = SCRIPT_DEBUG ? '' : '.min';
    $r = plugin_dir_url(__FILE__);
    wp_enqueue_style('wp-color-picker');
    wp_register_style('jquery-flexigrid', $r . 'js/css/flexigrid.css', false, '1.1');
    wp_enqueue_style('jquery-flexigrid');
    wp_register_script('jquery-flexigrid', $r . "js/jquery.flexigrid{$suffix}.js", array('jquery'), '1.1');
    wp_enqueue_script('jquery-flexigrid');
    wp_register_script('jquery-jqmodal', $r . 'js/jquery.jqmodal.js', array('jquery'), '1.3.0');
    wp_register_script('cforms-admin', $r . 'js/cforms.admin.js', array('jquery', 'jquery-jqmodal', 'jquery-ui-draggable', 'jquery-ui-sortable', 'wp-color-picker'), $localversion);
    wp_localize_script('cforms-admin', 'cforms2_nonces', array('installpreset' => wp_create_nonce('cforms2_installpreset'), 'reset_captcha' => wp_create_nonce('cforms2_reset_captcha'), 'cforms2_field' => wp_create_nonce('cforms2_field'), 'deleteentries' => wp_create_nonce('database_deleteentries'), 'deleteentry' => wp_create_nonce('database_deleteentry'), 'dlentries' => wp_create_nonce('database_dlentries'), 'getentries' => wp_create_nonce('database_getentries')));
    wp_enqueue_script('cforms-admin');
    cforms2_enqueue_style_admin();
    cforms2_enqueue_script_datepicker($localversion, 'dd/mm/yy');
}
예제 #2
0
function cforms2_enqueue_scripts()
{
    global $wp_query, $localversion, $cformsSettings;
    ### add content actions and filters
    $page_obj = $wp_query->get_queried_object();
    $exclude = $cformsSettings['global']['cforms_inexclude']['ex'] == '1';
    $onPages = str_replace(' ', '', stripslashes(htmlspecialchars($cformsSettings['global']['cforms_inexclude']['ids'])));
    $onPagesA = explode(',', $onPages);
    if ($onPages == '' || in_array($page_obj->ID, $onPagesA) && !$exclude || !in_array($page_obj->ID, $onPagesA) && $exclude) {
        if ($cformsSettings['global']['cforms_no_css'] != '1') {
            wp_register_style('cforms2', plugin_dir_url(__FILE__) . 'styling/' . $cformsSettings['global']['cforms_css']);
            wp_enqueue_style('cforms2');
        }
        ### add calendar
        if ($cformsSettings['global']['cforms_datepicker'] == '1') {
            cforms2_enqueue_script_datepicker($localversion, stripslashes($cformsSettings['global']['cforms_dp_date']));
        }
        wp_register_script('jquery-md5', plugin_dir_url(__FILE__) . "js/jquery.md5.js", array('jquery'), '1.2.1');
        wp_register_script('cforms2', plugin_dir_url(__FILE__) . 'js/cforms.js', array('jquery', 'jquery-md5'), $localversion);
        wp_localize_script('cforms2', 'cforms2_ajax', array('url' => admin_url('admin-ajax.php'), 'nonces' => array('reset_captcha' => wp_create_nonce('cforms2_reset_captcha'), 'submitcomment' => wp_create_nonce('submitcomment'))));
        wp_enqueue_script('cforms2');
    }
}