This class allows to import bulk posts into Wordpress from array
| Author | Mario Spada |
| Copyright | Copyright (c) 2015 Mario Spada |
| License | http://opensource.org/licenses/GPL-2.0 GNU Public License |
| Package | ImportPostWp |
| Version | 0.1.0 2015/06/28 |

class ImportPostWp
| Author | Mario Spada |
| Copyright | Copyright (c) 2015 Mario Spada |
| License | http://opensource.org/licenses/GPL-2.0 GNU Public License |
| Package | ImportPostWp |
| Version | 0.1.0 2015/06/28 |
| + $debug | Switch on debug |
| # $default_post_values | Array containing the default field values |
| # $fields_list | Array containing the list of the fields to insert |
| # $insert_errors | Array containing each row number of the failed insert |
| # $nPosts | The number of rows of data array |
| # $posts | Array containing data |
| # $time_elapsed | Total elapsed time in seconds |
| + $time_zone | Timezone as defined in http://php.net/manual/en/timezones.php |
| + $wp_path | Path of Wordpress root directory |
| + __construct() | |
| + delete_posts() | Delete all post of a specific category |
| + get_data() | Return data array |
| + get_default_post_values() | Return default values for the optional field list |
| + get_elapsed_time() | Get elapsed time |
| + get_field_list() | Return the field name list |
| + get_insert_errors() | Return an array of the not inserted rows |
| + insert_posts() | Insert all posts in Wordpress DB |
| # prepare_categories() | Loop through data and search ID categories on WP database. |
| + raw_insert_posts() | Insert all posts in Wordpress DB |
| + reset_time() | reset elapsed time |
| + set_default_comment_status() | Set default values for the field 'comment_status' |
| + set_default_ping_status() | Set default values for the field 'ping_status' |
| + set_default_post_author() | Set default values for the field 'post_author' |
| + set_default_post_status() | Set default values for the field 'post_status' |
| + set_default_post_type() | Set default values for the field 'post_type' |
protected $default_post_values = array('post_status' => 'publish',
'post_type'=> 'post',
'ping_status'=> 'closed',
'comment_status'=> 'closed',
'post_author'=> 1 )protected $fields_list = array('post_title','post_content','post_name',
'post_status','post_type','guid','post_excerpt',
'post_date','post_date_gmt','ping_status',
'comment_status','post_author','categories')protected $insert_errors = array()protected $nPosts = 0protected $posts = array()protected $time_elapsed = 0public $time_zone = "Europe/Rome"public $wp_path = "."
function __construct( |
$data)
|
array $data |
data array |
string $wpPath |
The path to Wordpress directory |
public function delete_posts( |
$cat)
|
int|string $cat |
public function get_data( |
$print = false)
|
bool $print |
public function get_default_post_values( |
$print = false)
|
bool $print |
public function get_field_list( |
$print = false)
|
bool $print |
public function get_insert_errors( |
$print = false)
|
bool $print |
public function insert_posts( |
)
|
protected function prepare_categories( |
)
|
public function raw_insert_posts( |
)
|
public function set_default_comment_status( |
$val)
|
string $val |
public function set_default_ping_status( |
$val)
|
string $val |
public function set_default_post_author( |
$val)
|
string $val |
public function set_default_post_status( |
$val)
|
string $val |
public function set_default_post_type( |
$val)
|
string $val |