vishvajit commited on
Commit
f6d3606
·
1 Parent(s): adb5747

Trickyenough Favorites Post

Browse files

Trickyenough Favorites Post for custom post type

Files changed (31) hide show
  1. tricyenough-favorites-posts/core/class-tricyenough-favorites-posts.php +142 -0
  2. tricyenough-favorites-posts/core/includes/assets/css/backend-styles.css +52 -0
  3. tricyenough-favorites-posts/core/includes/assets/css/index.php +1 -0
  4. tricyenough-favorites-posts/core/includes/assets/index.php +1 -0
  5. tricyenough-favorites-posts/core/includes/assets/js/favorite-scripts.js +45 -0
  6. tricyenough-favorites-posts/core/includes/assets/js/index.php +1 -0
  7. tricyenough-favorites-posts/core/includes/classes/class-tricyenough-favorites-posts-database.php +94 -0
  8. tricyenough-favorites-posts/core/includes/classes/class-tricyenough-favorites-posts-helpers.php +115 -0
  9. tricyenough-favorites-posts/core/includes/classes/class-tricyenough-favorites-posts-run.php +122 -0
  10. tricyenough-favorites-posts/core/includes/classes/class-tricyenough-favorites-posts-settings.php +56 -0
  11. tricyenough-favorites-posts/core/includes/classes/class-tricyenough-favorites-posts-shortcode.php +81 -0
  12. tricyenough-favorites-posts/core/includes/classes/index.php +1 -0
  13. tricyenough-favorites-posts/core/includes/index.php +1 -0
  14. tricyenough-favorites-posts/core/includes/integrations/demo-integration/actions/demo_update_post.php +126 -0
  15. tricyenough-favorites-posts/core/includes/integrations/demo-integration/actions/index.php +1 -0
  16. tricyenough-favorites-posts/core/includes/integrations/demo-integration/assets/img/icon-wp-webhooks.svg +1 -0
  17. tricyenough-favorites-posts/core/includes/integrations/demo-integration/assets/img/index.php +1 -0
  18. tricyenough-favorites-posts/core/includes/integrations/demo-integration/assets/index.php +1 -0
  19. tricyenough-favorites-posts/core/includes/integrations/demo-integration/demo-integration.php +48 -0
  20. tricyenough-favorites-posts/core/includes/integrations/demo-integration/helpers/index.php +1 -0
  21. tricyenough-favorites-posts/core/includes/integrations/demo-integration/index.php +1 -0
  22. tricyenough-favorites-posts/core/includes/integrations/demo-integration/triggers/demo_request_received.php +171 -0
  23. tricyenough-favorites-posts/core/includes/integrations/demo-integration/triggers/demo_update_user.php +309 -0
  24. tricyenough-favorites-posts/core/includes/integrations/demo-integration/triggers/index.php +1 -0
  25. tricyenough-favorites-posts/core/includes/integrations/index.php +1 -0
  26. tricyenough-favorites-posts/core/index.php +1 -0
  27. tricyenough-favorites-posts/index.php +1 -0
  28. tricyenough-favorites-posts/languages/index.php +1 -0
  29. tricyenough-favorites-posts/license.txt +281 -0
  30. tricyenough-favorites-posts/readme.txt +61 -0
  31. tricyenough-favorites-posts/tricyenough-favorites-posts.php +63 -0
tricyenough-favorites-posts/core/class-tricyenough-favorites-posts.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly.
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+ if ( ! class_exists( 'Tricyenough_Favorites_Posts' ) ) :
6
+
7
+ /**
8
+ * Main Tricyenough_Favorites_Posts Class.
9
+ *
10
+ * @package TRICYENOUG
11
+ * @subpackage Classes/Tricyenough_Favorites_Posts
12
+ * @since 1.0.0
13
+ * @author vishvajit kumar
14
+ */
15
+ final class Tricyenough_Favorites_Posts {
16
+
17
+ /**
18
+ * The real instance
19
+ *
20
+ * @access private
21
+ * @since 1.0.0
22
+ * @var object|Tricyenough_Favorites_Posts
23
+ */
24
+ private static $instance;
25
+
26
+ /**
27
+ * TRICYENOUG helpers object.
28
+ *
29
+ * @access public
30
+ * @since 1.0.0
31
+ * @var object|Tricyenough_Favorites_Posts_Helpers
32
+ */
33
+ public $helpers;
34
+
35
+ /**
36
+ * TRICYENOUG settings object.
37
+ *
38
+ * @access public
39
+ * @since 1.0.0
40
+ * @var object|Tricyenough_Favorites_Posts_Settings
41
+ */
42
+ public $settings;
43
+
44
+ /**
45
+ * Throw error on object clone.
46
+ *
47
+ * Cloning instances of the class is forbidden.
48
+ *
49
+ * @access public
50
+ * @since 1.0.0
51
+ * @return void
52
+ */
53
+ public function __clone() {
54
+ _doing_it_wrong( __FUNCTION__, __( 'You are not allowed to clone this class.', 'tricyenough-favorites-posts' ), '1.0.0' );
55
+ }
56
+
57
+ /**
58
+ * Disable unserializing of the class.
59
+ *
60
+ * @access public
61
+ * @since 1.0.0
62
+ * @return void
63
+ */
64
+ public function __wakeup() {
65
+ _doing_it_wrong( __FUNCTION__, __( 'You are not allowed to unserialize this class.', 'tricyenough-favorites-posts' ), '1.0.0' );
66
+ }
67
+
68
+ /**
69
+ * Main Tricyenough_Favorites_Posts Instance.
70
+ *
71
+ * Insures that only one instance of Tricyenough_Favorites_Posts exists in memory at any one
72
+ * time. Also prevents needing to define globals all over the place.
73
+ *
74
+ * @access public
75
+ * @since 1.0.0
76
+ * @static
77
+ * @return object|Tricyenough_Favorites_Posts The one true Tricyenough_Favorites_Posts
78
+ */
79
+ public static function instance() {
80
+ if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Tricyenough_Favorites_Posts ) ) {
81
+ self::$instance = new Tricyenough_Favorites_Posts;
82
+ self::$instance->base_hooks();
83
+ self::$instance->includes();
84
+ self::$instance->helpers = new Tricyenough_Favorites_Posts_Helpers();
85
+ self::$instance->settings = new Tricyenough_Favorites_Posts_Settings();
86
+ self::$instance->database = new Tricyenough_Favorites_Posts_Database();
87
+ self::$instance->shortcode = new Tricyenough_Favorites_Posts_Shortcode();
88
+
89
+ //Fire the plugin logic
90
+ self::$instance->run = new Tricyenough_Favorites_Posts_Run();
91
+
92
+ /**
93
+ * Fire a custom action to allow dependencies
94
+ * after the successful plugin setup
95
+ */
96
+ do_action( 'TRICYENOUG/plugin_loaded' );
97
+ }
98
+
99
+ return self::$instance;
100
+ }
101
+
102
+ /**
103
+ * Include required files.
104
+ *
105
+ * @access private
106
+ * @since 1.0.0
107
+ * @return void
108
+ */
109
+ private function includes() {
110
+ require_once TRICYENOUG_PLUGIN_DIR . 'core/includes/classes/class-tricyenough-favorites-posts-helpers.php';
111
+ require_once TRICYENOUG_PLUGIN_DIR . 'core/includes/classes/class-tricyenough-favorites-posts-settings.php';
112
+ require_once TRICYENOUG_PLUGIN_DIR . 'core/includes/classes/class-tricyenough-favorites-posts-database.php';
113
+ require_once TRICYENOUG_PLUGIN_DIR . 'core/includes/classes/class-tricyenough-favorites-posts-shortcode.php';
114
+
115
+ require_once TRICYENOUG_PLUGIN_DIR . 'core/includes/classes/class-tricyenough-favorites-posts-run.php';
116
+ }
117
+
118
+ /**
119
+ * Add base hooks for the core functionality
120
+ *
121
+ * @access private
122
+ * @since 1.0.0
123
+ * @return void
124
+ */
125
+ private function base_hooks() {
126
+ add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
127
+ }
128
+
129
+ /**
130
+ * Loads the plugin language files.
131
+ *
132
+ * @access public
133
+ * @since 1.0.0
134
+ * @return void
135
+ */
136
+ public function load_textdomain() {
137
+ load_plugin_textdomain( 'tricyenough-favorites-posts', FALSE, dirname( plugin_basename( TRICYENOUG_PLUGIN_FILE ) ) . '/languages/' );
138
+ }
139
+
140
+ }
141
+
142
+ endif; // End if class_exists check.
tricyenough-favorites-posts/core/includes/assets/css/backend-styles.css ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*-----------------
2
+ Backend related CSS
3
+ -----------------*/
4
+ .favorites-popup {
5
+ width: 350px;
6
+ height: 200px;
7
+ background: rgb(213 210 210);
8
+ display: none;
9
+ position: absolute;
10
+ top:40%;
11
+ left: 40%;
12
+ right: 60%;
13
+ z-index: 9999999;
14
+ text-align: center;
15
+
16
+ h5{
17
+ margin-top: 25%;
18
+ }
19
+ &:nth-child(2) {
20
+ transform: rotate(135deg);
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+
27
+ .popup__content {
28
+ width: 80%;
29
+ overflow:auto;
30
+ padding: 50px;
31
+ background: white;
32
+ color: black;
33
+ position: relative;
34
+ top: 50%;
35
+ left: 50%;
36
+ transform: translate(-50%, -50%);
37
+ box-sizing: border-box;
38
+ .close {
39
+ position: absolute;
40
+ right: 20px;
41
+ top: 20px;
42
+ width: 20px;
43
+ display: block;
44
+ span {
45
+ cursor: pointer;
46
+ position: fixed;
47
+ width: 20px;
48
+ height: 3px;
49
+ background: #099ccc;
50
+ &:nth-child(1) {
51
+ transform: rotate(45deg);
52
+ }
tricyenough-favorites-posts/core/includes/assets/css/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/assets/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/assets/js/favorite-scripts.js ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*------------------------
2
+ Backend related javascript
3
+ ------------------------*/
4
+ jQuery(document).ready(function(){
5
+ $('form#save_bookmark').unbind("submit").submit(function(e){
6
+ e.preventDefault();
7
+ $.ajax({
8
+ url: favorites_ajax_object.ajax_url,
9
+ type: "POST",
10
+ data: $(this).serialize(),
11
+ success: function(data){
12
+ $("#bookmark_icon").attr('class', 'fa fa-bookmark');
13
+ $("#favorite_popup_msg").text("Bookmark Added");
14
+ $(".favorites-popup").fadeIn(500);
15
+ //$("form").attr("id","remove_bookmark");
16
+ //$("#form-action").val("removBookmark");
17
+ },
18
+ error: function(){
19
+ console.log(data);
20
+ }
21
+ });
22
+ });
23
+ $('form#remove_bookmark').unbind("submit").submit(function(e){
24
+ e.preventDefault();
25
+ // var data = $(this).serialize();
26
+ $.ajax({
27
+ url: favorites_ajax_object.ajax_url,
28
+ type: "POST",
29
+ data: $(this).serialize(),
30
+ success: function(data){
31
+ $("#bookmark_icon").attr('class', 'fa fa-bookmark-o');
32
+ $("#favorite_popup_msg").text("Bookmark Removed");
33
+ $(".favorites-popup").fadeIn(500);
34
+ //$("form").attr("id","save_bookmark");
35
+ //$("#form-action").val("savePost");
36
+ },
37
+ error: function(data){
38
+ console.log(data);
39
+ }
40
+ });
41
+ });
42
+ $(".close").click(function() {
43
+ $(".favorites-popup").fadeOut(500);
44
+ });
45
+ });
tricyenough-favorites-posts/core/includes/assets/js/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/classes/class-tricyenough-favorites-posts-database.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly.
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Class Tricyenough_Favorites_Posts_Database
8
+ *
9
+ * This class contains repetitive functions that
10
+ * are used globally within the plugin.
11
+ *
12
+ * @package TRICYENOUG
13
+ * @subpackage Classes/Tricyenough_Favorites_Posts_Database
14
+ * @author vishvajit kumar
15
+ * @since 1.0.0
16
+ */
17
+ class Tricyenough_Favorites_Posts_Database
18
+ {
19
+ function __construct()
20
+ {
21
+ register_activation_hook(__FILE__,array($this, 'database_install'));
22
+
23
+ }
24
+ //
25
+ public function database_install() {
26
+ global $wpdb;
27
+ $table_name = $wpdb->prefix . 'favorites_posts';
28
+ $charset_collate = $wpdb->get_charset_collate();
29
+ $query = "CREATE TABLE " . $wpdb->prefix . "favorite_posts
30
+ (id INT AUTO_INCREMENT,
31
+ post_id INT NOT NULL,
32
+ user_id INT NOT NULL,
33
+ PRIMARY KEY (id))";
34
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
35
+ $wpdb->get_results($query);
36
+ }
37
+
38
+ public function saveBookmark($the_post,$the_user)
39
+ {
40
+ // Save to DB
41
+ global $wpdb;
42
+ $check = $wpdb->get_results("
43
+ SELECT *
44
+ FROM wp_favorite_posts
45
+ WHERE post_id = '$the_post'
46
+ AND user_id = '$the_user'
47
+ ");
48
+ if ( empty($check) ) {
49
+ $result = $wpdb->insert( 'wp_favorite_posts', array( 'post_id' => $the_post, 'user_id' => $the_user), array( '%d', '%d' ) );
50
+ }
51
+ }
52
+ public function removeBookmark($the_post,$the_user)
53
+ {
54
+ // remove to DB
55
+ global $wpdb;
56
+ $check = $wpdb->get_results("
57
+ SELECT *
58
+ FROM wp_favorite_posts
59
+ WHERE post_id = '$the_post'
60
+ AND user_id = '$the_user'");
61
+ if ( !empty($check) ) {
62
+ $result = $wpdb->delete( 'wp_favorite_posts', array( 'post_id' => $the_post, 'user_id' => $the_user), array( '%d', '%d' ) );
63
+ }
64
+ }
65
+ public function get_favorite_posts($userid)
66
+ {
67
+ global $wpdb;
68
+ $match = $wpdb->get_results("
69
+ SELECT wp_posts.ID, wp_favorite_posts.post_id
70
+ FROM wp_posts
71
+ INNER JOIN wp_favorite_posts
72
+ ON wp_posts.ID=wp_favorite_posts.post_id
73
+ AND wp_favorite_posts.user_id = '$userid'
74
+ ORDER BY wp_posts.ID
75
+ ");
76
+ if ( !empty($match) ) {
77
+ return $match;
78
+ }
79
+ // if ( !empty($match) ) {
80
+ // $favorites = array();
81
+ // foreach ( $match as $post ){
82
+ // $favorites[] = $post->ID;
83
+ // }
84
+ // return $favorites;
85
+ // } else {
86
+ // return FALSE;
87
+ // }
88
+ }
89
+ }
90
+
91
+ $tri_shortcode = new Tricyenough_Favorites_Posts_Database();
92
+
93
+
94
+
tricyenough-favorites-posts/core/includes/classes/class-tricyenough-favorites-posts-helpers.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly.
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Class Tricyenough_Favorites_Posts_Helpers
8
+ *
9
+ * This class contains repetitive functions that
10
+ * are used globally within the plugin.
11
+ *
12
+ * @package TRICYENOUG
13
+ * @subpackage Classes/Tricyenough_Favorites_Posts_Helpers
14
+ * @author vishvajit kumar
15
+ * @since 1.0.0
16
+ */
17
+ class Tricyenough_Favorites_Posts_Helpers{
18
+
19
+ /**
20
+ * ######################
21
+ * ###
22
+ * #### CALLABLE FUNCTIONS
23
+ * ###
24
+ * ######################
25
+ */
26
+ function __construct(){
27
+ $this->add_hooks();
28
+ }
29
+
30
+ private function add_hooks()
31
+ {
32
+ //add_shortcode( 'favourite-post-btn', array(&$this, 'get_favorites_add_link' ) );
33
+ add_action( 'wp_ajax_savePost', array( $this, 'savePost' ));
34
+ add_action( 'wp_ajax_nopriv_savePost', array( $this, 'savePost' ));
35
+
36
+ add_action( 'wp_ajax_savePost', array( $this, 'savePost' ) ); //execute when wp logged in
37
+ add_action( 'wp_ajax_nopriv_savePost', array( $this, 'savePost' )); //execute when logged out
38
+
39
+ add_action( 'wp_ajax_removBookmark', array( $this, 'removBookmark' ) ); //execute when wp logged in
40
+ add_action( 'wp_ajax_nopriv_removBookmark', array( $this, 'removBookmark' )); //execute when logged out
41
+ add_action('wp_body_open', array( $this, 'custom_content_after_body_open_tag'));
42
+ }
43
+
44
+ public function check_favorite_posts($post_id, $user_id)
45
+ {
46
+ global $wpdb;
47
+ $match = $wpdb->get_results("SELECT * FROM wp_favorite_posts WHERE post_id = '$post_id'
48
+ AND user_id = '$user_id'");
49
+ if ( !empty($match) ) :
50
+ return TRUE;
51
+ else :
52
+ return FALSE;
53
+ endif;
54
+ }
55
+ // Get Remove Button
56
+ function get_favorites_remove_link($title = 'Remove', $class = NULL){
57
+ // Remove from DB
58
+ if ( is_user_logged_in() ) {
59
+ return '
60
+ <form id="remove_bookmark" class="remove" style="display: inline;">
61
+ <input type="hidden" value="1" name="remove_it" />
62
+ <input type="hidden" value="'.get_the_ID().'" name="post_id" class="fp_id" />
63
+ <input type="hidden" value="'.get_current_user_id().'" name="user_id" class="fp_user_id" />
64
+ <input type="hidden" value="removBookmark" name="action" />
65
+ <button class="btn btn-dark remove_it_now '.$class.'" name="" ><i id="bookmark_icon" class="fa fa-bookmark" style="color: #fdfdfd;"></i>
66
+ </button>
67
+ </form>
68
+ ';
69
+ }
70
+ }
71
+ public function savePost()
72
+ {
73
+ $database = new Tricyenough_Favorites_Posts_Database();
74
+ $the_post = $_POST['post_id'];
75
+ $the_user = $_POST['user_id'];
76
+ $result=$database->saveBookmark($the_post,$the_user);
77
+ if (!empty($result) ) {
78
+ return true;
79
+ }else{
80
+ return false;
81
+ }
82
+ exit;
83
+ exit;
84
+ }
85
+ public function removBookmark()
86
+ {
87
+ $database = new Tricyenough_Favorites_Posts_Database();
88
+ $the_post = $_POST['post_id'];
89
+ $the_user = $_POST['user_id'];
90
+ $result=$database->removeBookmark($the_post,$the_user);
91
+ if (!empty($result) ) {
92
+ return true;
93
+ }else{
94
+ return false;
95
+ }
96
+ exit;
97
+
98
+ }
99
+ function custom_content_after_body_open_tag() {
100
+
101
+ ?>
102
+ <section class="favorites-popup">
103
+ <div class="close">X</div>
104
+ <div class="popup__content">
105
+ <h5 id="favorite_popup_msg" class="text-center" style="margin-top: 25%;color: #000 !important;">Bookmark Success</h5>
106
+ </div>
107
+ </section>
108
+ <?php
109
+
110
+ }
111
+
112
+
113
+
114
+
115
+ }
tricyenough-favorites-posts/core/includes/classes/class-tricyenough-favorites-posts-run.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly.
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Class Tricyenough_Favorites_Posts_Run
8
+ *
9
+ * Thats where we bring the plugin to life
10
+ *
11
+ * @package TRICYENOUG
12
+ * @subpackage Classes/Tricyenough_Favorites_Posts_Run
13
+ * @author vishvajit kumar
14
+ * @since 1.0.0
15
+ */
16
+ class Tricyenough_Favorites_Posts_Run{
17
+
18
+ /**
19
+ * Our Tricyenough_Favorites_Posts_Run constructor
20
+ * to run the plugin logic.
21
+ *
22
+ * @since 1.0.0
23
+ */
24
+ function __construct(){
25
+ $this->add_hookss();
26
+ }
27
+
28
+ /**
29
+ * ######################
30
+ * ###
31
+ * #### WORDPRESS HOOKS
32
+ * ###
33
+ * ######################
34
+ */
35
+
36
+ /**
37
+ * Registers all WordPress and plugin related hooks
38
+ *
39
+ * @access private
40
+ * @since 1.0.0
41
+ * @return void
42
+ */
43
+ private function add_hookss(){
44
+
45
+ add_action( 'wp_enqueue_scripts', array( $this, 'favorite_enqueue_backend_scripts_and_styles' ), 21 );
46
+ add_action( 'plugins_loaded', array( $this, 'add_wp_webhooks_integrations' ), 9 );
47
+
48
+ }
49
+
50
+ /**
51
+ * ######################
52
+ * ###
53
+ * #### WORDPRESS HOOK CALLBACKS
54
+ * ###
55
+ * ######################
56
+ */
57
+
58
+ /**
59
+ * Enqueue the backend related scripts and styles for this plugin.
60
+ * All of the added scripts andstyles will be available on every page within the backend.
61
+ *
62
+ * @access public
63
+ * @since 1.0.0
64
+ *
65
+ * @return void
66
+ */
67
+ public function favorite_enqueue_backend_scripts_and_styles()
68
+ {
69
+ wp_enqueue_style( 'favorite-fontend-styles', TRICYENOUG_PLUGIN_URL . 'core/includes/assets/css/backend-styles.css', array(), TRICYENOUG_VERSION, 'all' );
70
+
71
+ wp_enqueue_script( 'favorite-backend-scripts', TRICYENOUG_PLUGIN_URL . 'core/includes/assets/js/favorite-scripts.js', array('jquery'), TRICYENOUG_VERSION, false );
72
+
73
+ wp_localize_script( 'favorite-backend-scripts', 'tricyenoug', array(
74
+ 'plugin_name' => __( TRICYENOUG_NAME, 'tricyenough-favorites-posts' ),
75
+ ));
76
+ wp_localize_script( 'favorite-backend-scripts', 'favorites_ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
77
+ }
78
+
79
+ /**
80
+ * ####################
81
+ * ### WP Webhooks
82
+ * ####################
83
+ */
84
+
85
+ /*
86
+ * Register dynamically all integrations
87
+ * The integrations are available within core/includes/integrations.
88
+ * A new folder is considered a new integration.
89
+ *
90
+ * @access public
91
+ * @since 1.0.0
92
+ *
93
+ * @return void
94
+ */
95
+ public function add_wp_webhooks_integrations(){
96
+
97
+ // Abort if WP Webhooks is not active
98
+ if( ! function_exists('WPWHPRO') ){
99
+ return;
100
+ }
101
+
102
+ $custom_integrations = array();
103
+ $folder = TRICYENOUG_PLUGIN_DIR . 'core' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'integrations';
104
+
105
+ try {
106
+ $custom_integrations = WPWHPRO()->helpers->get_folders( $folder );
107
+ } catch ( Exception $e ) {
108
+ WPWHPRO()->helpers->log_issue( $e->getTraceAsString() );
109
+ }
110
+
111
+ if( ! empty( $custom_integrations ) ){
112
+ foreach( $custom_integrations as $integration ){
113
+ $file_path = $folder . DIRECTORY_SEPARATOR . $integration . DIRECTORY_SEPARATOR . $integration . '.php';
114
+ WPWHPRO()->integrations->register_integration( array(
115
+ 'slug' => $integration,
116
+ 'path' => $file_path,
117
+ ) );
118
+ }
119
+ }
120
+ }
121
+
122
+ }
tricyenough-favorites-posts/core/includes/classes/class-tricyenough-favorites-posts-settings.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly.
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Class Tricyenough_Favorites_Posts_Settings
8
+ *
9
+ * This class contains all of the plugin settings.
10
+ * Here you can configure the whole plugin data.
11
+ *
12
+ * @package TRICYENOUG
13
+ * @subpackage Classes/Tricyenough_Favorites_Posts_Settings
14
+ * @author vishvajit kumar
15
+ * @since 1.0.0
16
+ */
17
+ class Tricyenough_Favorites_Posts_Settings{
18
+
19
+ /**
20
+ * The plugin name
21
+ *
22
+ * @var string
23
+ * @since 1.0.0
24
+ */
25
+ private $plugin_name;
26
+
27
+ /**
28
+ * Our Tricyenough_Favorites_Posts_Settings constructor
29
+ * to run the plugin logic.
30
+ *
31
+ * @since 1.0.0
32
+ */
33
+ function __construct(){
34
+
35
+ $this->plugin_name = TRICYENOUG_NAME;
36
+ }
37
+
38
+ /**
39
+ * ######################
40
+ * ###
41
+ * #### CALLABLE FUNCTIONS
42
+ * ###
43
+ * ######################
44
+ */
45
+
46
+ /**
47
+ * Return the plugin name
48
+ *
49
+ * @access public
50
+ * @since 1.0.0
51
+ * @return string The plugin name
52
+ */
53
+ public function get_plugin_name(){
54
+ return apply_filters( 'TRICYENOUG/settings/get_plugin_name', $this->plugin_name );
55
+ }
56
+ }
tricyenough-favorites-posts/core/includes/classes/class-tricyenough-favorites-posts-shortcode.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly.
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Class Tricyenough_Favorites_Posts_Run
8
+ *
9
+ * Thats where we bring the plugin to life
10
+ *
11
+ * @package TRICYENOUG
12
+ * @subpackage Classes/Tricyenough_Favorites_Posts_Run
13
+ * @author vishvajit kumar
14
+ * @since 1.0.0
15
+ */
16
+ class Tricyenough_Favorites_Posts_shortcode{
17
+
18
+ /**
19
+ * Our Tricyenough_Favorites_Posts_Run constructor
20
+ * to run the plugin logic.
21
+ *
22
+ * @since 1.0.0
23
+ */
24
+ function __construct(){
25
+ $this->add_hooks();
26
+
27
+ }
28
+ private function add_hooks()
29
+ {
30
+ add_shortcode( 'favourite-post-btn', array(&$this, 'get_favorites_add_link' ) );
31
+ add_shortcode( 'favourite-bookmark-list', array(&$this, 'get_bookmark_list' ) );
32
+ }
33
+ public function get_favorites_add_link($title = 'BookMark Game')
34
+ {
35
+ $helper = new Tricyenough_Favorites_Posts_Helpers();
36
+ $postid = get_the_ID();
37
+ $userid = get_current_user_id();
38
+ if ( is_user_logged_in() ) {
39
+ if ( !$helper->check_favorite_posts($postid,$userid) ) {
40
+ if ( is_user_logged_in() ) {
41
+ return '<form id="save_bookmark" style="display: inline;">
42
+ <input type="hidden" value="1" name="save_later" />
43
+ <input type="hidden" value="'.get_the_ID().'" name="post_id" class="fp_id" />
44
+ <input type="hidden" value="'.get_current_user_id().'" name="user_id" class="fp_user_id" />
45
+ <input type="hidden" name="action" value="savePost" id="form-action">
46
+ <button class="btn btn-dark" name="save">
47
+ <i id="bookmark_icon" class="fa fa-bookmark-o"></i></button>
48
+ </form>';
49
+ }
50
+ } else {
51
+ if ( get_post_type() == 'tools' ) {
52
+ echo $helper->get_favorites_remove_link('Remove');
53
+ } elseif ( get_post_type() == 'tools' ) {
54
+ echo $helper->get_favorites_remove_link('Remove bookmark');
55
+ } else {
56
+ echo $helper->get_favorites_remove_link('Remove bookmark');
57
+ }
58
+ }
59
+ } else {
60
+ return '<a href="" class="must_login">Read Later</a>';
61
+ }
62
+ }
63
+ public function get_bookmark_list()
64
+ {
65
+ $userid = get_current_user_id();
66
+ $db = new Tricyenough_Favorites_Posts_Database();
67
+ $tools=$db->get_favorite_posts($userid);
68
+ foreach ($tools as $tool) {
69
+ $feat_image = get_the_post_thumbnail_url($tool->post_id,'homepage-most-viewed');
70
+ echo "<div class='col-md-4 d-flex'>";
71
+ echo '<div class="card" style="width: 20rem;">
72
+ <img class="card-img-top" src="'.$feat_image.'" alt="'.get_the_title($tool->post_id).'">
73
+ <div class="card-body">
74
+ <a href="'.get_permalink($tool->post_id).'"><h5 class="card-title">'.get_the_title($tool->post_id).'</h5></a>
75
+ </div>
76
+ </div>';
77
+
78
+ echo "</div>";
79
+ }
80
+ }
81
+ }
tricyenough-favorites-posts/core/includes/classes/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/integrations/demo-integration/actions/demo_update_post.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ if ( ! class_exists( 'WP_Webhooks_Integrations_demo_integration_Actions_demo_update_post' ) ) :
7
+
8
+ /**
9
+ * Class WP_Webhooks_Integrations_demo_integration_Actions_demo_update_post
10
+ *
11
+ * This class contains the demo_update_post action related logic
12
+ *
13
+ * @package TRICYENOUG
14
+ * @subpackage Integrations/WP_Webhooks_Integrations_demo_integration_Actions_demo_update_post
15
+ * @author vishvajit kumar
16
+ * @since 1.0.0
17
+ */
18
+ class WP_Webhooks_Integrations_demo_integration_Actions_demo_update_post {
19
+
20
+ /**
21
+ * The details and configurations about
22
+ * this specific action
23
+ *
24
+ * @since 1.0.0
25
+ * @access public
26
+ *
27
+ * @return array The action configuration
28
+ */
29
+ public function get_details(){
30
+
31
+ $translation_ident = "action-demo_update_post-description";
32
+
33
+ $parameter = array(
34
+ 'post_id' => array(
35
+ 'required' => true,
36
+ 'label' => WPWHPRO()->helpers->translate( 'The post ID', $translation_ident ),
37
+ 'short_description' => WPWHPRO()->helpers->translate( '(integer) The ID of the post you would like to update.', $translation_ident ),
38
+ ),
39
+ 'post_title' => array(
40
+ 'label' => WPWHPRO()->helpers->translate( 'The new post title', $translation_ident ),
41
+ 'short_description' => WPWHPRO()->helpers->translate( '(string) Set the new title for the post.', $translation_ident ),
42
+ ),
43
+ );
44
+
45
+ $returns = array(
46
+ 'success' => array( 'short_description' => WPWHPRO()->helpers->translate( '(Bool) True if the action was successful, false if not. E.g. array( \'success\' => true )', $translation_ident ) ),
47
+ 'msg' => array( 'short_description' => WPWHPRO()->helpers->translate( '(string) A message with more information about the current request. E.g. array( \'msg\' => "This action was successful." )', $translation_ident ) ),
48
+ 'data' => array( 'short_description' => WPWHPRO()->helpers->translate( '(array) Further details about the sent data.', $translation_ident ) ),
49
+ );
50
+
51
+ $returns_code = array (
52
+ 'success' => true,
53
+ 'msg' => 'The post was successfully updated using the demo action.',
54
+ );
55
+
56
+ $description = WPWHPRO()->webhook->get_endpoint_description( 'action', array(
57
+ 'webhook_name' => 'Demo update post',
58
+ 'webhook_slug' => 'demo_update_post',
59
+ 'steps' => array(
60
+ WPWHPRO()->helpers->translate( 'It is also required to set the <strong>post_id</strong> argument. Please set it to the ID of the post you want to update the title for.', $translation_ident ),
61
+ ),
62
+ ) );
63
+
64
+ return array(
65
+ 'action' => 'demo_update_post',
66
+ 'name' => WPWHPRO()->helpers->translate( 'Demo update post', $translation_ident ),
67
+ 'sentence' => WPWHPRO()->helpers->translate( 'update a post using the demo action', $translation_ident ),
68
+ 'parameter' => $parameter,
69
+ 'returns' => $returns,
70
+ 'returns_code' => $returns_code,
71
+ 'short_description' => WPWHPRO()->helpers->translate( 'This is a demo action that allows you to update the post title of a post.', $translation_ident ),
72
+ 'description' => $description,
73
+ 'integration' => 'demo-integration',
74
+ 'premium' => false,
75
+ );
76
+
77
+ }
78
+
79
+ /**
80
+ * The function used to execute the action once data
81
+ * was sent to the webhook action URL
82
+ *
83
+ * @since 1.0.0
84
+ * @access public
85
+ *
86
+ * @param array $return_data The data returned to the webhook caller
87
+ * @param array $response_body The data about the current request
88
+ *
89
+ * @return array The response body
90
+ */
91
+ public function execute( $return_data, $response_body ){
92
+
93
+ $return_args = array(
94
+ 'success' => false,
95
+ 'msg' => '',
96
+ );
97
+
98
+ $post_id = intval( WPWHPRO()->helpers->validate_request_value( $response_body['content'], 'post_id' ) );
99
+ $post_title = WPWHPRO()->helpers->validate_request_value( $response_body['content'], 'post_title' );
100
+
101
+ if( empty( $post_id ) ){
102
+ $return_args['msg'] = WPWHPRO()->helpers->translate( "Please set the post_id argument.", 'action-demo_update_post-failure' );
103
+ return $return_args;
104
+ }
105
+
106
+ $args = array(
107
+ 'ID' => $post_id,
108
+ 'post_title' => $post_title,
109
+ );
110
+
111
+ $check = wp_update_post( $args );
112
+
113
+ if( ! empty( $check ) && ! is_wp_error( $check ) ){
114
+ $return_args['msg'] = WPWHPRO()->helpers->translate( "The post was successfully updated using the demo action.", 'action-demo_update_post-success' );
115
+ $return_args['success'] = true;
116
+ } else {
117
+ $return_args['msg'] = WPWHPRO()->helpers->translate( "An error occured while updating the post using the demo request.", 'action-demo_update_post-success' );
118
+ }
119
+
120
+ return $return_args;
121
+
122
+ }
123
+
124
+ }
125
+
126
+ endif; // End if class_exists check.
tricyenough-favorites-posts/core/includes/integrations/demo-integration/actions/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/integrations/demo-integration/assets/img/icon-wp-webhooks.svg ADDED
tricyenough-favorites-posts/core/includes/integrations/demo-integration/assets/img/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/integrations/demo-integration/assets/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/integrations/demo-integration/demo-integration.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Class WP_Webhooks_Integrations_demo_integration
8
+ *
9
+ * This class contains the main definition of the demo
10
+ * integration for WP Webhooks
11
+ *
12
+ * @package TRICYENOUG
13
+ * @subpackage Integrations/WP_Webhooks_Integrations_demo_integration
14
+ * @author vishvajit kumar
15
+ * @since 1.0.0
16
+ */
17
+ class WP_Webhooks_Integrations_demo_integration {
18
+
19
+ /**
20
+ * Customize the availability of the integration.
21
+ * By default, we always load it.
22
+ *
23
+ * @access public
24
+ *
25
+ * @return boolean
26
+ */
27
+ public function is_active(){
28
+ return true;
29
+ }
30
+
31
+ /**
32
+ * The details of the custom integration
33
+ *
34
+ * @since 1.0.0
35
+ * @access public
36
+ *
37
+ * @return array The integration details
38
+ */
39
+ public function get_details(){
40
+ $integration_url = plugin_dir_url( __FILE__ );
41
+
42
+ return array(
43
+ 'name' => 'Demo Integration',
44
+ 'icon' => $integration_url . '/assets/img/icon-wp-webhooks.svg',
45
+ );
46
+ }
47
+
48
+ }
tricyenough-favorites-posts/core/includes/integrations/demo-integration/helpers/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/integrations/demo-integration/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/integrations/demo-integration/triggers/demo_request_received.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if ( ! class_exists( 'WP_Webhooks_Integrations_demo_integration_Triggers_demo_request_received' ) ) :
6
+
7
+ /**
8
+ * Class WP_Webhooks_Integrations_demo_integration_Triggers_demo_request_received
9
+ *
10
+ * This class contains the demo_request_received trigger related logic
11
+ *
12
+ * @package TRICYENOUG
13
+ * @subpackage Integrations/WP_Webhooks_Integrations_demo_integration_Triggers_demo_request_received
14
+ * @author vishvajit kumar
15
+ * @since 1.0.0
16
+ */
17
+ class WP_Webhooks_Integrations_demo_integration_Triggers_demo_request_received {
18
+
19
+ /**
20
+ * The details and configurations about
21
+ * this specific trigger
22
+ *
23
+ * @since 1.0.0
24
+ * @access public
25
+ *
26
+ * @return array The trigger configuration
27
+ */
28
+ public function get_details(){
29
+
30
+ $translation_ident = "trigger-demo_request_received-description";
31
+
32
+ $parameter = array(
33
+ 'custom_construct' => array( 'short_description' => WPWHPRO()->helpers->translate( '(Mixed) The data that was sent along with the HTTP call that was made to the receivable URL.', $translation_ident ) ),
34
+ );
35
+
36
+ $description = WPWHPRO()->webhook->get_endpoint_description( 'trigger', array(
37
+ 'webhook_name' => 'Demo HTTP request received',
38
+ 'webhook_slug' => 'demo_request_received',
39
+ 'post_delay' => false,
40
+ 'steps' => array(
41
+ WPWHPRO()->helpers->translate( 'Add a URL to this trigger on which you want to receive the data.', $translation_ident ),
42
+ WPWHPRO()->helpers->translate( 'Go into the settings for your added URL and copy the receivable URL (The dynamically created URL).', $translation_ident ),
43
+ WPWHPRO()->helpers->translate( 'Place the receivable URL into the service of your choice and start sending data.', $translation_ident ),
44
+ ),
45
+ 'tipps' => array(
46
+ WPWHPRO()->helpers->translate( 'To receive this data on the receivable URL, please send it from an external URL to the dynamically created URL.', $translation_ident ),
47
+ WPWHPRO()->helpers->translate( 'The receivable URL accepts content types such as JSON, form data, or XML.', $translation_ident ),
48
+ )
49
+ ) );
50
+
51
+ $settings = array(
52
+ 'load_default_settings' => false,
53
+ 'data' => array(
54
+ 'wpwhpro_demo_return_full_request' => array(
55
+ 'id' => 'wpwhpro_demo_return_full_request',
56
+ 'type' => 'checkbox',
57
+ 'label' => WPWHPRO()->helpers->translate( 'Send full request', $translation_ident ),
58
+ 'placeholder' => '',
59
+ 'required' => false,
60
+ 'description' => WPWHPRO()->helpers->translate( 'Send the full, validated request instead of the payload (body) data only. This gives you access to header, cookies, response type and much more.', $translation_ident )
61
+ ),
62
+ )
63
+ );
64
+
65
+ return array(
66
+ 'trigger' => 'demo_request_received',
67
+ 'name' => WPWHPRO()->helpers->translate( 'Demo HTTP request received', $translation_ident ),
68
+ 'sentence' => WPWHPRO()->helpers->translate( 'a demo HTTP request was received', $translation_ident ),
69
+ 'parameter' => $parameter,
70
+ 'settings' => $settings,
71
+ 'returns_code' => $this->get_demo( array() ),
72
+ 'short_description' => WPWHPRO()->helpers->translate( 'This webhook fires as soon as a HTTP request was received from an external URL.', $translation_ident ),
73
+ 'description' => $description,
74
+ 'integration' => 'demo-integration', //the folder name of the integration
75
+ 'receivable_url' => true, //turn the trigger into a receivable trigger
76
+ 'premium' => false,
77
+ );
78
+
79
+ }
80
+
81
+ /**
82
+ * The function used to execute the trigger once data
83
+ * was sent to the dynamically created, receivable URL
84
+ *
85
+ * @since 1.0.0
86
+ * @access public
87
+ *
88
+ * @param array $return_data The data returned to the webhook caller
89
+ * @param array $response_body The data about the current request
90
+ * @param string $trigger_url_name The name of the current trigger URL
91
+ *
92
+ * @return array The response body
93
+ */
94
+ public function execute( $return_data, $response_body, $trigger_url_name ){
95
+
96
+ $translation_ident = "trigger-demo_request_received-description";
97
+
98
+ if( $trigger_url_name !== null ){
99
+ $webhooks = WPWHPRO()->webhook->get_hooks( 'trigger', 'demo_request_received', $trigger_url_name );
100
+ if( ! empty( $webhooks ) ){
101
+ $webhooks = array( $webhooks );
102
+ } else {
103
+ $return_data['msg'] = WPWHPRO()->helpers->translate( 'We could not locate a callable trigger URL.', $translation_ident );
104
+ return $return_data;
105
+ }
106
+ } else {
107
+ $webhooks = WPWHPRO()->webhook->get_hooks( 'trigger', 'demo_request_received' );
108
+ }
109
+
110
+
111
+ $payload = $response_body['content'];
112
+
113
+ $response_data_array = array();
114
+
115
+ foreach( $webhooks as $webhook ){
116
+
117
+ $webhook_url_name = ( is_array($webhook) && isset( $webhook['webhook_url_name'] ) ) ? $webhook['webhook_url_name'] : null;
118
+ $is_valid = true;
119
+
120
+ if( isset( $webhook['settings'] ) ){
121
+ foreach( $webhook['settings'] as $settings_name => $settings_data ){
122
+
123
+ if( $settings_name === 'wpwhpro_demo_return_full_request' && ! empty( $settings_data ) ){
124
+ $payload = $response_body;
125
+ }
126
+
127
+ }
128
+ }
129
+
130
+ if( $is_valid ){
131
+
132
+ $webhook_response = WPWHPRO()->webhook->post_to_webhook( $webhook, $payload, array( 'blocking' => true ) );
133
+
134
+ if( $webhook_url_name !== null ){
135
+ $response_data_array[ $webhook_url_name ] = $webhook_response;
136
+ } else {
137
+ $response_data_array[] = $webhook_response;
138
+ }
139
+ }
140
+
141
+ }
142
+
143
+ $return_data['success'] = true;
144
+ $return_data['data'] = ( count( $response_data_array ) > 1 ) ? $response_data_array : reset( $response_data_array );
145
+
146
+ do_action( 'wpwhpro/webhooks/trigger_demo_request_received', $return_data, $response_body, $trigger_url_name, $response_data_array );
147
+
148
+ return $return_data;
149
+ }
150
+
151
+ /**
152
+ * The demo data that is assigned to the trigger.
153
+ * This will be used to send a static demo request.
154
+ *
155
+ * @since 1.0.0
156
+ * @access public
157
+ *
158
+ * @return array The demo data
159
+ */
160
+ public function get_demo( $options = array() ) {
161
+
162
+ $data = array (
163
+ 'custom_construct' => 'The data that was sent to the receivable data URL. Or the full request array.',
164
+ );
165
+
166
+ return $data;
167
+ }
168
+
169
+ }
170
+
171
+ endif; // End if class_exists check.
tricyenough-favorites-posts/core/includes/integrations/demo-integration/triggers/demo_update_user.php ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ if ( ! class_exists( 'WP_Webhooks_Integrations_demo_integration_Triggers_demo_update_user' ) ) :
7
+
8
+ /**
9
+ * Class WP_Webhooks_Integrations_demo_integration_Triggers_demo_update_user
10
+ *
11
+ * This class contains the demo_update_user trigger related logic
12
+ *
13
+ * @package TRICYENOUG
14
+ * @subpackage Integrations/WP_Webhooks_Integrations_demo_integration_Triggers_demo_update_user
15
+ * @author vishvajit kumar
16
+ * @since 1.0.0
17
+ */
18
+ class WP_Webhooks_Integrations_demo_integration_Triggers_demo_update_user {
19
+
20
+ /**
21
+ * Register the callbacks that are used to
22
+ * fire the webhook trigger
23
+ *
24
+ * @since 1.0.0
25
+ * @access public
26
+ *
27
+ * @return array The event callbacks
28
+ */
29
+ public function get_callbacks(){
30
+
31
+ return array(
32
+ array(
33
+ 'type' => 'action',
34
+ 'hook' => 'profile_update',
35
+ 'callback' => array( $this, 'wpwh_trigger_user_update' ),
36
+ 'priority' => 10,
37
+ 'arguments' => 2,
38
+ 'delayed' => true,
39
+ ),
40
+ );
41
+
42
+ }
43
+
44
+ /**
45
+ * The details and configurations about
46
+ * this specific trigger
47
+ *
48
+ * @since 1.0.0
49
+ * @access public
50
+ *
51
+ * @return array The trigger configuration
52
+ */
53
+ public function get_details(){
54
+
55
+ $translation_ident = "trigger-update-user-description";
56
+
57
+ $parameter = array(
58
+ 'user_object' => array( 'short_description' => WPWHPRO()->helpers->translate( 'The request will send the full user object as an array. Please see https://codex.wordpress.org/Class_Reference/WP_User for more details.', $translation_ident ) ),
59
+ 'user_meta' => array( 'short_description' => WPWHPRO()->helpers->translate( 'The user meta is also pushed to the user object. You will find it on the first layer of the object as well. ', $translation_ident ) ),
60
+ 'user_old_data' => array( 'short_description' => WPWHPRO()->helpers->translate( 'This is the object with the previous user object as an array. You can recheck your data on it as well.', $translation_ident ) ),
61
+ );
62
+
63
+ $description = WPWHPRO()->webhook->get_endpoint_description( 'trigger', array(
64
+ 'webhook_name' => 'Demo user updated',
65
+ 'webhook_slug' => 'demo_update_user',
66
+ 'post_delay' => true,
67
+ 'trigger_hooks' => array(
68
+ array(
69
+ 'hook' => 'profile_update',
70
+ 'url' => 'https://developer.wordpress.org/reference/hooks/profile_update/',
71
+ ),
72
+ )
73
+ ) );
74
+
75
+ return array(
76
+ 'trigger' => 'demo_update_user',
77
+ 'name' => WPWHPRO()->helpers->translate( 'Demo user updated', $translation_ident ),
78
+ 'sentence' => WPWHPRO()->helpers->translate( 'a user was updated', $translation_ident ),
79
+ 'parameter' => $parameter,
80
+ 'returns_code' => $this->get_demo( array() ),
81
+ 'short_description' => WPWHPRO()->helpers->translate( 'This webhook is a demo webhook and fires as soon as a user updates his profile.', $translation_ident ),
82
+ 'description' => $description,
83
+ 'callback' => 'test_user_update',
84
+ 'integration' => 'demo-integration', //the folder name of the integration
85
+ 'premium' => false,
86
+ );
87
+
88
+ }
89
+
90
+ /**
91
+ * The callback used to fire the webhook trigger.
92
+ *
93
+ * @since 1.0.0
94
+ * @access public
95
+ *
96
+ * @return array The trigger configuration
97
+ */
98
+ public function wpwh_trigger_user_update( $user_id, $old_data ){
99
+ $webhooks = WPWHPRO()->webhook->get_hooks( 'trigger', 'demo_update_user' );
100
+ $user_data = (array) get_user_by( 'id', $user_id );
101
+
102
+ $user_data['user_meta'] = get_user_meta( $user_id );
103
+ $user_data['user_old_data'] = $old_data;
104
+ $response_data = array();
105
+
106
+ foreach( $webhooks as $webhook ){
107
+
108
+ $webhook_url_name = ( is_array($webhook) && isset( $webhook['webhook_url_name'] ) ) ? $webhook['webhook_url_name'] : null;
109
+
110
+ if( $webhook_url_name !== null ){
111
+ $response_data[ $webhook_url_name ] = WPWHPRO()->webhook->post_to_webhook( $webhook, $user_data );
112
+ } else {
113
+ $response_data[] = WPWHPRO()->webhook->post_to_webhook( $webhook, $user_data );
114
+ }
115
+
116
+ }
117
+
118
+ do_action( 'wpwhpro/webhooks/demo_trigger_user_update', $user_id, $user_data, $response_data );
119
+ }
120
+
121
+ /**
122
+ * The demo data that is assigned to the trigger.
123
+ * This will be used to send a static demo request.
124
+ *
125
+ * @since 1.0.0
126
+ * @access public
127
+ *
128
+ * @return array The demo data
129
+ */
130
+ public function get_demo( $options = array() ){
131
+
132
+ $data = array (
133
+ 'data' =>
134
+ array (
135
+ 'ID' => '1',
136
+ 'user_login' => 'admin',
137
+ 'user_pass' => '$P$BVbptZxEcZV2yeLyYeN.O4ZeG8225d.',
138
+ 'user_nicename' => 'admin',
139
+ 'user_email' => 'admin@wp-webhooks.test',
140
+ 'user_url' => '',
141
+ 'user_registered' => '2018-11-06 14:19:18',
142
+ 'user_activation_key' => '',
143
+ 'user_status' => '0',
144
+ 'display_name' => 'admin',
145
+ ),
146
+ 'ID' => 1,
147
+ 'caps' =>
148
+ array (
149
+ 'administrator' => true,
150
+ ),
151
+ 'cap_key' => 'wp_capabilities',
152
+ 'roles' =>
153
+ array (
154
+ 0 => 'administrator',
155
+ ),
156
+ 'allcaps' =>
157
+ array (
158
+ 'switch_themes' => true,
159
+ 'edit_themes' => true,
160
+ 'activate_plugins' => true,
161
+ 'edit_plugins' => true,
162
+ 'edit_users' => true,
163
+ 'edit_files' => true,
164
+ 'manage_options' => true,
165
+ 'moderate_comments' => true,
166
+ 'manage_categories' => true,
167
+ 'manage_links' => true,
168
+ 'upload_files' => true,
169
+ 'import' => true,
170
+ 'unfiltered_html' => true,
171
+ 'edit_posts' => true,
172
+ 'edit_others_posts' => true,
173
+ 'edit_published_posts' => true,
174
+ 'publish_posts' => true,
175
+ 'edit_pages' => true,
176
+ 'read' => true,
177
+ 'level_10' => true,
178
+ 'level_9' => true,
179
+ 'level_8' => true,
180
+ 'level_7' => true,
181
+ 'level_6' => true,
182
+ 'level_5' => true,
183
+ 'level_4' => true,
184
+ 'level_3' => true,
185
+ 'level_2' => true,
186
+ 'level_1' => true,
187
+ 'level_0' => true,
188
+ 'edit_others_pages' => true,
189
+ 'edit_published_pages' => true,
190
+ 'publish_pages' => true,
191
+ 'delete_pages' => true,
192
+ 'delete_others_pages' => true,
193
+ 'delete_published_pages' => true,
194
+ 'delete_posts' => true,
195
+ 'delete_others_posts' => true,
196
+ 'delete_published_posts' => true,
197
+ 'delete_private_posts' => true,
198
+ 'edit_private_posts' => true,
199
+ 'read_private_posts' => true,
200
+ 'delete_private_pages' => true,
201
+ 'edit_private_pages' => true,
202
+ 'read_private_pages' => true,
203
+ 'delete_users' => true,
204
+ 'create_users' => true,
205
+ 'unfiltered_upload' => true,
206
+ 'edit_dashboard' => true,
207
+ 'update_plugins' => true,
208
+ 'delete_plugins' => true,
209
+ 'install_plugins' => true,
210
+ 'update_themes' => true,
211
+ 'install_themes' => true,
212
+ 'update_core' => true,
213
+ 'list_users' => true,
214
+ 'remove_users' => true,
215
+ 'promote_users' => true,
216
+ 'edit_theme_options' => true,
217
+ 'delete_themes' => true,
218
+ 'export' => true,
219
+ 'administrator' => true,
220
+ ),
221
+ 'filter' => NULL,
222
+ 'user_meta' => array (
223
+ 'nickname' =>
224
+ array (
225
+ 0 => 'admin',
226
+ ),
227
+ 'first_name' =>
228
+ array (
229
+ 0 => 'Jon',
230
+ ),
231
+ 'last_name' =>
232
+ array (
233
+ 0 => 'Doe',
234
+ ),
235
+ 'description' =>
236
+ array (
237
+ 0 => 'My descriptio ',
238
+ ),
239
+ 'rich_editing' =>
240
+ array (
241
+ 0 => 'true',
242
+ ),
243
+ 'syntax_highlighting' =>
244
+ array (
245
+ 0 => 'true',
246
+ ),
247
+ 'comment_shortcuts' =>
248
+ array (
249
+ 0 => 'false',
250
+ ),
251
+ 'admin_color' =>
252
+ array (
253
+ 0 => 'fresh',
254
+ ),
255
+ 'use_ssl' =>
256
+ array (
257
+ 0 => '0',
258
+ ),
259
+ 'show_admin_bar_front' =>
260
+ array (
261
+ 0 => 'true',
262
+ ),
263
+ 'locale' =>
264
+ array (
265
+ 0 => '',
266
+ ),
267
+ 'wp_capabilities' =>
268
+ array (
269
+ 0 => 'a:1:{s:13:"administrator";b:1;}',
270
+ ),
271
+ 'wp_user_level' =>
272
+ array (
273
+ 0 => '10',
274
+ ),
275
+ 'dismissed_wp_pointers' =>
276
+ array (
277
+ 0 => 'wp111_privacy',
278
+ ),
279
+ 'show_welcome_panel' =>
280
+ array (
281
+ 0 => '1',
282
+ ),
283
+ 'session_tokens' =>
284
+ array (
285
+ 0 => 'a:1:{}',
286
+ ),
287
+ 'wp_dashboard_quick_press_last_post_id' =>
288
+ array (
289
+ 0 => '4',
290
+ ),
291
+ 'community-events-location' =>
292
+ array (
293
+ 0 => 'a:1:{s:2:"ip";s:9:"127.0.0.0";}',
294
+ ),
295
+ 'show_try_gutenberg_panel' =>
296
+ array (
297
+ 0 => '0',
298
+ ),
299
+ )
300
+ );
301
+
302
+ $data['user_old_data'] = array();
303
+
304
+ return $data;
305
+ }
306
+
307
+ }
308
+
309
+ endif; // End if class_exists check.
tricyenough-favorites-posts/core/includes/integrations/demo-integration/triggers/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/includes/integrations/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/core/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/languages/index.php ADDED
@@ -0,0 +1 @@
 
 
1
+ <?php //Silence is golden
tricyenough-favorites-posts/license.txt ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
6
+
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ Preamble
11
+
12
+ The licenses for most software are designed to take away your
13
+ freedom to share and change it. By contrast, the GNU General Public
14
+ License is intended to guarantee your freedom to share and change free
15
+ software--to make sure the software is free for all its users. This
16
+ General Public License applies to most of the Free Software
17
+ Foundation's software and to any other program whose authors commit to
18
+ using it. (Some other Free Software Foundation software is covered by
19
+ the GNU Library General Public License instead.) You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ this service if you wish), that you receive source code or can get it
26
+ if you want it, that you can change the software or use pieces of it
27
+ in new free programs; and that you know you can do these things.
28
+
29
+ To protect your rights, we need to make restrictions that forbid
30
+ anyone to deny you these rights or to ask you to surrender the rights.
31
+ These restrictions translate to certain responsibilities for you if you
32
+ distribute copies of the software, or if you modify it.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must give the recipients all the rights that
36
+ you have. You must make sure that they, too, receive or can get the
37
+ source code. And you must show them these terms so they know their
38
+ rights.
39
+
40
+ We protect your rights with two steps: (1) copyright the software, and
41
+ (2) offer you this license which gives you legal permission to copy,
42
+ distribute and/or modify the software.
43
+
44
+ Also, for each author's protection and ours, we want to make certain
45
+ that everyone understands that there is no warranty for this free
46
+ software. If the software is modified by someone else and passed on, we
47
+ want its recipients to know that what they have is not the original, so
48
+ that any problems introduced by others will not reflect on the original
49
+ authors' reputations.
50
+
51
+ Finally, any free program is threatened constantly by software
52
+ patents. We wish to avoid the danger that redistributors of a free
53
+ program will individually obtain patent licenses, in effect making the
54
+ program proprietary. To prevent this, we have made it clear that any
55
+ patent must be licensed for everyone's free use or not licensed at all.
56
+
57
+ The precise terms and conditions for copying, distribution and
58
+ modification follow.
59
+
60
+ GNU GENERAL PUBLIC LICENSE
61
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
62
+
63
+ 0. This License applies to any program or other work which contains
64
+ a notice placed by the copyright holder saying it may be distributed
65
+ under the terms of this General Public License. The "Program", below,
66
+ refers to any such program or work, and a "work based on the Program"
67
+ means either the Program or any derivative work under copyright law:
68
+ that is to say, a work containing the Program or a portion of it,
69
+ either verbatim or with modifications and/or translated into another
70
+ language. (Hereinafter, translation is included without limitation in
71
+ the term "modification".) Each licensee is addressed as "you".
72
+
73
+ Activities other than copying, distribution and modification are not
74
+ covered by this License; they are outside its scope. The act of
75
+ running the Program is not restricted, and the output from the Program
76
+ is covered only if its contents constitute a work based on the
77
+ Program (independent of having been made by running the Program).
78
+ Whether that is true depends on what the Program does.
79
+
80
+ 1. You may copy and distribute verbatim copies of the Program's
81
+ source code as you receive it, in any medium, provided that you
82
+ conspicuously and appropriately publish on each copy an appropriate
83
+ copyright notice and disclaimer of warranty; keep intact all the
84
+ notices that refer to this License and to the absence of any warranty;
85
+ and give any other recipients of the Program a copy of this License
86
+ along with the Program.
87
+
88
+ You may charge a fee for the physical act of transferring a copy, and
89
+ you may at your option offer warranty protection in exchange for a fee.
90
+
91
+ 2. You may modify your copy or copies of the Program or any portion
92
+ of it, thus forming a work based on the Program, and copy and
93
+ distribute such modifications or work under the terms of Section 1
94
+ above, provided that you also meet all of these conditions:
95
+
96
+ a) You must cause the modified files to carry prominent notices
97
+ stating that you changed the files and the date of any change.
98
+
99
+ b) You must cause any work that you distribute or publish, that in
100
+ whole or in part contains or is derived from the Program or any
101
+ part thereof, to be licensed as a whole at no charge to all third
102
+ parties under the terms of this License.
103
+
104
+ c) If the modified program normally reads commands interactively
105
+ when run, you must cause it, when started running for such
106
+ interactive use in the most ordinary way, to print or display an
107
+ announcement including an appropriate copyright notice and a
108
+ notice that there is no warranty (or else, saying that you provide
109
+ a warranty) and that users may redistribute the program under
110
+ these conditions, and telling the user how to view a copy of this
111
+ License. (Exception: if the Program itself is interactive but
112
+ does not normally print such an announcement, your work based on
113
+ the Program is not required to print an announcement.)
114
+
115
+ These requirements apply to the modified work as a whole. If
116
+ identifiable sections of that work are not derived from the Program,
117
+ and can be reasonably considered independent and separate works in
118
+ themselves, then this License, and its terms, do not apply to those
119
+ sections when you distribute them as separate works. But when you
120
+ distribute the same sections as part of a whole which is a work based
121
+ on the Program, the distribution of the whole must be on the terms of
122
+ this License, whose permissions for other licensees extend to the
123
+ entire whole, and thus to each and every part regardless of who wrote it.
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
tricyenough-favorites-posts/readme.txt ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Tricyenough Favorites Posts ===
2
+ Author URI: https://www.trickyenough.com/
3
+ Plugin URI: https://www.trickyenough.com/
4
+ Donate link:
5
+ Contributors:
6
+ Tags:
7
+ Requires at least:
8
+ Tested up to:
9
+ Requires PHP:
10
+ Stable tag: 1.0.0
11
+ License: GPLv2
12
+ License URI: https://www.gnu.org/licenses/gpl-2.0.html
13
+
14
+ Tricyenough Favorites Posts
15
+
16
+ == Description ==
17
+
18
+ This is the long description. No limit, and you can use Markdown (as well as in the following sections).
19
+
20
+ For backwards compatibility, if this section is missing, the full length of the short description will be used, and
21
+ Markdown parsed.
22
+
23
+ A few notes about the sections above:
24
+
25
+ * "Contributors" is a comma separated list of wordpress.org usernames
26
+ * "Tags" is a comma separated list of tags that apply to the plugin
27
+ * "Requires at least" is the lowest version that the plugin will work on
28
+ * "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on
29
+ higher versions... this is just the highest one you've verified.
30
+ * Stable tag should indicate the Subversion "tag" of the latest stable version, or "trunk," if you use `/trunk/` for
31
+ stable.
32
+
33
+ Note that the `readme.txt` of the stable tag is the one that is considered the defining one for the plugin, so
34
+ if the `/trunk/readme.txt` file says that the stable tag is `4.3`, then it is `/tags/4.3/readme.txt` that'll be used
35
+ for displaying information about the plugin. In this situation, the only thing considered from the trunk `readme.txt`
36
+ is the stable tag pointer. Thus, if you develop in trunk, you can update the trunk `readme.txt` to reflect changes in
37
+ your in-development version, without having that information incorrectly disclosed about the current stable version
38
+ that lacks those changes -- as long as the trunk's `readme.txt` points to the correct stable tag.
39
+
40
+ If no stable tag is provided, it is assumed that trunk is stable, but you should specify "trunk" if that's where
41
+ you put the stable version, in order to eliminate any doubt.
42
+
43
+
44
+ == Frequently Asked Questions ==
45
+
46
+ = A question that someone might have =
47
+
48
+ An answer to that question.
49
+
50
+
51
+ == Installation ==
52
+
53
+ 1. Go to `Plugins` in the Admin menu
54
+ 2. Click on the button `Add new`
55
+ 3. Search for `Tricyenough Favorites Posts` and click 'Install Now' or click on the `upload` link to upload `tricyenough-favorites-posts.zip`
56
+ 4. Click on `Activate plugin`
57
+
58
+ == Changelog ==
59
+
60
+ = 1.0.0: March 14, 2023 =
61
+ * Birthday of Tricyenough Favorites Posts
tricyenough-favorites-posts/tricyenough-favorites-posts.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tricyenough Favorites Posts
4
+ *
5
+ * @package TRICYENOUG
6
+ * @author vishvajit kumar
7
+ * @license gplv2
8
+ * @version 1.0.0
9
+ *
10
+ * @wordpress-plugin
11
+ * Plugin Name: Tricyenough Favorites Posts
12
+ * Plugin URI: https://www.trickyenough.com/
13
+ * Description: Tricyenough Favorites Posts
14
+ * Version: 1.0.0
15
+ * Author: vishvajit kumar
16
+ * Author URI: https://www.trickyenough.com/
17
+ * Text Domain: tricyenough-favorites-posts
18
+ * Domain Path: /languages
19
+ * License: GPLv2
20
+ * License URI: https://www.gnu.org/licenses/gpl-2.0.html
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with Tricyenough Favorites Posts. If not, see <https://www.gnu.org/licenses/gpl-2.0.html/>.
24
+ */
25
+
26
+ // Exit if accessed directly.
27
+ if ( ! defined( 'ABSPATH' ) ) exit;
28
+ // Plugin name
29
+ define( 'TRICYENOUG_NAME', 'Tricyenough Favorites Posts' );
30
+
31
+ // Plugin version
32
+ define( 'TRICYENOUG_VERSION', '1.0.0' );
33
+
34
+ // Plugin Root File
35
+ define( 'TRICYENOUG_PLUGIN_FILE', __FILE__ );
36
+
37
+ // Plugin base
38
+ define( 'TRICYENOUG_PLUGIN_BASE', plugin_basename( TRICYENOUG_PLUGIN_FILE ) );
39
+
40
+ // Plugin Folder Path
41
+ define( 'TRICYENOUG_PLUGIN_DIR', plugin_dir_path( TRICYENOUG_PLUGIN_FILE ) );
42
+
43
+ // Plugin Folder URL
44
+ define( 'TRICYENOUG_PLUGIN_URL', plugin_dir_url( TRICYENOUG_PLUGIN_FILE ) );
45
+
46
+ /**
47
+ * Load the main class for the core functionality
48
+ */
49
+ require_once TRICYENOUG_PLUGIN_DIR . 'core/class-tricyenough-favorites-posts.php';
50
+
51
+ /**
52
+ * The main function to load the only instance
53
+ * of our master class.
54
+ *
55
+ * @author vishvajit kumar
56
+ * @since 1.0.0
57
+ * @return object|Tricyenough_Favorites_Posts
58
+ */
59
+ function TRICYENOUG() {
60
+ return Tricyenough_Favorites_Posts::instance();
61
+ }
62
+
63
+ TRICYENOUG();