本文整理汇总了PHP中SendPress_Data::create_settings_post方法的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Data::create_settings_post方法的具体用法?PHP SendPress_Data::create_settings_post怎么用?PHP SendPress_Data::create_settings_post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SendPress_Data
的用法示例。
在下文中一共展示了SendPress_Data::create_settings_post方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save($post, $sp)
{
// print_r($post);
// die();
$action = isset($post['form_action']) ? $post['form_action'] : 'save';
switch ($action) {
case 'copy':
$postid = SendPress_Data::create_settings_post($post['post_subject'], "", $post['copy_from']);
//wp_redirect( '?page=sp-settings&view=widgets&id='. $postid );
SendPress_Admin::redirect('Settings_Widgets', array('id' => $postid));
break;
case 'create':
$postid = SendPress_Data::create_settings_post($post['post_subject'], $post['form_type']);
//wp_redirect( '?page=sp-settings&view=widgets&id='. $postid );
SendPress_Admin::redirect('Settings_Widgets', array('id' => $postid));
break;
case 'delete':
self::delete_form_save($post, $sp);
//wp_redirect( '?page=sp-settings&view=widgets' );
SendPress_Admin::redirect('Settings_Widgets');
break;
default:
self::save_form($post, $sp);
break;
}
}
示例2: create_default_form
static function create_default_form($type = 'signup')
{
//SendPress_Option::set('default-signup-widget-settings',null);
$postid = SendPress_Option::get('default-' . $type . '-widget-settings');
$hasPost = false;
if (!empty($postid)) {
$hasPost = true;
$query = array();
/*
$query = get_posts(array(
'post_type'=>'sp_settings',
'post_status'=>'any',
'p'=>$postid
));
*/
if (count($query) === 0) {
$hasPost = false;
$xposts = get_posts(array('post_type' => 'sp_settings', 'post_status' => 'any', 'orderby' => 'ID', 'order' => 'ASC'));
foreach ($xposts as $pchecks) {
if ($pchecks->post_title == 'Default Signup Settings') {
$hasPost = true;
SendPress_Option::set('default-signup-widget-settings', $pchecks->ID);
}
//Default Signup Settings
}
}
}
if (!$hasPost) {
switch ($type) {
case 'signup':
$postid = SendPress_Data::create_settings_post("Default Signup Settings", SendPress_Data::signup_defaults());
SendPress_Option::set('default-' . $type . '-widget-settings', $postid);
break;
}
}
}