WordPress.org

Ready to get started?Download WordPress

Forums

Ultimate TinyMCE
Bug report: relative path causes problems (10 posts)

  1. redcocker
    Member
    Posted 2 years ago #

    Hi,

    Thanks good plugin!

    Ultimate TinyMCE contains relative path names.

    ../../../../wp-content/plugins/ultimate-tinymce/img/normal.png

    But they may cause problems.
    Because It's not always true that WordPress is installed in root directory.

    If WordPress was installed in www.eample.com/blog/, images will disappear in setting panel.

    http://wordpress.org/extend/plugins/ultimate-tinymce/

  2. redcocker
    Member
    Posted 2 years ago #

    I modified main.php to correct this issue and shared it.

    http://www.near-mint.com/blog/download/ultimate-tinymce.1.5.5.zip

    Note: This file includes main.php file for ver. 1.5.5

  3. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 2 years ago #

    Thank you very very much!! I didn't think about that when writing the code.

    I am going to make your adjustments to my new main.php file, since I just rewrote it to include language localization support. And I will most certainly give you credit in the update changelog.

    So, were the only places you did this is in the image calls?

    For example, this:

    function jwl_fontselect_callback_function() {
     	echo '<input name="jwl_fontselect_field_id" id="fontselect" type="checkbox" value="1" class="code" ' . checked( 1, get_option('jwl_fontselect_field_id'), false ) . ' /> ';
    	?><img src="../../../../wp-content/plugins/ultimate-tinymce/img/fontselect.png" style="margin-left:10px;margin-bottom:-5px;" /><?php
     }

    To this:

    function jwl_fontselect_callback_function() {
     	echo '<input name="jwl_fontselect_field_id" id="fontselect" type="checkbox" value="1" class="code" ' . checked( 1, get_option('jwl_fontselect_field_id'), false ) . ' /> ';
    	?><img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/fontselect.png" style="margin-left:10px;margin-bottom:-5px;" /><?php
     }
  4. redcocker
    Member
    Posted 2 years ago #

    >So, were the only places you did this is in the image calls?

    I also modified following lines.

    Line 106-108

    array( 'title' => 'Normal Alert', 'block' => 'p', 'styles' => array( 'border' => 'solid 1px #DEDEDE', 'background' => '#EFEFEF url(../../../../wp-content/plugins/ultimate-tinymce/img/normal.png) 8px 4px no-repeat', 'color' => '#222222' , 'padding' => '4px 4px 4px 30px' , 'text-align' => 'left'  )),
    array( 'title' => 'Green Alert', 'block' => 'p', 'styles' => array( 'border' => 'solid 1px #1EDB0D', 'background' => '#A9FCA2 url(../../../../wp-content/plugins/ultimate-tinymce/img/green.png) 8px 4px no-repeat', 'color' => '#222222' , 'padding' => '4px 4px 4px 30px' , 'text-align' => 'left'  )),
    array( 'title' => 'Yellow Alert', 'block' => 'p', 'styles' => array( 'border' => 'solid 1px #F5F531', 'background' => '#FAFAB9 url(../../../../wp-content/plugins/ultimate-tinymce/img/yellow.png) 8px 4px no-repeat', 'color' => '#222222' , 'padding' => '4px 4px 4px 30px' , 'text-align' => 'left'  )),
    array( 'title' => 'Red Alert', 'block' => 'p', 'styles' => array( 'border' => 'solid 1px #ED220C', 'background' => '#FABDB6 url(../../../../wp-content/plugins/ultimate-tinymce/img/red.png) 8px 4px no-repeat', 'color' => '#222222' , 'padding' => '4px 4px 4px 30px' , 'text-align' => 'left'  ))

    to

    array( 'title' => 'Normal Alert', 'block' => 'p', 'styles' => array( 'border' => 'solid 1px #DEDEDE', 'background' => '#EFEFEF url('.plugin_dir_url( __FILE__ ).'img/normal.png) 8px 4px no-repeat', 'color' => '#222222' , 'padding' => '4px 4px 4px 30px' , 'text-align' => 'left'  )),
    array( 'title' => 'Green Alert', 'block' => 'p', 'styles' => array( 'border' => 'solid 1px #1EDB0D', 'background' => '#A9FCA2 url('.plugin_dir_url( __FILE__ ).'img/green.png) 8px 4px no-repeat', 'color' => '#222222' , 'padding' => '4px 4px 4px 30px' , 'text-align' => 'left'  )),
    array( 'title' => 'Yellow Alert', 'block' => 'p', 'styles' => array( 'border' => 'solid 1px #F5F531', 'background' => '#FAFAB9 url('.plugin_dir_url( __FILE__ ).'img/yellow.png) 8px 4px no-repeat', 'color' => '#222222' , 'padding' => '4px 4px 4px 30px' , 'text-align' => 'left'  )),
    array( 'title' => 'Red Alert', 'block' => 'p', 'styles' => array( 'border' => 'solid 1px #ED220C', 'background' => '#FABDB6 url('.plugin_dir_url( __FILE__ ).'img/red.png) 8px 4px no-repeat', 'color' => '#222222' , 'padding' => '4px 4px 4px 30px' , 'text-align' => 'left'  ))

    Line 78, 79

    $siteurl = get_option('siteurl');
    $url = $siteurl . '/wp-content/plugins/' . basename(dirname(__FILE__)) . '/admin_panel.css';

    to

    $url = plugin_dir_url( __FILE__ ) . 'admin_panel.css';

    You should not hardcode plugin directory path.
    Because users can change it easily.

    I use plugin_dir_url( __FILE__ ) many times.
    You put no variable definitions in the global scope.
    I respect it.

  5. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 2 years ago #

    Thank you. I know my share, but I'm definitely still learning as I go.

    What's your website, and I'll include it in my next update?

  6. redcocker
    Member
    Posted 2 years ago #

    Josh san,

    Thanks.

    My web site is http://www.near-mint.com/blog/

  7. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 2 years ago #

    Your name is Josh too?

    Do you by chance speak any other languages?

  8. redcocker
    Member
    Posted 2 years ago #

    Josh san,(means "Mr./Mrs./Ms. Josh" in Japanese.)

    I'm sorry,I wrote misleading information.
    My name(online name) is redcocker.

  9. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 2 years ago #

    lol... gotcha. I've heard it before but never seen it written :)

    Thank you very much for the info and the fix. Please stay in touch!!

  10. Josh (WP Edit)
    Moderator and Editor Customizer
    Plugin Author

    Posted 2 years ago #

    Hey, I was thinking about something. Would you mind taking a look at the file at this location:

    /plugins/ultimate-tinymce/advimage/image.htm

    Do you think these need to be changed as well?

    <script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
    	<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
    	<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
    	<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
    	<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/editable_selects.js"></script>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic