Plugin Directory

Changeset 806114


Ignore:
Timestamp:
11/18/2013 09:30:25 AM (12 years ago)
Author:
wirka
Message:

Send the updates for version 0.2

Location:
multiple-gallery-on-post/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • multiple-gallery-on-post/trunk/admin/admin.css

    r804183 r806114  
    2424    display: inline-block;
    2525    width: 20%;
     26    vertical-align: top;
    2627}
    2728
     
    6869    width: 79%;
    6970    padding: 2px;
     71}
     72.mgop-filed .mgop-contentfield{
     73    width: 78%;
     74    padding: 2px;
     75    display: inline-block;
    7076}
    7177.mgop-filed .mgop-textfield {
  • multiple-gallery-on-post/trunk/admin/metabox.php

    r804183 r806114  
    77{
    88    private $boxes;
     9   
     10    private $positions = array(
     11        'after' => 'After post content',
     12        'before' => 'Before post content',
     13        'shortcode' => 'By Shortcode',
     14    );
    915
    1016    public function __construct( $args )
     
    7379            } ?>
    7480        </ul>
    75         <div class="mgop-powerred">Powerred By: Multiple Gallery on Post (<a href="http://duststone.com">duststone.com</a>)</div>
     81        <div class="mgop-detail" style="border-top: 1px solid #ccc;">
     82            <ul>
     83                <li><label>Gallery Slug</label>: <code><?php echo $box['args']['slug']; ?></code></li>
     84                <li><label>Output Location</label>: <?php echo $this->positions[ $box['args']['position'] ]; ?></li>
     85                <li><label>Available Shortcodes</label>: <code><?php echo mgop_create_shortcode($box['args']['slug'], 'ul'); ?></code> or <code><?php echo mgop_create_shortcode($box['args']['slug'], 'ol'); ?></code> or <code><?php echo mgop_create_shortcode($box['args']['slug'], 'div'); ?></code></li>
     86            </ul>
     87        </div>
     88        <div class="mgop-powerred">Powerred By: Multiple Gallery on Post By <a href="http://iwayanwirka.duststone.com">I Wayan Wirka</a>.</div>
    7689        <?php
    7790    }
     
    90103                    'title' => $mgop_title['title'],
    91104                    'post_type' => $post_type,
     105                    'args' => array(                       
     106                        'slug' => $mgop_slug,
     107                        'position' => $mgop_title['position'],
     108                    ),
    92109                );
    93110            }
  • multiple-gallery-on-post/trunk/admin/options.php

    r804183 r806114  
    9696                                            <option <?php echo ($label['position'] == 'after' ? 'selected' : ''); ?> value="after">After post content</option>
    9797                                            <option <?php echo ($label['position'] == 'before' ? 'selected' : ''); ?> value="before">Before post content</option>
    98                                             <!-- <option <?php echo ($label['position'] == 'manual' ? 'selected' : ''); ?> value="manual">Manualy thru the theme</option> -->
     98                                            <option <?php echo ($label['position'] == 'shortcode' ? 'selected' : ''); ?> value="shortcode">By Shortcode</option>
    9999                                        </select>
     100                                    </div>
     101                                    <div class="field-item">
     102                                        <label>Available Shortcodes</label>
     103                                        <div class="mgop-contentfield">
     104                                            <code><?php echo mgop_create_shortcode($slug, 'ul'); ?></code><br/>
     105                                            <code><?php echo mgop_create_shortcode($slug, 'ol'); ?></code><br/>
     106                                            <code><?php echo mgop_create_shortcode($slug, 'div'); ?></code>
     107                                        </div>
    100108                                    </div>
    101109                                    <a href="#" class="delete-this"><span>delete</span></a>
     
    117125                                        <option value="after">After post content</option>
    118126                                        <option value="before">Before post content</option>
    119                                         <!-- <option value="manual">Manualy thru the theme</option> -->
     127                                        <option value="shortcode">By Shortcode</option>
    120128                                    </select>
    121129                                </div>
     
    168176                                        <option value="after">After post content</option>\
    169177                                        <option value="before">Before post content</option>\
     178                                        <option value="shortcode">By Shortcode</option>\
    170179                                    </select>\
    171180                                </div>\
  • multiple-gallery-on-post/trunk/functions.php

    r804183 r806114  
    11<?php
     2
     3/**
     4 * Create Multiple Gallery On Post shortcode text from given mgop_slug and mgop_markup_type.
     5 *
     6 * @since 0.2
     7 *
     8 * @param string $mgop_slug Required. Metabox slug which would like to create shortcode to.
     9 * @param string $mgop_markup_type Optional. The markup type that HTML generated as. The value must be 'div', 'ol', or 'ul'.
     10 * @return string|empty string on no value.
     11 */
     12function mgop_create_shortcode( $mgop_slug, $mgop_markup_type = 'ul' ){
     13
     14    if(! $mgop_markup_type){
     15        $mgop_markup_type = 'ul';
     16    }
     17   
     18    if($mgop_slug){
     19        return '[mgop_gallery slug="'. $mgop_slug .'" markup="'. $mgop_markup_type .'"/]';
     20    }
     21   
     22}
     23
    224
    325/**
     
    1335   
    1436    if( ! $post_id ){
    15         global $post;   
     37        global $post;
    1638        $post_id = $post->ID;
    1739    }   
    1840    $metavalue = get_post_meta( $post_id, 'mgop_media_value', true );   
    1941    if( $mgop_slug ){   
    20         return isset( $metavalue['mgop_mb_' . $mgop_slug] ) ? $metavalue[$mgop_slug] : array();
     42        return isset( $metavalue['mgop_mb_' . $mgop_slug] ) ? $metavalue['mgop_mb_' . $mgop_slug] : array();   
    2143    }else{     
    2244        return ( is_array( $metavalue ) ) ? $metavalue : array();       
     
    3153 *
    3254 * @param string $mgop_slug Required.
    33  * @param array $mgop_title Required.
     55 * @param array $mgop_title Optional.
     56 * @param array $post_id Optional.
    3457 * @param array $metavalue Optional.
     58 * @param array $mgop_markup_type Optional.
    3559 * @return string|empty string on no value.
    3660 */
    37 function mgop_gallery_theme( $mgop_slug, $mgop_title, $post_id = '', $metavalue = null ){
    38 
     61function mgop_gallery_theme( $mgop_slug, $mgop_title, $post_id = '', $metavalue = '', $mgop_markup_type = 'ul' ){   
     62   
     63    if( !$mgop_title ){
     64       
     65        global $post;
     66       
     67        $options = get_option('mgop_options');
     68        if( isset($options[$post->post_type]) && $options[$post->post_type]['active'] ){
     69            if( count($options[$post->post_type]['titles']) && isset($options[$post->post_type]['titles'][$mgop_slug]) && is_array($options[$post->post_type]['titles'][$mgop_slug]) ){
     70                $mgop_title = $options[$post->post_type]['titles'][$mgop_slug]['title'];
     71            }
     72        }
     73    }   
     74   
    3975    if( !$metavalue ){
    4076        $metavalue = mgop_get_metadata($mgop_slug, $post_id);
    4177    }
    42 
    43     if(is_array($metavalue) && count($metavalue)){
    44    
    45         $mgop_slug .= 'mgop_mb_' . $mgop_slug;
    46 
    47         $template_list = '
    48                         <li class="mgop-elements-item">
    49                             <a href="@mgop_image_full_url" title="@mgop_image_caption" class="mgop-elements-item-link">
    50                                 <img src="@mgop_image_thumb_url" width="@mgop_image_thumb_width" height="@mgop_image_thumb_height" alt="@mgop_image_alt" />
    51                                 <span class="mgop-elements-item-description">@mgop_image_description</span>
    52                             </a>
    53                         </li>
    54         ';
     78   
     79    if(! $mgop_markup_type){
     80        $mgop_markup_type = 'ul';
     81    }
     82
     83    if(is_array($metavalue) && count($metavalue)){ 
     84
     85        if($mgop_markup_type == 'ul' || $mgop_markup_type == 'ol'){
     86            $template_list = '
     87                            <li class="mgop-elements-item">
     88                                <a href="@mgop_image_full_url" title="@mgop_image_caption" class="mgop-elements-item-link">
     89                                    <img src="@mgop_image_thumb_url" width="@mgop_image_thumb_width" height="@mgop_image_thumb_height" alt="@mgop_image_alt" />
     90                                    <span class="mgop-elements-item-description">@mgop_image_description</span>
     91                                </a>
     92                            </li>
     93            ';
     94        }elseif($mgop_markup_type == 'div'){
     95            $template_list = '
     96                            <div class="mgop-elements-item">
     97                                <a href="@mgop_image_full_url" title="@mgop_image_caption" class="mgop-elements-item-link">
     98                                    <img src="@mgop_image_thumb_url" width="@mgop_image_thumb_width" height="@mgop_image_thumb_height" alt="@mgop_image_alt" />
     99                                    <span class="mgop-elements-item-description">@mgop_image_description</span>
     100                                </a>
     101                            </div>
     102            ';
     103        }
     104       
     105        if($mgop_markup_type == 'ul'){
     106            $template_wrap = '
     107                <div class="mgop-element mgop_@mgop_slug">
     108                    <div class="mgop-element-content">
     109                        <h3>@mgop_title</h3>
     110                        <ul class="mgop-elements">
     111                            @mgop_list
     112                        </ul>
     113                    </div>
     114                </div>
     115            ';
     116        }elseif($mgop_markup_type == 'ol'){
     117            $template_wrap = '
     118                <div class="mgop-element mgop_@mgop_slug">
     119                    <div class="mgop-element-content">
     120                        <h3>@mgop_title</h3>
     121                        <ol class="mgop-elements">
     122                            @mgop_list
     123                        </ol>
     124                    </div>
     125                </div>
     126            ';
     127        }elseif($mgop_markup_type == 'div'){
     128            $template_wrap = '
     129                <div class="mgop-element mgop_@mgop_slug">
     130                    <div class="mgop-element-content">
     131                        <h3>@mgop_title</h3>
     132                        <div class="mgop-elements">
     133                            @mgop_list
     134                        </div>
     135                    </div>
     136                </div>
     137            ';
     138        }
    55139       
    56140        $mgop_list = '';
     
    74158            );
    75159            $mgop_list .= strtr($template_list, $args);
    76         }
    77 
     160        }       
     161       
     162        $mgop_slug = 'mgop_mb_' . $mgop_slug;
    78163        $args = array(
    79164            '@mgop_slug' => $mgop_slug,
     
    82167        );
    83168       
    84         $template_wrap = '
    85             <div id="mgop_@mgop_slug" class="mgop-element">
    86                 <div class="mgop-element-content">
    87                     <h3>@mgop_title</h3>
    88                     <ul class="mgop-elements">
    89                         @mgop_list
    90                     </ul>
    91                 </div>
    92             </div>
    93         ';
    94        
    95169        return strtr($template_wrap, $args);
    96170       
     
    98172}
    99173
     174
     175// Register the shortcodes
     176// Since 0.2
     177if(! function_exists('mgop_run_gallery_shortcode')){
     178
     179    function mgop_run_gallery_shortcode($atts, $content = null) {
     180        extract(shortcode_atts(array(
     181            "slug" => '',
     182            "markup" => '',
     183        ), $atts));     
     184        $the_content = mgop_gallery_theme($atts['slug'], '', '', '', $atts['markup']);
     185        return $the_content;
     186    }
     187    add_shortcode("mgop_gallery", "mgop_run_gallery_shortcode");
     188}
     189
     190
     191// Add filter to post content in order to append or prepend the galleries
     192// Since 0.1
    100193if(! function_exists('mgop_add_filter')){
    101194    add_filter('the_content', 'mgop_add_filter');
     
    148241}
    149242
     243   
     244// Register style and scripts
     245// Since 0.1
    150246if(! function_exists('mgop_add_head_tag')){
    151247   
  • multiple-gallery-on-post/trunk/multiple-gallery-on-post.php

    r804183 r806114  
    44 * Plugin URI: http://iwayanwirka.duststone.com/multiple-gallery-on-post/
    55 * Description: Very simple gallery plugin embeded on post as metabox, be able to add multiple metaboxes in one post with ability to insert multiple images for each.
    6  * Version: 0.1
     6 * Version: 0.2
    77 * Author: I Wayan Wirka
    88 * Author URI: http://iwayanwirka.duststone.com/
  • multiple-gallery-on-post/trunk/readme.txt

    r804194 r806114  
    22Contributors: wirka
    33Tags: gallery, multiple images, multiple metaboxes, multiple galeries
    4 Requires at least: 3.0.1
     4Requires at least: 3.4.0
    55Tested up to: 3.7.1
    66Stable tag: trunk
     
    1313Very simple gallery plugin embedded on post as metaboxes, be able to add multiple metaboxes in one post with ability to insert multiple images for each.
    1414
    15 Features:<br/>
    16 1. Unlimited galleries in one post<br/>
    17 2. Gallery as a metabox for each galleries<br/>
    18 3. Unlimited images<br/>
    19 4. Be able to be automatically picked up into post display<br/>
    20 
    21 Please feel free to rate, write reviews or submit a compatibility if it's working on your WordPress version.
     15Features:
     161. Unlimited galleries in one post.
     172. Gallery as a metabox for each galleries.
     183. Unlimited images.
     194. Be able to be automatically picked up into post display.
    2220
    2321== Installation ==
    24 1. Upload plugin directory to the \\\\\\\\\\\\\\\"/wp-content/plugins/\\\\\\\\\\\\\\\" directory.
    25 2. Activate the plugin through the \\\\\\\\\\\\\\\"Plugins\\\\\\\\\\\\\\\" menu in WordPress.
     221. Upload plugin directory to the "/wp-content/plugins/" directory.
     232. Activate the plugin through the "Plugins" menu in WordPress.
    26243. Go to settings page on Settings -> Multiple Gallery on Post.
    27254. Define gallery metaboxes through plugin setting page per content type.
    28 5. Your post or page (depend on your settings) will have new gallery metabox(es), feel free to add new image.
     265. Your post or page (depend on your settings) will have new gallery metabox(es), feel free to add new images.
    2927
    3028== Screenshots ==
    31 1. Settings gallery page
     291. Settings page
    32302. Add images to gallery through edit post page
    33313. The galleries preview on post
    3432
    3533== Changelog ==
     34= 0.2 =
     35* Add options to display by shortcode.
     36
    3637= 0.1 =
    3738* Initial release.
  • multiple-gallery-on-post/trunk/style/style.css

    r804183 r806114  
    1 ul.mgop-elements {
     1ul.mgop-elements,
     2ol.mgop-elements,
     3div.mgop-elements {
    24    display: table;
    35    margin: 0;
Note: See TracChangeset for help on using the changeset viewer.