本文整理匯總了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;
}
}
}