Beispiel #1
0
/**
 * Basic scripts
 */
function wpcf_enqueue_scripts()
{
    if (!is_admin()) {
        return;
    }
    if (!wpcf_is_embedded()) {
        /**
         * Basic JS
         */
        wp_register_script('wpcf-js', WPCF_RES_RELPATH . '/js/basic.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', 'toolset-colorbox'), WPCF_VERSION);
        wp_localize_script('wpcf-js', 'wpcf_js', array('close' => __('Close', 'wpcf')));
        wp_enqueue_script('wpcf-js');
        if (function_exists('wpcf_admin_add_js_settings')) {
            wpcf_admin_add_js_settings('wpcf_nonce_toggle_group', '\'' . wp_create_nonce('group_form_collapsed') . '\'');
        }
    }
    /**
     * Basic JS
     */
    wp_enqueue_script('wpcf-js-embedded', WPCF_EMBEDDED_RES_RELPATH . '/js/basic.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', 'select2'), WPCF_VERSION);
    wp_localize_script('wpcf-js-embedded', 'WPCF_basic', array('field_already_in_use' => sprintf(__('%s This field is locked because the same field is added multiple times to this post. %s%s%s you can set the value%s', 'wpcf'), '<small style="display: block;">', '<a href="#" class="focus_correct_field" data-field-slug="##DATA-FIELD-ID##" >', 'Here', '</a>', '</small>')));
    /*
     *
     * Basic CSS
     */
    wp_enqueue_style('wpcf-css-embedded');
    /*
     *
     * Other components
     */
    if (!defined('WPTOOLSET_FORMS_ABSPATH')) {
        // Repetitive
        wp_enqueue_script('wpcf-repeater', WPCF_EMBEDDED_RES_RELPATH . '/js/repetitive.js', array('wpcf-js-embedded'), WPCF_VERSION);
        wp_enqueue_style('wpcf-repeater', WPCF_EMBEDDED_RES_RELPATH . '/css/repetitive.css', array('wpcf-css-embedded'), WPCF_VERSION);
    }
    // Conditional
    wp_enqueue_script('types-conditional');
    // RTL
    if (is_rtl()) {
        wp_enqueue_style('wpcf-rtl', WPCF_EMBEDDED_RES_RELPATH . '/css/rtl.css', array('wpcf-css-embedded'), WPCF_VERSION);
    }
    /**
     * select2
     */
    $select2_version = '3.5.2';
    if (!wp_script_is('select2', 'registered')) {
        wp_register_script('select2', WPCF_EMBEDDED_TOOLSET_RELPATH . '/toolset-common/res/lib/select2/select2.min.js', array('jquery'), $select2_version);
    }
    if (!wp_style_is('select2', 'registered')) {
        wp_register_style('select2', WPCF_EMBEDDED_TOOLSET_RELPATH . '/toolset-common/res/lib/select2/select2.css', array(), $select2_version);
    }
    if (!wp_style_is('select2')) {
        wp_enqueue_style('select2');
    }
    // Add JS settings
    wpcf_admin_add_js_settings('wpcfFormUniqueValuesCheckText', '\'' . __('Warning: same values selected', 'wpcf') . '\'');
    wpcf_admin_add_js_settings('wpcfFormUniqueNamesCheckText', '\'' . __('Warning: field name already used', 'wpcf') . '\'');
    wpcf_admin_add_js_settings('wpcfFormUniqueSlugsCheckText', '\'' . __('Warning: field slug already used', 'wpcf') . '\'');
    wpcf_admin_add_js_settings('wpcfFormUsedOrReservedSlug', '\'' . __('You cannot use this slug because it is already used or a reserved word. Please choose a different slug.', 'wpcf') . '\'');
}
Beispiel #2
0
/**
 * Basic scripts
 */
function wpcf_enqueue_scripts()
{
    if (!wpcf_is_embedded()) {
        /*
         * 
         * Basic JS
         */
        wp_enqueue_script('wpcf-js', WPCF_RES_RELPATH . '/js/basic.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs'), WPCF_VERSION);
        /*
         * 
         * Basic CSS
         */
        wp_enqueue_style('wpcf-css', WPCF_RES_RELPATH . '/css/basic.css', array(), WPCF_VERSION);
    }
    /*
     * 
     * Basic JS
     */
    wp_enqueue_script('wpcf-js-embedded', WPCF_EMBEDDED_RES_RELPATH . '/js/basic.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs'), WPCF_VERSION);
    /*
     * 
     * Basic CSS
     */
    wp_enqueue_style('wpcf-css-embedded', WPCF_EMBEDDED_RES_RELPATH . '/css/basic.css', array(), WPCF_VERSION);
    /*
     * 
     * Other components
     */
    if (!defined('WPTOOLSET_FORMS_ABSPATH')) {
        // Repetitive
        wp_enqueue_script('wpcf-repeater', WPCF_EMBEDDED_RES_RELPATH . '/js/repetitive.js', array('wpcf-js-embedded'), WPCF_VERSION);
        wp_enqueue_style('wpcf-repeater', WPCF_EMBEDDED_RES_RELPATH . '/css/repetitive.css', array('wpcf-css-embedded'), WPCF_VERSION);
    }
    // Conditional
    wp_enqueue_script('types-conditional');
    wpcf_admin_add_js_settings('wpcfConditionalVerify_nonce', wp_create_nonce('cd_verify'));
    wpcf_admin_add_js_settings('wpcfConditionalVerifyGroup', wp_create_nonce('cd_group_verify'));
    // RTL
    if (is_rtl()) {
        wp_enqueue_style('wpcf-rtl', WPCF_EMBEDDED_RES_RELPATH . '/css/rtl.css', array('wpcf-css-embedded'), WPCF_VERSION);
    }
}
/**
 * Basic scripts
 */
function wpcf_enqueue_scripts()
{
    if (!is_admin()) {
        return;
    }
    if (!wpcf_is_embedded()) {
        /**
         * Basic JS
         */
        wp_register_script('wpcf-js', WPCF_RES_RELPATH . '/js/basic.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', 'toolset-colorbox'), WPCF_VERSION);
        wp_localize_script('wpcf-js', 'wpcf_js', array('close' => __('Close', 'wpcf')));
        wp_enqueue_script('wpcf-js');
        if (function_exists('wpcf_admin_add_js_settings')) {
            wpcf_admin_add_js_settings('wpcf_nonce_toggle_group', '\'' . wp_create_nonce('group_form_collapsed') . '\'');
        }
    }
    /**
     * Basic JS
     */
    wp_enqueue_script('wpcf-js-embedded', WPCF_EMBEDDED_RES_RELPATH . '/js/basic.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', 'select2'), WPCF_VERSION);
    /*
     *
     * Basic CSS
     */
    wp_enqueue_style('wpcf-css-embedded');
    /*
     *
     * Other components
     */
    if (!defined('WPTOOLSET_FORMS_ABSPATH')) {
        // Repetitive
        wp_enqueue_script('wpcf-repeater', WPCF_EMBEDDED_RES_RELPATH . '/js/repetitive.js', array('wpcf-js-embedded'), WPCF_VERSION);
        wp_enqueue_style('wpcf-repeater', WPCF_EMBEDDED_RES_RELPATH . '/css/repetitive.css', array('wpcf-css-embedded'), WPCF_VERSION);
    }
    // Conditional
    wp_enqueue_script('types-conditional');
    // RTL
    if (is_rtl()) {
        wp_enqueue_style('wpcf-rtl', WPCF_EMBEDDED_RES_RELPATH . '/css/rtl.css', array('wpcf-css-embedded'), WPCF_VERSION);
    }
    /**
     * select2
     */
    $select2_version = '3.5.2';
    if (!wp_script_is('select2', 'registered')) {
        wp_register_script('select2', WPCF_EMBEDDED_RELPATH . '/toolset/toolset-common/utility/js/select2.min.js', array('jquery'), $select2_version);
    }
    if (!wp_style_is('select2', 'registered')) {
        wp_register_style('select2', WPCF_EMBEDDED_RELPATH . '/toolset/toolset-common/utility/css/select2/select2.css', array(), $select2_version);
    }
    if (!wp_style_is('select2')) {
        wp_enqueue_style('select2');
    }
    // Add JS settings
    wpcf_admin_add_js_settings('wpcfFormUniqueValuesCheckText', '\'' . __('Warning: same values selected', 'wpcf') . '\'');
    wpcf_admin_add_js_settings('wpcfFormUniqueNamesCheckText', '\'' . __('Warning: field name already used', 'wpcf') . '\'');
    wpcf_admin_add_js_settings('wpcfFormUniqueSlugsCheckText', '\'' . __('Warning: field slug already used', 'wpcf') . '\'');
    wpcf_admin_add_js_settings('wpcfFormUsedOrReservedSlug', '\'' . __('You cannot use this slug because it is already used or a reserved word. Please choose a different slug.', 'wpcf') . '\'');
}
Beispiel #4
0
/**
 * Add fields to user profile
 */
function wpcf_admin_user_profile_save_hook($user_id)
{
    if (!current_user_can('edit_user', $user_id)) {
        return false;
    }
    if (!wpcf_is_embedded()) {
        require_once WPCF_INC_ABSPATH . '/usermeta.php';
    }
    require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
    require_once WPCF_EMBEDDED_INC_ABSPATH . '/usermeta.php';
    require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields-post.php';
    require_once WPCF_EMBEDDED_INC_ABSPATH . '/usermeta-post.php';
    wpcf_admin_userprofilesave_init($user_id);
}
Beispiel #5
0
/**
 * Basic scripts
 */
function wpcf_enqueue_scripts()
{
    if (!wpcf_is_embedded()) {
        /*
         * 
         * Basic JS
         */
        wp_enqueue_script('wpcf-js', WPCF_RES_RELPATH . '/js/basic.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs'), WPCF_VERSION);
        /*
         * 
         * Basic CSS
         */
        wp_enqueue_style('wpcf-css', WPCF_RES_RELPATH . '/css/basic.css', array(), WPCF_VERSION);
        /*
         * Settings
         */
        // _nonce for editor callback
        wpcf_admin_add_js_settings('wpcfEditorCallbackNonce', wp_create_nonce('editor_callback'));
        // Thickbox generic title
        wpcf_admin_add_js_settings('wpcfEditorTbTitle', esc_js(__('Insert field', 'wpcf')));
    }
    /*
     * 
     * Basic JS
     */
    wp_enqueue_script('wpcf-js-embedded', WPCF_EMBEDDED_RES_RELPATH . '/js/basic.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs'), WPCF_VERSION);
    /*
     * 
     * Basic CSS
     */
    wp_enqueue_style('wpcf-css-embedded', WPCF_EMBEDDED_RES_RELPATH . '/css/basic.css', array(), WPCF_VERSION);
    /*
     * 
     * Other components
     */
    // Repetitive
    wp_enqueue_script('wpcf-repeater', WPCF_EMBEDDED_RES_RELPATH . '/js/repetitive.js', array('wpcf-js-embedded'), WPCF_VERSION);
    wp_enqueue_style('wpcf-repeater', WPCF_EMBEDDED_RES_RELPATH . '/css/repetitive.css', array('wpcf-css-embedded'), WPCF_VERSION);
    // Conditional
    wp_enqueue_script('wpcf-conditional', WPCF_EMBEDDED_RES_RELPATH . '/js/conditional.js', array('wpcf-js-embedded'), WPCF_VERSION);
    wpcf_admin_add_js_settings('wpcfConditionalVerify_nonce', wp_create_nonce('cd_verify'));
    wpcf_admin_add_js_settings('wpcfConditionalVerifyGroup', wp_create_nonce('cd_group_verify'));
    // RTL
    if (is_rtl()) {
        wp_enqueue_style('wpcf-rtl', WPCF_EMBEDDED_RES_RELPATH . '/css/rtl.css', array('wpcf-css-embedded'), WPCF_VERSION);
    }
}
<?php

/*
 * Image editor form.
 */
if (!defined('ABSPATH')) {
    die('Security check');
}
if (!isset($data)) {
    $data = array();
}
$data = array_merge(array('alignment' => 'none', 'alignment_options' => array(), 'alt' => '', 'height' => '', 'image' => '', 'image_size' => 'full', 'preview' => '', 'size_options' => array(), 'title' => '', 'warning_remote' => false, 'width' => '', 'url' => false, 'onload' => ''), (array) $data);
if ($data['warning_remote']) {
    if (wpcf_is_embedded()) {
        $warning_remote = __('Remote image resize is disabled, so Types will only resize images that you upload.', 'wpcf');
    } else {
        $warning_remote = sprintf(__('Remote image resize is currently disabled, so Types will only resize images that you upload. To change, go to the %sTypes settings page%s.', 'wpcf'), '<a href="' . admin_url('admin.php?page=wpcf-custom-settings#types-image-settings') . '" target="_blank">', '</a>');
    }
}
?>

<div data-bind="template: {name:'tpl-types-modal-image'}"></div>

<!--TYPES MODAL IMAGE-->
<script id="tpl-types-modal-image" type="text/html">

<div class="fieldset">
	<p>
		<label for="image-title" class="input-title"><?php 
_e('Image title', 'wpcf');
?>
Beispiel #7
0
/**
 * Basic scripts
 */
function wpcf_enqueue_scripts()
{
    if (!wpcf_is_embedded()) {
        /**
         * Basic JS
         */
        wp_register_script('wpcf-js', WPCF_RES_RELPATH . '/js/basic.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', 'toolset-colorbox'), WPCF_VERSION);
        wp_localize_script('wpcf-js', 'wpcf_js', array('close' => __('Close', 'wpcf')));
        wp_enqueue_script('wpcf-js');
    }
    /**
     * Basic JS
     */
    wp_enqueue_script('wpcf-js-embedded', WPCF_EMBEDDED_RES_RELPATH . '/js/basic.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs'), WPCF_VERSION);
    /*
     *
     * Basic CSS
     */
    wp_enqueue_style('wpcf-css-embedded');
    /*
     *
     * Other components
     */
    if (!defined('WPTOOLSET_FORMS_ABSPATH')) {
        // Repetitive
        wp_enqueue_script('wpcf-repeater', WPCF_EMBEDDED_RES_RELPATH . '/js/repetitive.js', array('wpcf-js-embedded'), WPCF_VERSION);
        wp_enqueue_style('wpcf-repeater', WPCF_EMBEDDED_RES_RELPATH . '/css/repetitive.css', array('wpcf-css-embedded'), WPCF_VERSION);
    }
    // Conditional
    wp_enqueue_script('types-conditional');
    // RTL
    if (is_rtl()) {
        wp_enqueue_style('wpcf-rtl', WPCF_EMBEDDED_RES_RELPATH . '/css/rtl.css', array('wpcf-css-embedded'), WPCF_VERSION);
    }
    /**
     * select2
     */
    if (!wp_script_is('select2', 'registered')) {
        $select2_version = '3.5.2';
        wp_register_script('select2', WPCF_EMBEDDED_RELPATH . '/common/utility/js/select2.min.js', array('jquery'), $select2_version);
        wp_register_style('select2', WPCF_EMBEDDED_RELPATH . '/common/utility/css/select2/select2.css', array(), $select2_version);
        wp_enqueue_style('select2');
    }
}