Exemple #1
0
 /**
  * Initializes the CartoPress plugin
  *
  * @since 0.1.0
  */
 public static function initialize()
 {
     cartopress::load_constants();
     cartopress::add_settings();
     cartopress::add_geolocator();
     cartopress::add_bulkactions();
     require CARTOPRESS_ADMIN_DIR . 'cp-sql.php';
     require CARTOPRESS_ADMIN_DIR . 'cp-actions.php';
     add_action('admin_init', 'register_admin_styles');
     add_action('admin_init', 'register_admin_scripts');
     /**
      * Registers all stylesheets required by CartoPress.
      */
     function register_admin_styles()
     {
         // add google fonts
         $query_args = array('family' => 'Montserrat:400,700', 'subset' => 'latin,latin-ext');
         wp_register_style('google_fonts', add_query_arg($query_args, "//fonts.googleapis.com/css"), array(), null);
         wp_register_style('cartopress', CARTOPRESS_URL . '/admin/css/cartopress-settings.css', array(), CARTOPRESS_VERS);
         wp_register_style('cartopress-geocode-styles', CARTOPRESS_URL . '/admin/css/geocoder-styles.css', array(), CARTOPRESS_VERS);
         wp_register_style('leaflet', 'http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css');
         wp_register_style('ionicons', 'http://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css');
         wp_register_style('cartopress-leaflet-styles', CARTOPRESS_URL . '/admin/css/leaflet-awesome-markers.css', array(), CARTOPRESS_VERS);
     }
     // end get_admin_styles
     /**
      * Registers all linked scripts required by CartoPress.
      * 
      * @todo Use default WordPress install of jQuery instead of 2.1.4 for cartopress-geocode-script
      */
     function register_admin_scripts()
     {
         wp_register_script('jquery2.1.4', 'https://code.jquery.com/jquery-2.1.4.min.js');
         wp_register_script('leaflet', 'http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js');
         wp_register_script('cartodb', 'http://libs.cartocdn.com/cartodb.js/v3/3.11/cartodb.js');
         wp_register_script('ionicons', CARTOPRESS_URL . '/admin/js/leaflet.awesome-markers.min.js', array(), CARTOPRESS_VERS);
         wp_register_script('admin-script', CARTOPRESS_URL . '/admin/js/admin.js', array('jquery'), CARTOPRESS_VERS);
         wp_register_script('cartopress-geocode-script', CARTOPRESS_URL . '/admin/js/geocoder.js', array('jquery2.1.4', 'leaflet'), CARTOPRESS_VERS);
         wp_register_script('cartopress-geocode-helper-script', CARTOPRESS_URL . '/admin/js/geocoder-helper.js', array('jquery'), CARTOPRESS_VERS);
     }
     // end get_admin_scripts
     add_action('save_post', 'cartopress_update_row', 2000);
     add_action('edit_attachment', 'cartopress_update_row', 2000);
     add_action('delete_post', 'cartopress_delete_attachment');
 }
Exemple #2
0
 /**
  * Initializes the CartoPress plugin
  *
  * @since 0.1.0
  */
 public static function initialize()
 {
     cartopress::load_constants();
     cartopress::add_settings();
     cartopress::add_geolocator();
     cartopress::add_bulkactions();
     require CARTOPRESS_ADMIN_DIR . 'cp-sql.php';
     require CARTOPRESS_ADMIN_DIR . 'cp-actions.php';
     add_action('admin_init', 'register_admin_styles');
     add_action('admin_init', 'register_admin_scripts');
     /**
      * Registers all stylesheets required by CartoPress.
      */
     function register_admin_styles()
     {
         // add google fonts
         $query_args = array('family' => 'Montserrat:400,700', 'subset' => 'latin,latin-ext');
         wp_register_style('google_fonts', add_query_arg($query_args, "//fonts.googleapis.com/css"), array(), null);
         wp_register_style('cartopress-settings', CARTOPRESS_URL . '/admin/css/cartopress-settings.css', array(), CARTOPRESS_VERS);
         wp_register_style('cartopress-geocode-styles', CARTOPRESS_URL . '/admin/css/geocoder-styles.css', array(), CARTOPRESS_VERS);
         wp_register_style('cartopress-leaflet', CARTOPRESS_URL . '/admin/css/leaflet.css', array(), CARTOPRESS_VERS);
         wp_register_style('cartopress-leaflet-styles', CARTOPRESS_URL . '/admin/css/leaflet-awesome-markers.css', array(), CARTOPRESS_VERS);
     }
     // end get_admin_styles
     /**
      * Registers all linked scripts required by CartoPress.
      */
     function register_admin_scripts()
     {
         wp_register_script('cartopress-leaflet', CARTOPRESS_URL . '/admin/js/leaflet.js', array(), CARTOPRESS_VERS);
         wp_register_script('cartopress-leaflet-markers', CARTOPRESS_URL . '/admin/js/leaflet-awesome-markers.min.js', array(), CARTOPRESS_VERS);
         wp_register_script('cartopress-admin-script', CARTOPRESS_URL . '/admin/js/admin.js', array('jquery'), CARTOPRESS_VERS);
         wp_register_script('cartopress-geocode-script', CARTOPRESS_URL . '/admin/js/geocoder.js', array('jquery', 'cartopress-leaflet'), CARTOPRESS_VERS);
         wp_register_script('cartopress-geocode-helper-script', CARTOPRESS_URL . '/admin/js/geocoder-helper.js', array('jquery'), CARTOPRESS_VERS);
     }
     // end get_admin_scripts
     add_action('save_post', 'cartopress_update_row', 2000);
     add_action('edit_attachment', 'cartopress_update_row', 2000);
     add_action('delete_post', 'cartopress_delete_attachment');
 }