<?php global $form_processors; //dump($element,0); // Get Processors $form_processors = $processors = Caldera_Forms_Processor_Load::get_instance()->get_processors(); $form_processors_defaults = array("var processor_defaults = {};"); foreach ($form_processors as $processor => $config) { if (!empty($config['default'])) { $form_processors_defaults[] = "processor_defaults." . sanitize_key($processor) . "_cfg = " . json_encode($config['default']) . ";"; } } function processor_line_template($id = '{{id}}', $type = null) { global $form_processors; $type_name = __('New Form Processor', 'caldera-forms'); if (!empty($type)) { if (empty($form_processors[$type])) { return; } if (isset($form_processors[$type]['name'])) { $type_name = $form_processors[$type]['name']; } } ?> <li class="caldera-processor-nav <?php echo $id; ?> <?php if (!empty($type)) { echo 'processor_type_' . $type;
/** * Get class instance * * @since 1.3.0 * * @return \Caldera_Forms_Processor_Load */ public static function get_instance() { if (is_null(self::$init)) { self::$init = new self(); } return self::$init; }
/** * Add default magic tags * * @param array $tags * * @return array */ public function set_magic_tags($tags) { // get internal tags $system_tags = array('entry_id', 'entry_token', 'ip', 'user:id', 'user:user_login', 'user:first_name', 'user:last_name', 'user:user_email' => array('text', 'email'), 'get:*', 'post:*', 'request:*', 'post_meta:*', 'embed_post:ID', 'embed_post:post_title', 'embed_post:permalink', 'embed_post:post_date' => array('text', 'date_picker'), 'date:Y-m-d H:i:s' => array('text', 'date_picker'), 'date:Y/m/d', 'date:Y/d/m', 'login_url', 'logout_url', 'register_url', 'lostpassword_url'); $tags['system'] = array('type' => __('System Tags', 'caldera-forms'), 'tags' => $system_tags, 'wrap' => array('{', '}')); // get processor tags $processors = Caldera_Forms_Processor_Load::get_instance()->get_processors(); if (!empty($processors)) { foreach ($processors as $processor_key => $processor) { if (isset($processor['magic_tags'])) { foreach ($processor['magic_tags'] as $key_tag => $value_tag) { if (!isset($tags[$processor_key])) { $tags[$processor_key] = array('type' => $processor['name'], 'tags' => array(), 'wrap' => array('{', '}')); } if (is_array($value_tag)) { // compatibility specific $tag = $processor_key . ':' . $key_tag; if (!isset($tags[$processor_key]['tags'][$tag])) { if (!in_array('text', $value_tag)) { $value_tag[] = 'text'; } $tags[$processor_key]['tags'][$tag] = $value_tag; } } else { // compatibility text $tag = $processor_key . ':' . $value_tag; if (!in_array($tag, $tags)) { $tags[$processor_key]['tags'][] = $tag; } } } } } } return $tags; }
/** * Register and enqueue admin-specific style sheet. * * * @return null */ public function enqueue_admin_stylescripts() { $screen = get_current_screen(); wp_enqueue_style($this->plugin_slug . '-admin-icon-styles', CFCORE_URL . 'assets/css/dashicon.css', array(), self::VERSION); if ($screen->base === 'post') { wp_enqueue_style($this->plugin_slug . '-modal-styles', CFCORE_URL . 'assets/css/modals.css', array(), self::VERSION); wp_enqueue_script($this->plugin_slug . '-shortcode-insert', CFCORE_URL . 'assets/js/shortcode-insert.min.js', array('jquery'), self::VERSION); /* //add_editor_style( CFCORE_URL . 'assets/css/caldera-form.css' ); add_editor_style( CFCORE_URL . 'assets/css/caldera-grid.css' ); add_editor_style( CFCORE_URL . 'assets/css/dashicon.css' ); // get fields $field_types = Caldera_Forms::get_field_types(); foreach($field_types as $field_type){ //enqueue styles if( !empty( $field_type['styles'])){ foreach($field_type['styles'] as $style){ add_editor_style( $style ); } } } */ } if (!in_array($screen->base, $this->screen_prefix)) { return; } wp_enqueue_media(); wp_enqueue_script('wp-pointer'); wp_enqueue_style('wp-pointer'); wp_enqueue_script('password-strength-meter'); wp_enqueue_style($this->plugin_slug . '-admin-styles', CFCORE_URL . 'assets/css/admin.css', array(), self::VERSION); wp_enqueue_style($this->plugin_slug . '-modal-styles', CFCORE_URL . 'assets/css/modals.css', array(), self::VERSION); wp_enqueue_style($this->plugin_slug . '-field-styles', CFCORE_URL . 'assets/css/fields.min.css', array(), self::VERSION); /* standalone scripts wp_enqueue_script( $this->plugin_slug .'-admin-scripts', CFCORE_URL . 'assets/js/admin.js', array(), self::VERSION ); wp_enqueue_script( $this->plugin_slug .'-handlebars', CFCORE_URL . 'assets/js/handlebars.js', array(), self::VERSION ); wp_enqueue_script( $this->plugin_slug .'-baldrick-handlebars', CFCORE_URL . 'assets/js/handlebars.baldrick.js', array($this->plugin_slug .'-baldrick'), self::VERSION ); wp_enqueue_script( $this->plugin_slug .'-baldrick-modals', CFCORE_URL . 'assets/js/modals.baldrick.js', array($this->plugin_slug .'-baldrick'), self::VERSION ); wp_enqueue_script( $this->plugin_slug .'-baldrick', CFCORE_URL . 'assets/js/jquery.baldrick.js', array('jquery'), self::VERSION ); */ wp_enqueue_script($this->plugin_slug . '-baldrick', CFCORE_URL . 'assets/js/wp-baldrick-full.js', array('jquery'), self::VERSION); wp_enqueue_script($this->plugin_slug . '-admin-scripts', CFCORE_URL . 'assets/js/admin.min.js', array($this->plugin_slug . '-baldrick'), self::VERSION); if (!empty($_GET['edit'])) { /*// editor specific styles wp_enqueue_script( $this->plugin_slug .'-edit-fields', CFCORE_URL . 'assets/js/edit.js', array('jquery'), self::VERSION ); */ wp_enqueue_script($this->plugin_slug . '-edit-fields', CFCORE_URL . 'assets/js/fields.min.js', array('jquery'), self::VERSION); wp_enqueue_script($this->plugin_slug . '-edit-editor', CFCORE_URL . 'assets/js/edit.min.js', array('jquery'), self::VERSION); wp_enqueue_script('jquery-ui-users'); wp_enqueue_script('jquery-ui-sortable'); wp_enqueue_script('jquery-ui-droppable'); } if (!empty($_GET['edit-entry'])) { wp_enqueue_style('cf-grid-styles', CFCORE_URL . 'assets/css/caldera-grid.css', array(), self::VERSION); } // Load Field Types Styles & Scripts $field_types = apply_filters('caldera_forms_get_field_types', array()); // load panels $panel_extensions = apply_filters('caldera_forms_get_panel_extensions', array()); // load processors $form_processors = $processors = Caldera_Forms_Processor_Load::get_instance()->get_processors(); // merge a list $merged_types = array_merge($field_types, $panel_extensions, $form_processors); foreach ($merged_types as $type => &$config) { // set context if (!empty($_GET['edit'])) { $context =& $config['setup']; } else { $context =& $config; } /// Styles if (!empty($context['styles'])) { foreach ($context['styles'] as $location => $styles) { // front only scripts if ($location === 'front') { continue; } foreach ((array) $styles as $style) { $key = $type . '-' . sanitize_key(basename($style)); // is url if (false === strpos($style, "/")) { // is reference wp_enqueue_style($style); } else { // is url - if ('//' != substr($style, 0, 2) && file_exists($style)) { // local file wp_enqueue_style($key, plugin_dir_url($style) . basename($style), array(), self::VERSION); } else { // most likely remote wp_enqueue_style($key, $style, array(), self::VERSION); } } } } } /// scripts if (!empty($context['scripts'])) { foreach ($context['scripts'] as $location => $scripts) { // front only scripts if ($location === 'front') { continue; } foreach ((array) $scripts as $script) { $key = $type . '-' . sanitize_key(basename($script)); // is url if (false === strpos($script, "/")) { // is reference wp_enqueue_script($script); } else { // is url - if ('//' != substr($script, 0, 2) && file_exists($script)) { // local file wp_enqueue_script($key, plugin_dir_url($script) . basename($script), array('jquery'), self::VERSION); } else { // most likely remote wp_enqueue_script($key, $script, array('jquery'), self::VERSION); } } } } } } //} }