| @@ 40-64 (lines=25) @@ | ||
| 37 | * @param string $slug a custom post type ID. |
|
| 38 | * @param int $num Optional. Number of posts to create. |
|
| 39 | */ |
|
| 40 | public function create_objects( $slug, $connection, $num = '' ) { |
|
| 41 | ||
| 42 | // If we're missing a custom post type id - don't do anything |
|
| 43 | if ( empty( $slug ) ) { |
|
| 44 | return; |
|
| 45 | } |
|
| 46 | ||
| 47 | // Set our connection status for the rest of the methods |
|
| 48 | $this->connected = $connection; |
|
| 49 | ||
| 50 | // If we forgot to put in a quantity, make one for us |
|
| 51 | if ( empty( $num ) ) { |
|
| 52 | $num = rand( 5, 30 ); |
|
| 53 | } |
|
| 54 | ||
| 55 | // Create test terms |
|
| 56 | for( $i = 0; $i < $num; $i++ ) { |
|
| 57 | ||
| 58 | $return = $this->create_test_object( $slug ); |
|
| 59 | ||
| 60 | return $return; |
|
| 61 | ||
| 62 | } |
|
| 63 | ||
| 64 | } |
|
| 65 | ||
| 66 | ||
| 67 | /** |
|
| @@ 42-66 (lines=25) @@ | ||
| 39 | * @param boolean $connection Whether or not we're connected to the Internet. |
|
| 40 | * @param int $num Optional. Number of posts to create. |
|
| 41 | */ |
|
| 42 | public function create_objects( $slug, $connection, $num = '' ) { |
|
| 43 | ||
| 44 | // If we're missing a custom post type id - don't do anything |
|
| 45 | if ( empty( $slug ) ) { |
|
| 46 | return; |
|
| 47 | } |
|
| 48 | ||
| 49 | // Set our connection status for the rest of the methods |
|
| 50 | $this->connected = $connection; |
|
| 51 | ||
| 52 | // If we forgot to put in a quantity, make one for us |
|
| 53 | if ( empty( $num ) ) { |
|
| 54 | $num = rand( 5, 30 ); |
|
| 55 | } |
|
| 56 | ||
| 57 | // Create test posts |
|
| 58 | for( $i = 0; $i < $num; $i++ ) { |
|
| 59 | ||
| 60 | $return = $this->create_test_object( $slug ); |
|
| 61 | ||
| 62 | return $return; |
|
| 63 | ||
| 64 | } |
|
| 65 | ||
| 66 | } |
|
| 67 | ||
| 68 | ||
| 69 | /** |
|