public static function activation_install() { FrmAppHelper::delete_cache_and_transient('frm_plugin_version'); FrmFormActionsController::actions_init(); self::install(); }
public static function import_xml_views($views, $imported) { $imported['posts'] = array(); $form_action_type = FrmFormActionsController::$action_post_type; $post_types = array('frm_display' => 'views', $form_action_type => 'actions', 'frm_styles' => 'styles'); foreach ($views as $item) { $post = array('post_title' => (string) $item->title, 'post_name' => (string) $item->post_name, 'post_type' => (string) $item->post_type, 'post_password' => (string) $item->post_password, 'guid' => (string) $item->guid, 'post_status' => (string) $item->status, 'post_author' => FrmAppHelper::get_user_id_param((string) $item->post_author), 'post_id' => (int) $item->post_id, 'post_parent' => (int) $item->post_parent, 'menu_order' => (int) $item->menu_order, 'post_content' => FrmFieldsHelper::switch_field_ids((string) $item->content), 'post_excerpt' => FrmFieldsHelper::switch_field_ids((string) $item->excerpt), 'is_sticky' => (string) $item->is_sticky, 'comment_status' => (string) $item->comment_status, 'post_date' => (string) $item->post_date, 'post_date_gmt' => (string) $item->post_date_gmt, 'ping_status' => (string) $item->ping_status, 'postmeta' => array(), 'tax_input' => array()); $old_id = $post['post_id']; self::populate_post($post, $item, $imported); unset($item); $post_id = false; if ($post['post_type'] == $form_action_type) { $action_control = FrmFormActionsController::get_form_actions($post['post_excerpt']); if ($action_control) { $post_id = $action_control->maybe_create_action($post, $imported['form_status']); } unset($action_control); } else { if ($post['post_type'] == 'frm_styles') { // Properly encode post content before inserting the post $post['post_content'] = FrmAppHelper::maybe_json_decode($post['post_content']); $post['post_content'] = FrmAppHelper::prepare_and_encode($post['post_content']); // Create/update post now $post_id = wp_insert_post($post); } else { // Create/update post now $post_id = wp_insert_post($post); } } if (!is_numeric($post_id)) { continue; } self::update_postmeta($post, $post_id); $this_type = 'posts'; if (isset($post_types[$post['post_type']])) { $this_type = $post_types[$post['post_type']]; } if (isset($post['ID']) && $post_id == $post['ID']) { $imported['updated'][$this_type]++; } else { $imported['imported'][$this_type]++; } unset($post); $imported['posts'][(int) $old_id] = $post_id; } return $imported; }
</ul> </div> <div class="frm_no_actions"> <div class="inner_actions"> <img src="<?php echo FrmAppHelper::plugin_url() . '/images/sketch_arrow1.png'; ?> " alt=""/> <div class="clear"></div> <?php _e('Click an action to add it to this form', 'formidable'); ?> </div> </div> <?php FrmFormActionsController::list_actions($form, $values); ?> </div> <div id="html_settings" class="tabs-panel <?php echo $a == 'html_settings' ? ' frm_block' : ' frm_hidden'; ?> "> <div class="frm_field_html_box frm_top_container"> <p><label><?php _e('Form Classes', 'formidable'); ?> </label> <input type="text" name="options[form_class]" value="<?php echo esc_attr($values['form_class']);
public static function actions_init() { self::$registered_actions = new Frm_Form_Action_Factory(); self::register_actions(); do_action('frm_form_actions_init'); }
/** * @param int $action_id */ public static function get_single_action_type($action_id, $type) { $action_control = FrmFormActionsController::get_form_actions($type); return $action_control->get_single_action($action_id); }
public function entry_created($entry_id, $form_id) { _deprecated_function(__FUNCTION__, '2.0', 'FrmFormActionsController::trigger_actions("create", ' . $form_id . ', ' . $entry_id . ', "email")'); FrmFormActionsController::trigger_actions('create', $form_id, $entry_id, 'email'); }
public static function get_action_for_form($form_id, $type = 'all', $limit = 99) { $action_controls = FrmFormActionsController::get_form_actions($type); if (empty($action_controls)) { // don't continue if there are no available actions return array(); } if ('all' != $type) { return $action_controls->get_all($form_id, $limit); } $args = self::action_args($form_id, $limit); $actions = FrmAppHelper::check_cache(serialize($args), 'frm_actions', $args, 'get_posts'); if (!$actions) { return array(); } $settings = array(); foreach ($actions as $action) { // some plugins/themes are formatting the post_excerpt $action->post_excerpt = sanitize_title($action->post_excerpt); if (!isset($action_controls[$action->post_excerpt])) { continue; } $action = $action_controls[$action->post_excerpt]->prepare_action($action); $settings[$action->ID] = $action; if (count($settings) >= $limit) { break; } } if (1 === $limit) { $settings = reset($settings); } return $settings; }
public static function get_settings_vars($id, $errors = array(), $message = '') { FrmAppHelper::permission_check('frm_edit_forms'); global $frm_vars; $form = FrmForm::getOne($id); $fields = FrmField::get_all_for_form($id); $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true); if (isset($values['default_template']) && $values['default_template']) { wp_die(__('That template cannot be edited', 'formidable')); } $action_controls = FrmFormActionsController::get_form_actions(); $sections = apply_filters('frm_add_form_settings_section', array(), $values); $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"'; $styles = apply_filters('frm_get_style_opts', array()); require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php'; }
/** * @return int|boolean */ public static function destroy($id) { global $wpdb; $form = self::getOne($id); if (!$form) { return false; } // Disconnect the entries from this form $entries = FrmDb::get_col($wpdb->prefix . 'frm_items', array('form_id' => $id)); foreach ($entries as $entry_id) { FrmEntry::destroy($entry_id); unset($entry_id); } // Disconnect the fields from this form $wpdb->query($wpdb->prepare('DELETE fi FROM ' . $wpdb->prefix . 'frm_fields AS fi LEFT JOIN ' . $wpdb->prefix . 'frm_forms fr ON (fi.form_id = fr.id) WHERE fi.form_id=%d OR parent_form_id=%d', $id, $id)); $query_results = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'frm_forms WHERE id=%d OR parent_form_id=%d', $id, $id)); if ($query_results) { // Delete all form actions linked to this form $action_control = FrmFormActionsController::get_form_actions('email'); $action_control->destroy($id, 'all'); // Clear form caching self::clear_form_cache(); do_action('frm_destroy_form', $id); do_action('frm_destroy_form_' . $id); } return $query_results; }
public static function send_email() { if (current_user_can('frm_view_forms') || current_user_can('frm_edit_forms') || current_user_can('frm_edit_entries')) { if (FrmAppHelper::doing_ajax()) { check_ajax_referer('frm_ajax', 'nonce'); } $entry_id = FrmAppHelper::get_param('entry_id', '', 'get', 'absint'); $form_id = FrmAppHelper::get_param('form_id', '', 'get', 'absint'); printf(__('Resent to %s', 'formidable'), ''); add_filter('frm_echo_emails', '__return_true'); FrmFormActionsController::trigger_actions('create', $form_id, $entry_id, 'email'); } else { _e('Resent to No one! You do not have permission', 'formidable'); } wp_die(); }
public static function _posttax_row() { check_ajax_referer('frm_ajax', 'nonce'); if (isset($_POST['field_id'])) { $field_vars = array('meta_name' => $_POST['meta_name'], 'field_id' => $_POST['field_id'], 'show_exclude' => (int) $_POST['show_exclude'], 'exclude_cat' => (int) $_POST['show_exclude'] ? '-1' : 0); } else { $field_vars = array('meta_name' => '', 'field_id' => '', 'show_exclude' => 0, 'exclude_cat' => 0); } $tax_meta = (int) $_POST['tax_key']; $post_type = sanitize_text_field($_POST['post_type']); $action_key = (int) $_POST['action_key']; $action_control = FrmFormActionsController::get_form_actions('wppost'); $action_control->_set($action_key); if ($post_type) { $taxonomies = get_object_taxonomies($post_type); } $values = array(); if (isset($_POST['form_id'])) { $values['fields'] = FrmField::getAll(array('fi.form_id' => (int) $_POST['form_id'], 'fi.type' => array('checkbox', 'radio', 'select', 'tag', 'data')), 'field_order'); $values['id'] = (int) $_POST['form_id']; } $echo = false; include FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-form-actions/_post_taxonomy_row.php'; wp_die(); }