PluginProbe
Weather Effect / trunk
Weather Effect vtrunk
1.6.1 1.1.9 1.2.0 1.2.10 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 All 90 releases
weather-effect / weather-effect.php

weather-effect.php in Weather Effect trunk, at weather-effect.php

93 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5 /*
6 Plugin Name: Weather Effect
7 Plugin URI: https://awplife.com/
8 Description: This is Weather Effect Widget.
9 Version: 1.6.1
10 Requires at least: 4.5
11 Requires PHP: 5.6
12 Author: A WP Life
13 Author URI: https://awplife.com/
14 License: GPLv2 or later
15 Text Domain: weather-effect
16 Domain Path: /languages
17
18 Weather Effect is free software: you can redistribute it and/or modify
19 it under the terms of the GNU General Public License as published by
20 the Free Software Foundation, either version 2 of the License, or
21 any later version.
22
23 Weather Effect is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 GNU General Public License for more details.
27
28 You should have received a copy of the GNU General Public License
29 along with User Registration. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
30 */
31
32 define( 'AWPLIFE_WE_PLUGIN_PATH', plugin_dir_url( __FILE__ ) );
33 define( 'AWPLIFE_WEP_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
34 define( 'AWPLIFE_WE_VERSION', '1.6.1' );
35
36 // Plugin Text Domain
37 define( 'AWPLIFE_WE_TXTD', 'weather-effect' );
38
39 // Load text domain
40 add_action( 'plugins_loaded', 'awplife_we_load_textdomain' );
41
42 function awplife_we_load_textdomain() {
43 load_plugin_textdomain( 'weather-effect', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
44 }
45
46 // Default settings
47 function awplife_we_default_settings() {
48 $default_settings = array(
49 'enable_weather_effect' => 0,
50 );
51
52 if ( get_option( 'weather_effect_settings' ) === false ) {
53 add_option( 'weather_effect_settings', $default_settings );
54 }
55 }
56 register_activation_hook( __FILE__, 'awplife_we_default_settings' );
57
58 // Enqueue necessary scripts
59 function awplife_we_enqueue_scripts() {
60
61 // Enqueue frontend scripts only when effects are enabled
62 $weather_effect_settings = get_option( 'weather_effect_settings' );
63 $enable_weather_effect = isset( $weather_effect_settings['enable_weather_effect'] ) ? $weather_effect_settings['enable_weather_effect'] : 0;
64
65 if ( $enable_weather_effect == 1 ) {
66 wp_enqueue_script( 'awplife-we-snow-christmas-snow-js', AWPLIFE_WE_PLUGIN_PATH . 'assets/js/christmas-snow/christmas-snow.js', array( 'jquery' ), '1.6.1', true );
67 wp_enqueue_script( 'awplife-we-snow-snow-falling-js', AWPLIFE_WE_PLUGIN_PATH . 'assets/js/snow-falling/snow-falling.js', array( 'jquery' ), '1.6.1', true );
68 wp_enqueue_script( 'awplife-we-snow-snowfall-master-js', AWPLIFE_WE_PLUGIN_PATH . 'assets/js/snowfall-master/snowfall-master.min.js', array( 'jquery' ), '1.6.1', true );
69 }
70 }
71 add_action( 'wp_enqueue_scripts', 'awplife_we_enqueue_scripts' );
72
73 // Weather effect premium setting page
74 if (file_exists(AWPLIFE_WEP_PLUGIN_DIR_PATH . 'settings.php')) {
75 require_once AWPLIFE_WEP_PLUGIN_DIR_PATH . 'settings.php';
76 }
77
78 /**
79 * Load frontend effects in footer
80 */
81 function awplife_we_load_frontend_effects() {
82 $weather_effect_settings = get_option( 'weather_effect_settings' );
83 $enable_weather_effect = isset( $weather_effect_settings['enable_weather_effect'] ) ? $weather_effect_settings['enable_weather_effect'] : 1;
84
85 // Check if weather effect is enabled
86 if ( $enable_weather_effect == 1 ) {
87 require_once 'output.php';
88 }
89 }
90 add_action( 'wp_footer', 'awplife_we_load_frontend_effects' );
91
92 ?>
93