public function getCustomField($get, $post) { if (!current_user_can(CRED_CAPABILITY)) { wp_die(); } if (!isset($get['_wpnonce']) || !wp_verify_nonce($get['_wpnonce'], '_cred_customfield')) { echo "wpnonce error"; die; } $popup_close = 'false'; $fm = CRED_Loader::get('MODEL/Fields'); $fields = $fm->getTypesDefaultFields(true); if (isset($post['field']) && is_array($post['field'])) { $fm = CRED_Loader::get('MODEL/Fields'); $fm->setCustomField($post['field']); $popup_close = 'true'; } if (isset($get['field_name'])) { $field_name = sanitize_text_field($get['field_name']); $post_type = isset($get['post_type']) ? $get['post_type'] : 'post'; if (isset($get['_reset_']) && '1' == $get['_reset_']) { $fm->ignoreCustomFields($post_type, array($field_name), 'reset'); $popup_close = 'true'; $data = array(); $field_type = ''; //__('Not Set','wp-cred'); } else { $data = $fm->getCustomField($post_type, $field_name); if (isset($get['field'])) { $field_type = $get['field']; if (isset($data['type']) && $data['type'] != $field_type) { $data = array(); } } else { $field_type = isset($data['type']) ? $data['type'] : 'textfield'; } } echo CRED_Loader::tpl('custom-field-setup', array('field' => $fields[$field_type], 'data' => $data, 'popup_close' => $popup_close, 'field_name' => $field_name, 'post_type' => $post_type, 'url' => CRED_CRED::route('/Generic_Fields/getCustomField?post_type=' . $post_type . '&field_name=' . $field_name . '&_wpnonce=' . wp_create_nonce('_cred_customfield')), 'fields' => $fields)); } die; }
/** * Render CRED Form notification option for post expiration. * */ public function cred_pe_add_notification_option($form, $options, $notification) { if ($form->post_type == CRED_USER_FORMS_CUSTOM_POST_NAME) { return; } list($ii, $name, $type) = $options; $notification = self::array_merge_distinct(array('event' => array('expiration_date' => 0)), $notification); echo CRED_Loader::tpl('pe_form_notification_option', array('cred_post_expiration' => $this, 'notification' => $notification, 'ii' => $ii, 'name' => $name, 'type' => $type)); }
public static function addMessagesMetaBox2($form, $args) { $extra = $args['args']['extra']; if (isset($extra->messages)) { $messages = $extra->messages; } else { $messages = false; } $model = CRED_Loader::get('MODEL/UserForms'); if (!$messages) { $messages = $model->getDefaultMessages(); } echo CRED_Loader::tpl('text-settings-meta-box', array('messages' => $messages, 'descriptions' => $model->getDefaultMessageDescriptions())); }
<i class="icon-question-sign"></i> <span><?php echo $help['notification_settings']['text']; ?> </span> </a> <div id='cred_notification_settings_panel_container'> <?php /* <div data-cred-bind="{ action: 'fadeIn', condition: '_cred[notification][enable]<>1' }" class="cred_disabled_overlay"><br /></div> */ ?> <div><br /></div> <?php foreach ($notifications as $ii => $notification) { // new format echo CRED_Loader::tpl('notification', array('form' => $form, 'ii' => $ii, 'enableTestMail' => $enableTestMail, 'notification' => $notification)); // not cache } ?> </div> <?php /* <p id='cred_notification_add_container' class='cred-notification-add-container' <?php echo $enable?'':'style="display:none;"'?>> */ ?> <p id='cred_notification_add_container' class='cred-notification-add-container'> <a id='cred-notification-add-button' class='button cred-notification-add-button' href='javascript:;' data-cred-bind="{ event: 'click', action: 'addItem', tmplRef: '#cred_notification_template', modelRef: '_cred[notification][notifications][__i__]', domRef: '#cred_notification_settings_panel_container',
<fieldset class="cred-fieldset"> <h4><?php _e('Body of emails', 'wp-cred'); ?> </h4> <div id="cred_mail_body_placeholders-<?php echo $ii; ?> " class="cred-label-holder wpcf-wysiwyg"> <label><?php _e('Notification mail body:', 'wp-cred'); ?> </label> <?php echo CRED_Helper::getRichEditor("credmailbody{$ii}", "_cred[notification][notifications][{$ii}][mail][body]", $notification['mail']['body'], array('wpautop' => false, 'teeny' => true, 'editor_height' => 200, 'editor_class' => 'wpcf-wysiwyg'), array('custom_media_buttons' => true, 'extra' => CRED_Loader::tpl('notification-body-codes', array('area_id' => "credmailbody{$ii}", 'form' => $form, 'ii' => $ii, 'notification' => $notification)))); ?> </div> </fieldset> <?php do_action('cred_admin_notification_fields_after', $form, $ii, $notification); ?> <?php if ($enableTestMail) { ?> <p> <a class='button' href='javascript:;' data-cred-bind="{ event: 'click',
public static function cred_delete_post_link($post_id = false, $text = '', $action = '', $class = '', $style = '', $message = '', $message_after = '', $message_show = 1, $redirect = '') { global $post, $current_user; static $idcount = 0; if (!current_user_can('delete_own_posts_with_cred') && $current_user->ID == $post->post_author) { //return '<strong>'.__('Do not have permission (delete own)','wp-cred').'</strong>'; return ''; } if (!current_user_can('delete_other_posts_with_cred') && $current_user->ID != $post->post_author) { //return '<strong>'.__('Do not have permission (delete other)','wp-cred').'</strong>'; return ''; } if ($post_id === false || empty($post_id) || !isset($post_id) || !is_numeric($post_id)) { if (!isset($post->ID)) { return '<strong>' . __('No post specified', 'wp-cred') . '</strong>'; } else { $post_id = $post->ID; } } // localise the ID $post_id = self::getLocalisedID(intval($post_id)); // provide WPML localization for hardcoded texts $text = str_replace(array('%TITLE%', '%ID%'), array(get_the_title($post_id), $post_id), cred_translate('Delete Link Text', $text, 'CRED Shortcodes')); $link_id = '_cred_cred_' . $post_id . '_' . ++$idcount . '_' . rand(1, 10); $_wpnonce = wp_create_nonce($link_id . '_' . $action); $link = CRED_CRED::routeAjax('cred-ajax-delete-post&cred_post_id=' . $post_id . '&cred_action=' . $action . '&redirect=' . $redirect . '&_wpnonce=' . $_wpnonce); $_atts = array(); if (!empty($class)) { $_atts[] = 'class="' . esc_attr(str_replace('"', "'", $class)) . '"'; } if (!empty($style)) { $_atts[] = 'style="' . esc_attr(str_replace('"', "'", $style)) . '"'; } $dps = ""; if ($idcount == 1) { //$dps = self::get_delete_post_link_js($message_after); global $message_after; add_action('wp_footer', array('CRED_Helper', 'get_delete_post_link_js'), 100); } return CRED_Loader::tpl('delete-post-link', array('link' => $link, 'text' => $text, 'link_id' => $link_id, 'link_atts' => !empty($_atts) ? implode(' ', $_atts) : false, 'message' => $message, 'message_after' => $message_after, 'message_show' => $message_show, 'js' => $dps)); }
public static function addCREDButton($v, $area) { static $id = 1; $id++; $m = CRED_Loader::get('MODEL/Forms'); $forms = $m->getFormsForTable(0, -1); $m = CRED_Loader::get('MODEL/UserForms'); $uforms = $m->getFormsForTable(0, -1); $shortcode_but = ''; $shortcode_but = CRED_Loader::tpl('insert-form-shortcode-button-extra', array('id' => $id, 'forms' => $forms, 'user_forms' => $uforms, 'help' => self::$help, 'content' => $area, 'help_target' => self::$help_link_target)); $out = $shortcode_but; return $out; }