function activatePlugin()
 {
     $admin_options = $this->getAdminOptions();
     $admin_options['show_install_popover'] = 1;
     update_option($this->getAdminOptionsName(), $admin_options);
     ccf_utils::load_module('db/custom-contact-forms-activate-db.php');
     new CustomContactFormsActivateDB();
 }
 function defineConstants()
 {
     $prefix = ccf_utils::getWPTablePrefix();
     define('CCF_AJAX_URL', admin_url('admin-ajax.php'));
     define('CCF_FORMS_TABLE', $prefix . 'customcontactforms_forms');
     define('CCF_FIELDS_TABLE', $prefix . 'customcontactforms_fields');
     define('CCF_STYLES_TABLE', $prefix . 'customcontactforms_styles');
     define('CCF_USER_DATA_TABLE', $prefix . 'customcontactforms_user_data');
     define('CCF_FIELD_OPTIONS_TABLE', $prefix . 'customcontactforms_field_options');
     define('CCF_BASE_PATH', ABSPATH . 'wp-content/plugins/custom-contact-forms/');
     define('CCF_DEAD_STATE_VALUE', 'ccf-dead-state');
     $GLOBALS['ccf_tables_array'] = array(CCF_FORMS_TABLE, CCF_FIELDS_TABLE, CCF_STYLES_TABLE, CCF_USER_DATA_TABLE, CCF_FIELD_OPTIONS_TABLE);
     $GLOBALS['ccf_fixed_fields'] = array('customcontactforms_submit' => '', 'fid' => '', 'fixedEmail' => __("Use this field if you want the plugin to throw an error on fake emails.", 'custom-contact-forms'), 'fixedWebsite' => __("This field will throw an error on invalid website addresses.", 'custom-contact-forms'), 'emailSubject' => __("This field lets users specify the subject of the email sent to you on submission.", 'custom-contact-forms'), 'form_page' => '', 'captcha' => __("This field requires users to type numbers in an image preventing spam.", 'custom-contact-forms'), 'ishuman' => __("This field requires users to check a box to prove they aren't a spam bot.", 'custom-contact-forms'), 'usaStates' => __("This is a dropdown field showing each state in the US. If you want a state initially selected, enter it in 'Initial Value.'", 'custom-contact-forms'), 'datePicker' => __("This field displays a text box that when clicked pops up an interactive calender.'", 'custom-contact-forms'), 'allCountries' => __("This is a dropdown field showing countries. If you want a country initially selected, enter it in 'Initial Value.'", 'custom-contact-forms'), 'resetButton' => __("This field lets users reset all form fields to their initial values. This will be inserted next to the submit button.", 'custom-contact-forms'), 'MAX_FILE_SIZE' => '');
 }
 function encodeData()
 {
     $data_array = $this->getDataArray();
     $encoded_data = '';
     foreach ($data_array as $key => $value) {
         $key = ccf_utils::encodeOption($key);
         if (!is_array($value)) {
             $value = ccf_utils::encodeOption($value);
         } else {
             $value = ccf_utils::encodeOptionArray($value);
             $value = implode(', ', $value);
         }
         $encoded_data .= 's:' . strlen($key) . ':"' . $key . '";';
         $encoded_data .= 's:' . strlen($value) . ':"' . $value . '";';
     }
     $this->setEncodedData($encoded_data);
 }
 function updateStyle($style, $sid)
 {
     global $wpdb;
     if (empty($style['style_slug'])) {
         return false;
     }
     $test = $this->selectStyle('', $this->formatSlug($style['style_slug']));
     if (!empty($test) and $test->id != $sid) {
         // if style_slug is different then make sure it is unique
         return false;
     }
     $style['style_slug'] = $this->formatSlug($style['style_slug']);
     foreach ($style as $key => $value) {
         $style[$key] = ccf_utils::encodeOption($value);
     }
     $wpdb->update(CCF_STYLES_TABLE, $style, array('id' => $sid));
     return true;
 }
 function generateOptionsUpdateQuery($option_name = NULL)
 {
     if ($option_name == NULL) {
         $option_name = $this->option_name;
     }
     $prefix = ccf_utils::getWPTablePrefix();
     $options = serialize(get_option($option_name));
     return 'UPDATE `' . $prefix . "options` SET `option_value`='{$options}' WHERE `option_name`='{$option_name}';";
 }
Example #6
0
<?php

/*
	Custom Contact Forms Plugin
	By Taylor Lovett - http://www.taylorlovett.com
	Plugin URL: http://www.taylorlovett.com/wordpress-plugins
*/
error_reporting(0);
//header("Content-type: image/png");
require_once 'custom-contact-forms-utils.php';
ccf_utils::load_module('images/custom-contact-forms-images.php');
$image = new CustomContactFormsImages();
$str = rand(10000, 99999);
if (!session_id()) {
    session_start();
}
$captcha_name = 'ccf_captcha_' . $_GET['fid'];
if (!$_SESSION[$captcha_name]) {
    $_SESSION[$captcha_name] = $str;
} else {
    $str = $_SESSION[$captcha_name];
}
$image->createImageWithText($str);
 function getCountriesCode($field_object, $form_id)
 {
     ccf_utils::load_module('extra_fields/countries_field.php');
     $req = $field_object->field_required == 1 ? '* ' : '';
     $countries_field = new ccf_countries_field($field_object->field_class, $form_id, $field_object->field_value, $field_object->field_instructions);
     return '<label for="' . ccf_utils::decodeOption($field_object->field_slug, 1, 1) . '">' . $req . ccf_utils::decodeOption($field_object->field_label, 1, 1) . '</label>' . "\n" . $countries_field->getCode();
 }
        function display()
        {
            ccf_utils::load_module('export/custom-contact-forms-user-data.php');
            $user_data_array = parent::selectAllUserData();
            ?>
			<table id="ccf-dashboard" cellpadding="0" cellspacing="0">
			  <thead>
				<tr>
				  <th>Date</th>
				  <th>Form</th>
				  <th>Form Location</th>
				  <th></th>
				</tr>
			  </thead>
			  <tbody>
			<?php 
            if (empty($user_data_array)) {
                ?>
               <tr>
               	 <td colspan="4"><?php 
                _e('No submissions to display.', 'custom-contact-forms');
                ?>
</td> 
               </tr>
                <?php 
            }
            $i = 0;
            foreach ($user_data_array as $data_object) {
                if ($i > 3) {
                    break;
                }
                $data = new CustomContactFormsUserData(array('form_id' => $data_object->data_formid, 'data_time' => $data_object->data_time, 'form_page' => $data_object->data_formpage, 'encoded_data' => $data_object->data_value));
                ?>
				<tr class="<?php 
                if ($i % 2 == 1) {
                    echo 'even';
                }
                ?>
">
					<td class="date"><?php 
                echo date('m/d/y', $data->getDataTime());
                ?>
</td>
					<td class="slug">
					<?php 
                if ($data->getFormID() > 0) {
                    $data_form = parent::selectForm($data->getFormID());
                    $this_form = !empty($data_form->form_slug) ? $data_form->form_slug : '-';
                } else {
                    $this_form = __('Custom HTML Form', 'custom-contact-forms');
                }
                if (strlen($this_form) > 13) {
                    echo substr($this_form, 0, 13) . '...';
                } else {
                    echo $this_form;
                }
                ?>
					</td>
					<td class="form-page">
					<?php 
                if (strlen($data->getFormPage()) > 30) {
                    echo substr($data->getFormPage(), 0, 30) . '...';
                } else {
                    echo $data->getFormPage();
                }
                ?>
					</td>
					<td>
						<input class="ccf-view-submission" type="button" value="<?php 
                _e('View', 'custom-contact-forms');
                ?>
" />
						<div class="ccf-view-submission-popover" title="<?php 
                _e('CCF Saved Form Submission', 'custom-contact-forms');
                ?>
">
							<div class="top">
								<div class="left">
								<p><?php 
                _e('Form Submitted:', 'custom-contact-forms');
                ?>
 <span><?php 
                echo $this_form == '-' ? __('Not Found', 'custom-contact-forms') : $this_form;
                ?>
</span></p>
								<p><?php 
                _e('Form Location:', 'custom-contact-forms');
                ?>
 <span>
								<?php 
                if (strlen($data->getFormPage()) > 70) {
                    echo substr($data->getFormPage(), 0, 70) . '...';
                } else {
                    echo $data->getFormPage();
                }
                ?>
</span></p></div>
								<div class="right"><span><?php 
                echo date('F j, Y, g:i a', $data->getDataTime());
                ?>
</span></div>
							</div>
							<div class="separate"></div>
							<ul>
								<?php 
                $data_array = $data->getDataArray();
                foreach ($data_array as $item_key => $item_value) {
                    ?>
								<li>
								  <div><?php 
                    echo $item_key;
                    ?>
</div>
								  <p><?php 
                    echo $data->parseUserData($item_value);
                    ?>
</p>
								</li>
								<?php 
                }
                ?>
							</ul>
							<div class="separate"></div>
                            <a class="button" href="admin.php?page=ccf-saved-form-submissions"><?php 
                _e('View All Submissions', 'custom-contact-forms');
                ?>
</a>
						</div>
					</td>
				</tr>
				<?php 
                $i++;
            }
            ?>
			  </tbody>
			</table>
			<a href="admin.php?page=ccf-saved-form-submissions"><?php 
            _e('View All Submissions', 'custom-contact-forms');
            ?>
</a>
			<?php 
        }
        function printSettingsPage()
        {
            $admin_options = parent::getAdminOptions();
            if ($admin_options['show_install_popover'] == 1) {
                $admin_options['show_install_popover'] = 0;
                ?>
                <script type="text/javascript" language="javascript">
					$j(document).ready(function() {
						showCCFUsagePopover();
					});
				</script>
                <?php 
                update_option(parent::getAdminOptionsName(), $admin_options);
            }
            if ($_POST['general_settings']) {
                $_POST['settings'] = array_map(array('ccf_utils', 'encodeOption'), $_POST['settings']);
                $admin_options = array_merge($admin_options, $_POST['settings']);
                $admin_options[show_widget_categories] = $_POST['settings']['show_widget_categories'];
                $admin_options[show_widget_singles] = $_POST['settings']['show_widget_singles'];
                $admin_options[show_widget_pages] = $_POST['settings']['show_widget_pages'];
                $admin_options[show_widget_archives] = $_POST['settings']['show_widget_archives'];
                $admin_options[show_widget_home] = $_POST['settings']['show_widget_home'];
                $this->action_complete = __('Your settings have been successfully saved!', 'custom-contact-forms');
                update_option(parent::getAdminOptionsName(), $admin_options);
            } elseif ($_POST['configure_mail']) {
                $_POST['mail_config'] = array_map(array('ccf_utils', 'encodeOption'), $_POST['mail_config']);
                $admin_options = array_merge($admin_options, $_POST['mail_config']);
                $this->action_complete = __('Your mail settings have been successfully saved!', 'custom-contact-forms');
                update_option(parent::getAdminOptionsName(), $admin_options);
            }
            ccf_utils::load_module('export/custom-contact-forms-export.php');
            ?>
			<div id="customcontactforms-admin">
			  <div class="plugin-header">
				<h2>
					<?php 
            _e("Custom Contact Forms", 'custom-contact-forms');
            ?>
				</h2>
             	<div class="links">
                	<a href="javascript:void(0)" class="quick-start-button">Quick Start Guide</a> - <a href="javascript:void(0)" class="usage-popover-button">Plugin Usage Manual</a>
              	</div>
              </div>
			  <a class="genesis" href="http://www.shareasale.com/r.cfm?b=241369&u=481196&m=28169&urllink=&afftrack=">Custom Contact Forms works best with any of the 20+ <span>Genesis</span> Wordpress child themes. The <span>Genesis Framework</span> empowers you to quickly and easily build incredible websites with WordPress.</a>
			
			<form class="blog-horizontal-form" method="post" action="http://www.aweber.com/scripts/addlead.pl">
            	<input type="hidden" name="meta_web_form_id" value="1578604781" />
				<input type="hidden" name="meta_split_id" value="" />
				<input type="hidden" name="listname" value="ccf-plugin" />
				<input type="hidden" name="redirect" value="http://www.taylorlovett.com/wordpress-plugins/tutorials-offers-tips/" id="redirect_5832e41084448adb07da67a35dc83c27" />
				<input type="hidden" name="meta_adtracking" value="CCF_-_Wordpress_Plugins_Horizontal" />
				<input type="hidden" name="meta_message" value="1" />
				<input type="hidden" name="meta_required" value="name,email" />
				<span>WP Blogging Tips, Downloads, SEO Tricks & Exclusive Tutorials</span>
                <input type="text" name="name" value="Your Name" onclick="value=''" />
                <input type="text" name="email" value="Your Email" onclick="value=''" />
                <input type="submit" value="Sign Up for Free" />
            </form>
			
			<?php 
            if (!empty($this->action_complete)) {
                ?>
			<div id="message" class="updated below-h2">
				<p><?php 
                echo $this->action_complete;
                ?>
</p>
			</div>
			<?php 
            }
            ?>
			
			  <div id="general-settings" class="postbox">
				<h3 class="hndle"><span>
				  <?php 
            _e("General Settings", 'custom-contact-forms');
            ?>
				  </span></h3>
				<div class="inside">
				  <form method="post" action="<?php 
            echo $_SERVER['REQUEST_URI'];
            ?>
">
					<ul class="gleft">
					  <li>
						<label for="email_form_submissions">
						<?php 
            _e("Email Form Submissions:", 'custom-contact-forms');
            ?>
						</label>
						<select name="settings[email_form_submissions]">
						  <option value="1">
						  <?php 
            _e("Yes", 'custom-contact-forms');
            ?>
						  </option>
						  <option value="0" <?php 
            if ($admin_options['email_form_submissions'] == 0) {
                echo 'selected="selected"';
            }
            ?>
>
						  <?php 
            _e("No", 'custom-contact-forms');
            ?>
						  </option>
						</select>
					  </li>
					  <li class="descrip">
						<?php 
            _e("When a user fills out one of your forms, the info submitted is saved in the Saved Form Submission section of the admin panel for you to view. If this is enabled, you will also be sent an email containing the submission info.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="default_to_email">
						<?php 
            _e("Default Email:", 'custom-contact-forms');
            ?>
						</label>
						<input name="settings[default_to_email]" value="<?php 
            echo $admin_options['default_to_email'];
            ?>
" type="text" maxlength="100" />
					  </li>
					  <li class="descrip">
						<?php 
            _e("Form emails will be sent <span>to</span> this address, if no destination email is specified by the form.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="enable_jquery">
						<?php 
            _e("Front End JQuery:", 'custom-contact-forms');
            ?>
						</label>
						<select name="settings[enable_jquery]">
						  <option value="1">
						  <?php 
            _e("Enabled", 'custom-contact-forms');
            ?>
						  </option>
						  <option <?php 
            if ($admin_options['enable_jquery'] != 1) {
                echo 'selected="selected"';
            }
            ?>
 value="0">
						  <?php 
            _e("Disabled", 'custom-contact-forms');
            ?>
						  </option>
						</select>
					  </li>
					  <li class="descrip">
						<?php 
            _e("Some plugins don't setup JQuery correctly, so when any other plugin uses JQuery (whether correctly or not), JQuery works for neither plugin. This plugin uses JQuery correctly. If another plugin isn't using JQuery correctly but is more important to you than this one: disable this option. 99% of this plugin's functionality will work without JQuery, just no field instruction tooltips.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="default_from_email">
						<?php 
            _e("Default From Email:", 'custom-contact-forms');
            ?>
						</label>
						<input name="settings[default_from_email]" value="<?php 
            echo $admin_options['default_from_email'];
            ?>
" type="text" maxlength="100" />
					  </li>
					  <li class="descrip">
						<?php 
            _e("Form emails will be sent <span>from</span> this address. It is recommended you provide a real email address that has been created through your host.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="default_from_name">
						<?php 
            _e("Default From Name:", 'custom-contact-forms');
            ?>
						</label>
						<input name="settings[default_from_name]" value="<?php 
            echo $admin_options['default_from_name'];
            ?>
" type="text" maxlength="100" />
					  </li>
					  <li class="descrip">
						<?php 
            _e("This setting allows you to specify the name under which form emails are sent. The default is 'Custom Contact Forms'.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="default_form_subject">
						<?php 
            _e("Default Email Subject:", 'custom-contact-forms');
            ?>
						</label>
						<input name="settings[default_form_subject]" value="<?php 
            echo $admin_options['default_form_subject'];
            ?>
" type="text" />
					  </li>
					  <li class="descrip">
						<?php 
            _e("Default subject to be included in all form emails.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="enable_dashboard_widget">
						<?php 
            _e("Enable Dashboard Widget:", 'custom-contact-forms');
            ?>
						</label>
						<select name="settings[enable_dashboard_widget]">
						  <option value="1">
						  <?php 
            _e("Enabled", 'custom-contact-forms');
            ?>
						  </option>
						  <option value="0" <?php 
            if ($admin_options['enable_dashboard_widget'] == 0) {
                echo 'selected="selected"';
            }
            ?>
>
						  <?php 
            _e("Disabled", 'custom-contact-forms');
            ?>
						  </option></select>
					 </li>
					  <li class="descrip">
						<?php 
            _e("Enabling this will display a widget on your dashboard that shows the latest form submissions.", 'custom-contact-forms');
            ?>
					  </li>
                      <li>
						<label for="dashboard_access">
						<?php 
            _e("Dashboard Widget Accessibility:", 'custom-contact-forms');
            ?>
						</label>
						<select name="settings[dashboard_access]">
						  <option value="2">
						  <?php 
            _e("Only admins can view", 'custom-contact-forms');
            ?>
						  </option>
                          <option value="1" <?php 
            if ($admin_options['dashboard_access'] == 1) {
                echo 'selected="selected"';
            }
            ?>
>
						  <?php 
            _e("All roles except subscribers can view", 'custom-contact-forms');
            ?>
						  </option>
						  <option value="0" <?php 
            if ($admin_options['dashboard_access'] == 0) {
                echo 'selected="selected"';
            }
            ?>
>
						  <?php 
            _e("All roles can view", 'custom-contact-forms');
            ?>
						  </option></select>
					 </li>
					  <li class="descrip">
						<?php 
            _e("If you are using the dashboard widget, this allows you to disallow certain users from viewing it.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="code_type">
						<?php 
            _e("Use Code Type:", 'custom-contact-forms');
            ?>
						</label>
						<select name="settings[code_type]">
						  <option>XHTML</option>
						  <option <?php 
            if ($admin_options['code_type'] == 'HTML') {
                echo 'selected="selected"';
            }
            ?>
>HTML</option>
						</select>
					  </li>
					  <li class="descrip">
						<?php 
            _e("This lets you switch the form code between HTML and XHTML.", 'custom-contact-forms');
            ?>
					  </li>
                      <li>
						<label for="form_page_inclusion_only">
						<?php 
            _e("Restrict Frontend JS and CSS to Form Pages Only:", 'custom-contact-forms');
            ?>
						</label>
						<select name="settings[form_page_inclusion_only]">
						  <option value="1">
						  <?php 
            _e("Yes", 'custom-contact-forms');
            ?>
						  </option>
						  <option value="0" <?php 
            if ($admin_options['form_page_inclusion_only'] == 0) {
                echo 'selected="selected"';
            }
            ?>
>
						  <?php 
            _e("No", 'custom-contact-forms');
            ?>
						  </option></select>
                      </li>
					  <li class="descrip">
						<?php 
            _e("Within each form in the form manager, you can specify the page id's on which that form will be used. If you set this to 'Yes', the plugin will only include CSS and JS files on pages/posts where a CCF form is inserted. If this is set to 'No', CSS and JS files for this plugin will be included on every page of your site except in the admin area.", 'custom-contact-forms');
            ?>
					  </li>
					</ul>
					<ul class="gright">
					  <li>
						<label for="form_success_message_title">
						<?php 
            _e("Default Form Success Message Title:", 'custom-contact-forms');
            ?>
						</label>
						<input name="settings[form_success_message_title]" value="<?php 
            echo $admin_options['form_success_message_title'];
            ?>
" type="text"/>
					  </li>
					  <li class="descrip">
						<?php 
            _e("If someone fills out a form for which a success message title is not provided and a custom success page is not provided, the plugin will show a popover using this field as the window title.", 'custom-contact-forms');
            ?>
					  </li>
                      
					  <li>
						<label for="form_success_message">
						<?php 
            _e("Default Form Success Message:", 'custom-contact-forms');
            ?>
						</label>
						<input name="settings[form_success_message]" value="<?php 
            echo $admin_options['form_success_message'];
            ?>
" type="text"/>
					  </li>
					  <li class="descrip">
						<?php 
            _e("If someone fills out a form for which a success message is not provided and a custom success page is not provided, the plugin will show a popover containing this message.", 'custom-contact-forms');
            ?>
					  </li>
                      <li>
						<label for="default_form_error_header">
						<?php 
            _e("Default Form Error Header:", 'custom-contact-forms');
            ?>
						</label>
						<input name="settings[default_form_error_header]" value="<?php 
            echo $admin_options['default_form_error_header'];
            ?>
" type="text" />
					  </li>
					  <li class="descrip">
						<?php 
            _e("When a form is filled out incorrectly, this message will be displayed followed by the individual field error messages.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="remember_field_values">
						<?php 
            _e("Remember Field Values:", 'custom-contact-forms');
            ?>
						</label>
						<select name="settings[remember_field_values]">
						  <option value="1">
						  <?php 
            _e("Yes", 'custom-contact-forms');
            ?>
						  </option>
						  <option <?php 
            if ($admin_options['remember_field_values'] == 0) {
                echo 'selected="selected"';
            }
            ?>
 value="0">
						  <?php 
            _e("No", 'custom-contact-forms');
            ?>
						  </option>
						</select>
					  </li>
					  <li class="descrip">
						<?php 
            _e("Selecting yes will make form fields remember how they were last filled out.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="enable_widget_tooltips">
						<?php 
            _e("Tooltips in Widget:", 'custom-contact-forms');
            ?>
						</label>
						<select name="settings[enable_widget_tooltips]">
						  <option value="1">
						  <?php 
            _e("Enabled", 'custom-contact-forms');
            ?>
						  </option>
						  <option <?php 
            if ($admin_options['enable_widget_tooltips'] == 0) {
                echo 'selected="selected"';
            }
            ?>
 value="0">
						  <?php 
            _e("Disabled", 'custom-contact-forms');
            ?>
						  </option>
						</select>
					  </li>
					  <li class="descrip">
						<?php 
            _e("Enabling this shows tooltips containing field instructions on forms in the widget.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="admin_ajax">
						<?php 
            _e("Fancy Admin AJAX Abilities:", 'custom-contact-forms');
            ?>
						</label>
						<select name="settings[admin_ajax]">
						  <option value="1">
						  <?php 
            _e("Enabled", 'custom-contact-forms');
            ?>
						  </option>
						  <option value="0" <?php 
            if ($admin_options['admin_ajax'] == 0) {
                echo 'selected="selected"';
            }
            ?>
>
						  <?php 
            _e("Disabled", 'custom-contact-forms');
            ?>
						  </option>
						</select>
					  </li>
					  <li class="descrip">
						<?php 
            _e("If you enable this, creating, editing and modifying forms, fields, styles, etc in the admin panel will be done using AJAX. This means that clicking things like 'Edit' or 'Delete' will not cause the page to reload thus managing your forms will be much smoother and quicker. If you are having problems with things not saving, deleting, or inserting correctly, then disable this and fill out a bug report below.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="default_form_bad_permissions">
						<?php 
            _e("Default Permissions Error:", 'custom-contact-forms');
            ?>
						</label>
						<input name="settings[default_form_bad_permissions]" value="<?php 
            echo $admin_options['default_form_bad_permissions'];
            ?>
" type="text" />
					  </li>
					  <li class="descrip">
						<?php 
            _e("When someone doesn't have the proper permissions to use a form, this message is displayed in place of the form. You control who can view each form with the form access manager which is located inside the form manager.", 'custom-contact-forms');
            ?>
					  </li>
					  <li>
						<label for="enable_form_access_manager">
						<?php 
            _e("Form Access Capabilities:", 'custom-contact-forms');
            ?>
						</label>
						<select name="settings[enable_form_access_manager]">
						  <option value="0">
						  <?php 
            _e("Disabled", 'custom-contact-forms');
            ?>
						  </option>
						  <option value="1" <?php 
            if ($admin_options['enable_form_access_manager'] == 1) {
                echo 'selected="selected"';
            }
            ?>
>
						  <?php 
            _e("Enabled", 'custom-contact-forms');
            ?>
						  </option>
						</select>
					  </li>
					  <li class="descrip">
						<?php 
            _e("The form access manager within each form allows you to control who can view your form. However, that will take effect on any of your forms unless this is enabled.", 'custom-contact-forms');
            ?>
					  </li>
                      <li>
						<label for="max_file_upload_size">
						<?php 
            _e("Maximum File Upload Size:", 'custom-contact-forms');
            ?>
						</label>
						<input name="settings[max_file_upload_size]" class="ccf-width75" type="text" value="<?php 
            echo $admin_options['max_file_upload_size'];
            ?>
" /> <?php 
            _e("MB");
            ?>
						  
                      </li>
					  <li class="descrip">
						<?php 
            _e("When creating file fields, you can specify maximum upload sizes for each individual field. This setting lets you set an overall cap for security reasons. It is recommended you leave this at 10 MB.", 'custom-contact-forms');
            ?>
					  </li>
					  <li class="show-widget"><b>
						<?php 
            _e("Show Sidebar Widget:", 'custom-contact-forms');
            ?>
						</b></li>
					  <li>
						<label>
						<input value="1" type="checkbox" name="settings[show_widget_home]" <?php 
            if ($admin_options['show_widget_home'] == 1) {
                echo 'checked="checked"';
            }
            ?>
 />
						<?php 
            _e("On Homepage", 'custom-contact-forms');
            ?>
						</label>
						<label>
						<input value="1" type="checkbox" name="settings[show_widget_pages]" <?php 
            if ($admin_options['show_widget_pages'] == 1) {
                echo 'checked="checked"';
            }
            ?>
 />
						<?php 
            _e("On Pages", 'custom-contact-forms');
            ?>
						</label>
						<label>
						<input value="1" type="checkbox" name="settings[show_widget_singles]" <?php 
            if ($admin_options['show_widget_singles'] == 1) {
                echo 'checked="checked"';
            }
            ?>
 />
						<?php 
            _e("On Single Posts", 'custom-contact-forms');
            ?>
						</label>
						<br />
						<label>
						<input value="1" type="checkbox" name="settings[show_widget_categories]" <?php 
            if ($admin_options['show_widget_categories'] == 1) {
                echo 'checked="checked"';
            }
            ?>
 />
						<?php 
            _e("On Categories", 'custom-contact-forms');
            ?>
						</label>
						<label>
						<input value="1" type="checkbox" name="settings[show_widget_archives]" <?php 
            if ($admin_options['show_widget_archives'] == 1) {
                echo 'checked="checked"';
            }
            ?>
 />
						<?php 
            _e("On Archives", 'custom-contact-forms');
            ?>
						</label>
					  </li>
                      
					  <li>
						<input type="submit" value="<?php 
            _e("Update", 'custom-contact-forms');
            ?>
" name="general_settings" />
					  </li>
					</ul>
				  </form>
				</div>
			  </div>
			  <div id="configure-mail" class="postbox">
				<h3 class="hndle"><span>
				  <?php 
            _e("Mail Settings", 'custom-contact-forms');
            ?>
				  </span></h3>
				<div class="inside">
                	<form method="post" action="<?php 
            echo $_SERVER['REQUEST_URI'];
            ?>
">
                	<p><?php 
            _e("There are two ways you can send emails: using the PHP mail() function or using SMTP (secure/insecure). If you choose to use the PHP mail() function you can ignore all the other options. For some people Wordpress's default way of sending mail does not work; if for some reason your mail is being sent you should try the SMTP option.", 'custom-contact-forms');
            ?>
</p>
                	<label for="mail_function"><?php 
            _e("* Send My Emails Using the Following:", 'custom-contact-forms');
            ?>
</label>
                    <select name="mail_config[mail_function]">
					  <option value="default"><?php 
            _e("Wordpress Default", 'custom-contact-forms');
            ?>
</option>
					  <option <?php 
            if ($admin_options['mail_function'] == 'smtp') {
                echo 'selected="selected"';
            }
            ?>
 value="smtp"><?php 
            _e("SMTP", 'custom-contact-forms');
            ?>
</option>
					</select> <?php 
            _e("(If mail isn't sending, try toggling this option.)", 'custom-contact-forms');
            ?>
                    <div>
                        <ul class="left">
                            <li><label for="smtp_host"><?php 
            _e("SMTP Host:", 'custom-contact-forms');
            ?>
</label> <input class="ccf-width125" type="text" size="10" name="mail_config[smtp_host]" value="<?php 
            echo $admin_options['smtp_host'];
            ?>
" /></li>
                            <li><label for="smtp_port"><?php 
            _e("SMTP Port:", 'custom-contact-forms');
            ?>
</label> <input class="ccf-width125" type="text" size="10" name="mail_config[smtp_port]" value="<?php 
            echo $admin_options['smtp_port'];
            ?>
" /></li>
                            <li><label for="smtp_encryption"><?php 
            _e("Encryption:", 'custom-contact-forms');
            ?>
</label> <select name="mail_config[smtp_encryption]">
                            <option value="none"><?php 
            _e("None", 'custom-contact-forms');
            ?>
</option>
                            <option <?php 
            if ($admin_options['smtp_encryption'] == 'ssl') {
                echo 'selected="selected"';
            }
            ?>
 value="ssl"><?php 
            _e("SSL", 'custom-contact-forms');
            ?>
</option>
                            <option <?php 
            if ($admin_options['smtp_encryption'] == 'tls') {
                echo 'selected="selected"';
            }
            ?>
 value="tls"><?php 
            _e("TLS", 'custom-contact-forms');
            ?>
</option>
                            </select></li>
                        </ul>
                        <ul class="right">
                            <li><label for="smtp_authentication"><?php 
            _e("SMTP Authentication:", 'custom-contact-forms');
            ?>
</label> <select name="mail_config[smtp_authentication]"><option value="0"><?php 
            _e("None Needed", 'custom-contact-forms');
            ?>
</option><option <?php 
            if ($admin_options['smtp_authentication'] == 1) {
                echo 'selected="selected"';
            }
            ?>
 value="1"><?php 
            _e("Use SMTP Username/Password", 'custom-contact-forms');
            ?>
</option></select></li>
                            <li><label for="smtp_username"><?php 
            _e("SMTP Username:"******"ccf-width125" type="text" size="10" name="mail_config[smtp_username]" value="<?php 
            echo $admin_options['smtp_username'];
            ?>
" /></li>
                            <li><label for="smtp_password"><?php 
            _e("SMTP Password:"******"ccf-width125" type="text" size="10" name="mail_config[smtp_password]" value="<?php 
            echo $admin_options['smtp_password'];
            ?>
" /></li>
                        </ul>
                    </div>
                    <input type="submit" name="configure_mail" value="<?php 
            _e("Save Mail Sending Options", 'custom-contact-forms');
            ?>
" />
                    </form>
                </div>
              </div>
			  <div id="export" class="postbox">
				<h3 class="hndle"><span>
				  <?php 
            _e("Export", 'custom-contact-forms');
            ?>
				  </span></h3>
				<div class="inside">
				  <form method="post" action="<?php 
            echo $_SERVER['REQUEST_URI'];
            ?>
">
					<p>
					  <?php 
            _e("Preforming a Custom Contact Forms export will create a file of the form \n\t\t\t\t\t\tccf-export-xxxx.sql on your web server. The file created contains SQL that \n\t\t\t\t\t\twill recreate all the plugin data on any Wordpress installation. After Custom Contact Forms creates the export file, you will be prompted to download it. You can use this file as a backup in case your Wordpress database gets ruined.", 'custom-contact-forms');
            ?>
					</p>
					<input type="submit" name="ccf_export" value="<?php 
            _e("Export All CCF Plugin Content", 'custom-contact-forms');
            ?>
" />
				  </form>
				</div>
			  </div>
			  <div id="import" class="postbox">
				<h3 class="hndle"><span>
				  <?php 
            _e("Import", 'custom-contact-forms');
            ?>
				  </span></h3>
				<div class="inside">
				  <form method="post" enctype="multipart/form-data" action="<?php 
            echo $_SERVER['REQUEST_URI'];
            ?>
">
					
					<p>
					  <?php 
            _e("Browse to a CCF .sql export file to import Custom Contact Form data from another Wordpress installation to this one. Pressing the 'Clear and Import' button deletes all current data and then imports the selected file; this will not work for merging to data!. Clearing all CCF data before importing prevents any conflicts from occuring. Before you attempt an import, you should always download a backup, by clicking the 'Export All' button.", 'custom-contact-forms');
            ?>
					</p>
					<p class="choose_import">
					  <?php 
            _e("Choose What You Want to Use from the Import File:", 'custom-contact-forms');
            ?>
					</p>
					<ul>
					  <li>
						<input type="checkbox" checked="checked" name="ccf_import_overwrite_settings" value="1" />
						<label for="ccf_import_overwrite_settings">
						<?php 
            _e("Use General Settings", 'custom-contact-forms');
            ?>
						</label>
					  </li>
					  <li>
						<input type="checkbox" checked="checked" name="ccf_import_forms" value="1" />
						<label for="ccf_import_forms">
						<?php 
            _e("Forms", 'custom-contact-forms');
            ?>
						</label>
					  </li>
					  <li>
						<input type="checkbox" checked="checked" name="ccf_import_saved_submissions" value="1" />
						<label for="ccf_import_saved_submissions">
						<?php 
            _e("Form Submissions", 'custom-contact-forms');
            ?>
						</label>
					  </li>
					  <li>
						<input type="checkbox" checked="checked" name="ccf_import_fields" value="1" />
						<label for="ccf_import_fields">
						<?php 
            _e("Fields", 'custom-contact-forms');
            ?>
						</label>
					  </li>
					  <li>
						<input type="checkbox" checked="checked" name="ccf_import_forms" value="1" />
						<label for="ccf_import_forms">
						<?php 
            _e("Forms", 'custom-contact-forms');
            ?>
						</label>
					  </li>
					  <li>
						<input type="checkbox" checked="checked" name="ccf_import_field_options" value="1" />
						<label for="ccf_import_field_options">
						<?php 
            _e("Field Options", 'custom-contact-forms');
            ?>
						</label>
					  </li>
					  <li>
						<input type="checkbox" checked="checked" name="ccf_import_styles" value="1" />
						<label for="ccf_import_styles">
						<?php 
            _e("Styles", 'custom-contact-forms');
            ?>
						</label>
					  </li>
					</ul>
					<p class="choose_import">
					  <label for="import_file">
					  <?php 
            _e("Choose an Import File:", 'custom-contact-forms');
            ?>
					  </label>
					  <input type="file" name="import_file" />
					</p>
					<input name="ccf_clear_import" type="submit" value="<?php 
            _e("Clear and Import", 'custom-contact-forms');
            ?>
" />
					<input type="checkbox" name="ccf_import_confirm" value="1" />
					<?php 
            _e('Yes, I want to do this and have created a backup.', 'custom-contact-forms');
            ?>
				  </form>
				</div>
			  </div>
			  <?php 
            $this->insertUsagePopover();
            ?>
              <?php 
            $this->insertQuickStartPopover();
            ?>
			</div>
			<?php 
        }
Example #10
0
        function __construct($public_key, $label = NULL, $slug = NULL, $class = NULL, $initial_value = NULL, $field_instructions = NULL)
        {
            $class_attr = $class == NULL ? '' : $class;
            $label = !empty($label) ? '<div><label for="' . ccf_utils::decodeOption($slug, 1, 1) . '">* ' . ccf_utils::decodeOption($label, 1, 1) . '</label></div>' : '';
            if ($field_instructions == NULL) {
                $instructions_attr = '';
                $tooltip_class = '';
            } else {
                $instructions_attr = ' title="' . esc_attr($field_instructions) . '" ';
                $tooltip_class = 'ccf-tooltip-field';
            }
            ob_start();
            ?>
			<div id="recaptcha_widget" style="display:none" class="<?php 
            echo esc_attr($class_attr);
            ?>
">
				<div class="right">
					<img class="logo" width="75" height="80" src="<?php 
            echo plugins_url();
            ?>
/custom-contact-forms/images/recaptcha-logo-white.png" />
					<div class="reload"><a href="javascript:Recaptcha.reload()"><img width="25" height="18" src="<?php 
            echo plugins_url();
            ?>
/custom-contact-forms/images/refresh.png" alt="Reload captcha" /></a></div>
					<div class="recaptcha_only_if_image audio"><a href="javascript:Recaptcha.switch_type('audio')"><img width="25" height="15" src="<?php 
            echo plugins_url();
            ?>
/custom-contact-forms/images/audio.png" alt="Play audio captcha" /></a></div>
					<!--<div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')"><img width="25" height="18" src="<?php 
            echo plugins_url();
            ?>
/custom-contact-forms/images/refresh.png" alt="Reload captcha" /></a></div>
					--><div class="help"><a href="javascript:Recaptcha.showhelp()"><img width="25" height="16" src="<?php 
            echo plugins_url();
            ?>
/custom-contact-forms/images/help.png" alt="Recaptcha help" /></a></div>
				</div>
				<div class="left">
					<div id="recaptcha_image"></div>
					<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div>
					<?php 
            echo $label;
            ?>
					<input value="<?php 
            if (!empty($initial_value)) {
                echo esc_attr($initial_value);
            }
            ?>
" type="text" id="recaptcha_response_field" name="recaptcha_response_field" class="<?php 
            echo $tooltip_class;
            ?>
" <?php 
            echo $instructions_attr;
            ?>
 />
				</div>
				
			  </div>
			 
			  <script type="text/javascript"
				 src="http://www.google.com/recaptcha/api/challenge?k=<?php 
            echo $public_key;
            ?>
">
			  </script>
			  <noscript>
				<iframe src="http://www.google.com/recaptcha/api/noscript?k=<?php 
            echo $public_key;
            ?>
"
					 height="300" width="500" frameborder="0"></iframe><br>
				<textarea name="recaptcha_challenge_field" rows="3" cols="40">
				</textarea>
				<input type="hidden" name="recaptcha_response_field"
					 value="manual_challenge">
			  </noscript>
			<?php 
            $this->field_code = ob_get_clean();
        }