本文整理汇总了PHP中wpcf7_normalize_newline_deep函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf7_normalize_newline_deep函数的具体用法?PHP wpcf7_normalize_newline_deep怎么用?PHP wpcf7_normalize_newline_deep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf7_normalize_newline_deep函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpcf7_convert_to_cpt
function wpcf7_convert_to_cpt($new_ver, $old_ver)
{
global $wpdb;
if (!version_compare($old_ver, '3.0-dev', '<')) {
return;
}
$old_rows = array();
$table_name = $wpdb->prefix . "contact_form_7";
if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'")) {
$old_rows = $wpdb->get_results("SELECT * FROM {$table_name}");
} elseif (($opt = get_option('wpcf7')) && !empty($opt['contact_forms'])) {
foreach ((array) $opt['contact_forms'] as $key => $value) {
$old_rows[] = (object) array_merge($value, array('cf7_unit_id' => $key));
}
}
foreach ((array) $old_rows as $row) {
$q = "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_old_cf7_unit_id'" . $wpdb->prepare(" AND meta_value = %d", $row->cf7_unit_id);
if ($wpdb->get_var($q)) {
continue;
}
$postarr = array('post_type' => 'wpcf7_contact_form', 'post_status' => 'publish', 'post_title' => maybe_unserialize($row->title));
$post_id = wp_insert_post($postarr);
if ($post_id) {
update_post_meta($post_id, '_old_cf7_unit_id', $row->cf7_unit_id);
$metas = array('form', 'mail', 'mail_2', 'messages', 'additional_settings');
foreach ($metas as $meta) {
update_post_meta($post_id, '_' . $meta, wpcf7_normalize_newline_deep(maybe_unserialize($row->{$meta})));
}
}
}
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:31,代码来源:upgrade.php
示例2: 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;
}
开发者ID:estrategasdigitales,项目名称:dictobas,代码行数:26,代码来源:contact-form.php
示例3: save
function save()
{
$postarr = array('ID' => (int) $this->id, 'post_type' => 'wpcf7_contact_form', 'post_status' => 'publish', 'post_title' => $this->title);
$post_id = wp_insert_post($postarr);
if ($post_id) {
$metas = array('form', 'mail', 'mail_2', 'messages', 'additional_settings');
foreach ($metas as $meta) {
update_post_meta($post_id, $meta, wpcf7_normalize_newline_deep($this->{$meta}));
}
if ($this->initial) {
$this->initial = false;
$this->id = $post_id;
do_action_ref_array('wpcf7_after_create', array(&$this));
} else {
do_action_ref_array('wpcf7_after_update', array(&$this));
}
do_action_ref_array('wpcf7_after_save', array(&$this));
}
return $post_id;
}
开发者ID:xuandungpy,项目名称:vuong,代码行数:20,代码来源:classes.php
示例4: wpcf7_normalize_newline_deep
function wpcf7_normalize_newline_deep($arr, $to = "\n")
{
if (is_array($arr)) {
$result = array();
foreach ($arr as $key => $text) {
$result[$key] = wpcf7_normalize_newline_deep($text, $to);
}
return $result;
}
return wpcf7_normalize_newline($arr, $to);
}
开发者ID:abcode619,项目名称:wpstuff,代码行数:11,代码来源:formatting.php
示例5: save
function save()
{
$metas = array('form', 'mail', 'mail_2', 'messages', 'additional_settings');
$post_content = '';
foreach ($metas as $meta) {
$props = (array) $this->{$meta};
foreach ($props as $prop) {
$post_content .= "\n" . trim($prop);
}
}
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 ($metas as $meta) {
update_post_meta($post_id, $meta, wpcf7_normalize_newline_deep($this->{$meta}));
}
if ($this->initial) {
$this->initial = false;
$this->id = $post_id;
do_action_ref_array('wpcf7_after_create', array(&$this));
} else {
do_action_ref_array('wpcf7_after_update', array(&$this));
}
do_action_ref_array('wpcf7_after_save', array(&$this));
}
return $post_id;
}
开发者ID:rotoballer,项目名称:emily,代码行数:30,代码来源:classes.php
注:本文中的wpcf7_normalize_newline_deep函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论