| 1 |
<?php |
| 2 |
/** |
| 3 |
* Core plugin functionality. |
| 4 |
* |
| 5 |
* @package Unagi |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Unagi\Core; |
| 9 |
|
| 10 |
use \WP_Error as WP_Error; |
| 11 |
|
| 12 |
/** |
| 13 |
* Default setup routine |
| 14 |
* |
| 15 |
* @return void |
| 16 |
*/ |
| 17 |
function setup() { |
| 18 |
$n = function ( $function ) { |
| 19 |
return __NAMESPACE__ . "\\$function"; |
| 20 |
}; |
| 21 |
|
| 22 |
add_action( 'init', $n( 'i18n' ) ); |
| 23 |
add_action( 'init', $n( 'init' ) ); |
| 24 |
|
| 25 |
do_action( 'unagi_loaded' ); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Registers the default textdomain. |
| 30 |
* |
| 31 |
* @return void |
| 32 |
*/ |
| 33 |
function i18n() { |
| 34 |
$locale = apply_filters( 'plugin_locale', get_locale(), 'unagi' ); |
| 35 |
load_textdomain( 'unagi', WP_LANG_DIR . '/unagi/unagi-' . $locale . '.mo' ); |
| 36 |
load_plugin_textdomain( 'unagi', false, plugin_basename( UNAGI_PATH ) . '/languages/' ); |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Initializes the plugin and fires an action other plugins can hook into. |
| 41 |
* |
| 42 |
* @return void |
| 43 |
*/ |
| 44 |
function init() { |
| 45 |
do_action( 'unagi_init' ); |
| 46 |
} |
| 47 |
|
| 48 |
|