forked from dlesendric/cyrillic-to-latin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cyrillic-to-latin.php
72 lines (61 loc) · 1.78 KB
/
cyrillic-to-latin.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Plugin Name: Cyrillic To Latin
* Plugin URI:
* Description: Convert Serbian cyrillic to Serbian latin translation files.
* Version: 1.0.1
* Author: Darko Lesendric
* Author URI: [email protected]
* License: GPL-2.0+
* Copyright: 2017 Darko Lesendric
* Domain Path: src/Resources/languages
* Text Domain: cyrillic-to-latin
*/
namespace DLS;
if ( ! defined( 'ABSPATH' ) ) {
exit; // disable direct access
}
require_once __DIR__.'/vendor/autoload.php';
add_action( 'plugins_loaded', __NAMESPACE__ . '\loaded' );
/**
* Instantiate and run the plugin
*
* @return void
*/
$ctl_plugin = null;
function loaded() {
global $ctl_plugin;
define('CTL_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR);
load_plugin_textdomain( 'cyrillic-to-latin', false, basename( dirname( __FILE__ ) ) . '/src/Resources/languages' );
$ctl_plugin = new WP_CyrillicToLatin();
}
add_action( 'admin_menu', __NAMESPACE__.'\\load_ctl_menu' );
/**
* Load this into menu
*/
function load_ctl_menu() {
add_options_page( 'Konvertovanje ćirilice u latinicu', __('convert cyrillic', 'cyrillic-to-latin'), 'manage_options', 'cyrillic-to-latin', __NAMESPACE__.'\\ctl_option' );
}
/** Step 3. */
function ctl_option() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
//container
echo '<div class="wrap">';
global $ctl_plugin;
/**
* @var WP_CyrillicToLatin $ctl_plugin
*/
$ctl_plugin->run();
echo '</div>';
}
register_activation_hook( __FILE__, __NAMESPACE__ . '\flush_rewrites' );
/**
* Plugin activation callback function.
*
* @return void
*/
function flush_rewrites() {
flush_rewrite_rules();
}