-
Notifications
You must be signed in to change notification settings - Fork 0
/
newmoji-plugin.php
58 lines (40 loc) · 1.64 KB
/
newmoji-plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* Plugin Name: Newmoji
* Plugin URI: https://github.com/BenjaminGuV/Newmoji
* Description: Your post generates emotions, count the reactions with this simple plugin | Tus post genera emociones, contabiliza las reacciones con este sencillo plugin
* Text Domain: newmoji
* Domain Path: /i18n/languages
* Version: 1.1.0
* Requires at least: 5.5.3
* Requires PHP: 7.2.24
* Author: Benjamin Guerrero
* Author URI: https://nanos.pw/
* License: MIT
* License URI: https://opensource.org/licenses/MIT
*/
//PATH
define( 'NWMJ_NEWMOJI__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'NWMJ_NEWMOJI__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
//includes libs functions
require_once plugin_dir_path(__FILE__) . 'includes/newmoji-functions.php';
//menu admin
add_action( 'admin_menu', 'nwmj_newmoji_add_my_admin_link' );
//print html
add_action( 'the_content', 'nwmj_newmoji_print_html' );
//load css and js
add_action('wp_enqueue_scripts', 'nwmj_newmoji_callback_scripts');
//ajax request
// Hook para usuarios no logueados
add_action('wp_ajax_nopriv_save_newmoji_ajax', 'nwmj_newmoji_save_ajax');
// Hook para usuarios logueados
add_action('wp_ajax_save_newmoji_ajax', 'nwmj_newmoji_save_ajax');
//install tables
register_activation_hook(__FILE__, 'nwmj_newmoji_installer');
//load languages es_MX
function plugin_name_load_plugin_textdomain() {
$domain = 'newmoji';
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
}
add_action( 'init', 'plugin_name_load_plugin_textdomain' );