Plugin Directory

Changeset 1238493


Ignore:
Timestamp:
09/05/2015 03:46:33 AM (10 years ago)
Author:
arickards
Message:

Added new settings page with various settings

Location:
tinywym-editor/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • tinywym-editor/trunk/css/tinywym-styles.css

    r1216264 r1238493  
    77.tiny-wym body {
    88    background: #f4f4f4;
     9    font-size: 16px;
    910}
    1011
     
    1617.tiny-wym img {
    1718    max-width: 100%;
     19    height: auto;
    1820}
    1921
  • tinywym-editor/trunk/js/mce-plugin.js

    r1216264 r1238493  
    178178                    classes: 'cancel',
    179179                    onclick: 'close',
     180                    styles: 'color: red; float: right;'
    180181                },
    181182                {
  • tinywym-editor/trunk/languages/twym_editor.pot

    r1216264 r1238493  
    44"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
    55"Project-Id-Version: tinyWYM Editor\n"
    6 "POT-Creation-Date: 2015-08-06 18:27+1000\n"
    7 "PO-Revision-Date: 2015-08-06 18:27+1000\n"
     6"POT-Creation-Date: 2015-09-05 13:40+1000\n"
     7"PO-Revision-Date: 2015-09-05 13:39+1000\n"
    88"Last-Translator: \n"
    99"Language-Team: \n"
     
    2020"X-Poedit-SearchPath-0: .\n"
    2121"X-Poedit-SearchPathExcluded-0: *.js\n"
     22
     23#: tinywym-editor.php:49
     24msgid "Settings"
     25msgstr ""
    2226
    2327#: translations.php:14
     
    5357msgstr ""
    5458
     59#: twym-admin-settings.php:19 twym-admin-settings.php:50
     60msgid "tinyWYM Editor Settings"
     61msgstr ""
     62
    5563#. Plugin Name of the plugin/theme
     64#: twym-admin-settings.php:20
    5665msgid "tinyWYM Editor"
    5766msgstr ""
    5867
     68#: twym-admin-settings.php:41
     69msgid "administrator"
     70msgstr ""
     71
     72#: twym-admin-settings.php:42
     73msgid "editor"
     74msgstr ""
     75
     76#: twym-admin-settings.php:43
     77msgid "author"
     78msgstr ""
     79
     80#: twym-admin-settings.php:44
     81msgid "contributor"
     82msgstr ""
     83
     84#: twym-admin-settings.php:66
     85#, php-format
     86msgid "%s Settings"
     87msgstr ""
     88
     89#: twym-admin-settings.php:70
     90#, php-format
     91msgid "Disable for %ss"
     92msgstr ""
     93
     94#: twym-admin-settings.php:78
     95msgid "Compatibility"
     96msgstr ""
     97
     98#: twym-admin-settings.php:80
     99msgid ""
     100"Some plugins, such as Beaver Builder, disable other editor plugins when "
     101"using custom instances of the WordPress editor. Check the box below if "
     102"tinyWYM Editor appears to be disabled in some editor instances."
     103msgstr ""
     104
     105#: twym-admin-settings.php:84
     106msgid "Force enable tinyWYM Editor"
     107msgstr ""
     108
     109#: twym-admin-settings.php:90
     110msgid "Theme Editor Styles"
     111msgstr ""
     112
     113#: twym-admin-settings.php:92
     114msgid ""
     115"Many themes include their own editor stylesheet which may cause conflicts "
     116"with tinyWYM Editor's own stylesheet. If you would like to allow your "
     117"theme's editor stylesheet to load anyway, check the box below."
     118msgstr ""
     119
     120#: twym-admin-settings.php:96
     121msgid "Allow theme editor styles"
     122msgstr ""
     123
     124#: twym-admin-settings.php:104
     125msgid "Save Settings"
     126msgstr ""
     127
    59128#. Description of the plugin/theme
    60 msgid "Converts WordPress's WYSIWYG visual editor into a WYSIWYM editor"
     129msgid ""
     130"tinyWYM Editor converts WordPress's WYSIWYG visual editor into a WYSIWYM "
     131"editor. tinyWYM Editor also give the the control anf flexibility of the text "
     132"editor without having to leave the visual editor."
    61133msgstr ""
    62134
  • tinywym-editor/trunk/readme.txt

    r1218764 r1238493  
    33Tags: tinyMCE, WYSIWYM, WP Editor
    44Requires at least: 4.2.0
    5 Tested up to: 4.2.3
    6 Stable tag: 1.0.1
     5Tested up to: 4.3
     6Stable tag: 1.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3737= How do I create an HTML element from a selection? =
    3838
    39 To create a new element from a selection first select some text. tinyWYM Editor plugin adds a new button to the toolbar. Click it and a dialogue will appear with a field for your new tag and any attributes you want to give it. Click the 'Okay' button. (You can also hit Ctrl+T instead of clicking the button to open the dialogue.)
     39To create a new element from a selection first select some text. tinyWYM Editor plugin adds a new button to the toolbar. Click it and a dialogue will appear with a field for your new tag and any attributes you want to give it. Enter your new HTML tag and any desired attributes, then click the 'Okay' button. (You can also hit Ctrl+T instead of clicking the button to open the dialogue.)
    4040
    4141= How do I wrap one HTML element in another HTML element? =
    4242
    43 To wrap an element in another element, place the caret inside the element that you want to wrap. tinyWYM Editor plugin adds a new button to the toolbar. Click it and a dialogue will appear with a field for your new tag and any attributes you want to give it. Click the 'Okay' button. (You can also hit Ctrl+T instead of clicking the button to open the dialogue.)
     43To wrap an element in another element, place the caret inside the element that you want to wrap. tinyWYM Editor plugin adds a new button to the toolbar. Click it and a dialogue will appear with a field for your new tag and any attributes you want to give it. Enter your new HTML tag and any desired attributes, then click the 'Okay' button. (You can also hit Ctrl+T instead of clicking the button to open the dialogue.)
    4444
    4545= How do I edit or add attributes to an HTML element? =
    4646
    47 Click any element while holding the Alt key and a dialogue will appear where you can edit the current HTML tag and any attributes it might have or you want to give it. Click the 'Okay' button.
     47Click any element while holding the Alt key and a dialogue will appear where you can edit the current HTML tag and any attributes it might have or you want to give it. Enter your new HTML tag and any desired attributes, then click the 'Okay' button.
    4848
    4949= How do I unwrap an HTML element from its parent element or remove text from its containing element? =
    5050
    51 Click any element while holding the Shift+Alt and that element will be removed from the markup but preserve any inner text or child elements.
     51Click any element while holding the Shift+Alt and that element will be removed from the markup preserving any inner text or child elements.
    5252
    5353= Why does tinyWYM Editor remove my theme's editor styles? =
    5454
    55 tinyWYM Editor removes the current theme's editor stylesheet. It does this partly in order to prevent conflicts with the theme's editor styles, but mainly because it is assumed that if you are using tinyWYM editor it is because you want to see the markup being posted to the front end of the site and not what it will eventually look like. After all, that is what the plugin is for.
     55tinyWYM Editor removes the current theme's editor stylesheet by default, however, you can enable your theme's editor stylesheet by going to Settings - tinyWYM Editor and checking 'Allow theme editor styles'. tinyWYM Editor removes other editor styles partly in order to prevent conflicts, but also because it is assumed that if you are using tinyWYM editor it is because you want to see the _markup_ being posted to the front end of the site and not what it will eventually look like. After all, that is what the plugin is for.
     56
     57= Can I disable tinyWYM Editor for certain users =
     58
     59tinyWYM Editor allows administrators to disable tinyWYM for particular user roles; Administrators, Editors, Authors, or Contributors. Go to Settings - tinyWYM Editor.
    5660
    5761== Screenshots ==
     
    60642. With tinyWYM installed: empty tags and superfluous markup revealed.
    61653. tinyWYM Editor converts WordPress's WYSIWYG editor into a WYSIWYM editor.
    62 4. Create any HTML tag from selection - Select text then click the button or hit Ctrl+T.
    63 5. Wrap the current element in a new HTML element - Place caret in element you want to wrap, then click the button or hit Ctrl+T.
    64 6. Wrap multiple elements in a new HTML element - Select elements you want to wrap, then click the button or hit Ctrl+T.
     664. Create any HTML tag from selection: Select text then click the button or hit Ctrl+T.
     675. Wrap the current element in a new HTML element: Place caret in element you want to wrap, then click the button or hit Ctrl+T.
     686. Wrap multiple elements in a new HTML element: Select elements you want to wrap, then click the button or hit Ctrl+T.
    65697. Enter the new HTML tag name and any attributes you want it to have, then click 'Okay'.
    66708. Elements are now wrapped in a new tag.
    67 9. Edit any element - Alt+Click any element then edit its tag and attributes.
     719. Edit any element: Alt+Click any element then edit its tag and attributes.
    6872
    6973== Changelog ==
     74
     75= 1.1 =
     76
     77* Added new settings page
     78* Added option for admins to disable tinyWYM for Administrators, Editors, Authors, or Contributors.
     79* Added option to re-enable the current theme's editor styles.
     80* Added option to increase tinyWYM priority when loading scripts. (This was mainly to allow tinyWYM to work with BeaverBuilder's front end editor.)
     81
     82= 1.0.2 =
     83
     84* CSS improvements
     85* Increase script loading priority to allow for use with beaverbuilder
    7086
    7187= 1.0.1 =
     
    7995== Upgrade Notice ==
    8096
     97= 1.1 =
     98
     99* Added new setting page: Setting - tinyWYM Editor
     100
     101= 1.0.2 =
     102
     103* Improved CSS for images inside editor, plus tinyWYM is now works with beaverbuilder
     104
    81105= 1.0 =
    82106
  • tinywym-editor/trunk/tinywym-editor.php

    r1216766 r1238493  
    22/*
    33Plugin Name: tinyWYM Editor
    4 Description: Converts WordPress's WYSIWYG visual editor into a WYSIWYM editor
    5 Version:     1.0.1
     4Description: tinyWYM Editor converts WordPress's WYSIWYG visual editor into a WYSIWYM editor. tinyWYM Editor also give the the control anf flexibility of the text editor without having to leave the visual editor.
     5Version:     1.1
    66Author:      Andrew Rickards
    77License:     GPL-2.0+
     
    2525*/
    2626
    27 //* If this file is called directly, abort ====================================
     27//* If this file is called directly, abort ==================================== */
    2828if ( ! defined( 'ABSPATH' ) ) {
    2929    exit;
    3030}
    3131
    32 //* Load Plugin textdomain ====================================================
     32//* Load Plugin textdomain ==================================================== */
    3333add_action( 'plugins_loaded', 'twym_load_textdomain' );
    3434
     
    3939}
    4040
    41 //* Remove Theme's Editor Stylesheet ==========================================
    42 add_action( 'admin_init', 'twym_remove_editor_styles' );
     41//* Admin Settings ============================================================ */
     42include 'twym-admin-settings.php';
     43
     44//* Plugins Page Settings Link
     45add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'twym_settings_link' );
     46
     47function twym_settings_link ( $links ) {
     48
     49    $links[] = '<a href="' . admin_url( 'options-general.php?page=tinywym-settings' ) . '">' . __( 'Settings', 'twym_editor' ) . '</a>';
     50
     51    return $links;
     52}
     53
     54//* Remove Theme's Editor Stylesheet ========================================== */
     55add_action( 'admin_init', 'twym_remove_editor_styles', 999 );
    4356
    4457function twym_remove_editor_styles() {
     58
     59    $settings = get_option( 'twym_settings' );
     60    $theme_styles = isset( $settings[ 'theme_styles' ] ) ? '1' : false;
     61
     62    if ( '1' === $theme_styles ) {
     63        return;
     64    }
    4565
    4666    remove_editor_styles();
     
    4868}
    4969
    50 //* Add Editor Stylesheet =====================================================
     70//* Add Editor Stylesheet ===================================================== */
    5171add_filter( 'mce_css', 'twym_add_editor_styles' );
    5272
     
    6383}
    6484
    65 //* Register tinyMCE Plugin & Button ==========================================
     85//* Register tinyMCE Plugin & Button ========================================== */
    6686add_action( 'init', 'twym_register_mce_plugin' );
    6787
    6888function twym_register_mce_plugin() {
     89
     90    // Get tinyWYM Settings
     91    $settings = get_option( 'twym_settings' );
     92    $disabled = isset( $settings[ 'disable' ] ) ? $settings[ 'disable' ] : [];
     93    $priority = isset( $settings[ 'force_enable' ] ) ? 99999999 : 10;
     94
     95    // Extract user roles disabled in settings
     96    extract( $disabled );
     97
     98    // Define user capabilities
     99    $admin_capabilities       = current_user_can( 'manage_options' );
     100    $editor_capabilities      = current_user_can( 'edit_pages' )           && ! current_user_can( 'manage_options' )       ? true : false;
     101    $author_capabilities      = current_user_can( 'edit_published_posts' ) && ! current_user_can( 'edit_pages' )           ? true : false;
     102    $contributor_capabilities = current_user_can( 'edit_posts' )           && ! current_user_can( 'edit_published_posts' ) ? true : false;
     103
     104    // Disable editor for various various user roles
     105    if ( isset( $administrator ) && $admin_capabilities ) {
     106        return;
     107    }
     108
     109    if ( isset( $editor ) && $editor_capabilities ) {
     110        return;
     111    }
     112
     113    if ( isset( $author ) && $author_capabilities ) {
     114        return;
     115    }
     116
     117    if ( isset( $contributor ) && $contributor_capabilities ) {
     118        return;
     119    }
    69120
    70121    // Check user permissions
     
    76127    if ( get_user_option('rich_editing') == 'true') {
    77128
    78         add_filter( 'mce_external_plugins', 'twym_add_mce_plugin' );
    79         add_filter( 'mce_buttons', 'twym_register_mce_button' );
     129        add_filter( 'mce_external_plugins', 'twym_add_mce_plugin', $priority );
     130        add_filter( 'mce_buttons', 'twym_register_mce_button', $priority );
    80131
    81132        // Admin Styles for Modal Form
     
    83134
    84135    }
     136
     137    // Tranlations
     138    add_filter( 'mce_external_languages', 'twym_load_translation');
    85139
    86140}
     
    104158}
    105159
    106 //* Enqueue Admin Styles for Modal Form =======================================
     160//* Enqueue Admin Styles for Modal Form ======================================= */
    107161function twym_enqueue_admin_style() {
    108162
     
    112166}
    113167
    114 //* Load Translation File =====================================================
    115 add_filter( 'mce_external_languages', 'twym_load_translation');
    116 
     168//* Load Translation File ===================================================== */
    117169function twym_load_translation( $locales ) {
    118170
Note: See TracChangeset for help on using the changeset viewer.