Skip to content

Commit

Permalink
getting ready for translations
Browse files Browse the repository at this point in the history
  • Loading branch information
bozdoz committed Jan 25, 2018
1 parent 45b3607 commit 1428295
Show file tree
Hide file tree
Showing 9 changed files with 644 additions and 178 deletions.
31 changes: 16 additions & 15 deletions class.leaflet-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class Leaflet_Map {
* Used for asset file cache-busting
* @var string major minor patch version
*/
public static $version = '2.9.1';
public static $version = '2.10.0';

/**
* Leaflet version
* @var string major minor patch version
*/
public static $leaflet_version = '1.2.0';
public static $leaflet_version = '1.3.1';

/**
* Number of maps on page; used for unique map ids
Expand Down Expand Up @@ -83,35 +83,26 @@ public static function init() {
* Leaflet_Map Constructor
*/
private function __construct() {
$this->includes();
$this->init_hooks();
$this->add_shortcodes();

// loaded
do_action('leaflet-map-loaded');
}

/**
*
* include classes
*
*/
private function includes() {
// Leaflet_Map_Plugin_Settings
include_once(LEAFLET_MAP__PLUGIN_DIR . 'class.plugin-settings.php');
// Leaflet_Map_Admin
include_once(LEAFLET_MAP__PLUGIN_DIR . 'class.admin.php');
}

/**
*
* add actions and filters
*
*/
private function init_hooks() {
// Leaflet_Map_Admin
include_once(LEAFLET_MAP__PLUGIN_DIR . 'class.admin.php');

// init admin
Leaflet_Map_Admin::init();

add_action( 'plugins_loaded', array('Leaflet_Map', 'load_text_domain' ));

add_action( 'wp_enqueue_scripts', array('Leaflet_Map', 'enqueue_and_register') );

Expand Down Expand Up @@ -154,13 +145,23 @@ public static function uninstall () {
Leaflet_Geocoder::remove_caches();
}

/**
* Loads Translations
*
*/
public static function load_text_domain() {
load_plugin_textdomain( 'leaflet-map', false, dirname( plugin_basename( LEAFLET_MAP__PLUGIN_FILE ) ) . '/languages/' );
}

/**
* Enqueue and register styles and scripts (called in __construct)
*
*/

public static function enqueue_and_register () {
/* defaults from db */
// Leaflet_Map_Plugin_Settings
include_once(LEAFLET_MAP__PLUGIN_DIR . 'class.plugin-settings.php');
$settings = Leaflet_Map_Plugin_Settings::init();

$js_url = $settings->get('js_url');
Expand Down
15 changes: 8 additions & 7 deletions class.plugin-option.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ function __construct ($details = array()) {
}

$option_filter = array(
'default' => null,
'type' => FILTER_SANITIZE_STRING,
'options' => array(
'filter' => FILTER_SANITIZE_STRING,
'flags' => FILTER_FORCE_ARRAY
),
'helptext' => FILTER_SANITIZE_STRING
'display_name' => FILTER_SANITIZE_STRING,
'default' => null,
'type' => FILTER_SANITIZE_STRING,
'options' => array(
'filter' => FILTER_SANITIZE_STRING,
'flags' => FILTER_FORCE_ARRAY
),
'helptext' => FILTER_SANITIZE_STRING
);

// get matching keys only
Expand Down
299 changes: 188 additions & 111 deletions class.plugin-settings.php

Large diffs are not rendered by default.

Loading

0 comments on commit 1428295

Please sign in to comment.