PluginProbe
URL Shortify – Simple and Easy URL Shortener / 2.6.0
URL Shortify – Simple and Easy URL Shortener v2.6.0
2.6.0 2.5.2 2.5.1 2.5.0 2.4.2 2.4.3 2.4.0 2.4.1 2.3.3 2.3.1 2.3.2 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.6.1 All 160 releases
url-shortify / url-shortify.php

url-shortify.php in URL Shortify – Simple and Easy URL Shortener 2.6.0, at url-shortify.php

234 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * URL Shortify
4 *
5 * URL Shortify helps you beautify, manage, share & cloak any links on or off of your WordPress website. Create links that look how you want using your own domain name!
6 *
7 * @link https://wordpress.org/plugins/url-shortify
8 * @author KaizenCoders <hello@kaizencoders.com>
9 * @license GPL-3.0+
10 * @package Url_Shortify
11 * @copyright 2020 - 2026 KaizenCoders
12 *
13 * @wordpress-plugin
14 *
15 * Plugin Name: URL Shortify
16 * Plugin URI: https://kaizencoders.com/url-shortify
17 * Description: URL Shortify helps you beautify, manage, share & cloak any links on or off of your WordPress website. Create links that look how you want using your own domain name!
18 * Version: 2.6.0
19 * Author: KaizenCoders
20 * Author URI: https://kaizencoders.com/
21 * Tested up to: 7.1
22 * Requires PHP: 5.6
23 * Text Domain: url-shortify
24 * License: GPL-3.0+
25 * License URI: https://www.gnu.org/licenses
26 * Domain Path: /languages
27 *
28 * @fs_premium_only /pro/, /addons/
29 * @fs_ignore /vendor/, /lite/dist/styles/app.css, /lite/scripts/app.js
30 *
31 */
32
33 // If this file is called directly, abort.
34
35 if ( ! defined( 'ABSPATH' ) ) {
36 die;
37 }
38
39 if ( function_exists( 'kc_us_fs' ) ) {
40 kc_us_fs()->set_basename( true, __FILE__ );
41 } else {
42 /**
43 * Plugin Version
44 *
45 * @since 1.0.0
46 */
47 if ( ! defined( 'KC_US_PLUGIN_VERSION' ) ) {
48 define( 'KC_US_PLUGIN_VERSION', '2.6.0' );
49 }
50
51 /**
52 * Minimum PHP version required for URL Shortify
53 *
54 * @since 1.0.0
55 *
56 */
57 if ( ! defined( 'KC_US_MIN_PHP_VER' ) ) {
58 define( 'KC_US_MIN_PHP_VER', '5.6' );
59 }
60
61 if ( ! function_exists( 'kc_us_fs' ) ) {
62 function kc_us_fs() {
63 global $kc_us_fs;
64
65 if ( ! isset( $kc_us_fs ) ) {
66 require_once dirname( __FILE__ ) . '/libs/fs/start.php';
67
68 $kc_us_fs = fs_dynamic_init( [
69 'id' => '6054',
70 'slug' => 'url-shortify',
71 'type' => 'plugin',
72 'public_key' => 'pk_62af18f49c6c943300b43e8b1d027',
73 'is_premium' => false,
74 'has_premium_version' => true,
75 'has_addons' => false,
76 'has_paid_plans' => true,
77 'has_affiliation' => 'selected',
78 'menu' => [
79 'slug' => 'url_shortify',
80 'first-path' => 'admin.php?page=url_shortify',
81 'account' => true,
82 'contact' => true,
83 'support' => true,
84 'affiliation' => false,
85 ],
86
87 'is_live' => true,
88 ] );
89 }
90
91 return $kc_us_fs;
92 }
93
94 kc_us_fs();
95
96 // Use custom icon for onboarding.
97 kc_us_fs()->add_filter( 'plugin_icon', function () {
98 return dirname( __FILE__ ) . '/assets/images/url-shortify-fs.png';
99 } );
100
101 do_action( 'kc_us_fs_loaded' );
102 }
103
104 if ( ! function_exists( 'kc_us_fail_php_version_notice' ) ) {
105 /**
106 * URL Shortify admin notice for minimum PHP version.
107 *
108 * Warning when the site doesn't have the minimum required PHP version.
109 *
110 * @return void
111 * @since 1.0.0
112 *
113 */
114 function kc_us_fail_php_version_notice() {
115 /* translators: %s: PHP version */
116 $message = sprintf( esc_html__( 'URL Shortify requires PHP version %s+, plugin is currently NOT RUNNING.',
117 'url-shortify' ), KC_US_MIN_PHP_VER );
118 $html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) );
119 echo wp_kses_post( $html_message );
120 }
121 }
122
123 if ( ! version_compare( PHP_VERSION, KC_US_MIN_PHP_VER, '>=' ) ) {
124 add_action( 'admin_notices', 'kc_us_fail_php_version_notice' );
125
126 return;
127 }
128
129 if ( file_exists( dirname( __FILE__ ) . '/vendor/autoload.php' ) ) {
130 require_once dirname( __FILE__ ) . '/vendor/autoload.php';
131 }
132
133 // Plugin Folder Path.
134 if ( ! defined( 'KC_US_PLUGIN_DIR' ) ) {
135 define( 'KC_US_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
136 }
137
138 // PRO Plugin Folder Path.
139 if ( ! defined( 'KC_US_PRO_PLUGIN_DIR' ) ) {
140 define( 'KC_US_PRO_PLUGIN_DIR', KC_US_PLUGIN_DIR . '/pro' );
141 }
142
143 if ( ! defined( 'KC_US_PLUGIN_ASSETS_DIR' ) ) {
144 define( 'KC_US_PLUGIN_ASSETS_DIR', KC_US_PLUGIN_DIR . 'lite/dist/assets' );
145 }
146
147 if ( ! defined( 'KC_US_PLUGIN_BASE_NAME' ) ) {
148 define( 'KC_US_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
149 }
150
151 if ( ! defined( 'KC_US_PLUGIN_FILE' ) ) {
152 define( 'KC_US_PLUGIN_FILE', __FILE__ );
153 }
154
155 if ( ! defined( 'KC_US_PLUGIN_URL' ) ) {
156 define( 'KC_US_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
157 }
158
159 if ( ! defined( 'KC_US_PLUGIN_ASSETS_DIR_URL' ) ) {
160 define( 'KC_US_PLUGIN_ASSETS_DIR_URL', KC_US_PLUGIN_URL . 'lite/dist/assets' );
161 }
162
163 if ( ! defined( 'KC_US_PLUGIN_STYLES_DIR_URL' ) ) {
164 define( 'KC_US_PLUGIN_STYLES_DIR_URL', KC_US_PLUGIN_URL . 'lite/dist/styles' );
165 }
166
167 $upload_dir = wp_upload_dir( null, false );
168
169 if ( ! defined( 'KC_US_LOG_DIR' ) ) {
170 define( 'KC_US_LOG_DIR', $upload_dir['basedir'] . '/kaizencoders_uploads/url-shortify/logs/' );
171 }
172
173 if ( ! defined( 'KC_US_UPLOADS_DIR' ) ) {
174 define( 'KC_US_UPLOADS_DIR', $upload_dir['basedir'] . '/kaizencoders_uploads/url-shortify/uploads/' );
175 }
176
177 // Load the action scheduler library.
178 if ( ! class_exists( 'ActionScheduler' ) ) {
179 require_once dirname( __FILE__ ) . '/libs/action-scheduler/action-scheduler.php';
180 }
181
182 /**
183 * The code that runs during plugin activation.
184 * This action is documented in lib/Activator.php
185 */
186 \register_activation_hook( __FILE__, '\KaizenCoders\URL_Shortify\Activator::activate' );
187
188 /**
189 * The code that runs during plugin deactivation.
190 * This action is documented in lib/Deactivator.php
191 */
192 \register_deactivation_hook( __FILE__, '\KaizenCoders\URL_Shortify\Deactivator::deactivate' );
193
194
195 if ( ! function_exists( 'US' ) ) {
196 /**
197 *
198 * @since 1.0.0
199 */
200 function US() {
201 return \KaizenCoders\URL_Shortify\Plugin::instance();
202 }
203
204 }
205
206 if ( ! function_exists( 'get_the_shorturl' ) ) {
207 /**
208 * Get the short url of a current page, page etc.
209 *
210 * @param $auto_create bool
211 *
212 * @return string
213 *
214 * @since 1.10.0
215 *
216 */
217 function get_the_shorturl( $auto_create = false ) {
218 $short_url = '';
219
220 $post = get_post();
221
222 if ( $post instanceof \WP_Post ) {
223 $short_url = \KaizenCoders\URL_Shortify\Helper::get_post_short_url( $post, $auto_create );
224 }
225
226 return $short_url;
227 }
228 }
229
230 add_action( 'plugins_loaded', function () {
231 US()->run();
232 } );
233 }
234