Exemplo n.º 1
0
function synved_social_init()
{
    if (current_user_can('edit_posts') || current_user_can('edit_pages')) {
        if (get_user_option('rich_editing') == 'true') {
            //add_filter('mce_external_plugins', 'synved_social_wp_tinymce_plugin');
            //add_filter('mce_buttons', 'synved_social_wp_tinymce_button');
        }
    }
    $priority = defined('SHORTCODE_PRIORITY') ? SHORTCODE_PRIORITY : 11;
    if (synved_option_get('synved_social', 'shortcode_widgets')) {
        remove_filter('widget_text', 'do_shortcode', $priority);
        add_filter('widget_text', 'do_shortcode', $priority);
    }
    if (function_exists('synved_shortcode_add')) {
        synved_shortcode_add('feather_share', 'synved_social_share_shortcode');
        synved_shortcode_add('feather_follow', 'synved_social_follow_shortcode');
        $size_set = '16,24,32,48,64,96';
        $size_item = synved_option_item('synved_social', 'icon_size');
        if ($size_item != null) {
            $item_set = synved_option_item_set($size_item);
            if ($item_set != null) {
                $set_items = array();
                foreach ($item_set as $set_item) {
                    $item_keys = array_keys($set_item);
                    $set_items[] = $item_keys[0];
                }
                $size_set = implode(',', $set_items);
            }
        }
        $providers_share = array_keys(synved_social_service_provider_list('share'));
        $providers_follow = array_keys(synved_social_service_provider_list('follow'));
        $providers_params = array('show' => __('Specify a comma-separated list of %1$s providers to show and their order, possible values are %2$s', 'social-media-feather'), 'hide' => __('Specify a comma-separated list of %1$s providers to hide, possible values are %2$s', 'social-media-feather'));
        $common_params = array('skin' => __('Specify which skin to use for the icons', 'social-media-feather'), 'size' => sprintf(__('Specify the size for the icons, possible values are %s', 'social-media-feather'), $size_set), 'spacing' => __('Determines how much blank space there will be between the buttons, in pixels', 'social-media-feather'), 'container' => __('Determines whether to wrap the buttons in a container', 'social-media-feather'), 'container_type' => sprintf(__('Determines what type of container to use, possible values are %1$s', 'social-media-feather'), 'basic, block'), 'class' => __('Select additional CSS classes for the buttons, separated by spaces', 'social-media-feather'));
        $share_params = array('url' => __('URL to use for the sharing buttons, default is the current post URL', 'social-media-feather'), 'title' => __('Title to use for the sharing buttons, default is the current post title', 'social-media-feather'));
        $follow_params = array();
        $share_params = array_merge($common_params, $share_params);
        $follow_params = array_merge($common_params, $follow_params);
        foreach ($providers_params as $param_name => $param_value) {
            $share_params[$param_name] = sprintf($param_value, 'share', implode(', ', $providers_share));
            $follow_params[$param_name] = sprintf($param_value, 'follow', implode(', ', $providers_follow));
        }
        synved_shortcode_item_help_set('feather_share', array('tip' => __('Creates a list of buttons for social sharing as selected in the Social Media options', 'social-media-feather'), 'parameters' => $share_params));
        synved_shortcode_item_help_set('feather_follow', array('tip' => __('Creates a list of buttons for social following as selected in the Social Media options', 'social-media-feather'), 'parameters' => $follow_params));
    } else {
        add_shortcode('feather_share', 'synved_social_share_shortcode');
        add_shortcode('synved_feather_share', 'synved_social_share_shortcode');
        add_shortcode('feather_follow', 'synved_social_follow_shortcode');
        add_shortcode('synved_feather_follow', 'synved_social_follow_shortcode');
    }
    //add_action('wp_ajax_synved_social', 'synved_social_ajax_callback');
    //add_action('wp_ajax_nopriv_synved_social', 'synved_social_ajax_callback');
    if (!is_admin()) {
        add_action('wp_enqueue_scripts', 'synved_social_enqueue_scripts');
        add_action('wp_head', 'synved_social_print_styles');
    }
    if (synved_option_get('synved_social', 'automatic_share') || synved_option_get('synved_social', 'automatic_follow')) {
        add_filter('the_content', 'synved_social_wp_the_content', 10, 2);
    }
}
Exemplo n.º 2
0
function synved_shortcode_register_list()
{
    synved_shortcode_add('tabs', 'synved_shortcode_do_tabs');
    synved_shortcode_add('tab', 'synved_shortcode_do_tab', true);
    synved_shortcode_item_default_set('tabs', '[%%_synved_name%%]
[%%_synved_name_tab%% title="Tab 1"]
Tab Content 1.
[/%%_synved_name_tab%%]
[%%_synved_name_tab%% title="Tab 2"]
Tab Content 2.
[/%%_synved_name_tab%%]
[/%%_synved_name%%]');
    synved_shortcode_item_help_set('tabs', array('tip' => __('Creates a list of SEO-friendly tabs that work with or without JavaScript', 'synved-shortcode'), 'parameters' => array('class' => __('Only for [tabs] element, specify a custom CSS class for the main tabs container', 'synved-shortcode'), 'imitate' => __('Only for [tabs] element, imitate usual tab behaviour when JavaScript is disabled, i.e. hiding inactive tabs and creating actual links that will open those tabs by reloading the page, use imitate="yes" (Note: if set to "yes" this could damage SEO for the page)', 'synved-shortcode'), 'title' => __('Only for [tab] element, specify the title of the tab', 'synved-shortcode'), 'tip' => __('Only for [tab] element, specify a tooltip to show when hovering the tab with the mouse', 'synved-shortcode'), 'active' => __('Only for [tab] element, specify whether the tab is the active tab, use active="yes"', 'synved-shortcode'))));
    synved_shortcode_add('sections', 'synved_shortcode_do_sections');
    synved_shortcode_add('section', 'synved_shortcode_do_section', true);
    synved_shortcode_item_default_set('sections', '[%%_synved_name%%]
[%%_synved_name_section%% title="Section 1"]
<p style="margin:5px 0;padding:0;">
Section Content 1.
</p>
[/%%_synved_name_section%%]
[%%_synved_name_section%% title="Section 2"]
<p style="margin:5px 0;padding:0;">
Section Content 2.
</p>
[/%%_synved_name_section%%]
[/%%_synved_name%%]');
    synved_shortcode_item_help_set('sections', array('tip' => __('Creates a list of exclusive sections, also called accordions', 'synved-shortcode'), 'parameters' => array('class' => __('Only for [sections] element, specify a custom CSS class for the main sections container', 'synved-shortcode'), 'height' => __('Only for [sections] element, determines how height is calculated, possible values are "auto" to pick tallest panel or "fill" to fill the paren\'t container. By default each section will be as tall as required.', 'synved-shortcode'), 'collapse' => __('Only for [sections] element, determines if all sections can be collapsed at the same time, possible values are "allow" or "always" where "always" will collapse them all by default', 'synved-shortcode'), 'title' => __('Only for [section] element, specify the title of the section', 'synved-shortcode'), 'tip' => __('Only for [section] element, specify a tooltip to show when hovering the section with the mouse', 'synved-shortcode'))));
    synved_shortcode_add('button', 'synved_shortcode_do_button');
    synved_shortcode_item_default_set('button', '[%%_synved_name%% icon=heart]My Button[/%%_synved_name%%]');
    synved_shortcode_item_help_set('button', array('tip' => __('Creates a nice-looking button', 'synved-shortcode'), 'parameters' => array('type' => __('Specify a custom type of default button, possible values are download,purchase', 'synved-shortcode'), 'link' => __('Specify a link to open when clicking on the button with the mouse', 'synved-shortcode'), 'icon' => __('Specify an icon to display on the left of the button, check the <a target="_blank" href="http://synved.com/blog/help/tutorial/wordpress-shortcodes-icons/">list of icons</a>', 'synved-shortcode'), 'icon2' => __('Specify an icon to display on the right of the button, check the <a target="_blank" href="http://synved.com/blog/help/tutorial/wordpress-shortcodes-icons/">list of icons</a>', 'synved-shortcode'), 'tag' => __('Specify a tag to display on the top-right corner of the button', 'synved-shortcode'), 'tip' => __('Specify a tooltip to show when hovering the button with the mouse', 'synved-shortcode'))));
    synved_shortcode_add('list', 'synved_shortcode_do_list');
    synved_shortcode_add('item', 'synved_shortcode_do_item', true);
    synved_shortcode_item_default_set('list', '[%%_synved_name%% type=roman]
[%%_synved_name_item%%]Item 1[/%%_synved_name_item%%]
[%%_synved_name_item%%]Item 2[/%%_synved_name_item%%]
[%%_synved_name_item%%]Item 3[/%%_synved_name_item%%]
[/%%_synved_name%%]');
    synved_shortcode_item_help_set('list', array('tip' => __('Creates a list of items in a layout', 'synved-shortcode'), 'parameters' => array('type' => __('Only for [list] element, specify a custom type, possible values are decimal,alpha,roman,latin,upper-alpha,lower-roman,upper-latin', 'synved-shortcode'), 'class' => __('Only for [list] element, specify a custom CSS class for the main list container', 'synved-shortcode'), 'icon' => __('Specify the default icon for [list], which overwrites <b>type</b>, or the individual icon for each [item], check the <a target="_blank" href="http://synved.com/blog/help/tutorial/wordpress-shortcodes-icons/">list of icons</a>', 'synved-shortcode'), 'tip' => __('Only for [item] element, specify a tooltip to show when hovering the item with the mouse', 'synved-shortcode'))));
    synved_shortcode_column_register('full');
    synved_shortcode_column_register('three_quarters');
    synved_shortcode_column_register('two_thirds');
    synved_shortcode_column_register('half');
    synved_shortcode_column_register('third');
    synved_shortcode_column_register('quarter');
    synved_shortcode_column_register('fifth');
    synved_shortcode_box_register('success');
    synved_shortcode_box_register('info');
    synved_shortcode_box_register('warning');
    synved_shortcode_box_register('error');
    synved_shortcode_box_register('plain');
    synved_shortcode_link_register('post');
    synved_shortcode_link_register('page');
    synved_shortcode_link_register('media');
    synved_shortcode_link_register('category');
    synved_shortcode_link_register('tag');
    synved_shortcode_link_register('term');
    synved_shortcode_link_register('user');
    synved_shortcode_link_register('common');
    synved_shortcode_add('hide', 'synved_shortcode_do_hide');
    synved_shortcode_item_help_set('hide', array('tip' => __('Creates a block of hidden content. The content will never be presented onto the page. Useful for comments and notes.', 'synved-shortcode'), 'parameters' => array()));
    synved_shortcode_add('condition', 'synved_shortcode_do_condition');
    synved_shortcode_item_default_set('condition', '[%%_synved_name%% check="is_user_logged_in"]Test Content.[/%%_synved_name%%]');
    synved_shortcode_item_help_set('condition', array('tip' => __('Creates a condition block which will only add its contents to the page if the condition is true.', 'synved-shortcode'), 'parameters' => array('check' => __('Determines the condition to check for. Possible values are is_user_logged_in, is_user_admin, is_user_editor, is_user_author, user_can, is_post_protected, is_post_sticky, is_tag, is_category, post_has_featured_image, post_has_tag, post_has_category, post_meta_is, post_format_is, post_info_is, user_meta_is, user_option_is, match_query/request/post/cookie', 'synved-shortcode'), 'param_1' => __('When the check is "user_can" param_1 specifies the user capability, when the check is "post_meta_is", "post_info_is", "user_meta_is" or "user_option_is" it specifies the property name, when "match_query/request/post/cookie" it contains the argument name.', 'synved-shortcode'), 'param_2' => __('When the check is "post_meta_is", "post_info_is", "user_meta_is" or "user_option_is" param_1 specifies the property value (if any), when "match_query/request/post/cookie" it contains the argument value.', 'synved-shortcode'))));
}