Plugin Directory

Changeset 1885230


Ignore:
Timestamp:
06/01/2018 04:26:36 AM (8 years ago)
Author:
kvvaradha
Message:

Standard fonts enable disable feature added with it

Location:
kv-tinymce-editor-fonts/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kv-tinymce-editor-fonts/trunk/kv_fonts.php

    r1640599 r1885230  
    77Version: 1.1
    88Author URI: http://profiles.wordpress.org/kvvaradha
    9 
    109*/
    1110
    1211define('KV_FONT_TINYMCE_URL', plugin_dir_url( __FILE__ ));
     12
     13if(!function_exists('kv_tinymce_fonts_deactivate')) {
     14    function kv_tinymce_fonts_deactivate(){
     15        if ( ! current_user_can( 'activate_plugins' ) )
     16            return;
     17        $plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : '';
     18        check_admin_referer( "deactivate-plugin_{$plugin}" );
     19        update_option( 'ShowDefaultFonts', '1');
     20        add_filter("mce_buttons_3", "kv_add_font_family_size");
     21    }
     22
     23    register_deactivation_hook( __FILE__, 'kv_tinymce_fonts_deactivate' );
     24}
    1325
    1426if(!function_exists('kv_admin_menu')) {
     
    178190
    179191function kv_custom_font_list($in){
     192
     193    if(get_option('ShowDefaultFonts') == 1 ){
     194        $in['font_formats'] = "Arial=arial,helvetica,sans-serif;".
     195            "Arial Black=arial black,avant garde;".
     196            "Comic Sans MS=comic sans ms,sans-serif;".
     197            "Courier New=courier new,courier;".
     198            "Georgia=georgia,palatino;".
     199            "Helvetica=helvetica;".
     200            "Tahoma=tahoma,arial,helvetica,sans-serif;".
     201            "Terminal=terminal,monaco;".
     202            "Times New Roman=times new roman,times;".
     203            "Trebuchet MS=trebuchet ms,geneva;".
     204            "Verdana=verdana,geneva;";
     205    } else {
     206        $in['font_formats'] = '';
     207    }
    180208    if ( get_option( 'KvcodesGoogleFonts' ) !== false ){
    181209        $KvcodesGoogleFonts   = get_option( 'KvcodesGoogleFonts' );
     
    184212            $kvfont_formats .= $singleFont.'='.$singleFont.';';
    185213        }
    186         $in['font_formats']= $kvfont_formats;
     214        $in['font_formats'] .= $kvfont_formats;
    187215    }else
    188         $in['font_formats']= 'Open Sans=Open Sans; Josefin=Josefin; Slab=Slab; Arvo=Arvo; Lato=Lato; Vollkorn=Vollkorn; Ubuntu=Ubuntu; Old Standard TT=Old Standard TT; Droid Sans=Droid Sans; Roboto=Roboto; Oswald=Oswald; Source Sans Pro=Source Sans Pro' ;     
     216        $in['font_formats'] .= 'Open Sans=Open Sans; Josefin=Josefin; Slab=Slab; Arvo=Arvo; Lato=Lato; Vollkorn=Vollkorn; Ubuntu=Ubuntu; Old Standard TT=Old Standard TT; Droid Sans=Droid Sans; Roboto=Roboto; Oswald=Oswald; Source Sans Pro=Source Sans Pro' ;       
    189217   
    190218    $in['fontsize_formats'] = "9px 10px 12px 13px 14px 16px 18px 21px 24px 28px 32px 36px";
    191219 return $in;
    192220}
     221
     222       
    193223add_filter('tiny_mce_before_init', 'kv_custom_font_list' );
    194224
     
    200230        $fontsList = get_option('KvcodesGoogleFonts');
    201231        if ( get_option( 'KvcodesGoogleFonts' ) !== false ) {
    202             update_option( 'KvcodesGoogleFonts', $_POST['KvcodesGoogleFonts'] );
     232            update_option( 'KvcodesGoogleFonts', $_POST['KvcodesGoogleFonts'] );           
    203233        } else{
    204             add_option( 'KvcodesGoogleFonts', $_POST['KvcodesGoogleFonts'] );
     234            add_option( 'KvcodesGoogleFonts', $_POST['KvcodesGoogleFonts'] );           
     235        }
     236
     237        $fontsList = get_option('ShowDefaultFonts');
     238        if ( get_option( 'ShowDefaultFonts' ) !== false ) {
     239            update_option( 'ShowDefaultFonts', (isset($_POST['ShowDefaultFonts']) ? '1' : '0')  );
     240        } else {
     241            add_option( 'ShowDefaultFonts', (isset($_POST['ShowDefaultFonts']) ? '1' : '0') );
    205242        }
    206243    }
     
    244281                            </td>
    245282                            </tr>
     283                            <tr>
     284                                <td> Show Default Fonts </td>
     285                                <td> <input type="checkbox" name="ShowDefaultFonts" value="1" <?php echo ((get_option('ShowDefaultFonts') !== false && get_option('ShowDefaultFonts') == 1 )? 'checked' : '') ; ?> > </td>
     286                            </tr>
    246287                            </tbody>
    247288                        </table>
     289
    248290                        <p class="submit" style="margin-left: 5%;"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    249291                        </form>
  • kv-tinymce-editor-fonts/trunk/readme.txt

    r1641249 r1885230  
    44Tags: tinymce editor, google fonts tinymce editor, kvcodes, Google Fonts, WordPress Google Webfonts, webfonts, WordPress Google Fonts Plugin
    55Requires at least: 3.1
    6 Tested up to: 4.7
     6Tested up to: 4.9.6
    77License: GPL
    88
     
    2020* Simple Set-up, Less space consuming
    2121* Google Web Fonts added
     22* You can have an option to enable and disable default fonts list
    2223
    2324 
Note: See TracChangeset for help on using the changeset viewer.