예제 #1
0
function wpef7_submit_shortcode_handler($tag)
{
    if (!is_array($tag)) {
        return '';
    }
    $options = (array) $tag['options'];
    $values = (array) $tag['values'];
    $atts = '';
    $id_att = '';
    $class_att = '';
    $tabindex_att = '';
    $class_att .= ' wpef7-submit';
    foreach ($options as $option) {
        if (preg_match('%^id:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
            $id_att = $matches[1];
        } elseif (preg_match('%^class:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
            $class_att .= ' ' . $matches[1];
        } elseif (preg_match('%^tabindex:(\\d+)$%', $option, $matches)) {
            $tabindex_att = (int) $matches[1];
        }
    }
    if ($id_att) {
        $atts .= ' id="' . trim($id_att) . '"';
    }
    if ($class_att) {
        $atts .= ' class="' . trim($class_att) . '"';
    }
    if ('' !== $tabindex_att) {
        $atts .= sprintf(' tabindex="%d"', $tabindex_att);
    }
    $value = isset($values[0]) ? $values[0] : '';
    if (empty($value)) {
        $value = __('Send', 'wpef7');
    }
    $html = '<input type="submit" value="' . esc_attr($value) . '"' . $atts . ' />';
    if (wpef7_script_is()) {
        $src = apply_filters('wpef7_ajax_loader', wpef7_plugin_url('images/ajax-loader.gif'));
        $html .= '<img class="ajax-loader" style="visibility: hidden;" alt="' . esc_attr(__('Sending ...', 'wpef7')) . '" src="' . esc_url_raw($src) . '" />';
    }
    return $html;
}
예제 #2
0
function wpef7_admin_footer()
{
    global $plugin_page;
    if (!isset($plugin_page) || 'wpef7' != $plugin_page) {
        return;
    }
    ?>
<script type="text/javascript">
/* <![CDATA[ */
var _wpef7 = {
	pluginUrl: '<?php 
    echo wpef7_plugin_url();
    ?>
',
	tagGenerators: {
<?php 
    wpef7_print_tag_generators();
    ?>
	}
};
/* ]]> */
</script>
<?php 
}
예제 #3
0
function wpef7_enqueue_styles()
{
    wp_enqueue_style('eval-form-7', wpef7_plugin_url('styles.css'), array(), WPEF7_VERSION, 'all');
    if ('rtl' == get_bloginfo('text_direction')) {
        wp_enqueue_style('eval-form-7-rtl', wpef7_plugin_url('styles-rtl.css'), array(), WPEF7_VERSION, 'all');
    }
    do_action('wpef7_enqueue_styles');
}