/** * Echo's out the content of our widget */ function widget($args, $instance) { extract($args); $addthis_new_styles = _get_style_options(); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } printf(apply_filters('addthis_sidebar_style_output', $addthis_new_styles[$instance['style']]['src']), ''); echo $after_widget; }
/** * The icon choser row. Should be made to look a bit prettier */ function _addthis_choose_icons($name, $options) { global $addThisConfigs; global $cmsConnector; $addthis_new_styles = _get_style_options(); $addthis_default_options = $addThisConfigs->getConfigs(); extract($options); if ($name == 'above') { _addthis_swap_first_two_elements($addthis_new_styles, 'large_toolbox'); $titleAdjective = 'Above'; $option = $above; $custom_size = $above_custom_size; $do_custom_services = isset($above_do_custom_services) && $above_do_custom_services ? 'checked="checked"' : ''; $do_custom_preferred = isset($above_do_custom_preferred) && $above_do_custom_preferred ? 'checked="checked"' : ''; $custom_services = $above_custom_services; $custom_preferred = $above_custom_preferred; $custom_more = $above_custom_more; $custom_string = $above_custom_string; } else { $titleAdjective = 'Below'; $option = $below; $custom_size = $below_custom_size; $do_custom_services = isset($below_do_custom_services) && $below_do_custom_services ? 'checked="checked"' : ''; $do_custom_preferred = isset($below_do_custom_preferred) && $below_do_custom_preferred ? 'checked="checked"' : ''; $custom_services = $below_custom_services; $custom_preferred = $below_custom_preferred; $custom_more = $below_custom_more; $custom_string = $below_custom_string; } $titleAdjectiveLower = strtolower($titleAdjective); ?> <table> <tr> <td id="<?php echo $name; ?> " colspan="2"> <fieldset> <legend class="hidden"> <strong><?php _e("Sharing {$titleAdjective} Post", 'addthis_trans_domain'); ?> </strong> </legend> <div class="Sharing-Icons-options-container"> <p><?php _e("These buttons will appear {$titleAdjectiveLower} your blog posts.", 'addthis_trans_domain'); ?> </p> <?php foreach ($addthis_new_styles as $k => $v) { $checked = ''; if ($option == $k || $option == 'none' && $k == $addthis_default_options[$name]) { $checked = 'checked="checked"'; } if ($checked === '' && isset($v['defaultHide']) && $v['defaultHide'] == true) { continue; } echo "\n <div class='{$name}" . "_option select_row'>\n <span class='radio'>\n <input\n {$checked}\n type='radio'\n value='" . $k . "'\n id='{$k}_{$name}'\n name='addthis_settings[{$name}]'\n />\n </span>\n <label for='{$k}_{$name}'>\n <span class=\"addthis-checkbox-label\">\n <img alt='" . $k . "' src='" . $cmsConnector->getPluginImageFolderUrl() . $v['img'] . "' />\n </span>\n </label>\n </div>"; } $checked = ''; if ($option == 'custom_string' || $option == 'none' && 'custom_strin' == $addthis_default_options[$name]) { $checked = 'checked="checked"'; } echo "\n <div class='{$name}" . "_option select_row'>\n <span class='radio mt4'>\n <input\n {$checked}\n type='radio'\n value='custom_string'\n name='addthis_settings[{$name}]'\n id='{$name}" . "_custom_string'\n />\n </span>\n <label for='{$name}_custom_string'>\n <span class=\"addthis-checkbox-label\">\n Advanced API button configuration\n </span>\n </label>\n </div>"; _e(sprintf("<div style='max-width: 555px;margin-left:20px' class='%s_custom_string_input'> This text box allows you to enter any AddThis markup that you wish. To see examples of what you can do, visit <a href='https://www.addthis.com/get/sharing'>AddThis.com Sharing Tools</a> and select any sharing tool. You can also check out our <a href='http://support.addthis.com/customer/portal/articles/1365467-preferred-services-personalization'>Client API</a>. For any help you may need, please visit <a href='http://support.addthis.com'>AddThis Support</a></div>", $name), 'addthis_trans_domain'); echo "<textarea rows='5' name='addthis_settings[{$name}" . "_custom_string]' class='{$name}" . "_custom_string_input' />" . esc_textarea($custom_string) . "</textarea>"; $class = 'hidden'; $checked = ''; if ($option == 'custom' || $option == 'none' && 'custom' == $addthis_default_options[$name]) { $checked = 'checked="checked"'; $class = ''; echo "<div class='{$name}" . "_option select_row {$class} mt20'><span class='radio mt4'><input {$checked} type='radio' value='custom' name='addthis_settings[{$name}]' id='{$name}" . "_custom_button' /></span> Build your own</div>"; echo "<ul class='{$name}" . "_option_custom hidden'>"; $custom_16 = $custom_size == 16 ? 'selected="selected"' : ''; $custom_32 = $custom_size == 32 ? 'selected="selected"' : ''; echo "<li class='nocheck'><span class='at_custom_label'>Size:</span><select name='addthis_settings[{$name}" . "_custom_size]'><option value='16' {$custom_16} >16x16</option><option value='32' {$custom_32} >32x32</option></select><br/><span class='description'>The size of the icons to display</span></li>"; echo "<li><input {$do_custom_services} class='at_do_custom' type='checkbox' name='addthis_settings[{$name}" . "_do_custom_services]' value='true' /><span class='at_custom_label'>Services to always show:</span><input class='at_custom_input' name='addthis_settings[{$name}" . "_custom_services]' value='{$custom_services}'/><br/><span class='description'>Enter a comma-separated list of <a href='//addthis.com/services'>service codes</a> </span></li>"; echo "<li><input type='checkbox' {$do_custom_preferred} class='at_do_custom' name='addthis_settings[{$name}" . "_do_custom_preferred]' value='true' /><span class='at_custom_label'>Automatically personalized:</span>\n <select name='addthis_settings[{$name}" . "_custom_preferred]' class='at_custom_input'>"; for ($i = 0; $i <= 11; $i++) { $selected = ''; if ($custom_preferred == $i) { $selected = 'selected="selected"'; } echo '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>'; } echo "</select><br/><span class='description'>Enter the number of automatically user-personalized items you want displayed</span></li>"; $custom_more = $custom_more ? 'checked="checked"' : ''; echo "<li><input {$custom_more} type='checkbox' class='at_do_custom' name='addthis_settings[{$name}" . "_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic logo that offers sharing to over 330 destinations</span></li>"; echo "</ul></div>"; } echo '</div>'; ?> </div> <?php _addthis_print_services_picker($name, $options); ?> </fieldset> </td> </tr> </table> <?php }
/** * The icon choser row. Should be made to look a bit prettier */ function _addthis_choose_icons($name, $options) { $addthis_new_styles = _get_style_options(); global $addthis_default_options; extract($options); if ($name == 'above') { _addthis_swap_first_two_elements($addthis_new_styles, 'large_toolbox'); $legend = 'Top'; $option = $above; $custom_size = $above_custom_size; $do_custom_services = isset($above_do_custom_services) && $above_do_custom_services ? 'checked="checked"' : ''; $do_custom_preferred = isset($above_do_custom_preferred) && $above_do_custom_preferred ? 'checked="checked"' : ''; $custom_services = $above_custom_services; $custom_preferred = $above_custom_preferred; $custom_more = $above_custom_more; $custom_string = $above_custom_string; } else { $legend = 'Bottom'; $option = $below; $custom_size = $below_custom_size; $do_custom_services = isset($below_do_custom_services) && $below_do_custom_services ? 'checked="checked"' : ''; $do_custom_preferred = isset($below_do_custom_preferred) && $below_do_custom_preferred ? 'checked="checked"' : ''; $custom_services = $below_custom_services; $custom_preferred = $below_custom_preferred; $custom_more = $below_custom_more; $custom_string = $below_custom_string; } ?> <tr> <td id="<?php echo $name; ?> " colspan="2"> <fieldset> <legend> <strong><?php _e("{$legend} Sharing Tool", 'addthis_trans_domain'); ?> </strong> </legend> <div style="float: left; width: 395px;"> <?php $imgLocationBase = apply_filters('at_files_uri', plugins_url('', basename(dirname(__FILE__)))) . '/addthis/img/'; $imgLocationBase = apply_filters('addthis_files_uri', plugins_url('', basename(dirname(__FILE__)))) . '/addthis/img/'; foreach ($addthis_new_styles as $k => $v) { $checked = ''; if ($option == $k || $option == 'none' && $k == $addthis_default_options[$name]) { $checked = 'checked="checked"'; } if ($checked === '' && isset($v['defaultHide']) && $v['defaultHide'] == true) { continue; } echo "<div class='{$name}" . "_option select_row'><span class='radio'><input {$checked} type='radio' value='" . $k . "' id='{$k}_{$name}' name='addthis_settings[{$name}]' /></span><label for='{$k}_{$name}'> <img alt='" . $k . "' src='" . $imgLocationBase . $v['img'] . "' align='left' /></label><div class='clear'></div></div>"; } $ischecked = ''; if ($option == 'disable') { $ischecked = 'checked="checked"'; } echo "<div class='{$name}" . "_option select_row'><span class='radio'><input type='radio' {$ischecked} value='disable' id='disable_{$name}' name='addthis_settings[{$name}]' /></span><label for='disable_{$name}'>Do not show a sharing tool at the <strong>{$legend}</strong> of posts</label></div>"; $checked = ''; if ($option == 'custom_string' || $option == 'none' && 'custom_strin' == $addthis_default_options[$name]) { $checked = 'checked="checked"'; } echo "<div class='{$name}" . "_option select_row'><span class='radio mt4'><input {$checked} type='radio' value='custom_string' name='addthis_settings[{$name}]' id='{$name}" . "_custom_string' /></span> <label for='{$name}_custom_string'>Custom button</label><div class='clear'></div></div>"; _e(sprintf("<div style='max-width: 555px;margin-left:20px' class='%s_custom_string_input'> This text box allows you to enter any AddThis markup that you wish. To see examples of what you can do, visit <a href='https://www.addthis.com/get/sharing'>AddThis.com Sharing Tools</a> and select any sharing tool. You can also check out our <a href='http://support.addthis.com/customer/portal/articles/381263-addthis-client-api#rendering-decoration'>Client API</a>. For any help you may need, please visit <a href='http://support.addthis.com'>AddThis Support</a></div>", $name), 'addthis_trans_domain'); echo "<textarea style='max-width:555px;margin-left:20px' rows='5' cols='100' name='addthis_settings[{$name}" . "_custom_string]' class='{$name}" . "_custom_string_input' />" . esc_textarea($custom_string) . "</textarea>"; $class = 'hidden'; $checked = ''; if ($option == 'custom' || $option == 'none' && 'custom' == $addthis_default_options[$name]) { $checked = 'checked="checked"'; $class = ''; echo "<div class='{$name}" . "_option select_row {$class} mt20'><span class='radio mt4'><input {$checked} type='radio' value='custom' name='addthis_settings[{$name}]' id='{$name}" . "_custom_button' /></span> Build your own<div class='clear'></div></div>"; echo "<ul class='{$name}" . "_option_custom hidden'>"; $custom_16 = $custom_size == 16 ? 'selected="selected"' : ''; $custom_32 = $custom_size == 32 ? 'selected="selected"' : ''; echo "<li class='nocheck'><span class='at_custom_label'>Size:</span><select name='addthis_settings[{$name}" . "_custom_size]'><option value='16' {$custom_16} >16x16</option><option value='32' {$custom_32} >32x32</option></select><br/><span class='description'>The size of the icons to display</span></li>"; echo "<li><input {$do_custom_services} class='at_do_custom' type='checkbox' name='addthis_settings[{$name}" . "_do_custom_services]' value='true' /><span class='at_custom_label'>Services to always show:</span><input class='at_custom_input' name='addthis_settings[{$name}" . "_custom_services]' value='{$custom_services}'/><br/><span class='description'>Enter a comma-separated list of <a href='//addthis.com/services'>service codes</a> </span></li>"; echo "<li><input type='checkbox' {$do_custom_preferred} class='at_do_custom' name='addthis_settings[{$name}" . "_do_custom_preferred]' value='true' /><span class='at_custom_label'>Automatically personalized:</span>\r\n <select name='addthis_settings[{$name}" . "_custom_preferred]' class='at_custom_input'>"; for ($i = 0; $i <= 11; $i++) { $selected = ''; if ($custom_preferred == $i) { $selected = 'selected="selected"'; } echo '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>'; } echo "</select><br/><span class='description'>Enter the number of automatically user-personalized items you want displayed</span></li>"; $custom_more = $custom_more ? 'checked="checked"' : ''; echo "<li><input {$custom_more} type='checkbox' class='at_do_custom' name='addthis_settings[{$name}" . "_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic logo that offers sharing to over 330 destinations</span></li>"; echo "</ul></div>"; } echo '</div>'; ?> </div> <div class="<?php echo $name; ?> _button_set select_row" style="float: left; width: 480px;"> <div id="<?php echo $name; ?> _custom_btns"> <?php //if ($name == "above") { ?> <span class="<?php echo $name; ?> -smart-sharing-container"> <p id="customizedMessage" class="mb40 personalizedMessage customize-message-section customize-your-buttons" style="display:none;"> Your buttons are currently customized. <a href="#" class="<?php echo $name; ?> -customize-sharing-link customize-your-buttons">Show customization.</a> </p> <p id="personalizedMessage" class="mb40 personalizedMessage customize-message-section customize-your-buttons"> AddThis boosts sharing by automatically showing the right buttons to each user based on their location and activity across the web. <a href="#" class="<?php echo $name; ?> -customize-sharing-link customize-your-buttons">Disable and select your own buttons.</a> </p> <p class="mb40 smart-sharing-link customize-message-section">Your buttons are currently customized. <a href="#" class="<?php echo $name; ?> -customize-sharing-link smart-sharing-link">Let AddThis choose instead and boost sharing</a> <span class="row-right" data-content="Smartest sharing buttons on the web. Automated to show each user the services that they use most based on their location and activity across the web." data-original-title="Smart Sharing."> (<a href="#">?</a>)</span> </p> <span class="smart-sharing-inner-container"> <p class="hide"> <label> <input type="radio" checked="checked" name="<?php echo $name; ?> -sharing" id="<?php echo $name; ?> -enable-smart-sharing" value="<?php echo $name; ?> -enable-smart-sharing"/> Use Smart Buttons <strong>(Recommended)</strong> </label> <label> <input type="radio" name="<?php echo $name; ?> -sharing" id="<?php echo $name; ?> -disable-smart-sharing"> Customize your buttons </label> </p> <div class="customize-buttons"> <div class="sharing-buttons"> <h4 class="sortable-heading">Button Options</h4> <input type="text" class="sharing-buttons-search" placeholder="Find a service" maxlength="20" size="30" style="width: 230px; height: 41px; margin: 0;"> <ul class="sortable"></ul> </div> <div class="selected-services"> <h4 class="sortable-heading">Selected Buttons</h4> <ul class="sortable" data-type="addthisButtons"></ul> </div> </div> <div class="vertical-drag"> <i class="icon-arrow-up"></i> <i class="icon-arrow-down"></i> <p>Drag up or down to reorder services</p> </div> <div class="horizontal-drag"> <i class="icon-arrow-right"></i> <p>Drag across to add service</p> </div> <a href="#" class="restore-default-options" style="float: left; padding-left: 100px;">Restore default options</a> <?php $list = $name . '_chosen_list'; ?> <input type="hidden" id="<?php echo $name; ?> -chosen-list" name="addthis_settings[<?php echo $name; ?> _chosen_list]" value="<?php echo $options[$list]; ?> "/> </span> </span> <script type="text/javascript"> window.page = 'sharing-buttons'; //$('.follow-tooltip').popover({ trigger: "hover" }); </script> <!-- <div id="atcode"></div> --> <?php //} ?> </div> </div> </fieldset> </td> </tr> <?php }
/** * The icon choser row. Should be made to look a bit prettier */ function _addthis_choose_icons($name, $options) { $addthis_new_styles = _get_style_options(); global $addthis_default_options; extract($options); if ($name == 'above') { _addthis_swap_first_two_elements($addthis_new_styles, 'large_toolbox'); $legend = 'Top'; $option = $above; $custom_size = $above_custom_size; $do_custom_services = isset($above_do_custom_services) && $above_do_custom_services ? 'checked="checked"' : ''; $do_custom_preferred = isset($above_do_custom_preferred) && $above_do_custom_preferred ? 'checked="checked"' : ''; $custom_services = $above_custom_services; $custom_preferred = $above_custom_preferred; $custom_more = $above_custom_more; $custom_string = $above_custom_string; } else { $legend = 'Bottom'; $option = $below; $custom_size = $below_custom_size; $do_custom_services = isset($below_do_custom_services) && $below_do_custom_services ? 'checked="checked"' : ''; $do_custom_preferred = isset($below_do_custom_preferred) && $below_do_custom_preferred ? 'checked="checked"' : ''; $custom_services = $below_custom_services; $custom_preferred = $below_custom_preferred; $custom_more = $below_custom_more; $custom_string = $below_custom_string; } ?> <tr> <td id="<?php echo $name; ?> " colspan="2"> <fieldset> <legend> <strong><?php _e("{$legend} Sharing Tool", 'addthis_trans_domain'); ?> </strong> </legend> <?php $sharing_checked = $option == 'none' ? '' : 'checked="checked"'; echo "<div class='enable-sharing-tool'><input type='checkbox' {$sharing_checked} value='{$option}' id='enable_{$name}' name='addthis_settings[enable_{$name}]' />\n <label for='enable_{$name}'>"; echo _e('Enable the following sharing tool at the ', 'addthis_trans_domain'); echo '<strong>'; echo _e($legend, 'addthis_trans_domain'); echo '</strong> of posts:</label></div>'; $imgLocationBase = apply_filters('at_files_uri', plugins_url('', basename(dirname(__FILE__)))) . '/addthis/img/'; $imgLocationBase = apply_filters('addthis_files_uri', plugins_url('', basename(dirname(__FILE__)))) . '/addthis/img/'; foreach ($addthis_new_styles as $k => $v) { $checked = ''; if ($option == $k || $option == 'none' && $k == $addthis_default_options[$name]) { $checked = 'checked="checked"'; } if ($checked === '' && isset($v['defaultHide']) && $v['defaultHide'] == true) { continue; } echo "<div class='{$name}" . "_option select_row'><span class='radio'><input {$checked} type='radio' value='" . $k . "' id='{$k}_{$name}' name='addthis_settings[{$name}]' /></span><label for='{$k}_{$name}'> <img alt='" . $k . "' src='" . $imgLocationBase . $v['img'] . "' align='left' /></label><div class='clear'></div></div>"; } $class = 'hidden'; $checked = ''; if ($option == 'custom' || $option == 'none' && 'custom' == $addthis_default_options[$name]) { $checked = 'checked="checked"'; $class = ''; echo "<div class='{$name}" . "_option select_row {$class} mt20'><span class='radio mt4'><input {$checked} type='radio' value='custom' name='addthis_settings[{$name}]' id='{$name}" . "_custom_button' /></span> Build your own<div class='clear'></div></div>"; echo "<ul class='{$name}" . "_option_custom hidden'>"; $custom_16 = $custom_size == 16 ? 'selected="selected"' : ''; $custom_32 = $custom_size == 32 ? 'selected="selected"' : ''; echo "<li class='nocheck'><span class='at_custom_label'>Size:</span><select name='addthis_settings[{$name}" . "_custom_size]'><option value='16' {$custom_16} >16x16</option><option value='32' {$custom_32} >32x32</option></select><br/><span class='description'>The size of the icons to display</span></li>"; echo "<li><input {$do_custom_services} class='at_do_custom' type='checkbox' name='addthis_settings[{$name}" . "_do_custom_services]' value='true' /><span class='at_custom_label'>Services to always show:</span><input class='at_custom_input' name='addthis_settings[{$name}" . "_custom_services]' value='{$custom_services}'/><br/><span class='description'>Enter a comma-separated list of <a href='//addthis.com/services'>service codes</a> </span></li>"; echo "<li><input type='checkbox' {$do_custom_preferred} class='at_do_custom' name='addthis_settings[{$name}" . "_do_custom_preferred]' value='true' /><span class='at_custom_label'>Automatically personalized:</span>\n <select name='addthis_settings[{$name}" . "_custom_preferred]' class='at_custom_input'>"; for ($i = 0; $i <= 11; $i++) { $selected = ''; if ($custom_preferred == $i) { $selected = 'selected="selected"'; } echo '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>'; } echo "</select><br/><span class='description'>Enter the number of automatically user-personalized items you want displayed</span></li>"; $custom_more = $custom_more ? 'checked="checked"' : ''; echo "<li><input {$custom_more} type='checkbox' class='at_do_custom' name='addthis_settings[{$name}" . "_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic logo that offers sharing to over 330 destinations</span></li>"; echo "</ul></div>"; } $checked = ''; if ($option == 'custom_string' || $option == 'none' && 'custom_strin' == $addthis_default_options[$name]) { $checked = 'checked="checked"'; } echo "<div class='{$name}" . "_option select_row'><span class='radio mt4'><input {$checked} type='radio' value='custom_string' name='addthis_settings[{$name}]' id='{$name}" . "_custom_string' /></span> <label for='{$name}_custom_string'>Custom button</label><div class='clear'></div></div>"; _e(sprintf("<div style='max-width: 748px;margin-left:20px' class='%s_custom_string_input'> This text box allows you to enter any AddThis markup that you wish. To see examples of what you can do, visit <a href='https://www.addthis.com/get/sharing'>AddThis.com Sharing Tools</a> and select any sharing tool. You can also check out our <a href='http://support.addthis.com/customer/portal/articles/381263-addthis-client-api#rendering-decoration'>Client API</a>. For any help you may need, please visit <a href='http://support.addthis.com'>AddThis Support</a></div>", $name), 'addthis_trans_domain'); echo "<textarea style='max-width:748px;margin-left:20px' rows='5' cols='120' name='addthis_settings[{$name}" . "_custom_string]' class='{$name}" . "_custom_string_input' />" . esc_textarea($custom_string) . "</textarea>"; echo '</div>'; ?> </fieldset> </td> </tr> <?php }