Version Description
- Modified jQuery ticker class loading.
- Fixed load_plugin_textdomain setup.
- Added wysiwyg editor option back.
Download this release
Release Info
Developer | metaphorcreations |
Plugin | Ditty News Ticker |
Version | 1.1.5 |
Comparing to | |
See all releases |
Code changes from version 1.1.4 to 1.1.5
- ditty-news-ticker.php +7 -7
- includes/functions.php +109 -58
- includes/meta-boxes.php +38 -38
- includes/metaboxer/metaboxer.css +10 -4
- includes/metaboxer/metaboxer.js +61 -54
- includes/metaboxer/metaboxer.php +113 -113
- includes/scripts.php +64 -99
- includes/settings.php +20 -22
- languages/ditty-news-ticker-en_US.mo +0 -0
- languages/ditty-news-ticker-en_US.po +10 -25
- readme.txt +10 -2
ditty-news-ticker.php
CHANGED
@@ -3,17 +3,17 @@
|
|
3 |
Plugin Name: Ditty News Ticker
|
4 |
Plugin URI: http://dittynewsticker.com/
|
5 |
Description: Ditty News Ticker is a multi-functional data display plugin
|
6 |
-
Version: 1.1.
|
7 |
Author: Metaphor Creations
|
8 |
Author URI: http://www.metaphorcreations.com
|
9 |
License: GPL2
|
10 |
*/
|
11 |
|
12 |
-
/*
|
13 |
Copyright 2012 Metaphor Creations (email : joe@metaphorcreations.com)
|
14 |
|
15 |
This program is free software; you can redistribute it and/or modify
|
16 |
-
it under the terms of the GNU General Public License, version 2, as
|
17 |
published by the Free Software Foundation.
|
18 |
|
19 |
This program is distributed in the hope that it will be useful,
|
@@ -43,11 +43,11 @@ The icons are licensed under a Creative Commons Attribution
|
|
43 |
* Define constants
|
44 |
*
|
45 |
* @since 1.0.0
|
46 |
-
*/
|
47 |
if ( WP_DEBUG ) {
|
48 |
-
define ( 'MTPHR_DNT_VERSION', '1.1.
|
49 |
} else {
|
50 |
-
define ( 'MTPHR_DNT_VERSION', '1.1.
|
51 |
}
|
52 |
define ( 'MTPHR_DNT_DIR', plugin_dir_path(__FILE__) );
|
53 |
define ( 'MTPHR_DNT_URL', plugins_url().'/ditty-news-ticker' );
|
@@ -59,7 +59,7 @@ define ( 'MTPHR_DNT_URL', plugins_url().'/ditty-news-ticker' );
|
|
59 |
* Include files
|
60 |
*
|
61 |
* @since 1.0.0
|
62 |
-
*/
|
63 |
|
64 |
if( is_admin() ) {
|
65 |
|
3 |
Plugin Name: Ditty News Ticker
|
4 |
Plugin URI: http://dittynewsticker.com/
|
5 |
Description: Ditty News Ticker is a multi-functional data display plugin
|
6 |
+
Version: 1.1.5
|
7 |
Author: Metaphor Creations
|
8 |
Author URI: http://www.metaphorcreations.com
|
9 |
License: GPL2
|
10 |
*/
|
11 |
|
12 |
+
/*
|
13 |
Copyright 2012 Metaphor Creations (email : joe@metaphorcreations.com)
|
14 |
|
15 |
This program is free software; you can redistribute it and/or modify
|
16 |
+
it under the terms of the GNU General Public License, version 2, as
|
17 |
published by the Free Software Foundation.
|
18 |
|
19 |
This program is distributed in the hope that it will be useful,
|
43 |
* Define constants
|
44 |
*
|
45 |
* @since 1.0.0
|
46 |
+
*/
|
47 |
if ( WP_DEBUG ) {
|
48 |
+
define ( 'MTPHR_DNT_VERSION', '1.1.5-'.time() );
|
49 |
} else {
|
50 |
+
define ( 'MTPHR_DNT_VERSION', '1.1.5' );
|
51 |
}
|
52 |
define ( 'MTPHR_DNT_DIR', plugin_dir_path(__FILE__) );
|
53 |
define ( 'MTPHR_DNT_URL', plugins_url().'/ditty-news-ticker' );
|
59 |
* Include files
|
60 |
*
|
61 |
* @since 1.0.0
|
62 |
+
*/
|
63 |
|
64 |
if( is_admin() ) {
|
65 |
|
includes/functions.php
CHANGED
@@ -4,17 +4,17 @@
|
|
4 |
*
|
5 |
* @package Ditty News Ticker
|
6 |
*/
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
/**
|
12 |
* Display the ticker
|
13 |
*
|
14 |
* @since 1.0.0
|
15 |
*/
|
16 |
function ditty_news_ticker( $id='', $class='', $atts=false ) {
|
17 |
-
|
18 |
// Display the ticker
|
19 |
echo get_mtphr_dnt_ticker( $id, $class, $atts );
|
20 |
}
|
@@ -29,37 +29,37 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
|
|
29 |
// Get the post
|
30 |
$ticker = get_post( $id );
|
31 |
if( $ticker && $ticker->post_status == 'publish' ) {
|
32 |
-
|
33 |
// Save the original $wp_query
|
34 |
global $wp_query;
|
35 |
$original_query = $wp_query;
|
36 |
$wp_query = null;
|
37 |
$wp_query = new WP_Query();
|
38 |
-
|
39 |
// Get all the custom data
|
40 |
$custom_fields = get_post_custom( $id );
|
41 |
$meta_data = array();
|
42 |
foreach( $custom_fields as $key => $value ) {
|
43 |
$meta_data[$key] = maybe_unserialize( $value[0] );
|
44 |
}
|
45 |
-
|
46 |
// Override meta data with supplied attributes
|
47 |
if( is_array($atts) ) {
|
48 |
-
foreach( $atts as $key => $value ) {
|
49 |
$meta_data["_mtphr_dnt_{$key}"] = $value;
|
50 |
}
|
51 |
}
|
52 |
-
|
53 |
// Extract the metadata array into variables
|
54 |
extract( $meta_data );
|
55 |
|
56 |
// Create an empty array to save ticks
|
57 |
$dnt_ticks = array();
|
58 |
-
|
59 |
// Get the ticks
|
60 |
if( is_array($_mtphr_dnt_ticks) ) {
|
61 |
foreach( $_mtphr_dnt_ticks as $i => $tick ) {
|
62 |
-
|
63 |
if( $text = wp_kses_post($tick['tick']) ) {
|
64 |
|
65 |
// Get the contents
|
@@ -70,7 +70,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
|
|
70 |
$contents = $text;
|
71 |
}
|
72 |
$contents = apply_filters('mtphr_dnt_tick', $contents, $text, $link );
|
73 |
-
|
74 |
// Save the output to the tick array
|
75 |
$dnt_ticks[] = $contents;
|
76 |
}
|
@@ -81,7 +81,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
|
|
81 |
$dnt_ticks = apply_filters( 'mtphr_dnt_tick_array', $dnt_ticks, $id, $meta_data );
|
82 |
|
83 |
ob_start();
|
84 |
-
|
85 |
// Create the opening div
|
86 |
$tick_id = 'mtphr-dnt-'.$id;
|
87 |
// Add a unique id
|
@@ -90,7 +90,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
|
|
90 |
$tick_id = 'mtphr-dnt-'.$id.'-'.sanitize_html_class( $_mtphr_dnt_unique_id );
|
91 |
}
|
92 |
}
|
93 |
-
|
94 |
// Check for a set width
|
95 |
$ticker_width = '';
|
96 |
if( isset($_mtphr_dnt_ticker_width) ) {
|
@@ -98,30 +98,30 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
|
|
98 |
$ticker_width = ' style="width:'.intval($_mtphr_dnt_ticker_width).'px"';
|
99 |
}
|
100 |
}
|
101 |
-
|
102 |
echo '<div'.$ticker_width.' id="'.$tick_id.'" '.mtphr_dnt_ticker_class( $id, $class, $meta_data ).'>';
|
103 |
echo '<div class="mtphr-dnt-wrapper mtphr-dnt-clearfix">';
|
104 |
-
|
105 |
// Display the title
|
106 |
if( isset($_mtphr_dnt_title) ) {
|
107 |
if( $_mtphr_dnt_title ) {
|
108 |
-
|
109 |
$inline_title = '';
|
110 |
if( isset($_mtphr_dnt_inline_title) ) {
|
111 |
if( $_mtphr_dnt_inline_title ) {
|
112 |
$inline_title = ' mtphr-dnt-inline-title';
|
113 |
}
|
114 |
}
|
115 |
-
|
116 |
do_action( 'mtphr_dnt_title_before', $id, $meta_data );
|
117 |
echo '<h3 class="mtphr-dnt-title'.$inline_title.'">'.apply_filters( 'mtphr_dnt_ticker_title', $ticker->post_title ).'</h3>';
|
118 |
do_action( 'mtphr_dnt_title_after', $id, $meta_data );
|
119 |
}
|
120 |
}
|
121 |
-
|
122 |
// Create and save element styles
|
123 |
$margin='';$padding='';$width='';$height='';$spacing='';
|
124 |
-
|
125 |
if( $_mtphr_dnt_mode == 'scroll' ) {
|
126 |
$padding = ( intval($_mtphr_dnt_scroll_padding) != 0 ) ? 'padding-top:'.intval($_mtphr_dnt_scroll_padding).'px;padding-bottom:'.intval($_mtphr_dnt_scroll_padding).'px;' : '';
|
127 |
$margin = ( intval($_mtphr_dnt_scroll_margin) != 0 ) ? 'margin-top:'.intval($_mtphr_dnt_scroll_margin).'px;margin-bottom:'.intval($_mtphr_dnt_scroll_margin).'px;' : '';
|
@@ -130,54 +130,54 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
|
|
130 |
} elseif( $_mtphr_dnt_mode == 'rotate' ) {
|
131 |
$padding = ( intval($_mtphr_dnt_rotate_padding) != 0 ) ? 'padding-top:'.intval($_mtphr_dnt_rotate_padding).'px;padding-bottom:'.intval($_mtphr_dnt_rotate_padding).'px;' : '';
|
132 |
$margin = ( intval($_mtphr_dnt_rotate_margin) != 0 ) ? 'margin-top:'.intval($_mtphr_dnt_rotate_margin).'px;margin-bottom:'.intval($_mtphr_dnt_rotate_margin).'px;' : '';
|
133 |
-
$height = ( intval($_mtphr_dnt_rotate_height) != 0 ) ? 'height:'.intval($_mtphr_dnt_rotate_height).'px;' : '';
|
134 |
} elseif( $_mtphr_dnt_mode == 'list' ) {
|
135 |
$padding = ( intval($_mtphr_dnt_list_padding) != 0 ) ? 'padding-top:'.intval($_mtphr_dnt_list_padding).'px;padding-bottom:'.intval($_mtphr_dnt_list_padding).'px;' : '';
|
136 |
-
$margin = ( intval($_mtphr_dnt_list_margin) != 0 ) ? 'margin-top:'.intval($_mtphr_dnt_list_margin).'px;margin-bottom:'.intval($_mtphr_dnt_list_margin).'px;' : '';
|
137 |
}
|
138 |
-
|
139 |
// Filter the variables
|
140 |
$padding = apply_filters( 'mtphr_dnt_tick_container_padding', $padding );
|
141 |
$margin = apply_filters( 'mtphr_dnt_tick_container_margin', $margin );
|
142 |
$width = apply_filters( 'mtphr_dnt_tick_width', $width );
|
143 |
$height = apply_filters( 'mtphr_dnt_tick_height', $height );
|
144 |
-
|
145 |
// Create the container style
|
146 |
$container_style = ( $padding != '' || $margin != '' ) ? ' style="'.$padding.$margin.'"' : '';
|
147 |
-
|
148 |
// Open the ticker container
|
149 |
do_action( 'mtphr_dnt_before', $id, $meta_data );
|
150 |
echo '<div class="mtphr-dnt-tick-container"'.$container_style.'>';
|
151 |
do_action( 'mtphr_dnt_top', $id, $meta_data );
|
152 |
-
|
153 |
// Print out the ticks
|
154 |
if( is_array($dnt_ticks) ) {
|
155 |
$total = count($dnt_ticks);
|
156 |
foreach( $dnt_ticks as $i => $tick ) {
|
157 |
-
|
158 |
// Set the list spacing depending on the tick position
|
159 |
if( $_mtphr_dnt_mode == 'list' ) {
|
160 |
$spacing = ( $i != intval($total-1) ) ? 'margin-bottom:'.intval($_mtphr_dnt_list_tick_spacing).'px;' : '';
|
161 |
}
|
162 |
$spacing = apply_filters( 'mtphr_dnt_list_tick_spacing', $spacing, $i, $total );
|
163 |
$tick_style = ( $width != '' || $height != '' || $spacing != '' ) ? ' style="'.$width.$height.$spacing.'"' : '';
|
164 |
-
|
165 |
do_action( 'mtphr_dnt_tick_before', $id, $meta_data, $total, $i );
|
166 |
echo '<div'.$tick_style.' '.mtphr_dnt_tick_class('mtphr-dnt-clearfix').'>';
|
167 |
do_action( 'mtphr_dnt_tick_top', $id, $meta_data );
|
168 |
-
|
169 |
echo $tick;
|
170 |
-
|
171 |
do_action( 'mtphr_dnt_tick_bottom', $id, $meta_data );
|
172 |
echo '</div>';
|
173 |
do_action( 'mtphr_dnt_tick_after', $id, $meta_data, $total, $i );
|
174 |
}
|
175 |
-
|
176 |
// Add the directional nav
|
177 |
if( $_mtphr_dnt_mode == 'rotate' ) {
|
178 |
if( isset($_mtphr_dnt_rotate_directional_nav) ) {
|
179 |
if( $_mtphr_dnt_rotate_directional_nav ) {
|
180 |
-
|
181 |
$hide = '';
|
182 |
if( isset($_mtphr_dnt_rotate_directional_nav_hide) ) {
|
183 |
$hide = $_mtphr_dnt_rotate_directional_nav_hide ? ' mtphr-dnt-nav-hide' : '';
|
@@ -193,7 +193,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
|
|
193 |
do_action( 'mtphr_dnt_bottom', $id, $meta_data );
|
194 |
echo '</div>';
|
195 |
do_action( 'mtphr_dnt_after', $id, $meta_data );
|
196 |
-
|
197 |
// Add the control nav
|
198 |
if( is_array($dnt_ticks) && $_mtphr_dnt_mode == 'rotate' ) {
|
199 |
if( isset($_mtphr_dnt_rotate_control_nav) ) {
|
@@ -207,16 +207,67 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
|
|
207 |
}
|
208 |
}
|
209 |
}
|
210 |
-
|
211 |
// Close the ticker
|
212 |
echo '</div></div>';
|
213 |
-
|
214 |
// Restore the original $wp_query
|
215 |
$wp_query = null;
|
216 |
$wp_query = $original_query;
|
217 |
wp_reset_postdata();
|
218 |
}
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
// Return the output
|
221 |
return ob_get_clean();
|
222 |
}
|
@@ -230,7 +281,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
|
|
230 |
* @since 1.0.9
|
231 |
*/
|
232 |
function mtphr_dnt_ticker_class( $id='', $class='', $meta_data ) {
|
233 |
-
|
234 |
// Separates classes with a single space, collates classes for ditty ticker element
|
235 |
return 'class="'.join( ' ', get_mtphr_dnt_ticker_class($id,$class,$meta_data) ).'"';
|
236 |
}
|
@@ -241,19 +292,19 @@ function get_mtphr_dnt_ticker_class( $id='', $class='', $meta_data ) {
|
|
241 |
extract( $meta_data );
|
242 |
|
243 |
$classes = array();
|
244 |
-
|
245 |
$classes[] = 'mtphr-dnt';
|
246 |
$classes[] = 'mtphr-dnt-'.$id;
|
247 |
$classes[] = 'mtphr-dnt-'.$_mtphr_dnt_type;
|
248 |
$classes[] = 'mtphr-dnt-'.$_mtphr_dnt_mode;
|
249 |
-
|
250 |
if( $_mtphr_dnt_mode == 'scroll' ) {
|
251 |
$classes[] = 'mtphr-dnt-'.$_mtphr_dnt_mode.'-'.$_mtphr_dnt_scroll_direction;
|
252 |
}
|
253 |
if( $_mtphr_dnt_mode == 'rotate' ) {
|
254 |
$classes[] = 'mtphr-dnt-'.$_mtphr_dnt_mode.'-'.$_mtphr_dnt_rotate_type;
|
255 |
}
|
256 |
-
|
257 |
// Set the styles class
|
258 |
if( isset($_mtphr_dnt_styled) ) {
|
259 |
if( $_mtphr_dnt_styled ) {
|
@@ -270,9 +321,9 @@ function get_mtphr_dnt_ticker_class( $id='', $class='', $meta_data ) {
|
|
270 |
// Ensure that we always coerce class to being an array.
|
271 |
$class = array();
|
272 |
}
|
273 |
-
|
274 |
$classes = array_map( 'esc_attr', $classes );
|
275 |
-
|
276 |
return apply_filters( 'mtphr_dnt_ticker_class', $classes, $class );
|
277 |
}
|
278 |
|
@@ -285,7 +336,7 @@ function get_mtphr_dnt_ticker_class( $id='', $class='', $meta_data ) {
|
|
285 |
* @since 1.0.0
|
286 |
*/
|
287 |
function mtphr_dnt_tick_class( $class='' ) {
|
288 |
-
|
289 |
// Separates classes with a single space, collates classes for ditty ticker element
|
290 |
return 'class="'.join( ' ', get_mtphr_dnt_tick_class($class) ).'"';
|
291 |
}
|
@@ -293,9 +344,9 @@ function mtphr_dnt_tick_class( $class='' ) {
|
|
293 |
function get_mtphr_dnt_tick_class( $class='' ) {
|
294 |
|
295 |
$classes = array();
|
296 |
-
|
297 |
$classes[] = 'mtphr-dnt-tick';
|
298 |
-
|
299 |
if ( !empty( $class ) ) {
|
300 |
if ( !is_array( $class ) ) {
|
301 |
$class = preg_split( '#\s+#', $class );
|
@@ -305,9 +356,9 @@ function get_mtphr_dnt_tick_class( $class='' ) {
|
|
305 |
// Ensure that we always coerce class to being an array.
|
306 |
$class = array();
|
307 |
}
|
308 |
-
|
309 |
$classes = array_map( 'esc_attr', $classes );
|
310 |
-
|
311 |
return apply_filters( 'mtphr_dnt_tick_class', $classes, $class );
|
312 |
}
|
313 |
|
@@ -320,7 +371,7 @@ function get_mtphr_dnt_tick_class( $class='' ) {
|
|
320 |
* @since 1.0.0
|
321 |
*/
|
322 |
function mtphr_dnt_compress_script( $str ) {
|
323 |
-
|
324 |
$lines = explode( "\n", $str );
|
325 |
$output = '';
|
326 |
foreach( $lines as $line ) {
|
@@ -328,8 +379,8 @@ function mtphr_dnt_compress_script( $str ) {
|
|
328 |
$output .= trim( $line );
|
329 |
}
|
330 |
}
|
331 |
-
|
332 |
-
return $output;
|
333 |
}
|
334 |
|
335 |
|
@@ -341,14 +392,14 @@ function mtphr_dnt_compress_script( $str ) {
|
|
341 |
* @since 1.0.0
|
342 |
*/
|
343 |
function mtphr_dnt_types_array() {
|
344 |
-
|
345 |
/* Create the types array. */
|
346 |
$dnt_types_array = array();
|
347 |
$dnt_types_array['default'] = array(
|
348 |
'button' => __('Default', 'ditty-news-ticker'),
|
349 |
'metaboxes' => array( 'mtphr_dnt_type_default' )
|
350 |
);
|
351 |
-
|
352 |
return apply_filters('mtphr_dnt_types', $dnt_types_array);
|
353 |
}
|
354 |
|
@@ -361,7 +412,7 @@ function mtphr_dnt_types_array() {
|
|
361 |
* @since 1.0.0
|
362 |
*/
|
363 |
function mtphr_dnt_modes_array() {
|
364 |
-
|
365 |
/* Create the modes array. */
|
366 |
$dnt_modes_array = array();
|
367 |
$dnt_modes_array['scroll'] = array(
|
@@ -376,7 +427,7 @@ function mtphr_dnt_modes_array() {
|
|
376 |
'button' => __('List', 'ditty-news-ticker'),
|
377 |
'metaboxes' => array( 'mtphr_dnt_mode_list' )
|
378 |
);
|
379 |
-
|
380 |
return apply_filters('mtphr_dnt_modes', $dnt_modes_array);
|
381 |
}
|
382 |
|
@@ -392,7 +443,7 @@ function mtphr_dnt_settings_tabs() {
|
|
392 |
|
393 |
$dnt_settings_array = array();
|
394 |
$dnt_settings_array['general'] = 'mtphr_dnt_general_settings';
|
395 |
-
|
396 |
return apply_filters('mtphr_dnt_settings', $dnt_settings_array);
|
397 |
}
|
398 |
|
@@ -403,10 +454,10 @@ add_action( 'plugins_loaded', 'mtphr_dnt_localization' );
|
|
403 |
/**
|
404 |
* Setup localization
|
405 |
*
|
406 |
-
* @since 1.
|
407 |
*/
|
408 |
function mtphr_dnt_localization() {
|
409 |
-
|
410 |
}
|
411 |
|
412 |
|
4 |
*
|
5 |
* @package Ditty News Ticker
|
6 |
*/
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
/**
|
12 |
* Display the ticker
|
13 |
*
|
14 |
* @since 1.0.0
|
15 |
*/
|
16 |
function ditty_news_ticker( $id='', $class='', $atts=false ) {
|
17 |
+
|
18 |
// Display the ticker
|
19 |
echo get_mtphr_dnt_ticker( $id, $class, $atts );
|
20 |
}
|
29 |
// Get the post
|
30 |
$ticker = get_post( $id );
|
31 |
if( $ticker && $ticker->post_status == 'publish' ) {
|
32 |
+
|
33 |
// Save the original $wp_query
|
34 |
global $wp_query;
|
35 |
$original_query = $wp_query;
|
36 |
$wp_query = null;
|
37 |
$wp_query = new WP_Query();
|
38 |
+
|
39 |
// Get all the custom data
|
40 |
$custom_fields = get_post_custom( $id );
|
41 |
$meta_data = array();
|
42 |
foreach( $custom_fields as $key => $value ) {
|
43 |
$meta_data[$key] = maybe_unserialize( $value[0] );
|
44 |
}
|
45 |
+
|
46 |
// Override meta data with supplied attributes
|
47 |
if( is_array($atts) ) {
|
48 |
+
foreach( $atts as $key => $value ) {
|
49 |
$meta_data["_mtphr_dnt_{$key}"] = $value;
|
50 |
}
|
51 |
}
|
52 |
+
|
53 |
// Extract the metadata array into variables
|
54 |
extract( $meta_data );
|
55 |
|
56 |
// Create an empty array to save ticks
|
57 |
$dnt_ticks = array();
|
58 |
+
|
59 |
// Get the ticks
|
60 |
if( is_array($_mtphr_dnt_ticks) ) {
|
61 |
foreach( $_mtphr_dnt_ticks as $i => $tick ) {
|
62 |
+
|
63 |
if( $text = wp_kses_post($tick['tick']) ) {
|
64 |
|
65 |
// Get the contents
|
70 |
$contents = $text;
|
71 |
}
|
72 |
$contents = apply_filters('mtphr_dnt_tick', $contents, $text, $link );
|
73 |
+
|
74 |
// Save the output to the tick array
|
75 |
$dnt_ticks[] = $contents;
|
76 |
}
|
81 |
$dnt_ticks = apply_filters( 'mtphr_dnt_tick_array', $dnt_ticks, $id, $meta_data );
|
82 |
|
83 |
ob_start();
|
84 |
+
|
85 |
// Create the opening div
|
86 |
$tick_id = 'mtphr-dnt-'.$id;
|
87 |
// Add a unique id
|
90 |
$tick_id = 'mtphr-dnt-'.$id.'-'.sanitize_html_class( $_mtphr_dnt_unique_id );
|
91 |
}
|
92 |
}
|
93 |
+
|
94 |
// Check for a set width
|
95 |
$ticker_width = '';
|
96 |
if( isset($_mtphr_dnt_ticker_width) ) {
|
98 |
$ticker_width = ' style="width:'.intval($_mtphr_dnt_ticker_width).'px"';
|
99 |
}
|
100 |
}
|
101 |
+
|
102 |
echo '<div'.$ticker_width.' id="'.$tick_id.'" '.mtphr_dnt_ticker_class( $id, $class, $meta_data ).'>';
|
103 |
echo '<div class="mtphr-dnt-wrapper mtphr-dnt-clearfix">';
|
104 |
+
|
105 |
// Display the title
|
106 |
if( isset($_mtphr_dnt_title) ) {
|
107 |
if( $_mtphr_dnt_title ) {
|
108 |
+
|
109 |
$inline_title = '';
|
110 |
if( isset($_mtphr_dnt_inline_title) ) {
|
111 |
if( $_mtphr_dnt_inline_title ) {
|
112 |
$inline_title = ' mtphr-dnt-inline-title';
|
113 |
}
|
114 |
}
|
115 |
+
|
116 |
do_action( 'mtphr_dnt_title_before', $id, $meta_data );
|
117 |
echo '<h3 class="mtphr-dnt-title'.$inline_title.'">'.apply_filters( 'mtphr_dnt_ticker_title', $ticker->post_title ).'</h3>';
|
118 |
do_action( 'mtphr_dnt_title_after', $id, $meta_data );
|
119 |
}
|
120 |
}
|
121 |
+
|
122 |
// Create and save element styles
|
123 |
$margin='';$padding='';$width='';$height='';$spacing='';
|
124 |
+
|
125 |
if( $_mtphr_dnt_mode == 'scroll' ) {
|
126 |
$padding = ( intval($_mtphr_dnt_scroll_padding) != 0 ) ? 'padding-top:'.intval($_mtphr_dnt_scroll_padding).'px;padding-bottom:'.intval($_mtphr_dnt_scroll_padding).'px;' : '';
|
127 |
$margin = ( intval($_mtphr_dnt_scroll_margin) != 0 ) ? 'margin-top:'.intval($_mtphr_dnt_scroll_margin).'px;margin-bottom:'.intval($_mtphr_dnt_scroll_margin).'px;' : '';
|
130 |
} elseif( $_mtphr_dnt_mode == 'rotate' ) {
|
131 |
$padding = ( intval($_mtphr_dnt_rotate_padding) != 0 ) ? 'padding-top:'.intval($_mtphr_dnt_rotate_padding).'px;padding-bottom:'.intval($_mtphr_dnt_rotate_padding).'px;' : '';
|
132 |
$margin = ( intval($_mtphr_dnt_rotate_margin) != 0 ) ? 'margin-top:'.intval($_mtphr_dnt_rotate_margin).'px;margin-bottom:'.intval($_mtphr_dnt_rotate_margin).'px;' : '';
|
133 |
+
$height = ( intval($_mtphr_dnt_rotate_height) != 0 ) ? 'height:'.intval($_mtphr_dnt_rotate_height).'px;' : '';
|
134 |
} elseif( $_mtphr_dnt_mode == 'list' ) {
|
135 |
$padding = ( intval($_mtphr_dnt_list_padding) != 0 ) ? 'padding-top:'.intval($_mtphr_dnt_list_padding).'px;padding-bottom:'.intval($_mtphr_dnt_list_padding).'px;' : '';
|
136 |
+
$margin = ( intval($_mtphr_dnt_list_margin) != 0 ) ? 'margin-top:'.intval($_mtphr_dnt_list_margin).'px;margin-bottom:'.intval($_mtphr_dnt_list_margin).'px;' : '';
|
137 |
}
|
138 |
+
|
139 |
// Filter the variables
|
140 |
$padding = apply_filters( 'mtphr_dnt_tick_container_padding', $padding );
|
141 |
$margin = apply_filters( 'mtphr_dnt_tick_container_margin', $margin );
|
142 |
$width = apply_filters( 'mtphr_dnt_tick_width', $width );
|
143 |
$height = apply_filters( 'mtphr_dnt_tick_height', $height );
|
144 |
+
|
145 |
// Create the container style
|
146 |
$container_style = ( $padding != '' || $margin != '' ) ? ' style="'.$padding.$margin.'"' : '';
|
147 |
+
|
148 |
// Open the ticker container
|
149 |
do_action( 'mtphr_dnt_before', $id, $meta_data );
|
150 |
echo '<div class="mtphr-dnt-tick-container"'.$container_style.'>';
|
151 |
do_action( 'mtphr_dnt_top', $id, $meta_data );
|
152 |
+
|
153 |
// Print out the ticks
|
154 |
if( is_array($dnt_ticks) ) {
|
155 |
$total = count($dnt_ticks);
|
156 |
foreach( $dnt_ticks as $i => $tick ) {
|
157 |
+
|
158 |
// Set the list spacing depending on the tick position
|
159 |
if( $_mtphr_dnt_mode == 'list' ) {
|
160 |
$spacing = ( $i != intval($total-1) ) ? 'margin-bottom:'.intval($_mtphr_dnt_list_tick_spacing).'px;' : '';
|
161 |
}
|
162 |
$spacing = apply_filters( 'mtphr_dnt_list_tick_spacing', $spacing, $i, $total );
|
163 |
$tick_style = ( $width != '' || $height != '' || $spacing != '' ) ? ' style="'.$width.$height.$spacing.'"' : '';
|
164 |
+
|
165 |
do_action( 'mtphr_dnt_tick_before', $id, $meta_data, $total, $i );
|
166 |
echo '<div'.$tick_style.' '.mtphr_dnt_tick_class('mtphr-dnt-clearfix').'>';
|
167 |
do_action( 'mtphr_dnt_tick_top', $id, $meta_data );
|
168 |
+
|
169 |
echo $tick;
|
170 |
+
|
171 |
do_action( 'mtphr_dnt_tick_bottom', $id, $meta_data );
|
172 |
echo '</div>';
|
173 |
do_action( 'mtphr_dnt_tick_after', $id, $meta_data, $total, $i );
|
174 |
}
|
175 |
+
|
176 |
// Add the directional nav
|
177 |
if( $_mtphr_dnt_mode == 'rotate' ) {
|
178 |
if( isset($_mtphr_dnt_rotate_directional_nav) ) {
|
179 |
if( $_mtphr_dnt_rotate_directional_nav ) {
|
180 |
+
|
181 |
$hide = '';
|
182 |
if( isset($_mtphr_dnt_rotate_directional_nav_hide) ) {
|
183 |
$hide = $_mtphr_dnt_rotate_directional_nav_hide ? ' mtphr-dnt-nav-hide' : '';
|
193 |
do_action( 'mtphr_dnt_bottom', $id, $meta_data );
|
194 |
echo '</div>';
|
195 |
do_action( 'mtphr_dnt_after', $id, $meta_data );
|
196 |
+
|
197 |
// Add the control nav
|
198 |
if( is_array($dnt_ticks) && $_mtphr_dnt_mode == 'rotate' ) {
|
199 |
if( isset($_mtphr_dnt_rotate_control_nav) ) {
|
207 |
}
|
208 |
}
|
209 |
}
|
210 |
+
|
211 |
// Close the ticker
|
212 |
echo '</div></div>';
|
213 |
+
|
214 |
// Restore the original $wp_query
|
215 |
$wp_query = null;
|
216 |
$wp_query = $original_query;
|
217 |
wp_reset_postdata();
|
218 |
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Add to the global script variable
|
222 |
+
*
|
223 |
+
* @since 1.0.0
|
224 |
+
*/
|
225 |
+
if( $_mtphr_dnt_mode == 'scroll' || $_mtphr_dnt_mode == 'rotate' ) {
|
226 |
+
|
227 |
+
global $mtphr_dnt_ticker_scripts;
|
228 |
+
|
229 |
+
$ticker = '#mtphr-dnt-'.$id;
|
230 |
+
|
231 |
+
// Add a unique id class, if there is one
|
232 |
+
if( isset($_mtphr_dnt_unique_id) ) {
|
233 |
+
if( $_mtphr_dnt_unique_id != '' ) {
|
234 |
+
$ticker = '#mtphr-dnt-'.$id.'-'.sanitize_html_class( $_mtphr_dnt_unique_id );
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
$scroll_pause = 0;
|
239 |
+
if( isset($_mtphr_dnt_scroll_pause) ) {
|
240 |
+
$pause = $_mtphr_dnt_scroll_pause ? 1 : 0;
|
241 |
+
}
|
242 |
+
$rotate = 0; $rotate_pause = 0; $nav_autohide = 0; $nav_reverse = 0;
|
243 |
+
if( isset($_mtphr_dnt_auto_rotate) ) {
|
244 |
+
$rotate = $_mtphr_dnt_auto_rotate ? 1 : 0;
|
245 |
+
}
|
246 |
+
if( isset($_mtphr_dnt_rotate_pause) ) {
|
247 |
+
$pause = $_mtphr_dnt_rotate_pause ? 1 : 0;
|
248 |
+
}
|
249 |
+
if( isset($_mtphr_dnt_rotate_directional_nav_reverse) ) {
|
250 |
+
$nav_reverse = $_mtphr_dnt_rotate_directional_nav_reverse ? 1 : 0;
|
251 |
+
}
|
252 |
+
|
253 |
+
$mtphr_dnt_ticker_scripts[] = array(
|
254 |
+
'ticker' => $ticker,
|
255 |
+
'id' => $id,
|
256 |
+
'type' => $_mtphr_dnt_mode,
|
257 |
+
'scroll_direction' => $_mtphr_dnt_scroll_direction,
|
258 |
+
'scroll_speed' => intval($_mtphr_dnt_scroll_speed),
|
259 |
+
'scroll_pause' => $scroll_pause,
|
260 |
+
'scroll_spacing' => intval($_mtphr_dnt_scroll_tick_spacing),
|
261 |
+
'rotate_type' => $_mtphr_dnt_rotate_type,
|
262 |
+
'auto_rotate' => $rotate,
|
263 |
+
'rotate_delay' => intval($_mtphr_dnt_rotate_delay),
|
264 |
+
'rotate_pause' => $rotate_pause,
|
265 |
+
'rotate_speed' => intval($_mtphr_dnt_rotate_speed),
|
266 |
+
'rotate_ease' => $_mtphr_dnt_rotate_ease,
|
267 |
+
'nav_reverse' => $nav_reverse
|
268 |
+
);
|
269 |
+
}
|
270 |
+
|
271 |
// Return the output
|
272 |
return ob_get_clean();
|
273 |
}
|
281 |
* @since 1.0.9
|
282 |
*/
|
283 |
function mtphr_dnt_ticker_class( $id='', $class='', $meta_data ) {
|
284 |
+
|
285 |
// Separates classes with a single space, collates classes for ditty ticker element
|
286 |
return 'class="'.join( ' ', get_mtphr_dnt_ticker_class($id,$class,$meta_data) ).'"';
|
287 |
}
|
292 |
extract( $meta_data );
|
293 |
|
294 |
$classes = array();
|
295 |
+
|
296 |
$classes[] = 'mtphr-dnt';
|
297 |
$classes[] = 'mtphr-dnt-'.$id;
|
298 |
$classes[] = 'mtphr-dnt-'.$_mtphr_dnt_type;
|
299 |
$classes[] = 'mtphr-dnt-'.$_mtphr_dnt_mode;
|
300 |
+
|
301 |
if( $_mtphr_dnt_mode == 'scroll' ) {
|
302 |
$classes[] = 'mtphr-dnt-'.$_mtphr_dnt_mode.'-'.$_mtphr_dnt_scroll_direction;
|
303 |
}
|
304 |
if( $_mtphr_dnt_mode == 'rotate' ) {
|
305 |
$classes[] = 'mtphr-dnt-'.$_mtphr_dnt_mode.'-'.$_mtphr_dnt_rotate_type;
|
306 |
}
|
307 |
+
|
308 |
// Set the styles class
|
309 |
if( isset($_mtphr_dnt_styled) ) {
|
310 |
if( $_mtphr_dnt_styled ) {
|
321 |
// Ensure that we always coerce class to being an array.
|
322 |
$class = array();
|
323 |
}
|
324 |
+
|
325 |
$classes = array_map( 'esc_attr', $classes );
|
326 |
+
|
327 |
return apply_filters( 'mtphr_dnt_ticker_class', $classes, $class );
|
328 |
}
|
329 |
|
336 |
* @since 1.0.0
|
337 |
*/
|
338 |
function mtphr_dnt_tick_class( $class='' ) {
|
339 |
+
|
340 |
// Separates classes with a single space, collates classes for ditty ticker element
|
341 |
return 'class="'.join( ' ', get_mtphr_dnt_tick_class($class) ).'"';
|
342 |
}
|
344 |
function get_mtphr_dnt_tick_class( $class='' ) {
|
345 |
|
346 |
$classes = array();
|
347 |
+
|
348 |
$classes[] = 'mtphr-dnt-tick';
|
349 |
+
|
350 |
if ( !empty( $class ) ) {
|
351 |
if ( !is_array( $class ) ) {
|
352 |
$class = preg_split( '#\s+#', $class );
|
356 |
// Ensure that we always coerce class to being an array.
|
357 |
$class = array();
|
358 |
}
|
359 |
+
|
360 |
$classes = array_map( 'esc_attr', $classes );
|
361 |
+
|
362 |
return apply_filters( 'mtphr_dnt_tick_class', $classes, $class );
|
363 |
}
|
364 |
|
371 |
* @since 1.0.0
|
372 |
*/
|
373 |
function mtphr_dnt_compress_script( $str ) {
|
374 |
+
|
375 |
$lines = explode( "\n", $str );
|
376 |
$output = '';
|
377 |
foreach( $lines as $line ) {
|
379 |
$output .= trim( $line );
|
380 |
}
|
381 |
}
|
382 |
+
|
383 |
+
return $output;
|
384 |
}
|
385 |
|
386 |
|
392 |
* @since 1.0.0
|
393 |
*/
|
394 |
function mtphr_dnt_types_array() {
|
395 |
+
|
396 |
/* Create the types array. */
|
397 |
$dnt_types_array = array();
|
398 |
$dnt_types_array['default'] = array(
|
399 |
'button' => __('Default', 'ditty-news-ticker'),
|
400 |
'metaboxes' => array( 'mtphr_dnt_type_default' )
|
401 |
);
|
402 |
+
|
403 |
return apply_filters('mtphr_dnt_types', $dnt_types_array);
|
404 |
}
|
405 |
|
412 |
* @since 1.0.0
|
413 |
*/
|
414 |
function mtphr_dnt_modes_array() {
|
415 |
+
|
416 |
/* Create the modes array. */
|
417 |
$dnt_modes_array = array();
|
418 |
$dnt_modes_array['scroll'] = array(
|
427 |
'button' => __('List', 'ditty-news-ticker'),
|
428 |
'metaboxes' => array( 'mtphr_dnt_mode_list' )
|
429 |
);
|
430 |
+
|
431 |
return apply_filters('mtphr_dnt_modes', $dnt_modes_array);
|
432 |
}
|
433 |
|
443 |
|
444 |
$dnt_settings_array = array();
|
445 |
$dnt_settings_array['general'] = 'mtphr_dnt_general_settings';
|
446 |
+
|
447 |
return apply_filters('mtphr_dnt_settings', $dnt_settings_array);
|
448 |
}
|
449 |
|
454 |
/**
|
455 |
* Setup localization
|
456 |
*
|
457 |
+
* @since 1.1.5
|
458 |
*/
|
459 |
function mtphr_dnt_localization() {
|
460 |
+
load_plugin_textdomain( 'ditty-news-ticker', false, 'ditty-news-ticker/languages/' );
|
461 |
}
|
462 |
|
463 |
|
includes/meta-boxes.php
CHANGED
@@ -4,11 +4,11 @@
|
|
4 |
*
|
5 |
* @package Ditty News Ticker
|
6 |
*/
|
7 |
-
|
8 |
|
9 |
|
10 |
|
11 |
-
|
|
|
12 |
/**
|
13 |
* Create the types metabox.
|
14 |
*
|
@@ -40,24 +40,24 @@ function mtphr_dnt_metabox_types() {
|
|
40 |
);
|
41 |
new MTPHR_DNT_MetaBoxer( $dnt_types );
|
42 |
}
|
43 |
-
|
44 |
-
|
45 |
|
46 |
|
47 |
-
|
|
|
|
|
48 |
/**
|
49 |
* Create the default type metabox.
|
50 |
*
|
51 |
* @since 1.1.4
|
52 |
*/
|
53 |
function mtphr_dnt_metabox_type_default() {
|
54 |
-
|
55 |
$tick_type = 'textarea';
|
56 |
$settings = get_option( 'mtphr_dnt_general_settings' );
|
57 |
if( $settings && isset($settings['wysiwyg']) ) {
|
58 |
-
|
59 |
}
|
60 |
-
|
61 |
// Create an array to store the default item structure
|
62 |
$tick_structure = array(
|
63 |
'tick' => array(
|
@@ -80,17 +80,17 @@ function mtphr_dnt_metabox_type_default() {
|
|
80 |
'type' => 'checkbox'
|
81 |
)
|
82 |
);
|
83 |
-
|
84 |
// Create an array to store the fields
|
85 |
$default_fields = array();
|
86 |
-
|
87 |
// Add the items field
|
88 |
$default_fields['ticks'] = array(
|
89 |
'id' => '_mtphr_dnt_ticks',
|
90 |
'type' => 'list',
|
91 |
'structure' => apply_filters('mtphr_dnt_default_tick_structure', $tick_structure)
|
92 |
);
|
93 |
-
|
94 |
// Create the metabox
|
95 |
$dnt_default_data = array(
|
96 |
'id' => 'mtphr_dnt_type_default',
|
@@ -106,7 +106,7 @@ function mtphr_dnt_metabox_type_default() {
|
|
106 |
|
107 |
|
108 |
|
109 |
-
add_action( 'admin_init', 'mtphr_dnt_metabox_modes', 11 );
|
110 |
/**
|
111 |
* Create the modes metabox.
|
112 |
*
|
@@ -124,7 +124,7 @@ function mtphr_dnt_metabox_modes() {
|
|
124 |
'options' => mtphr_dnt_modes_array(),
|
125 |
'default' => 'scroll'
|
126 |
);
|
127 |
-
|
128 |
/* Create the modes metabox. */
|
129 |
$dnt_modes = array(
|
130 |
'id' => 'mtphr_dnt_modes',
|
@@ -140,7 +140,7 @@ function mtphr_dnt_metabox_modes() {
|
|
140 |
|
141 |
|
142 |
|
143 |
-
add_action( 'admin_init', 'mtphr_dnt_mode_metabox_scroll', 12 );
|
144 |
/**
|
145 |
* Create the scroll mode metabox.
|
146 |
*
|
@@ -150,7 +150,7 @@ function mtphr_dnt_mode_metabox_scroll() {
|
|
150 |
|
151 |
// Create an array to store the fields
|
152 |
$scroll_fields = array();
|
153 |
-
|
154 |
// Add the dimensions field
|
155 |
$scroll_fields['direction'] = array(
|
156 |
'id' => '_mtphr_dnt_scroll_direction',
|
@@ -183,7 +183,7 @@ function mtphr_dnt_mode_metabox_scroll() {
|
|
183 |
)
|
184 |
)
|
185 |
);
|
186 |
-
|
187 |
// Add the spacing field
|
188 |
$scroll_fields['scroller_padding'] = array(
|
189 |
'id' => '_mtphr_dnt_scroll_padding',
|
@@ -200,7 +200,7 @@ function mtphr_dnt_mode_metabox_scroll() {
|
|
200 |
)
|
201 |
)
|
202 |
);
|
203 |
-
|
204 |
// Add the slide speed field
|
205 |
$scroll_fields['scroll_speed'] = array(
|
206 |
'id' => '_mtphr_dnt_scroll_speed',
|
@@ -215,7 +215,7 @@ function mtphr_dnt_mode_metabox_scroll() {
|
|
215 |
)
|
216 |
)
|
217 |
);
|
218 |
-
|
219 |
// Add the slide spacing field
|
220 |
$scroll_fields['tick_spacing'] = array(
|
221 |
'id' => '_mtphr_dnt_scroll_tick_spacing',
|
@@ -225,7 +225,7 @@ function mtphr_dnt_mode_metabox_scroll() {
|
|
225 |
'after' => __('Pixels', 'ditty-news-ticker'),
|
226 |
'description' => __('Set the spacing between scrolling data.', 'ditty-news-ticker')
|
227 |
);
|
228 |
-
|
229 |
// Create the metabox
|
230 |
$dnt_scroll_settings = array(
|
231 |
'id' => 'mtphr_dnt_mode_scroll',
|
@@ -241,7 +241,7 @@ function mtphr_dnt_mode_metabox_scroll() {
|
|
241 |
|
242 |
|
243 |
|
244 |
-
add_action( 'admin_init', 'mtphr_dnt_mode_metabox_rotate', 12 );
|
245 |
/**
|
246 |
* Create the rotate metabox.
|
247 |
*
|
@@ -251,7 +251,7 @@ function mtphr_dnt_mode_metabox_rotate() {
|
|
251 |
|
252 |
// Create an array to store the fields
|
253 |
$rotate_fields = array();
|
254 |
-
|
255 |
// Add the dimensions field
|
256 |
$rotate_fields['type'] = array(
|
257 |
'id' => '_mtphr_dnt_rotate_type',
|
@@ -284,7 +284,7 @@ function mtphr_dnt_mode_metabox_rotate() {
|
|
284 |
'before' => __('Height', 'ditty-news-ticker'),
|
285 |
'description' => __('Override the auto dimensions with specific values.', 'ditty-news-ticker')
|
286 |
);
|
287 |
-
|
288 |
// Add the spacing field
|
289 |
$rotate_fields['rotate_padding'] = array(
|
290 |
'id' => '_mtphr_dnt_rotate_padding',
|
@@ -301,7 +301,7 @@ function mtphr_dnt_mode_metabox_rotate() {
|
|
301 |
)
|
302 |
)
|
303 |
);
|
304 |
-
|
305 |
// Add the rotate delay field
|
306 |
$rotate_fields['rotate_delay'] = array(
|
307 |
'id' => '_mtphr_dnt_auto_rotate',
|
@@ -321,7 +321,7 @@ function mtphr_dnt_mode_metabox_rotate() {
|
|
321 |
)
|
322 |
)
|
323 |
);
|
324 |
-
|
325 |
// Add the rotate speed field
|
326 |
$rotate_fields['rotate_speed'] = array(
|
327 |
'id' => '_mtphr_dnt_rotate_speed',
|
@@ -337,7 +337,7 @@ function mtphr_dnt_mode_metabox_rotate() {
|
|
337 |
)
|
338 |
)
|
339 |
);
|
340 |
-
|
341 |
// Add the rotate navigation field
|
342 |
$rotate_fields['rotate_directional_nav'] = array(
|
343 |
'id' => '_mtphr_dnt_rotate_directional_nav',
|
@@ -352,7 +352,7 @@ function mtphr_dnt_mode_metabox_rotate() {
|
|
352 |
)
|
353 |
)
|
354 |
);
|
355 |
-
|
356 |
// Add the rotate navigation field
|
357 |
$rotate_fields['rotate_control_nav'] = array(
|
358 |
'id' => '_mtphr_dnt_rotate_control_nav',
|
@@ -372,7 +372,7 @@ function mtphr_dnt_mode_metabox_rotate() {
|
|
372 |
)
|
373 |
)
|
374 |
);
|
375 |
-
|
376 |
// Create the metabox
|
377 |
$dnt_rotate_settings = array(
|
378 |
'id' => 'mtphr_dnt_mode_rotate',
|
@@ -388,7 +388,7 @@ function mtphr_dnt_mode_metabox_rotate() {
|
|
388 |
|
389 |
|
390 |
|
391 |
-
add_action( 'admin_init', 'mtphr_dnt_mode_metabox_list', 12 );
|
392 |
/**
|
393 |
* Create the list metabox.
|
394 |
*
|
@@ -398,7 +398,7 @@ function mtphr_dnt_mode_metabox_list() {
|
|
398 |
|
399 |
// Create an array to store the fields
|
400 |
$list_fields = array();
|
401 |
-
|
402 |
// Add the spacing field
|
403 |
$list_fields['list_padding'] = array(
|
404 |
'id' => '_mtphr_dnt_list_padding',
|
@@ -415,7 +415,7 @@ function mtphr_dnt_mode_metabox_list() {
|
|
415 |
)
|
416 |
)
|
417 |
);
|
418 |
-
|
419 |
// Add the list spacing field
|
420 |
$list_fields['tick_spacing'] = array(
|
421 |
'id' => '_mtphr_dnt_list_tick_spacing',
|
@@ -425,7 +425,7 @@ function mtphr_dnt_mode_metabox_list() {
|
|
425 |
'after' => __('Pixels', 'ditty-news-ticker'),
|
426 |
'description' => __('Set the spacing between ticks.', 'ditty-news-ticker')
|
427 |
);
|
428 |
-
|
429 |
// Create the metabox
|
430 |
$dnt_list_settings = array(
|
431 |
'id' => 'mtphr_dnt_mode_list',
|
@@ -441,7 +441,7 @@ function mtphr_dnt_mode_metabox_list() {
|
|
441 |
|
442 |
|
443 |
|
444 |
-
add_action( 'admin_init', 'mtphr_dnt_global_settings', 13 );
|
445 |
/**
|
446 |
* Create the display metabox.
|
447 |
*
|
@@ -451,7 +451,7 @@ function mtphr_dnt_global_settings() {
|
|
451 |
|
452 |
// Create an array to store the fields
|
453 |
$global_fields = array();
|
454 |
-
|
455 |
// Add the title field
|
456 |
$global_fields['title'] = array(
|
457 |
'id' => '_mtphr_dnt_title',
|
@@ -464,7 +464,7 @@ function mtphr_dnt_global_settings() {
|
|
464 |
)
|
465 |
)
|
466 |
);
|
467 |
-
|
468 |
// Add the title field
|
469 |
$global_fields['ticker_width'] = array(
|
470 |
'id' => '_mtphr_dnt_ticker_width',
|
@@ -488,7 +488,7 @@ function mtphr_dnt_global_settings() {
|
|
488 |
|
489 |
|
490 |
|
491 |
-
add_action( 'admin_init', 'mtphr_dnt_display_metabox', 13 );
|
492 |
/**
|
493 |
* Create the display metabox.
|
494 |
*
|
@@ -498,7 +498,7 @@ function mtphr_dnt_display_metabox() {
|
|
498 |
|
499 |
// Create an array to store the fields
|
500 |
$display_fields = array();
|
501 |
-
|
502 |
// Add the shortcode field
|
503 |
$display_fields['shortcode'] = array(
|
504 |
'id' => '_mtphr_dnt_shortcode',
|
@@ -507,7 +507,7 @@ function mtphr_dnt_display_metabox() {
|
|
507 |
'button' => __('Select Shortcode', 'ditty-news-ticker'),
|
508 |
'description' => __('Use this shortcode to insert the ticker into a post/page.', 'ditty-news-ticker'),
|
509 |
);
|
510 |
-
|
511 |
// Add the function field
|
512 |
$display_fields['function'] = array(
|
513 |
'id' => '_mtphr_dnt_function',
|
@@ -516,7 +516,7 @@ function mtphr_dnt_display_metabox() {
|
|
516 |
'button' => __('Select Function', 'ditty-news-ticker'),
|
517 |
'description' => __('Place this code directly into your theme to display the ticker.', 'ditty-news-ticker'),
|
518 |
);
|
519 |
-
|
520 |
// Create the metabox
|
521 |
$dnt_display = array(
|
522 |
'id' => 'mtphr_dnt_display',
|
4 |
*
|
5 |
* @package Ditty News Ticker
|
6 |
*/
|
|
|
7 |
|
8 |
|
9 |
|
10 |
+
|
11 |
+
add_action( 'admin_init', 'mtphr_dnt_metabox_types', 9 );
|
12 |
/**
|
13 |
* Create the types metabox.
|
14 |
*
|
40 |
);
|
41 |
new MTPHR_DNT_MetaBoxer( $dnt_types );
|
42 |
}
|
|
|
|
|
43 |
|
44 |
|
45 |
+
|
46 |
+
|
47 |
+
add_action( 'admin_init', 'mtphr_dnt_metabox_type_default' );
|
48 |
/**
|
49 |
* Create the default type metabox.
|
50 |
*
|
51 |
* @since 1.1.4
|
52 |
*/
|
53 |
function mtphr_dnt_metabox_type_default() {
|
54 |
+
|
55 |
$tick_type = 'textarea';
|
56 |
$settings = get_option( 'mtphr_dnt_general_settings' );
|
57 |
if( $settings && isset($settings['wysiwyg']) ) {
|
58 |
+
$tick_type = 'wysiwyg';
|
59 |
}
|
60 |
+
|
61 |
// Create an array to store the default item structure
|
62 |
$tick_structure = array(
|
63 |
'tick' => array(
|
80 |
'type' => 'checkbox'
|
81 |
)
|
82 |
);
|
83 |
+
|
84 |
// Create an array to store the fields
|
85 |
$default_fields = array();
|
86 |
+
|
87 |
// Add the items field
|
88 |
$default_fields['ticks'] = array(
|
89 |
'id' => '_mtphr_dnt_ticks',
|
90 |
'type' => 'list',
|
91 |
'structure' => apply_filters('mtphr_dnt_default_tick_structure', $tick_structure)
|
92 |
);
|
93 |
+
|
94 |
// Create the metabox
|
95 |
$dnt_default_data = array(
|
96 |
'id' => 'mtphr_dnt_type_default',
|
106 |
|
107 |
|
108 |
|
109 |
+
add_action( 'admin_init', 'mtphr_dnt_metabox_modes', 11 );
|
110 |
/**
|
111 |
* Create the modes metabox.
|
112 |
*
|
124 |
'options' => mtphr_dnt_modes_array(),
|
125 |
'default' => 'scroll'
|
126 |
);
|
127 |
+
|
128 |
/* Create the modes metabox. */
|
129 |
$dnt_modes = array(
|
130 |
'id' => 'mtphr_dnt_modes',
|
140 |
|
141 |
|
142 |
|
143 |
+
add_action( 'admin_init', 'mtphr_dnt_mode_metabox_scroll', 12 );
|
144 |
/**
|
145 |
* Create the scroll mode metabox.
|
146 |
*
|
150 |
|
151 |
// Create an array to store the fields
|
152 |
$scroll_fields = array();
|
153 |
+
|
154 |
// Add the dimensions field
|
155 |
$scroll_fields['direction'] = array(
|
156 |
'id' => '_mtphr_dnt_scroll_direction',
|
183 |
)
|
184 |
)
|
185 |
);
|
186 |
+
|
187 |
// Add the spacing field
|
188 |
$scroll_fields['scroller_padding'] = array(
|
189 |
'id' => '_mtphr_dnt_scroll_padding',
|
200 |
)
|
201 |
)
|
202 |
);
|
203 |
+
|
204 |
// Add the slide speed field
|
205 |
$scroll_fields['scroll_speed'] = array(
|
206 |
'id' => '_mtphr_dnt_scroll_speed',
|
215 |
)
|
216 |
)
|
217 |
);
|
218 |
+
|
219 |
// Add the slide spacing field
|
220 |
$scroll_fields['tick_spacing'] = array(
|
221 |
'id' => '_mtphr_dnt_scroll_tick_spacing',
|
225 |
'after' => __('Pixels', 'ditty-news-ticker'),
|
226 |
'description' => __('Set the spacing between scrolling data.', 'ditty-news-ticker')
|
227 |
);
|
228 |
+
|
229 |
// Create the metabox
|
230 |
$dnt_scroll_settings = array(
|
231 |
'id' => 'mtphr_dnt_mode_scroll',
|
241 |
|
242 |
|
243 |
|
244 |
+
add_action( 'admin_init', 'mtphr_dnt_mode_metabox_rotate', 12 );
|
245 |
/**
|
246 |
* Create the rotate metabox.
|
247 |
*
|
251 |
|
252 |
// Create an array to store the fields
|
253 |
$rotate_fields = array();
|
254 |
+
|
255 |
// Add the dimensions field
|
256 |
$rotate_fields['type'] = array(
|
257 |
'id' => '_mtphr_dnt_rotate_type',
|
284 |
'before' => __('Height', 'ditty-news-ticker'),
|
285 |
'description' => __('Override the auto dimensions with specific values.', 'ditty-news-ticker')
|
286 |
);
|
287 |
+
|
288 |
// Add the spacing field
|
289 |
$rotate_fields['rotate_padding'] = array(
|
290 |
'id' => '_mtphr_dnt_rotate_padding',
|
301 |
)
|
302 |
)
|
303 |
);
|
304 |
+
|
305 |
// Add the rotate delay field
|
306 |
$rotate_fields['rotate_delay'] = array(
|
307 |
'id' => '_mtphr_dnt_auto_rotate',
|
321 |
)
|
322 |
)
|
323 |
);
|
324 |
+
|
325 |
// Add the rotate speed field
|
326 |
$rotate_fields['rotate_speed'] = array(
|
327 |
'id' => '_mtphr_dnt_rotate_speed',
|
337 |
)
|
338 |
)
|
339 |
);
|
340 |
+
|
341 |
// Add the rotate navigation field
|
342 |
$rotate_fields['rotate_directional_nav'] = array(
|
343 |
'id' => '_mtphr_dnt_rotate_directional_nav',
|
352 |
)
|
353 |
)
|
354 |
);
|
355 |
+
|
356 |
// Add the rotate navigation field
|
357 |
$rotate_fields['rotate_control_nav'] = array(
|
358 |
'id' => '_mtphr_dnt_rotate_control_nav',
|
372 |
)
|
373 |
)
|
374 |
);
|
375 |
+
|
376 |
// Create the metabox
|
377 |
$dnt_rotate_settings = array(
|
378 |
'id' => 'mtphr_dnt_mode_rotate',
|
388 |
|
389 |
|
390 |
|
391 |
+
add_action( 'admin_init', 'mtphr_dnt_mode_metabox_list', 12 );
|
392 |
/**
|
393 |
* Create the list metabox.
|
394 |
*
|
398 |
|
399 |
// Create an array to store the fields
|
400 |
$list_fields = array();
|
401 |
+
|
402 |
// Add the spacing field
|
403 |
$list_fields['list_padding'] = array(
|
404 |
'id' => '_mtphr_dnt_list_padding',
|
415 |
)
|
416 |
)
|
417 |
);
|
418 |
+
|
419 |
// Add the list spacing field
|
420 |
$list_fields['tick_spacing'] = array(
|
421 |
'id' => '_mtphr_dnt_list_tick_spacing',
|
425 |
'after' => __('Pixels', 'ditty-news-ticker'),
|
426 |
'description' => __('Set the spacing between ticks.', 'ditty-news-ticker')
|
427 |
);
|
428 |
+
|
429 |
// Create the metabox
|
430 |
$dnt_list_settings = array(
|
431 |
'id' => 'mtphr_dnt_mode_list',
|
441 |
|
442 |
|
443 |
|
444 |
+
add_action( 'admin_init', 'mtphr_dnt_global_settings', 13 );
|
445 |
/**
|
446 |
* Create the display metabox.
|
447 |
*
|
451 |
|
452 |
// Create an array to store the fields
|
453 |
$global_fields = array();
|
454 |
+
|
455 |
// Add the title field
|
456 |
$global_fields['title'] = array(
|
457 |
'id' => '_mtphr_dnt_title',
|
464 |
)
|
465 |
)
|
466 |
);
|
467 |
+
|
468 |
// Add the title field
|
469 |
$global_fields['ticker_width'] = array(
|
470 |
'id' => '_mtphr_dnt_ticker_width',
|
488 |
|
489 |
|
490 |
|
491 |
+
add_action( 'admin_init', 'mtphr_dnt_display_metabox', 13 );
|
492 |
/**
|
493 |
* Create the display metabox.
|
494 |
*
|
498 |
|
499 |
// Create an array to store the fields
|
500 |
$display_fields = array();
|
501 |
+
|
502 |
// Add the shortcode field
|
503 |
$display_fields['shortcode'] = array(
|
504 |
'id' => '_mtphr_dnt_shortcode',
|
507 |
'button' => __('Select Shortcode', 'ditty-news-ticker'),
|
508 |
'description' => __('Use this shortcode to insert the ticker into a post/page.', 'ditty-news-ticker'),
|
509 |
);
|
510 |
+
|
511 |
// Add the function field
|
512 |
$display_fields['function'] = array(
|
513 |
'id' => '_mtphr_dnt_function',
|
516 |
'button' => __('Select Function', 'ditty-news-ticker'),
|
517 |
'description' => __('Place this code directly into your theme to display the ticker.', 'ditty-news-ticker'),
|
518 |
);
|
519 |
+
|
520 |
// Create the metabox
|
521 |
$dnt_display = array(
|
522 |
'id' => 'mtphr_dnt_display',
|
includes/metaboxer/metaboxer.css
CHANGED
@@ -103,7 +103,7 @@
|
|
103 |
border: 1px solid #EEE;
|
104 |
white-space: normal;
|
105 |
word-break: break-all;
|
106 |
-
|
107 |
-webkit-border-radius: 5px;
|
108 |
-moz-border-radius: 5px;
|
109 |
border-radius: 5px;
|
@@ -129,7 +129,7 @@
|
|
129 |
border: 1px solid #EEE;
|
130 |
white-space: normal;
|
131 |
text-decoration: none;
|
132 |
-
|
133 |
-webkit-border-radius: 5px;
|
134 |
-moz-border-radius: 5px;
|
135 |
border-radius: 5px;
|
@@ -175,7 +175,7 @@
|
|
175 |
border: 1px solid #EEE;
|
176 |
white-space: normal;
|
177 |
text-decoration: none;
|
178 |
-
|
179 |
-webkit-border-radius: 5px;
|
180 |
-moz-border-radius: 5px;
|
181 |
border-radius: 5px;
|
@@ -332,10 +332,16 @@ a.mtphr-dnt-metaboxer-image-select-link.selected img {
|
|
332 |
/* WYSIWYG
|
333 |
------------------------------------------------------------ */
|
334 |
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
.mtphr-dnt-metaboxer-wysiwyg {
|
336 |
max-width: 800px;
|
337 |
}
|
338 |
-
.mtphr-dnt-metaboxer-wysiwyg .
|
339 |
background: #FFF;
|
340 |
}
|
341 |
|
103 |
border: 1px solid #EEE;
|
104 |
white-space: normal;
|
105 |
word-break: break-all;
|
106 |
+
|
107 |
-webkit-border-radius: 5px;
|
108 |
-moz-border-radius: 5px;
|
109 |
border-radius: 5px;
|
129 |
border: 1px solid #EEE;
|
130 |
white-space: normal;
|
131 |
text-decoration: none;
|
132 |
+
|
133 |
-webkit-border-radius: 5px;
|
134 |
-moz-border-radius: 5px;
|
135 |
border-radius: 5px;
|
175 |
border: 1px solid #EEE;
|
176 |
white-space: normal;
|
177 |
text-decoration: none;
|
178 |
+
|
179 |
-webkit-border-radius: 5px;
|
180 |
-moz-border-radius: 5px;
|
181 |
border-radius: 5px;
|
332 |
/* WYSIWYG
|
333 |
------------------------------------------------------------ */
|
334 |
|
335 |
+
.mtphr-dnt-metaboxer-wysiwyg-placeholder {
|
336 |
+
background: #EFEFEF;
|
337 |
+
border: 1px dashed #CCC;
|
338 |
+
padding: 30px;
|
339 |
+
margin-bottom: 10px;
|
340 |
+
}
|
341 |
.mtphr-dnt-metaboxer-wysiwyg {
|
342 |
max-width: 800px;
|
343 |
}
|
344 |
+
.mtphr-dnt-metaboxer-wysiwyg .mceContentBody {
|
345 |
background: #FFF;
|
346 |
}
|
347 |
|
includes/metaboxer/metaboxer.js
CHANGED
@@ -9,7 +9,7 @@ jQuery(document).ready( function($) {
|
|
9 |
*/
|
10 |
$('.mtphr-dnt-metaboxer-code-select').click( function(e) {
|
11 |
e.preventDefault();
|
12 |
-
|
13 |
var $pre = $(this).parents('.mtphr-dnt-metaboxer-code').find('pre');
|
14 |
var refNode = $pre[0];
|
15 |
if ( jQuery.browser.msie ) {
|
@@ -36,7 +36,7 @@ $('.mtphr-dnt-metaboxer-code-select').click( function(e) {
|
|
36 |
* @since 1.0.0
|
37 |
*/
|
38 |
$('.mtphr-dnt-metaboxer-file').each( function(index) {
|
39 |
-
|
40 |
// If there currently isn't a value, show the upload button
|
41 |
if( $(this).find('.mtphr-dnt-metaboxer-file-value').val() == '' ) {
|
42 |
$(this).find('.mtphr-dnt-metaboxer-file-upload').css('display','inline-block');
|
@@ -45,17 +45,17 @@ $('.mtphr-dnt-metaboxer-file').each( function(index) {
|
|
45 |
|
46 |
// Custom media upload functionality
|
47 |
$('.mtphr-dnt-metaboxer-file-upload').click(function() {
|
48 |
-
|
49 |
// Save the container
|
50 |
var $container = $(this).parent('.mtphr-dnt-metaboxer-file-contents');
|
51 |
-
|
52 |
var send_attachment_bkp = wp.media.editor.send.attachment;
|
53 |
|
54 |
wp.media.editor.send.attachment = function( props, attachment ) {
|
55 |
|
56 |
// Set the field value
|
57 |
$container.find('.mtphr-dnt-metaboxer-file-value').val(attachment.id);
|
58 |
-
|
59 |
// Create the display
|
60 |
var data = {
|
61 |
action: 'mtphr_dnt_metaboxer_ajax_file_display',
|
@@ -70,33 +70,33 @@ $('.mtphr-dnt-metaboxer-file-upload').click(function() {
|
|
70 |
|
71 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
72 |
jQuery.post( ajaxurl, data, function( response ) {
|
73 |
-
|
74 |
// Append the new data
|
75 |
$container.append( response );
|
76 |
-
|
77 |
// Hide the upload button
|
78 |
$container.find('.mtphr-dnt-metaboxer-file-upload').hide();
|
79 |
});
|
80 |
|
81 |
wp.media.editor.send.attachment = send_attachment_bkp;
|
82 |
}
|
83 |
-
|
84 |
wp.media.editor.open();
|
85 |
|
86 |
-
return false;
|
87 |
});
|
88 |
|
89 |
$('.mtphr-dnt-metaboxer-file-delete').live('click',function() {
|
90 |
-
|
91 |
// Save the container
|
92 |
var $container = $(this).parents('.mtphr-dnt-metaboxer-file-contents');
|
93 |
-
|
94 |
// Remove the field value
|
95 |
$container.find('.mtphr-dnt-metaboxer-file-value').val('');
|
96 |
-
|
97 |
// Remove the current display
|
98 |
$container.find('.mtphr-dnt-metaboxer-file-table').remove();
|
99 |
-
|
100 |
// Disply the upload button
|
101 |
$container.find('.mtphr-dnt-metaboxer-file-upload').css('display','inline-block');
|
102 |
});
|
@@ -109,7 +109,7 @@ $('.mtphr-dnt-metaboxer-file-delete').live('click',function() {
|
|
109 |
* @since 1.0.0
|
110 |
*/
|
111 |
$('.mtphr-dnt-metaboxer-image').each( function(index) {
|
112 |
-
|
113 |
// If there currently isn't a value, show the upload button
|
114 |
if( $(this).find('.mtphr-dnt-metaboxer-image-value').val() == '' ) {
|
115 |
$(this).find('.mtphr-dnt-metaboxer-image-upload').css('display','inline-block');
|
@@ -118,10 +118,10 @@ $('.mtphr-dnt-metaboxer-image').each( function(index) {
|
|
118 |
|
119 |
// Image upload functionality
|
120 |
$('.mtphr-dnt-metaboxer-image-upload').click(function() {
|
121 |
-
|
122 |
// Save the container
|
123 |
var $container = $(this).parent('.mtphr-dnt-metaboxer-image-contents');
|
124 |
-
|
125 |
var send_attachment_bkp = wp.media.editor.send.attachment;
|
126 |
|
127 |
wp.media.editor.send.attachment = function( props, attachment ) {
|
@@ -143,33 +143,33 @@ $('.mtphr-dnt-metaboxer-image-upload').click(function() {
|
|
143 |
|
144 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
145 |
jQuery.post( ajaxurl, data, function( response ) {
|
146 |
-
|
147 |
// Append the new data
|
148 |
$container.append( response );
|
149 |
-
|
150 |
// Hide the upload button
|
151 |
$container.find('.mtphr-dnt-metaboxer-image-upload').hide();
|
152 |
});
|
153 |
|
154 |
wp.media.editor.send.attachment = send_attachment_bkp;
|
155 |
}
|
156 |
-
|
157 |
wp.media.editor.open();
|
158 |
|
159 |
-
return false;
|
160 |
});
|
161 |
|
162 |
$('.mtphr-dnt-metaboxer-image-delete').live('click',function() {
|
163 |
-
|
164 |
// Save the container
|
165 |
var $container = $(this).parents('.mtphr-dnt-metaboxer-image-contents');
|
166 |
-
|
167 |
// Remove the field value
|
168 |
$container.find('.mtphr-dnt-metaboxer-image-value').val('');
|
169 |
-
|
170 |
// Remove the current display
|
171 |
$container.find('.mtphr-dnt-metaboxer-image-table').remove();
|
172 |
-
|
173 |
// Disply the upload button
|
174 |
$container.find('.mtphr-dnt-metaboxer-image-upload').css('display','inline-block');
|
175 |
});
|
@@ -183,15 +183,15 @@ $('.mtphr-dnt-metaboxer-image-delete').live('click',function() {
|
|
183 |
* @since 1.0
|
184 |
*/
|
185 |
$('.mtphr-dnt-metaboxer-image-select-link').click( function(e) {
|
186 |
-
|
187 |
e.preventDefault();
|
188 |
-
|
189 |
// Get the value
|
190 |
var val = $(this).attr('href');
|
191 |
-
|
192 |
// Save the value to the input
|
193 |
$(this).siblings('input[type="hidden"]').val(val);
|
194 |
-
|
195 |
// Set & remove selected
|
196 |
$(this).siblings('.mtphr-dnt-metaboxer-image-select-link').removeClass('selected');
|
197 |
$(this).addClass('selected');
|
@@ -203,12 +203,12 @@ $('.mtphr-dnt-metaboxer-image-select-link').click( function(e) {
|
|
203 |
* Add list functionality.
|
204 |
*
|
205 |
* @since 1.0.0
|
206 |
-
*/
|
207 |
$('.mtphr-dnt-metaboxer-list').each( function(index) {
|
208 |
|
209 |
// Set the field order
|
210 |
mtphr_dnt_metaboxer_lists_set_order( $(this) );
|
211 |
-
|
212 |
// Add sorting to the items
|
213 |
mtphr_dnt_metaboxer_lists_set_sortable( $(this) );
|
214 |
});
|
@@ -230,11 +230,11 @@ function mtphr_dnt_metaboxer_lists_set_sortable( $list ) {
|
|
230 |
return $helper;
|
231 |
},
|
232 |
update: function( event, ui ) {
|
233 |
-
|
234 |
// Set the field order
|
235 |
mtphr_dnt_metaboxer_lists_set_order( $(this) );
|
236 |
}
|
237 |
-
});
|
238 |
}
|
239 |
|
240 |
// List - set the list item order
|
@@ -242,18 +242,18 @@ function mtphr_dnt_metaboxer_lists_set_order( $list ) {
|
|
242 |
|
243 |
// Set the order of the items
|
244 |
$list.find('.mtphr-dnt-metaboxer-list-item').each( function(i) {
|
245 |
-
|
246 |
$(this).find('.mtphr-dnt-metaboxer-list-structure-item').each( function(e) {
|
247 |
-
|
248 |
var base = $(this).attr('base');
|
249 |
var field = $(this).attr('field');
|
250 |
$(this).find('input,textarea,select').attr('name', base+'['+i+']['+field+']');
|
251 |
});
|
252 |
});
|
253 |
-
|
254 |
// Hide the delete if only one element
|
255 |
if( $list.find('.mtphr-dnt-metaboxer-list-item').length == 1 ) {
|
256 |
-
|
257 |
$list.find('.mtphr-dnt-metaboxer-list-item-handle,.mtphr-dnt-metaboxer-list-item-delete').hide();
|
258 |
}
|
259 |
}
|
@@ -265,16 +265,23 @@ $('.mtphr-dnt-metaboxer-list-item-add').live( 'click', function(e) {
|
|
265 |
// Create a new item with blank content
|
266 |
var $parent = $(this).parents('.mtphr-dnt-metaboxer-list-item');
|
267 |
var $new = $parent.clone(true).hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
$new.find('input,textarea,select').removeAttr('value').removeAttr('checked').removeAttr('selected');
|
269 |
$parent.after($new);
|
270 |
$new.fadeIn().css('display', 'table-row');
|
271 |
-
|
272 |
// Set the field order
|
273 |
mtphr_dnt_metaboxer_lists_set_order( $(this).parents('.mtphr-dnt-metaboxer-list') );
|
274 |
-
|
275 |
// Show the handles
|
276 |
$(this).parents('.mtphr-dnt-metaboxer-list').find('.mtphr-dnt-metaboxer-list-item-handle,.mtphr-dnt-metaboxer-list-item-delete').show();
|
277 |
-
|
278 |
// Set the focus to the new input
|
279 |
var inputs = $new.find('input,textarea,select');
|
280 |
$(inputs[0]).focus();
|
@@ -283,16 +290,16 @@ $('.mtphr-dnt-metaboxer-list-item-add').live( 'click', function(e) {
|
|
283 |
// List - delete item click
|
284 |
$('.mtphr-dnt-metaboxer-list-item-delete').live( 'click', function(e) {
|
285 |
e.preventDefault();
|
286 |
-
|
287 |
// Fade out the item
|
288 |
$(this).parents('.mtphr-dnt-metaboxer-list-item').fadeOut( function() {
|
289 |
-
|
290 |
// Get the list
|
291 |
var $list = $(this).parents('.mtphr-dnt-metaboxer-list');
|
292 |
-
|
293 |
// Remove the item
|
294 |
$(this).remove();
|
295 |
-
|
296 |
// Set the field order
|
297 |
mtphr_dnt_metaboxer_lists_set_order( $list );
|
298 |
});
|
@@ -315,16 +322,16 @@ $('.mtphr-dnt-metaboxer-field-metabox_toggle').each( function(index) {
|
|
315 |
// Create an array to store all the toggled metaboxes
|
316 |
var metaboxes = Array();
|
317 |
$(this).find('.mtphr-dnt-metaboxer-metabox-toggle').each( function(index) {
|
318 |
-
|
319 |
// Get the metaboxes and merge into the main array
|
320 |
var m = $(this).attr('metaboxes').split(',');
|
321 |
$.merge( metaboxes, m );
|
322 |
});
|
323 |
var total_metaboxes = metaboxes.length;
|
324 |
-
|
325 |
// Hide the toggled metaboxes
|
326 |
mtphr_dnt_metaboxer_metabox_hide();
|
327 |
-
|
328 |
// Display the current metaboxes
|
329 |
if( $(this).find('.mtphr-dnt-metaboxer-metabox-toggle.button-primary').length > 0 ) {
|
330 |
$init_button = $(this).find('.mtphr-dnt-metaboxer-metabox-toggle.button-primary');
|
@@ -333,7 +340,7 @@ $('.mtphr-dnt-metaboxer-field-metabox_toggle').each( function(index) {
|
|
333 |
$init_button.addClass('button-primary');
|
334 |
}
|
335 |
mtphr_dnt_metaboxer_metabox_show( $init_button );
|
336 |
-
|
337 |
// Hide the toggled metaboxes
|
338 |
function mtphr_dnt_metaboxer_metabox_hide() {
|
339 |
for( var i=0; i<total_metaboxes; i++ ) {
|
@@ -341,31 +348,31 @@ $('.mtphr-dnt-metaboxer-field-metabox_toggle').each( function(index) {
|
|
341 |
$('input[name="'+metaboxes[i]+'-hide"]').removeAttr('checked');
|
342 |
}
|
343 |
}
|
344 |
-
|
345 |
// Show the selected metaboxes
|
346 |
function mtphr_dnt_metaboxer_metabox_show( $button ) {
|
347 |
-
|
348 |
// Get and display the selected metaboxes
|
349 |
var m = $button.attr('metaboxes').split(',');
|
350 |
var t = m.length;
|
351 |
-
|
352 |
// Show all the toggled metaboxes
|
353 |
for( var i=0; i<t; i++ ) {
|
354 |
$('#'+m[i]).show();
|
355 |
$('input[name="'+m[i]+'-hide"]').attr('checked', 'checked');
|
356 |
}
|
357 |
-
|
358 |
// Store the new value
|
359 |
$button.siblings('input').val($button.attr('href'));
|
360 |
}
|
361 |
-
|
362 |
// Select the code on button click
|
363 |
$(this).find('.mtphr-dnt-metaboxer-metabox-toggle').click( function(e) {
|
364 |
e.preventDefault();
|
365 |
|
366 |
// Hide all the toggled metaboxes
|
367 |
mtphr_dnt_metaboxer_metabox_hide();
|
368 |
-
|
369 |
// Show the selected metaboxes
|
370 |
mtphr_dnt_metaboxer_metabox_show( $(this) );
|
371 |
|
@@ -383,7 +390,7 @@ $('.mtphr-dnt-metaboxer-field-metabox_toggle').each( function(index) {
|
|
383 |
* @since 1.0.1
|
384 |
*/
|
385 |
$('.mtphr-dnt-metaboxer-sort').each( function(index) {
|
386 |
-
|
387 |
// Add sorting to the items
|
388 |
$(this).sortable( {
|
389 |
handle: '.mtphr-dnt-metaboxer-sort-item-handle',
|
9 |
*/
|
10 |
$('.mtphr-dnt-metaboxer-code-select').click( function(e) {
|
11 |
e.preventDefault();
|
12 |
+
|
13 |
var $pre = $(this).parents('.mtphr-dnt-metaboxer-code').find('pre');
|
14 |
var refNode = $pre[0];
|
15 |
if ( jQuery.browser.msie ) {
|
36 |
* @since 1.0.0
|
37 |
*/
|
38 |
$('.mtphr-dnt-metaboxer-file').each( function(index) {
|
39 |
+
|
40 |
// If there currently isn't a value, show the upload button
|
41 |
if( $(this).find('.mtphr-dnt-metaboxer-file-value').val() == '' ) {
|
42 |
$(this).find('.mtphr-dnt-metaboxer-file-upload').css('display','inline-block');
|
45 |
|
46 |
// Custom media upload functionality
|
47 |
$('.mtphr-dnt-metaboxer-file-upload').click(function() {
|
48 |
+
|
49 |
// Save the container
|
50 |
var $container = $(this).parent('.mtphr-dnt-metaboxer-file-contents');
|
51 |
+
|
52 |
var send_attachment_bkp = wp.media.editor.send.attachment;
|
53 |
|
54 |
wp.media.editor.send.attachment = function( props, attachment ) {
|
55 |
|
56 |
// Set the field value
|
57 |
$container.find('.mtphr-dnt-metaboxer-file-value').val(attachment.id);
|
58 |
+
|
59 |
// Create the display
|
60 |
var data = {
|
61 |
action: 'mtphr_dnt_metaboxer_ajax_file_display',
|
70 |
|
71 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
72 |
jQuery.post( ajaxurl, data, function( response ) {
|
73 |
+
|
74 |
// Append the new data
|
75 |
$container.append( response );
|
76 |
+
|
77 |
// Hide the upload button
|
78 |
$container.find('.mtphr-dnt-metaboxer-file-upload').hide();
|
79 |
});
|
80 |
|
81 |
wp.media.editor.send.attachment = send_attachment_bkp;
|
82 |
}
|
83 |
+
|
84 |
wp.media.editor.open();
|
85 |
|
86 |
+
return false;
|
87 |
});
|
88 |
|
89 |
$('.mtphr-dnt-metaboxer-file-delete').live('click',function() {
|
90 |
+
|
91 |
// Save the container
|
92 |
var $container = $(this).parents('.mtphr-dnt-metaboxer-file-contents');
|
93 |
+
|
94 |
// Remove the field value
|
95 |
$container.find('.mtphr-dnt-metaboxer-file-value').val('');
|
96 |
+
|
97 |
// Remove the current display
|
98 |
$container.find('.mtphr-dnt-metaboxer-file-table').remove();
|
99 |
+
|
100 |
// Disply the upload button
|
101 |
$container.find('.mtphr-dnt-metaboxer-file-upload').css('display','inline-block');
|
102 |
});
|
109 |
* @since 1.0.0
|
110 |
*/
|
111 |
$('.mtphr-dnt-metaboxer-image').each( function(index) {
|
112 |
+
|
113 |
// If there currently isn't a value, show the upload button
|
114 |
if( $(this).find('.mtphr-dnt-metaboxer-image-value').val() == '' ) {
|
115 |
$(this).find('.mtphr-dnt-metaboxer-image-upload').css('display','inline-block');
|
118 |
|
119 |
// Image upload functionality
|
120 |
$('.mtphr-dnt-metaboxer-image-upload').click(function() {
|
121 |
+
|
122 |
// Save the container
|
123 |
var $container = $(this).parent('.mtphr-dnt-metaboxer-image-contents');
|
124 |
+
|
125 |
var send_attachment_bkp = wp.media.editor.send.attachment;
|
126 |
|
127 |
wp.media.editor.send.attachment = function( props, attachment ) {
|
143 |
|
144 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
145 |
jQuery.post( ajaxurl, data, function( response ) {
|
146 |
+
|
147 |
// Append the new data
|
148 |
$container.append( response );
|
149 |
+
|
150 |
// Hide the upload button
|
151 |
$container.find('.mtphr-dnt-metaboxer-image-upload').hide();
|
152 |
});
|
153 |
|
154 |
wp.media.editor.send.attachment = send_attachment_bkp;
|
155 |
}
|
156 |
+
|
157 |
wp.media.editor.open();
|
158 |
|
159 |
+
return false;
|
160 |
});
|
161 |
|
162 |
$('.mtphr-dnt-metaboxer-image-delete').live('click',function() {
|
163 |
+
|
164 |
// Save the container
|
165 |
var $container = $(this).parents('.mtphr-dnt-metaboxer-image-contents');
|
166 |
+
|
167 |
// Remove the field value
|
168 |
$container.find('.mtphr-dnt-metaboxer-image-value').val('');
|
169 |
+
|
170 |
// Remove the current display
|
171 |
$container.find('.mtphr-dnt-metaboxer-image-table').remove();
|
172 |
+
|
173 |
// Disply the upload button
|
174 |
$container.find('.mtphr-dnt-metaboxer-image-upload').css('display','inline-block');
|
175 |
});
|
183 |
* @since 1.0
|
184 |
*/
|
185 |
$('.mtphr-dnt-metaboxer-image-select-link').click( function(e) {
|
186 |
+
|
187 |
e.preventDefault();
|
188 |
+
|
189 |
// Get the value
|
190 |
var val = $(this).attr('href');
|
191 |
+
|
192 |
// Save the value to the input
|
193 |
$(this).siblings('input[type="hidden"]').val(val);
|
194 |
+
|
195 |
// Set & remove selected
|
196 |
$(this).siblings('.mtphr-dnt-metaboxer-image-select-link').removeClass('selected');
|
197 |
$(this).addClass('selected');
|
203 |
* Add list functionality.
|
204 |
*
|
205 |
* @since 1.0.0
|
206 |
+
*/
|
207 |
$('.mtphr-dnt-metaboxer-list').each( function(index) {
|
208 |
|
209 |
// Set the field order
|
210 |
mtphr_dnt_metaboxer_lists_set_order( $(this) );
|
211 |
+
|
212 |
// Add sorting to the items
|
213 |
mtphr_dnt_metaboxer_lists_set_sortable( $(this) );
|
214 |
});
|
230 |
return $helper;
|
231 |
},
|
232 |
update: function( event, ui ) {
|
233 |
+
|
234 |
// Set the field order
|
235 |
mtphr_dnt_metaboxer_lists_set_order( $(this) );
|
236 |
}
|
237 |
+
});
|
238 |
}
|
239 |
|
240 |
// List - set the list item order
|
242 |
|
243 |
// Set the order of the items
|
244 |
$list.find('.mtphr-dnt-metaboxer-list-item').each( function(i) {
|
245 |
+
|
246 |
$(this).find('.mtphr-dnt-metaboxer-list-structure-item').each( function(e) {
|
247 |
+
|
248 |
var base = $(this).attr('base');
|
249 |
var field = $(this).attr('field');
|
250 |
$(this).find('input,textarea,select').attr('name', base+'['+i+']['+field+']');
|
251 |
});
|
252 |
});
|
253 |
+
|
254 |
// Hide the delete if only one element
|
255 |
if( $list.find('.mtphr-dnt-metaboxer-list-item').length == 1 ) {
|
256 |
+
|
257 |
$list.find('.mtphr-dnt-metaboxer-list-item-handle,.mtphr-dnt-metaboxer-list-item-delete').hide();
|
258 |
}
|
259 |
}
|
265 |
// Create a new item with blank content
|
266 |
var $parent = $(this).parents('.mtphr-dnt-metaboxer-list-item');
|
267 |
var $new = $parent.clone(true).hide();
|
268 |
+
|
269 |
+
if( $new.find('.wp-editor-wrap').length > 0 ) {
|
270 |
+
var $container = $new.find('.wp-editor-wrap').parent();
|
271 |
+
$new.find('.wp-editor-wrap').remove();
|
272 |
+
$container.append('<div class="mtphr-dnt-metaboxer-wysiwyg-placeholder">You must <strong>save your page</strong> to use this editor.</div>');
|
273 |
+
}
|
274 |
+
|
275 |
$new.find('input,textarea,select').removeAttr('value').removeAttr('checked').removeAttr('selected');
|
276 |
$parent.after($new);
|
277 |
$new.fadeIn().css('display', 'table-row');
|
278 |
+
|
279 |
// Set the field order
|
280 |
mtphr_dnt_metaboxer_lists_set_order( $(this).parents('.mtphr-dnt-metaboxer-list') );
|
281 |
+
|
282 |
// Show the handles
|
283 |
$(this).parents('.mtphr-dnt-metaboxer-list').find('.mtphr-dnt-metaboxer-list-item-handle,.mtphr-dnt-metaboxer-list-item-delete').show();
|
284 |
+
|
285 |
// Set the focus to the new input
|
286 |
var inputs = $new.find('input,textarea,select');
|
287 |
$(inputs[0]).focus();
|
290 |
// List - delete item click
|
291 |
$('.mtphr-dnt-metaboxer-list-item-delete').live( 'click', function(e) {
|
292 |
e.preventDefault();
|
293 |
+
|
294 |
// Fade out the item
|
295 |
$(this).parents('.mtphr-dnt-metaboxer-list-item').fadeOut( function() {
|
296 |
+
|
297 |
// Get the list
|
298 |
var $list = $(this).parents('.mtphr-dnt-metaboxer-list');
|
299 |
+
|
300 |
// Remove the item
|
301 |
$(this).remove();
|
302 |
+
|
303 |
// Set the field order
|
304 |
mtphr_dnt_metaboxer_lists_set_order( $list );
|
305 |
});
|
322 |
// Create an array to store all the toggled metaboxes
|
323 |
var metaboxes = Array();
|
324 |
$(this).find('.mtphr-dnt-metaboxer-metabox-toggle').each( function(index) {
|
325 |
+
|
326 |
// Get the metaboxes and merge into the main array
|
327 |
var m = $(this).attr('metaboxes').split(',');
|
328 |
$.merge( metaboxes, m );
|
329 |
});
|
330 |
var total_metaboxes = metaboxes.length;
|
331 |
+
|
332 |
// Hide the toggled metaboxes
|
333 |
mtphr_dnt_metaboxer_metabox_hide();
|
334 |
+
|
335 |
// Display the current metaboxes
|
336 |
if( $(this).find('.mtphr-dnt-metaboxer-metabox-toggle.button-primary').length > 0 ) {
|
337 |
$init_button = $(this).find('.mtphr-dnt-metaboxer-metabox-toggle.button-primary');
|
340 |
$init_button.addClass('button-primary');
|
341 |
}
|
342 |
mtphr_dnt_metaboxer_metabox_show( $init_button );
|
343 |
+
|
344 |
// Hide the toggled metaboxes
|
345 |
function mtphr_dnt_metaboxer_metabox_hide() {
|
346 |
for( var i=0; i<total_metaboxes; i++ ) {
|
348 |
$('input[name="'+metaboxes[i]+'-hide"]').removeAttr('checked');
|
349 |
}
|
350 |
}
|
351 |
+
|
352 |
// Show the selected metaboxes
|
353 |
function mtphr_dnt_metaboxer_metabox_show( $button ) {
|
354 |
+
|
355 |
// Get and display the selected metaboxes
|
356 |
var m = $button.attr('metaboxes').split(',');
|
357 |
var t = m.length;
|
358 |
+
|
359 |
// Show all the toggled metaboxes
|
360 |
for( var i=0; i<t; i++ ) {
|
361 |
$('#'+m[i]).show();
|
362 |
$('input[name="'+m[i]+'-hide"]').attr('checked', 'checked');
|
363 |
}
|
364 |
+
|
365 |
// Store the new value
|
366 |
$button.siblings('input').val($button.attr('href'));
|
367 |
}
|
368 |
+
|
369 |
// Select the code on button click
|
370 |
$(this).find('.mtphr-dnt-metaboxer-metabox-toggle').click( function(e) {
|
371 |
e.preventDefault();
|
372 |
|
373 |
// Hide all the toggled metaboxes
|
374 |
mtphr_dnt_metaboxer_metabox_hide();
|
375 |
+
|
376 |
// Show the selected metaboxes
|
377 |
mtphr_dnt_metaboxer_metabox_show( $(this) );
|
378 |
|
390 |
* @since 1.0.1
|
391 |
*/
|
392 |
$('.mtphr-dnt-metaboxer-sort').each( function(index) {
|
393 |
+
|
394 |
// Add sorting to the items
|
395 |
$(this).sortable( {
|
396 |
handle: '.mtphr-dnt-metaboxer-sort-item-handle',
|
includes/metaboxer/metaboxer.php
CHANGED
@@ -22,35 +22,35 @@ function mtphr_dnt_metaboxer_container( $field, $context ) {
|
|
22 |
$value = ( get_post_meta( $post->ID, $field['id'], true ) != '' ) ? get_post_meta( $post->ID, $field['id'], true ) : $default;
|
23 |
$display = isset( $field['display'] ) ? $field['display'] : '';
|
24 |
?>
|
25 |
-
<tr class="mtphr-dnt-metaboxer-field mtphr-dnt-metaboxer-field-<?php echo $field['type']; ?> mtphr-dnt-metaboxer<?php echo $field['id']; ?><?php if( isset($field['class']) ) { echo ' '.$field['class']; } ?> clearfix">
|
26 |
-
|
27 |
<?php
|
28 |
$content_class = 'mtphr-dnt-metaboxer-field-content mtphr-dnt-metaboxer-field-content-full mtphr-dnt-metaboxer-'.$field['type'].' clearfix';
|
29 |
$content_span = ' colspan="2"';
|
30 |
$label = false;
|
31 |
-
|
32 |
if ( isset($field['name']) || isset($field['description']) ) {
|
33 |
-
|
34 |
$content_class = 'mtphr-dnt-metaboxer-field-content mtphr-dnt-metaboxer-'.$field['type'].' clearfix';
|
35 |
$content_span = '';
|
36 |
$label = true;
|
37 |
?>
|
38 |
|
39 |
<?php if( $context == 'side' || $display == 'vertical' ) { ?><td><table><tr><?php } ?>
|
40 |
-
|
41 |
<td class="mtphr-dnt-metaboxer-label">
|
42 |
<?php if( isset($field['name']) ) { ?><label for="<?php echo $field['id']; ?>"><?php echo $field['name']; ?></label><?php } ?>
|
43 |
<?php if( isset($field['description']) ) { ?><small><?php echo $field['description']; ?></small><?php } ?>
|
44 |
</td>
|
45 |
-
|
46 |
<?php if( $context == 'side' || $display == 'vertical' ) { echo '</tr>'; } ?>
|
47 |
|
48 |
<?php
|
49 |
}
|
50 |
?>
|
51 |
-
|
52 |
<?php if( $label ) { if( $context == 'side' || $display == 'vertical' ) { echo '<tr>'; } } ?>
|
53 |
-
|
54 |
<td<?php echo $content_span; ?> class="<?php echo $content_class; ?>" id="<?php echo $post->ID; ?>">
|
55 |
<?php
|
56 |
// Call the function to display the field
|
@@ -59,9 +59,9 @@ function mtphr_dnt_metaboxer_container( $field, $context ) {
|
|
59 |
}
|
60 |
?>
|
61 |
</td>
|
62 |
-
|
63 |
<?php if( $label ) { if( $context == 'side' || $display == 'vertical' ) { echo '</tr></table></td>'; } } ?>
|
64 |
-
|
65 |
</tr>
|
66 |
<?php
|
67 |
}
|
@@ -78,37 +78,37 @@ function mtphr_dnt_metaboxer_append_field( $field ) {
|
|
78 |
|
79 |
// Add appended fields
|
80 |
if( isset($field['append']) ) {
|
81 |
-
|
82 |
$fields = $field['append'];
|
83 |
$settings = ( isset($field['option'] ) ) ? $field['option'] : false;
|
84 |
|
85 |
if( is_array($fields) ) {
|
86 |
-
|
87 |
foreach( $fields as $id => $field ) {
|
88 |
-
|
89 |
// Get the value
|
90 |
if( $settings) {
|
91 |
$options = get_option( $settings );
|
92 |
-
$value = isset( $options[$id] ) ? $options[$id] : get_option( $id );
|
93 |
} else {
|
94 |
global $post;
|
95 |
$value = get_post_meta( $post->ID, $id, true );
|
96 |
}
|
97 |
-
|
98 |
// Set the default if no value
|
99 |
if( $value == '' && isset($field['default']) ) {
|
100 |
$value = $field['default'];
|
101 |
}
|
102 |
-
|
103 |
if( isset($field['type']) ) {
|
104 |
-
|
105 |
if( $settings ) {
|
106 |
$field['id'] = $settings.'['.$id.']';
|
107 |
$field['option'] = $settings;
|
108 |
} else {
|
109 |
$field['id'] = $id;
|
110 |
}
|
111 |
-
|
112 |
// Call the function to display the field
|
113 |
if ( function_exists('mtphr_dnt_metaboxer_'.$field['type']) ) {
|
114 |
echo '<div class="mtphr-dnt-metaboxer-appended mtphr-dnt-metaboxer'.$field['id'].'">';
|
@@ -136,7 +136,7 @@ function mtphr_dnt_metaboxer_checkbox( $field, $value='' ) {
|
|
136 |
$after = ( isset($field['after']) ) ? '<span> '.$field['after'].'</span>' : '';
|
137 |
|
138 |
if( isset($field['options']) ) {
|
139 |
-
|
140 |
$break = '<br/>';
|
141 |
if ( isset($field['display']) ) {
|
142 |
if( $field['display'] == 'inline' ) {
|
@@ -147,19 +147,19 @@ function mtphr_dnt_metaboxer_checkbox( $field, $value='' ) {
|
|
147 |
$checked = ( isset($value[$i]) ) ? 'checked="checked"' : '';
|
148 |
$output .= '<label><input name="'.$field['id'].'['.$i.']" id="'.$field['id'].'['.$i.']" type="checkbox" value="1" '.$checked.' /> '.$option.'</label>'.$break;
|
149 |
}
|
150 |
-
|
151 |
} else {
|
152 |
-
|
153 |
$checked = ( $value == 1 ) ? 'checked="checked"' : '';
|
154 |
$output .= '<label><input name="'.$field['id'].'" id="'.$field['id'].'" type="checkbox" value="1" '.$checked.' />';
|
155 |
if( isset($field['label']) ) {
|
156 |
$output .= ' '.$field['label'];
|
157 |
-
}
|
158 |
$output .= '</label>';
|
159 |
}
|
160 |
-
|
161 |
echo $before.$output.$after;
|
162 |
-
|
163 |
// Add appended fields
|
164 |
mtphr_dnt_metaboxer_append_field($field);
|
165 |
}
|
@@ -172,26 +172,26 @@ function mtphr_dnt_metaboxer_checkbox( $field, $value='' ) {
|
|
172 |
* @since 1.0.0
|
173 |
*/
|
174 |
function mtphr_dnt_metaboxer_file( $field, $value='' ) {
|
175 |
-
|
176 |
// Check if there's actually a file
|
177 |
$file = false;
|
178 |
if( $value != '' ) {
|
179 |
$file = get_post( $value );
|
180 |
}
|
181 |
-
|
182 |
// If there isn't a file reset the value
|
183 |
if( !$file ) {
|
184 |
$value = '';
|
185 |
}
|
186 |
?>
|
187 |
-
|
188 |
<input class="mtphr-dnt-metaboxer-file-value" type="hidden" id="<?php echo $field['id']; ?>" name="<?php echo $field['id']; ?>" value="<?php echo $value; ?>" />
|
189 |
-
|
190 |
<?php
|
191 |
echo isset( $field['button'] ) ? '<a href="#" class="button mtphr-dnt-metaboxer-file-upload">'.$field['button'].'</a>' : '<a href="#" class="button custom-media-upload">Insert File</a>';
|
192 |
-
|
193 |
if( $file ) {
|
194 |
-
|
195 |
$type = explode( '/', $file->post_mime_type );
|
196 |
|
197 |
// Display the file
|
@@ -209,13 +209,13 @@ add_action( 'wp_ajax_mtphr_dnt_metaboxer_ajax_file_display', 'mtphr_dnt_metaboxe
|
|
209 |
* @since 1.0.0
|
210 |
*/
|
211 |
function mtphr_dnt_metaboxer_ajax_file_display() {
|
212 |
-
|
213 |
// Get access to the database
|
214 |
global $wpdb;
|
215 |
-
|
216 |
// Check the nonce
|
217 |
check_ajax_referer( 'mtphr_dnt', 'security' );
|
218 |
-
|
219 |
// Get variables
|
220 |
$id = $_POST['id'];
|
221 |
$type = $_POST['type'];
|
@@ -223,24 +223,24 @@ function mtphr_dnt_metaboxer_ajax_file_display() {
|
|
223 |
$title = $_POST['title'];
|
224 |
$caption = $_POST['caption'];
|
225 |
$description = $_POST['description'];
|
226 |
-
|
227 |
// Display the file
|
228 |
mtphr_dnt_metaboxer_file_display( $id, $type, $url, $title, $caption, $description );
|
229 |
-
|
230 |
die(); // this is required to return a proper result
|
231 |
}
|
232 |
|
233 |
// Display the file
|
234 |
-
function mtphr_dnt_metaboxer_file_display( $id, $type, $url, $title, $caption, $description ) {
|
235 |
|
236 |
$src = '';
|
237 |
switch( $type ) {
|
238 |
-
|
239 |
case 'image':
|
240 |
$att = wp_get_attachment_image_src( $id, 'thumbnail' );
|
241 |
$src = $att[0];
|
242 |
break;
|
243 |
-
|
244 |
case 'application':
|
245 |
$att = wp_get_attachment_image_src( $id, 'thumbnail', true );
|
246 |
$src = $att[0];
|
@@ -277,10 +277,10 @@ function mtphr_dnt_metaboxer_file_display( $id, $type, $url, $title, $caption, $
|
|
277 |
* @since 1.0.0
|
278 |
*/
|
279 |
function mtphr_dnt_metaboxer_html( $field, $value='' ) {
|
280 |
-
|
281 |
// Echo the html
|
282 |
echo $value;
|
283 |
-
|
284 |
// Add appended fields
|
285 |
mtphr_dnt_metaboxer_append_field($field);
|
286 |
}
|
@@ -293,36 +293,36 @@ function mtphr_dnt_metaboxer_html( $field, $value='' ) {
|
|
293 |
* @since 1.0.0
|
294 |
*/
|
295 |
function mtphr_dnt_metaboxer_image( $field, $value='' ) {
|
296 |
-
|
297 |
// Check if there's actually a file
|
298 |
$image = false;
|
299 |
if( $value != '' ) {
|
300 |
$image = get_post( $value );
|
301 |
}
|
302 |
-
|
303 |
// If there isn't a file reset the value
|
304 |
if( !$image ) {
|
305 |
$value = '';
|
306 |
}
|
307 |
?>
|
308 |
-
|
309 |
<div class="mtphr-dnt-metaboxer-image-contents">
|
310 |
<input class="mtphr-dnt-metaboxer-image-value" type="hidden" id="<?php echo $field['id']; ?>" name="<?php echo $field['id']; ?>" value="<?php echo $value; ?>" />
|
311 |
-
|
312 |
<?php
|
313 |
echo isset( $field['button'] ) ? '<a href="#" class="button mtphr-dnt-metaboxer-image-upload">'.$field['button'].'</a>' : '<a href="#" class="button mtphr-dnt-metaboxer-image-upload">Insert Image</a>';
|
314 |
-
|
315 |
if( $image ) {
|
316 |
-
|
317 |
$type = explode( '/', $image->post_mime_type );
|
318 |
|
319 |
// Display the file
|
320 |
echo mtphr_dnt_metaboxer_image_display( $image->ID, $type[0], $image->guid, $image->post_title, $image -> post_excerpt, $image->post_content );
|
321 |
}
|
322 |
?>
|
323 |
-
|
324 |
</div>
|
325 |
-
|
326 |
<?php
|
327 |
// Add appended fields
|
328 |
mtphr_dnt_metaboxer_append_field($field);
|
@@ -335,13 +335,13 @@ add_action( 'wp_ajax_mtphr_dnt_metaboxer_ajax_image_display', 'mtphr_dnt_metabox
|
|
335 |
* @since 1.0.0
|
336 |
*/
|
337 |
function mtphr_dnt_metaboxer_ajax_image_display() {
|
338 |
-
|
339 |
// Get access to the database
|
340 |
global $wpdb;
|
341 |
-
|
342 |
// Check the nonce
|
343 |
check_ajax_referer( 'neuron', 'security' );
|
344 |
-
|
345 |
// Get variables
|
346 |
$id = $_POST['id'];
|
347 |
$type = $_POST['type'];
|
@@ -349,24 +349,24 @@ function mtphr_dnt_metaboxer_ajax_image_display() {
|
|
349 |
$title = $_POST['title'];
|
350 |
$caption = $_POST['caption'];
|
351 |
$description = $_POST['description'];
|
352 |
-
|
353 |
// Display the file
|
354 |
mtphr_dnt_metaboxer_image_display( $id, $type, $url, $title, $caption, $description );
|
355 |
-
|
356 |
die(); // this is required to return a proper result
|
357 |
}
|
358 |
|
359 |
// Display the file
|
360 |
-
function mtphr_dnt_metaboxer_image_display( $id, $type, $url, $title, $caption, $description ) {
|
361 |
|
362 |
$src = '';
|
363 |
switch( $type ) {
|
364 |
-
|
365 |
case 'image':
|
366 |
$att = wp_get_attachment_image_src( $id, 'thumbnail' );
|
367 |
$src = $att[0];
|
368 |
break;
|
369 |
-
|
370 |
case 'application':
|
371 |
$att = wp_get_attachment_image_src( $id, 'thumbnail', true );
|
372 |
$src = $att[0];
|
@@ -402,7 +402,7 @@ function mtphr_dnt_metaboxer_image_select( $field, $value='' ) {
|
|
402 |
$output .= '<a class="mtphr-dnt-metaboxer-image-select-link '.$selected.'" href="'.$option['value'].'"><img src="'.$option['path'].'" /><small>'.$option['label'].'</small></a>';
|
403 |
}
|
404 |
echo $output;
|
405 |
-
|
406 |
// Add appended fields
|
407 |
mtphr_dnt_metaboxer_append_field($field);
|
408 |
}
|
@@ -415,13 +415,13 @@ function mtphr_dnt_metaboxer_image_select( $field, $value='' ) {
|
|
415 |
* @since 1.0.2
|
416 |
*/
|
417 |
function mtphr_dnt_metaboxer_list( $field, $value='' ) {
|
418 |
-
|
419 |
-
$output = '<table>';
|
420 |
-
|
421 |
$headers = false;
|
422 |
$header_str = '';
|
423 |
foreach( $field['structure'] as $id => $str ) {
|
424 |
-
|
425 |
$header_str .= '<th>';
|
426 |
if( isset($str['header']) ) {
|
427 |
$headers = true;
|
@@ -432,7 +432,7 @@ function mtphr_dnt_metaboxer_list( $field, $value='' ) {
|
|
432 |
if( $headers ) {
|
433 |
$output .= '<tr><td class="mtphr-dnt-metaboxer-list-item-handle"></td>'.$header_str.'</tr>';
|
434 |
}
|
435 |
-
|
436 |
$buttons = '<td class="mtphr-dnt-metaboxer-list-item-delete"><a href="#">Delete</a></td><td class="mtphr-dnt-metaboxer-list-item-add"><a href="#">Add</a></td>';
|
437 |
if( is_array($value) ) {
|
438 |
foreach( $value as $i=>$v ) {
|
@@ -440,17 +440,17 @@ function mtphr_dnt_metaboxer_list( $field, $value='' ) {
|
|
440 |
$output .= '<tr class="mtphr-dnt-metaboxer-list-item"><td class="mtphr-dnt-metaboxer-list-item-handle"><span></span></td>'.$structure.$buttons.'</tr>';
|
441 |
}
|
442 |
}
|
443 |
-
|
444 |
// If nothing is being output make sure one field is showing
|
445 |
if( $value == '' || count($value) == 0 ) {
|
446 |
$structure = mtphr_dnt_metaboxer_list_structure( 0, $field );
|
447 |
$output .= '<tr class="mtphr-dnt-metaboxer-list-item"><td class="mtphr-dnt-metaboxer-list-item-handle"><span></span></td>'.$structure.$buttons.'</tr>';
|
448 |
}
|
449 |
-
|
450 |
$output .= '</table>';
|
451 |
-
|
452 |
echo $output;
|
453 |
-
|
454 |
// Add appended fields
|
455 |
mtphr_dnt_metaboxer_append_field($field);
|
456 |
}
|
@@ -459,29 +459,29 @@ function mtphr_dnt_metaboxer_list( $field, $value='' ) {
|
|
459 |
function mtphr_dnt_metaboxer_list_structure( $pos, $fields, $m_value='' ) {
|
460 |
|
461 |
$main_id = $fields['id'];
|
462 |
-
|
463 |
// Add appended fields
|
464 |
if( isset($fields['structure']) ) {
|
465 |
-
|
466 |
$fields = $fields['structure'];
|
467 |
$settings = ( isset($fields['option'] ) ) ? $fields['option'] : false;
|
468 |
|
469 |
if( is_array($fields) ) {
|
470 |
-
|
471 |
ob_start();
|
472 |
-
|
473 |
foreach( $fields as $id => $field ) {
|
474 |
-
|
475 |
// Get the value
|
476 |
$value = isset($m_value[$id]) ? $m_value[$id] : '';
|
477 |
-
|
478 |
// Get the width
|
479 |
$width = isset($field['width']) ? ' style="width:'.$field['width'].'"' : '';
|
480 |
-
|
481 |
if( isset($field['type']) ) {
|
482 |
-
|
483 |
$field['id'] = $main_id.'['.$pos.']['.$id.']';
|
484 |
-
|
485 |
// Call the function to display the field
|
486 |
if ( function_exists('mtphr_dnt_metaboxer_'.$field['type']) ) {
|
487 |
|
@@ -491,7 +491,7 @@ function mtphr_dnt_metaboxer_list_structure( $pos, $fields, $m_value='' ) {
|
|
491 |
}
|
492 |
}
|
493 |
}
|
494 |
-
|
495 |
return ob_get_clean();
|
496 |
}
|
497 |
}
|
@@ -507,24 +507,24 @@ function mtphr_dnt_metaboxer_list_structure( $pos, $fields, $m_value='' ) {
|
|
507 |
function mtphr_dnt_metaboxer_metabox_toggle( $field, $value='' ) {
|
508 |
|
509 |
if( isset($field['options']) ) {
|
510 |
-
|
511 |
$output = '';
|
512 |
$output .= '<input type="hidden" id="'.$field['id'].'" name="'.$field['id'].'" value="'.$value.'" />';
|
513 |
-
|
514 |
foreach( $field['options'] as $i => $option ) {
|
515 |
-
|
516 |
$button = $option['button'];
|
517 |
$metaboxes = $option['metaboxes'];
|
518 |
$metabox_list = join( ',', $metaboxes );
|
519 |
-
|
520 |
// Create a button
|
521 |
$selected = ( $value == $i ) ? ' button-primary' : '';
|
522 |
$output .= '<a href="'.$i.'" metaboxes="'.$metabox_list.'" class="mtphr-dnt-metaboxer-metabox-toggle button'.$selected.'">'.$button.'</a> ';
|
523 |
-
}
|
524 |
-
|
525 |
echo $output;
|
526 |
}
|
527 |
-
|
528 |
// Add appended fields
|
529 |
mtphr_dnt_metaboxer_append_field($field);
|
530 |
}
|
@@ -542,7 +542,7 @@ function mtphr_dnt_metaboxer_number( $field, $value='' ) {
|
|
542 |
$after = ( isset($field['after']) ) ? '<span> '.$field['after'].'</span>' : '';
|
543 |
$output = $before.'<input name="'.$field['id'].'" id="'.$field['id'].'" type="number" value="'.$value.'" class="small-text"'.$style.'>'.$after;
|
544 |
echo $output;
|
545 |
-
|
546 |
// Add appended fields
|
547 |
mtphr_dnt_metaboxer_append_field($field);
|
548 |
}
|
@@ -555,7 +555,7 @@ function mtphr_dnt_metaboxer_number( $field, $value='' ) {
|
|
555 |
* @since 1.0.0
|
556 |
*/
|
557 |
function mtphr_dnt_metaboxer_radio( $field, $value='' ) {
|
558 |
-
|
559 |
if( isset($field['options']) ) {
|
560 |
|
561 |
$output = '';
|
@@ -568,11 +568,11 @@ function mtphr_dnt_metaboxer_radio( $field, $value='' ) {
|
|
568 |
foreach( $field['options'] as $i => $option ) {
|
569 |
$checked = ( $value == $i ) ? 'checked="checked"' : '';
|
570 |
$output .= '<label><input name="'.$field['id'].'" id="'.$field['id'].'" type="radio" value="'.$i.'" '.$checked.' /> '.$option.'</label>'.$break;
|
571 |
-
}
|
572 |
}
|
573 |
-
|
574 |
echo $output;
|
575 |
-
|
576 |
// Add appended fields
|
577 |
mtphr_dnt_metaboxer_append_field($field);
|
578 |
}
|
@@ -588,13 +588,13 @@ function mtphr_dnt_metaboxer_select( $field, $value='' ) {
|
|
588 |
|
589 |
$before = ( isset($field['before']) ) ? '<span>'.$field['before'].' </span>' : '';
|
590 |
$after = ( isset($field['after']) ) ? '<span> '.$field['after'].'</span>' : '';
|
591 |
-
|
592 |
$output = $before.'<select name="'.$field['id'].'" id="'.$field['id'].'">';
|
593 |
-
|
594 |
if( $field['options'] ) {
|
595 |
-
|
596 |
$key_val = isset( $field['key_val'] ) ? true : false;
|
597 |
-
|
598 |
foreach ( $field['options'] as $key => $option ) {
|
599 |
if( is_numeric($key) && !$key_val ) {
|
600 |
$name = ( is_array( $option ) ) ? $option['name'] : $option;
|
@@ -610,7 +610,7 @@ function mtphr_dnt_metaboxer_select( $field, $value='' ) {
|
|
610 |
$output .= '</select>'.$after;
|
611 |
|
612 |
echo $output;
|
613 |
-
|
614 |
// Add appended fields
|
615 |
mtphr_dnt_metaboxer_append_field($field);
|
616 |
}
|
@@ -636,45 +636,45 @@ function mtphr_dnt_metaboxer_sort( $field, $value='' ) {
|
|
636 |
} else {
|
637 |
$rows = $field['rows'];
|
638 |
}
|
639 |
-
|
640 |
foreach( $field['rows'] as $id=>$data ) {
|
641 |
if( !isset($rows[$id]) ) {
|
642 |
$rows[$id] = $data;
|
643 |
}
|
644 |
}
|
645 |
-
|
646 |
-
$output = '<table>';
|
647 |
|
648 |
foreach( $rows as $id => $data ) {
|
649 |
-
|
650 |
$output .= '<tr class="mtphr-dnt-metaboxer-sort-item"><td class="mtphr-dnt-metaboxer-sort-item-handle"><span></span></td>';
|
651 |
if( isset($data['name']) ) {
|
652 |
$output .= '<td class="mtphr-dnt-metaboxer-sort-name">'.$data['name'].'</td>';
|
653 |
}
|
654 |
$output .= '<td><input name="'.$field['id'].'[]" id="'.$field['id'].'[]" type="hidden" value="'.$id.'">';
|
655 |
-
|
656 |
// Find the value
|
657 |
$data_value = get_post_meta( $post->ID, $data['id'], true );
|
658 |
if( $data_value == '' && isset($data['default']) ) {
|
659 |
$data_value = $data['default'];
|
660 |
}
|
661 |
-
|
662 |
ob_start();
|
663 |
// Call the function to display the field
|
664 |
if ( function_exists('mtphr_dnt_metaboxer_'.$data['type']) ) {
|
665 |
call_user_func( 'mtphr_dnt_metaboxer_'.$data['type'], $data, $data_value );
|
666 |
}
|
667 |
$output .= ob_get_clean();
|
668 |
-
|
669 |
$output .= '</td>';
|
670 |
-
|
671 |
$output .= '</tr>';
|
672 |
}
|
673 |
-
|
674 |
$output .= '</table>';
|
675 |
-
|
676 |
echo $output;
|
677 |
-
|
678 |
// Add appended fields
|
679 |
mtphr_dnt_metaboxer_append_field($field);
|
680 |
}
|
@@ -693,7 +693,7 @@ function mtphr_dnt_metaboxer_text( $field, $value='' ) {
|
|
693 |
$text_align = ( isset($field['text_align']) ) ? ' style="text-align:'.$field['text_align'].'"' : '' ;
|
694 |
$output = $before.'<input name="'.$field['id'].'" id="'.$field['id'].'" type="text" value="'.$value.'" size="'.$size.'"'.$text_align.'>'.$after;
|
695 |
echo $output;
|
696 |
-
|
697 |
// Add appended fields
|
698 |
mtphr_dnt_metaboxer_append_field($field);
|
699 |
}
|
@@ -710,7 +710,7 @@ function mtphr_dnt_metaboxer_textarea( $field, $value='' ) {
|
|
710 |
$cols = ( isset($field['cols']) ) ? $field['cols'] : 40;
|
711 |
$output = '<textarea name="'.$field['id'].'" id="'.$field['id'].'" rows="'.$rows.'" cols="'.$cols.'">'.$value.'</textarea>';
|
712 |
echo $output;
|
713 |
-
|
714 |
// Add appended fields
|
715 |
mtphr_dnt_metaboxer_append_field($field);
|
716 |
}
|
@@ -727,7 +727,7 @@ function mtphr_dnt_metaboxer_wysiwyg( $field, $value='' ) {
|
|
727 |
$settings['media_buttons'] = true;
|
728 |
$settings['textarea_rows'] = ( isset($field['rows']) ) ? $field['rows'] : 12;
|
729 |
wp_editor( $value, $field['id'], $settings );
|
730 |
-
|
731 |
// Add appended fields
|
732 |
mtphr_dnt_metaboxer_append_field($field);
|
733 |
}
|
@@ -741,20 +741,20 @@ function mtphr_dnt_metaboxer_wysiwyg( $field, $value='' ) {
|
|
741 |
* @since 1.0.0
|
742 |
*/
|
743 |
function mtphr_dnt_metaboxer_code( $field, $value='' ) {
|
744 |
-
|
745 |
global $post;
|
746 |
-
|
747 |
// Display the shortcode code
|
748 |
if( $field['id'] == '_mtphr_dnt_shortcode' ) {
|
749 |
-
|
750 |
echo '<pre><p>[ditty_news_ticker id="'.$post->ID.'"]</p></pre>';
|
751 |
-
|
752 |
// Display the function code
|
753 |
} elseif( $field['id'] == '_mtphr_dnt_function' ) {
|
754 |
-
|
755 |
echo '<pre><p><?php if(function_exists(\'ditty_news_ticker\')){ditty_news_ticker('.$post->ID.');} ?></p></pre>';
|
756 |
}
|
757 |
-
|
758 |
// Display a "Select All" button
|
759 |
$button = isset($field['button']) ? $field['button'] : __('Select Code', 'ditty-news-ticker');
|
760 |
echo '<a href="#" class="button mtphr-dnt-metaboxer-code-select">'.$button.'</a>';
|
22 |
$value = ( get_post_meta( $post->ID, $field['id'], true ) != '' ) ? get_post_meta( $post->ID, $field['id'], true ) : $default;
|
23 |
$display = isset( $field['display'] ) ? $field['display'] : '';
|
24 |
?>
|
25 |
+
<tr class="mtphr-dnt-metaboxer-field mtphr-dnt-metaboxer-field-<?php echo $field['type']; ?> mtphr-dnt-metaboxer<?php echo $field['id']; ?><?php if( isset($field['class']) ) { echo ' '.$field['class']; } ?> clearfix">
|
26 |
+
|
27 |
<?php
|
28 |
$content_class = 'mtphr-dnt-metaboxer-field-content mtphr-dnt-metaboxer-field-content-full mtphr-dnt-metaboxer-'.$field['type'].' clearfix';
|
29 |
$content_span = ' colspan="2"';
|
30 |
$label = false;
|
31 |
+
|
32 |
if ( isset($field['name']) || isset($field['description']) ) {
|
33 |
+
|
34 |
$content_class = 'mtphr-dnt-metaboxer-field-content mtphr-dnt-metaboxer-'.$field['type'].' clearfix';
|
35 |
$content_span = '';
|
36 |
$label = true;
|
37 |
?>
|
38 |
|
39 |
<?php if( $context == 'side' || $display == 'vertical' ) { ?><td><table><tr><?php } ?>
|
40 |
+
|
41 |
<td class="mtphr-dnt-metaboxer-label">
|
42 |
<?php if( isset($field['name']) ) { ?><label for="<?php echo $field['id']; ?>"><?php echo $field['name']; ?></label><?php } ?>
|
43 |
<?php if( isset($field['description']) ) { ?><small><?php echo $field['description']; ?></small><?php } ?>
|
44 |
</td>
|
45 |
+
|
46 |
<?php if( $context == 'side' || $display == 'vertical' ) { echo '</tr>'; } ?>
|
47 |
|
48 |
<?php
|
49 |
}
|
50 |
?>
|
51 |
+
|
52 |
<?php if( $label ) { if( $context == 'side' || $display == 'vertical' ) { echo '<tr>'; } } ?>
|
53 |
+
|
54 |
<td<?php echo $content_span; ?> class="<?php echo $content_class; ?>" id="<?php echo $post->ID; ?>">
|
55 |
<?php
|
56 |
// Call the function to display the field
|
59 |
}
|
60 |
?>
|
61 |
</td>
|
62 |
+
|
63 |
<?php if( $label ) { if( $context == 'side' || $display == 'vertical' ) { echo '</tr></table></td>'; } } ?>
|
64 |
+
|
65 |
</tr>
|
66 |
<?php
|
67 |
}
|
78 |
|
79 |
// Add appended fields
|
80 |
if( isset($field['append']) ) {
|
81 |
+
|
82 |
$fields = $field['append'];
|
83 |
$settings = ( isset($field['option'] ) ) ? $field['option'] : false;
|
84 |
|
85 |
if( is_array($fields) ) {
|
86 |
+
|
87 |
foreach( $fields as $id => $field ) {
|
88 |
+
|
89 |
// Get the value
|
90 |
if( $settings) {
|
91 |
$options = get_option( $settings );
|
92 |
+
$value = isset( $options[$id] ) ? $options[$id] : get_option( $id );
|
93 |
} else {
|
94 |
global $post;
|
95 |
$value = get_post_meta( $post->ID, $id, true );
|
96 |
}
|
97 |
+
|
98 |
// Set the default if no value
|
99 |
if( $value == '' && isset($field['default']) ) {
|
100 |
$value = $field['default'];
|
101 |
}
|
102 |
+
|
103 |
if( isset($field['type']) ) {
|
104 |
+
|
105 |
if( $settings ) {
|
106 |
$field['id'] = $settings.'['.$id.']';
|
107 |
$field['option'] = $settings;
|
108 |
} else {
|
109 |
$field['id'] = $id;
|
110 |
}
|
111 |
+
|
112 |
// Call the function to display the field
|
113 |
if ( function_exists('mtphr_dnt_metaboxer_'.$field['type']) ) {
|
114 |
echo '<div class="mtphr-dnt-metaboxer-appended mtphr-dnt-metaboxer'.$field['id'].'">';
|
136 |
$after = ( isset($field['after']) ) ? '<span> '.$field['after'].'</span>' : '';
|
137 |
|
138 |
if( isset($field['options']) ) {
|
139 |
+
|
140 |
$break = '<br/>';
|
141 |
if ( isset($field['display']) ) {
|
142 |
if( $field['display'] == 'inline' ) {
|
147 |
$checked = ( isset($value[$i]) ) ? 'checked="checked"' : '';
|
148 |
$output .= '<label><input name="'.$field['id'].'['.$i.']" id="'.$field['id'].'['.$i.']" type="checkbox" value="1" '.$checked.' /> '.$option.'</label>'.$break;
|
149 |
}
|
150 |
+
|
151 |
} else {
|
152 |
+
|
153 |
$checked = ( $value == 1 ) ? 'checked="checked"' : '';
|
154 |
$output .= '<label><input name="'.$field['id'].'" id="'.$field['id'].'" type="checkbox" value="1" '.$checked.' />';
|
155 |
if( isset($field['label']) ) {
|
156 |
$output .= ' '.$field['label'];
|
157 |
+
}
|
158 |
$output .= '</label>';
|
159 |
}
|
160 |
+
|
161 |
echo $before.$output.$after;
|
162 |
+
|
163 |
// Add appended fields
|
164 |
mtphr_dnt_metaboxer_append_field($field);
|
165 |
}
|
172 |
* @since 1.0.0
|
173 |
*/
|
174 |
function mtphr_dnt_metaboxer_file( $field, $value='' ) {
|
175 |
+
|
176 |
// Check if there's actually a file
|
177 |
$file = false;
|
178 |
if( $value != '' ) {
|
179 |
$file = get_post( $value );
|
180 |
}
|
181 |
+
|
182 |
// If there isn't a file reset the value
|
183 |
if( !$file ) {
|
184 |
$value = '';
|
185 |
}
|
186 |
?>
|
187 |
+
|
188 |
<input class="mtphr-dnt-metaboxer-file-value" type="hidden" id="<?php echo $field['id']; ?>" name="<?php echo $field['id']; ?>" value="<?php echo $value; ?>" />
|
189 |
+
|
190 |
<?php
|
191 |
echo isset( $field['button'] ) ? '<a href="#" class="button mtphr-dnt-metaboxer-file-upload">'.$field['button'].'</a>' : '<a href="#" class="button custom-media-upload">Insert File</a>';
|
192 |
+
|
193 |
if( $file ) {
|
194 |
+
|
195 |
$type = explode( '/', $file->post_mime_type );
|
196 |
|
197 |
// Display the file
|
209 |
* @since 1.0.0
|
210 |
*/
|
211 |
function mtphr_dnt_metaboxer_ajax_file_display() {
|
212 |
+
|
213 |
// Get access to the database
|
214 |
global $wpdb;
|
215 |
+
|
216 |
// Check the nonce
|
217 |
check_ajax_referer( 'mtphr_dnt', 'security' );
|
218 |
+
|
219 |
// Get variables
|
220 |
$id = $_POST['id'];
|
221 |
$type = $_POST['type'];
|
223 |
$title = $_POST['title'];
|
224 |
$caption = $_POST['caption'];
|
225 |
$description = $_POST['description'];
|
226 |
+
|
227 |
// Display the file
|
228 |
mtphr_dnt_metaboxer_file_display( $id, $type, $url, $title, $caption, $description );
|
229 |
+
|
230 |
die(); // this is required to return a proper result
|
231 |
}
|
232 |
|
233 |
// Display the file
|
234 |
+
function mtphr_dnt_metaboxer_file_display( $id, $type, $url, $title, $caption, $description ) {
|
235 |
|
236 |
$src = '';
|
237 |
switch( $type ) {
|
238 |
+
|
239 |
case 'image':
|
240 |
$att = wp_get_attachment_image_src( $id, 'thumbnail' );
|
241 |
$src = $att[0];
|
242 |
break;
|
243 |
+
|
244 |
case 'application':
|
245 |
$att = wp_get_attachment_image_src( $id, 'thumbnail', true );
|
246 |
$src = $att[0];
|
277 |
* @since 1.0.0
|
278 |
*/
|
279 |
function mtphr_dnt_metaboxer_html( $field, $value='' ) {
|
280 |
+
|
281 |
// Echo the html
|
282 |
echo $value;
|
283 |
+
|
284 |
// Add appended fields
|
285 |
mtphr_dnt_metaboxer_append_field($field);
|
286 |
}
|
293 |
* @since 1.0.0
|
294 |
*/
|
295 |
function mtphr_dnt_metaboxer_image( $field, $value='' ) {
|
296 |
+
|
297 |
// Check if there's actually a file
|
298 |
$image = false;
|
299 |
if( $value != '' ) {
|
300 |
$image = get_post( $value );
|
301 |
}
|
302 |
+
|
303 |
// If there isn't a file reset the value
|
304 |
if( !$image ) {
|
305 |
$value = '';
|
306 |
}
|
307 |
?>
|
308 |
+
|
309 |
<div class="mtphr-dnt-metaboxer-image-contents">
|
310 |
<input class="mtphr-dnt-metaboxer-image-value" type="hidden" id="<?php echo $field['id']; ?>" name="<?php echo $field['id']; ?>" value="<?php echo $value; ?>" />
|
311 |
+
|
312 |
<?php
|
313 |
echo isset( $field['button'] ) ? '<a href="#" class="button mtphr-dnt-metaboxer-image-upload">'.$field['button'].'</a>' : '<a href="#" class="button mtphr-dnt-metaboxer-image-upload">Insert Image</a>';
|
314 |
+
|
315 |
if( $image ) {
|
316 |
+
|
317 |
$type = explode( '/', $image->post_mime_type );
|
318 |
|
319 |
// Display the file
|
320 |
echo mtphr_dnt_metaboxer_image_display( $image->ID, $type[0], $image->guid, $image->post_title, $image -> post_excerpt, $image->post_content );
|
321 |
}
|
322 |
?>
|
323 |
+
|
324 |
</div>
|
325 |
+
|
326 |
<?php
|
327 |
// Add appended fields
|
328 |
mtphr_dnt_metaboxer_append_field($field);
|
335 |
* @since 1.0.0
|
336 |
*/
|
337 |
function mtphr_dnt_metaboxer_ajax_image_display() {
|
338 |
+
|
339 |
// Get access to the database
|
340 |
global $wpdb;
|
341 |
+
|
342 |
// Check the nonce
|
343 |
check_ajax_referer( 'neuron', 'security' );
|
344 |
+
|
345 |
// Get variables
|
346 |
$id = $_POST['id'];
|
347 |
$type = $_POST['type'];
|
349 |
$title = $_POST['title'];
|
350 |
$caption = $_POST['caption'];
|
351 |
$description = $_POST['description'];
|
352 |
+
|
353 |
// Display the file
|
354 |
mtphr_dnt_metaboxer_image_display( $id, $type, $url, $title, $caption, $description );
|
355 |
+
|
356 |
die(); // this is required to return a proper result
|
357 |
}
|
358 |
|
359 |
// Display the file
|
360 |
+
function mtphr_dnt_metaboxer_image_display( $id, $type, $url, $title, $caption, $description ) {
|
361 |
|
362 |
$src = '';
|
363 |
switch( $type ) {
|
364 |
+
|
365 |
case 'image':
|
366 |
$att = wp_get_attachment_image_src( $id, 'thumbnail' );
|
367 |
$src = $att[0];
|
368 |
break;
|
369 |
+
|
370 |
case 'application':
|
371 |
$att = wp_get_attachment_image_src( $id, 'thumbnail', true );
|
372 |
$src = $att[0];
|
402 |
$output .= '<a class="mtphr-dnt-metaboxer-image-select-link '.$selected.'" href="'.$option['value'].'"><img src="'.$option['path'].'" /><small>'.$option['label'].'</small></a>';
|
403 |
}
|
404 |
echo $output;
|
405 |
+
|
406 |
// Add appended fields
|
407 |
mtphr_dnt_metaboxer_append_field($field);
|
408 |
}
|
415 |
* @since 1.0.2
|
416 |
*/
|
417 |
function mtphr_dnt_metaboxer_list( $field, $value='' ) {
|
418 |
+
|
419 |
+
$output = '<table>';
|
420 |
+
|
421 |
$headers = false;
|
422 |
$header_str = '';
|
423 |
foreach( $field['structure'] as $id => $str ) {
|
424 |
+
|
425 |
$header_str .= '<th>';
|
426 |
if( isset($str['header']) ) {
|
427 |
$headers = true;
|
432 |
if( $headers ) {
|
433 |
$output .= '<tr><td class="mtphr-dnt-metaboxer-list-item-handle"></td>'.$header_str.'</tr>';
|
434 |
}
|
435 |
+
|
436 |
$buttons = '<td class="mtphr-dnt-metaboxer-list-item-delete"><a href="#">Delete</a></td><td class="mtphr-dnt-metaboxer-list-item-add"><a href="#">Add</a></td>';
|
437 |
if( is_array($value) ) {
|
438 |
foreach( $value as $i=>$v ) {
|
440 |
$output .= '<tr class="mtphr-dnt-metaboxer-list-item"><td class="mtphr-dnt-metaboxer-list-item-handle"><span></span></td>'.$structure.$buttons.'</tr>';
|
441 |
}
|
442 |
}
|
443 |
+
|
444 |
// If nothing is being output make sure one field is showing
|
445 |
if( $value == '' || count($value) == 0 ) {
|
446 |
$structure = mtphr_dnt_metaboxer_list_structure( 0, $field );
|
447 |
$output .= '<tr class="mtphr-dnt-metaboxer-list-item"><td class="mtphr-dnt-metaboxer-list-item-handle"><span></span></td>'.$structure.$buttons.'</tr>';
|
448 |
}
|
449 |
+
|
450 |
$output .= '</table>';
|
451 |
+
|
452 |
echo $output;
|
453 |
+
|
454 |
// Add appended fields
|
455 |
mtphr_dnt_metaboxer_append_field($field);
|
456 |
}
|
459 |
function mtphr_dnt_metaboxer_list_structure( $pos, $fields, $m_value='' ) {
|
460 |
|
461 |
$main_id = $fields['id'];
|
462 |
+
|
463 |
// Add appended fields
|
464 |
if( isset($fields['structure']) ) {
|
465 |
+
|
466 |
$fields = $fields['structure'];
|
467 |
$settings = ( isset($fields['option'] ) ) ? $fields['option'] : false;
|
468 |
|
469 |
if( is_array($fields) ) {
|
470 |
+
|
471 |
ob_start();
|
472 |
+
|
473 |
foreach( $fields as $id => $field ) {
|
474 |
+
|
475 |
// Get the value
|
476 |
$value = isset($m_value[$id]) ? $m_value[$id] : '';
|
477 |
+
|
478 |
// Get the width
|
479 |
$width = isset($field['width']) ? ' style="width:'.$field['width'].'"' : '';
|
480 |
+
|
481 |
if( isset($field['type']) ) {
|
482 |
+
|
483 |
$field['id'] = $main_id.'['.$pos.']['.$id.']';
|
484 |
+
|
485 |
// Call the function to display the field
|
486 |
if ( function_exists('mtphr_dnt_metaboxer_'.$field['type']) ) {
|
487 |
|
491 |
}
|
492 |
}
|
493 |
}
|
494 |
+
|
495 |
return ob_get_clean();
|
496 |
}
|
497 |
}
|
507 |
function mtphr_dnt_metaboxer_metabox_toggle( $field, $value='' ) {
|
508 |
|
509 |
if( isset($field['options']) ) {
|
510 |
+
|
511 |
$output = '';
|
512 |
$output .= '<input type="hidden" id="'.$field['id'].'" name="'.$field['id'].'" value="'.$value.'" />';
|
513 |
+
|
514 |
foreach( $field['options'] as $i => $option ) {
|
515 |
+
|
516 |
$button = $option['button'];
|
517 |
$metaboxes = $option['metaboxes'];
|
518 |
$metabox_list = join( ',', $metaboxes );
|
519 |
+
|
520 |
// Create a button
|
521 |
$selected = ( $value == $i ) ? ' button-primary' : '';
|
522 |
$output .= '<a href="'.$i.'" metaboxes="'.$metabox_list.'" class="mtphr-dnt-metaboxer-metabox-toggle button'.$selected.'">'.$button.'</a> ';
|
523 |
+
}
|
524 |
+
|
525 |
echo $output;
|
526 |
}
|
527 |
+
|
528 |
// Add appended fields
|
529 |
mtphr_dnt_metaboxer_append_field($field);
|
530 |
}
|
542 |
$after = ( isset($field['after']) ) ? '<span> '.$field['after'].'</span>' : '';
|
543 |
$output = $before.'<input name="'.$field['id'].'" id="'.$field['id'].'" type="number" value="'.$value.'" class="small-text"'.$style.'>'.$after;
|
544 |
echo $output;
|
545 |
+
|
546 |
// Add appended fields
|
547 |
mtphr_dnt_metaboxer_append_field($field);
|
548 |
}
|
555 |
* @since 1.0.0
|
556 |
*/
|
557 |
function mtphr_dnt_metaboxer_radio( $field, $value='' ) {
|
558 |
+
|
559 |
if( isset($field['options']) ) {
|
560 |
|
561 |
$output = '';
|
568 |
foreach( $field['options'] as $i => $option ) {
|
569 |
$checked = ( $value == $i ) ? 'checked="checked"' : '';
|
570 |
$output .= '<label><input name="'.$field['id'].'" id="'.$field['id'].'" type="radio" value="'.$i.'" '.$checked.' /> '.$option.'</label>'.$break;
|
571 |
+
}
|
572 |
}
|
573 |
+
|
574 |
echo $output;
|
575 |
+
|
576 |
// Add appended fields
|
577 |
mtphr_dnt_metaboxer_append_field($field);
|
578 |
}
|
588 |
|
589 |
$before = ( isset($field['before']) ) ? '<span>'.$field['before'].' </span>' : '';
|
590 |
$after = ( isset($field['after']) ) ? '<span> '.$field['after'].'</span>' : '';
|
591 |
+
|
592 |
$output = $before.'<select name="'.$field['id'].'" id="'.$field['id'].'">';
|
593 |
+
|
594 |
if( $field['options'] ) {
|
595 |
+
|
596 |
$key_val = isset( $field['key_val'] ) ? true : false;
|
597 |
+
|
598 |
foreach ( $field['options'] as $key => $option ) {
|
599 |
if( is_numeric($key) && !$key_val ) {
|
600 |
$name = ( is_array( $option ) ) ? $option['name'] : $option;
|
610 |
$output .= '</select>'.$after;
|
611 |
|
612 |
echo $output;
|
613 |
+
|
614 |
// Add appended fields
|
615 |
mtphr_dnt_metaboxer_append_field($field);
|
616 |
}
|
636 |
} else {
|
637 |
$rows = $field['rows'];
|
638 |
}
|
639 |
+
|
640 |
foreach( $field['rows'] as $id=>$data ) {
|
641 |
if( !isset($rows[$id]) ) {
|
642 |
$rows[$id] = $data;
|
643 |
}
|
644 |
}
|
645 |
+
|
646 |
+
$output = '<table>';
|
647 |
|
648 |
foreach( $rows as $id => $data ) {
|
649 |
+
|
650 |
$output .= '<tr class="mtphr-dnt-metaboxer-sort-item"><td class="mtphr-dnt-metaboxer-sort-item-handle"><span></span></td>';
|
651 |
if( isset($data['name']) ) {
|
652 |
$output .= '<td class="mtphr-dnt-metaboxer-sort-name">'.$data['name'].'</td>';
|
653 |
}
|
654 |
$output .= '<td><input name="'.$field['id'].'[]" id="'.$field['id'].'[]" type="hidden" value="'.$id.'">';
|
655 |
+
|
656 |
// Find the value
|
657 |
$data_value = get_post_meta( $post->ID, $data['id'], true );
|
658 |
if( $data_value == '' && isset($data['default']) ) {
|
659 |
$data_value = $data['default'];
|
660 |
}
|
661 |
+
|
662 |
ob_start();
|
663 |
// Call the function to display the field
|
664 |
if ( function_exists('mtphr_dnt_metaboxer_'.$data['type']) ) {
|
665 |
call_user_func( 'mtphr_dnt_metaboxer_'.$data['type'], $data, $data_value );
|
666 |
}
|
667 |
$output .= ob_get_clean();
|
668 |
+
|
669 |
$output .= '</td>';
|
670 |
+
|
671 |
$output .= '</tr>';
|
672 |
}
|
673 |
+
|
674 |
$output .= '</table>';
|
675 |
+
|
676 |
echo $output;
|
677 |
+
|
678 |
// Add appended fields
|
679 |
mtphr_dnt_metaboxer_append_field($field);
|
680 |
}
|
693 |
$text_align = ( isset($field['text_align']) ) ? ' style="text-align:'.$field['text_align'].'"' : '' ;
|
694 |
$output = $before.'<input name="'.$field['id'].'" id="'.$field['id'].'" type="text" value="'.$value.'" size="'.$size.'"'.$text_align.'>'.$after;
|
695 |
echo $output;
|
696 |
+
|
697 |
// Add appended fields
|
698 |
mtphr_dnt_metaboxer_append_field($field);
|
699 |
}
|
710 |
$cols = ( isset($field['cols']) ) ? $field['cols'] : 40;
|
711 |
$output = '<textarea name="'.$field['id'].'" id="'.$field['id'].'" rows="'.$rows.'" cols="'.$cols.'">'.$value.'</textarea>';
|
712 |
echo $output;
|
713 |
+
|
714 |
// Add appended fields
|
715 |
mtphr_dnt_metaboxer_append_field($field);
|
716 |
}
|
727 |
$settings['media_buttons'] = true;
|
728 |
$settings['textarea_rows'] = ( isset($field['rows']) ) ? $field['rows'] : 12;
|
729 |
wp_editor( $value, $field['id'], $settings );
|
730 |
+
|
731 |
// Add appended fields
|
732 |
mtphr_dnt_metaboxer_append_field($field);
|
733 |
}
|
741 |
* @since 1.0.0
|
742 |
*/
|
743 |
function mtphr_dnt_metaboxer_code( $field, $value='' ) {
|
744 |
+
|
745 |
global $post;
|
746 |
+
|
747 |
// Display the shortcode code
|
748 |
if( $field['id'] == '_mtphr_dnt_shortcode' ) {
|
749 |
+
|
750 |
echo '<pre><p>[ditty_news_ticker id="'.$post->ID.'"]</p></pre>';
|
751 |
+
|
752 |
// Display the function code
|
753 |
} elseif( $field['id'] == '_mtphr_dnt_function' ) {
|
754 |
+
|
755 |
echo '<pre><p><?php if(function_exists(\'ditty_news_ticker\')){ditty_news_ticker('.$post->ID.');} ?></p></pre>';
|
756 |
}
|
757 |
+
|
758 |
// Display a "Select All" button
|
759 |
$button = isset($field['button']) ? $field['button'] : __('Select Code', 'ditty-news-ticker');
|
760 |
echo '<a href="#" class="button mtphr-dnt-metaboxer-code-select">'.$button.'</a>';
|
includes/scripts.php
CHANGED
@@ -19,11 +19,11 @@ function mtphr_dnt_admin_scripts( $hook ) {
|
|
19 |
global $typenow;
|
20 |
|
21 |
if ( $typenow == 'ditty_news_ticker' ) {
|
22 |
-
|
23 |
// Load the metaboxer style sheet
|
24 |
wp_register_style( 'ditty-metaboxer', MTPHR_DNT_URL.'/includes/metaboxer/metaboxer.css', array( 'colors', 'thickbox' ), MTPHR_DNT_VERSION );
|
25 |
wp_enqueue_style( 'ditty-metaboxer' );
|
26 |
-
|
27 |
// Load scipts for the media uploader
|
28 |
if(function_exists( 'wp_enqueue_media' )){
|
29 |
wp_enqueue_media();
|
@@ -32,12 +32,18 @@ function mtphr_dnt_admin_scripts( $hook ) {
|
|
32 |
wp_enqueue_script('media-upload');
|
33 |
wp_enqueue_script('thickbox');
|
34 |
}
|
35 |
-
|
36 |
// Load the metaboxer jQuery
|
37 |
wp_register_script( 'ditty-metaboxer', MTPHR_DNT_URL.'/includes/metaboxer/metaboxer.js', array( 'jquery','jquery-ui-core','jquery-ui-sortable' ), MTPHR_DNT_VERSION, true );
|
38 |
wp_enqueue_script( 'ditty-metaboxer' );
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
-
|
41 |
// Load the plugin css
|
42 |
wp_register_style( 'mtphr-dnt-admin', MTPHR_DNT_URL.'/assets/css/style-admin.css', false, MTPHR_DNT_VERSION );
|
43 |
wp_enqueue_style( 'mtphr-dnt-admin' );
|
@@ -50,126 +56,85 @@ add_action( 'wp_enqueue_scripts', 'mtphr_dnt_scripts' );
|
|
50 |
/**
|
51 |
* Load the front end scripts
|
52 |
*
|
53 |
-
* @since 1.
|
54 |
*/
|
55 |
function mtphr_dnt_scripts() {
|
56 |
-
|
57 |
// Load the css
|
58 |
wp_register_style( 'ditty-news-ticker', MTPHR_DNT_URL.'/assets/css/style.css', false, MTPHR_DNT_VERSION );
|
59 |
wp_enqueue_style( 'ditty-news-ticker' );
|
60 |
-
|
61 |
-
//
|
62 |
wp_register_script( 'jquery-easing', MTPHR_DNT_URL.'/assets/js/jquery.easing.1.3.js', array('jquery'), MTPHR_DNT_VERSION, true );
|
63 |
-
|
64 |
-
|
65 |
-
// Load the jQuery
|
66 |
wp_register_script( 'ditty-news-ticker', MTPHR_DNT_URL.'/assets/js/ditty-news-ticker.js', array('jquery'), MTPHR_DNT_VERSION, true );
|
67 |
-
wp_enqueue_script( 'ditty-news-ticker' );
|
68 |
}
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
-
add_action( '
|
74 |
/**
|
75 |
-
* Add
|
76 |
*
|
77 |
-
* @since 1.1.
|
78 |
*/
|
79 |
-
function
|
80 |
-
|
81 |
-
extract( $meta_data );
|
82 |
-
|
83 |
-
// Get the ticker classe
|
84 |
-
$ticker = '#mtphr-dnt-'.$id;
|
85 |
-
|
86 |
-
// Add a unique id class, if there is one
|
87 |
-
if( isset($_mtphr_dnt_unique_id) ) {
|
88 |
-
if( $_mtphr_dnt_unique_id != '' ) {
|
89 |
-
$ticker = '#mtphr-dnt-'.$id.'-'.sanitize_html_class( $_mtphr_dnt_unique_id );
|
90 |
-
}
|
91 |
-
}
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
$pause = $_mtphr_dnt_scroll_pause ? 1 : 0;
|
97 |
-
}
|
98 |
-
ob_start(); ?>
|
99 |
-
<script>
|
100 |
-
jQuery( window ).load( function() {
|
101 |
-
jQuery( '<?php echo $ticker; ?>' ).ditty_news_ticker({
|
102 |
-
id : '<?php echo $id; ?>',
|
103 |
-
type : '<?php echo $_mtphr_dnt_mode; ?>',
|
104 |
-
scroll_direction : '<?php echo $_mtphr_dnt_scroll_direction; ?>',
|
105 |
-
scroll_speed : <?php echo intval($_mtphr_dnt_scroll_speed); ?>,
|
106 |
-
scroll_pause : <?php echo $pause; ?>,
|
107 |
-
scroll_spacing : <?php echo intval($_mtphr_dnt_scroll_tick_spacing); ?>
|
108 |
-
});
|
109 |
-
});
|
110 |
-
</script>
|
111 |
-
<?php // Echo the compressed scripts
|
112 |
-
echo ob_get_clean();
|
113 |
-
|
114 |
-
} elseif( $_mtphr_dnt_mode == 'rotate' ) {
|
115 |
-
$rotate = 0; $pause = 0; $nav_autohide = 0; $nav_reverse = 0;
|
116 |
-
if( isset($_mtphr_dnt_auto_rotate) ) {
|
117 |
-
$rotate = $_mtphr_dnt_auto_rotate ? 1 : 0;
|
118 |
-
}
|
119 |
-
if( isset($_mtphr_dnt_rotate_pause) ) {
|
120 |
-
$pause = $_mtphr_dnt_rotate_pause ? 1 : 0;
|
121 |
-
}
|
122 |
-
if( isset($_mtphr_dnt_rotate_directional_nav_reverse) ) {
|
123 |
-
$nav_reverse = $_mtphr_dnt_rotate_directional_nav_reverse ? 1 : 0;
|
124 |
-
}
|
125 |
-
ob_start(); ?>
|
126 |
-
<script>
|
127 |
-
jQuery( window ).load( function() {
|
128 |
-
jQuery( '<?php echo $ticker; ?>' ).ditty_news_ticker({
|
129 |
-
id : '<?php echo $id; ?>',
|
130 |
-
type : '<?php echo $_mtphr_dnt_mode; ?>',
|
131 |
-
rotate_type : '<?php echo $_mtphr_dnt_rotate_type; ?>',
|
132 |
-
auto_rotate : <?php echo $rotate; ?>,
|
133 |
-
rotate_delay : <?php echo intval($_mtphr_dnt_rotate_delay); ?>,
|
134 |
-
rotate_pause : <?php echo $pause; ?>,
|
135 |
-
rotate_speed : <?php echo intval($_mtphr_dnt_rotate_speed); ?>,
|
136 |
-
rotate_ease : '<?php echo $_mtphr_dnt_rotate_ease; ?>',
|
137 |
-
nav_reverse : <?php echo $nav_reverse; ?>,
|
138 |
-
after_load : function( $ticker ) {
|
139 |
-
<?php echo apply_filters( 'mtphr_dnt_after_load_rotate' , '', $id ); ?>
|
140 |
-
},
|
141 |
-
before_change : function( $ticker ) {
|
142 |
-
<?php echo apply_filters( 'mtphr_dnt_before_change_rotate' , '', $id ); ?>
|
143 |
-
},
|
144 |
-
after_change : function( $ticker ) {
|
145 |
-
<?php echo apply_filters( 'mtphr_dnt_after_change_rotate' , '', $id ); ?>
|
146 |
-
}
|
147 |
-
});
|
148 |
-
});
|
149 |
-
</script>
|
150 |
-
<?php // Echo the compressed scripts
|
151 |
-
echo ob_get_clean();
|
152 |
}
|
153 |
}
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
-
add_action( '
|
159 |
/**
|
160 |
-
*
|
161 |
*
|
162 |
-
* @since 1.
|
163 |
*/
|
164 |
-
function
|
165 |
-
$settings = get_option( 'mtphr_dnt_general_settings' );
|
166 |
-
if( $settings ) {
|
167 |
-
|
168 |
-
if( isset($settings['css']) ) {
|
169 |
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
}
|
175 |
|
19 |
global $typenow;
|
20 |
|
21 |
if ( $typenow == 'ditty_news_ticker' ) {
|
22 |
+
|
23 |
// Load the metaboxer style sheet
|
24 |
wp_register_style( 'ditty-metaboxer', MTPHR_DNT_URL.'/includes/metaboxer/metaboxer.css', array( 'colors', 'thickbox' ), MTPHR_DNT_VERSION );
|
25 |
wp_enqueue_style( 'ditty-metaboxer' );
|
26 |
+
|
27 |
// Load scipts for the media uploader
|
28 |
if(function_exists( 'wp_enqueue_media' )){
|
29 |
wp_enqueue_media();
|
32 |
wp_enqueue_script('media-upload');
|
33 |
wp_enqueue_script('thickbox');
|
34 |
}
|
35 |
+
|
36 |
// Load the metaboxer jQuery
|
37 |
wp_register_script( 'ditty-metaboxer', MTPHR_DNT_URL.'/includes/metaboxer/metaboxer.js', array( 'jquery','jquery-ui-core','jquery-ui-sortable' ), MTPHR_DNT_VERSION, true );
|
38 |
wp_enqueue_script( 'ditty-metaboxer' );
|
39 |
+
|
40 |
+
// Localize scripts
|
41 |
+
wp_localize_script( 'ditty-metaboxer', 'ditty_metaboxer_vars', array(
|
42 |
+
'security' => wp_create_nonce( 'ditty-metaboxer' )
|
43 |
+
)
|
44 |
+
);
|
45 |
}
|
46 |
+
|
47 |
// Load the plugin css
|
48 |
wp_register_style( 'mtphr-dnt-admin', MTPHR_DNT_URL.'/assets/css/style-admin.css', false, MTPHR_DNT_VERSION );
|
49 |
wp_enqueue_style( 'mtphr-dnt-admin' );
|
56 |
/**
|
57 |
* Load the front end scripts
|
58 |
*
|
59 |
+
* @since 1.1.5
|
60 |
*/
|
61 |
function mtphr_dnt_scripts() {
|
62 |
+
|
63 |
// Load the css
|
64 |
wp_register_style( 'ditty-news-ticker', MTPHR_DNT_URL.'/assets/css/style.css', false, MTPHR_DNT_VERSION );
|
65 |
wp_enqueue_style( 'ditty-news-ticker' );
|
66 |
+
|
67 |
+
// Register the jQuery easing
|
68 |
wp_register_script( 'jquery-easing', MTPHR_DNT_URL.'/assets/js/jquery.easing.1.3.js', array('jquery'), MTPHR_DNT_VERSION, true );
|
69 |
+
|
70 |
+
// Register the DNT jQuery class
|
|
|
71 |
wp_register_script( 'ditty-news-ticker', MTPHR_DNT_URL.'/assets/js/ditty-news-ticker.js', array('jquery'), MTPHR_DNT_VERSION, true );
|
|
|
72 |
}
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
+
add_action( 'wp_head', 'mtphr_dnt_custom_css' );
|
78 |
/**
|
79 |
+
* Add custom css
|
80 |
*
|
81 |
+
* @since 1.1.5
|
82 |
*/
|
83 |
+
function mtphr_dnt_custom_css() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
+
$settings = get_option( 'mtphr_dnt_general_settings' );
|
86 |
+
if( $settings && isset($settings['css']) ) {
|
87 |
+
echo '<style>'.sanitize_text_field( $settings['css'] ).'</style>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
}
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
+
add_action( 'wp_footer', 'mtphr_dnt_tickers_init_scripts', 20 );
|
95 |
/**
|
96 |
+
* Initialize the ticker scriptinos
|
97 |
*
|
98 |
+
* @since 1.1.5
|
99 |
*/
|
100 |
+
function mtphr_dnt_tickers_init_scripts() {
|
|
|
|
|
|
|
|
|
101 |
|
102 |
+
global $mtphr_dnt_ticker_scripts;
|
103 |
+
if( is_array($mtphr_dnt_ticker_scripts) && !empty($mtphr_dnt_ticker_scripts) ) {
|
104 |
+
wp_print_scripts('jquery-easing');
|
105 |
+
wp_print_scripts('ditty-news-ticker');
|
106 |
+
?>
|
107 |
+
<script>
|
108 |
+
jQuery( window ).load( function() {
|
109 |
+
<?php foreach( $mtphr_dnt_ticker_scripts as $ticker ) { ?>
|
110 |
+
jQuery( '<?php echo $ticker['ticker']; ?>' ).ditty_news_ticker({
|
111 |
+
id : '<?php echo $ticker['id']; ?>',
|
112 |
+
type : '<?php echo $ticker['type']; ?>',
|
113 |
+
scroll_direction : '<?php echo $ticker['scroll_direction']; ?>',
|
114 |
+
scroll_speed : <?php echo $ticker['scroll_speed']; ?>,
|
115 |
+
scroll_pause : <?php echo $ticker['scroll_pause']; ?>,
|
116 |
+
scroll_spacing : <?php echo $ticker['scroll_spacing']; ?>,
|
117 |
+
rotate_type : '<?php echo $ticker['rotate_type']; ?>',
|
118 |
+
auto_rotate : <?php echo $ticker['auto_rotate']; ?>,
|
119 |
+
rotate_delay : <?php echo $ticker['rotate_delay']; ?>,
|
120 |
+
rotate_pause : <?php echo $ticker['rotate_pause']; ?>,
|
121 |
+
rotate_speed : <?php echo $ticker['rotate_speed']; ?>,
|
122 |
+
rotate_ease : '<?php echo $ticker['rotate_ease']; ?>',
|
123 |
+
nav_reverse : <?php echo $ticker['nav_reverse']; ?>,
|
124 |
+
after_load : function( $ticker ) {
|
125 |
+
<?php echo apply_filters( 'mtphr_dnt_after_load_rotate' , '', $ticker['id'] ); ?>
|
126 |
+
},
|
127 |
+
before_change : function( $ticker ) {
|
128 |
+
<?php echo apply_filters( 'mtphr_dnt_before_change_rotate' , '', $ticker['id'] ); ?>
|
129 |
+
},
|
130 |
+
after_change : function( $ticker ) {
|
131 |
+
<?php echo apply_filters( 'mtphr_dnt_after_change_rotate' , '', $ticker['id'] ); ?>
|
132 |
+
}
|
133 |
+
});
|
134 |
+
<?php } ?>
|
135 |
+
});
|
136 |
+
</script>
|
137 |
+
<?php
|
138 |
+
}
|
139 |
}
|
140 |
|
includes/settings.php
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
*
|
5 |
* @package Ditty News Ticker
|
6 |
*/
|
7 |
-
|
8 |
-
|
9 |
|
10 |
|
11 |
add_action( 'admin_menu', 'mtphr_dnt_settings_menu', 9 );
|
@@ -41,26 +41,24 @@ function mtphr_dnt_initialize_settings() {
|
|
41 |
* General options sections
|
42 |
*/
|
43 |
$settings = array();
|
44 |
-
|
45 |
-
|
46 |
-
$settings['wysiwyg'] = array(
|
47 |
'title' => __( 'Visual Editor', 'ditty-news-ticker' ),
|
48 |
'type' => 'checkbox',
|
49 |
'label' => __( 'Use the visual editor for ticks', 'ditty-news-ticker' ),
|
50 |
'description' => __( '*The content in the visual editors will disappear after re-arranging ticks. That content will re-populate after resaving the ticker.', 'ditty-news-ticker' )
|
51 |
);
|
52 |
-
|
53 |
-
|
54 |
$settings['css'] = array(
|
55 |
'title' => __( 'Custom CSS', 'ditty-news-ticker' ),
|
56 |
'type' => 'textarea',
|
57 |
'rows' => 20,
|
58 |
'description' => __( 'Custom CSS will be added to the head of each page that includes a Ditty News Ticker.', 'ditty-news-ticker' )
|
59 |
);
|
60 |
-
if( false == get_option('mtphr_dnt_general_settings') ) {
|
61 |
add_option( 'mtphr_dnt_general_settings' );
|
62 |
}
|
63 |
-
|
64 |
/* Register the general options */
|
65 |
add_settings_section(
|
66 |
'mtphr_dnt_general_settings_section', // ID used to identify this section and with which to register options
|
@@ -77,7 +75,7 @@ $settings['wysiwyg'] = array(
|
|
77 |
add_settings_field( $setting['id'], $setting['title'], 'mtphr_dnt_settings_callback', 'mtphr_dnt_general_settings', 'mtphr_dnt_general_settings_section', $setting);
|
78 |
}
|
79 |
}
|
80 |
-
|
81 |
// Register the fields with WordPress
|
82 |
register_setting( 'mtphr_dnt_general_settings', 'mtphr_dnt_general_settings' );
|
83 |
}
|
@@ -94,16 +92,16 @@ function mtphr_dnt_settings_display( $active_tab = null ) {
|
|
94 |
?>
|
95 |
<!-- Create a header in the default WordPress 'wrap' container -->
|
96 |
<div class="wrap">
|
97 |
-
|
98 |
<div id="icon-themes" class="icon32"></div>
|
99 |
<h2><?php _e( 'Ditty News Ticker Settings', 'ditty-news-ticker' ); ?></h2>
|
100 |
<?php settings_errors(); ?>
|
101 |
-
|
102 |
<?php
|
103 |
$tabs = mtphr_dnt_settings_tabs();
|
104 |
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general';
|
105 |
?>
|
106 |
-
|
107 |
<ul style="margin-bottom:20px;" class="subsubsub">
|
108 |
<?php
|
109 |
$num_tabs = count($tabs);
|
@@ -116,7 +114,7 @@ function mtphr_dnt_settings_display( $active_tab = null ) {
|
|
116 |
}
|
117 |
?>
|
118 |
</ul>
|
119 |
-
|
120 |
<br class="clear" />
|
121 |
|
122 |
<form method="post" action="options.php">
|
@@ -126,7 +124,7 @@ function mtphr_dnt_settings_display( $active_tab = null ) {
|
|
126 |
submit_button();
|
127 |
?>
|
128 |
</form>
|
129 |
-
|
130 |
</div><!-- /.wrap -->
|
131 |
<?php
|
132 |
}
|
@@ -154,31 +152,31 @@ function mtphr_dnt_general_settings_callback() {
|
|
154 |
* The custom field callback.
|
155 |
*
|
156 |
* @since 1.0.0
|
157 |
-
*/
|
158 |
function mtphr_dnt_settings_callback( $args ) {
|
159 |
-
|
160 |
// First, we read the options collection
|
161 |
if( isset($args['option']) ) {
|
162 |
$options = get_option( $args['option'] );
|
163 |
$value = isset( $options[$args['option_id']] ) ? $options[$args['option_id']] : '';
|
164 |
} else {
|
165 |
$value = get_option( $args['id'] );
|
166 |
-
}
|
167 |
if( $value == '' && isset($args['default']) ) {
|
168 |
$value = $args['default'];
|
169 |
}
|
170 |
if( isset($args['type']) ) {
|
171 |
-
|
172 |
echo '<div class="mtphr-dnt-metaboxer-field mtphr-dnt-metaboxer-'.$args['type'].'">';
|
173 |
-
|
174 |
// Call the function to display the field
|
175 |
if ( function_exists('mtphr_dnt_metaboxer_'.$args['type']) ) {
|
176 |
call_user_func( 'mtphr_dnt_metaboxer_'.$args['type'], $args, $value );
|
177 |
}
|
178 |
-
|
179 |
echo '<div>';
|
180 |
}
|
181 |
-
|
182 |
// Add a descriptions
|
183 |
if( isset($args['description']) ) {
|
184 |
echo '<span class="description"><small>'.$args['description'].'</small></span>';
|
4 |
*
|
5 |
* @package Ditty News Ticker
|
6 |
*/
|
7 |
+
|
8 |
+
|
9 |
|
10 |
|
11 |
add_action( 'admin_menu', 'mtphr_dnt_settings_menu', 9 );
|
41 |
* General options sections
|
42 |
*/
|
43 |
$settings = array();
|
44 |
+
|
45 |
+
$settings['wysiwyg'] = array(
|
|
|
46 |
'title' => __( 'Visual Editor', 'ditty-news-ticker' ),
|
47 |
'type' => 'checkbox',
|
48 |
'label' => __( 'Use the visual editor for ticks', 'ditty-news-ticker' ),
|
49 |
'description' => __( '*The content in the visual editors will disappear after re-arranging ticks. That content will re-populate after resaving the ticker.', 'ditty-news-ticker' )
|
50 |
);
|
51 |
+
|
|
|
52 |
$settings['css'] = array(
|
53 |
'title' => __( 'Custom CSS', 'ditty-news-ticker' ),
|
54 |
'type' => 'textarea',
|
55 |
'rows' => 20,
|
56 |
'description' => __( 'Custom CSS will be added to the head of each page that includes a Ditty News Ticker.', 'ditty-news-ticker' )
|
57 |
);
|
58 |
+
if( false == get_option('mtphr_dnt_general_settings') ) {
|
59 |
add_option( 'mtphr_dnt_general_settings' );
|
60 |
}
|
61 |
+
|
62 |
/* Register the general options */
|
63 |
add_settings_section(
|
64 |
'mtphr_dnt_general_settings_section', // ID used to identify this section and with which to register options
|
75 |
add_settings_field( $setting['id'], $setting['title'], 'mtphr_dnt_settings_callback', 'mtphr_dnt_general_settings', 'mtphr_dnt_general_settings_section', $setting);
|
76 |
}
|
77 |
}
|
78 |
+
|
79 |
// Register the fields with WordPress
|
80 |
register_setting( 'mtphr_dnt_general_settings', 'mtphr_dnt_general_settings' );
|
81 |
}
|
92 |
?>
|
93 |
<!-- Create a header in the default WordPress 'wrap' container -->
|
94 |
<div class="wrap">
|
95 |
+
|
96 |
<div id="icon-themes" class="icon32"></div>
|
97 |
<h2><?php _e( 'Ditty News Ticker Settings', 'ditty-news-ticker' ); ?></h2>
|
98 |
<?php settings_errors(); ?>
|
99 |
+
|
100 |
<?php
|
101 |
$tabs = mtphr_dnt_settings_tabs();
|
102 |
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general';
|
103 |
?>
|
104 |
+
|
105 |
<ul style="margin-bottom:20px;" class="subsubsub">
|
106 |
<?php
|
107 |
$num_tabs = count($tabs);
|
114 |
}
|
115 |
?>
|
116 |
</ul>
|
117 |
+
|
118 |
<br class="clear" />
|
119 |
|
120 |
<form method="post" action="options.php">
|
124 |
submit_button();
|
125 |
?>
|
126 |
</form>
|
127 |
+
|
128 |
</div><!-- /.wrap -->
|
129 |
<?php
|
130 |
}
|
152 |
* The custom field callback.
|
153 |
*
|
154 |
* @since 1.0.0
|
155 |
+
*/
|
156 |
function mtphr_dnt_settings_callback( $args ) {
|
157 |
+
|
158 |
// First, we read the options collection
|
159 |
if( isset($args['option']) ) {
|
160 |
$options = get_option( $args['option'] );
|
161 |
$value = isset( $options[$args['option_id']] ) ? $options[$args['option_id']] : '';
|
162 |
} else {
|
163 |
$value = get_option( $args['id'] );
|
164 |
+
}
|
165 |
if( $value == '' && isset($args['default']) ) {
|
166 |
$value = $args['default'];
|
167 |
}
|
168 |
if( isset($args['type']) ) {
|
169 |
+
|
170 |
echo '<div class="mtphr-dnt-metaboxer-field mtphr-dnt-metaboxer-'.$args['type'].'">';
|
171 |
+
|
172 |
// Call the function to display the field
|
173 |
if ( function_exists('mtphr_dnt_metaboxer_'.$args['type']) ) {
|
174 |
call_user_func( 'mtphr_dnt_metaboxer_'.$args['type'], $args, $value );
|
175 |
}
|
176 |
+
|
177 |
echo '<div>';
|
178 |
}
|
179 |
+
|
180 |
// Add a descriptions
|
181 |
if( isset($args['description']) ) {
|
182 |
echo '<span class="description"><small>'.$args['description'].'</small></span>';
|
languages/ditty-news-ticker-en_US.mo
CHANGED
Binary file
|
languages/ditty-news-ticker-en_US.po
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"Project-Id-Version: Ditty News Ticker v1.1.
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: \n"
|
6 |
-
"PO-Revision-Date: 2013-
|
7 |
"Last-Translator: admin <joe@metaphorcreations.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
@@ -41,22 +41,22 @@ msgstr "Shortcode"
|
|
41 |
msgid "Direct Function"
|
42 |
msgstr "Direct Function"
|
43 |
|
44 |
-
#: includes/functions.php:
|
45 |
#@ ditty-news-ticker
|
46 |
msgid "Default"
|
47 |
msgstr "Default"
|
48 |
|
49 |
-
#: includes/functions.php:
|
50 |
#@ ditty-news-ticker
|
51 |
msgid "Scroll"
|
52 |
msgstr "Scroll"
|
53 |
|
54 |
-
#: includes/functions.php:
|
55 |
#@ ditty-news-ticker
|
56 |
msgid "Rotate"
|
57 |
msgstr "Rotate"
|
58 |
|
59 |
-
#: includes/functions.php:
|
60 |
#@ ditty-news-ticker
|
61 |
msgid "List"
|
62 |
msgstr "List"
|
@@ -531,17 +531,17 @@ msgstr "Ditty News Ticker Updated!"
|
|
531 |
msgid "Settings"
|
532 |
msgstr "Settings"
|
533 |
|
534 |
-
#: includes/settings.php:
|
535 |
#@ ditty-news-ticker
|
536 |
msgid "Custom CSS"
|
537 |
msgstr "Custom CSS"
|
538 |
|
539 |
-
#: includes/settings.php:
|
540 |
#@ ditty-news-ticker
|
541 |
msgid "Custom CSS will be added to the head of each page that includes a Ditty News Ticker."
|
542 |
msgstr "Custom CSS will be added to the head of each page that includes a Ditty News Ticker."
|
543 |
|
544 |
-
#: includes/settings.php:
|
545 |
#@ ditty-news-ticker
|
546 |
msgid "Ditty News Ticker Settings"
|
547 |
msgstr "Ditty News Ticker Settings"
|
@@ -576,23 +576,8 @@ msgstr "View DNT extensions"
|
|
576 |
msgid "NF"
|
577 |
msgstr "NF"
|
578 |
|
579 |
-
#: includes/settings.php:
|
580 |
#@ ditty-news-ticker
|
581 |
msgid "The global settings to your news tickers."
|
582 |
msgstr "The global settings to your news tickers."
|
583 |
|
584 |
-
#: includes/settings.php:46
|
585 |
-
#@ ditty-news-ticker
|
586 |
-
msgid "Visual Editor"
|
587 |
-
msgstr "Visual Editor"
|
588 |
-
|
589 |
-
#: includes/settings.php:48
|
590 |
-
#@ ditty-news-ticker
|
591 |
-
msgid "Use the visual editor for ticks"
|
592 |
-
msgstr "Use the visual editor for ticks"
|
593 |
-
|
594 |
-
#: includes/settings.php:49
|
595 |
-
#@ ditty-news-ticker
|
596 |
-
msgid "*The content in the visual editors will disappear after re-arranging ticks. That content will re-populate after resaving the ticker."
|
597 |
-
msgstr "*The content in the visual editors will disappear after re-arranging ticks. That content will re-populate after resaving the ticker."
|
598 |
-
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"Project-Id-Version: Ditty News Ticker v1.1.4\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2013-05-04 18:25:42+0000\n"
|
7 |
"Last-Translator: admin <joe@metaphorcreations.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
41 |
msgid "Direct Function"
|
42 |
msgstr "Direct Function"
|
43 |
|
44 |
+
#: includes/functions.php:399
|
45 |
#@ ditty-news-ticker
|
46 |
msgid "Default"
|
47 |
msgstr "Default"
|
48 |
|
49 |
+
#: includes/functions.php:419
|
50 |
#@ ditty-news-ticker
|
51 |
msgid "Scroll"
|
52 |
msgstr "Scroll"
|
53 |
|
54 |
+
#: includes/functions.php:423
|
55 |
#@ ditty-news-ticker
|
56 |
msgid "Rotate"
|
57 |
msgstr "Rotate"
|
58 |
|
59 |
+
#: includes/functions.php:427
|
60 |
#@ ditty-news-ticker
|
61 |
msgid "List"
|
62 |
msgstr "List"
|
531 |
msgid "Settings"
|
532 |
msgstr "Settings"
|
533 |
|
534 |
+
#: includes/settings.php:55
|
535 |
#@ ditty-news-ticker
|
536 |
msgid "Custom CSS"
|
537 |
msgstr "Custom CSS"
|
538 |
|
539 |
+
#: includes/settings.php:58
|
540 |
#@ ditty-news-ticker
|
541 |
msgid "Custom CSS will be added to the head of each page that includes a Ditty News Ticker."
|
542 |
msgstr "Custom CSS will be added to the head of each page that includes a Ditty News Ticker."
|
543 |
|
544 |
+
#: includes/settings.php:99
|
545 |
#@ ditty-news-ticker
|
546 |
msgid "Ditty News Ticker Settings"
|
547 |
msgstr "Ditty News Ticker Settings"
|
576 |
msgid "NF"
|
577 |
msgstr "NF"
|
578 |
|
579 |
+
#: includes/settings.php:145
|
580 |
#@ ditty-news-ticker
|
581 |
msgid "The global settings to your news tickers."
|
582 |
msgstr "The global settings to your news tickers."
|
583 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -11,7 +11,7 @@ Ditty News Ticker is a multi-functional data display plugin.
|
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
Ditty News Ticker is a multi-functional data display plugin. Easily add custom news tickers to your site either through shortcodes, direct functions, or in a custom Ditty News Ticker Widget.
|
15 |
|
16 |
#### There are 3 default ticker modes
|
17 |
|
@@ -52,11 +52,16 @@ Each individual Ticker post has multiple settings to customize.
|
|
52 |
|
53 |
== Changelog ==
|
54 |
|
|
|
|
|
|
|
|
|
|
|
55 |
= 1.1.4 =
|
56 |
* Added nofollow to navigational links.
|
57 |
|
58 |
= 1.1.3 =
|
59 |
-
* Added option to use visual editors for tick content (on settings page).
|
60 |
* Adjusted DNT jQuery class. Converted height() & width() to outerHeight() & outerWidth()
|
61 |
|
62 |
= 1.1.2 =
|
@@ -123,6 +128,9 @@ Each individual Ticker post has multiple settings to customize.
|
|
123 |
|
124 |
== Upgrade Notice ==
|
125 |
|
|
|
|
|
|
|
126 |
= 1.1.4 =
|
127 |
Added nofollow to navigational links.
|
128 |
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
Ditty News Ticker is a multi-functional data display plugin. Easily add custom news tickers to your site either through shortcodes, direct functions, or in a custom Ditty News Ticker Widget.
|
15 |
|
16 |
#### There are 3 default ticker modes
|
17 |
|
52 |
|
53 |
== Changelog ==
|
54 |
|
55 |
+
= 1.1.5 =
|
56 |
+
* Modified jQuery ticker class loading.
|
57 |
+
* Fixed load_plugin_textdomain setup.
|
58 |
+
* Added wysiwyg editor option back.
|
59 |
+
|
60 |
= 1.1.4 =
|
61 |
* Added nofollow to navigational links.
|
62 |
|
63 |
= 1.1.3 =
|
64 |
+
* Added option to use visual editors for tick content (on settings page).
|
65 |
* Adjusted DNT jQuery class. Converted height() & width() to outerHeight() & outerWidth()
|
66 |
|
67 |
= 1.1.2 =
|
128 |
|
129 |
== Upgrade Notice ==
|
130 |
|
131 |
+
= 1.1.5 =
|
132 |
+
Modified jQuery ticker class loading. Fixed load_plugin_textdomain setup. Added wysiwyg editor option back.
|
133 |
+
|
134 |
= 1.1.4 =
|
135 |
Added nofollow to navigational links.
|
136 |
|