| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Catch Web Tools |
| 4 |
* Plugin URI: http://catchthemes.com/wp-plugins/catch-web-tools/ |
| 5 |
* Description: Catch Web Tools is a simple and lightweight WordPress plugin to help you manage your WordPress site. Power up your WordPress site with powerful features that were till now only available to Catch Themes users. We currently offer Webmaster Tools, Open Graph, Custom CSS, Social Icons, Catch IDs and basic SEO Optimization. |
| 6 |
* Author: Catch Themes Team |
| 7 |
* Author URI: http://catchthemes.com |
| 8 |
* Version: 0.1 |
| 9 |
* License: GPLv2 or later (license.txt) |
| 10 |
* Requires at least: 3.5 |
| 11 |
* Tested up to: 3.7.1 |
| 12 |
* |
| 13 |
* Text Domain: catch-web-tools |
| 14 |
* Domain Path: /catch-web-tools/ |
| 15 |
* |
| 16 |
* @package catch_web_tools |
| 17 |
* @author CatchThemes |
| 18 |
*/ |
| 19 |
|
| 20 |
|
| 21 |
// Exit if accessed directly |
| 22 |
if ( !defined( 'ABSPATH' ) ) exit; |
| 23 |
|
| 24 |
|
| 25 |
// Define Version |
| 26 |
define( 'CATCHWEBTOOLS_VERSION', '0.1' ); |
| 27 |
|
| 28 |
|
| 29 |
// The URL of the directory that contains the plugin |
| 30 |
if ( !defined( 'CATCHWEBTOOLS_URL' ) ) |
| 31 |
define( 'CATCHWEBTOOLS_URL', plugin_dir_url( __FILE__ ) ); |
| 32 |
|
| 33 |
|
| 34 |
// The absolute path of the directory that contains the file |
| 35 |
if ( !defined( 'CATCHWEBTOOLS_PATH' ) ) |
| 36 |
define( 'CATCHWEBTOOLS_PATH', plugin_dir_path( __FILE__ ) ); |
| 37 |
|
| 38 |
|
| 39 |
// Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes. |
| 40 |
if ( !defined( 'CATCHWEBTOOLS_BASENAME' ) ) |
| 41 |
define( 'CATCHWEBTOOLS_BASENAME', plugin_basename( __FILE__ ) ); |
| 42 |
|
| 43 |
|
| 44 |
/** |
| 45 |
* Make plugin available for translation |
| 46 |
* Translations can be filed in the /languages/ directory |
| 47 |
*/ |
| 48 |
function catchwebtools_load_textdomain() { |
| 49 |
load_plugin_textdomain( 'catch-web-tools', false, basename( dirname( __FILE__ ) ) . '/languages' ); |
| 50 |
} |
| 51 |
add_filter( 'wp_loaded', 'catchwebtools_load_textdomain' ); |
| 52 |
|
| 53 |
|
| 54 |
/** |
| 55 |
* Compare PHP Version |
| 56 |
* |
| 57 |
* Activate only if PHP version 5.2 or above |
| 58 |
*/ |
| 59 |
if ( version_compare( PHP_VERSION, '5.2', '<' ) ) { |
| 60 |
if ( is_admin() && ( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) ) { |
| 61 |
require_once ABSPATH . '/wp-admin/includes/plugin.php'; |
| 62 |
|
| 63 |
deactivate_plugins( __FILE__ ); |
| 64 |
|
| 65 |
wp_die( sprintf( __( 'Catch Web Tools requires PHP 5.2 or higher, as does WordPress 3.5 and higher. The plugin has now disabled itself.', 'catchwebtools' ) ) ); |
| 66 |
} else { |
| 67 |
return; |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Function to get catchwebtools options from parameter |
| 73 |
* |
| 74 |
* @param $field:option field name |
| 75 |
*/ |
| 76 |
function get_catchwebtools_options( $field ){ |
| 77 |
// Get any existing copy of our transient data |
| 78 |
if ( false === ( $settings = get_transient( $field.'_transient' ) ) ) { |
| 79 |
// It wasn't there, so regenerate the data and save the transient |
| 80 |
$settings = get_option( $field ); |
| 81 |
|
| 82 |
set_transient( $field.'_transient', $settings, 7 * DAY_IN_SECONDS ); |
| 83 |
} |
| 84 |
return $settings; |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
// Include Admin functions |
| 89 |
require_once CATCHWEBTOOLS_PATH . '/admin/admin-functions.php'; |
| 90 |
|
| 91 |
|
| 92 |
// Include Frontend functions |
| 93 |
require_once CATCHWEBTOOLS_PATH . '/frontend/frontend-functions.php'; |