Skip to content

Instantly share code, notes, and snippets.

@gubi
Last active July 11, 2024 10:53
Show Gist options
  • Select an option

  • Save gubi/83402a9aae7cfa762df8 to your computer and use it in GitHub Desktop.

Select an option

Save gubi/83402a9aae7cfa762df8 to your computer and use it in GitHub Desktop.

Revisions

  1. gubi revised this gist Feb 11, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion available_font-awesome_icons.php
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@ function array_delete($array, $element) {
    $icons_file = "css/font-awesome/css/font-awesome.css";
    $parsed_file = file_get_contents($icons_file);
    preg_match_all("/fa\-([a-zA-z0-9\-]+[^\:\.\,\s])/", $parsed_file, $matches);
    $exclude_icons = array("fa-lg", "fa-2x", "fa-3x", "fa-4x", "fa-5x", "fa-ul", "fa-li", "fa-fw", "fa-rotate-90", "fa-rotate-180", "fa-rotate-270", "fa-spin");
    $exclude_icons = array("fa-lg", "fa-2x", "fa-3x", "fa-4x", "fa-5x", "fa-ul", "fa-li", "fa-fw", "fa-border", "fa-pulse", "fa-rotate-90", "fa-rotate-180", "fa-rotate-270", "fa-spin", "fa-flip-horizontal", "fa-flip-vertical", "fa-stack", "fa-stack-1x", "fa-stack-2x", "fa-inverse");
    $icons = (object) array("icons" => array_delete($matches[0], $exclude_icons));

    print json_encode($icons);
  2. gubi revised this gist Feb 11, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion available_font-awesome_icons.php
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@ function array_delete($array, $element) {
    $icons_file = "css/font-awesome/css/font-awesome.css";
    $parsed_file = file_get_contents($icons_file);
    preg_match_all("/fa\-([a-zA-z0-9\-]+[^\:\.\,\s])/", $parsed_file, $matches);
    $exclude_icons = array("fa-lg", "fa-2x", "fa-3x", "fa-4x", "fa-5x", "fa-ul", "fa-li", "fa-fw");
    $exclude_icons = array("fa-lg", "fa-2x", "fa-3x", "fa-4x", "fa-5x", "fa-ul", "fa-li", "fa-fw", "fa-rotate-90", "fa-rotate-180", "fa-rotate-270", "fa-spin");
    $icons = (object) array("icons" => array_delete($matches[0], $exclude_icons));

    print json_encode($icons);
  3. gubi revised this gist Feb 11, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion available_font-awesome_icons.php
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@
    */


    header("Content-type: text/plain");
    header("Content-type: text/json");

    /**
    * Remove items from an array
  4. gubi revised this gist Feb 11, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion available_font-awesome_icons.php
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ function array_delete($array, $element) {
    $parsed_file = file_get_contents($icons_file);
    preg_match_all("/fa\-([a-zA-z0-9\-]+[^\:\.\,\s])/", $parsed_file, $matches);
    $exclude_icons = array("fa-lg", "fa-2x", "fa-3x", "fa-4x", "fa-5x", "fa-ul", "fa-li", "fa-fw");
    $icons = array_delete($matches[0], $exclude_icons);
    $icons = (object) array("icons" => array_delete($matches[0], $exclude_icons));

    print json_encode($icons);
    ?>
  5. gubi revised this gist Feb 11, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion available_font-awesome_icons.php
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    /**
    * Available Font Awesome icons
    *
    * Get all icons from a font-awesome.css file and returns it in a json list
    * Get all icons from a font-awesome.css file and list in json mode
    *
    * @author Alessandro Gubitosi <[email protected]>
    * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3
  6. gubi revised this gist Feb 11, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion available_font-awesome_icons.php
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ function array_delete($array, $element) {
    return (is_array($element)) ? array_values(array_diff($array, $element)) : array_values(array_diff($array, array($element)));
    }

    $icons_file = "../../../css/font-awesome/css/font-awesome.css";
    $icons_file = "css/font-awesome/css/font-awesome.css";
    $parsed_file = file_get_contents($icons_file);
    preg_match_all("/fa\-([a-zA-z0-9\-]+[^\:\.\,\s])/", $parsed_file, $matches);
    $exclude_icons = array("fa-lg", "fa-2x", "fa-3x", "fa-4x", "fa-5x", "fa-ul", "fa-li", "fa-fw");
  7. gubi created this gist Feb 11, 2015.
    31 changes: 31 additions & 0 deletions available_font-awesome_icons.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    <?php
    /**
    * Available Font Awesome icons
    *
    * Get all icons from a font-awesome.css file and returns it in a json list
    *
    * @author Alessandro Gubitosi <[email protected]>
    * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3
    */


    header("Content-type: text/plain");

    /**
    * Remove items from an array
    * @param array $array The array to manage
    * @param void $element An array or a string of the item to remove
    * @return array The cleaned array with resetted keys
    */
    function array_delete($array, $element) {
    return (is_array($element)) ? array_values(array_diff($array, $element)) : array_values(array_diff($array, array($element)));
    }

    $icons_file = "../../../css/font-awesome/css/font-awesome.css";
    $parsed_file = file_get_contents($icons_file);
    preg_match_all("/fa\-([a-zA-z0-9\-]+[^\:\.\,\s])/", $parsed_file, $matches);
    $exclude_icons = array("fa-lg", "fa-2x", "fa-3x", "fa-4x", "fa-5x", "fa-ul", "fa-li", "fa-fw");
    $icons = array_delete($matches[0], $exclude_icons);

    print json_encode($icons);
    ?>