PluginProbe
Ovation Elements / 1.0.3
Ovation Elements v1.0.3
1.2.7 1.2.6 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 27 releases
ovation-elements / ovation-elements.php

ovation-elements.php in Ovation Elements 1.0.3, at ovation-elements.php

131 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Ovation Elements
4 * Plugin URI:
5 * Description: Transform your site with captivating sliders. Perfect for beginners and advanced users. Create and customize with our ultimate slider plugin.
6 * Version: 1.0.3
7 * Requires at least: 5.2
8 * Requires PHP: 7.2
9 * Author: pewilliams
10 * Author URI: https://www.ovationthemes.com/
11 * License: GPL v2 or later
12 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
13 * Text Domain: ovation-elements
14 */
15
16 if (!defined('ABSPATH')) {
17 exit; // Exit if accessed directly.
18 }
19
20 define( 'OVA_ELEMS_FILE', __FILE__ );
21 define( 'OVA_ELEMS_BASE', plugin_basename( OVA_ELEMS_FILE ) );
22 define( 'OVA_ELEMS_DIR', plugin_dir_path( OVA_ELEMS_FILE ) );
23 define( 'OVA_ELEMS_URL', plugins_url( '/', OVA_ELEMS_FILE ) );
24
25 if( ! function_exists('get_plugin_data') ) {
26 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
27 }
28
29 $plugin_data = get_plugin_data( __FILE__ );
30 define( 'OVA_ELEMS_VER', $plugin_data['Version'] );
31
32 // Include necessary files
33 include(plugin_dir_path(__FILE__) . 'includes/admin-settings.php');
34 include(plugin_dir_path(__FILE__) . 'includes/slider-shortcode.php');
35
36
37
38 function ova_elems_admin_scripts($hook) {
39
40 wp_enqueue_media();
41 wp_enqueue_style('ova-elems-bootstrap-css', plugin_dir_url(__FILE__) . 'assets/css/bootstrap.min.css', array(), OVA_ELEMS_VER);
42 wp_enqueue_style('ova-elems-admin-css', plugin_dir_url(__FILE__) . 'assets/css/slider-admin.css', array(), OVA_ELEMS_VER);
43
44 if ( $hook == 'admin_page_edit-slider-template-template1' ) {
45 wp_enqueue_script('ova-elems-template-1-scripts', plugin_dir_url(__FILE__) . 'assets/js/admin/template-1-scripts.js', array('jquery'), OVA_ELEMS_VER, true);
46 } elseif ( $hook == 'admin_page_edit-slider-template-template2' ) {
47 wp_enqueue_script('ova-elems-template-2-scripts', plugin_dir_url(__FILE__) . 'assets/js/admin/template-2-scripts.js', array('jquery'), OVA_ELEMS_VER, true);
48 } elseif ( $hook == 'admin_page_edit-slider-template-template3' ) {
49 wp_enqueue_script('ova-elems-template-3-scripts', plugin_dir_url(__FILE__) . 'assets/js/admin/template-3-scripts.js', array('jquery'), OVA_ELEMS_VER, true);
50 } elseif ( $hook == 'admin_page_edit-slider-template-template4' ) {
51 wp_enqueue_script('ova-elems-template-4-scripts', plugin_dir_url(__FILE__) . 'assets/js/admin/template-4-scripts.js', array('jquery'), OVA_ELEMS_VER, true);
52 wp_localize_script(
53 'ova-elems-template-4-scripts',
54 'ova_elems_template_script',
55 array(
56 'ajaxurl' => admin_url('admin-ajax.php')
57 )
58 );
59 } elseif ( $hook == 'admin_page_edit-slider-template-template5' ) {
60 wp_enqueue_script('ova-elems-template-5-scripts', plugin_dir_url(__FILE__) . 'assets/js/admin/template-5-scripts.js', array('jquery'), OVA_ELEMS_VER, true);
61 }
62
63 }
64 add_action('admin_enqueue_scripts', 'ova_elems_admin_scripts');
65
66 function ova_elems_admin_enqueue_scripts($hook_suffix) {
67 if ($hook_suffix !== 'toplevel_page_ova-elems') {
68 return;
69 }
70
71 wp_enqueue_script('jquery');
72
73 }
74 add_action('admin_enqueue_scripts', 'ova_elems_admin_enqueue_scripts');
75
76 //i add temprory
77
78 //for enque
79 function ova_elems_enqueue_scripts($hook) {
80
81 // Enqueue Font Awesome
82 wp_enqueue_style('ova-elems-font-awesome', plugin_dir_url(__FILE__) . 'assets/css/font.all.min.css', array(), OVA_ELEMS_VER);
83
84 // Enqueue Bootstrap CSS
85 wp_enqueue_script('jquery');
86 if (isset($_GET['page']) && $_GET['page'] == 'ovation_elements') {
87
88 wp_enqueue_style('ova-elems-bootstrap-css', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css', array(), '4.5.2');
89 // Enqueue Bootstrap JS and its dependency Popper.js
90 wp_enqueue_script('ova-elems-popper-js', 'https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js', array('jquery'), '2.9.3', true);
91 wp_enqueue_script('ova-elems-bootstrap-js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js', array('jquery', 'ova-elems-popper-js'), '4.5.2', true);
92
93
94 }
95 }
96 add_action('admin_enqueue_scripts', 'ova_elems_enqueue_scripts');
97 //end
98
99 // Register activation hook
100 register_activation_hook(__FILE__, 'ova_elems_activate');
101
102 function ova_elems_activate() {
103 // Activation code here
104 ova_elems_post_type();
105 flush_rewrite_rules();
106 }
107
108 // Register deactivation hook
109 register_deactivation_hook(__FILE__, 'ova_elems_deactivate');
110
111 function ova_elems_deactivate() {
112 // Deactivation code here
113 flush_rewrite_rules();
114 }
115
116 function ova_elems_get_posts_for_slider() {
117 $args = array(
118 'post_type' => 'post',
119 'posts_per_page' => -1,
120 );
121 $posts = get_posts($args);
122 $options = '';
123 foreach ($posts as $post) {
124 $options .= '<option value="' . esc_attr($post->ID) . '">' . esc_html($post->post_title) . '</option>';
125 }
126 echo wp_kses_post($options);
127 wp_die();
128 }
129 add_action('wp_ajax_ova_elems_get_posts_for_slider', 'ova_elems_get_posts_for_slider');
130 add_action('wp_ajax_nopriv_ova_elems_get_posts_for_slider', 'ova_elems_get_posts_for_slider');
131