Plugin Directory

Changeset 1292022


Ignore:
Timestamp:
11/22/2015 01:55:47 PM (10 years ago)
Author:
mRommel
Message:

Added link target option

Location:
image-widget-deluxe/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • image-widget-deluxe/trunk/css/image-widget-backend.css

    r1238824 r1292022  
    3737    position: absolute;
    3838    top: 73px;
     39    margin: 0;
     40    line-height: 1;
    3941    right: 15px;
    4042    background: #ccc;
     
    4446    color: #000;
    4547    font-size: 24px;
     48    -webkit-appearance: none;
     49    -moz-appearance:    none;
     50    appearance:         none;
    4651}
    4752
     
    5863    height: auto;
    5964    margin-top: 15px;
     65}
     66
     67.customize-control-widget_form button.widget-image-select {
     68    display: block !important;
    6069}
    6170
  • image-widget-deluxe/trunk/image-widget-deluxe.php

    r1290503 r1292022  
    8181 *
    8282 */
    83 
     83add_action( 'customize_controls_enqueue_scripts', 'rommeled_image_widget_scripts', 999 ); // Enqueue at the customizer.
    8484function rommeled_image_widget_scripts(){
    8585
     
    116116
    117117        // Enqueue the JS and styles for the backend.
    118         add_action( 'admin_enqueue_scripts', 'rommeled_image_widget_scripts', 99 );
     118        add_action( 'admin_enqueue_scripts', 'rommeled_image_widget_scripts', 99 );  // Enqueue at admin area.
    119119    }
    120120
     
    138138        $text = ! empty( $instance['text'] ) ? $instance['text'] : '';
    139139        $url = ! empty( $instance['url'] ) ? esc_attr($instance['url']) : '';
     140        $url_target = ! empty( $instance['url_target'] ) ? esc_attr($instance['url_target']) : '';
    140141        $button = ! empty( $instance['button'] ) ? esc_attr($instance['button']) : '';
    141142        $size = ! empty( $instance['size'] ) ? esc_attr($instance['size']) : '';
     
    153154        }
    154155
     156        // Url Target.
     157        if ( ! empty($url_target) ) {
     158            $attr_target = 'target="' . $url_target .'" ';
     159        } else {
     160            $attr_target = '';
     161        }
     162
    155163        // Get the title.
    156164        if ( ! empty( $title ) ) {
     
    180188                // Begin the link.
    181189                if ( ! empty( $url ) ) {
    182                     echo '<a href="' . $url . '">';
     190                    echo '<a ' . $attr_target . ' href="' . $url . '">';
    183191                }
    184192
     
    213221            if ( $field == $widget_id . '-button' && ! empty( $url ) && ! empty( $button ) || $field === 'no-sort' && ! empty( $url ) && ! empty( $button ) ) :
    214222
    215                 $link = "window.location.href='" . $url . "'";
     223                if ( empty($url_target) ) {
     224                    $link = "window.location.href='" . $url . "'";
     225                } else {
     226                    $link = "window.location.href='" . $url . "','_blank'";
     227                }
    216228
    217229                echo '<p class="rommeled_widget_image-field rommeled_widget_image-button"><button class="button btn" onclick="' . $link . '">' . $button . '</button></p>';
     
    239251        $text = ! empty( $instance['text'] ) ? $instance['text'] : '';
    240252        $url = ! empty( $instance['url'] ) ? esc_attr($instance['url']) : '';
     253        $url_target = ! empty( $instance['url_target'] ) ? esc_attr($instance['url_target']) : '';
    241254        $button = ! empty( $instance['button'] ) ? esc_attr($instance['button']) : '';
    242255        $size = ! empty( $instance['size'] ) ? esc_attr($instance['size']) : '';
     
    333346        <div class="non-sortable" <?php echo $imageoptions; ?>>
    334347            <h4><?php _e('Widget Options', 'image-widget' ); ?></h4>
     348
     349            <label for="<?php echo $this->get_field_id( 'url_target' ); ?>"><?php _e( 'Link target', 'image-widget' ); ?>:
     350                <select class='widefat' id="<?php echo $this->get_field_id( 'url_target' ); ?>" name="<?php echo $this->get_field_name( 'url_target' ); ?>">
     351
     352                    <?php
     353
     354                    $targets = array(
     355                        '' => esc_html__( 'Same window', 'image-widget' ),
     356                        '_blank' => esc_html__( 'New window', 'image-widget' ),
     357                    );
     358
     359                    foreach ( $targets as $target => $target_type ) : ?>
     360
     361                        <option value="<?php echo $target; ?>" <?php selected( $target, $url_target, true ); ?>><?php echo $target_type; ?></option>
     362
     363                    <?php endforeach; ?>
     364
     365                </select>
     366                <small><?php _e( 'Select a style for the image', 'image-widget' ); ?>.</small>
     367            </label>
    335368
    336369            <label for="<?php echo $this->get_field_id( 'style' ); ?>"><?php _e( 'Image style', 'image-widget' ); ?>:
     
    394427        $instance['button'] = ( ! empty( $new_instance['button'] ) ) ? strip_tags( $new_instance['button'] ) : '';
    395428        $instance['url'] = ( ! empty( $new_instance['url'] ) ) ? strip_tags( $new_instance['url'] ) : '';
     429        $instance['url_target'] = ( ! empty( $new_instance['url_target'] ) ) ? strip_tags( $new_instance['url_target'] ) : '';
    396430        $instance['size'] = ( ! empty( $new_instance['size'] ) ) ? strip_tags( $new_instance['size'] ) : '';
    397431        $instance['style'] = ( ! empty( $new_instance['style'] ) ) ? strip_tags( $new_instance['style'] ) : '';
  • image-widget-deluxe/trunk/js/media.js

    r1238149 r1292022  
    4141
    4242        });
    43 
    4443    }
    4544
     
    6059
    6160        });
    62 
    6361    }
    6462
     
    7775
    7876        sort.disableSelection();
    79 
    8077    }
    8178
  • image-widget-deluxe/trunk/languages/image-widget-da_DK.po

    r1238824 r1292022  
    22msgstr ""
    33"Project-Id-Version: Image Widget\n"
    4 "POT-Creation-Date: 2015-09-05 18:36+0200\n"
    5 "PO-Revision-Date: 2015-09-05 18:36+0200\n"
     4"POT-Creation-Date: 2015-11-22 14:29+0100\n"
     5"PO-Revision-Date: 2015-11-22 14:29+0100\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    1313"X-Poedit-Basepath: ..\n"
    1414"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    15 "X-Poedit-KeywordsList: __;_e\n"
     15"X-Poedit-KeywordsList: __;_e;esc_html__;esc_html_e\n"
    1616"X-Poedit-SearchPath-0: .\n"
    1717
     
    2424msgstr "Brug dette billede"
    2525
    26 #: image-widget-deluxe.php:113
     26#: image-widget-deluxe.php:111
    2727msgid "Image widget Deluxe"
    2828msgstr "Billede Widget Deluxe"
    2929
    30 #: image-widget-deluxe.php:115
     30#: image-widget-deluxe.php:113
    3131msgid "A widget that displays an image with title, description and a button."
    3232msgstr ""
     
    3434"link."
    3535
    36 #: image-widget-deluxe.php:270
     36#: image-widget-deluxe.php:275
    3737msgid "Widget Title"
    3838msgstr "Widget titel"
    3939
    40 #: image-widget-deluxe.php:272
     40#: image-widget-deluxe.php:277
    4141msgid "Give the widget a title (If you need one)"
    4242msgstr "Giv denne widget en titel. (Hvis du har brug for en)"
    4343
    44 #: image-widget-deluxe.php:282
     44#: image-widget-deluxe.php:287
    4545msgid "Title"
    4646msgstr "Overskrift"
    4747
    48 #: image-widget-deluxe.php:284
     48#: image-widget-deluxe.php:289
    4949msgid "Add a title that will be displayed inside the widget"
    5050msgstr "En overskrift der vil blive vist inde i widget"
    5151
    52 #: image-widget-deluxe.php:291
     52#: image-widget-deluxe.php:296
    5353msgid "Image"
    5454msgstr "Billede"
    5555
    56 #: image-widget-deluxe.php:292
     56#: image-widget-deluxe.php:297
    5757msgid "Select image"
    5858msgstr "Vælg billede"
    5959
    60 #: image-widget-deluxe.php:315
     60#: image-widget-deluxe.php:320
    6161msgid "Text"
    6262msgstr "Tekst"
    6363
    64 #: image-widget-deluxe.php:317
     64#: image-widget-deluxe.php:322
    6565msgid "Add or edit a description for the widget"
    6666msgstr "Tilføj eller rediger teksten i widget"
    6767
    68 #: image-widget-deluxe.php:324
     68#: image-widget-deluxe.php:329
    6969msgid "Button"
    7070msgstr "Knap"
    7171
    72 #: image-widget-deluxe.php:326
     72#: image-widget-deluxe.php:331
    7373msgid "Add a text that will be displayed in the button"
    7474msgstr "Tilføj en tekst hvis du vil have vist en knap"
    7575
    76 #: image-widget-deluxe.php:338
     76#: image-widget-deluxe.php:341
    7777msgid "Link"
    7878msgstr "Link"
    7979
    80 #: image-widget-deluxe.php:340
     80#: image-widget-deluxe.php:343
    8181msgid "Add an url that the widget should refer to (Button and Image)"
    8282msgstr "Tilføj en url som denne widget skal referere til (Knap & Billede)"
    8383
    84 #: image-widget-deluxe.php:344
     84#: image-widget-deluxe.php:347
    8585msgid "Widget Options"
    8686msgstr "Widget indstillinger"
    8787
    88 #: image-widget-deluxe.php:346
     88#: image-widget-deluxe.php:349
     89msgid "Link target"
     90msgstr "Link mål"
     91
     92#: image-widget-deluxe.php:355
     93msgid "Same window"
     94msgstr "Samme vindue"
     95
     96#: image-widget-deluxe.php:356
     97msgid "New window"
     98msgstr "Nyt vindue"
     99
     100#: image-widget-deluxe.php:366 image-widget-deluxe.php:386
     101msgid "Select a style for the image"
     102msgstr "Vælg en stil billedet skal vises i"
     103
     104#: image-widget-deluxe.php:369
    89105msgid "Image style"
    90106msgstr "Billede styling"
    91107
    92 #: image-widget-deluxe.php:352
     108#: image-widget-deluxe.php:375
    93109msgid "Square"
    94110msgstr "Uden style"
    95111
    96 #: image-widget-deluxe.php:353
     112#: image-widget-deluxe.php:376
    97113msgid "Round"
    98114msgstr "Rund style"
    99115
    100 #: image-widget-deluxe.php:363
    101 msgid "Select a style for the image"
    102 msgstr "Vælg en stil billedet skal vises i"
    103 
    104 #: image-widget-deluxe.php:367
     116#: image-widget-deluxe.php:389
    105117msgid "Image size"
    106118msgstr "Billedestørrelse"
    107119
    108 #: image-widget-deluxe.php:381
     120#: image-widget-deluxe.php:403
    109121msgid "Select an image size"
    110122msgstr "Vælg en billedestørrelse"
  • image-widget-deluxe/trunk/readme.txt

    r1290508 r1292022  
    44Requires at least: 3.8
    55Tested up to: 4.4
    6 Stable tag: 1.0.2
     6Stable tag: 1.0.3
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    5151== Changelog ==
    5252
     53= 1.0.4 - 22/11/2015 =
     54* Feature- Added link target option.
     55
    5356= 1.0.3 - 20/11/2015 =
    5457* Feature- Added full image size as option.
Note: See TracChangeset for help on using the changeset viewer.