static function display_options()
    {
        // This displays the options menu in the admin area
        $tab_names = array(__('Basic Settings', 'si-contact-form'), __('Fields', 'si-contact-form'), __('Styles', 'si-contact-form'), __('Labels', 'si-contact-form'), __('Security', 'si-contact-form'), __('Advanced', 'si-contact-form'), __('Scheduling', 'si-contact-form'), __('Tools', 'si-contact-form'), __('Newsletter', 'si-contact-form'));
        $num_tabs = count($tab_names);
        self::define_ads();
        // Process ctf_actions, if any
        if (!empty($_POST['ctf_action'])) {
            FSCF_Action::do_ctf_action();
        }
        // Load the options into the options array
        self::get_options();
        // The update_lang function receives the array by ref., so it can be changed
        FSCF_Util::update_lang(self::$form_options);
        FSCF_Util::update_lang(self::$form_defaults);
        self::set_fld_array();
        // Create a header in the default WordPress 'wrap' container
        ?>
		<div class="wrap">

		<script type="text/javascript">
		// Set up tabs for options page (selected supports jQuery ui pre-1.9)
		jQuery(function() { 
			jQuery( "#fscf-tabs" ).tabs({ active: <?php 
        echo esc_js(self::$current_tab) - 1;
        ?>
, selected: <?php 
        echo esc_js(self::$current_tab) - 1;
        ?>
 });

			}); 
		</script>

		<?php 
        echo "\n";
        ?>
		
		<div class="fscf_statbox">
		<?php 
        // Display plugin ratings
        if (function_exists('get_transient')) {
            require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
            // First, try to access the data, check the cache.
            if (false === ($api = get_transient('si_contact_form_info'))) {
                // The cache data doesn't exist or it's expired.
                $api = plugins_api('plugin_information', array('slug' => 'si-contact-form'));
                if (!is_wp_error($api)) {
                    // cache isn't up to date, write this fresh information to it now to avoid the query for xx time.
                    $myexpire = 60 * 15;
                    // Cache data for 15 minutes
                    set_transient('si_contact_form_info', $api, $myexpire);
                }
            }
            if (!is_wp_error($api)) {
                $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
                //Sanitize HTML
                foreach ((array) $api->sections as $section_name => $content) {
                    $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);
                }
                foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) {
                    $api->{$key} = wp_kses($api->{$key}, $plugins_allowedtags);
                }
                if (!empty($api->downloaded)) {
                    echo sprintf(__('Downloaded %s times.', 'si-contact-form'), number_format_i18n($api->downloaded));
                }
                ?>

					<?php 
                if (!empty($api->rating)) {
                    ?>
						<div class="fcs-star-holder" title="<?php 
                    echo esc_attr(sprintf(__('(Average rating based on %s ratings)', 'si-contact-form'), number_format_i18n($api->num_ratings)));
                    ?>
">
							<div class="fcs-star fcs-star-rating" style="width: <?php 
                    echo esc_attr($api->rating);
                    ?>
px"></div>
							<div class="fcs-star fcs-star5"><img src="<?php 
                    echo FSCF_URL . 'includes/star.png';
                    ?>
" alt="<?php 
                    esc_attr_e('5 stars', 'si-contact-form');
                    ?>
" /></div>
							<div class="fcs-star fcs-star4"><img src="<?php 
                    echo FSCF_URL . 'includes/star.png';
                    ?>
" alt="<?php 
                    esc_attr_e('4 stars', 'si-contact-form');
                    ?>
" /></div>
							<div class="fcs-star fcs-star3"><img src="<?php 
                    echo FSCF_URL . 'includes/star.png';
                    ?>
" alt="<?php 
                    esc_attr_e('3 stars', 'si-contact-form');
                    ?>
" /></div>
							<div class="fcs-star fcs-star2"><img src="<?php 
                    echo FSCF_URL . 'includes/star.png';
                    ?>
" alt="<?php 
                    esc_attr_e('2 stars', 'si-contact-form');
                    ?>
" /></div>
							<div class="fcs-star fcs-star1"><img src="<?php 
                    echo FSCF_URL . 'includes/star.png';
                    ?>
" alt="<?php 
                    esc_attr_e('1 star', 'si-contact-form');
                    ?>
" /></div>
						</div>
						<small><?php 
                    echo sprintf(__('(Average rating based on %s ratings)', 'si-contact-form'), number_format_i18n($api->num_ratings));
                    ?>
 <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/si-contact-form?rate=5#postform"> <?php 
                    _e('rate', 'si-contact-form');
                    ?>
</a></small>
						<br />
						<?php 
                }
            }
            // if ( !is_wp_error($api)
        }
        // end if (function_exists('get_transient'
        if (isset($api->version)) {
            if (version_compare($api->version, FSCF_VERSION, '>')) {
                echo '<div id="message" class="updated">';
                echo '<a href="' . admin_url('plugins.php') . '">' . sprintf(__('A newer version of Fast Secure Contact Form is available: %s', 'si-contact-form'), $api->version) . '</a>';
                echo "</div>\n";
            } else {
                echo sprintf(__('Version %s (up to date)', 'si-contact-form'), FSCF_VERSION);
            }
        }
        // end div fscf_statbox
        ?>
		</div>

<p>
<a href="http://wordpress.org/extend/plugins/si-contact-form/changelog/" target="_blank"><?php 
        _e('Changelog', 'si-contact-form');
        ?>
</a> |
<a href="http://www.fastsecurecontactform.com/faq-wordpress-version" target="_blank"><?php 
        _e('FAQ', 'si-contact-form');
        ?>
</a> |
<a href="http://wordpress.org/support/plugin/si-contact-form" target="_blank"><?php 
        _e('Support Forum', 'si-contact-form');
        ?>
</a> |
<a href="http://www.fastsecurecontactform.com/support" target="_blank"><?php 
        _e('Support Ticket', 'si-contact-form');
        ?>
</a> |
<a href="http://wordpress.org/support/view/plugin-reviews/si-contact-form?rate=5#postform" target="_blank"><?php 
        _e('Rate This', 'si-contact-form');
        ?>
</a> |
<a href="https://www.fastsecurecontactform.com/donate" target="_blank"><?php 
        _e('Donate', 'si-contact-form');
        ?>
</a>
</p>

<?php 
        /* --- vCita Header Error Messages - Start --- */
        if (self::$global_options['vcita_show_disable_msg'] == 'true') {
            // Put visible notification that vCita was removed.
            echo '<div class="fsc-success">' . __('vCita Meeting Scheduler has been disabled.', 'si-contact-form');
            echo '</div><div style="clear:both;display:block"></div>';
            self::$global_options = FSCF_Util::get_global_options();
            self::$global_options['vcita_show_disable_msg'] = 'false';
            update_option('fs_contact_global', self::$global_options);
        } else {
            FSCF_Process::vcita_print_admin_page_notification(self::$form_options, self::$global_options);
        }
        /* --- vCita Header Error Messages - End --- */
        // action hook for database extension menu
        do_action('fsctf_menu_links');
        ?>

		<h2><?php 
        _e('Fast Secure Contact Form Settings', 'si-contact-form');
        ?>
</h2>
		<?php 
        settings_errors();
        // Display form select control
        // Has a preview been selected?
        $preview = isset($_POST['ctf_action']) && __('Preview Form', 'si-contact-form') == $_POST['ctf_action'] ? true : false;
        ?>
		<div class="fscf_left">
        <form id="fscf_form_control" action="<?php 
        echo admin_url('plugins.php?page=si-contact-form/si-contact-form.php&amp;fscf_form=' . self::$current_form) . '&fscf_tab=' . self::$current_tab;
        ?>
" method="post" name="previewform">
            <?php 
        wp_nonce_field('fs_contact_options-options', 'fs_options');
        // The value of the ctf_action field will be set by javascript when needed
        ?>
			<input type="hidden" name="ctf_action" id="ctf_action" value="<?php 
        $preview ? _e('Preview Form', 'si-contact-form') : _e('Edit Form', 'si-contact-form');
        ?>
" />
			<div class="fscf_select_form"><strong><?php 
        _e('Select a Form', 'si-contact-form');
        ?>
: </strong>
			<select id="form_select" name="<?php 
        echo self::$current_form;
        ?>
" onchange="fscf_set_form('<?php 
        _e('Add Form', 'si-contact-form');
        ?>
');">
			<?php 
        // above was onchange="setForm(this.form)"
        // Display forms select list
        foreach (self::$global_options['form_list'] as $key => $val) {
            echo '<option value="' . esc_attr($key) . '"';
            if ((int) self::$current_form == $key) {
                echo ' selected="selected"';
            }
            echo '>' . sprintf(__('Form %d: %s', 'si-contact-form'), esc_html($key), esc_html($val)) . "</option>\n";
        }
        echo '<option value="0">' . esc_html(__('Add a New Form', 'si-contact-form')) . "</option>\n";
        ?>
			</select>
			<span class="submit">
				&nbsp;<input id="preview" class="button-primary" type="submit" value="<?php 
        // When submit button is pressed, this will override the value of the hidden field
        // named ctf_action
        if ($preview) {
            _e('Edit Form', 'si-contact-form');
        } else {
            _e('Preview Form', 'si-contact-form');
        }
        ?>
" name="ctf_action" />
			</span>

			</div>
		</form>
		</div>
		<div id="ctf-loading">
		<?php 
        echo '<img src="' . plugins_url('si-contact-form/includes/ctf-loading.gif') . '" width="32" height="32" alt="' . esc_attr(__('Loading...', 'si-contact-form')) . '" />';
        ?>
</div>
		<div class='fscf_clear'></div>

		<?php 
        // If Preview is selected, preview the form.  Otherwise display the settings menu
        if ($preview) {
            echo FSCF_Display::process_short_code(array('form' => self::$current_form));
        } else {
            ?>

		<form id="fscf-optionsform" name="fscf-optionsform" class="fscf_clear" action="options.php" method="post" enctype="multipart/form-data">
              <?php 
            wp_nonce_field('fs_contact_options-options', 'fs_options');
            ?>
			<div>
			<input type="hidden" name="form-changed" id="form-changed" value="0"/>
			<input type="hidden" id="cur_tab" name="current_tab" value="<?php 
            echo self::$current_tab;
            ?>
"/>
			<input type="hidden" id="admin_url" value="<?php 
            echo admin_url();
            ?>
"/>
			</div><div id="fscf-tabs">
			<ul id="fscf-tab-list">
			<?php 
            // Display the tab labels
            $i = 1;
            for ($i = 1; $i <= $num_tabs; $i++) {
                echo '<li id="fscf-tab' . $i . '"';
                // select the current tab
                echo '><a href="#fscf-tabs-' . $i . '">' . esc_html($tab_names[$i - 1]) . '</a></li> ';
            }
            ?>
			</ul>

			<?php 
            // Display the tab contents
            for ($i = 1; $i <= $num_tabs; $i++) {
                echo '<div id="fscf-tabs-' . $i . '">';
                settings_fields('fs_contact_options');
                do_settings_sections('tab_page' . $i);
                if ($i < $num_tabs) {
                    //					submit_button();
                    // XXX if moving tabs around, you have may have to change 8 to a diff number, also make a change in  fscf-scripts-admin.js  if (tabId < 8) {
                    if ($i != 8) {
                        // skip tab 8 for the tools tab
                        ?>
					<p class="submit">
					<input id="submit<?php 
                        echo $i;
                        ?>
" class="button-primary" type="submit" value="<?php 
                        esc_attr_e('Save Changes', 'si-contact-form');
                        ?>
" onclick="document.pressed=this.value" name="submit" />
					</p>
					<?php 
                    }
                }
                echo ' </div>';
            }
            ?>
			</div>
		<!-- </form> -->
		<?php 
            ?>
	</div>

		<?php 
        }
    }
Example #2
0
 function si_contact_form_short_code($atts)
 {
     // backwards compatibility with manual PHP call from 3.xx
     echo FSCF_Display::process_short_code($atts);
 }