| @@ -1,107 +1,117 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Plugin Name: Taskbuilder | |
| 4 | - * Plugin URI: https://wordpress.org/plugins/taskbuilder/ | |
| 5 | - * Description: Wordpress Project & Task Management plugin. Easy to keep track of projects & tasks! | |
| 6 | - * Version: 1.0.3 | |
| 7 | - * Author: Taskbuilder Team | |
| 8 | - * Author URI: https://taskbuilder.net/ | |
| 9 | - * Requires at least: 4.4 | |
| 10 | - * Tested up to: 5.9.1 | |
| 11 | - * Text Domain: taskbuilder | |
| 12 | - * Domain Path: /lang | |
| 13 | - */ | |
| 14 | - | |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 16 | - exit; // Exit if accessed directly | |
| 17 | -} | |
| 18 | - | |
| 19 | -if ( ! class_exists( 'WP_Taskbuilder' ) ) : | |
| 20 | - | |
| 21 | - final class WP_Taskbuilder { | |
| 22 | - public $version = '1.0.3'; | |
| 23 | - public function __construct() { | |
| 24 | - // define global constants | |
| 25 | - $this->define_constants(); | |
| 26 | - // Include required files and classes | |
| 27 | - $this->includes(); | |
| 28 | - add_action( 'init', array($this,'load_textdomain') ); | |
| 29 | - add_action( 'init', array( $this, 'wppm_check_download_file') ); | |
| 30 | - register_deactivation_hook( __FILE__, array($this,'deactivate') ); | |
| 31 | - } | |
| 32 | - | |
| 33 | - function define_constants() { | |
| 34 | - $this->define('WPPM_STORE_URL', 'https://taskbuilder.net/'); | |
| 35 | - $this->define('WPPM_PLUGIN_FILE', __FILE__); | |
| 36 | - $this->define('WPPM_ABSPATH', dirname(__FILE__) . '/'); | |
| 37 | - $this->define('WPPM_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); | |
| 38 | - $this->define('WPPM_PLUGIN_BASENAME', plugin_basename(__FILE__)); | |
| 39 | - $this->define('WPPM_VERSION', $this->version); | |
| 40 | - } | |
| 41 | - | |
| 42 | - function load_textdomain(){ | |
| 43 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'taskbuilder' ); | |
| 44 | - load_textdomain( 'taskbuilder', WP_LANG_DIR . '/taskbuilder/taskbuilder-' . $locale . '.mo' ); | |
| 45 | - load_plugin_textdomain( 'taskbuilder', false, plugin_basename( dirname( __FILE__ ) ) . '/lang' ); | |
| 46 | - } | |
| 47 | - | |
| 48 | - public function includes() { | |
| 49 | - include_once( WPPM_ABSPATH . 'includes/wppm-install.php' ); | |
| 50 | - include_once( WPPM_ABSPATH . 'includes/class-wppm-functions.php' ); | |
| 51 | - include( WPPM_ABSPATH.'includes/wppm_cron.php' ); | |
| 52 | - include_once( WPPM_ABSPATH . 'includes/wppm_actions.php' ); | |
| 53 | - if ($this->is_request('admin')) { | |
| 54 | - include_once( WPPM_ABSPATH . 'includes/class-wppm-admin.php' ); | |
| 55 | - } | |
| 56 | - if ($this->is_request('frontend')) { | |
| 57 | - include_once( WPPM_ABSPATH . 'includes/class-wppm-frontend.php' ); | |
| 58 | - } | |
| 59 | - if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) { | |
| 60 | - include_once( WPPM_ABSPATH . 'includes/EDD_SL_Plugin_Updater.php' ); | |
| 61 | - } | |
| 62 | - | |
| 63 | - } | |
| 64 | - | |
| 65 | - public function define($name, $value) { | |
| 66 | - if (!defined($name)) { | |
| 67 | - define($name, $value); | |
| 68 | - } | |
| 69 | - } | |
| 70 | - | |
| 71 | - public function is_request($type) { | |
| 72 | - switch ($type) { | |
| 73 | - case 'admin' : | |
| 74 | - return is_admin(); | |
| 75 | - case 'frontend' : | |
| 76 | - return (!is_admin() || defined('DOING_AJAX') ) && !defined('DOING_CRON'); | |
| 77 | - } | |
| 78 | - } | |
| 79 | - | |
| 80 | - public function wppm_check_download_file(){ | |
| 81 | - global $wpdb,$wppmfunction; | |
| 82 | - if( isset($_REQUEST['wppm_attachment']) && isset($_REQUEST['tid']) && isset($_REQUEST['tac'])){ | |
| 83 | - $attach_id = intval(sanitize_text_field($_REQUEST['wppm_attachment'])); | |
| 84 | - $auth_code = (sanitize_text_field($_REQUEST['tac'])); | |
| 85 | - $task_id = intval(sanitize_text_field($_REQUEST['tid'])); | |
| 86 | - $task_auth_code = $wppmfunction->get_task_fields($task_id,'task_auth_code'); | |
| 87 | - $task_auth_code = sanitize_text_field($task_auth_code); | |
| 88 | - if($task_auth_code == $auth_code){ | |
| 89 | - $this->wppm_file_download($attach_id); | |
| 90 | - } | |
| 91 | - } | |
| 92 | - } | |
| 93 | - | |
| 94 | - public function wppm_file_download($attach_id){ | |
| 95 | - include WPPM_ABSPATH.'includes/admin/attachment/wppm_download_attachment.php'; | |
| 96 | - } | |
| 97 | - | |
| 98 | - public function deactivate() { | |
| 99 | - // Remove cron jobs | |
| 100 | - WPPMCron::wppm_unschedule_events(); | |
| 101 | - } | |
| 102 | - | |
| 103 | - } | |
| 104 | - | |
| 105 | -endif; | |
| 106 | - | |
| 107 | -new WP_Taskbuilder(); | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Plugin Name: Taskbuilder | |
| 4 | + * Plugin URI: https://taskbuilder.net/ | |
| 5 | + * Description: All-in-One Project & Task Management Tool for WordPress. | |
| 6 | + * Version: 6.0.5 | |
| 7 | + * Author: Taskbuilder Team | |
| 8 | + * Author URI: https://taskbuilder.net/ | |
| 9 | + * Requires at least: 5.6 | |
| 10 | + * Requires PHP: 7.4 | |
| 11 | + * Tested up to: 7.1 | |
| 12 | + * Text Domain: taskbuilder | |
| 13 | + * Domain Path: /lang | |
| 14 | + * License: GPLv3 or later | |
| 15 | + * License URI: https://www.gnu.org/licenses/gpl-3.0.html | |
| 16 | + */ | |
| 17 | + | |
| 18 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 19 | + exit; // Exit if accessed directly | |
| 20 | +} | |
| 21 | + | |
| 22 | +if ( ! class_exists( 'WP_Taskbuilder' ) ) : | |
| 23 | + | |
| 24 | + final class WP_Taskbuilder { | |
| 25 | + public $version = '6.0.5'; | |
| 26 | + public function __construct() { | |
| 27 | + // define global constants | |
| 28 | + $this->define_constants(); | |
| 29 | + // Include required files and classes | |
| 30 | + $this->includes(); | |
| 31 | + add_action( 'init', array($this,'load_textdomain') ); | |
| 32 | + add_action( 'init', array( $this, 'wppm_check_download_file') ); | |
| 33 | + register_deactivation_hook( __FILE__, array($this,'deactivate') ); | |
| 34 | + } | |
| 35 | + | |
| 36 | + function define_constants() { | |
| 37 | + $this->define('WPPM_STORE_URL', 'https://taskbuilder.net/'); | |
| 38 | + $this->define('WPPM_PLUGIN_FILE', __FILE__); | |
| 39 | + $this->define('WPPM_ABSPATH', dirname(__FILE__) . '/'); | |
| 40 | + $this->define('WPPM_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); | |
| 41 | + $this->define('WPPM_PLUGIN_BASENAME', plugin_basename(__FILE__)); | |
| 42 | + $this->define('WPPM_VERSION', $this->version); | |
| 43 | + } | |
| 44 | + | |
| 45 | + function load_textdomain(){ | |
| 46 | + $locale = apply_filters( 'plugin_locale', get_locale(), 'taskbuilder' ); | |
| 47 | + load_textdomain( 'taskbuilder', WP_LANG_DIR . '/taskbuilder/taskbuilder-' . $locale . '.mo' ); | |
| 48 | + load_plugin_textdomain( 'taskbuilder', false, plugin_basename( dirname( __FILE__ ) ) . '/lang' ); | |
| 49 | + } | |
| 50 | + | |
| 51 | + public function includes() { | |
| 52 | + include_once( WPPM_ABSPATH . 'includes/wppm-install.php' ); | |
| 53 | + include_once( WPPM_ABSPATH . 'includes/class-wppm-functions.php' ); | |
| 54 | + include( WPPM_ABSPATH.'includes/wppm_cron.php' ); | |
| 55 | + include_once( WPPM_ABSPATH . 'includes/wppm_actions.php' ); | |
| 56 | + if ($this->is_request('admin')) { | |
| 57 | + include_once( WPPM_ABSPATH . 'includes/class-wppm-admin.php' ); | |
| 58 | + include_once( WPPM_ABSPATH . 'includes/class-wppm-profile-update.php' ); | |
| 59 | + } | |
| 60 | + if ($this->is_request('frontend')) { | |
| 61 | + include_once( WPPM_ABSPATH . 'includes/class-wppm-frontend.php' ); | |
| 62 | + } | |
| 63 | + | |
| 64 | + } | |
| 65 | + | |
| 66 | + public function define($name, $value) { | |
| 67 | + if (!defined($name)) { | |
| 68 | + define($name, $value); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + | |
| 72 | + public function is_request($type) { | |
| 73 | + switch ($type) { | |
| 74 | + case 'admin' : | |
| 75 | + return is_admin(); | |
| 76 | + case 'frontend' : | |
| 77 | + return (!is_admin() || defined('DOING_AJAX') ) && !defined('DOING_CRON'); | |
| 78 | + } | |
| 79 | + } | |
| 80 | + | |
| 81 | + public function wppm_check_download_file(){ | |
| 82 | + global $wpdb,$wppmfunction; | |
| 83 | + if( isset($_REQUEST['wppm_attachment']) && isset($_REQUEST['tid']) && isset($_REQUEST['tac'])){ | |
| 84 | + $attach_id = intval(sanitize_text_field(wp_unslash($_REQUEST['wppm_attachment']))); | |
| 85 | + $auth_code = (sanitize_text_field(wp_unslash($_REQUEST['tac']))); | |
| 86 | + $task_id = intval(sanitize_text_field(wp_unslash($_REQUEST['tid']))); | |
| 87 | + $task_auth_code = $wppmfunction->get_task_fields($task_id,'task_auth_code'); | |
| 88 | + $task_auth_code = sanitize_text_field($task_auth_code); | |
| 89 | + if($task_auth_code == $auth_code){ | |
| 90 | + $this->wppm_file_download($attach_id); | |
| 91 | + } | |
| 92 | + }elseif( isset($_REQUEST['wppm_attachment']) && isset($_REQUEST['pid']) && isset($_REQUEST['pac'])){ | |
| 93 | + $attach_id = intval(sanitize_text_field(wp_unslash($_REQUEST['wppm_attachment']))); | |
| 94 | + $auth_code = (sanitize_text_field(wp_unslash($_REQUEST['pac']))); | |
| 95 | + $proj_id = intval(sanitize_text_field(wp_unslash($_REQUEST['pid']))); | |
| 96 | + $proj_auth_code = $wppmfunction->get_project_fields($proj_id,'project_auth_code'); | |
| 97 | + $proj_auth_code = sanitize_text_field($proj_auth_code); | |
| 98 | + if($proj_auth_code == $auth_code){ | |
| 99 | + $this->wppm_file_download($attach_id); | |
| 100 | + } | |
| 101 | + } | |
| 102 | + } | |
| 103 | + | |
| 104 | + public function wppm_file_download($attach_id){ | |
| 105 | + include WPPM_ABSPATH.'includes/admin/attachment/wppm_download_attachment.php'; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public function deactivate() { | |
| 109 | + // Remove cron jobs | |
| 110 | + WPPMCron::wppm_unschedule_events(); | |
| 111 | + } | |
| 112 | + | |
| 113 | + } | |
| 114 | + | |
| 115 | +endif; | |
| 116 | + | |
| 117 | +new WP_Taskbuilder(); | |