| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The plugin bootstrap file |
| 5 |
* |
| 6 |
* This file is read by WordPress to generate the plugin information in the plugin |
| 7 |
* admin area. This file also includes all of the dependencies used by the plugin, |
| 8 |
* registers the activation and deactivation functions, and defines a function |
| 9 |
* that starts the plugin. |
| 10 |
* |
| 11 |
* @link https://www.sharedfilespro.com |
| 12 |
* @since 1.0.0 |
| 13 |
* @package Shared_Files |
| 14 |
* |
| 15 |
* @wordpress-plugin |
| 16 |
* Plugin Name: Shared Files |
| 17 |
* Description: A simple yet effective tool to list downloadable files on your site. |
| 18 |
* Version: 1.7.66 |
| 19 |
* Author: Shared Files – File Upload Form |
| 20 |
* Author URI: https://www.sharedfilespro.com |
| 21 |
* License: GPL-2.0+ |
| 22 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 23 |
* Text Domain: shared-files |
| 24 |
* Domain Path: /languages |
| 25 |
*/ |
| 26 |
// If this file is called directly, abort. |
| 27 |
if ( !defined( 'WPINC' ) ) { |
| 28 |
die; |
| 29 |
} |
| 30 |
if ( function_exists( 'shared_files_fs' ) ) { |
| 31 |
shared_files_fs()->set_basename( false, __FILE__ ); |
| 32 |
} else { |
| 33 |
require_once dirname( __FILE__ ) . '/vendor/autoload.php'; |
| 34 |
$shared_files_settings = get_option( 'shared_files_settings' ); |
| 35 |
$shared_files_tag_slug = 'post_tag'; |
| 36 |
if ( isset( $shared_files_settings['tag_slug'] ) && $shared_files_settings['tag_slug'] ) { |
| 37 |
$shared_files_tag_slug = sanitize_title( $shared_files_settings['tag_slug'] ); |
| 38 |
} |
| 39 |
define( 'SHARED_FILES_TAG_SLUG', $shared_files_tag_slug ); |
| 40 |
if ( !function_exists( 'shared_files_fs' ) ) { |
| 41 |
// Create a helper function for easy SDK access. |
| 42 |
function shared_files_fs() { |
| 43 |
global $shared_files_fs; |
| 44 |
if ( !isset( $shared_files_fs ) ) { |
| 45 |
// Include Freemius SDK. |
| 46 |
// SDK is auto-loaded through Composer |
| 47 |
$settings_contact = false; |
| 48 |
$settings_support = true; |
| 49 |
$shared_files_fs = fs_dynamic_init( array( |
| 50 |
'id' => '5144', |
| 51 |
'slug' => 'shared-files', |
| 52 |
'premium_slug' => 'shared-files-pro', |
| 53 |
'type' => 'plugin', |
| 54 |
'public_key' => 'pk_f414b8738adada8a01641686165dc', |
| 55 |
'is_premium' => false, |
| 56 |
'premium_suffix' => 'Pro', |
| 57 |
'has_addons' => false, |
| 58 |
'has_paid_plans' => true, |
| 59 |
'is_org_compliant' => true, |
| 60 |
'trial' => array( |
| 61 |
'days' => 7, |
| 62 |
'is_require_payment' => true, |
| 63 |
), |
| 64 |
'menu' => array( |
| 65 |
'slug' => 'shared-files', |
| 66 |
'contact' => $settings_contact, |
| 67 |
'support' => $settings_support, |
| 68 |
'parent' => array( |
| 69 |
'slug' => 'options-general.php', |
| 70 |
), |
| 71 |
), |
| 72 |
'is_live' => true, |
| 73 |
) ); |
| 74 |
} |
| 75 |
return $shared_files_fs; |
| 76 |
} |
| 77 |
|
| 78 |
// Init Freemius. |
| 79 |
shared_files_fs(); |
| 80 |
// Signal that SDK was initiated. |
| 81 |
do_action( 'shared_files_fs_loaded' ); |
| 82 |
} |
| 83 |
function shared_files_fs_custom_connect_message( $message, $user_first_name ) { |
| 84 |
return sprintf( |
| 85 |
/* translators: %1$s: user's first name */ |
| 86 |
__( 'Hey %1$s', 'shared-files' ) . ',<br>' . __( 'never miss an important update -- opt-in to our security and feature updates notifications, and non-sensitive diagnostic tracking with freemius.com.', 'shared-files' ), |
| 87 |
$user_first_name |
| 88 |
); |
| 89 |
} |
| 90 |
|
| 91 |
shared_files_fs()->add_filter( |
| 92 |
'connect_message', |
| 93 |
'shared_files_fs_custom_connect_message', |
| 94 |
10, |
| 95 |
6 |
| 96 |
); |
| 97 |
shared_files_fs()->add_filter( 'show_deactivation_feedback_form', '__return_false' ); |
| 98 |
function shared_files_freemius_custom_is_submenu_visible( $is_visible, $menu_id ) { |
| 99 |
if ( $menu_id == 'contact' ) { |
| 100 |
return shared_files_fs()->can_use_premium_code(); |
| 101 |
} elseif ( $menu_id == 'support' ) { |
| 102 |
return !shared_files_fs()->can_use_premium_code(); |
| 103 |
} |
| 104 |
return $is_visible; |
| 105 |
} |
| 106 |
|
| 107 |
shared_files_fs()->add_filter( |
| 108 |
'is_submenu_visible', |
| 109 |
'shared_files_freemius_custom_is_submenu_visible', |
| 110 |
10, |
| 111 |
2 |
| 112 |
); |
| 113 |
function shared_files_fs_custom_connect_message_on_update( |
| 114 |
$message, |
| 115 |
$user_first_name, |
| 116 |
$plugin_title, |
| 117 |
$user_login, |
| 118 |
$site_link, |
| 119 |
$freemius_link |
| 120 |
) { |
| 121 |
return sprintf( |
| 122 |
/* translators: %1$s: user's first name */ |
| 123 |
__( 'Hey %1$s', 'shared-files' ) . ',<br>' . __( 'Please help us improve %2$s! If you opt-in, some data about your usage of %2$s will be sent to %5$s. If you skip this, that\'s okay! %2$s will still work just fine.', 'shared-files' ), |
| 124 |
$user_first_name, |
| 125 |
'<b>' . $plugin_title . '</b>', |
| 126 |
'<b>' . $user_login . '</b>', |
| 127 |
$site_link, |
| 128 |
$freemius_link |
| 129 |
); |
| 130 |
} |
| 131 |
|
| 132 |
shared_files_fs()->add_filter( |
| 133 |
'connect_message_on_update', |
| 134 |
'shared_files_fs_custom_connect_message_on_update', |
| 135 |
10, |
| 136 |
6 |
| 137 |
); |
| 138 |
function shared_files_fs_custom_icon() { |
| 139 |
return dirname( __FILE__ ) . '/img/plugin-icon/icon.svg'; |
| 140 |
} |
| 141 |
|
| 142 |
shared_files_fs()->add_filter( 'plugin_icon', 'shared_files_fs_custom_icon' ); |
| 143 |
/** |
| 144 |
* Currently plugin version. |
| 145 |
* Start at version 1.0.0 and use SemVer - https://semver.org |
| 146 |
* Rename this for your plugin and update it as you release new versions. |
| 147 |
*/ |
| 148 |
define( 'SHARED_FILES_VERSION', '1.7.66' ); |
| 149 |
define( 'SHARED_FILES_URI', plugin_dir_url( __FILE__ ) ); |
| 150 |
define( 'SHARED_FILES_PATH', plugin_dir_path( __FILE__ ) ); |
| 151 |
/** |
| 152 |
* The code that runs during plugin activation. |
| 153 |
* This action is documented in includes/class-shared-files-activator.php |
| 154 |
*/ |
| 155 |
function activate_shared_files() { |
| 156 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-shared-files-activator.php'; |
| 157 |
Shared_Files_Activator::activate(); |
| 158 |
} |
| 159 |
|
| 160 |
/** |
| 161 |
* The code that runs during plugin deactivation. |
| 162 |
* This action is documented in includes/class-shared-files-deactivator.php |
| 163 |
*/ |
| 164 |
function deactivate_shared_files() { |
| 165 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-shared-files-deactivator.php'; |
| 166 |
Shared_Files_Deactivator::deactivate(); |
| 167 |
} |
| 168 |
|
| 169 |
register_activation_hook( __FILE__, 'activate_shared_files' ); |
| 170 |
register_deactivation_hook( __FILE__, 'deactivate_shared_files' ); |
| 171 |
/** |
| 172 |
* The core plugin class that is used to define internationalization, |
| 173 |
* admin-specific hooks, and public-facing site hooks. |
| 174 |
*/ |
| 175 |
require plugin_dir_path( __FILE__ ) . 'includes/class-shared-files.php'; |
| 176 |
/** |
| 177 |
* Begins execution of the plugin. |
| 178 |
* |
| 179 |
* Since everything within the plugin is registered via hooks, |
| 180 |
* then kicking off the plugin from this point in the file does |
| 181 |
* not affect the page life cycle. |
| 182 |
* |
| 183 |
* @since 1.0.0 |
| 184 |
*/ |
| 185 |
function run_shared_files() { |
| 186 |
$plugin = new Shared_Files(); |
| 187 |
$plugin->run(); |
| 188 |
} |
| 189 |
|
| 190 |
run_shared_files(); |
| 191 |
} |