Example #1
0
 function mtphr_dnt_types_labels()
 {
     $types = mtphr_dnt_types_array();
     $labels = array();
     if (is_array($types) && count($types) > 0) {
         foreach ($types as $i => $type) {
             $labels[$i] = $type['button'];
         }
     }
     return $labels;
 }
Example #2
0
function mtphr_dnt_edit_screen_filters()
{
    global $typenow;
    if ($typenow == 'ditty_news_ticker') {
        $dnt_type = isset($_GET['dnt_type']) ? $_GET['dnt_type'] : '';
        $dnt_mode = isset($_GET['dnt_mode']) ? $_GET['dnt_mode'] : '';
        $types = mtphr_dnt_types_array();
        $modes = mtphr_dnt_modes_array();
        echo '<select name="dnt_type">';
        echo '<option value="">' . __('Show all Types', 'ditty-news-ticker') . '</option>';
        if (is_array($types) && count($types) > 0) {
            foreach ($types as $i => $type) {
                echo '<option value="' . $i . '" ' . selected($i, $dnt_type, false) . '>' . $type['button'] . '</option>';
            }
        }
        echo '</select>';
        echo '<select name="dnt_mode">';
        echo '<option value="">' . __('Show all Modes', 'ditty-news-ticker') . '</option>';
        if (is_array($modes) && count($modes) > 0) {
            foreach ($modes as $i => $mode) {
                echo '<option value="' . $i . '" ' . selected($i, $dnt_mode, false) . '>' . $mode['button'] . '</option>';
            }
        }
        echo '</select>';
    }
}
Example #3
0
 function mtphr_dnt_mixed_ticks($id, $meta_data)
 {
     global $mtphr_dnt_ticker_types;
     // Get all active ticker types
     $types = mtphr_dnt_types_array();
     // Create a cache of the ticks
     $ticks_cache = array();
     // Create an empty array to save ticks
     $dnt_ticks = array();
     // Get the ticks
     if (isset($meta_data['_mtphr_dnt_mixed_ticks']) && is_array($meta_data['_mtphr_dnt_mixed_ticks']) && count($meta_data['_mtphr_dnt_mixed_ticks']) > 0) {
         foreach ($meta_data['_mtphr_dnt_mixed_ticks'] as $i => $tick) {
             // Make sure the tick type exists
             if (array_key_exists($tick['type'], $types) && !array_key_exists($tick['type'], $ticks_cache)) {
                 // Add to the global tick types
                 $mtphr_dnt_ticker_types[$tick['type']] = $tick['type'];
                 // Cache the appropriate ticks
                 $meta_data['_mtphr_dnt_type'] = $tick['type'];
                 $ticks_cache[$tick['type']] = apply_filters('mtphr_dnt_tick_array', array(), $id, $meta_data);
             }
             // Add all ticks of the selected type to the array
             if (isset($tick['all']) && $tick['all'] == 'on' && isset($ticks_cache[$tick['type']])) {
                 if (is_array($ticks_cache[$tick['type']]) && count($ticks_cache[$tick['type']]) > 0) {
                     foreach ($ticks_cache[$tick['type']] as $i => $all_tick) {
                         $dnt_ticks[] = array('type' => $tick['type'], 'tick' => $all_tick);
                     }
                 }
                 // Or, add just the select offset to the array
             } elseif (isset($ticks_cache[$tick['type']][intval($tick['offset'])])) {
                 $dnt_ticks[] = array('type' => $tick['type'], 'tick' => $ticks_cache[$tick['type']][intval($tick['offset'])]);
             }
         }
     }
     // Return the new ticks
     return $dnt_ticks;
 }
Example #4
0
 function mtphr_dnt_option_buttons()
 {
     global $post, $typenow;
     if ($typenow == 'ditty_news_ticker') {
         $tab = get_post_meta($post->ID, '_mtphr_dnt_admin_tab', true);
         $tab = $tab != '' ? $tab : '#mtphr-dnt-type-select';
         $types = mtphr_dnt_types_array();
         $type = get_post_meta($post->ID, '_mtphr_dnt_type', true);
         $type = $type != '' ? $type : 'default';
         $modes = mtphr_dnt_modes_array();
         $mode = get_post_meta($post->ID, '_mtphr_dnt_mode', true);
         $mode = $mode != '' ? $mode : 'scroll';
         echo '<div id="mtphr-dnt-settings-select">';
         echo '<input type="hidden" name="mtphr_dnt_nonce" value="' . wp_create_nonce(basename(__FILE__)) . '" />';
         echo '<input type="hidden" name="_mtphr_dnt_admin_tab" value="' . $tab . '" />';
         echo '<input type="hidden" name="_mtphr_dnt_admin_javascript" value="error" />';
         echo '<div id="mtphr-dnt-metabox-group-toggles" class="mtphr-dnt-clearfix">';
         $active = $tab == '#mtphr-dnt-type-select' ? ' active' : '';
         echo '<a class="mtphr-dnt-metabox-group-toggle' . $active . '" href="#mtphr-dnt-type-select"><i class="mtphr-dnt-icon-dittynewsticker"></i> ' . __('<span>Ticker </span>Type', 'ditty-news-ticker') . '</a>';
         $active = $tab == '#mtphr-dnt-mode-select' ? ' active' : '';
         echo '<a class="mtphr-dnt-metabox-group-toggle' . $active . '" href="#mtphr-dnt-mode-select"><i class="mtphr-dnt-icon-dittynewsticker"></i> ' . __('<span>Ticker </span>Mode', 'ditty-news-ticker') . '</a>';
         $active = $tab == '#mtphr-dnt-global-select' ? ' active' : '';
         echo '<a class="mtphr-dnt-metabox-group-toggle' . $active . '" href="#mtphr-dnt-global-select"><i class="mtphr-dnt-icon-dittynewsticker"></i> ' . __('<span>Global </span>Settings', 'ditty-news-ticker') . '</a>';
         echo '<button name="save" type="submit" class="button button-primary button-large" id="mtphr-dnt-publish"><i class="dashicons dashicons-yes"></i><span> ' . __('Update', 'ditty-news-ticker') . '</span></button>';
         echo '</div>';
         /* --------------------------------------------------------- */
         /* !Ticker Type - 2.0.2 */
         /* --------------------------------------------------------- */
         $active = $tab == '#mtphr-dnt-type-select' ? ' active' : '';
         echo '<div id="mtphr-dnt-type-select" class="mtphr-dnt-metabox-group' . $active . '">';
         echo '<div>';
         echo '<div class="mtphr-dnt-metabox-toggle">';
         echo '<input type="hidden" name="_mtphr_dnt_type" value="' . $type . '" />';
         foreach ($types as $i => $t) {
             $value = '';
             $button = $t['button'];
             $metabox_id = isset($t['metabox_id']) ? $t['metabox_id'] : '';
             if (is_array($metabox_id)) {
                 $metabox_id = trim(implode(' ', $t['metabox_id']));
             }
             // Create a button
             $selected = $type == $i ? ' button-primary' : '';
             $icon = isset($t['icon']) ? '<i class="' . $t['icon'] . '"></i> ' : '';
             echo '<a href="#' . $i . '" metabox="' . $metabox_id . '" class="mtphr-dnt-type-toggle mtphr-dnt-button button' . $selected . '">' . $icon . $button . '</a>&nbsp;';
         }
         echo '<a href="http://www.dittynewsticker.com/" target="_blank" class="mtphr-dnt-button button mtphr-dnt-get-more"><i class="fontastic mtphr-dnt-icon-download"></i> ' . __('More Extensions', 'ditty-news-ticker') . '</a>';
         echo '</div>';
         echo '</div>';
         echo '<div id="mtphr-dnt-type-metaboxes">';
         do_action('mtphr_dnt_type_metaboxes');
         echo '</div>';
         echo '</div>';
         /* --------------------------------------------------------- */
         /* !Ticker Mode - 2.0.2 */
         /* --------------------------------------------------------- */
         $active = $tab == '#mtphr-dnt-mode-select' ? ' active' : '';
         echo '<div id="mtphr-dnt-mode-select" class="mtphr-dnt-metabox-group' . $active . '">';
         echo '<div class="wrapper">';
         echo '<div class="mtphr-dnt-metabox-toggle">';
         echo '<input type="hidden" name="_mtphr_dnt_mode" value="' . $mode . '" />';
         foreach ($modes as $i => $m) {
             $value = '';
             $button = $m['button'];
             $metabox_id = isset($m['metabox_id']) ? $m['metabox_id'] : '';
             if (is_array($metabox_id)) {
                 $metabox_id = trim(implode(' ', $m['metabox_id']));
             }
             // Create a button
             $selected = $mode == $i ? ' button-primary' : '';
             $icon = isset($m['icon']) ? '<i class="' . $m['icon'] . '"></i> ' : '';
             echo '<a href="#' . $i . '" metabox="' . $metabox_id . '" class="mtphr-dnt-mode-toggle mtphr-dnt-button button' . $selected . '">' . $icon . $button . '</a>&nbsp;';
         }
         echo '<a href="http://www.dittynewsticker.com/" target="_blank" class="mtphr-dnt-button button mtphr-dnt-get-more"><i class="fontastic mtphr-dnt-icon-download"></i> ' . __('More Extensions', 'ditty-news-ticker') . '</a>';
         echo '</div>';
         echo '</div>';
         echo '<div id="mtphr-dnt-mode-metaboxes">';
         do_action('mtphr_dnt_mode_metaboxes');
         echo '</div>';
         echo '</div>';
         /* --------------------------------------------------------- */
         /* !Global Settings - 2.0.0 */
         /* --------------------------------------------------------- */
         $active = $tab == '#mtphr-dnt-global-select' ? ' active' : '';
         echo '<div id="mtphr-dnt-global-select" class="mtphr-dnt-metabox-group' . $active . '">';
         echo '<div id="mtphr-dnt-global-metaboxes">';
         do_action('mtphr_dnt_global_metaboxes');
         echo '</div>';
         echo '</div>';
         echo '</div>';
     }
 }
Example #5
0
 function mtphr_dnt_mixed_render_metabox()
 {
     global $post;
     $ticks = get_post_meta($post->ID, '_mtphr_dnt_mixed_ticks', true);
     $types = mtphr_dnt_types_array();
     unset($types['mixed']);
     echo '<input type="hidden" name="mtphr_dnt_nonce" value="' . wp_create_nonce(basename(__FILE__)) . '" />';
     echo '<table class="mtphr-dnt-table">';
     echo '<tr>';
     echo '<td class="mtphr-dnt-label">';
     echo '<label>' . __('Tick selection', 'ditty-news-ticker') . '</label>';
     echo '<small>' . __('Select the ticks you would like to display by choosing the tick type and the offset position of the selected feed', 'ditty-news-ticker') . '</small>';
     echo '</td>';
     echo '<td>';
     echo '<table class="mtphr-dnt-list mtphr-dnt-mixed-list mtphr-dnt-advanced-list" style="width:auto;">';
     if (is_array($ticks) && count($ticks) > 0) {
         foreach ($ticks as $i => $tick) {
             mtphr_dnt_render_mixed_tick($types, $tick, $i);
         }
     } else {
         mtphr_dnt_render_mixed_tick($types);
     }
     echo '</table>';
     echo '</td>';
     echo '</tr>';
     echo '</table>';
 }