Forum Replies Created

Viewing 15 replies - 466 through 480 (of 488 total)
  • Thread Starter Harm10

    (@harm10)

    Thanks. I will try to supply the missing translations.

    The ones I found in the first place are already corrected but still in yellow and status waiting. The time stamp of that is e.g. 2016-01-11 10:37:53 GMT.
    When will those messages get the permanent status?

    Thread Starter Harm10

    (@harm10)

    This development version solves my problem with CR LF in the shortcode.
    Thanks! I think other users are also helped by this.

    I have marked this topic as solved.

    Thread Starter Harm10

    (@harm10)

    I have sent you a mail through the contact form to discuss the translation. I had poedit 1.5.4 (2012) and the dialog in there is definitely different. I now use 1.7.4 and that is much more like what is described in the pdf.

    Pointing to the translation pdf in the documentation itself could perhaps give you more response?

    Point 7 works OK. So that is another improvement.

    Thread Starter Harm10

    (@harm10)

    Sometimes the option is already there and you just do not see it.
    Of course mla_image_alt is the solution!

    Perhaps you should put it on some to-do list that whenever someone uses such parms in the general mla_link_attributes or mla_image_attributes you replace their setting otherwise you will end up with a lot of different parms. Just an idea!

    So at the end of this series of posts I ended up with all requested in the first post!
    Thanks for all the time you put in!

    Thread Starter Harm10

    (@harm10)

    This is very weird. I took a look at the whole source and the unescaped characters are there like you say (both in Firefox that I normally use as in IE 11). But if you select “check element” (also in both browsers) the characters change.
    So I guess this is a bug in the checking of the element by the browser.

    By looking at the generated code I noticed something else.
    If someone codes this as part of the mla_gallery
    mla_image_attributes="alt='{+mla_fixed_alt+}'"
    the end result is that the img tag contains 2 alt parms.
    I would expect the presence of the alt parm in mla_image_attributes to suppress the regular one. Or not?

    Thread Starter Harm10

    (@harm10)

    Getting rid of those single quotes made the mla_link_href working as you predicted.

    Now I look at my code example I understand why you do not understand me…… ‘Title###Title2’ is what I coded and not ‘Title”Title2’.
    So I try to escape the double quote indeed. I expect the resulting html to also be title=”Title###Title2″ which it isn’t.
    I understand your explanation what the WP editor will do.
    So how I can escape a double quote and still end up with valid HTML?

    NB This editor also converts those escaped characters…..
    So ### should read the & q u o t ; character

    Thread Starter Harm10

    (@harm10)

    I understand your explanation about the html. Better make sure that the shown example in the example code also has the fixed value applied between quotes. Currently there is
    e.g., [mla_gallery mla_fixed_title="my title"].
    and in my view this should read something like
    e.g., [mla_gallery mla_fixed_title="array('my title','my other title')" mla_image_attributes="title='{+mla_fixed_title+}'"].

    I have used your new example code and currently the fixed values are applied to the correct mla_gallery!

    I already experimented with mla_link_href setting before I posted my previous example! And it doesn’t work.
    This is my code:
    [mla_gallery ids="961,1006,942,922" link=file mla_fixed_page="array('?p=1857','?m=201211','?p=306#comment-52','?page_id=107')" mla_fixed_title="array('Title 1','Title 2','Title 3','Title 4')" mla_fixed_alt="array('Alt 1','Alt 2','Alt 3','Alt 4')" mla_link_href="'{+site_url+}/{+mla_fixed_page+}'" mla_link_attributes="'title='{+mla_fixed_title+}'" mla_image_attributes="title='{+mla_fixed_title+}' alt='{+mla_fixed_alt+}'"]
    which results in links to the page the gallery is on for all 4 images. If I leave out {+site_url+} the result is the same.

    And perhaps this post gets too cluttered (please tell me if you want a post to be split) with specific things but there is also something else wrong in the processing of the single and double quote when specified in a fixed value and applied in the html part.

    If I code this:
    [mla_gallery ids="961,1006,942,922" link=file mla_fixed_page="array('?p=1858','?m=201311','?p=406#comment-42','?page_id=127')" mla_fixed_title="array('Justatitle','Title"Title2','Title to the title','Title of title'Title2')" mla_link_attributes="href='{+mla_fixed_page+}' title='{+mla_fixed_title+}'" mla_image_attributes="title='{+mla_fixed_title+}'"]
    the translated single and double quote end up translated again in the html element (for the single quote it looks fairly similar):

    <a title="Title"Title2" href="?m=201311">
    <img ..... title="Title"Title2"></img></a>

    Although the mouse-over displays the correct text still I think this is considered to be invalid html?

    Thread Starter Harm10

    (@harm10)

    I have an additional question on this topic.
    How can I change the example code in such a way that the mla_fixed values are set per mla_gallery code?
    Now if I have 2 mla_gallery codes with the same mla_fixed parm but with other values the values of the first one are used when building the second gallery.

    And btw I have a code that gives me fixed hrefs:
    [mla_gallery ids="961,1006,942,922" link=file mla_fixed_page="array('?p=1857','?m=201211','?p=306#comment-52','?page_id=107')" mla_fixed_title="array('Title 1','Title 2','Title 3','Title 4')" mla_fixed_alt="array('Alt 1','Alt 2','Alt 3','Alt 4')" mla_link_attributes="href='{+mla_fixed_page+}' title='{+mla_fixed_title+}'" mla_image_attributes="title='{+mla_fixed_title+}' alt='{+mla_fixed_alt+}'"]

    Thread Starter Harm10

    (@harm10)

    I found the development version.

    But I also found a bug in the processing of this example.
    If I code this
    [mla_gallery ids="961,1006,942,922" mla_fixed_title="array('Text number 1','Text number 2','Text number 3','Text number 4')" mla_link_attributes="title={+mla_fixed_title+}" mla_image_attributes="title={+mla_fixed_title+}"]
    I have to specify the fixed titles with spaces in between with quotes otherwise I get nothing in my fixed values. This seems logical but the end result of the above is that only the first string gets incorporated into the element (so only showing “Text”).
    I can see the values leaving correctly in $item_values array but apparently after this something goes wrong.
    If I change the code to
    [mla_gallery ids="961,1006,942,922" mla_fixed_title="array('Text number 1','Text number 2','Text number 3','Text number 4')" mla_link_attributes="title='{+mla_fixed_title+}'" mla_image_attributes="title='{+mla_fixed_title+}'"]
    so put quotes around the placing of the fixed values everything works OK.
    How come?

    Thread Starter Harm10

    (@harm10)

    I know I have read somewhere how to get hold of a Development version but I cannot find that instruction any more……. So how can I get this dev.version?

    Thanks for the acknowledgement. There was no need for it but still it is a nice gesture!

    I was also looking at creating a translation for you (I am Dutch).
    First the file you point to in the FAQ is not called MLA Internationalization Guide.php but MLA Internationalization Guide.pdf
    When I follow the instructions in that pdf by opening the pot file through Poedit I do not get a language dropdown. I can probably just fill the nl code in there? But what do I fill for source code character set?
    And the plurals rule should just be the default setting?

    Thread Starter Harm10

    (@harm10)

    Hi!
    I have updated your example to be able to set up any variable as long as the parm starts with mla_fixed_…..
    Also treat a value just separated by a comma as an array.

    So when you code:
    [mla_gallery ids="1015,1165,1074" link=file mla_fixed_caption="array('test1','test2','test3')" mla_fixed_title="'title1','title2','title3'" mla_fixed_alt="array('alttest1','alttest2','alttest3')" mla_caption="{+mla_fixed_caption+}" mla_link_attributes="title={+mla_fixed_title+}" mla_image_attributes="title={+mla_fixed_title+} alt={+mla_fixed_alt+}"]

    You will get fixed values in your anchor and img title and alt and caption as well.

    Perhaps you would contemplate of adding this code permanently to your plug-in?

    <?php
    /*
    Plugin Name: Media Library Assistant Fixed Values
    Plugin URI: http://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/
    Description: Adds the option to specify fixed values and use them in MLA [mla_gallery] shortcode
    Author: David Lingren
    Version: 1.00
    Author URI: http://fairtradejudaica.org/our-story/staff/
    
    Copyright 2013, 2014 David Lingren
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You can get a copy of the GNU General Public License by writing to the
        Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
    */
    
    /**
     * Class MLA Fixed Values hooks a few of the filters provided by the [mla_gallery] shortcode
     *
     * Call it anything you want, but give it an unlikely and hopefully unique name. Hiding everything
     * else inside a class means this is the only name you have to worry about.
     */
    class MLAFixedValuesExample {
        /**
         * Initialization function, similar to __construct()
         */
        public static function initialize() {
            /*
             * The filters are only useful for front-end posts/pages; exit if in the admin section
             */
            if ( is_admin() )
                return;
    
            /*
             * add_filter parameters:
             */
            add_filter( 'mla_gallery_attributes', 'MLAFixedValuesExample::mla_gallery_attributes_filter', 10, 1 );
            add_filter( 'mla_gallery_item_values', 'MLAFixedValuesExample::mla_gallery_item_values_filter', 10, 1 );
        }
    
        /**
         * Save the shortcode attributes
         */
        private static $shortcode_attributes = array();
    
        /**
         * MLA Gallery (Display) Attributes
         *
         * This filter gives you an opportunity to record or modify the arguments passed in to the shortcode
         * before they are merged with the default arguments used for the gallery display.
         *
         * The $shortcode_attributes array is where you will find any of your own parameters that are coded in the
         * shortcode, e.g., [mla_gallery my_parameter="my value"].
         */
        public static function mla_gallery_attributes_filter( $shortcode_attributes ) {
            /*
             * Save the attributes for use in the later filter
             */
            self::$shortcode_attributes = $shortcode_attributes;
    
            return $shortcode_attributes;
        } // mla_gallery_attributes_filter
    
        /**
         * MLA Gallery Item Values
         *
         * @since 1.00
         *
         * @param    array    parameter_name => parameter_value pairs
         *
         * @return    array    updated substitution parameter name => value pairs
         */
        public static function mla_gallery_item_values_filter( $item_values ) {
            /*
             * We use a shortcode parameter of our own to apply our filters on a gallery-by-gallery basis,
             * leaving other [mla_gallery] instances untouched. If the "fixed_values" parameter is not present,
             * we have nothing to do. Here is an example of how the custom parameter can be used:
             *
             * [mla_gallery ids="2621,2622,2623" mla_fixed_caption="array('test1','test2','test3')" mla_caption="{+mla_fixed_caption+}"]
             */
            // Is there something that starts with mla_fixed_ ?
            $mla_fixed_indicator = false;
            foreach ( self::$shortcode_attributes as $parmkey => $parmvalue ) {
                if ( substr($parmkey,0,10) == 'mla_fixed_' ) {
                    $mla_fixed_indicator = true;
                    break;
                }
            }
            if ( ! $mla_fixed_indicator ) {
                return $item_values; // leave them unchanged
            }
    
            /*
             * Evaluate the parameter value once per page load.
             */
            static $mla_fixed_values = NULL;
            if ( NULL === $mla_fixed_values ) {
                $mla_fixed_values = array();
                foreach ( self::$shortcode_attributes as $parmkey => $parmvalue ) {
                    if ( substr($parmkey,0,10) == 'mla_fixed_' ) {
                        $function = @create_function('', 'return ' . self::$shortcode_attributes[$parmkey] . ';' );
                        if ( is_callable( $function ) ) {
                            $mla_fixed_values[$parmkey] = $function();
                        }
                        if ( ! is_array( $mla_fixed_values[$parmkey] ) ) {
                            $mla_fixed_expl = explode(",",$parmvalue);
                            if ( is_array( $mla_fixed_expl) ) {
                                $mla_fixed_values[$parmkey] = $mla_fixed_expl;
                            } else {
                                $mla_fixed_values[$parmkey] = array();
                            }
                        }
                    }
                }
            }
            foreach ( $mla_fixed_values as $mla_fixed_key => $mla_fixed_value ) {
                /*
                * Apply the appropriate value to the current item.
                */
                if ( isset( $mla_fixed_value[ $item_values['index'] - 1 ] ) ) {
                    $item_values[$mla_fixed_key] = $mla_fixed_value[ $item_values['index'] - 1 ];
                }
            }
    
            return $item_values;
        } // mla_gallery_item_values_filter
    } // Class MLAFixedValuesExample
    
    /*
     * Install the filters at an early opportunity
     */
    add_action('init', 'MLAFixedValuesExample::initialize');
    ?>
    Thread Starter Harm10

    (@harm10)

    Although it works I think this is a somewhat complicated way to get a hash behind your paging links…….

    Wouldn’t an approach like adding a new mla_output parameter for this be easier?
    Something along the way of
    mla_output=”hash(‘mygallery’)”
    to put in the gallery shortcode itself and
    mla_output=”paginate_links,prev_next,hash(‘mygallery’)”
    to add to the paging gallery shortcode ?

    BTW I also asked in one of my other replies on resolved issues: do you have a wish list for additional features?

    Thread Starter Harm10

    (@harm10)

    First of all I read the documentation on this parameter and did not conclude that this would the parameter to use for me in this case.
    So maybe it needs some clarification?

    But although the gallery itself pages nicely if I click on its pager and the other one remains untouched the pager display itself isn’t.

    I currently have this code:

    <code>
    [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2012))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" ]
    </code>
    <code>
    [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2012))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" mla_output="paginate_links,prev_next" mla_page_parameter="mla_paginate_current_2"]
    </code>
    <hr/>
    <code>
    [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2011))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" ]
    </code>
    <code>
    [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2011))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" mla_output="paginate_links,prev_next" mla_page_parameter="mla_paginate_current_2"]
    </code>
    <hr/>

    If I page the second gallery the pager itself shows an active link of page 2 and also the text Previous. Which is OK. But the same is displayed for the first gallery which isn’t paged. If you click on the Previous link there nothing weird happens but still it looks strange.

    Rereading the documentation I tried an example with different mla_page_parameters (i.e. mla_paginate_current_2 and mla_paginate_current_3) to get a real solo paging effect for one gallery.
    So I understand that the parameter name needs to be unique. That could be made clearer in the documentation.
    I already read it somewhere that the myriad of possibilities of your plug-in could do with examples.
    How about some examples in the documentation that only open up (with jquery) when the link is clicked? In such a case the documentation isn’t getting cluttered by all the displayed examples and if someone wants to have an explanation by looking at it (we are not all native English speakers you know….. 🙂 ) he/she can get it!

    Thread Starter Harm10

    (@harm10)

    Thanks! This works flawlessly.
    Are you considering making this approach part of the MLA plug-in itself in the future? I think it will appeal to others as well.
    Or perhaps I can help coding and/or testing it?

    BTW Do you have some list of future enhancements?

    Thread Starter Harm10

    (@harm10)

    I should have seen that myself. Especially when I look at the code block above……………… 🙁

    Anyway it works now! Thanks for your fast response. I continue experimenting…… 🙂

Viewing 15 replies - 466 through 480 (of 488 total)