本文整理汇总了PHP中wpcf7_get_request_uri函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf7_get_request_uri函数的具体用法?PHP wpcf7_get_request_uri怎么用?PHP wpcf7_get_request_uri使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf7_get_request_uri函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form_html
function form_html()
{
$form = '<div class="wpcf7" id="' . $this->unit_tag . '">';
$url = wpcf7_get_request_uri();
if ($frag = strstr($url, '#')) {
$url = substr($url, 0, -strlen($frag));
}
$url .= '#' . $this->unit_tag;
$url = apply_filters('wpcf7_form_action_url', $url);
$enctype = apply_filters('wpcf7_form_enctype', '');
$class = apply_filters('wpcf7_form_class_attr', 'wpcf7-form');
$form .= '<form action="' . esc_url_raw($url) . '" method="post"' . ' class="' . esc_attr($class) . '"' . $enctype . '>' . "\n";
$form .= '<div style="display: none;">' . "\n";
$form .= '<input type="hidden" name="_wpcf7" value="' . esc_attr($this->id) . '" />' . "\n";
$form .= '<input type="hidden" name="_wpcf7_version" value="' . esc_attr(WPCF7_VERSION) . '" />' . "\n";
$form .= '<input type="hidden" name="_wpcf7_unit_tag" value="' . esc_attr($this->unit_tag) . '" />' . "\n";
$form .= '</div>' . "\n";
$form .= $this->form_elements();
if (!$this->responses_count) {
$form .= $this->form_response_output();
}
$form .= '</form>';
$form .= '</div>';
return $form;
}
示例2: form_html
function form_html()
{
$form = '<div class="wpcf7" id="' . $this->unit_tag . '">';
$url = wpcf7_get_request_uri();
if ($frag = strstr($url, '#')) {
$url = substr($url, 0, -strlen($frag));
}
$url .= '#' . $this->unit_tag;
$url = apply_filters('wpcf7_form_action_url', $url);
$class = 'wpcf7-form';
if ($this->is_posted()) {
if (!empty($_POST['_wpcf7_validation_errors'])) {
$class .= ' invalid';
} elseif (!empty($_POST['_wpcf7_mail_sent'])) {
if (!empty($_POST['_wpcf7_mail_sent']['spam'])) {
$class .= ' spam';
} elseif (!empty($_POST['_wpcf7_mail_sent']['ok'])) {
$class .= ' sent';
} else {
$class .= ' failed';
}
}
}
$class = apply_filters('wpcf7_form_class_attr', $class);
$enctype = apply_filters('wpcf7_form_enctype', '');
$form .= '<form action="' . esc_url_raw($url) . '" method="post"' . ' class="' . esc_attr($class) . '"' . $enctype . '>' . "\n";
$form .= $this->form_hidden_fields();
$form .= $this->form_elements();
if (!$this->responses_count) {
$form .= $this->form_response_output();
}
$form .= '</form>';
$form .= '</div>';
return $form;
}
示例3: wpcf7_special_mail_tag
function wpcf7_special_mail_tag($output, $name)
{
// For backwards compat.
$name = preg_replace('/^wpcf7\\./', '_', $name);
if ('_remote_ip' == $name) {
$output = preg_replace('/[^0-9a-f.:, ]/', '', $_SERVER['REMOTE_ADDR']);
} elseif ('_url' == $name) {
$output = get_option('home') . wpcf7_get_request_uri();
} elseif ('_date' == $name) {
$output = date_i18n(get_option('date_format'));
} elseif ('_time' == $name) {
$output = date_i18n(get_option('time_format'));
}
return $output;
}
示例4: wpcf7_special_mail_tag
function wpcf7_special_mail_tag($output, $name)
{
// For backwards compat.
$name = preg_replace('/^wpcf7\\./', '_', $name);
if ('_remote_ip' == $name) {
$output = preg_replace('/[^0-9a-f.:, ]/', '', $_SERVER['REMOTE_ADDR']);
} elseif ('_url' == $name) {
$url = untrailingslashit(home_url());
$url = preg_replace('%(?<!:|/)/.*$%', '', $url);
$url .= wpcf7_get_request_uri();
$output = esc_url($url);
} elseif ('_date' == $name) {
$output = date_i18n(get_option('date_format'));
} elseif ('_time' == $name) {
$output = date_i18n(get_option('time_format'));
}
return $output;
}
示例5: form_html
function form_html()
{
$form = '<div class="wpcf7" id="' . $this->unit_tag . '">';
$url = wpcf7_get_request_uri();
if ($frag = strstr($url, '#')) {
$url = substr($url, 0, -strlen($frag));
}
$url .= '#' . $this->unit_tag;
$url = apply_filters('wpcf7_form_action_url', $url);
$enctype = apply_filters('wpcf7_form_enctype', '');
$class = apply_filters('wpcf7_form_class_attr', 'wpcf7-form');
$form .= '<form action="' . esc_url_raw($url) . '" method="post"' . ' class="' . esc_attr($class) . '"' . $enctype . '>' . "\n";
$form .= $this->form_hidden_fields();
$form .= $this->form_elements();
if (!$this->responses_count) {
$form .= $this->form_response_output();
}
$form .= '</form>';
$form .= '</div>';
return $form;
}
示例6: form_html
public function form_html($args = '')
{
$args = wp_parse_args($args, array('html_id' => '', 'html_name' => '', 'html_class' => '', 'output' => 'form'));
if ('raw_form' == $args['output']) {
return '<pre class="wpcf7-raw-form"><code>' . esc_html($this->prop('form')) . '</code></pre>';
}
$this->unit_tag = self::get_unit_tag($this->id);
$html = sprintf('<div %s>', wpcf7_format_atts(array('role' => 'form', 'class' => 'wpcf7', 'id' => $this->unit_tag, get_option('html_type') == 'text/html' ? 'lang' : 'xml:lang' => str_replace('_', '-', $this->locale), 'dir' => wpcf7_is_rtl($this->locale) ? 'rtl' : 'ltr'))) . "\n";
$html .= $this->screen_reader_response() . "\n";
$url = wpcf7_get_request_uri();
if ($frag = strstr($url, '#')) {
$url = substr($url, 0, -strlen($frag));
}
$url .= '#' . $this->unit_tag;
$url = apply_filters('wpcf7_form_action_url', $url);
$id_attr = apply_filters('wpcf7_form_id_attr', preg_replace('/[^A-Za-z0-9:._-]/', '', $args['html_id']));
$name_attr = apply_filters('wpcf7_form_name_attr', preg_replace('/[^A-Za-z0-9:._-]/', '', $args['html_name']));
$class = 'wpcf7-form';
if ($this->is_posted()) {
$submission = WPCF7_Submission::get_instance();
if ($submission->is('validation_failed')) {
$class .= ' invalid';
} elseif ($submission->is('spam')) {
$class .= ' spam';
} elseif ($submission->is('mail_sent')) {
$class .= ' sent';
} elseif ($submission->is('mail_failed')) {
$class .= ' failed';
}
}
if ($args['html_class']) {
$class .= ' ' . $args['html_class'];
}
if ($this->in_demo_mode()) {
$class .= ' demo';
}
$class = explode(' ', $class);
$class = array_map('sanitize_html_class', $class);
$class = array_filter($class);
$class = array_unique($class);
$class = implode(' ', $class);
$class = apply_filters('wpcf7_form_class_attr', $class);
$enctype = apply_filters('wpcf7_form_enctype', '');
$novalidate = apply_filters('wpcf7_form_novalidate', wpcf7_support_html5());
$atts = array('action' => esc_url($url), 'method' => 'post', 'class' => $class, 'enctype' => wpcf7_enctype_value($enctype), 'novalidate' => $novalidate ? 'novalidate' : '');
if ('' !== $id_attr) {
$atts['id'] = $id_attr;
}
if ('' !== $name_attr) {
$atts['name'] = $name_attr;
}
$atts = wpcf7_format_atts($atts);
$html .= sprintf('<form %s>', $atts) . "\n";
$html .= $this->form_hidden_fields();
$html .= $this->form_elements();
if (!$this->responses_count) {
$html .= $this->form_response_output();
}
$html .= '</form>';
$html .= '</div>';
return $html;
}
示例7: wpcf7_init
function wpcf7_init()
{
wpcf7_get_request_uri();
wpcf7_register_post_types();
do_action('wpcf7_init');
}
示例8: submit
private function submit()
{
if (!$this->is('init')) {
return $this->status;
}
$this->meta = array('remote_ip' => isset($_SERVER['REMOTE_ADDR']) ? preg_replace('/[^0-9a-f.:, ]/', '', $_SERVER['REMOTE_ADDR']) : '', 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? substr($_SERVER['HTTP_USER_AGENT'], 0, 254) : '', 'url' => preg_replace('%(?<!:|/)/.*$%', '', untrailingslashit(home_url())) . wpcf7_get_request_uri(), 'timestamp' => current_time('timestamp'), 'unit_tag' => isset($_POST['_wpcf7_unit_tag']) ? $_POST['_wpcf7_unit_tag'] : '');
$contact_form = $this->contact_form;
if (!$this->validate()) {
// Validation error occured
$this->status = 'validation_failed';
$this->response = $contact_form->message('validation_error');
} elseif (!$this->accepted()) {
// Not accepted terms
$this->status = 'acceptance_missing';
$this->response = $contact_form->message('accept_terms');
} elseif ($this->spam()) {
// Spam!
$this->status = 'spam';
$this->response = $contact_form->message('spam');
} elseif ($this->mail()) {
$this->status = 'mail_sent';
$this->response = $contact_form->message('mail_sent_ok');
do_action('wpcf7_mail_sent', $contact_form);
} else {
$this->status = 'mail_failed';
$this->response = $contact_form->message('mail_sent_ng');
do_action('wpcf7_mail_failed', $contact_form);
}
$this->remove_uploaded_files();
return $this->status;
}
示例9: form_html
public function form_html($atts = array())
{
$atts = wp_parse_args($atts, array('html_id' => '', 'html_class' => ''));
$this->unit_tag = self::get_unit_tag($this->id);
$form = '<div class="wpcf7" id="' . $this->unit_tag . '">';
$url = wpcf7_get_request_uri();
if ($frag = strstr($url, '#')) {
$url = substr($url, 0, -strlen($frag));
}
$url .= '#' . $this->unit_tag;
$url = apply_filters('wpcf7_form_action_url', $url);
$id_attr = apply_filters('wpcf7_form_id_attr', preg_replace('/[^A-Za-z0-9:._-]/', '', $atts['html_id']));
$class = 'wpcf7-form';
$result = self::get_submission_status($this->id);
if ($this->is_posted()) {
if (empty($result['valid'])) {
$class .= ' invalid';
} elseif (!empty($result['spam'])) {
$class .= ' spam';
} elseif (!empty($result['mail_sent'])) {
$class .= ' sent';
} else {
$class .= ' failed';
}
}
$atts['html_class'] = array_unique(array_map('sanitize_html_class', explode(' ', $atts['html_class'])));
if ($atts['html_class']) {
$class .= ' ' . implode(' ', $atts['html_class']);
}
$class = apply_filters('wpcf7_form_class_attr', trim($class));
$enctype = apply_filters('wpcf7_form_enctype', '');
$novalidate = apply_filters('wpcf7_form_novalidate', wpcf7_support_html5() ? ' novalidate="novalidate"' : '');
$form .= '<form action="' . esc_url_raw($url) . '" method="post"' . ($id_attr ? ' id="' . esc_attr($id_attr) . '"' : '') . ' class="' . esc_attr($class) . '"' . $enctype . $novalidate . '>' . "\n";
$form .= $this->form_hidden_fields();
$form .= $this->form_elements();
if (!$this->responses_count) {
$form .= $this->form_response_output();
}
$form .= '</form>';
$form .= '</div>';
return $form;
}