Skip to content

Commit

Permalink
Merge branch 'release/5.1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmikita committed Apr 13, 2018
2 parents 79428ff + d1e8b8f commit 173a5eb
Show file tree
Hide file tree
Showing 24 changed files with 395 additions and 35 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ language: php

matrix:
include:
- php: 7.1
- php: 7.2
env: SNIFF=1
# - php: 7.2
# env: WP_VERSION=latest
- php: 7.1
env: WP_VERSION=latest
- php: 7.0
Expand Down
2 changes: 1 addition & 1 deletion class/Abstracts/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function hash() {
/**
* Adds form field to collection
*
* @param object $field Field object.
* @param Interfaces\Fillable $field Field object.
* @return $this
*/
public function add_form_field( Interfaces\Fillable $field ) {
Expand Down
2 changes: 1 addition & 1 deletion class/Admin/MergeTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function trigger_merge_tags_list( $trigger_slug ) {
/**
* Prints merge tags list
*
* @param object $trigger Trigger object.
* @param Triggerable $trigger Trigger object.
* @return void
*/
public function merge_tags_list( Triggerable $trigger ) {
Expand Down
15 changes: 13 additions & 2 deletions class/Defaults/MergeTag/Comment/CommentActionApprove.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
*/
class CommentActionApprove extends UrlTag {

/**
* Trigger property to get the comment data from
*
* @var string
*/
protected $property_name = 'comment';

/**
* Merge tag constructor
*
Expand All @@ -23,11 +30,15 @@ class CommentActionApprove extends UrlTag {
*/
public function __construct( $params = array() ) {

if ( isset( $params['property_name'] ) && ! empty( $params['property_name'] ) ) {
$this->property_name = $params['property_name'];
}

$args = wp_parse_args( $params, array(
'slug' => 'comment_approve_action_url',
'name' => __( 'Comment approve URL', 'notification' ),
'resolver' => function( $trigger ) {
return admin_url( "comment.php?action=approve&c={$trigger->comment->comment_ID}#wpbody-content" );
return admin_url( "comment.php?action=approve&c={$trigger->{ $this->property_name }->comment_ID}#wpbody-content" );
},
) );

Expand All @@ -41,7 +52,7 @@ public function __construct( $params = array() ) {
* @return boolean
*/
public function check_requirements( ) {
return isset( $this->trigger->comment->comment_ID );
return isset( $this->trigger->{ $this->property_name }->comment_ID );
}

}
15 changes: 13 additions & 2 deletions class/Defaults/MergeTag/Comment/CommentActionDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
*/
class CommentActionDelete extends UrlTag {

/**
* Trigger property to get the comment data from
*
* @var string
*/
protected $property_name = 'comment';

/**
* Merge tag constructor
*
Expand All @@ -23,11 +30,15 @@ class CommentActionDelete extends UrlTag {
*/
public function __construct( $params = array() ) {

if ( isset( $params['property_name'] ) && ! empty( $params['property_name'] ) ) {
$this->property_name = $params['property_name'];
}

$args = wp_parse_args( $params, array(
'slug' => 'comment_delete_action_url',
'name' => __( 'Comment delete URL', 'notification' ),
'resolver' => function( $trigger ) {
return admin_url( "comment.php?action=delete&c={$trigger->comment->comment_ID}#wpbody-content" );
return admin_url( "comment.php?action=delete&c={$trigger->{ $this->property_name }->comment_ID}#wpbody-content" );
},
) );

Expand All @@ -41,7 +52,7 @@ public function __construct( $params = array() ) {
* @return boolean
*/
public function check_requirements( ) {
return isset( $this->trigger->comment->comment_ID );
return isset( $this->trigger->{ $this->property_name }->comment_ID );
}

}
15 changes: 13 additions & 2 deletions class/Defaults/MergeTag/Comment/CommentActionSpam.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
*/
class CommentActionSpam extends UrlTag {

/**
* Trigger property to get the comment data from
*
* @var string
*/
protected $property_name = 'comment';

/**
* Merge tag constructor
*
Expand All @@ -23,11 +30,15 @@ class CommentActionSpam extends UrlTag {
*/
public function __construct( $params = array() ) {

if ( isset( $params['property_name'] ) && ! empty( $params['property_name'] ) ) {
$this->property_name = $params['property_name'];
}

$args = wp_parse_args( $params, array(
'slug' => 'comment_spam_action_url',
'name' => __( 'Comment spam URL', 'notification' ),
'resolver' => function( $trigger ) {
return admin_url( "comment.php?action=spam&c={$trigger->comment->comment_ID}#wpbody-content" );
return admin_url( "comment.php?action=spam&c={$trigger->{ $this->property_name }->comment_ID}#wpbody-content" );
},
) );

Expand All @@ -41,7 +52,7 @@ public function __construct( $params = array() ) {
* @return boolean
*/
public function check_requirements( ) {
return isset( $this->trigger->comment->comment_ID );
return isset( $this->trigger->{ $this->property_name }->comment_ID );
}

}
15 changes: 13 additions & 2 deletions class/Defaults/MergeTag/Comment/CommentActionTrash.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
*/
class CommentActionTrash extends UrlTag {

/**
* Trigger property to get the comment data from
*
* @var string
*/
protected $property_name = 'comment';

/**
* Merge tag constructor
*
Expand All @@ -23,11 +30,15 @@ class CommentActionTrash extends UrlTag {
*/
public function __construct( $params = array() ) {

if ( isset( $params['property_name'] ) && ! empty( $params['property_name'] ) ) {
$this->property_name = $params['property_name'];
}

$args = wp_parse_args( $params, array(
'slug' => 'comment_trash_action_url',
'name' => __( 'Comment trash URL', 'notification' ),
'resolver' => function( $trigger ) {
return admin_url( "comment.php?action=trash&c={$trigger->comment->comment_ID}#wpbody-content" );
return admin_url( "comment.php?action=trash&c={$trigger->{ $this->property_name }->comment_ID}#wpbody-content" );
},
) );

Expand All @@ -41,7 +52,7 @@ public function __construct( $params = array() ) {
* @return boolean
*/
public function check_requirements( ) {
return isset( $this->trigger->comment->comment_ID );
return isset( $this->trigger->{ $this->property_name }->comment_ID );
}

}
15 changes: 13 additions & 2 deletions class/Defaults/MergeTag/Comment/CommentAuthorIP.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
*/
class CommentAuthorIP extends IPTag {

/**
* Trigger property to get the comment data from
*
* @var string
*/
protected $property_name = 'comment';

/**
* Merge tag constructor
*
Expand All @@ -23,13 +30,17 @@ class CommentAuthorIP extends IPTag {
*/
public function __construct( $params = array() ) {

if ( isset( $params['property_name'] ) && ! empty( $params['property_name'] ) ) {
$this->property_name = $params['property_name'];
}

$args = wp_parse_args( $params, array(
'slug' => 'comment_author_IP',
'name' => __( 'Comment author IP', 'notification' ),
'description' => '127.0.0.1',
'example' => true,
'resolver' => function( $trigger ) {
return $trigger->comment->comment_author_IP;
return $trigger->{ $this->property_name }->comment_author_IP;
},
) );

Expand All @@ -43,7 +54,7 @@ public function __construct( $params = array() ) {
* @return boolean
*/
public function check_requirements( ) {
return isset( $this->trigger->comment->comment_author_IP );
return isset( $this->trigger->{ $this->property_name }->comment_author_IP );
}

}
15 changes: 13 additions & 2 deletions class/Defaults/MergeTag/Comment/CommentAuthorUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
*/
class CommentAuthorUrl extends UrlTag {

/**
* Trigger property to get the comment data from
*
* @var string
*/
protected $property_name = 'comment';

/**
* Merge tag constructor
*
Expand All @@ -23,13 +30,17 @@ class CommentAuthorUrl extends UrlTag {
*/
public function __construct( $params = array() ) {

if ( isset( $params['property_name'] ) && ! empty( $params['property_name'] ) ) {
$this->property_name = $params['property_name'];
}

$args = wp_parse_args( $params, array(
'slug' => 'comment_author_url',
'name' => __( 'Comment author URL', 'notification' ),
'description' => __( 'http://mywebsite.com', 'notification' ),
'example' => true,
'resolver' => function( $trigger ) {
return $trigger->comment->comment_author_url;
return $trigger->{ $this->property_name }->comment_author_url;
},
) );

Expand All @@ -43,7 +54,7 @@ public function __construct( $params = array() ) {
* @return boolean
*/
public function check_requirements( ) {
return isset( $this->trigger->comment->comment_author_url );
return isset( $this->trigger->{ $this->property_name }->comment_author_url );
}

}
15 changes: 13 additions & 2 deletions class/Defaults/MergeTag/Comment/CommentAuthorUserAgent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
*/
class CommentAuthorUserAgent extends StringTag {

/**
* Trigger property to get the comment data from
*
* @var string
*/
protected $property_name = 'comment';

/**
* Merge tag constructor
*
Expand All @@ -23,13 +30,17 @@ class CommentAuthorUserAgent extends StringTag {
*/
public function __construct( $params = array() ) {

if ( isset( $params['property_name'] ) && ! empty( $params['property_name'] ) ) {
$this->property_name = $params['property_name'];
}

$args = wp_parse_args( $params, array(
'slug' => 'comment_author_user_agent',
'name' => __( 'Comment author user agent', 'notification' ),
'description' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0',
'example' => true,
'resolver' => function( $trigger ) {
return $trigger->comment->comment_agent;
return $trigger->{ $this->property_name }->comment_agent;
},
) );

Expand All @@ -43,7 +54,7 @@ public function __construct( $params = array() ) {
* @return boolean
*/
public function check_requirements( ) {
return isset( $this->trigger->comment->comment_agent );
return isset( $this->trigger->{ $this->property_name }->comment_agent );
}

}
15 changes: 13 additions & 2 deletions class/Defaults/MergeTag/Comment/CommentContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
*/
class CommentContent extends StringTag {

/**
* Trigger property to get the comment data from
*
* @var string
*/
protected $property_name = 'comment';

/**
* Merge tag constructor
*
Expand All @@ -23,13 +30,17 @@ class CommentContent extends StringTag {
*/
public function __construct( $params = array() ) {

if ( isset( $params['property_name'] ) && ! empty( $params['property_name'] ) ) {
$this->property_name = $params['property_name'];
}

$args = wp_parse_args( $params, array(
'slug' => 'comment_content',
'name' => __( 'Comment content', 'notification' ),
'description' => __( 'Great post!', 'notification' ),
'example' => true,
'resolver' => function( $trigger ) {
return $trigger->comment->comment_content;
return $trigger->{ $this->property_name }->comment_content;
},
) );

Expand All @@ -43,7 +54,7 @@ public function __construct( $params = array() ) {
* @return boolean
*/
public function check_requirements( ) {
return isset( $this->trigger->comment->comment_content );
return isset( $this->trigger->{ $this->property_name }->comment_content );
}

}
15 changes: 13 additions & 2 deletions class/Defaults/MergeTag/Comment/CommentID.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
*/
class CommentID extends IntegerTag {

/**
* Trigger property to get the comment data from
*
* @var string
*/
protected $property_name = 'comment';

/**
* Merge tag constructor
*
Expand All @@ -23,13 +30,17 @@ class CommentID extends IntegerTag {
*/
public function __construct( $params = array() ) {

if ( isset( $params['property_name'] ) && ! empty( $params['property_name'] ) ) {
$this->property_name = $params['property_name'];
}

$args = wp_parse_args( $params, array(
'slug' => 'comment_ID',
'name' => __( 'Comment ID', 'notification' ),
'description' => '35',
'example' => true,
'resolver' => function( $trigger ) {
return $trigger->comment->comment_ID;
return $trigger->{ $this->property_name }->comment_ID;
},
) );

Expand All @@ -43,7 +54,7 @@ public function __construct( $params = array() ) {
* @return boolean
*/
public function check_requirements( ) {
return isset( $this->trigger->comment->comment_ID );
return isset( $this->trigger->{ $this->property_name }->comment_ID );
}

}
Loading

0 comments on commit 173a5eb

Please sign in to comment.