Ejemplo n.º 1
0
function cred_embedded_html()
{
    if (isset($_GET['cred_id']) && is_numeric($_GET['cred_id'])) {
        $cred_id = (int) $_GET['cred_id'];
        //$cred = get_post($cred_id);
        $cred = get_post($cred_id, OBJECT, 'edit');
        //StaticClass::_pre($cred);
        if (null == $cred) {
            wp_die('<div class="wpv-setting-container"><p class="toolset-alert toolset-alert-error">' . __('You attempted to edit a CRED that doesn&#8217;t exist. Perhaps it was deleted?', 'wpv-views') . '</p></div>');
        } elseif ('cred-form' != $cred->post_type) {
            wp_die('<div class="wpv-setting-container"><p class="toolset-alert toolset-alert-error">' . __('You attempted to edit a CRED that doesn&#8217;t exist. Perhaps it was deleted?', 'wpv-views') . '</p></div>');
        } else {
            CRED_Loader::loadAsset('STYLE/cred_codemirror_style_dev', 'cred_codemirror_style', false, CRED_CONCAT_ASSETS);
            wp_enqueue_style('cred_codemirror_style');
            CRED_Loader::loadAsset('SCRIPT/cred_codemirror_dev', 'cred_codemirror_dev', false, CRED_CONCAT_ASSETS);
            wp_enqueue_script('cred_codemirror_dev');
            $sm = CRED_Loader::get('MODEL/Settings');
            $settings = $sm->getSettings();
            $fm = CRED_Loader::get('MODEL/Forms');
            $form_fields = $fm->getFormCustomFields($cred_id, array('form_settings', 'notification', 'extra', 'wizard'));
            $forms_model = CRED_Loader::get('MODEL/Forms');
            $settings = $forms_model->getFormCustomField($cred_id, 'form_settings');
            $fields_model = CRED_Loader::get('MODEL/Fields');
            $fields_all = $fields_model->getFields($cred->post_type);
            if ($settings->post['post_status'] == 'trash') {
                wp_die('<div class="wpv-setting-container"><p class="toolset-alert toolset-alert-error">' . __("You can\\'t edit this CRED because it is in the Trash. Please restore it and try again.", 'wpv-views') . '</p></div>');
            }
            $_button_getcred = '<a style="vertical-align: baseline; background: none repeat scroll 0 0 #f6921e;
    border-color: #ef6223;
    box-shadow: 0 1px 0 rgba(239, 239, 239, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
    color: #fff;
    text-decoration: none;" class="button button-primary-toolset" title="get cred" target="_blank" href="http://wp-types.com/home/cred/?utm_source=credplugin&utm_campaign=cred&utm_medium=embedded-cred-promotional-link&utm_term=Get CRED">Get CRED</a>';
            $_header = "You are viewing the read-only version of this CRED form. To edit it, you need to get CRED plugin. {$_button_getcred}";
            $_content = "CRED lets you build forms for editing any WordPress content on the site’s front-end. You can choose if the form creates or edits content and the type of content it will create or edit. The form is designed with simple HTML and shortcodes.";
            $settings_post_type = $settings->post['post_type'];
            $settings_post_status = $settings->post['post_status'];
            $settings_type = $settings->form['type'];
            $settings_action = $settings->form['action'];
            $has_captcha = $settings->form['include_captcha_scaffold'] == 1 ? " and includes captcha field " : "";
            $notification = $form_fields['notification'];
            if ($notification->enable == 1 && count($notification->notifications) > 0) {
                $notification_txt = "<p>Enabled</p>";
                foreach ($notification->notifications as $n => $notf) {
                    if (count($notf['to']['type']) > 0) {
                        $notification_txt .= "A notification will be sent to ";
                        //StaticClass::_pre($notf['to']['type']);
                        foreach ($notf['to']['type'] as $m => $t) {
                            if ($t == 'wp_user' || $t == 'mail_field' || $t == 'user_id_field') {
                                continue;
                            }
                            $notification_txt .= "<b>" . normalize_notf_txt($t) . "</b>";
                        }
                        foreach ($notf['to']['wp_user'] as $a => $b) {
                            if ($b != 'to') {
                                $notification_txt .= " <b>" . normalize_notf_txt($b) . "</b> ";
                            }
                        }
                    }
                    if (isset($notf['event']) && !empty($notf['event'])) {
                        $notification_event = "<p>The notification event is set to <b>" . trans_notf_event($notf['event']['type']) . "</b></p>";
                        $post_status_event = "<p>The notification post status event is set to <b>" . trans_notf_event($notf['event']['post_status']) . "</b></p>";
                        $condition_event = "";
                        if (!empty($notf['event']['condition']) && count($notf['event']['condition']) > 0) {
                            $condition_event = "<p>The notification is <b>Based to conditions</b></p>";
                        }
                        $notification_txt .= " {$notification_event} {$post_status_event} {$condition_event} ";
                    }
                    if (isset($notf['to']['author']) && $notf['to']['author'] == 'author') {
                        $notification_txt .= "<p>A notification will be <b>Sent to the Author</b></p>";
                    }
                }
            } else {
                $notification_txt = "Disabled";
            }
            $settings_txt = "This Form ";
            switch ($settings_type) {
                case 'new':
                    $act = "Creates";
                    $settings_txt .= '<b>Creates Content</b>';
                    break;
                case 'edit':
                    $act = "Edits";
                    $settings_txt .= '<b>Edits Content</b>';
                    break;
            }
            $settings_txt .= " and after submition ";
            switch ($settings_action) {
                case 'form':
                    $settings_txt .= '<b>keeps displaying this form</b>';
                    break;
                case 'message':
                    $settings_txt .= '<b>displays a custom message</b>';
                    break;
                case 'post':
                    $settings_txt .= '<b>displays a post</b>';
                    break;
                case 'page':
                    $settings_txt .= '<b>got to a custom page</b>';
                    break;
            }
            $settings_txt .= $settings->form['hide_comments'] == 1 ? "<p>Comments are hidden</p>" : "";
            $settings_post_txt = "This Form {$act} <b>{$settings_post_type}</b> and the status will be <b>" . trans_txt($settings_post_status) . "</b>" . $has_captcha;
            $extra = $form_fields['extra'];
            $css = $extra->css;
            $css_txt = "";
            $js = $extra->js;
            $css_txt = "Empty";
            if (!empty($css)) {
                $css_txt = $css;
            }
            $js_txt = "Empty";
            if (!empty($js)) {
                $js_txt = $js;
            }
            ?>

            <div style="clear:both;height:20px;"></div>

            <h2><?php 
            echo $cred->post_title;
            ?>
</h2>

            <div style="width:950px;height:auto;">
                <div class="toolset-help js-info-box">
                    <div class="toolset-help-content">
                        <h2 style="color: #222;
                            font-size: 1.1em;
                            font-weight:bold;
                            margin: 0.83em 0;"><?php 
            echo $_header;
            ?>
</h2>
                        <p><?php 
            echo $_content;
            ?>
</p>
                    </div>
                    <div class="toolset-help-sidebar">
                        <div class="toolset-help-sidebar-ico"></div>
                    </div>

                </div>
            </div>


            <h3>Form Settings:</h3> <?php 
            echo $settings_txt;
            ?>

            <h3>Post Type Settings:</h3> <?php 
            echo $settings_post_txt;
            ?>

            <h3>Form Content:</h3> 

            <div style="width:950px;height:auto;">
                <textarea id="mycontent"><?php 
            echo $cred->post_content;
            ?>
</textarea>
            </div>

            <script>
                jQuery(document).ready(function () {
                    CodeMirror.defineMode("myshortcodes", codemirror_shortcodes_overlay);
                    CodeMirror.fromTextArea(document.getElementById("mycontent")
                            , {
                                mode: 'myshortcodes', //"text/html",
                                tabMode: "indent",
                                lineWrapping: true,
                                lineNumbers: true,
                                readOnly: "nocursor"
                            });
                });
            </script>

            <?php 
            if (false) {
                ?>
<div style="padding:5px;margin-left:10px;border:1px #000 solid;width:80%;height:200px;overflow-y:auto;"><?php 
                echo $cred->post_content;
                ?>
</div><?php 
            }
            ?>

            <?php 
            if (false) {
                ?>
                <h3>JS:</h3> <?php 
                echo $js_txt;
                ?>

                <h3>CSS:</h3> <?php 
                echo $css_txt;
                ?>
            
                <?php 
            }
            ?>
            <h3>Notification:</h3> <?php 
            echo $notification_txt;
            ?>
            <?php 
            //StaticClass::_pre($form_fields['extra']);
            //StaticClass::_pre($cred);
            //StaticClass::_pre($settings);
            //StaticClass::_pre($fields_all);
        }
    } else {
        wp_die('<div class="wpv-setting-container"><p class="toolset-alert toolset-alert-error">' . __('You attempted to edit a View that doesn&#8217;t exist. Perhaps it was deleted?', 'wpv-views') . '</p></div>');
    }
    ?>

    <?php 
}
if (!defined('ABSPATH')) {
    die('Security check');
}
// field options
$options = array('hidden' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default value:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<input type='text' name='field[default]' value='" . $data['default'] . "' />" : "<input type='text' name='field[default]' value='' />"), 'password' => array('has_default_value' => false, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default value:', 'wp-cred'), 'value_field' => "<input type='text' name='default' value='' />"), 'text' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default value:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<input type='text' name='field[default]' value='" . $data['default'] . "' />" : "<input type='text' name='field[default]' value='' />"), 'textfield' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default value:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<input type='text' name='field[default]' value='" . $data['default'] . "' />" : "<input type='text' name='field[default]' value='' />"), 'colorpicker' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default value:', 'wp-cred'), 'value_field' => "<input type='text' name='default' value='' />"), 'embed' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default value:', 'wp-cred'), 'value_field' => "<input type='text' name='default' value='' />"), 'numeric' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default value:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<input type='text' name='field[default]' value='" . $data['default'] . "' />" : "<input type='text' name='field[default]' value='' />"), 'integer' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default value:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<input type='text' name='field[default]' value='" . $data['default'] . "' />" : "<input type='text' name='field[default]' value='' />"), 'file' => array('has_default_value' => false, 'additional' => '', 'default_selector' => '', 'value_label' => '', 'value_field' => ''), 'video' => array('has_default_value' => false, 'additional' => '', 'default_selector' => '', 'value_label' => '', 'value_field' => ''), 'audio' => array('has_default_value' => false, 'additional' => '', 'default_selector' => '', 'value_label' => '', 'value_field' => ''), 'image' => array('has_default_value' => false, 'additional' => array("<input type='text' size='5' value='' name='field[additional_options][max_width]' /><span style='vertical-align:bottom;margin-left:10px'>" . __('Max. Width', 'wp-cred') . "</span>", "<input type='text' size='5' value='' name='field[additional_options][max_height]' /><span style='vertical-align:bottom;margin-left:10px'>" . __('Max. Height', 'wp-cred') . "</span>"), 'default_selector' => '', 'value_label' => '', 'value_field' => ''), 'checkbox' => array('has_default_value' => true, 'additional' => "<label class='cred-label'><input type='checkbox' class='cred-checkbox' value='1' name='field[additional_options][checked]' /><span style='vertical-align:bottom;margin-left:10px'>" . __('Checked by default', 'wp-cred') . "</span></label>", 'default_selector' => '', 'value_label' => __('Set value:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<input type='text' name='field[default]' value='" . $data['default'] . "' />" : "<input type='text' name='field[default]' value='' />"), 'select' => array('has_default_value' => true, 'additional' => '', 'default_selector' => "<label class='cred-label'><input type='radio' value='1' class='cred-radio' name='field[options][option_default]' /><span class='cred-radio-replace'></span><span style='vertical-align:bottom;margin-left:10px'>" . __('Default', 'wp-cred') . "</span></label>", 'default_selector_checked' => "<label class='cred-label'><input type='radio' value='1' class='cred-radio' name='field[options][option_default]' checked='checked' /><span class='cred-radio-replace'></span><span style='vertical-align:bottom;margin-left:10px'>" . __('Default', 'wp-cred') . "</span></label>", 'value_label' => '', 'value_field' => ''), 'radio' => array('has_default_value' => true, 'additional' => '', 'default_selector' => "<label class='cred-label'><input type='radio' value='1' class='cred-radio' name='field[options][option_default]' /><span class='cred-radio-replace'></span><span style='vertical-align:bottom;margin-left:10px'>" . __('Default', 'wp-cred') . "</span></label>", 'default_selector_checked' => "<label class='cred-label'><input type='radio' value='1' class='cred-radio' name='field[options][option_default]' checked='checked' /><span class='cred-radio-replace'></span><span style='vertical-align:bottom;margin-left:10px'>" . __('Default', 'wp-cred') . "</span></label>", 'value_label' => '', 'value_field' => ''), 'checkboxes' => array('has_default_value' => true, 'additional' => '', 'default_selector' => "<label class='cred-label'><input type='checkbox' value='1' class='cred-checkbox' name='field[options][option_default][]' /><span style='vertical-align:bottom;margin-left:10px'>" . __('Checked', 'wp-cred') . "</span></label>", 'default_selector_checked' => "<label class='cred-label'><input type='checkbox' value='1' class='cred-checkbox' name='field[options][option_default][]' checked='checked' /><span style='vertical-align:bottom;margin-left:10px'>" . __('Checked', 'wp-cred') . "</span></label>", 'value_label' => '', 'value_field' => ''), 'skype' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default Skypename:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<input type='text' name='field[default]' value='" . $data['default'] . "' />" : "<input type='text' name='field[default]' value='' />"), 'email' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default email:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<input type='text' name='field[default]' value='" . $data['default'] . "' />" : "<input type='text' name='field[default]' value='' />"), 'url' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default URL:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<input type='text' name='field[default]' value='" . $data['default'] . "' />" : "<input type='text' name='field[default]' value='' />"), 'phone' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default phone:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<input type='text' name='field[default]' value='" . $data['default'] . "' />" : "<input type='text' name='field[default]' value='' />"), 'textarea' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default value:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<textarea rows='10' style='overflow-y:auto;width:300px;' name='field[default]'>" . $data['default'] . "</textarea>" : "<textarea rows='10' style='overflow-y:auto;width:300px;' name='field[default]'></textarea>"), 'wysiwyg' => array('has_default_value' => true, 'additional' => '', 'default_selector' => '', 'value_label' => __('Default value:', 'wp-cred'), 'value_field' => isset($data['default']) ? "<textarea rows='10' style='overflow-y:auto;width:300px;' name='field[default]'>" . $data['default'] . "</textarea>" : "<textarea rows='10' style='overflow-y:auto;width:300px;' name='field[default]'></textarea>"), 'date' => array('has_default_value' => false, 'additional' => '', 'default_selector' => '', 'value_label' => '', 'value_field' => ''));
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php 
// include jquery from wp-admin and styles
CRED_Loader::loadAsset('STYLE/cred_template_style', 'cred_template_style', true);
wp_print_styles('cred_template_style');
CRED_Loader::loadAsset('SCRIPT/cred_template_script', 'cred_template_script', true);
//wp_enqueue_script('jquery-ui-sortable');
wp_print_scripts('cred_template_script');
wp_register_style('onthego-admin-styles', ON_THE_GO_SYSTEMS_BRANDING_REL_PATH . 'onthego-styles/onthego-styles.css');
wp_print_styles('onthego-admin-styles');
?>
<!-- templates -->
<script id='option-template' type='text/html-template'>
<li class='sub-row sortable-item'>
    <span class='cell'>
        <a class='move-option' href='javascript:;' title='<?php 
echo esc_attr(__('Move option', 'wp-cred'));
?>
'></a>
        <a class='remove-option' href='javascript:;' title='<?php 
echo esc_attr(__('Remove option', 'wp-cred'));
Ejemplo n.º 3
0
    public static function onAdminEnqueueScripts()
    {
        // On what admin pages should CRED assets be loaded?
        $set_on_pages = array('view-archives-editor', 'views-editor', 'CRED_User_Forms', 'CRED_Forms', 'CRED_Fields', 'CRED_Settings', 'CRED_Help');
        // Filter description is placed in setJSAndCSS().
        $set_on_pages = apply_filters('cred_get_custom_pages_to_load_assets', $set_on_pages);
        // setup css js
        // determine current admin page
        self::getAdminPage(array('post_type' => CRED_FORMS_CUSTOM_POST_NAME, 'base' => 'admin.php', 'pages' => $set_on_pages));
        self::getAdminPage(array('post_type' => CRED_USER_FORMS_CUSTOM_POST_NAME, 'base' => 'admin.php', 'pages' => $set_on_pages));
        CRED_Loader::loadAsset('STYLE/cred_utility_css', 'cred_utility_css', false, CRED_CONCAT_ASSETS);
        wp_enqueue_style('cred_utility_css');
        wp_register_style('utility-style', CRED_PLUGIN_URL . '/toolset/toolset-common/utility/css/notifications.css', array(), time());
        wp_enqueue_style('utility-style');
        if (self::$currentPage->isCustomPostEdit || self::$currentPage->isCustomPostNew || self::$currentUPage->isCustomPostEdit || self::$currentUPage->isCustomPostNew) {
            wp_dequeue_script('autosave');
            wp_deregister_script('autosave');
            global $post;
            // add form saved admin message
            if ($post) {
                if ($post->post_type == CRED_FORMS_CUSTOM_POST_NAME) {
                    $form_validation = CRED_Loader::get('MODEL/Forms')->getFormCustomField($post->ID, 'validation');
                    if (isset($_GET['message']) && '4' == $_GET['message'] && (isset($form_validation) && isset($form_validation['fail']) && $form_validation['fail'])) {
                        $form_saved_and_valid = false;
                        add_action('admin_notices', array(__CLASS__, 'formNotValidNotice'), 10);
                        // force opne metabox if validation issues
                        add_filter('postbox_classes_' . CRED_FORMS_CUSTOM_POST_NAME . "_crednotificationdiv", array(__CLASS__, 'forceMetaboxOpen'));
                    } elseif (isset($_GET['message']) && '4' == $_GET['message'] && (!isset($form_validation) || !isset($form_validation['fail']) || !$form_validation['fail'])) {
                        $form_saved_and_valid = true;
                        add_action('admin_notices', array(__CLASS__, 'formValidNotice'), 10);
                    }
                }
                if ($post->post_type == CRED_USER_FORMS_CUSTOM_POST_NAME) {
                    $form_validation = array("success" => 1);
                    if (isset($_GET['message']) && '4' == $_GET['message'] && (isset($form_validation) && isset($form_validation['fail']) && $form_validation['fail'])) {
                        $form_saved_and_valid = false;
                        add_action('admin_notices', array(__CLASS__, 'formNotValidNotice'), 10);
                        // force opne metabox if validation issues
                        add_filter('postbox_classes_' . CRED_USER_FORMS_CUSTOM_POST_NAME . "_crednotificationdiv", array(__CLASS__, 'forceMetaboxOpen'));
                    } elseif (isset($_GET['message']) && '4' == $_GET['message'] && (!isset($form_validation) || !isset($form_validation['fail']) || !$form_validation['fail'])) {
                        $form_saved_and_valid = true;
                        add_action('admin_notices', array(__CLASS__, 'formValidNotice'), 10);
                        //https://onthegosystems.myjetbrains.com/youtrack/issue/cred-147
                        //#########################################################################################################################
                        $fm = CRED_Loader::get('MODEL/UserForms');
                        $form_fields = $fm->getFormCustomFields($post->ID, array('form_settings', 'notification'));
                        $show_notification_alert = false;
                        $correct_notification_set = false;
                        //at least 1 autogeneration field is set
                        if ($form_fields['form_settings']->form['autogenerate_password_scaffold'] == 1) {
                            //checking each notification
                            foreach ($form_fields['notification']->notifications as $n => $notification) {
                                if (isset($notification['event'])) {
                                    if (isset($notification['event']['type']) && $notification['event']['type'] == 'form_submit' && (isset($notification['event']['post_status']) && $notification['event']['post_status'] == 'publish') && (isset($notification['to']['mail_field']['to_type']) && $notification['to']['mail_field']['to_type'] == 'to') && (isset($notification['to']['mail_field']['address_field']) && $notification['to']['mail_field']['address_field'] == 'user_email')) {
                                        //at least body must contains placeholder
                                        if (isset($notification['mail']['body']) && ($form_fields['form_settings']->form['autogenerate_password_scaffold'] == 1 && preg_match('/%%USER_PASSWORD%%/', $notification['mail']['body']))) {
                                            foreach ($notification['to']['type'] as $m => $type) {
                                                //at least email notification to the user must be set
                                                if ($type == 'mail_field') {
                                                    $correct_notification_set = true;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                if ($correct_notification_set) {
                                    break;
                                }
                            }
                            $show_notification_alert = !$correct_notification_set;
                        }
                        if ($show_notification_alert) {
                            add_action('admin_notices', array(__CLASS__, 'userFormAlertNotice'), 10);
                        }
                        //#########################################################################################################################
                    }
                }
            }
        }
        if (self::$currentPage->isPostEdit || self::$currentPage->isPostNew || self::$currentPage->isCustomAdminPage || (self::$currentUPage->isPostEdit || self::$currentUPage->isPostNew || self::$currentUPage->isCustomAdminPage)) {
            if (self::$currentPage->isCustomPostEdit || self::$currentPage->isCustomPostNew || (self::$currentUPage->isCustomPostEdit || self::$currentUPage->isCustomPostNew)) {
                CRED_Loader::loadAsset('SCRIPT/cred_cred_dev', 'cred_cred', false, CRED_CONCAT_ASSETS);
                CRED_Loader::loadAsset('SCRIPT/cred_wizard_dev', 'cred_wizard');
                CRED_Loader::loadAsset('STYLE/cred_cred_style_dev', 'cred_cred_style', false, CRED_CONCAT_ASSETS);
                // WordPress 4.0 compatibility: remove all the new fancy editor enhancements that break the highlighting and toolbars
                wp_dequeue_script('editor-expand');
            } else {
                CRED_Loader::loadAsset('SCRIPT/cred_cred_post_dev', 'cred_cred', false, CRED_CONCAT_ASSETS);
                CRED_Loader::loadAsset('STYLE/cred_cred_style_nocodemirror_dev', 'cred_cred_style', false, CRED_CONCAT_ASSETS);
            }
            // enqueue them with dependencies
            wp_enqueue_style('cred_cred_style');
            wp_enqueue_script('cred_cred');
            $fm = CRED_Loader::get('MODEL/UserForms');
            $form_fields = $fm->getFormCustomFields($post->ID, array('form_settings', 'notification'));
            // Inline Settings/Localization
            wp_localize_script('cred_cred', 'cred_settings', array('_current_page' => self::getCurrentPostType(), '_cred_wpnonce' => wp_create_nonce('_cred_wpnonce'), 'autogenerate_username_scaffold' => $form_fields['form_settings']->form['autogenerate_username_scaffold'], 'autogenerate_nickname_scaffold' => $form_fields['form_settings']->form['autogenerate_nickname_scaffold'], 'autogenerate_password_scaffold' => $form_fields['form_settings']->form['autogenerate_password_scaffold'], 'assets' => CRED_ASSETS_URL, 'ajaxurl' => admin_url('admin-ajax.php'), 'editurl' => admin_url('post.php'), 'form_controller_url' => '/Forms/updateFormField', 'wizard_url' => '/Settings/disableWizard', 'homeurl' => home_url('/'), 'settingsurl' => CRED_CRED::$settingsPage, 'help' => CRED_CRED::$help, 'locale' => array('OK' => __('OK', 'wp-cred'), 'Yes' => __('Yes', 'wp-cred'), 'No' => __('No', 'wp-cred'), 'syntax_button_title' => __('Syntax', 'wp-cred'), 'text_button_title' => __('Text'), 'title_explain_text' => __('Set the title for this new form.', 'wp-cred'), 'content_explain_text' => __('Build the form using HTML and CRED shortcodes. Click on the <strong>Auto-Generate Form</strong> button to create the form with default fields. Use the <strong>Add User/Post Fields</strong> button to add fields that belong to this post type, or <strong>Add Generic Fields</strong> to add any other inputs.', 'wp-cred'), 'next_text' => __('Next', 'wp-cred'), 'prev_text' => __('Previous', 'wp-cred'), 'finish_text' => __('Finish', 'wp-cred'), 'quit_wizard_text' => __('Exit Wizard Mode', 'wp-cred'), 'quit_wizard_confirm_text' => sprintf(__('Do you want to disable the Wizard for this form only, or disable the Wizard for all future forms as well? <br /><br /><span style="font-style:italic">(You can re-enable the Wizard at the %s Settings Page if you change your mind)</span>', 'wp-cred'), CRED_NAME), 'quit_wizard_all_forms' => __('All forms', 'wp-cred'), 'quit_wizard_this_form' => __('This form', 'wp-cred'), 'cancel_text' => __('Cancel', 'wp-cred'), 'form_type_missing' => __('You must select the form type for the form', 'wp-cred'), 'post_type_missing' => __('You must select a post type for the form', 'wp-cred'), 'ok_text' => __('OK', 'wp-cred'), 'step_1_title' => __('Title', 'wp-cred'), 'step_2_title' => __('Settings', 'wp-cred'), 'step_3_title' => __('Post Type', 'wp-cred'), 'step_4_title' => __('Build Form', 'wp-cred'), 'step_5_title' => __('Notifications', 'wp-cred'), 'submit_but' => __('Update', 'wp-cred'), 'form_content' => __('Form Content', 'wp-cred'), 'form_fields' => __('Form Fields', 'wp-cred'), 'post_fields' => __('Standard Post Fields', 'wp-cred'), 'user_fields' => __('Standard User Fields', 'wp-cred'), 'custom_fields' => __('Custom Fields', 'wp-cred'), 'taxonomy_fields' => __('Taxonomies', 'wp-cred'), 'parent_fields' => __('Parents', 'wp-cred'), 'extra_fields' => __('Extra Fields', 'wp-cred'), 'form_types_not_set' => __('Form Type or Post Type is not set!'), 'set_form_title' => __('Please set the form Title', 'wp-cred'), 'create_new_content_form' => __('(Create a new-post form first)', 'wp-cred'), 'create_edit_content_form' => __('(Create an edit-post form first)', 'wp-cred'), 'create_new_content_user_form' => __('(Create a new-user form first)', 'wp-cred'), 'create_edit_content_user_form' => __('(Create an edit-user form first)', 'wp-cred'), 'show_advanced_options' => __('Show advanced options', 'wp-cred'), 'hide_advanced_options' => __('Hide advanced options', 'wp-cred'), 'select_form' => __('Please select a form first', 'wp-cred'), 'select_post' => __('Please select a post first', 'wp-cred'), 'insert_post_id' => __('Please insert a valid post ID', 'wp-cred'), 'insert_shortcode' => __('Click to insert the specified shortcode', 'wp-cred'), 'select_shortcode' => __('Please select a shortcode first', 'wp-cred'), 'post_types_dont_match' => __('This post type is incompatible with the selected form', 'wp-cred'), 'post_status_must_be_public' => __('In order to display the post, post status must be set to Publish', 'wp-cred'), 'refresh_done' => __('Refresh Complete', 'wp-cred'), 'enable_popup_for_preview' => __('You have to enable popup windows in order for Preview to work!', 'wp-cred'), 'show_syntax_highlight' => __('Enable Syntax Highlight', 'wp-cred'), 'hide_syntax_highlight' => __('Revert to default editor', 'wp-cred'), 'syntax_highlight_on' => __('Syntax Highlight On', 'wp-cred'), 'syntax_highlight_off' => __('Syntax Highlight Off', 'wp-cred'), 'invalid_title' => __('Title should contain only letters, numbers and underscores/dashes', 'wp-cred'), 'form_user_not_set' => __('Form User Fields not set!'), 'invalid_user_role' => __('Allowed User Role option cannot be empty.', 'wp-cred'), 'invalid_form_type' => __('Allowed Form Type option cannot be empty.', 'wp-cred'))));
        }
        if (self::$currentPage->isCustomPostEdit || self::$currentPage->isCustomPostNew || self::$currentPage->isCustomAdminPage || (self::$currentUPage->isCustomPostEdit || self::$currentUPage->isCustomPostNew || self::$currentUPage->isCustomAdminPage)) {
            ?>
<style type="text/css">
                /* CRED plugin ICONS */
                #icon-CRED_Forms.icon32-posts-cred-form,
                #icon-edit.icon32-posts-cred-form,
                #icon-cred-frontend-editor {
                    background: transparent no-repeat 0 0;
                }

            <?php 
            if (self::$currentPage->isCustomPostEdit || self::$currentPage->isCustomPostNew || (self::$currentUPage->isCustomPostEdit || self::$currentUPage->isCustomPostNew)) {
                ?>
                    #credformactionmessage ,
                    #cred_form_action_message {
                        height:200px;
                    }
                    /* reduce FOUC a bit */
                    #screen-meta-links,
                    .postbox:not(.cred_related),
                    #post .postbox:not(.cred_related),
                    .wrap div.error, .wrap div.updated {
                        display:none !important;
                    }
                    /*div.wrap {
                        padding-bottom:140px;
                    }*/
                    /*#wpbody-content, div.wrap, form#post {
                        position:relative;
                        overflow:visible;
                        min-height:100%;
                        padding-bottom:140px;
                    }*/
            <?php 
            }
            ?>
            </style><?php 
        }
    }