예제 #1
0
/**
 * Initialize the Better Font Awesome Library.
 *
 * @since  2.0.0
 */
function trestle_load_bfa()
{
    // Set the library initialization args.
    $args = array('version' => 'latest', 'minified' => true, 'remove_existing_fa' => false, 'load_styles' => true, 'load_admin_styles' => true, 'load_shortcode' => true, 'load_tinymce_plugin' => true);
    // Initialize the Better Font Awesome Library.
    Better_Font_Awesome_Library::get_instance($args);
}
예제 #2
0
/**
 * Initialize the Better Font Awesome Library.
 *
 * @since  2.0.0
 */
function trestle_load_bfa()
{
    // Better Font Awesome Library
    require_once trailingslashit(get_stylesheet_directory()) . 'lib/better-font-awesome-library/better-font-awesome-library.php';
    // Set the library initialization args.
    $args = array('version' => 'latest', 'minified' => true, 'remove_existing_fa' => false, 'load_styles' => true, 'load_admin_styles' => true, 'load_shortcode' => true, 'load_tinymce_plugin' => true);
    // Initialize the Better Font Awesome Library.
    Better_Font_Awesome_Library::get_instance($args);
}
예제 #3
0
 function get_icons()
 {
     require_once dirname(__FILE__) . '/better-font-awesome-library/better-font-awesome-library.php';
     $args = array('version' => 'latest', 'minified' => true, 'remove_existing_fa' => false, 'load_styles' => false, 'load_admin_styles' => false, 'load_shortcode' => false, 'load_tinymce_plugin' => false);
     $bfa = Better_Font_Awesome_Library::get_instance($args);
     $bfa_icons = $bfa->get_icons();
     $bfa_prefix = $bfa->get_prefix() . '-';
     $new_icons = array();
     $this->stylesheet = $bfa->get_stylesheet_url();
     $this->version = $bfa->get_version();
     foreach ($bfa_icons as $hex => $class) {
         $unicode = '&#x' . ltrim($hex, '\\') . ';';
         $new_icons[$bfa_prefix . $class] = $unicode . ' ' . $bfa_prefix . $class;
     }
     return $new_icons;
 }
 /**
  * Output a <select> version selector.
  *
  * @since  0.10.0
  *
  * @param array  $versions  All available Font Awesome versions
  */
 public function version_callback($versions)
 {
     if ($versions) {
         // Add 'Always Latest' option.
         $versions['latest'] = __('Always Latest', 'better-font-awesome');
         /**
          * Remove version 2.0, since its CSS doesn't work with the regex
          * algorith and no one needs 2.0 anyways.
          */
         foreach ($versions as $index => $version) {
             if ('2.0' == $version) {
                 unset($versions[$index]);
             }
         }
         // Output the <select> element.
         printf('<select id="version" name="%s[version]">', esc_attr($this->option_name));
         foreach ($versions as $version => $text) {
             printf('<option value="%s" %s>%s</option>', esc_attr($version), selected($version, $this->options['version'], false), esc_attr($text));
         }
         echo '</select>';
     } else {
         ?>
         <p>
             <?php 
         printf(__('Version selection is currently unavailable. The attempt to reach the jsDelivr API server failed with the following error: %s', 'better-font-awesome'), '<code>' . $this->bfa_lib->get_error('api')->get_error_code() . ': ' . $this->bfa_lib->get_error('api')->get_error_message() . '</code>');
         ?>
         </p>
         <p>
             <?php 
         printf(__('Font Awesome will still render using version: %s', 'better-font-awesome'), '<code>' . $this->bfa_lib->get_fallback_version() . '</code>');
         ?>
         </p>
         <p>
             <?php 
         printf(__('This may be the result of a temporary server or connectivity issue which will resolve shortly. However if the problem persists please file a support ticket on the %splugin forum%s, citing the errors listed above. ', 'better-font-awesome'), '<a href="http://wordpress.org/support/plugin/better-font-awesome" target="_blank" title="Better Font Awesome support forum">', '</a>');
         ?>
         </small></p>
         <?php 
     }
 }
 /**
  * Returns the instance of this class, and initializes
  * the instance if it doesn't already exist.
  *
  * @since   1.0.0
  *
  * @return  Better_Font_Awesome_Library  The BFAL object.
  */
 public static function get_instance($args = array())
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self($args);
     }
     return self::$instance;
 }
예제 #6
0
/**
 * Initialize the Better Font Awesome Library.
 *
 * @since  1.0.0
 */
function mm_components_load_bfa()
{
    if (!class_exists('Better_Font_Awesome_Library')) {
        require_once MM_COMPONENTS_PATH . 'lib/better-font-awesome-library/better-font-awesome-library.php';
    }
    $args = array('version' => 'latest', 'minified' => true, 'remove_existing_fa' => false, 'load_styles' => true, 'load_admin_styles' => true, 'load_shortcode' => true, 'load_tinymce_plugin' => true);
    Better_Font_Awesome_Library::get_instance($args);
}
/**
 * Get array of icons to use.
 *
 * @since   1.0.0
 *
 * @return  array  Icon array.
 */
function tax_icons_get_icon_array()
{
    // Get Better Font Awesome instance
    $bfa = Better_Font_Awesome_Library::get_instance();
    // Get icons array
    $icons = $bfa->get_icons();
    // Add prefix to icon array
    $prefix = $bfa->get_prefix();
    foreach ($icons as $index => $icon) {
        $updated_icons[$icon] = $prefix ? "{$prefix} {$prefix}-{$icon}" : $icon;
    }
    /**
     * Filter the icon array.
     *
     * @since  1.0.0
     *
     * @param  array  $icons  Array of icons.
     */
    return apply_filters('tax_icons_icon_array', $updated_icons);
}
예제 #8
0
/**
 * Include and initialize the Better Font Awesome Library.
 *
 * @since  1.0.0
 */
function alcatraz_init_bfa()
{
    $args = array('version' => 'latest', 'minified' => true, 'remove_existing_fa' => false, 'load_styles' => true, 'load_admin_styles' => true, 'load_shortcode' => true, 'load_tinymce_plugin' => true);
    Better_Font_Awesome_Library::get_instance($args);
}