Example #1
0
 public static function expand($atts = null, $content = null)
 {
     $atts = shortcode_atts(array('more_text' => __('Show more', 'su'), 'less_text' => __('Show less', 'su'), 'height' => '100', 'hide_less' => 'no', 'text_color' => '#333333', 'link_color' => '#0088FF', 'link_style' => 'default', 'link_align' => 'left', 'more_icon' => '', 'less_icon' => '', 'class' => ''), $atts, 'expand');
     // Prepare more icon
     $more_icon = $atts['more_icon'] ? Su_Tools::icon($atts['more_icon']) : '';
     $less_icon = $atts['less_icon'] ? Su_Tools::icon($atts['less_icon']) : '';
     if ($more_icon || $less_icon) {
         su_query_asset('css', 'font-awesome');
     }
     // Prepare less link
     $less = $atts['hide_less'] !== 'yes' ? '<div class="su-expand-link su-expand-link-less" style="text-align:' . $atts['link_align'] . '"><a href="javascript:;" style="color:' . $atts['link_color'] . ';border-color:' . $atts['link_color'] . '">' . $less_icon . '<span style="border-color:' . $atts['link_color'] . '">' . $atts['less_text'] . '</span></a></div>' : '';
     su_query_asset('css', 'su-box-shortcodes');
     su_query_asset('js', 'su-other-shortcodes');
     return '<div class="su-expand su-expand-collapsed su-expand-link-style-' . $atts['link_style'] . su_ecssc($atts) . '" data-height="' . $atts['height'] . '"><div class="su-expand-content" style="color:' . $atts['text_color'] . ';max-height:' . intval($atts['height']) . 'px;overflow:hidden">' . do_shortcode($content) . '</div><div class="su-expand-link su-expand-link-more" style="text-align:' . $atts['link_align'] . '"><a href="javascript:;" style="color:' . $atts['link_color'] . ';border-color:' . $atts['link_color'] . '">' . $more_icon . '<span style="border-color:' . $atts['link_color'] . '">' . $atts['more_text'] . '</span></a></div>' . $less . '</div>';
 }
Example #2
0
 public static function cheatsheet($field, $config)
 {
     // Prepare print button
     $print = '<div><a href="javascript:;" id="su-cheatsheet-print" class="su-cheatsheet-switch button button-primary button-large">' . __('Printable version', 'shortcodes-ultimate') . '</a><div id="su-cheatsheet-print-head"><h1>' . __('Shortcodes Ultimate', 'shortcodes-ultimate') . ': ' . __('Cheatsheet', 'shortcodes-ultimate') . '</h1><a href="javascript:;" class="su-cheatsheet-switch">&larr; ' . __('Back to Dashboard', 'shortcodes-ultimate') . '</a></div></div>';
     // Prepare table array
     $table = array();
     // Table start
     $table[] = '<table><tr><th style="width:20%;">' . __('Shortcode', 'shortcodes-ultimate') . '</th><th style="width:50%">' . __('Attributes', 'shortcodes-ultimate') . '</th><th style="width:30%">' . __('Example code', 'shortcodes-ultimate') . '</th></tr>';
     // Loop through shortcodes
     foreach ((array) Su_Data::shortcodes() as $name => $shortcode) {
         // Prepare vars
         $icon = isset($shortcode['icon']) ? $shortcode['icon'] : 'puzzle-piece';
         $shortcode['name'] = isset($shortcode['name']) ? $shortcode['name'] : $name;
         $attributes = array();
         $example = array();
         $icons = 'icon: music, icon: envelope &hellip; <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">' . __('full list', 'shortcodes-ultimate') . '</a>';
         // Loop through attributes
         if (is_array($shortcode['atts'])) {
             foreach ($shortcode['atts'] as $id => $data) {
                 // Prepare default value
                 $default = isset($data['default']) && $data['default'] !== '' ? '<p><em>' . __('Default value', 'shortcodes-ultimate') . ':</em> ' . $data['default'] . '</p>' : '';
                 // Check type is set
                 if (empty($data['type'])) {
                     $data['type'] = 'text';
                 }
                 // Switch attribute types
                 switch ($data['type']) {
                     // Select
                     case 'select':
                         $value = implode(', ', array_keys($data['values']));
                         break;
                         // Slider and number
                     // Slider and number
                     case 'slider':
                     case 'number':
                         $value = $data['min'] . '&hellip;' . $data['max'];
                         break;
                         // Bool
                     // Bool
                     case 'bool':
                         $value = 'yes | no';
                         break;
                         // Icon
                     // Icon
                     case 'icon':
                         $value = $icons;
                         break;
                         // Color
                     // Color
                     case 'color':
                         $value = __('#RGB and rgba() colors');
                         break;
                         // Default value
                     // Default value
                     default:
                         $value = $data['default'];
                         break;
                 }
                 // Check empty value
                 if ($value === '') {
                     $value = __('Any text value', 'shortcodes-ultimate');
                 }
                 // Extra CSS class
                 if ($id === 'class') {
                     $value = __('Any custom CSS classes', 'shortcodes-ultimate');
                 }
                 // Add attribute
                 $attributes[] = '<div class="su-shortcode-attribute"><strong>' . $data['name'] . ' <em>&ndash; ' . $id . '</em></strong><p><em>' . __('Possible values', 'shortcodes-ultimate') . ':</em> ' . $value . '</p>' . $default . '</div>';
                 // Add attribute to the example code
                 $example[] = $id . '="' . $data['default'] . '"';
             }
         }
         // Prepare example code
         $example = '[%prefix_' . $name . ' ' . implode(' ', $example) . ']';
         // Prepare content value
         if (empty($shortcode['content'])) {
             $shortcode['content'] = '';
         }
         // Add wrapping code
         if ($shortcode['type'] === 'wrap') {
             $example .= esc_textarea($shortcode['content']) . '[/%prefix_' . $name . ']';
         }
         // Change compatibility prefix
         $example = str_replace(array('%prefix_', '__'), su_cmpt(), $example);
         // Shortcode
         $table[] = '<td>' . '<span class="su-shortcode-icon">' . Su_Tools::icon($icon) . '</span>' . $shortcode['name'] . '<br/><em class="su-shortcode-desc">' . $shortcode['desc'] . '</em></td>';
         // Attributes
         $table[] = '<td>' . implode('', $attributes) . '</td>';
         // Example code
         $table[] = '<td><code contenteditable="true">' . $example . '</code></td></tr>';
     }
     // Table end
     $table[] = '</table>';
     // Query assets
     su_query_asset('css', array('font-awesome', 'su-cheatsheet'));
     su_query_asset('js', array('jquery', 'su-options-page'));
     // Return output
     return '<div id="su-cheatsheet-screen">' . $print . implode('', $table) . '</div>';
 }
Example #3
0
    /**
     * Generator popup form
     */
    public static function popup()
    {
        // Get cache
        $output = get_transient('su/generator/popup');
        if ($output && SU_ENABLE_CACHE) {
            echo $output;
        } else {
            ob_start();
            $tools = apply_filters('su/generator/tools', array('<a href="' . admin_url('admin.php?page=shortcodes-ultimate') . '#tab-1" target="_blank" title="' . __('Settings', 'su') . '">' . __('Plugin settings', 'su') . '</a>', '<a href="http://gndev.info/shortcodes-ultimate/" target="_blank" title="' . __('Plugin homepage', 'su') . '">' . __('Plugin homepage', 'su') . '</a>', '<a href="http://wordpress.org/support/plugin/shortcodes-ultimate/" target="_blank" title="' . __('Support forums', 'su') . '">' . __('Support forums', 'su') . '</a>'));
            // Add add-ons links
            if (!defined('SUE_PLUGIN_FILE') || !defined('SUS_PLUGIN_FILE') || !defined('SUM_PLUGIN_FILE')) {
                $tools[] = '<a href="' . admin_url('admin.php?page=shortcodes-ultimate-addons') . '" target="_blank" title="' . __('Add-ons', 'su') . '" class="su-add-ons">' . __('Add-ons', 'su') . '</a>';
            }
            ?>
		<div id="su-generator-wrap" style="display:none">
			<div id="su-generator">
				<div id="su-generator-header">
					<div id="su-generator-tools"><?php 
            echo implode(' <span></span> ', $tools);
            ?>
</div>
					<input type="text" name="su_generator_search" id="su-generator-search" value="" placeholder="<?php 
            _e('Search for shortcodes', 'su');
            ?>
" />
					<div id="su-generator-filter">
						<strong><?php 
            _e('Filter by type', 'su');
            ?>
</strong>
						<?php 
            foreach ((array) Su_Data::groups() as $group => $label) {
                echo '<a href="#" data-filter="' . $group . '">' . $label . '</a>';
            }
            ?>
					</div>
					<div id="su-generator-choices" class="su-generator-clearfix">
						<?php 
            // Choices loop
            foreach ((array) Su_Data::shortcodes() as $name => $shortcode) {
                $icon = isset($shortcode['icon']) ? $shortcode['icon'] : 'puzzle-piece';
                $shortcode['name'] = isset($shortcode['name']) ? $shortcode['name'] : $name;
                echo '<span data-name="' . $shortcode['name'] . '" data-shortcode="' . $name . '" title="' . esc_attr($shortcode['desc']) . '" data-desc="' . esc_attr($shortcode['desc']) . '" data-group="' . $shortcode['group'] . '">' . Su_Tools::icon($icon) . $shortcode['name'] . '</span>' . "\n";
            }
            ?>
					</div>
				</div>
				<div id="su-generator-settings"></div>
				<input type="hidden" name="su-generator-selected" id="su-generator-selected" value="<?php 
            echo plugins_url('', SU_PLUGIN_FILE);
            ?>
" />
				<input type="hidden" name="su-generator-url" id="su-generator-url" value="<?php 
            echo plugins_url('', SU_PLUGIN_FILE);
            ?>
" />
				<input type="hidden" name="su-compatibility-mode-prefix" id="su-compatibility-mode-prefix" value="<?php 
            echo su_compatibility_mode_prefix();
            ?>
" />
				<div id="su-generator-result" style="display:none"></div>
			</div>
		</div>
	<?php 
            $output = ob_get_contents();
            set_transient('su/generator/popup', $output, 2 * DAY_IN_SECONDS);
            ob_end_clean();
            echo $output;
        }
    }
Example #4
0
    /**
     * Generator popup form
     */
    public static function popup()
    {
        // Get cache
        $output = get_transient('su/generator/popup');
        if ($output && SU_ENABLE_CACHE) {
            echo $output;
        } else {
            ob_start();
            ?>
		<div id="su-generator-wrap" style="display:none">
			<div id="su-generator">
				<div id="su-generator-header">
					<div id="su-generator-choices" class="su-generator-clearfix">
						<?php 
            // Choices loop
            foreach ((array) Su_Data::shortcodes() as $name => $shortcode) {
                $icon = isset($shortcode['icon']) ? $shortcode['icon'] : 'puzzle-piece';
                $shortcode['name'] = isset($shortcode['name']) ? $shortcode['name'] : $name;
                echo '<span data-name="' . $shortcode['name'] . '" data-shortcode="' . $name . '" title="' . esc_attr($shortcode['desc']) . '" data-desc="' . esc_attr($shortcode['desc']) . '" data-group="' . $shortcode['group'] . '">' . Su_Tools::icon($icon) . $shortcode['name'] . '</span>' . "\n";
            }
            ?>
					</div>
				</div>
				<div id="su-generator-settings"></div>
				<input type="hidden" name="su-generator-selected" id="su-generator-selected" value="<?php 
            echo get_template_directory_uri() . '/functions/sc_generator/';
            ?>
" />
				<input type="hidden" name="su-generator-url" id="su-generator-url" value="<?php 
            echo get_template_directory_uri() . '/functions/sc_generator/';
            ?>
" />
				<input type="hidden" name="su-compatibility-mode-prefix" id="su-compatibility-mode-prefix" value="<?php 
            echo su_compatibility_mode_prefix();
            ?>
" />
				<div id="su-generator-result" style="display:none"></div>
			</div>
		</div>
	<?php 
            $output = ob_get_contents();
            set_transient('su/generator/popup', $output, 2 * DAY_IN_SECONDS);
            ob_end_clean();
            echo $output;
        }
    }
Example #5
0
                <?php 
foreach ((array) Su_Data::groups() as $group => $label) {
    echo '<a href="#" data-filter="' . $group . '">' . $label . '</a>';
}
?>
            </div>
            <div id="su-generator-choices" class="su-generator-clearfix">
                <?php 
// Choices loop
foreach ((array) Su_Data::shortcodes() as $name => $shortcode) {
    $icon = isset($shortcode['icon']) ? $shortcode['icon'] : 'puzzle-piece';
    $badge = isset($shortcode['badge']) ? '<strong class="sug-badge badge-' . strtolower($shortcode['badge']) . '">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODE_' . $shortcode['badge']) . '</strong>' : '';
    $shortcode['name'] = isset($shortcode['name']) ? $shortcode['name'] : $name;
    $visible = isset($shortcode['visible']) ? $shortcode['visible'] : true;
    if ($visible == true) {
        echo '<span data-name="' . $shortcode['name'] . '" data-shortcode="' . $name . '" title="' . $shortcode['desc'] . '" data-desc="' . $shortcode['desc'] . '" data-group="' . $shortcode['group'] . '">' . Su_Tools::icon($icon) . $shortcode['name'] . $badge . '</span>' . "\n";
    }
}
?>
            </div>
        </div>
        <input type="hidden" name="su-generator-selected" id="su-generator-selected" value="" />
        <input type="hidden" name="su-generator-url" id="su-generator-url" value="" />
        <input type="hidden" name="su-compatibility-mode-prefix" id="su-compatibility-mode-prefix" value="<?php 
echo su_compatibility_mode_prefix();
?>
" />
        <div id="su-generator-settings"></div>
        <div id="su-generator-result" style="display:none"></div>
    </div>
</div>