/**
  * Outputs the content of the widget
  *
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance)
 {
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
     }
     $atts = array();
     $atts['id'] = 'scfp-' . $this->id;
     echo SCFP()->doContactFormWidget($atts);
     echo $args['after_widget'];
 }
function scfp_activate_plugin()
{
    if (class_exists('Webcodin\\WCPContactForm\\Core\\Agp_Autoloader') && !function_exists('SCFP')) {
        $autoloader = Agp_Autoloader::instance();
        $autoloader->setClassMap(array('paths' => array(__DIR__ => array('classes')), 'namespaces' => array('Webcodin\\WCPContactForm\\Core' => array(__DIR__ => array('agp-core'))), 'classmaps' => array(__DIR__ => 'classmap.json')));
        //$autoloader->generateClassMap(__DIR__);
        function SCFP()
        {
            return SCFP::instance();
        }
        SCFP();
    }
}
 private function redirect()
 {
     $formSettings = SCFP()->getSettings()->getFormSettings();
     $pageId = $formSettings['page_name'];
     if (!empty($pageId)) {
         $location = get_page_link($pageId);
         wp_redirect($location);
         die;
     }
     return FALSE;
 }
Example #4
0
<?php

$post = $params;
$entry = SCFP()->getFormEntries();
$data = SCFP()->getSettings()->getFieldsSettings();
?>
<div class="wrap">
    <h2>Entry #<?php 
echo $entry->getEntryId($post->ID);
?>
</h2>
    <div id="poststuff">
        <div id="post-body" class="metabox-holder columns-2">
            <div id="post-body-content" style="position: relative;">
                <div id="wp-content-editor-container" class="wp-editor-container">
                    <table class="view-entry-table widefat scfp-view-table">
                        <?php 
foreach ($data as $datakey => $datavalue) {
    ?>
                            <?php 
    if (!empty($datavalue['visibility']) && $datavalue['field_type'] !== 'captcha' && $datavalue['field_type'] !== 'captcha-recaptcha') {
        ?>
                                <tr class="view-entry-header alternate">
                                    <td><strong><?php 
        echo $datavalue['name'];
        ?>
</strong></td>
                                </tr>
                                <tr>
                                    <td>
                                        <?php 
 public function getFieldsSettings()
 {
     $defaults = $this->getFieldsDefaults();
     $types = $this->getFieldsTypes();
     $data = SCFP()->getFormSettings()->getData('scfp_form_settings');
     if (empty($data)) {
         $data = $this->getFieldsDefaults();
     }
     foreach ($data as $k => $v) {
         if (array_key_exists($k, $defaults)) {
             if (!empty($defaults[$k]['visibility_readonly'])) {
                 $data[$k]['visibility'] = $defaults[$k]['visibility'];
                 $data[$k]['visibility_readonly'] = $defaults[$k]['visibility_readonly'];
             }
             if (!empty($defaults[$k]['required_readonly'])) {
                 $data[$k]['required'] = $defaults[$k]['required'];
                 $data[$k]['required_readonly'] = $defaults[$k]['required_readonly'];
             }
             if (!empty($defaults[$k]['no_email'])) {
                 $data[$k]['no_email'] = $defaults[$k]['no_email'];
             }
             if (!empty($defaults[$k]['no_csv'])) {
                 $data[$k]['no_csv'] = $defaults[$k]['no_csv'];
             }
             if (!isset($data[$k]['field_type'])) {
                 $data[$k]['field_type'] = $types[$k];
             }
         }
     }
     return apply_filters('wcp_contact_form_get_fields_settings', $data);
 }
Example #6
0
    <form class="scfp-form" id="<?php 
echo $id;
?>
"  method="post" action=""<?php 
echo !empty($formSettings['html5_enabled']) ? '' : ' novalidate';
?>
>
        <input type="hidden" name="form_id" value="<?php 
echo $id;
?>
"/>
        <input type="hidden" name="action" value="scfp-form-submit"/>
        <?php 
foreach ($fieldsSettings as $key => $field) {
    if (!empty($field['visibility']) && !empty($field['field_type'])) {
        echo SCFP()->getTemplate("form/{$field['field_type']}", array('id' => $id, 'form' => $form, 'key' => $key, 'field' => $field, 'formSettings' => $formSettings, 'formData' => $formData));
    }
}
?>
        <div class="scfp-form-action scfp-form-button-position-<?php 
echo $button_position;
?>
">
            <input class="scfp-form-submit" type="submit" value="<?php 
echo $formSettings['button_name'];
?>
">
        </div>        
    </form>
</div>
Example #7
0
    $atts_s = '';
    foreach ($atts as $key => $value) {
        $atts_s .= $key . '="' . $value . '"';
    }
    $atts = $atts_s;
}
$obj = new stdClass();
$obj->ID = 'scfp_form_settings';
?>
    </tbody>        
</table>     

    <?php 
if (!empty($note)) {
    ?>
<p class="description"><?php 
    echo $note;
    ?>
</p><?php 
}
?>
    
    <?php 
echo SCFP()->getFormSettings()->viewMetabox($obj);
?>

<table class="form-table">
    <tbody>

    
    
Example #8
0
 public function getFormDynamicStyle($id)
 {
     $this->lessParser->parseFile($this->getBaseDir() . '/assets/less/style.less');
     $styleSettings = SCFP()->getSettings()->getStyleSettings();
     $this->lessParser->ModifyVars(array('id' => $id, 'no_border' => !empty($styleSettings['no_border']) ? $styleSettings['no_border'] : '', 'border_size' => !empty($styleSettings['border_size']) ? $styleSettings['border_size'] : '', 'border_style' => !empty($styleSettings['border_style']) ? $styleSettings['border_style'] : '', 'border_color' => !empty($styleSettings['border_color']) ? $styleSettings['border_color'] : '', 'field_label_text_color' => !empty($styleSettings['field_label_text_color']) ? $styleSettings['field_label_text_color'] : '', 'field_label_marker_text_color' => !empty($styleSettings['field_label_marker_text_color']) ? $styleSettings['field_label_marker_text_color'] : '', 'field_text_color' => !empty($styleSettings['field_text_color']) ? $styleSettings['field_text_color'] : '', 'no_background' => !empty($styleSettings['no_background']) ? $styleSettings['no_background'] : '', 'background_color' => !empty($styleSettings['background_color']) ? $styleSettings['background_color'] : '', 'button_color' => !empty($styleSettings['button_color']) ? $styleSettings['button_color'] : '', 'text_color' => !empty($styleSettings['text_color']) ? $styleSettings['text_color'] : '', 'hover_button_color' => !empty($styleSettings['hover_button_color']) ? $styleSettings['hover_button_color'] : '', 'hover_text_color' => !empty($styleSettings['hover_text_color']) ? $styleSettings['hover_text_color'] : ''));
     return '<style type="text/css" >' . $this->lessParser->getCss() . '</style>';
 }
Example #9
0
$key = $_REQUEST['tab'];
$args = $params;
$label = !empty($args->fields['fields'][$args->field]['label']) ? $args->fields['fields'][$args->field]['label'] : '';
$class = !empty($args->fields['fields'][$args->field]['class']) ? $args->fields['fields'][$args->field]['class'] : '';
$note = !empty($args->fields['fields'][$args->field]['note']) ? $args->fields['fields'][$args->field]['note'] : '';
$atts = !empty($args->fields['fields'][$args->field]['atts']) ? $args->fields['fields'][$args->field]['atts'] : '';
if (is_array($atts)) {
    $atts_s = '';
    foreach ($atts as $key => $value) {
        $atts_s .= $key . '="' . $value . '"';
    }
    $atts = $atts_s;
}
$data = SCFP()->getSettings()->getErrorsSettings();
$settings = SCFP()->getSettings()->getErrorsConfig();
?>

<?php 
if (!empty($note)) {
    ?>
<tr><p class="description"><?php 
    echo $note;
    ?>
</p></tr><?php 
}
?>

<?php 
foreach ($settings as $error_config_key => $error_config_value) {
    ?>
Example #10
0
<?php

$id = isset($params['id']) ? $params['id'] : NULL;
if (!empty($id)) {
    $row = isset($params['row']) ? $params['row'] : 0;
    $num = isset($params['num']) ? $params['num'] : '';
    $data = !empty($params['data']) ? $params['data'] : NULL;
    $btnClass = empty($data['no_delete']) ? 'button agp-del-row' : 'button disabled';
    $fieldTypes = SCFP()->getSettings()->getFieldSet('fieldTypes');
    if (empty($data['field_type'])) {
        $data['visibility'] = 1;
    }
    $selectedType = !empty($data['field_type']) ? $data['field_type'] : 'text';
    ?>
<div class="scfp-field scfp-field-num"><span class="priority scfp-order"><?php 
    echo $num;
    ?>
</span></div>
<div class="scfp-field scfp-field-type">
    <select class="widefat" id="<?php 
    echo "{$id}_{$row}_field_type";
    ?>
" name="<?php 
    echo "{$id}[field_settings][{$row}][field_type]";
    ?>
"<?php 
    echo !empty($data['no_delete']) ? ' disabled="disabled" readonly="readonly"' : '';
    ?>
 >
        <?php 
    foreach ($fieldTypes as $k => $v) {
Example #11
0
$args = new stdClass();
$args->settings = $params;
$args->key = isset($_GET['tab']) ? $_GET['tab'] : 'scfp_form_settings';
$args->tabs = $args->settings->getTabs();
$args->fieldSet = $args->settings->getFieldSet();
$args->data = $args->settings->getSettings($args->key);
$args->fields = $args->settings->getFields($args->key);
$title = !empty($args->settings->getConfig()->admin->options->title) ? $args->settings->getConfig()->admin->options->title : '';
if (!empty($title)) {
    ?>
<div style="width: 100%; padding: 20px 0 0;">
    <table>
        <tr style="vertical-align: middle;">
            <td style="padding: 0 20px 0 0;">                                                                                               
                <img src="<?php 
    echo SCFP()->getAssetUrl('images/icons/icon-128x128.png');
    ?>
" width="100" height="100" />    
            </td>
            <td>
                <h1 style="margin: 0px; padding: 0 0 10px;"><?php 
    echo $title;
    ?>
</h1>
                <p style="margin: 0px; padding: 0 0 5px;">More information about the plugin you can find on the <a href="https://wordpress.org/plugins/wcp-contact-form/" target="_blank" title="">plugin page</a> in the <a href="https://wordpress.org/plugins/wcp-contact-form/faq/" target="_blank" title="FAQ">FAQ</a> and <a href="http://wpdemo.webcodin.com/wordpress-plugin-wcp-contact-form/documentation/getting-started/" target="_blank" title="Check Plugin Documentation">plugin documentation</a> on our site. Check <strong>live demo</strong> or ask a question you can on <a href="http://wpdemo.webcodin.com/stay-in-touch/" target="_blank" title="FAQ">our site</a>.<br />If you really like our plugin, please <a href="https://wordpress.org/support/view/plugin-reviews/wcp-contact-form?rate=5#postform" target="blank" title="Rate Our Plugin">rate us</a>!</p> 
                <p style="margin: 0px; padding: 0;">To start using our contact form on your site, please <strong>check settings</strong> on the tabs below and <strong>add to a page shortcode</strong> of the contact form via <strong>button in the TinyMCE toolbar</strong> (should be activated in tab "Form" --> "TinyMCE Support") or <strong>copy &amp; paste following shortcode</strong>: [wcp_contactform id="wcpform_1"]</p>   
            </td>
        </tr>
    </table>
</div>
<?php 
 public function getReplyButton($postId, $title = '', $atts = array())
 {
     $result = '';
     $settings = SCFP()->getSettings()->getNotificationSettings();
     $key = !empty($settings['user_email']) ? $settings['user_email'] : 'email';
     $atts_s = '';
     if (is_array($atts) && !empty($atts)) {
         foreach ($atts as $k => $value) {
             $atts_s .= $k . '="' . $value . '"';
         }
     }
     $mail = get_post_meta($postId, "scfp_{$key}", true);
     if (!empty($mail)) {
         $result = sprintf('<a href="mailto:%s" %s><span class="dashicons dashicons-email-alt"></span>%s</a>', $mail, $atts_s, $title);
     }
     return $result;
 }
<?php

$id = !empty($params['id']) ? $params['id'] : NULL;
$form = !empty($params['form']) ? $params['form'] : NULL;
$key = !empty($params['key']) ? $params['key'] : NULL;
$field = !empty($params['field']) ? $params['field'] : NULL;
$formSettings = !empty($params['formSettings']) ? $params['formSettings'] : NULL;
$formData = !empty($params['formData']) ? $params['formData'] : NULL;
$recaptcha = SCFP()->getSettings()->getRecaptchaSettings();
$recaptchaId = str_replace('-', '_', $id) . '_' . str_replace('-', '_', $key);
$atts = !empty($field['atts']) ? $field['atts'] : NULL;
if (!empty($atts) && is_array($atts)) {
    $atts_s = '';
    foreach ($atts as $k => $value) {
        $atts_s .= $k . '="' . $value . '"';
    }
    $atts = $atts_s;
}
if (!empty($key)) {
    if (!empty($recaptcha['rc_key'])) {
        wp_enqueue_script('scfp-recaptcha');
        wp_enqueue_script('scfp-recaptcha-api');
        ?>
    <script type="text/javascript">
        if (typeof scfp_rcwidget == 'undefined') {
            var scfp_rcwidget = {};
        }
        
        scfp_rcwidget.rcwidget_<?php 
        echo $recaptchaId;
        ?>