Esempio n. 1
0
function synved_option_print_head_outputs()
{
    global $synved_option_list;
    foreach ($synved_option_list as $id => $list) {
        $items = synved_option_item_list($id);
        $outputs = $list['outputs'];
        foreach ($outputs as $name => $item) {
            $type = synved_option_item_type($item);
            $mode = synved_option_item_mode($item);
            if (in_array('manual', $mode)) {
                continue;
            }
            $content = synved_option_get($id, $name);
            $tag = null;
            $attrs = null;
            if ($type == 'style') {
                $tag = $type;
                $attrs['type'] = 'text/css';
            } else {
                if ($type == 'script') {
                    $tag = $type;
                    $attrs['type'] = 'text/javascript';
                    $content = '/* <![CDATA[ */' . "\r\n" . $content . "\r\n" . '/* ]]> */';
                }
            }
            if ($tag != null) {
                echo "\r\n" . '<' . $tag;
                foreach ($attrs as $attr_name => $attr_value) {
                    echo ' ' . $attr_name . '="' . esc_attr($attr_value) . '"';
                }
                echo '>';
                echo $content;
                echo '</' . $tag . '>' . "\r\n";
            }
        }
    }
}
Esempio n. 2
0
function synved_social_button_list_markup($context, $vars = null, $buttons = null, $params = null)
{
    $buttons_default = synved_social_service_provider_list($context);
    if ($buttons == null) {
        $buttons = $buttons_default;
    } else {
        $keys = array_keys($buttons);
        foreach ($keys as $key) {
            if ($buttons[$key] == null && isset($buttons_default[$key])) {
                $buttons[$key] = $buttons_default[$key];
            }
        }
    }
    $id = get_the_ID();
    if ($id == null) {
        global $post;
        if ($post != null) {
            $id = $post->ID;
        }
    }
    if (!isset($vars['url']) || !isset($vars['short_url'])) {
        $full_url = synved_option_get('synved_social', 'share_full_url');
        $home_url = home_url();
        $req_uri = $_SERVER['REQUEST_URI'];
        $path = parse_url($home_url, PHP_URL_PATH);
        $path_len = strlen($path);
        if (strtolower(substr($req_uri, 0, $path_len)) == strtolower($path)) {
            $req_uri = substr($req_uri, $path_len);
        }
        $url = home_url($req_uri);
        $short_url = $url;
        if ($id != null && in_the_loop()) {
            $post_full_url = strtolower(get_post_meta($id, 'synved_social_share_full_url', true));
            if ($post_full_url != null) {
                if ($post_full_url == 'yes') {
                    $full_url = true;
                } else {
                    if ($post_full_url == 'no') {
                        $full_url = false;
                    }
                }
            }
        }
        if ($id != null && in_the_loop()) {
            $use_shortlinks = synved_option_get('synved_social', 'use_shortlinks');
            $url = get_permalink($id);
            $short_url = wp_get_shortlink($id);
            if ($short_url != null) {
                if ($use_shortlinks && function_exists('wp_get_shortlink')) {
                    $url = $short_url;
                }
            } else {
                $short_url = $url;
            }
        } else {
            if (is_front_page()) {
                $url = $home_url;
            }
        }
        if (!isset($vars['url'])) {
            $vars['url'] = $url;
        }
        if (!isset($vars['short_url'])) {
            $vars['short_url'] = $short_url;
        }
    }
    if (!isset($vars['image'])) {
        $image_src = null;
        if ($id != null) {
            $image_id = get_post_thumbnail_id($id);
            if ($image_id != null) {
                $src = wp_get_attachment_image_src($image_id, 'full');
                $image_src = $src[0];
            } else {
                $post = get_post($id);
                $match = null;
                if (preg_match('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $match) > 0) {
                    $image_src = $match[1];
                }
            }
        }
        $vars['image'] = $image_src;
    }
    if (!isset($vars['title'])) {
        $title = get_the_title();
        // do this encoding to prevent non-tags things, like emoticons, from being stripped, i.e. <8
        $title = preg_replace('/\\<\\s*([^[:alpha:]\\/])/', '&lt;$1', $title);
        $vars['title'] = html_entity_decode(wp_strip_all_tags($title));
    }
    if (!isset($vars['message'])) {
        $message = synved_option_get('synved_social', 'share_message_default');
        if ($message == null) {
            $message = __('Hey check this out', 'social-media-feather');
        }
        $vars['message'] = $message;
    }
    if (!isset($vars['author_wp'])) {
        if ($id != null && in_the_loop()) {
            $author = get_the_author();
            if ($author != null) {
                $vars['author_wp'] = $author;
            }
        }
    }
    if (!isset($vars['author'])) {
        if ($id != null && in_the_loop()) {
            $author = get_the_author_meta('_synved_twitter_handle');
            if ($author == null) {
                $author = get_the_author_meta('twitter');
            }
            if ($author == null) {
                $author = get_the_author();
            }
            if ($author != null) {
                $vars['author'] = $author;
            }
        }
    }
    if (!isset($vars['date'])) {
        if ($id != null && in_the_loop()) {
            $date = get_the_date('', $id);
            if ($date != null) {
                $vars['date'] = $date;
            }
        }
    }
    if (isset($vars['url']) && !isset($vars['url_trimmed'])) {
        $url_trimmed = trim($vars['url']);
        while (substr($url_trimmed, -1) == '/') {
            $url_trimmed = substr($url_trimmed, 0, -1);
        }
        while (strtolower(substr($url_trimmed, -3)) == '%2f') {
            $url_trimmed = substr($url_trimmed, 0, -3);
        }
        $vars['url_trimmed'] = $url_trimmed;
    }
    if (isset($params['class']) && !is_array($params['class'])) {
        $class = explode(' ', $params['class']);
        $params['class'] = array_map('trim', $class);
    }
    if (isset($params['show']) && !is_array($params['show'])) {
        $show = explode(',', $params['show']);
        $params['show'] = array_map('trim', $show);
    }
    if (isset($params['hide']) && !is_array($params['hide'])) {
        $hide = explode(',', $params['hide']);
        $params['hide'] = array_map('trim', $hide);
    }
    $vars = apply_filters('synved_social_markup_variable_list', $vars, $context, $params);
    $params = apply_filters('synved_social_markup_parameter_list', $params, $context, $vars);
    if ($vars != null) {
        $vars = array_map('wp_kses_decode_entities', $vars);
        $vars = urlencode_deep($vars);
        // urlencode_deep converts space characters to + rather than %20 which messes things up
        $vars['message'] = str_ireplace('+', '%20', $vars['message']);
        $vars['title'] = str_ireplace('+', '%20', $vars['title']);
        // urlencode_deep tries to be smart and apostrophes (') to %19 not %27 and double quotes (") to their equivalent open/closed counterparts which doesn't work on most social networks sharings
        $vars['message'] = str_ireplace('%18', '%27', $vars['message']);
        $vars['title'] = str_ireplace('%18', '%27', $vars['title']);
        $vars['message'] = str_ireplace('%19', '%27', $vars['message']);
        $vars['title'] = str_ireplace('%19', '%27', $vars['title']);
        $vars['message'] = str_ireplace('%1c', '%22', $vars['message']);
        $vars['title'] = str_ireplace('%1c', '%22', $vars['title']);
        $vars['message'] = str_ireplace('%1d', '%22', $vars['message']);
        $vars['title'] = str_ireplace('%1d', '%22', $vars['title']);
    }
    $path = synved_social_path();
    $uri = synved_social_path_uri();
    $skin = synved_social_icon_skin_current();
    if (isset($params['skin'])) {
        $skin = synved_social_icon_skin_get($params['skin']);
    }
    $skin_path = isset($skin['path']) ? $skin['path'] : $path . '/image/social/regular/';
    $skin_uri = isset($skin['uri']) ? $skin['uri'] : $uri . '/image/social/regular/';
    $icon_size = synved_option_get('synved_social', 'icon_size');
    $size = 48;
    if ($icon_size != null) {
        $size = $icon_size;
    }
    if (isset($params['size'])) {
        $size = $params['size'];
        if (is_string($size)) {
            $size = strtolower($size);
            $size_parts = explode('x', $size);
            $size = (int) $size_parts[0];
        }
    }
    $icon_spacing = synved_option_get('synved_social', 'icon_spacing');
    $buttons_container = synved_option_get('synved_social', 'buttons_container');
    $buttons_container_type = synved_option_get('synved_social', 'buttons_container_type');
    $buttons_alignment = synved_option_get('synved_social', 'buttons_alignment_' . $context);
    $layout_rtl = synved_option_get('synved_social', 'layout_rtl');
    $spacing = 5;
    $container = 'none';
    $container_type = 'basic';
    $alignment = 'none';
    if ($icon_spacing != null) {
        $spacing = $icon_spacing;
    }
    if (isset($params['spacing'])) {
        $spacing = $params['spacing'];
    }
    if ($buttons_container != null) {
        $container = $buttons_container;
    }
    if ($buttons_container_type != null) {
        $container_type = $buttons_container_type;
    }
    if ($buttons_alignment != null) {
        $alignment = $buttons_alignment;
    }
    if (isset($params['alignment'])) {
        $alignment = $params['alignment'];
    }
    if ($alignment != 'none') {
        if ($container == 'none') {
            $container = $context;
        } else {
            if ($container != 'both' && $container != $context) {
                $container = 'both';
            }
        }
    }
    // Allow parameters to override container after we decide a default based on selected alignment
    if (isset($params['container'])) {
        $container = $params['container'];
    }
    if ($alignment != 'none') {
        $container_type = 'block';
    }
    // Allow parameters to override container after we decide a default based on selected alignment
    if (isset($params['container_type'])) {
        $container_type = $params['container_type'];
    }
    $class = isset($params['class']) ? $params['class'] : null;
    $show = isset($params['show']) ? $params['show'] : null;
    $hide = isset($params['hide']) ? $params['hide'] : null;
    if ($show != null) {
        $button_list = array();
        foreach ($show as $button_key) {
            if (isset($buttons[$button_key])) {
                $button_list[$button_key] = $buttons[$button_key];
                unset($buttons[$button_key]);
            }
        }
        foreach ($buttons as $button_key => $button_item) {
            $button_list[$button_key] = $button_item;
        }
        $buttons = $button_list;
    }
    if ($hide != null) {
        foreach ($hide as $button_key) {
            if (isset($buttons[$button_key])) {
                unset($buttons[$button_key]);
            }
        }
    }
    $out_list = array();
    $out_params = array();
    $image_list = array();
    $icon_resolution = synved_option_get('synved_social', 'icon_resolution');
    $resolutions = array('normal' => $size, 'hidef' => $size * 2);
    if (is_feed()) {
        $icon_resolution = 'single';
    }
    if ($icon_resolution == 'single') {
        $resolutions = array('single' => $size * 2);
    }
    foreach ($resolutions as $resolution_name => $resolution_size) {
        $image_list[$resolution_name] = synved_social_icon_skin_get_image_list($skin, array_keys($buttons), $resolution_size);
    }
    $index = 0;
    $count = count($buttons);
    foreach ($buttons as $button_key => $button_item) {
        $href = $button_item['link'];
        $title = $button_item['title'];
        $matches = null;
        if (preg_match_all('/%%(\\w+)%%/', $href, $matches, PREG_SET_ORDER) > 0) {
            foreach ($matches as $match) {
                $var_key = $match[1];
                $replace = null;
                if (isset($vars[$var_key])) {
                    $replace = $vars[$var_key];
                }
                $href = str_replace($match[0], $replace, $href);
            }
        }
        $icon_sizes = $resolutions;
        foreach ($icon_sizes as $icon_def => $icon_size) {
            $image = $image_list[$icon_def][$button_key];
            $image_size = $image[$icon_size];
            $image_sub = $image_size['sub'];
            $image_path = $image_size['path'];
            $image_uri = $image_size['uri'];
            if (!file_exists($image_path)) {
                $size_list = array_keys($image);
                $image_path = apply_filters('synved_social_button_image_path', $image_path, $image_uri, $icon_size, $image_sub, $skin_path, $skin_uri, $size_list);
                $image_uri = apply_filters('synved_social_button_image_uri', $image_uri, $image_path, $icon_size, $image_sub, $skin_path, $skin_uri, $size_list);
            }
            $style = 'margin:0;';
            if (true) {
                $style .= 'margin-bottom:' . $spacing . 'px;';
            }
            if ($index < $count - 1 || $layout_rtl) {
                $style .= 'margin-right:' . $spacing . 'px;';
            }
            $class_extra = null;
            if ($class != null) {
                $class_extra = ' ' . implode(' ', $class);
            }
            // don't use "nofancybox" because some plugins/themes interpret it as enabling fancybox
            $class_extra .= ' nolightbox';
            $out_button = array('tag' => 'a', 'class' => 'synved-social-button synved-social-button-' . $context . ' synved-social-size-' . $size . ' synved-social-resolution-' . $icon_def . ' synved-social-provider-' . $button_key . $class_extra, 'data-provider' => $button_key, 'target' => $button_key != 'mail' ? '_blank' : null, 'rel' => 'nofollow', 'title' => $title, 'href' => $href, 'style' => 'font-size: 0px; width:' . $size . 'px;' . 'height:' . $size . 'px;' . $style, 'child-list' => array(array('tag' => 'img', 'alt' => $button_key, 'title' => $title, 'class' => 'synved-share-image synved-social-image synved-social-image-' . $context, 'width' => $size, 'height' => $size, 'style' => 'display: inline; width:' . $size . 'px;' . 'height:' . $size . 'px; margin: 0; padding: 0; border: none; box-shadow: none;', 'src' => $image_uri)));
            $out_list[$icon_def][$button_key] = $out_button;
            $out_params[$icon_def][$button_key] = array('icon-resolution' => $icon_def);
        }
        $index++;
    }
    $out = null;
    if ($out_list != null) {
        foreach ($out_list as $def_key => $def_list) {
            $out_list[$def_key] = apply_filters('synved_social_button_list_markup', $def_list, $out_params[$def_key], $context, $vars, $params);
        }
    }
    if ($out_list != null) {
        $container_tag = 'span';
        if ($container_type == 'block') {
            $container_tag = 'div';
        }
        if ($container != 'none' && ($container == 'both' || $container == $context)) {
            $container_style = $alignment != 'none' ? ' style="text-align: ' . $alignment . '"' : null;
            $out .= '<' . $container_tag . ' class="synved-social-container synved-social-container-' . $context . '"' . $container_style . '>';
        }
        foreach ($out_list as $def_key => $def_list) {
            foreach ($def_list as $button_key => $out_item) {
                $out .= synved_social_button_list_markup_item_out($out_item);
            }
        }
        if (synved_option_get('synved_social', 'show_credit')) {
            $out .= '<a class="synved-social-credit" target="_blank" rel="nofollow" title="' . __('WordPress Social Media Feather', 'social-media-feather') . '" href="http://synved.com/wordpress-social-media-feather/" style="color:#444; text-decoration:none; font-size:8px; margin-left:5px;vertical-align:10px;white-space:nowrap;"><span>' . __('by ', 'social-media-feather') . '</span><img style="display: inline;margin:0;padding:0;width:16px;height:16px;" width="16" height="16" alt="feather" src="' . $uri . '/image/icon.png" /></a>';
        }
        if ($container != 'none' && ($container == 'both' || $container == $context)) {
            $out .= '</' . $container_tag . '>';
        }
    }
    return $out;
}
function synved_option_render_item($id, $name, $item = null, $render = false, $params = null, $context = null)
{
    if ($item == null) {
        $item = synved_option_item($id, $name);
    }
    if ($item == null) {
        return null;
    }
    $value = synved_option_get($id, $name);
    $type = synved_option_item_type($item);
    $style = synved_option_item_style($item);
    $label = synved_option_item_label($item);
    $tip = synved_option_item_tip($item);
    $hint = synved_option_item_hint($item);
    $default = synved_option_item_default($item);
    $set = synved_option_item_set($item);
    $set_is_linear = false;
    if ($set != null) {
        $set_is_linear = true;
        foreach ($set as $set_it) {
            if (count($set_it) > 1) {
                $set_is_linear = false;
                break;
            }
        }
    }
    $out_name = synved_option_render_field_name($id, $name);
    $out_id = synved_option_render_field_id($id, $name);
    $out = null;
    if (isset($params['output_name'])) {
        $out_name = $params['output_name'];
    }
    if (isset($params['output_id'])) {
        $out_id = $params['output_id'];
    }
    if (isset($params['tip'])) {
        $tip = $params['tip'];
    }
    if (isset($params['default'])) {
        $default = $params['default'];
    }
    if (isset($params['value'])) {
        $value = $params['value'];
    }
    $new_value = $value;
    $error_list = synved_option_item_validate_value($id, $name, $value, $new_value, $item);
    if ($new_value != $value && ($context == null || $context == 'settings')) {
        synved_option_set($id, $name, $new_value);
        $value = synved_option_get($id, $name);
    }
    if ($error_list != null) {
        foreach ($error_list as $error) {
            $out .= '<div id="message" class="error"><p>For "<i>' . $label . '</i>": ' . $error['message'] . '</p></div>';
        }
    }
    if ($set_is_linear) {
        $out .= '<select name="' . $out_name . '" id="' . $out_id . '">';
        // XXX exception...remove at some point
        if (isset($params['set_before'])) {
            $set_before = $params['set_before'];
            $set = array_merge($set_before, $set);
        }
        foreach ($set as $set_it) {
            $set_it_keys = array_keys($set_it);
            $selected = $set_it_keys[0] == $value ? ' selected="selected"' : null;
            $out .= '<option value="' . $set_it_keys[0] . '"' . $selected . '>' . $set_it[$set_it_keys[0]] . '</option>';
        }
        $out .= '</select>';
    } else {
        $placeholder = null;
        if ($hint != null) {
            $placeholder = ' placeholder="' . esc_attr($hint) . '"';
        }
        switch ($type) {
            case 'boolean':
                $checked = $value == true ? ' checked="checked"' : null;
                $out .= '<fieldset><legend class="screen-reader-text"><span>' . $label . '</span></legend><label for="' . $out_id . '"><input type="hidden" name="' . $out_name . '" value="0" /><input name="' . $out_name . '" id="' . $out_id . '" type="checkbox" value="1" class="code" ' . $checked . $placeholder . ' /> ' . $label . '</label>&nbsp;&nbsp;<span class="description" style="vertical-align:middle;">' . $tip . '</span></fieldset>';
                break;
            case 'text':
            case 'style':
            case 'script':
            case 'image':
            case 'video':
            case 'media':
                $atts = array('name' => $out_name, 'type' => 'text', 'id' => $out_id, 'value' => $value, 'class' => 'regular-text');
                $att_style = array();
                $content = null;
                $tag = 'input';
                $extended = false;
                if ($style != null) {
                    if (in_array('wide', $style)) {
                        $atts['class'] = 'wide-text';
                    }
                    if (in_array('extend', $style)) {
                        $extended = true;
                    }
                }
                if (in_array($type, array('style', 'script'))) {
                    $extended = true;
                    $att_style['width'] = '450px';
                    $att_style['height'] = '250px';
                }
                if ($extended) {
                    $tag = 'textarea';
                    if (isset($atts['value'])) {
                        $content = $atts['value'];
                        unset($atts['value']);
                    }
                    if ($content == null) {
                        $content = '';
                    }
                    unset($atts['type']);
                }
                if ($hint != null) {
                    $atts['placeholder'] = $hint;
                }
                if ($att_style != null) {
                    $att_css = null;
                    foreach ($att_style as $style_name => $style_value) {
                        $att_css .= $style_name . ':' . $style_value . ';';
                    }
                    $atts['style'] = $att_css;
                }
                $out .= '<' . $tag;
                foreach ($atts as $att_name => $att_value) {
                    $out .= ' ' . $att_name . '="' . esc_attr($att_value) . '"';
                }
                if ($content !== null) {
                    $out .= '>' . esc_html($content) . '</' . $tag . '>';
                } else {
                    $out .= ' />';
                }
                if (in_array($type, array('image', 'video', 'media'))) {
                    $out .= '<input type="hidden" name="' . esc_attr(synved_option_render_field_name($id, $name . '_info_')) . '" value="' . esc_attr($type) . '" />';
                    $out .= '&nbsp;&nbsp;<input type="button" class="synved-option-upload-button" value="' . esc_attr(__('Select File', 'synved-option')) . '"' . $placeholder . ' />';
                }
                break;
            case 'color':
                $out .= '<div style="position:relative; float: left;">';
                $out .= '<input name="' . $out_name . '" id="' . $out_id . '" type="text" value="' . esc_attr($value) . '" class="code medium-text color-input"' . $placeholder . ' />';
                $out .= '<div class="synved-option-color-input-picker" style="background:white;border:solid 1px #ccc;display:none;position:absolute;top:100%;left:0;z-index:10000;"></div>';
                $out .= '</div>';
                break;
            case 'integer':
            case 'decimal':
                $out .= '<input name="' . $out_name . '" id="' . $out_id . '" type="text" value="' . esc_attr($value) . '" class="code small-text"' . $placeholder . ' />';
                break;
            case 'user':
            case 'author':
            case 'category':
            case 'page':
                $args = array('echo' => false, 'name' => $out_name, 'id' => $name, 'selected' => $value, 'show_option_all' => __('Every', 'synved-option') . ' ' . ucfirst($type));
                $drop_out = null;
                switch ($type) {
                    case 'author':
                        $args['who'] = 'author';
                    case 'user':
                        $drop_out = wp_dropdown_users($args);
                        break;
                    case 'category':
                        $drop_out = wp_dropdown_categories($args);
                        break;
                    case 'page':
                        $args['show_option_no_change'] = $args['show_option_all'];
                        $drop_out = wp_dropdown_pages($args);
                        break;
                }
                $out .= $drop_out;
                break;
            case 'tag-list':
                $out .= '<input name="' . $out_name . '" id="' . $out_id . '" type="text" value="' . esc_attr($value) . '" class="regular-text synved-option-tag-selector"' . $placeholder . ' />';
                break;
            case 'addon':
                if (function_exists('synved_option_render_type_addon')) {
                    $out .= synved_option_render_type_addon($id, $name, $item, $out_name, array('out_id' => $out_id, 'label' => $label));
                }
                break;
        }
        if ($hint != null) {
            $out .= ' <span class="snvdopt"><a class="button synved-option-reset-button" title="' . __('Set value to default hinted background value', 'synved-option') . '" style="display: inline-block; padding: 0; vertical-align: middle; cursor: pointer;"><span class="ui-icon ui-icon-arrowrefresh-1-w"> </span></a></span>';
        }
    }
    $item_render = synved_option_item_render($item);
    if ($item_render != null) {
        $error = null;
        $new_out = null;
        try {
            $params = array('output_name' => $out_name, 'output_id' => $out_id, 'output' => $out, 'set' => $set, 'label' => $label);
            $new_out = $item_render->Invoke(array($value, $params, $name, $id, $item));
        } catch (Exception $ex) {
            $new_out = null;
            $error = $ex->getMessage();
        }
        if ($new_out !== null) {
            $out = $new_out;
        }
    }
    if ($out != null) {
        if ($tip != null && $type != 'boolean') {
            $tip_class = ' description-' . $type;
            $out .= '&nbsp;&nbsp;<span class="description' . $tip_class . '">' . $tip . '</span>';
        }
        if ($render) {
            echo $out;
        } else {
            return $out;
        }
    }
    return null;
}
Esempio n. 4
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);
    }
}
function synved_shortcode_init()
{
    $object_list = array();
    if (is_admin()) {
        $exclude_list = array();
        if (isset($_POST['synvedPost'])) {
            $synved_post = (int) $_POST['synvedPost'];
            if ($synved_post > 0) {
                $exclude_list[] = $synved_post;
            }
        }
        if (isset($_GET['post'])) {
            $synved_post = (int) $_GET['post'];
            if ($synved_post > 0 && array_search($synved_post, $exclude_list) === false) {
                $exclude_list[] = $synved_post;
            }
        }
        $args = array('numberposts' => 1, 'orderby' => 'random', 'exclude' => $exclude_list);
        $args['post_type'] = 'post';
        $posts = get_posts($args);
        $post = $posts != null ? $posts[0] : null;
        $args['post_type'] = 'post';
        if ($post != null) {
            $args['exclude'][] = $post->ID;
        }
        $posts = get_posts($args);
        $post2 = $posts != null ? $posts[0] : null;
        $args['post_type'] = 'page';
        $posts = get_posts($args);
        $page = $posts != null ? $posts[0] : null;
        $args['post_type'] = 'attachment';
        $args['post_status'] = null;
        $posts = get_posts($args);
        $media = $posts != null ? $posts[0] : null;
        $object_list['post'] = $post;
        $object_list['post-2'] = $post2;
        $object_list['page'] = $page;
        $object_list['media'] = $media;
    }
    synved_shortcode_register_list();
    $err_rep = error_reporting(0);
    synved_shortcode_register_presets($object_list);
    if (function_exists('synved_shortcode_addon_extra_presets_register')) {
        synved_shortcode_addon_extra_presets_register($object_list);
    }
    error_reporting($err_rep);
    if (current_user_can('edit_posts') || current_user_can('edit_pages')) {
        if (get_user_option('rich_editing') == 'true') {
            add_filter('mce_external_plugins', 'synved_shortcode_wp_tinymce_plugin');
            add_filter('mce_buttons', 'synved_shortcode_wp_tinymce_button');
        }
    }
    $priority = defined('SHORTCODE_PRIORITY') ? SHORTCODE_PRIORITY : 11;
    if (synved_option_get('synved_shortcode', 'shortcode_widgets')) {
        remove_filter('widget_text', 'do_shortcode', $priority);
        add_filter('widget_text', 'do_shortcode', $priority);
    }
    if (synved_option_get('synved_shortcode', 'shortcode_feed')) {
        remove_filter('the_content_feed', 'do_shortcode', $priority);
        remove_filter('the_excerpt_rss', 'do_shortcode', $priority);
        add_filter('the_content_feed', 'do_shortcode', $priority);
        add_filter('the_excerpt_rss', 'do_shortcode', $priority);
    }
    add_action('wp_ajax_synved_shortcode', 'synved_shortcode_ajax_callback');
    add_action('wp_ajax_nopriv_synved_shortcode', 'synved_shortcode_ajax_callback');
    if (!is_admin()) {
        if (isset($_GET['synved_dynamic_tab'])) {
            ob_start();
        }
        add_action('wp_enqueue_scripts', 'synved_shortcode_enqueue_scripts');
        //add_action('wp_print_styles', 'synved_shortcode_print_styles');
    }
}