Plugin Directory

Changeset 2028234


Ignore:
Timestamp:
02/10/2019 10:54:47 PM (7 years ago)
Author:
agusph
Message:

Update files to version 1.3.1

Location:
aph-prism-highlighter/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • aph-prism-highlighter/trunk/includes/aphph-admin-editor.php

    r2017203 r2028234  
    11<?php
     2/*
     3* TnyMCE Editor
     4*/
    25class Aphph_Admin_Editor
    36{
     
    6366                continue;
    6467           
    65             $lang_name = $this->options_phdata['lang-list'][$lang];
    66             $selected = $lang == $this->options['default-lang'] ? ' selected="selected"' : '';
    67             $lang_options .= '<option value="' . $lang . '"' . $selected . '>' . $lang_name . '</option>';
     68            $item = $this->options_phdata['lang-list'][$lang];
     69            if ($item) {
     70                $title = $item;
     71                if (is_array($item)) {
     72                    $title = $item['title'];
     73                    if (key_exists('aliasTitles', $item)) {
     74                        $title .= ' / ' . join($item['aliasTitles'], ' / ');
     75                    }
     76                }
     77                $selected = $lang == $this->options['default-lang'] ? ' selected="selected"' : '';
     78                $lang_options .= '<option value="' . $lang . '"' . $selected . '>' . $title . '</option>';
     79            }
    6880        }
    6981       
     
    7789            <div class="aphph-editor-body" id="aphph-editor-body">
    7890                <div class="aphph-inline-options aphph-clearfix">
    79                     <span>Language</span>
    80                     <select name="aphph-language" id="aphph-language">'.
     91                    <div><span>Language</span>
     92                    <select name="aphph-language" id="aphph-language" style="float:none">'.
    8193                        $lang_options . '
    8294                    </select>
     95                    </div>
     96                    <div>
    8397                    <span class="aphph-te-section">Highlight Line</span>
    8498                    <input type="text" class="aphph-small-text" name="aphph_highlight_lines" id="aphph-highlight-lines"/><span class="description">e.q: 1,2,3-6</span>
     99                    </div>
    85100                   
    86101                </div>
  • aph-prism-highlighter/trunk/includes/aphph-admin.php

    r2028055 r2028234  
    110110    public function ajax_no_priv()
    111111    {
    112         // echo 'xxx';  die;
    113112       
    114113    }
     
    148147            update_option(APHPH_OPTION_PHDATA, $this->components_list);
    149148            add_action('wp_head', array($this, 'build_files'));
    150         }   
     149        }
     150       
     151        update_option(APHPH_OPTION_PHDATA, $this->components_list);
    151152    }
    152153   
     
    158159            update_option(APHPH_OPTION_VERSION, APHPH_PLUGIN_VERSION);
    159160            update_option(APHPH_OPTION_PHDATA, $this->components_list);
    160             if (!$plugin_option_version || $plugin_option_version < 1.2)
     161            if (!$plugin_option_version || $plugin_option_version < '1.3.1')
    161162            {
    162                 $msg = 'APH PRISM HIGHLIGHTER v' . APHPH_PLUGIN_VERSION . ' Language added: Dark Plain and Light Plain';
     163                $msg = 'APH PRISM HIGHLIGHTER v' . APHPH_PLUGIN_VERSION . ' Update the prism core, update compatibilities to WordPress 5, and several bug fixes';
    163164                $this->admin_notices->add_notice($msg, 'success', false, true);
    164165            }               
     
    185186                'nonce' => wp_create_nonce('aphph-admin-all'),
    186187                'ajaxurl' => admin_url('admin-ajax.php')
    187                
    188188            )
    189189        );
     
    346346    public function option_language_list() {
    347347   
    348         $lang_used = $this->data_options['lang-used'];
     348        $lang_used = $this->options['lang-used'];
    349349        echo '<div class="aphph-langused-container aphph-clearfix" id="aphph-langused-container">';
    350350       
     
    354354        foreach ($lang_used as $lang)
    355355        {
     356            // Fallback to old plugin version
     357            if (strtolower($lang) == 'core')
     358                continue;
    356359           
    357360            $lang_item = $lang_list[$lang];
     
    411414   
    412415        // CREATE LIST OF ALL AVAILABLE LANGUAGES - Built in languages
    413         //
    414416        echo '<div class="aphph-langlist-container" id="aphph-langlist-container">';
    415417       
     
    421423                   
    422424        // Languages
    423         // echo '<pre>'; print_r($lang_list);
    424425        foreach ($lang_list as $lang_key => $item)
    425426        {
    426427            $msg = '';
    427             // Built in language
    428428            if (substr($lang_key, 0, 3) != 'add')
    429429            {   
    430                
    431430                $file_name = 'prism-'.$lang_key.'.min.js';
    432431               
     
    455454   
    456455    public function option_default_language() {
    457        
    458456        $lang_used = $this->options['lang-used'];
    459        
    460457        echo '<select name="' . APHPH_OPTION . '[default-lang]" id="opt-aphph-default-lang">';
    461458        foreach($lang_used as $lang)
     
    465462           
    466463            $selected = $this->options['default-lang'] == $lang ? ' selected="selected"' : '';
    467             echo '<option value="'.$lang.'"' . $selected . '>' . $this->options_phdata['lang-list'][$lang] . '</option>';
     464            $item = $this->components_list['lang-list'][$lang];
     465       
     466            $title = $item;
     467            if (is_array($item)) {
     468               
     469                $title = $item['title'];
     470                if (key_exists('aliasTitles', $item)) {
     471                    $title .= ' / ' . join($item['aliasTitles'], ' / ');
     472                }
     473            }
     474            echo '<option value="'.$lang.'"' . $selected . '>' . $title . '</option>';
     475            // echo '<option value="'.$lang.'"' . $selected . '>' . $this->options_phdata['lang-list'][$lang] . '</option>';
    468476        }
    469477        echo '</select>
  • aph-prism-highlighter/trunk/includes/aphph-admin_plugin.php

    r2028055 r2028234  
    346346    public function option_language_list() {
    347347   
    348         $lang_used = $this->data_options['lang-used'];
     348        $lang_used = $this->options['lang-used'];
    349349        echo '<div class="aphph-langused-container aphph-clearfix" id="aphph-langused-container">';
    350350       
     
    354354        foreach ($lang_used as $lang)
    355355        {
     356            // AFallback to old plugin version
     357            if (strtolower($lang) == 'core')
     358                continue;
    356359           
    357360            $lang_item = $lang_list[$lang];
  • aph-prism-highlighter/trunk/includes/aphph-build.php

    r2028055 r2028234  
    112112       
    113113        // Get theme css
     114        if (strtolower($options['theme']) == 'default')
     115            $options['theme'] = 'prism';
    114116        $prism_css = file_get_contents($path . 'themes' . APHPH_DS . $options['theme']. '.css');
    115117       
  • aph-prism-highlighter/trunk/includes/aphph-build_plugin.php

    r2028055 r2028234  
    8888       
    8989        // Get theme css
    90         $theme_name = $options['theme'] == 'default' ? '' : '-'.$options['theme'];
    91         $prism_css = file_get_contents($path . 'themes' . APHPH_DS . 'prism' . $theme_name. '.css');
     90        if (strtolower($options['theme']) == 'default')
     91            $options['theme'] = 'prism';
     92        $prism_css = file_get_contents($path . 'themes' . APHPH_DS . $options['theme']. '.css');
    9293       
    9394        // Get plugins css
  • aph-prism-highlighter/trunk/includes/aphph-config.php

    r2028055 r2028234  
    11<?php
    22// Config for backend and frontend
    3 define ('APHPH_PLUGIN_VERSION', '1.2');
     3define ('APHPH_PLUGIN_VERSION', '1.3.1');
    44
    55define ('APHPH_OPTION', 'aphph_options');
  • aph-prism-highlighter/trunk/js/aphph-tinymce.js

    r2017203 r2028234  
    77        $aphph_btn = '',
    88        default_lang = 'php';
     9        $cursor_node = '';
    910        new_lang = default_lang,
    1011       
     
    1718        init : function(ed, url)
    1819        {
    19             ed.onKeyUp.add(function(){
     20            ed.onKeyUp.add(function(e, elm){
    2021                checkCursor();
    2122            });
     
    200201                            return;
    201202                        }
    202                         ed.insertContent('<pre class="' + class_name + '">' + encoded_html + '</pre><br/>');
     203                       
     204                        $pre = $('<pre class="' + class_name + '">' + encoded_html + '</pre>');
     205                        // $cursor_node.append($pre);
     206                        $(ed.targetElm).find($cursor_node).append($pre.removeClass('aphph-pretag-focused'));
     207                       
     208                        // $prev = $cursor_node.find($pre).prev();
     209                        $prev = $(ed.targetElm).find($pre).prev();
     210                       
     211                        if ($prev.length > 0) {
     212                            if ($prev.prop("tagName").toLowerCase() == 'br') {
     213                                $prev.remove();
     214                            }
     215                        }
    203216                        // node_pre_onclick = $(ed.editorContainer).find('iframe').contents().find('pre[class*="aphph-pretag-focused"]');
    204217                    }
     
    213226            function setAphshBtn() {
    214227                if (!$aphph_btn) {
    215                     $aphph_btn = $(ed.editorContainer).find("div[class*='aphph-btn']");
     228                    // $aphph_btn = $(ed.editorContainer).find("div[class*='aphph-btn']");
     229                    $aphph_btn = $(ed.targetElm).prev().find("div[class*='aphph-btn']");
     230                   
    216231                }
    217232            }
     
    242257               
    243258                if (!$iframe_body) {
    244                     $iframe_body = $(ed.editorContainer).find('iframe').contents().find('body');
    245                 }
     259                    $iframe_body = $(ed.targetElm);
     260                }
     261               
    246262                $iframe_body.find('pre').removeClass('aphph-pretag-focused');
    247263                pre_tag_highlighted = 0;
     
    255271                {
    256272                    var classes = $cursor_node.attr('class');
    257                     if (classes.match(/lang\s*:/))
    258                     {
    259                         removeHighlightPre();
    260                         highlightAphshBtn();
    261                         $cursor_node.addClass('aphph-pretag-focused');
    262                     } else {
    263                         removeHighlightPre();
    264                         removeHighlightAphshBtn();
     273                    if (classes) {
     274                        if (classes.match(/lang\s*:/))
     275                        {
     276                            removeHighlightPre();
     277                            highlightAphshBtn();
     278                            $cursor_node.addClass('aphph-pretag-focused');
     279                        } else {
     280                            removeHighlightPre();
     281                            removeHighlightAphshBtn();
     282                        }
    265283                    }
    266284                } else {
  • aph-prism-highlighter/trunk/readme.txt

    r2028055 r2028234  
    44Requires at least: 3.5
    55Tested up to: 5.0.3
    6 Stable tag: 1.3.1
     6Stable tag: 1.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5656== Changelog ==
    5757
    58 = 1.3.1 February 10, 2019) =
    59 * Bug fixed due to the dependency changes on the newest prismjs core
    60 
    6158= 1.3 January 20, 2019) =
    6259* Add support to classic editor on Guttenberg
Note: See TracChangeset for help on using the changeset viewer.