PluginProbe
Catch Web Tools / 3.1
Catch Web Tools v3.1
trunk 0.1 0.2 0.3 0.4 1.0 1.1 1.2 1.3 1.4 1.4.1 1.5 1.5.1 1.5.2 1.6 1.7 1.8 1.8.1 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 All 58 releases
catch-web-tools / functions.php

functions.php in Catch Web Tools 3.1, at functions.php

160 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Catch Web Tools
4 * Plugin URI: https://catchplugins.com/plugins/catch-web-tools/
5 * Description: Catch Web Tools is a modular plugin that powers up your WordPress site with simple and utilitarian features. It currently offers Webmaster Tool, Open Graph, Custom CSS, Social Icons, Security, Updator and Basic SEO optimization modules with more addition in updates to come.
6 * Author: Catch Plugins
7 * Author URI: https://catchplugins.com/
8 * Version: 3.1
9 * License: GPL-3.0+
10 * License URI: http://www.gnu.org/licenses/gpl-3.0.txt
11 * Requires at least: 5.9
12 *
13 * Text Domain: catch-web-tools
14 * Domain Path: /catch-web-tools/
15 *
16 * @package Catch Plugins
17 * @subpackage Catch Web Tools
18 * @author CatchThemes
19 */
20
21 // Exit if accessed directly
22 if (! defined('ABSPATH')) {
23 exit;
24 }
25
26
27 // Define Version
28 if (! defined('CATCHWEBTOOLS_VERSION')) {
29 define('CATCHWEBTOOLS_VERSION', '3.1');
30 }
31
32 // The URL of the directory that contains the plugin
33 if (! defined('CATCHWEBTOOLS_URL')) {
34 define('CATCHWEBTOOLS_URL', plugin_dir_url(__FILE__));
35 }
36
37
38 // The absolute path of the directory that contains the file
39 if (! defined('CATCHWEBTOOLS_PATH')) {
40 define('CATCHWEBTOOLS_PATH', plugin_dir_path(__FILE__));
41 }
42
43
44 // Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes.
45 if (! defined('CATCHWEBTOOLS_BASENAME')) {
46 define('CATCHWEBTOOLS_BASENAME', plugin_basename(__FILE__));
47 }
48
49
50 /**
51 * Make plugin available for translation
52 * Translations can be filed in the /languages/ directory
53 */
54 function catchwebtools_load_textdomain()
55 {
56 load_plugin_textdomain('catch-web-tools', false, basename(dirname(__FILE__)) . '/languages/');
57 }
58 add_action('init', 'catchwebtools_load_textdomain', 1);
59
60
61 /**
62 * Compare PHP Version
63 *
64 * Activate only if PHP version 5.2 or above
65 */
66 if (version_compare(PHP_VERSION, '5.2', '<')) {
67 if (is_admin() && (! defined('DOING_AJAX') || ! DOING_AJAX)) {
68 require_once ABSPATH . '/wp-admin/includes/plugin.php';
69
70 deactivate_plugins(__FILE__);
71
72 wp_die(sprintf(esc_html__('Catch Web Tools requires PHP 5.2 or higher, as does WordPress 3.5 and higher. The plugin has now disabled itself.', 'catch-web-tools')));
73 } else {
74 return;
75 }
76 }
77
78 /**
79 * Function to get catchwebtools options from parameter
80 *
81 * @param $field:option field name
82 */
83 function catchwebtools_get_options($field)
84 {
85 $defaults = array();
86
87 if ('catchwebtools_to_top_options' == $field) {
88 $defaults = catchwebtools_to_top_default_options();
89 } elseif ('catchwebtools_webmaster' == $field) {
90 $defaults = catchwebtools_webmaster_default_options();
91 } elseif ('catchwebtools_seo' == $field) {
92 $defaults = catchwebtools_seo_default_options();
93 } elseif ('catchwebtools_opengraph' == $field) {
94 $defaults = catchwebtools_og_default_options();
95 } elseif ('catchwebtools_catchids' == $field) {
96 $defaults = catchwebtools_catch_ids_default_options();
97 } elseif ('catchwebtools_catch_updater' == $field) {
98 $defaults = catchwebtools_catch_updater_default_options();
99 } elseif ('catchwebtools_social' == $field) {
100 $defaults = catchwebtools_social_default_options();
101 } elseif ('catchwebtools_big_image_size_threshold' == $field) {
102 $defaults = catchwebtools_big_image_size_threshold_default_options();
103 }
104
105 $options = get_option($field, $defaults);
106
107 if (is_array($options)) {
108 return array_merge($defaults, $options);
109 }
110
111 return $options;
112 }
113
114 // Include default options
115 require_once(CATCHWEBTOOLS_PATH . '/admin/inc/default-options.php');
116
117
118 // Include Admin functions
119 require_once CATCHWEBTOOLS_PATH . '/admin/admin-functions.php';
120
121
122 // Include Frontend functions
123 require_once CATCHWEBTOOLS_PATH . '/frontend/frontend-functions.php';
124
125 function catchwebtools_action_links($links, $plugin_file)
126 {
127 if (! isset($plugin)) {
128 $plugin = plugin_basename(__FILE__);
129 }
130
131 if ($plugin == $plugin_file) {
132 $cwt_dashboard = add_query_arg(
133 array(
134 'page' => 'catch-web-tools',
135 ),
136 admin_url('admin.php')
137 );
138
139 $settings_link = '<a href="' . esc_url($cwt_dashboard) . '">' . esc_html__('Settings', 'catch-web-tools') . '</a>';
140
141 array_unshift($links, $settings_link);
142 }
143
144 return $links;
145 }
146 add_filter('plugin_action_links', 'catchwebtools_action_links', 10, 2);
147
148
149
150 /* CTP tabs removal options */
151 require plugin_dir_path(__FILE__) . 'admin/inc/ctp-tabs-removal.php';
152
153 $ctp_options = ctp_get_options();
154 if (1 == $ctp_options['theme_plugin_tabs']) {
155 /* Adds Catch Themes tab in Add theme page and Themes by Catch Themes in Customizer's change theme option. */
156 if (! class_exists('CatchThemesThemePlugin') && ! function_exists('add_our_plugins_tab')) {
157 require plugin_dir_path(__FILE__) . 'admin/inc/CatchThemesThemePlugin.php';
158 }
159 }
160