Changeset 806114
- Timestamp:
- 11/18/2013 09:30:25 AM (12 years ago)
- Location:
- multiple-gallery-on-post/trunk
- Files:
-
- 10 edited
-
admin/admin.css (modified) (2 diffs)
-
admin/metabox.php (modified) (3 diffs)
-
admin/options.php (modified) (3 diffs)
-
functions.php (modified) (7 diffs)
-
multiple-gallery-on-post.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
screenshot-1.jpg (modified) (previous)
-
screenshot-2.jpg (modified) (previous)
-
screenshot-3.jpg (modified) (previous)
-
style/style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
multiple-gallery-on-post/trunk/admin/admin.css
r804183 r806114 24 24 display: inline-block; 25 25 width: 20%; 26 vertical-align: top; 26 27 } 27 28 … … 68 69 width: 79%; 69 70 padding: 2px; 71 } 72 .mgop-filed .mgop-contentfield{ 73 width: 78%; 74 padding: 2px; 75 display: inline-block; 70 76 } 71 77 .mgop-filed .mgop-textfield { -
multiple-gallery-on-post/trunk/admin/metabox.php
r804183 r806114 7 7 { 8 8 private $boxes; 9 10 private $positions = array( 11 'after' => 'After post content', 12 'before' => 'Before post content', 13 'shortcode' => 'By Shortcode', 14 ); 9 15 10 16 public function __construct( $args ) … … 73 79 } ?> 74 80 </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> 76 89 <?php 77 90 } … … 90 103 'title' => $mgop_title['title'], 91 104 'post_type' => $post_type, 105 'args' => array( 106 'slug' => $mgop_slug, 107 'position' => $mgop_title['position'], 108 ), 92 109 ); 93 110 } -
multiple-gallery-on-post/trunk/admin/options.php
r804183 r806114 96 96 <option <?php echo ($label['position'] == 'after' ? 'selected' : ''); ?> value="after">After post content</option> 97 97 <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> 99 99 </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> 100 108 </div> 101 109 <a href="#" class="delete-this"><span>delete</span></a> … … 117 125 <option value="after">After post content</option> 118 126 <option value="before">Before post content</option> 119 < !-- <option value="manual">Manualy thru the theme</option> -->127 <option value="shortcode">By Shortcode</option> 120 128 </select> 121 129 </div> … … 168 176 <option value="after">After post content</option>\ 169 177 <option value="before">Before post content</option>\ 178 <option value="shortcode">By Shortcode</option>\ 170 179 </select>\ 171 180 </div>\ -
multiple-gallery-on-post/trunk/functions.php
r804183 r806114 1 1 <?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 */ 12 function 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 2 24 3 25 /** … … 13 35 14 36 if( ! $post_id ){ 15 global $post; 37 global $post; 16 38 $post_id = $post->ID; 17 39 } 18 40 $metavalue = get_post_meta( $post_id, 'mgop_media_value', true ); 19 41 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(); 21 43 }else{ 22 44 return ( is_array( $metavalue ) ) ? $metavalue : array(); … … 31 53 * 32 54 * @param string $mgop_slug Required. 33 * @param array $mgop_title Required. 55 * @param array $mgop_title Optional. 56 * @param array $post_id Optional. 34 57 * @param array $metavalue Optional. 58 * @param array $mgop_markup_type Optional. 35 59 * @return string|empty string on no value. 36 60 */ 37 function mgop_gallery_theme( $mgop_slug, $mgop_title, $post_id = '', $metavalue = null ){ 38 61 function 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 39 75 if( !$metavalue ){ 40 76 $metavalue = mgop_get_metadata($mgop_slug, $post_id); 41 77 } 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 } 55 139 56 140 $mgop_list = ''; … … 74 158 ); 75 159 $mgop_list .= strtr($template_list, $args); 76 } 77 160 } 161 162 $mgop_slug = 'mgop_mb_' . $mgop_slug; 78 163 $args = array( 79 164 '@mgop_slug' => $mgop_slug, … … 82 167 ); 83 168 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_list90 </ul>91 </div>92 </div>93 ';94 95 169 return strtr($template_wrap, $args); 96 170 … … 98 172 } 99 173 174 175 // Register the shortcodes 176 // Since 0.2 177 if(! 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 100 193 if(! function_exists('mgop_add_filter')){ 101 194 add_filter('the_content', 'mgop_add_filter'); … … 148 241 } 149 242 243 244 // Register style and scripts 245 // Since 0.1 150 246 if(! function_exists('mgop_add_head_tag')){ 151 247 -
multiple-gallery-on-post/trunk/multiple-gallery-on-post.php
r804183 r806114 4 4 * Plugin URI: http://iwayanwirka.duststone.com/multiple-gallery-on-post/ 5 5 * 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. 16 * Version: 0.2 7 7 * Author: I Wayan Wirka 8 8 * Author URI: http://iwayanwirka.duststone.com/ -
multiple-gallery-on-post/trunk/readme.txt
r804194 r806114 2 2 Contributors: wirka 3 3 Tags: gallery, multiple images, multiple metaboxes, multiple galeries 4 Requires at least: 3. 0.14 Requires at least: 3.4.0 5 5 Tested up to: 3.7.1 6 6 Stable tag: trunk … … 13 13 Very 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. 14 14 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. 15 Features: 16 1. Unlimited galleries in one post. 17 2. Gallery as a metabox for each galleries. 18 3. Unlimited images. 19 4. Be able to be automatically picked up into post display. 22 20 23 21 == Installation == 24 1. Upload plugin directory to the \\\\\\\\\\\\\\\"/wp-content/plugins/\\\\\\\\\\\\\\\" directory.25 2. Activate the plugin through the \\\\\\\\\\\\\\\"Plugins\\\\\\\\\\\\\\\" menu in WordPress.22 1. Upload plugin directory to the "/wp-content/plugins/" directory. 23 2. Activate the plugin through the "Plugins" menu in WordPress. 26 24 3. Go to settings page on Settings -> Multiple Gallery on Post. 27 25 4. 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 .26 5. Your post or page (depend on your settings) will have new gallery metabox(es), feel free to add new images. 29 27 30 28 == Screenshots == 31 1. Settings gallerypage29 1. Settings page 32 30 2. Add images to gallery through edit post page 33 31 3. The galleries preview on post 34 32 35 33 == Changelog == 34 = 0.2 = 35 * Add options to display by shortcode. 36 36 37 = 0.1 = 37 38 * Initial release. -
multiple-gallery-on-post/trunk/style/style.css
r804183 r806114 1 ul.mgop-elements { 1 ul.mgop-elements, 2 ol.mgop-elements, 3 div.mgop-elements { 2 4 display: table; 3 5 margin: 0;
Note: See TracChangeset
for help on using the changeset viewer.