function synved_social_option_addon_light_prompt_tip($tip, $item) { $uri = synved_social_path_uri(); if (synved_option_addon_installed('synved_social', 'addon_light_prompt')) { $tip .= ' <span style="background:#eee;padding:5px 8px;">' . __('The "Light Prompt" addon is already installed! You can use the button to re-install it.', 'social-media-feather') . '</span>'; } else { $tip .= '<div style="clear:both"><p style="font-size:120%;"><b>The <a target="_blank" href="http://synved.com/product/feather-light-prompt/">Light Prompt addon</a> allows you to achieve the nice overlay below when users click on a share button, <a target="_blank" href="http://synved.com/product/feather-light-prompt/">get it now</a>!</b></p> <a target="_blank" href="http://synved.com/product/feather-light-prompt/"><img src="' . $uri . '/image/social-feather-light-prompt-demo.png" /></a></div>'; } return $tip; }
function synved_shortcode_ajax_callback() { check_ajax_referer('synved-shortcode-submit-nonce', 'synvedSecurity'); if (!isset($_POST['synvedAction']) || $_POST['synvedAction'] == null) { return; } $action = $_POST['synvedAction']; $params = isset($_POST['synvedParams']) ? $_POST['synvedParams'] : null; $response = null; $response_html = null; if (is_string($params)) { $parms = json_decode($params, true); if ($parms == null) { $parms = json_decode(stripslashes($params), true); } $params = $parms; } switch ($action) { case 'load-ui': $uri = synved_shortcode_path_uri(); # # $response_html .= ' #<script type="text/javascript" src="' . '' . '" />'; # if (synved_option_addon_installed('synved_shortcode', 'skin_slickpanel')) # { # $set[]['slickpanel'] = 'SlickPanel'; # } if (current_user_can('edit_posts') || current_user_can('edit_pages')) { $response_html .= ' <div class="synved-shortcode-edit-popup">'; if (!synved_option_addon_installed('synved_shortcode', 'skin_slickpanel')) { $response_html .= ' <a target="_blank" href="http://synved.com/product/wordpress-shortcodes-slickpanel-skin/" style=""><img align="center" src="' . $uri . '/image/skin-slickpanel-thin.png" style="clear:both;margin-top:5px;border:solid 1px #aaa;"/></a>'; } $response_html .= '<h3 class="popup-title">' . __('Select your shortcode, edit it, preview it and confirm when you\'re done!', 'synved-shortcode') . '</h3>'; $response_html .= ' <form action="" method="post"> <div class="synved-shortcode-edit-ui">'; $list = synved_shortcode_list(); $extra_fields = null; $help_html = null; $response_html .= ' <div class="synved-shortcode-edit-ui-selector"> <div class="selector-item" style="float:left;"> <div class="selector-label" style="float:left;margin-top:3px;margin-right:8px;"> <label for="synved_shortcode_list">' . __('Shortcode', 'synved-shortcode') . ':</label> </div> <select name="synved_shortcode_list" id="synved_shortcode_list">'; $list_html = array(); $group_labels = array(); foreach ($list as $shortcode_name => $shortcode_item) { $name_alt = $shortcode_item['name_alt']; $label = $shortcode_item['label']; $group = $shortcode_item['group']; $callback = $shortcode_item['callback']; $internal = $shortcode_item['internal']; $default = $shortcode_item['default']; $help = $shortcode_item['help']; $presets = $shortcode_item['preset_list']; if ($internal == false) { $tip = null; $args = null; $group_name = null; $group_label = null; if ($group != null) { if (is_array($group)) { $group_name = isset($group['name']) ? $group['name'] : null; $group_label = isset($group['label']) ? $group['label'] : null; } else { $group_name = $group; $group_label = synved_shortcode_item_label_create($group_name); } $group_labels[$group_name] = $group_label; } if ($help != null) { if (is_string($help)) { $tip = $help; } else { if (is_array($help)) { $tip = isset($help['tip']) ? $help['tip'] : null; $args = isset($help['parameters']) ? $help['parameters'] : null; } } $help_html .= ' <div class="synved-shortcode-help-item" id="' . esc_attr('synved-shortcode-help-item-' . $shortcode_name) . '">'; $help_html .= ' <div class="help-tip"> <b>[' . $name_alt . ']</b> --> ' . $tip . ' </div>'; if ($presets != null) { $help_html .= ' <div class="presets-tip"> ' . __('Remember that you can also use the <strong>Preset</strong> selector at the top-right to see examples on how to use the shortcode.', 'synved-shortcode') . ' </div>'; } if ($args != null) { $help_html .= ' <div class="help-parameter-list-wrap">'; $help_html .= ' <h4 class="ui-title">' . __('Parameters', 'synved-shortcode') . ':</h4>'; $help_html .= ' <ul class="help-parameter-list">'; foreach ($args as $arg_name => $arg_tip) { $help_html .= ' <li class="help-parameter-tip"> <b>' . $arg_name . '</b>: <i>' . $arg_tip . '</i> </li>'; } $help_html .= ' </ul>'; $help_html .= ' </div>'; } $help_html .= ' </div>'; } $title = $tip != null ? ' title="' . esc_attr($tip) . '"' : null; if (!isset($list_html[$group_name])) { $list_html[$group_name] = null; } $list_html[$group_name] .= ' <option value="' . esc_attr($shortcode_name) . '"' . $title . '>' . $label . '</option>'; $extra_fields .= ' <select name="shortcode_preset[' . esc_attr($shortcode_name) . ']">'; $extra_fields .= ' <option selected="selected" value="' . esc_attr('default') . '" data-content="' . esc_attr($default) . '" title="' . esc_attr(__('The default preset', 'synved-shortcode')) . '">' . esc_attr(__('Default', 'synved-shortcode')) . '</option>'; if ($presets != null) { $preset_list_html = array(); $preset_group_labels = array(); foreach ($presets as $preset_name => $preset) { $preset_label = $preset['label']; $preset_group = $preset['group']; $preset_tip = $preset['tip']; $preset_content = $preset['content']; $preset_group_name = null; $preset_group_label = null; if ($preset_group != null) { if (is_array($preset_group)) { $preset_group_name = isset($preset_group['name']) ? $preset_group['name'] : null; $preset_group_label = isset($preset_group['label']) ? $preset_group['label'] : null; } else { $preset_group_name = $preset_group; $preset_group_label = synved_shortcode_item_label_create($preset_group_name); } $preset_group_labels[$preset_group_name] = $preset_group_label; } if ($preset_label == null) { $preset_label = synved_shortcode_item_label_create($preset_name); } if ($preset_tip != null) { $preset_tip = ' title="' . esc_attr($preset_tip) . '"'; } $preset_list_html[$preset_group_name] .= ' <option value="' . esc_attr($preset_name) . '" data-content="' . esc_attr($preset_content) . '"' . $preset_tip . '>' . $preset_label . '</option>'; } if (isset($preset_list_html[null])) { $preset_list_html_keys = array_keys($preset_list_html); $preset_list_html_values = array_values($preset_list_html); $preset_list_html_index = array_search(null, $preset_list_html_keys); if ($preset_list_html_index !== false && $preset_list_html_index > 0) { $preset_list_html_value = $preset_list_html_values[$preset_list_html_index]; unset($preset_list_html_keys[$preset_list_html_index]); unset($preset_list_html_values[$preset_list_html_index]); array_unshift($preset_list_html_keys, null); array_unshift($preset_list_html_values, $preset_list_html_value); $preset_list_html = array_combine($preset_list_html_keys, $preset_list_html_values); } } foreach ($preset_list_html as $preset_group_name => $preset_item_html) { if ($preset_group_name != null) { $extra_fields .= ' <optgroup label="' . $preset_group_labels[$preset_group_name] . '">'; } $extra_fields .= $preset_item_html; if ($preset_group_name != null) { $extra_fields .= ' </optgroup>'; } } } //<optgroup label="' . __('Custom', 'synved-shortcode') . '"> $extra_fields .= ' <option value="custom" data-content="' . esc_attr($default) . '" title="' . esc_attr(__('The custom preset, holds the temporarily customized shortcode code', 'synved-shortcode')) . '">' . esc_attr(__('<Custom>', 'synved-shortcode')) . '</option>'; //</optgroup> $extra_fields .= ' </select>'; } } if (isset($list_html[null])) { $list_html_keys = array_keys($list_html); $list_html_values = array_values($list_html); $list_html_index = array_search(null, $list_html_keys); if ($list_html_index !== false && $list_html_index > 0) { $list_html_value = $list_html_values[$list_html_index]; unset($list_html_keys[$list_html_index]); unset($list_html_values[$list_html_index]); array_unshift($list_html_keys, null); array_unshift($list_html_values, $list_html_value); $list_html = array_combine($list_html_keys, $list_html_values); } } foreach ($list_html as $group_name => $shortcode_item_html) { if ($group_name != null) { $response_html .= ' <optgroup label="' . $group_labels[$group_name] . '">'; } $response_html .= $shortcode_item_html; if ($group_name != null) { $response_html .= ' </optgroup>'; } } $response_html .= ' </select> <div class="shortcode-extra-fields" style="display:none">' . $extra_fields . '</div> </div> <div class="selector-item" style="float:right;"> <div class="selector-label" style="float:left;margin-top:3px;margin-right:8px;"> <label for="synved_preset_list">' . __('Preset', 'synved-shortcode') . ':</label> </div> <select name="synved_preset_list" id="synved_preset_list"> </select>'; if (!synved_option_addon_installed('synved_shortcode', 'addon_extra_presets')) { $response_html .= ' <a target="_blank" href="http://synved.com/product/wordpress-shortcodes-extra-presets/" style="display:block;text-align:right;font-weight:bold;">GET 30+ EXTRA AMAZING PRESETS!</a>'; } $response_html .= ' </div> <div style="clear:both"> </div> </div>'; $response_html .= ' <div class="synved-shortcode-edit-ui-viewer">'; $response_html .= ' <div class="ui-code-wrap"> <div class="ui-wrap ui-wrap-left">'; $response_html .= ' <h4 class="ui-title">' . __('Code', 'synved-shortcode') . ':</h4> <textarea name="synved_shortcode_code" class="ui-code"></textarea>'; $response_html .= ' </div> </div>'; $response_html .= ' <div class="ui-preview-wrap"> <div class="ui-wrap ui-wrap-right">'; $response_html .= ' <h4 class="ui-title">' . __('Preview', 'synved-shortcode') . ': <img class="preview-loader" style="visibility:hidden" src="' . $uri . '/image/ajax-loader.gif" /></h4> <div class="ui-preview"></div>'; $response_html .= ' </div> </div>'; $response_html .= ' </div>'; $response_html .= '<div style="clear:both"></div>'; $response_html .= ' <div class="synved-shortcode-edit-ui-help"> <div class="ui-help-wrap">'; # $response_html .= ' #<h3 class="">' . __('Help', 'synved-shortcode') . ':</h3>'; $response_html .= ' <div class="ui-help"></div>'; $response_html .= ' </div>'; if ($help_html != null) { $help_html = ' <div class="synved-shortcode-help" style="display:none;"> ' . $help_html . ' </div>'; $response_html .= $help_html; } $response_html .= ' </div>'; $response_html .= ' </div>'; $response_html .= '<div style="clear:both"></div>'; $response_html .= ' <div class="synved-shortcode-edit-actions">'; $response_html .= '<button class="action-confirm button-primary">' . __('Confirm and add shortcode', 'synved-shortcode') . '</button>'; $response_html .= ' <div style="float:right"><a target="_blank" href="http://synved.com/wordpress-shortcodes/">WordPress Shortcodes</a> by <a target="_blank" href="http://synved.com">Synved</a>'; if (function_exists('synved_connect_support_social_follow_render_small')) { $response_html .= ' ' . synved_connect_support_social_follow_render_small(); } if (!synved_option_addon_installed('synved_shortcode', 'skin_slickpanel')) { $response_html .= ' » <a target="_blank" href="http://synved.com/product/wordpress-shortcodes-slickpanel-skin/">BE SLICK AND SUPPORT US!</a> «'; } $response_html .= ' </div>'; $response_html .= '<div style="clear:both; margin: 10px 0 60px 0;"><a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/synved-shortcodes?rate=5#postform" style="font-size:120%"><b>We need your help!</b> If you like the plugin, you can help us by leaving a 5-stars review! It only takes a minute and it\'s free!</a></a></div>'; $response_html .= ' </div>'; $response_html .= ' </form> </div>'; } break; case 'preview-code': if (current_user_can('edit_posts') || current_user_can('edit_pages')) { $code = isset($params['code']) ? $params['code'] : null; if (get_magic_quotes_gpc() || get_magic_quotes_runtime() || true) { $code = stripslashes($code); } $response_html = do_shortcode($code); } break; } while (ob_get_level() > 0) { ob_end_clean(); } if ($response != null) { $response = json_encode($response); header('Content-Type: application/json'); echo $response; } else { if ($response_html != null) { header('Content-Type: text/html'); echo $response_html; } else { header('HTTP/1.1 403 Forbidden'); } } exit; }