本文整理汇总了PHP中wpcf7_array_flatten函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf7_array_flatten函数的具体用法?PHP wpcf7_array_flatten怎么用?PHP wpcf7_array_flatten使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf7_array_flatten函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpcf7_akismet_submitted_params
function wpcf7_akismet_submitted_params()
{
$params = array('author' => '', 'author_email' => '', 'author_url' => '');
$content = '';
$fes = wpcf7_scan_shortcode();
foreach ($fes as $fe) {
if (!isset($fe['name']) || !isset($_POST[$fe['name']])) {
continue;
}
$value = $_POST[$fe['name']];
if (is_array($value)) {
$value = implode(', ', wpcf7_array_flatten($value));
}
$value = trim($value);
$options = (array) $fe['options'];
if (preg_grep('%^akismet:author$%', $options)) {
$params['author'] = trim($params['author'] . ' ' . $value);
} elseif (preg_grep('%^akismet:author_email$%', $options)) {
if ('' == $params['author_email']) {
$params['author_email'] = $value;
}
} elseif (preg_grep('%^akismet:author_url$%', $options)) {
if ('' == $params['author_url']) {
$params['author_url'] = $value;
}
}
$content = trim($content . "\n\n" . $value);
}
$params = array_filter($params);
if (!$params) {
return false;
}
$params['content'] = $content;
return $params;
}
示例2: wpcf7_flat_join
function wpcf7_flat_join($input)
{
$input = wpcf7_array_flatten($input);
$output = array();
foreach ((array) $input as $value) {
$output[] = trim((string) $value);
}
return implode(', ', $output);
}
示例3: wpcf7_akismet_submitted_params
function wpcf7_akismet_submitted_params()
{
$params = array('author' => '', 'author_email' => '', 'author_url' => '', 'content' => '');
$has_akismet_option = false;
foreach ((array) $_POST as $key => $val) {
if ('_wpcf7' == substr($key, 0, 6) || '_wpnonce' == $key) {
continue;
}
if (is_array($val)) {
$val = implode(', ', wpcf7_array_flatten($val));
}
$val = trim($val);
if (0 == strlen($val)) {
continue;
}
if ($tags = wpcf7_scan_shortcode(array('name' => $key))) {
$tag = $tags[0];
$tag = new WPCF7_Shortcode($tag);
$akismet = $tag->get_option('akismet', '(author|author_email|author_url)', true);
if ($akismet) {
$has_akismet_option = true;
if ('author' == $akismet) {
$params[$akismet] = trim($params[$akismet] . ' ' . $val);
} elseif ('' == $params[$akismet]) {
$params[$akismet] = $val;
}
}
}
$params['content'] .= "\n\n" . $val;
}
if (!$has_akismet_option) {
return false;
}
$params['content'] = trim($params['content']);
return $params;
}
示例4: save
public function save()
{
$props = $this->get_properties();
$post_content = implode("\n", wpcf7_array_flatten($props));
if ($this->initial()) {
$post_id = wp_insert_post(array('post_type' => self::post_type, 'post_status' => 'publish', 'post_title' => $this->title, 'post_content' => trim($post_content)));
} else {
$post_id = wp_update_post(array('ID' => (int) $this->id, 'post_status' => 'publish', 'post_title' => $this->title, 'post_content' => trim($post_content)));
}
if ($post_id) {
foreach ($props as $prop => $value) {
update_post_meta($post_id, '_' . $prop, wpcf7_normalize_newline_deep($value));
}
if (wpcf7_is_valid_locale($this->locale)) {
update_post_meta($post_id, '_locale', $this->locale);
}
if ($this->initial()) {
$this->id = $post_id;
do_action('wpcf7_after_create', $this);
} else {
do_action('wpcf7_after_update', $this);
}
do_action('wpcf7_after_save', $this);
}
return $post_id;
}
示例5: blacklist_check
private function blacklist_check()
{
$target = wpcf7_array_flatten($this->posted_data);
$target[] = $this->get_meta('remote_ip');
$target[] = $this->get_meta('user_agent');
$target = implode("\n", $target);
return wpcf7_blacklist_check($target);
}
示例6: wpcf7_array_flatten
function wpcf7_array_flatten($input)
{
if (!is_array($input)) {
return array($input);
}
$output = array();
foreach ($input as $value) {
$output = array_merge($output, wpcf7_array_flatten($value));
}
return $output;
}
示例7: blacklist_check
private function blacklist_check()
{
$target = wpcf7_array_flatten($this->posted_data);
$target[] = $_SERVER['REMOTE_ADDR'];
$target[] = $_SERVER['HTTP_USER_AGENT'];
$target = implode("\n", $target);
return wpcf7_blacklist_check($target);
}