Skip to content

Commit 236091b

Browse files
authored
Merge pull request #21 from aaemnnosttv/patch/0.10.1
Version 0.10.1
2 parents 549c82a + 21378eb commit 236091b

File tree

13 files changed

+73
-46
lines changed

13 files changed

+73
-46
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release Notes
22

3+
## v0.10.1 (2016-)
4+
5+
### Fixed
6+
- Strict notice on PHP 5 for abstract static method
7+
38
## v0.10.0 (2016-07-16)
49

510
### Added

src/Post/Action/Action.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Silk\Post\Action;
4+
5+
use Silk\Post\Model;
6+
use Silk\Contracts\Executable;
7+
8+
abstract class Action implements Executable
9+
{
10+
/**
11+
* The model instance
12+
* @var \Silk\Post\Model
13+
*/
14+
protected $model;
15+
16+
/**
17+
* Action Constructor.
18+
*
19+
* @param Model $model The model performing the action
20+
*/
21+
public function __construct(Model $model)
22+
{
23+
$this->model = $model;
24+
}
25+
26+
/**
27+
* Execute the action.
28+
*
29+
* @return void
30+
*/
31+
abstract public function execute();
32+
}

src/Post/Action/PostDeleter.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Silk\Post\Action;
44

5-
use Silk\Database\Action;
6-
75
class PostDeleter extends Action
86
{
97
public function execute()

src/Post/Action/PostLoader.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Silk\Post\Action;
44

5-
use Silk\Database\Action;
6-
75
class PostLoader extends Action
86
{
97
public function execute()

src/Post/Action/PostSaver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Silk\Post\Action;
44

5-
use Silk\Database\Action;
65
use Silk\Exception\WP_ErrorException;
76

87
class PostSaver extends Action

src/Post/Model.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,6 @@ public static function create($attributes = [])
159159
return static::fromWpPost($post)->save();
160160
}
161161

162-
/**
163-
* Get the post type identifier for this model.
164-
*
165-
* @return string
166-
*/
167-
public static function typeId()
168-
{
169-
return static::postTypeId();
170-
}
171-
172162
/**
173163
* Get the post type identifier for this model
174164
*

src/Term/Action/Action.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Silk\Term\Action;
4+
5+
use Silk\Term\Model;
6+
use Silk\Contracts\Executable;
7+
8+
abstract class Action implements Executable
9+
{
10+
/**
11+
* The model instance
12+
* @var \Silk\Term\Model
13+
*/
14+
protected $model;
15+
16+
/**
17+
* Action Constructor.
18+
*
19+
* @param Model $model The model performing the action
20+
*/
21+
public function __construct(Model $model)
22+
{
23+
$this->model = $model;
24+
}
25+
26+
/**
27+
* Execute the action.
28+
*
29+
* @return void
30+
*/
31+
abstract public function execute();
32+
}

src/Term/Action/TermDeleter.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
namespace Silk\Term\Action;
44

5-
use Silk\Database\Action;
6-
75
class TermDeleter extends Action
86
{
97
public function execute()
108
{
11-
if (wp_delete_term($this->model->id, $this->model->typeId())) {
9+
if (wp_delete_term($this->model->id, $this->model->taxonomy)) {
1210
$this->model->setObject(new \WP_Term(new \stdClass));
1311
}
1412
}

src/Term/Action/TermLoader.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
namespace Silk\Term\Action;
44

5-
use Silk\Database\Action;
6-
75
class TermLoader extends Action
86
{
97
public function execute()
108
{
119
$this->model->setObject(
12-
\WP_Term::get_instance($this->model->id, $this->model->typeId())
10+
\WP_Term::get_instance($this->model->id, $this->model->taxonomy)
1311
);
1412
}
1513
}

src/Term/Action/TermSaver.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@
22

33
namespace Silk\Term\Action;
44

5-
use Silk\Database\Action;
65
use Silk\Exception\WP_ErrorException;
76

87
class TermSaver extends Action
98
{
109
public function execute()
1110
{
12-
$taxonomy = $this->model->typeId();
13-
1411
if ($this->model->id) {
15-
$ids = wp_update_term($this->model->id, $taxonomy, $this->model->object->to_array());
12+
$ids = wp_update_term($this->model->id, $this->model->taxonomy, $this->model->object->to_array());
1613
} else {
17-
$ids = wp_insert_term($this->model->name, $taxonomy, $this->model->object->to_array());
14+
$ids = wp_insert_term($this->model->name, $this->model->taxonomy, $this->model->object->to_array());
1815
}
1916

2017
if (is_wp_error($ids)) {

0 commit comments

Comments
 (0)