| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Hover Effects |
| 4 |
* Plugin URI: https://wordpress.org/plugins/hover-effects/ |
| 5 |
* Description: Hover Effect is easily applied to your own elements, modified or just used for inspiration. |
| 6 |
* Version: 2.1.3 |
| 7 |
* Author: Wow-Company |
| 8 |
* Author URI: http://wow-company.com |
| 9 |
* License: GPL-2.0+ |
| 10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 11 |
* PHP version 7.4 |
| 12 |
*/ |
| 13 |
if ( ! defined( 'WPINC' ) ) { |
| 14 |
die; |
| 15 |
} |
| 16 |
// Declaration Wow-Company class |
| 17 |
if ( ! class_exists( 'Wow_Company' ) ) { |
| 18 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wow-company.php'; |
| 19 |
} |
| 20 |
|
| 21 |
// Declaration of the plugin class |
| 22 |
if ( ! class_exists( 'Hover_Effects_Class' ) ) { |
| 23 |
class Hover_Effects_Class { |
| 24 |
/** |
| 25 |
* @var string |
| 26 |
*/ |
| 27 |
private $name; |
| 28 |
/** |
| 29 |
* @var string |
| 30 |
*/ |
| 31 |
private $version; |
| 32 |
/** |
| 33 |
* @var string |
| 34 |
*/ |
| 35 |
private $pluginname; |
| 36 |
/** |
| 37 |
* @var string |
| 38 |
*/ |
| 39 |
private $pluginurl; |
| 40 |
|
| 41 |
function __construct() { |
| 42 |
$this->name = 'Hover Effects'; |
| 43 |
$this->version = '2.1.3'; |
| 44 |
$this->pluginname = dirname( plugin_basename( __FILE__ ) ); |
| 45 |
$this->pluginurl = plugin_dir_url( __FILE__ ); |
| 46 |
// admin pages |
| 47 |
add_action( 'admin_menu', array( $this, 'add_menu_page' ) ); |
| 48 |
|
| 49 |
// add general style |
| 50 |
add_action( 'wp_enqueue_scripts', array( $this, 'plugin_scripts' ) ); |
| 51 |
add_action( 'admin_enqueue_scripts', [ $this, 'admin_style' ] ); |
| 52 |
|
| 53 |
// admin links |
| 54 |
add_filter( 'plugin_row_meta', array( $this, 'row_meta' ), 10, 4 ); |
| 55 |
add_filter( 'plugin_action_links', array( $this, 'action_links' ), 10, 2 ); |
| 56 |
|
| 57 |
} |
| 58 |
|
| 59 |
// AdminPanel |
| 60 |
public function add_menu_page(): void { |
| 61 |
add_submenu_page( 'wow-company', $this->name, $this->name, 'manage_options', $this->pluginname, array( |
| 62 |
$this, |
| 63 |
'plugin_admin' |
| 64 |
) ); |
| 65 |
} |
| 66 |
|
| 67 |
public function plugin_admin(): void { |
| 68 |
$name = $this->name; |
| 69 |
$pluginname = $this->pluginname; |
| 70 |
$version = $this->version; |
| 71 |
global $wow_company_plugin; |
| 72 |
$wow_company_plugin = true; |
| 73 |
include_once( 'admin/partials/main.php' ); |
| 74 |
} |
| 75 |
|
| 76 |
public function admin_style( $hook ): void { |
| 77 |
$page = 'wow-plugins_page_hover-effects'; |
| 78 |
if ( $page !== $hook ) { |
| 79 |
return; |
| 80 |
} |
| 81 |
// plugin sctyle & script |
| 82 |
wp_enqueue_style( $this->pluginname . '-style', $this->pluginurl . 'admin/css/style.css', false, $this->version ); |
| 83 |
wp_enqueue_script( $this->pluginname . '-script', $this->pluginurl . 'admin/js/script.js', array( 'jquery' ), $this->version, true ); |
| 84 |
// icon style |
| 85 |
wp_enqueue_style( $this->pluginname, plugin_dir_url( __FILE__ ) . 'asset/css/hover.css', array(), $this->version ); |
| 86 |
} |
| 87 |
|
| 88 |
// General plugin styles & scripts |
| 89 |
public function plugin_scripts(): void { |
| 90 |
wp_enqueue_style( $this->pluginname, plugin_dir_url( __FILE__ ) . 'asset/css/hover.css', array(), $this->version ); |
| 91 |
} |
| 92 |
|
| 93 |
// Admin links |
| 94 |
public function row_meta( $meta, $plugin_file ) { |
| 95 |
if ( false === strpos( $plugin_file, basename( __FILE__ ) ) ) { |
| 96 |
return $meta; |
| 97 |
} |
| 98 |
$meta[] = '<a href="https://wordpress.org/support/plugin/hover-effects/" target="_blank">Support </a> '; |
| 99 |
|
| 100 |
return $meta; |
| 101 |
} |
| 102 |
|
| 103 |
public function action_links( $actions, $plugin_file ) { |
| 104 |
if ( false === strpos( $plugin_file, basename( __FILE__ ) ) ) { |
| 105 |
return $actions; |
| 106 |
} |
| 107 |
$settings_link = '<a href="admin.php?page=' . esc_attr( $this->pluginname ) . '">Settings</a>'; |
| 108 |
array_unshift( $actions, $settings_link ); |
| 109 |
|
| 110 |
return $actions; |
| 111 |
} |
| 112 |
|
| 113 |
} |
| 114 |
|
| 115 |
$plugin = new Hover_Effects_Class(); |
| 116 |
} |
| 117 |
|