Plugin Directory

Changeset 3129913


Ignore:
Timestamp:
08/02/2024 09:11:15 AM (19 months ago)
Author:
teconce
Message:

update 1.2

Location:
fontier/trunk
Files:
77 added
6 edited

Legend:

Unmodified
Added
Removed
  • fontier/trunk/admin/partials/fontier-admin-options.php

    r3114702 r3129913  
    7676                        'default' => 'A Quick Brown Fox Jump Over a Lazy Dog'
    7777                    ),
     78                   
     79                    array(
     80                          'id'         => 'fontier_glyph_ebl',
     81                          'type'       => 'switcher',
     82                          'title'      => 'Glyph Section',
     83                          'text_on'    => 'Enabled',
     84                          'text_off'   => 'Disabled',
     85                          'text_width' => 100,
     86                           'default' => true
     87                        ),
     88                   
     89                     array(
     90                        'id'      => 'fontier_glyph_text',
     91                        'type'    => 'text',
     92                        'title'   => 'Glyph Section Title',
     93                        'default' => 'Glyph List',
     94                        'dependency' => array( 'fontier_glyph_ebl', '==', 'true' )
     95                    ),
     96                   
    7897
    7998                    array(
     
    135154                        'output' =>'.fontier-list li:after',
    136155                    ),
     156                   
     157                   
     158                   
     159                    array(
     160                        'id'          => 'fontier_glyph_ttl_color',
     161                        'type'        => 'color',
     162                        'title'       => 'Glyph Title Color',
     163                        'default' =>'#164a41',
     164                        'output'      => '#fontier-glyph-generate h3',
     165                        'output_mode' => 'color',
     166                        'dependency' => array( 'fontier_glyph_ebl', '==', 'true' )
     167                    ),
     168                   
     169                     array(
     170                        'id'          => 'fontier_glyph_border_color',
     171                        'type'        => 'color',
     172                        'title'       => 'Glyph Border Color',
     173                        'default' =>'#ccc',
     174                        'output'      => '.fontier-glyph-list li,.fontier-glyph-list',
     175                        'output_mode' => 'border-color',
     176                        'dependency' => array( 'fontier_glyph_ebl', '==', 'true' )
     177                    ),
     178                   
    137179                )),
    138180
  • fontier/trunk/fontier.php

    r3114702 r3129913  
    1717 * Plugin URI:        https://teconce.com
    1818 * Description:       Fontier is a auto font preview genration plugin for EDD
    19  * Version:           1.1
     19 * Version:           1.2
    2020 * Author:            Teconce
    2121 * Author URI:        https://teconce.com/about/
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'FONTIER_VERSION', '1.1' );
     38define( 'FONTIER_VERSION', '1.2' );
    3939
    4040/**
  • fontier/trunk/public/class-fontier-public.php

    r3114702 r3129913  
    2121 * @author     Teconce <[email protected]>
    2222 */
    23 class Fontier_Public
    24 {
     23// Custom Autoloader for FontLib
     24spl_autoload_register(function ($class) {
     25    $prefix = 'FontLib\\';
     26    $base_dir = __DIR__ . '/vendor/php-font-lib/src/FontLib/';
     27   
     28    // Does the class use the namespace prefix?
     29    $len = strlen($prefix);
     30    if (strncmp($prefix, $class, $len) !== 0) {
     31        // No, move to the next registered autoloader
     32        return;
     33    }
     34
     35    // Get the relative class name
     36    $relative_class = substr($class, $len);
     37
     38    // Replace the namespace prefix with the base directory, replace namespace
     39    // separators with directory separators in the relative class name, append
     40    // with .php
     41    $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
     42
     43    // If the file exists, require it
     44    if (file_exists($file)) {
     45        require $file;
     46    }
     47});
     48
     49use FontLib\Font;
     50
     51
     52class Fontier_Public {
    2553    private $fontier_product_type = 'download';
    2654    private $fontier_product_taxonomy = 'download_category';
     
    2957    public $slug = 'font_preview';
    3058
    31     function __construct()
    32     {
     59    function __construct() {
    3360        define('FONTIER_PATH', plugin_dir_path(__FILE__));
    3461        $this->layout = FONTIER_PATH . '/partials/fontier-public-display.php';
     
    4370        add_action('wp_ajax_nopriv_fontGenrate', array($this, 'fontier_font_preview_generator'));
    4471        add_action('wp_enqueue_scripts', array($this, 'fontier_enqueue_styles'));
    45     }
    46 
    47     public function fontier_before_post_content($content)
    48     {
     72        add_action('wp_ajax_fetchGlyphList', array($this, 'fetch_glyph_list'));
     73        add_action('wp_ajax_nopriv_fetchGlyphList', array($this, 'fetch_glyph_list'));
     74
     75    }
     76
     77    public function fontier_before_post_content($content) {
    4978        if (is_singular($this->fontier_product_type)) {
    5079            $fontier_layout = $this->layout;
     
    6594    }
    6695
    67   public function fontier_copy_zip($zip_file, $targetFolder, $id)
    68 {
    69     $output = array();
    70     if (!empty($zip_file)) {
    71         $zip = new ZipArchive;
    72         if ($zip->open($zip_file) === true) {
    73             for ($i = 0; $i < $zip->numFiles; $i++) {
    74                 $OnlyFileName = $zip->getNameIndex($i);
    75                 $FullFileName = $zip->statIndex($i);
    76 
    77                 if (!($FullFileName['name'][strlen($FullFileName['name']) - 1] == "/")) {
    78                     if (preg_match('#\.(ttf|otf)$#i', $OnlyFileName)) {
    79                         $name = basename($FullFileName['name']);
    80                         $zip->extractTo($targetFolder, $FullFileName['name']);
    81                         $extractedFile = $targetFolder . DIRECTORY_SEPARATOR . $name;
    82                         if (rename($targetFolder . DIRECTORY_SEPARATOR . $FullFileName['name'], $extractedFile)) {
    83                             $output[] = $extractedFile;
    84                             error_log('Extracted font file: ' . $extractedFile);
    85                         } else {
    86                             error_log('Failed to rename file: ' . $targetFolder . DIRECTORY_SEPARATOR . $FullFileName['name']);
     96    public function fontier_copy_zip($zip_file, $targetFolder, $id) {
     97        $output = array();
     98        if (!empty($zip_file)) {
     99            $zip = new ZipArchive;
     100            if ($zip->open($zip_file) === true) {
     101                for ($i = 0; $i < $zip->numFiles; $i++) {
     102                    $OnlyFileName = $zip->getNameIndex($i);
     103                    $FullFileName = $zip->statIndex($i);
     104
     105                    if (!($FullFileName['name'][strlen($FullFileName['name']) - 1] == "/")) {
     106                        if (preg_match('#\.(ttf|otf)$#i', $OnlyFileName)) {
     107                            $name = basename($FullFileName['name']);
     108                            $zip->extractTo($targetFolder, $FullFileName['name']);
     109                            $extractedFile = $targetFolder . DIRECTORY_SEPARATOR . $name;
     110                            if (rename($targetFolder . DIRECTORY_SEPARATOR . $FullFileName['name'], $extractedFile)) {
     111                                $output[] = $extractedFile;
     112                                error_log('Extracted font file: ' . $extractedFile);
     113                            } else {
     114                                error_log('Failed to rename file: ' . $targetFolder . DIRECTORY_SEPARATOR . $FullFileName['name']);
     115                            }
    87116                        }
    88117                    }
    89118                }
    90             }
    91             $zip->close();
    92         } else {
    93             error_log('Failed to open zip file: ' . $zip_file);
    94         }
    95     } else {
    96         error_log('Zip file is empty: ' . $zip_file);
    97     }
    98     return $output;
    99 }
    100 
    101 
    102     public function fontierCheckFont($path)
    103     {
     119                $zip->close();
     120            } else {
     121                error_log('Failed to open zip file: ' . $zip_file);
     122            }
     123        } else {
     124            error_log('Zip file is empty: ' . $zip_file);
     125        }
     126        return $output;
     127    }
     128
     129    public function fontierCheckFont($path) {
    104130        if (file_exists($path)) {
    105131            $folder = opendir($path);
     
    125151    }
    126152
    127  public function fontierGetFontFiles($id)
    128 {
    129     $download_files = get_post_meta($id, 'edd_download_files', true);
    130     error_log('Download files for post ID ' . $id . ': ' . print_r($download_files, true));
    131 
    132     $result = array();
    133     if (isset($download_files) && is_array($download_files)) {
    134         foreach ($download_files as $fi) {
    135             $getAID = attachment_url_to_postid($fi['file']);
    136             $zipfile = get_attached_file($getAID);
    137 
    138             $Fetchinfo = pathinfo($zipfile);
    139             $getDirectory = $Fetchinfo['dirname'];
    140             $targetFolder = $getDirectory . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $id;
    141             error_log('Target folder for fonts: ' . $targetFolder);
    142 
    143             if (!file_exists($targetFolder)) {
    144                 mkdir($targetFolder, 0777, true);
    145                 $result = $this->fontier_copy_zip($zipfile, $targetFolder, $id);
    146                 error_log('Copied font files: ' . print_r($result, true));
    147             } else {
    148                 $result = $this->fontierCheckFont($targetFolder);
    149                 error_log('Existing font files: ' . print_r($result, true));
    150             }
    151         }
    152     }
    153     return $result;
    154 }
    155 
    156 
    157     public function fontier_is_font_enable($id)
    158     {
     153    public function fontierGetFontFiles($id) {
     154        $download_files = get_post_meta($id, 'edd_download_files', true);
     155        error_log('Download files for post ID ' . $id . ': ' . print_r($download_files, true));
     156
     157        $result = array();
     158        if (isset($download_files) && is_array($download_files)) {
     159            foreach ($download_files as $fi) {
     160                $getAID = attachment_url_to_postid($fi['file']);
     161                $zipfile = get_attached_file($getAID);
     162
     163                $Fetchinfo = pathinfo($zipfile);
     164                $getDirectory = $Fetchinfo['dirname'];
     165                $targetFolder = $getDirectory . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $id;
     166                error_log('Target folder for fonts: ' . $targetFolder);
     167
     168                if (!file_exists($targetFolder)) {
     169                    mkdir($targetFolder, 0777, true);
     170                    $result = $this->fontier_copy_zip($zipfile, $targetFolder, $id);
     171                    error_log('Copied font files: ' . print_r($result, true));
     172                } else {
     173                    $result = $this->fontierCheckFont($targetFolder);
     174                    error_log('Existing font files: ' . print_r($result, true));
     175                }
     176            }
     177        }
     178        return $result;
     179    }
     180
     181    public function fontier_is_font_enable($id) {
    159182        $output = false;
    160183        if ($id) {
    161184            $fontier_metabox = get_post_meta(get_the_ID(), 'fontier_post_option', true);
    162             $enable_check = get_post_meta( get_the_ID(), 'font_preview_enable', true );
     185            $enable_check = get_post_meta(get_the_ID(), 'font_preview_enable', true);
    163186            $this->options = get_option('fontier_option_name');
    164187            $fontieroptions = get_option('fontier_options');
     
    193216    }
    194217
    195     public function fontierCalculateTextBox($text, $fontFile, $fontSize, $fontAngle)
    196     {
     218    public function fontierCalculateTextBox($text, $fontFile, $fontSize, $fontAngle) {
    197219        $rect = imagettfbbox($fontSize, $fontAngle, $fontFile, $text);
    198220        $minX = min(array($rect[0], $rect[2], $rect[4], $rect[6]));
     
    210232    }
    211233
    212   public function fontier_font_preview_generator()
    213 {
     234  public function fontier_font_preview_generator() {
    214235    $retArr = array('status' => 0, 'msg' => '', 'images' => array());
    215236    $nonce = sanitize_text_field($_REQUEST['auth']);
     
    234255                }
    235256            }
     257
     258            // Retrieve glyph list from cache or generate if not available
     259            $glyphList = get_post_meta($pid, '_glyph_list', true);
     260            if (empty($glyphList)) {
     261                $glyphList = $this->generate_glyph_list($font_Files[0], $size); // Assuming first font file for glyphs
     262                update_post_meta($pid, '_glyph_list', $glyphList);
     263            }
     264            $retArr['glyphs'] = $glyphList;
    236265        } else {
    237266            $retArr['msg'] = 'Font Files are not found';
     
    246275
    247276
    248  public function fontier_create_image($width, $height, $text, $fontsize, $font_file)
    249 {
    250     ob_start();
    251 
    252     // Ensure text is in UTF-8 encoding
    253     $text = mb_convert_encoding($text, 'UTF-8', mb_detect_encoding($text));
    254 
    255     // Calculate the text box size
    256     $the_box = $this->fontierCalculateTextBox($text, $font_file, $fontsize, 0);
    257     $imageWidth = $the_box["width"] + 10;
    258     $imageHeight = $the_box["height"] + 10;
    259     if ($imageWidth > 900) {
    260         $imageWidth = 900;
    261         $x = 0;
    262         $y = $the_box["top"] + ($imageHeight / 2) - ($the_box["height"] / 2);
     277
     278    public function fontier_create_image($width, $height, $text, $fontsize, $font_file) {
     279        ob_start();
     280
     281        // Ensure text is in UTF-8 encoding
     282        $text = mb_convert_encoding($text, 'UTF-8', mb_detect_encoding($text));
     283
     284        // Calculate the text box size
     285        $the_box = $this->fontierCalculateTextBox($text, $font_file, $fontsize, 0);
     286        $imageWidth = $the_box["width"] + 10;
     287        $imageHeight = $the_box["height"] + 10;
     288        if ($imageWidth > 900) {
     289            $imageWidth = 900;
     290            $x = 0;
     291            $y = $the_box["top"] + ($imageHeight / 2) - ($the_box["height"] / 2);
     292        } else {
     293            $x = $the_box["left"] + ($imageWidth / 2) - ($the_box["width"] / 2);
     294            $y = $the_box["top"] + ($imageHeight / 2) - ($the_box["height"] / 2);
     295        }
     296
     297        // Create the image with transparency
     298        $logoimg = imagecreatetruecolor($imageWidth, $imageHeight);
     299        imagealphablending($logoimg, false);
     300        imagesavealpha($logoimg, true);
     301        $col = imagecolorallocatealpha($logoimg, 255, 255, 255, 127);
     302        imagefill($logoimg, 0, 0, $col); // for transparent background
     303        $black = imagecolorallocate($logoimg, 0, 0, 0); // for font color
     304
     305        // Render the text on the image
     306        imagettftext($logoimg, $fontsize, 0, $x, $y, $black, $font_file, $text);
     307
     308        // Output the image
     309        imagepng($logoimg);
     310        $image_data = ob_get_contents();
     311        ob_end_clean();
     312        imagedestroy($logoimg); // Free memory
     313
     314        return "data:image/png;base64," . base64_encode($image_data);
     315    }
     316
     317   public function generate_glyph_list($font_file, $fontsize) {
     318    $glyphs = array();
     319
     320    // Load the font file
     321    $font = Font::load($font_file);
     322    $font->parse();
     323
     324    // Get the list of glyphs
     325    $glyphList = $font->getUnicodeCharMap();
     326    foreach ($glyphList as $code => $glyph) {
     327        $char = mb_convert_encoding(pack('N', $code), 'UTF-8', 'UCS-4BE');
     328        $image = $this->fontier_create_image(100, 100, $char, $fontsize, $font_file);
     329        $glyphs[] = array('char' => $char, 'image' => $image);
     330    }
     331
     332    return $glyphs;
     333}
     334
     335public function fetch_glyph_list() {
     336    $retArr = array('status' => 0, 'msg' => '', 'glyphs' => array());
     337    $nonce = sanitize_text_field($_REQUEST['auth']);
     338    if (wp_verify_nonce($nonce, '_prevnounce')) {
     339        $pid = sanitize_text_field($_REQUEST['pid']);
     340        // Retrieve glyph list from cache or generate if not available
     341        $glyphList = get_post_meta($pid, '_glyph_list', true);
     342        if (!empty($glyphList)) {
     343            $retArr['glyphs'] = $glyphList;
     344            $retArr['status'] = 1;
     345            $retArr['msg'] = 'successfully';
     346        } else {
     347            $retArr['msg'] = 'Glyph list not found';
     348        }
    263349    } else {
    264         $x = $the_box["left"] + ($imageWidth / 2) - ($the_box["width"] / 2);
    265         $y = $the_box["top"] + ($imageHeight / 2) - ($the_box["height"] / 2);
    266     }
    267 
    268     // Create the image with transparency
    269     $logoimg = imagecreatetruecolor($imageWidth, $imageHeight);
    270     imagealphablending($logoimg, false);
    271     imagesavealpha($logoimg, true);
    272     $col = imagecolorallocatealpha($logoimg, 255, 255, 255, 127);
    273     imagefill($logoimg, 0, 0, $col); // for transparent background
    274     $black = imagecolorallocate($logoimg, 0, 0, 0); // for font color
    275 
    276     // Render the text on the image
    277     imagettftext($logoimg, $fontsize, 0, $x, $y, $black, $font_file, $text);
    278 
    279     // Output the image
    280     imagepng($logoimg);
    281     $image_data = ob_get_contents();
    282     ob_end_clean();
    283     imagedestroy($logoimg); // Free memory
    284 
    285     return "data:image/png;base64," . base64_encode($image_data);
     350        $retArr['msg'] = 'Auth Failed!';
     351    }
     352    error_log('Glyph List Fetch Response: ' . print_r($retArr, true)); // Add logging
     353    wp_send_json($retArr);
     354    wp_die();
    286355}
    287356
    288357
    289     public function fontier_enqueue_styles()
    290     {
     358
     359    public function fontier_enqueue_styles() {
    291360        wp_enqueue_style('fontier-public', plugin_dir_url(__FILE__) . 'css/fontier-public.css', array(), $this->version, 'all');
    292361    }
  • fontier/trunk/public/css/fontier-public.css

    r3114702 r3129913  
    262262    margin:0;
    263263}
     264#fontier-glyph-generate h3{
     265        font-size: 24px;
     266    line-height: 1.4;
     267    margin-bottom: 20px;
     268}
     269.fontier-glyph-list{
     270    margin:0;
     271    padding:0;
     272    list-style:none;
     273    display: grid;
     274    grid-template-columns: repeat(10, 1fr);
     275    grid-template-rows: repeat(10, 1fr);
     276    grid-column-gap: 0px;
     277    grid-row-gap: 0px;
     278    border: .5px solid #ccc;
     279        border-radius: 3px;
     280}
     281.fontier-glyph-list li{
     282        width: 100% !important;
     283    height: auto !important;
     284    padding: 15px;
     285    border: .5px solid #ccc;
     286    min-height:140px;
     287    display: flex;
     288    flex-wrap: wrap;
     289    align-items: center;
     290    justify-content: center;
     291        border-radius: 3px;
     292}
     293#fontier-glyph-generate{
     294    margin-bottom:30px;
     295}
     296
     297/* Mobile view: 2 columns */
     298@media (max-width: 600px) {
     299    .fontier-glyph-list {
     300        grid-template-columns: repeat(3, 1fr);
     301    }
     302    .font-settings .text{
     303        width:100%;
     304    }
     305    .fontier-font-preview{
     306    width:100%;
     307    float:left;
     308}
     309}
     310
     311/* Tablet view: 3 columns */
     312@media (min-width: 601px) and (max-width: 900px) {
     313    .fontier-glyph-list {
     314        grid-template-columns: repeat(4, 1fr);
     315    }
     316     .font-settings .text{
     317        width:100%;
     318    }
     319    .fontier-font-preview{
     320    width:100%;
     321    float:left;
     322}
     323}
     324
     325/* Larger screens: 10 columns */
     326@media (min-width: 901px) {
     327    .fontier-glyph-list {
     328        grid-template-columns: repeat(10, 1fr);
     329    }
     330}
  • fontier/trunk/public/partials/fontier-public-display.php

    r3114702 r3129913  
    2626     }
    2727     
     28     $fontier_glyph_ebl =  $fontieroptions['fontier_glyph_ebl'];
     29     $fontier_glyph_text =  $fontieroptions['fontier_glyph_text'];
     30     
    2831?>
    2932<div class="clearfix">
    30     <div class="font-settings" data-settings="">
    31         <div class="text">
    32             <div id="fontier-font-loading" style="display: none;"><i class="zil zi-settings zi-spin"></i></div>
    33             <input class="settings-input" type="text" name="text" value="" data-default="<?php echo esc_html_e($previewtitle);?>" placeholder="Type here to preview text...">
    34         </div>
    35         <div class="font-settings-size">
    36             <a href="javascript:void(0)" data-size="24" class="s24">24pt</a>
    37             <a href="javascript:void(0)" data-size="36" class="s36 active">36pt</a>
    38             <a href="javascript:void(0)" data-size="48" class="s48">48pt</a>
    39             <a href="javascript:void(0)" data-size="72" class="s72">72pt</a>
    40         </div>
    41     </div>
     33    <div class="font-settings" data-settings="">
     34        <div class="text">
     35            <div id="fontier-font-loading" style="display: none;"><i class="zil zi-settings zi-spin"></i></div>
     36            <input class="settings-input" type="text" name="text" value="" data-default="<?php echo esc_html_e($previewtitle);?>" placeholder="Type here to preview text...">
     37        </div>
     38        <div class="font-settings-size">
     39            <a href="javascript:void(0)" data-size="24" class="s24">24pt</a>
     40            <a href="javascript:void(0)" data-size="36" class="s36 active">36pt</a>
     41            <a href="javascript:void(0)" data-size="48" class="s48">48pt</a>
     42            <a href="javascript:void(0)" data-size="72" class="s72">72pt</a>
     43        </div>
     44    </div>
    4245</div>
    4346<div class="clearfix">
    44     <div class="fontier-font-preview" style="visibility: visible;">
    45         <ul class="fontier-list">
    46             <li>
    47                 <span></span>
    48                 <div class="text-center"><i class="zil zi-settings zi-spin"></i> Loading preview, please wait...</div>
    49             </li>
    50         </ul>
    51     </div>
     47    <div class="fontier-font-preview" style="visibility: visible;">
     48        <ul class="fontier-list">
     49            <li>
     50                <span></span>
     51                <div class="text-center"><i class="zil zi-settings zi-spin"></i> Loading preview, please wait...</div>
     52            </li>
     53        </ul>
     54    </div>
    5255</div>
     56<?php if ($fontier_glyph_ebl){ ?>
     57<div id="fontier-glyph-generate">
     58   
     59</div>
     60<?php } ?>
    5361<script>
     62
    5463(function($) {
    5564    'use strict';
     
    7281            returnTypingPreview(storedText, size);
    7382        }
     83
     84        // Retrieve and display glyph list from the initial load
     85        fetchGlyphList();
    7486    });
    7587
     
    8294        jQuery('.settings-input').on("keyup paste", throttle(function() {
    8395            var text = jQuery(this).val();
     96            if (text.trim().length === 0) {
     97                text = jQuery('.settings-input').data('default');
     98                jQuery(this).val(text); // Set input value back to default
     99            }
    84100            localStorage.setItem('fontierInputText', text); // Save input value to local storage
    85             if (text.trim().length > 0) {
    86                 jQuery("#fontier-font-loading").show();
    87                 var size = jQuery(".font-settings-size a.active").data("size");
    88                 returnTypingPreview(text, size);
    89             } else {
    90                 text = jQuery('.settings-input').data('default');
    91             }
     101            jQuery("#fontier-font-loading").show();
     102            var size = jQuery(".font-settings-size a.active").data("size");
     103            returnTypingPreview(text, size);
    92104        }));
    93105
     
    140152            'font_loader_field': jQuery('#font_loader_field').val()
    141153        };
    142         console.log('Sending AJAX request with data:', data);
     154        console.log('Sending AJAX request with data:', data); // Add logging
    143155        jQuery.ajax({
    144156            type: 'POST',
     
    163175                    }
    164176                    jQuery('.fontier-font-preview ul').html(image_html);
     177
    165178                } else {
    166179                    jQuery('.fontier-font-preview ul').html('<li>No preview available.</li>');
     
    174187        });
    175188    }
     189
     190    function fetchGlyphList() {
     191        var pid = '<?php echo esc_html($id); ?>';
     192        var data = {
     193            'auth': '<?php echo wp_create_nonce('_prevnounce'); ?>',
     194            'pid': pid,
     195            'action': 'fetchGlyphList'
     196        };
     197        console.log('Fetching glyph list with data:', data); // Add logging
     198        jQuery.ajax({
     199            type: 'POST',
     200            url: '<?php echo admin_url('admin-ajax.php'); ?>',
     201            dataType: 'json',
     202            data: data,
     203            error: function(data, transport) {
     204                console.log('Error fetching glyph list:', data); // Add logging
     205            },
     206            success: function(result) {
     207                console.log('Fetched glyph list successfully. Result:', result); // Add logging
     208                if (result.status === 1) {
     209                    displayGlyphList(result.glyphs);
     210                }
     211            }
     212        });
     213    }
     214
     215    function displayGlyphList(glyphList) {
     216        if (glyphList && glyphList.length > 0) {
     217            var glyph_html = '<h3><?php echo esc_html($fontier_glyph_text);?></h3><ul class="fontier-glyph-list">';
     218            for (var j = 0; j < glyphList.length; j++) {
     219                glyph_html += '<li><img src="' + glyphList[j].image + '" alt="' + glyphList[j].char + '" /></li>';
     220            }
     221            glyph_html += '</ul>';
     222            console.log('Displaying glyph list:', glyph_html); // Add logging
     223            jQuery('#fontier-glyph-generate').html(glyph_html);
     224        }
     225    }
    176226})(jQuery);
    177227
  • fontier/trunk/readme.txt

    r3115108 r3129913  
    11=== Fontier -Font Preview Plugin for Easy Digital Downloads ===
    22Contributors: Teconce, nstuhin, apuzaman
    3 Tags: elementor, elements, font preview, elementor addon, elementor widget
     3Tags: elementor, elements, addons, elementor addon, elementor widget, page-builder, wordpress page builder
    44Requires at least: 5.6
    55Requires PHP:7.4
    6 Tested up to: 6.5
    7 Stable tag: 1.1
     6Tested up to: 6.5.5
     7Stable tag: 1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1818
    1919Built-in font preview features. It will take font from your EDD downloadable file. First, unzip it & create a folder inside WP Upload & Render it from the frontend.
    20 Take a look at the demo:  [demo preview](https://mayo.teconcetheme.com/mayofont/downloads/pt-serif-font-family/).
     20Take a look at the demo:  [demo preview](https://mayosis.themepreview.xyz/mayofont/downloads/chewy-font-family-typeface/).
    2121
    2222
     
    5050== Changelog ==
    5151
     52= 1.2 =
     53* Glyph list system added
     54* Glyph enable disable option added
     55* Other Improvement
     56
    5257= 1.1 =
    5358* OTF Supports added
     
    5863* CSS Issues Fixed
    5964* Bug fixed
    60 
    61 
    6265
    6366= 1.0.4 =
Note: See TracChangeset for help on using the changeset viewer.