當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SendPress_Data::create_settings_post方法代碼示例

本文整理匯總了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;
     }
 }
開發者ID:richardsweeney,項目名稱:sendpress,代碼行數:26,代碼來源:class-sendpress-view-settings-widgets.php

示例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;
         }
     }
 }
開發者ID:pedro-mendonca,項目名稱:sendpress,代碼行數:36,代碼來源:class-sendpress-data.php


注:本文中的SendPress_Data::create_settings_post方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。