Ejemplo n.º 1
0
function social_bookmarks_configure()
{
    global $CONFIG, $THEME_DIR, $thisplugin, $lang_plugin_social_bookmarks, $lang_common, $social_bookmarks_icon_array, $lang_errors, $social_bookmarks_installation, $socialBookmarks_title;
    $superCage = Inspekt::makeSuperCage();
    if (!GALLERY_ADMIN_MODE) {
        cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
    }
    // Form submit?
    if ($superCage->post->keyExists('submit') == TRUE) {
        //Check if the form token is valid
        if (!checkFormToken()) {
            cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
        }
        $config_changes_counter = social_bookmarks_configuration_submit();
        if ($config_changes_counter > 0) {
            $additional_submit_information = '<div class="cpg_message_success">' . $lang_plugin_social_bookmarks['changes_saved'] . '</div>';
        } else {
            $additional_submit_information = '<div class="cpg_message_validation">' . $lang_plugin_social_bookmarks['no_changes'] . '</div>';
        }
    }
    // Set the option output stuff
    if ($CONFIG['plugin_social_bookmarks_position'] == '0') {
        $option_output['plugin_social_bookmarks_position_placeholder_token'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_position_content_of_main_page'] = '';
        $option_output['plugin_social_bookmarks_position_sys_menu'] = '';
        $option_output['plugin_social_bookmarks_position_sub_menu'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_position'] == '1') {
        //
        $option_output['plugin_social_bookmarks_position_placeholder_token'] = '';
        $option_output['plugin_social_bookmarks_position_content_of_main_page'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_position_sys_menu'] = '';
        $option_output['plugin_social_bookmarks_position_sub_menu'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_position'] == '2') {
        //
        $option_output['plugin_social_bookmarks_position_placeholder_token'] = '';
        $option_output['plugin_social_bookmarks_position_content_of_main_page'] = '';
        $option_output['plugin_social_bookmarks_position_sys_menu'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_position_sub_menu'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_position'] == '3') {
        //
        $option_output['plugin_social_bookmarks_position_placeholder_token'] = '';
        $option_output['plugin_social_bookmarks_position_content_of_main_page'] = '';
        $option_output['plugin_social_bookmarks_position_sys_menu'] = '';
        $option_output['plugin_social_bookmarks_position_sub_menu'] = 'checked="checked"';
    }
    if ($CONFIG['plugin_social_bookmarks_visibility'] == '0') {
        $option_output['plugin_social_bookmarks_visibility_always_visible'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_visibility_expand_on_click'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_mouseover'] = '';
        $option_output['plugin_social_bookmarks_visibility_display_popup'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_visibility'] == '1') {
        //
        $option_output['plugin_social_bookmarks_visibility_always_visible'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_click'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_visibility_expand_on_mouseover'] = '';
        $option_output['plugin_social_bookmarks_visibility_display_popup'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_visibility'] == '2') {
        //
        $option_output['plugin_social_bookmarks_visibility_always_visible'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_click'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_mouseover'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_visibility_display_popup'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_visibility'] == '3') {
        //
        $option_output['plugin_social_bookmarks_visibility_always_visible'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_click'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_mouseover'] = '';
        $option_output['plugin_social_bookmarks_visibility_display_popup'] = 'checked="checked"';
    }
    if ($CONFIG['plugin_social_bookmarks_greyout'] == '0') {
        $option_output['plugin_social_bookmarks_greyout'] = '';
    } else {
        $option_output['plugin_social_bookmarks_greyout'] = 'checked="checked"';
    }
    if ($CONFIG['plugin_social_bookmarks_layout'] == '0') {
        $option_output['plugin_social_bookmarks_layout_simple_list'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_layout_advanced_list'] = '';
        $option_output['plugin_social_bookmarks_layout_icons_only'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_layout'] == '1') {
        //
        $option_output['plugin_social_bookmarks_layout_simple_list'] = '';
        $option_output['plugin_social_bookmarks_layout_advanced_list'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_layout_icons_only'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_layout'] == '2') {
        //
        $option_output['plugin_social_bookmarks_layout_simple_list'] = '';
        $option_output['plugin_social_bookmarks_layout_advanced_list'] = '';
        $option_output['plugin_social_bookmarks_layout_icons_only'] = 'checked="checked"';
    }
    if ($CONFIG['plugin_social_bookmarks_smart_language'] == '0') {
        $option_output['plugin_social_bookmarks_smart_language'] = '';
    } else {
        $option_output['plugin_social_bookmarks_smart_language'] = 'checked="checked"';
    }
    if ($CONFIG['plugin_social_bookmarks_admin_menu'] == '0') {
        $option_output['plugin_social_bookmarks_admin_menu'] = '';
    } else {
        $option_output['plugin_social_bookmarks_admin_menu'] = 'checked="checked"';
    }
    // Create the table row that is displayed during initial install
    if ($social_bookmarks_installation == 1) {
        $additional_submit_information = '<div class="cpg_message_info">' . $lang_plugin_social_bookmarks['submit_to_install'] . '</div>';
    }
    list($timestamp, $form_token) = getFormToken();
    // Start the actual output
    echo <<<EOT
            <form action="" method="post" name="social_bookmarks_config" id="social_bookmarks_config">
EOT;
    starttable('100%', $social_bookmarks_icon_array['configure'] . $lang_plugin_social_bookmarks['config'], 3);
    echo <<<EOT
                    <tr>
                        <td valign="top" class="tableh2" colspan="3">
                            {$lang_plugin_social_bookmarks['site_integration']}
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb" rowspan="4">
                            {$lang_plugin_social_bookmarks['position_of_button']}
                        </td>
                        <td valign="top" class="tableb">
                            <input type="radio" name="plugin_social_bookmarks_position" id="plugin_social_bookmarks_position_placeholder_token" class="radio" value="0" {$option_output['plugin_social_bookmarks_position_placeholder_token']} /> 
                        </td>
                        <td valign="top" class="tableb">
                        \t<label for="plugin_social_bookmarks_position_placeholder_token" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['placeholder_token']} ({$lang_plugin_social_bookmarks['placeholder_token_explain1']})
                        \t    <br />
                        \t    <span class="album_stat">
                        \t        {$lang_plugin_social_bookmarks['placeholder_token_explain2']}
                        \t    </span>
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                          <td valign="top" class="tableb">
                            <input type="radio" name="plugin_social_bookmarks_position" id="plugin_social_bookmarks_position_content_of_main_page" class="radio" value="1" {$option_output['plugin_social_bookmarks_position_content_of_main_page']} /> 
                        </td>
                        <td valign="top" class="tableb">
                        \t<label for="plugin_social_bookmarks_position_content_of_main_page" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['content_of_main_page']} ({$lang_plugin_social_bookmarks['content_of_main_page_explain1']})
                        \t    <br />
                        \t    <span class="album_stat">
                        \t        {$lang_plugin_social_bookmarks['content_of_main_page_explain2']}
                        \t    </span>
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            <input type="radio" name="plugin_social_bookmarks_position" id="plugin_social_bookmarks_position_sys_menu" class="radio" value="2" {$option_output['plugin_social_bookmarks_position_sys_menu']} /> 
                        </td>
                        <td valign="top" class="tableb">
                        \t<label for="plugin_social_bookmarks_position_sys_menu" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['sys_menu']} ({$lang_plugin_social_bookmarks['menu_explain1']})
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            <input type="radio" name="plugin_social_bookmarks_position" id="plugin_social_bookmarks_position_sub_menu" class="radio" value="3" {$option_output['plugin_social_bookmarks_position_sub_menu']} /> 
                        </td>
                        <td valign="top" class="tableb">
                        \t<label for="plugin_social_bookmarks_position_sub_menu" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['sub_menu']} ({$lang_plugin_social_bookmarks['menu_explain1']})
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableh2" colspan="3">
                            {$lang_plugin_social_bookmarks['design']}
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_social_bookmarks['visibility_of_details']}
                        </td>
                        <td valign="top" class="tableb" colspan="2">
                            <input type="radio" name="plugin_social_bookmarks_visibility" id="plugin_social_bookmarks_visibility_always_visible" class="radio" value="0" {$option_output['plugin_social_bookmarks_visibility_always_visible']} /> 
                        \t<label for="plugin_social_bookmarks_visibility_always_visible" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['always_visible']} ({$lang_plugin_social_bookmarks['not_recommended']})
                        \t</label>
                            <br />
                            <input type="radio" name="plugin_social_bookmarks_visibility" id="plugin_social_bookmarks_visibility_expand_on_click" class="radio" value="1" {$option_output['plugin_social_bookmarks_visibility_expand_on_click']} /> 
                            <label for="plugin_social_bookmarks_visibility_expand_on_click" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['expand_on_click']} ({$lang_plugin_social_bookmarks['recommended']})
                        \t</label>
                            <br />   
                            <input type="radio" name="plugin_social_bookmarks_visibility" id="plugin_social_bookmarks_visibility_expand_on_mouseover" class="radio" value="2" {$option_output['plugin_social_bookmarks_visibility_expand_on_mouseover']} /> 
                        \t<label for="plugin_social_bookmarks_visibility_expand_on_mouseover" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['expand_on_mouseover']}
                        \t</label>
                            <br />
                            <input type="radio" name="plugin_social_bookmarks_visibility" id="plugin_social_bookmarks_visibility_display_popup" class="radio" value="3" {$option_output['plugin_social_bookmarks_visibility_display_popup']} disabled="disabled" /> 
                        \t<label for="plugin_social_bookmarks_visibility_display_popup" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['display_popup']}
                        \t</label>
                        </td>
                    </tr>
\t\t\t\t\t<tr>
                        <td valign="top" class="tableb tableb_alternate">
                            <label for="plugin_social_bookmarks_greyout" class="clickable_option">
                                {$lang_plugin_social_bookmarks['grey_out']}
                            </label>
                        </td>
                        <td valign="top" class="tableb tableb_alternate" colspan="2">
\t\t\t\t\t\t\t<input type="checkbox" name="plugin_social_bookmarks_greyout" id="plugin_social_bookmarks_greyout" class="checkbox" value="1" {$option_output['plugin_social_bookmarks_greyout']} />
\t\t\t\t\t\t\t<label for="plugin_social_bookmarks_greyout" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['grey_out_explain1']}
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_social_bookmarks['layout']}
                        </td>
                        <td valign="top" class="tableb" colspan="2">
                            <input type="radio" name="plugin_social_bookmarks_layout" id="plugin_social_bookmarks_layout_simple_list" class="radio" value="0" {$option_output['plugin_social_bookmarks_layout_simple_list']} /> 
                        \t<label for="plugin_social_bookmarks_layout_simple_list" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['simple_list']} ({$lang_plugin_social_bookmarks['simple_list_explain1']})
                        \t</label>
                            <br />
                            <input type="radio" name="plugin_social_bookmarks_layout" id="plugin_social_bookmarks_layout_advanced_list" class="radio" value="1" {$option_output['plugin_social_bookmarks_layout_advanced_list']} /> 
                            <label for="plugin_social_bookmarks_layout_advanced_list" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['advanced_list']} ({$lang_plugin_social_bookmarks['advanced_list_explain1']})
                        \t</label>
                            <br />   
                            <input type="radio" name="plugin_social_bookmarks_layout" id="plugin_social_bookmarks_layout_icons_only" class="radio" value="2" {$option_output['plugin_social_bookmarks_layout_icons_only']} />
                        \t<label for="plugin_social_bookmarks_layout_icons_only" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['icons_only']} ({$lang_plugin_social_bookmarks['recommended']})
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            {$lang_plugin_social_bookmarks['number_of_columns']}
                        </td>
                        <td valign="top" class="tableb tableb_alternate" colspan="2">
                        \t<input type="text" name="plugin_social_bookmarks_columns" id="plugin_social_bookmarks_columns" class="textinput spin-button" size="2" maxlength="2" value="{$CONFIG['plugin_social_bookmarks_columns']}" />
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableh2" colspan="3">
                            {$lang_plugin_social_bookmarks['options']}
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            <label for="plugin_social_bookmarks_smart_language" class="clickable_option">
                                {$lang_plugin_social_bookmarks['smart_language']}
                            </label>
                        </td>
                        <td valign="top" class="tableb" colspan="2">
                            <input type="checkbox" name="plugin_social_bookmarks_smart_language" id="plugin_social_bookmarks_smart_language" class="checkbox" value="1" {$option_output['plugin_social_bookmarks_smart_language']} /> 
                        \t<label for="plugin_social_bookmarks_smart_language" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['smart_language_explain1']} ({$lang_plugin_social_bookmarks['recommended']})
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            <label for="plugin_social_bookmarks_admin_menu" class="clickable_option">
                                {$lang_plugin_social_bookmarks['admin_menu_item']}
                            </label>
                        </td>
                        <td valign="top" class="tableb tableb_alternate" colspan="2">
                            <input type="checkbox" name="plugin_social_bookmarks_admin_menu" id="plugin_social_bookmarks_admin_menu" class="checkbox" value="1" {$option_output['plugin_social_bookmarks_admin_menu']} /> 
                        \t<label for="plugin_social_bookmarks_admin_menu" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['admin_menu_item_explain1']}
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableh2" colspan="3">
                            {$lang_plugin_social_bookmarks['services']}
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_social_bookmarks['available_services']}
                        </td>
                        <td valign="top" class="tableb" colspan="2">
EOT;
    starttable('100%');
    echo <<<EOT
                            <tr>
                                <th valign="top" class="tableh1">
                                    {$lang_plugin_social_bookmarks['active']}
                                </th>
                                <th valign="top" class="tableh1">
                                    {$lang_plugin_social_bookmarks['service_name']}
                                </th>
\t\t\t\t\t\t\t\t<th valign="top" class="tableh1">
                                    {$lang_plugin_social_bookmarks['link']}
                                </th>
                                <th valign="top" class="tableh1">
                                    {$lang_plugin_social_bookmarks['relevance']}
                                </th>
                                <th valign="top" class="tableh1">
                                    {$lang_plugin_social_bookmarks['languages']}
                                </th>
                            </tr>
EOT;
    $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PREFIX']}plugin_social_bookmarks_services");
    $loopCounter = 0;
    while ($row = mysql_fetch_assoc($result)) {
        if ($row['icon_filename'] != '' && file_exists('plugins/social_bookmarks/images/services/' . $row['icon_filename']) == TRUE) {
            $service_icon = '<img src="plugins/social_bookmarks/images/services/' . $row['icon_filename'] . '" border="0" width="16" height="16" alt="" align="left" class="icon" />';
        } else {
            $service_icon = '<img src="images/spacer.gif" border="0" width="16" height="16" alt="" align="left" class="icon" />';
        }
        if ($loopCounter / 2 == floor($loopCounter / 2)) {
            $tableCellStyle = 'tableb tableb_alternate';
        } else {
            $tableCellStyle = 'tableb';
        }
        $row['service_url'] = str_replace('{u}', urlencode(social_bookmarks_pagelink()), $row['service_url']);
        $row['service_url'] = str_replace('{t}', urlencode($socialBookmarks_title), $row['service_url']);
        unset($service_language);
        $service_language = explode('|', $row['service_lang']);
        $languageFlagString = '';
        foreach ($service_language as $countryLanguage) {
            if ($countryLanguage == 'en') {
                $countryLanguage = 'us';
            }
            if (is_file('images/flags/' . $countryLanguage . '.png') == TRUE) {
                $languageFlagString .= '<img src="images/flags/' . $countryLanguage . '.png" border="0" width="16" height="11" alt="" title="' . $lang_plugin_social_bookmarks[$countryLanguage] . '" /> ';
            } elseif ($countryLanguage == 'multi') {
                $languageFlagString .= cpg_fetch_icon('babelfish', 0, $lang_plugin_social_bookmarks[$countryLanguage]);
            }
        }
        if ($row['service_active'] == 'YES') {
            $option_output['service'] = 'checked="checked"';
        } else {
            $option_output['service'] = '';
        }
        $link_title = sprintf($lang_plugin_social_bookmarks['go_to_servicename'], $row['service_name_full']);
        $relevance = '';
        if ($row['relevance'] < 1 || $row['relevance'] > 10) {
            $row['relevance'] = 0;
        }
        if ($row['relevance'] != 0) {
            $relevance = theme_display_bar($row['relevance'], 10, 150, 'lightsteelblue', '', '', 'lightsteelblue', '');
        }
        $loopCounter++;
        echo <<<EOT
                            <tr>
                                <td valign="top" align="center" class="{$tableCellStyle}">
                                    <input type="checkbox" class="checkbox" name="service_active[{$row['service_id']}]" id="service_active_{$row['service_id']}" value="1" {$option_output['service']} />
                                </td>
                                <td valign="top" class="{$tableCellStyle}">
                                    <label for="service_active_{$row['service_id']}" class="clickable_option">
                                    {$service_icon}
                                    {$row['service_name_full']}
                                    </label>
                                </td>
\t\t\t\t\t\t\t\t<td valign="top" class="{$tableCellStyle}">
                                    <a href="{$row['service_url']}" rel="external">
                                    <img src="images/link.gif" border="0" width="16" height="16" alt="" title="{$link_title}" />
                                    </a>
                                </td>
                                <td valign="top" class="{$tableCellStyle}">
                                    <div title="{$lang_plugin_social_bookmarks['relevance']}: {$row['relevance']}" class="social_bookmarks_relevance">{$relevance}</div>
                                </td>
                                <td valign="top" class="{$tableCellStyle}">
                                    <span class="album_stat">
                                        {$languageFlagString}
                                    </span>
                                </td>
                            </tr>
EOT;
    }
    mysql_free_result($result);
    endtable();
    echo <<<EOT
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" class="tablef">
                        </td>
                        <td valign="middle" class="tablef" colspan="2">
                            <input type="hidden" name="form_token" value="{$form_token}" />
                            <input type="hidden" name="timestamp" value="{$timestamp}" />
                            <button type="submit" class="button" name="submit" value="{$lang_common['ok']}">{$social_bookmarks_icon_array['ok']}{$lang_common['ok']}</button>
                        </td>
                    </tr>
EOT;
    endtable();
    echo <<<EOT
            {$additional_submit_information}
            </form>

EOT;
}
Ejemplo n.º 2
0
function social_bookmarks_content()
{
    global $CONFIG, $LINEBREAK, $USER, $lang_plugin_social_bookmarks, $lang_common, $socialBookmarks_title;
    $return = '';
    $loopCounter = 0;
    $return_array = array();
    if ($CONFIG['plugin_social_bookmarks_smart_language'] == '1') {
        // Determine the visistor's language
        $result = cpg_db_query("SELECT flag, abbr FROM {$CONFIG['TABLE_LANGUAGE']} WHERE lang_id='{$USER['lang']}' LIMIT 1");
        list($user_flag, $user_abbr) = mysql_fetch_row($result);
        mysql_free_result($result);
        if ($user_abbr != '') {
            $user_flag = $user_abbr;
        }
    }
    // Query the services
    $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PREFIX']}plugin_social_bookmarks_services WHERE service_active='YES'");
    while ($row = mysql_fetch_assoc($result)) {
        $row['service_url'] = str_replace('{u}', urlencode(social_bookmarks_pagelink()), $row['service_url']);
        $row['service_url'] = str_replace('{t}', urlencode($socialBookmarks_title), $row['service_url']);
        unset($service_language);
        $service_language = explode('|', $row['service_lang']);
        if ($CONFIG['plugin_social_bookmarks_smart_language'] != '1' || (in_array($user_flag, $service_language) == TRUE || in_array('multi', $service_language) == TRUE)) {
            $return_array[$loopCounter] = '';
            $return_array[$loopCounter] .= '<a href="' . $row['service_url'] . '" rel="external nofollow" title="' . $row['service_name_full'] . '">';
            if ($CONFIG['plugin_social_bookmarks_layout'] == 1 || $CONFIG['plugin_social_bookmarks_layout'] == 2) {
                $return_array[$loopCounter] .= '<img src="plugins/social_bookmarks/images/services/' . $row['icon_filename'] . '" border="0" width="16" height="16" alt="" align="left" class="icon" />';
            }
            if ($CONFIG['plugin_social_bookmarks_layout'] == 0 || $CONFIG['plugin_social_bookmarks_layout'] == 1) {
                $return_array[$loopCounter] .= $row['service_name_short'];
            }
            $return_array[$loopCounter] .= '</a>';
        }
        $loopCounter++;
    }
    $total_records = $loopCounter;
    if ($total_records == 0) {
        // Nothing to return, as no service has been enabled in config
        if (!GALLERY_ADMIN_MODE) {
            return;
        } else {
            return $lang_plugin_social_bookmarks['no_service_activated'];
        }
    }
    // Define HTML output wrappers
    if ($CONFIG['plugin_social_bookmarks_columns'] == 1) {
        $return_start = '<ul class="social_bookmarks_content">';
        $return_end = '</ul>';
        $record_start = '<li class="social_bookmarks_content">';
        $record_end = '</li>';
        // Add a close header
        if ($CONFIG['plugin_social_bookmarks_greyout'] != '1' && $CONFIG['plugin_social_bookmarks_visibility'] == '2') {
            $return .= '<div style="text-align:right;"><img src="images/icons/close.png" border="0" width="16" height="16" alt="" title="' . $lang_common['close'] . '" id="social_bookmarks_close" /></div>';
        }
    } else {
        if ($CONFIG['plugin_social_bookmarks_position'] == '2' || $CONFIG['plugin_social_bookmarks_position'] == '3') {
            $return_start = '<table class="maintable" width="100%">' . $LINEBREAK . '<tbody>';
        } else {
            $return_start = '<table class="maintable">' . $LINEBREAK . '<tbody>';
        }
        $return_start = '<table class="maintable">' . $LINEBREAK . '<tbody>';
        $return_end = '</tbody>' . $LINEBREAK . '</table>';
        $record_start = '<td class="social_bookmarks_content">';
        $record_end = '</td>';
        // Add a close header
        if ($CONFIG['plugin_social_bookmarks_greyout'] != '1' && $CONFIG['plugin_social_bookmarks_visibility'] == '2' && ($CONFIG['plugin_social_bookmarks_position'] == '2' || $CONFIG['plugin_social_bookmarks_position'] == '3')) {
            $return_start .= '<tr><td class="tableh1" style="text-align:right;" colspan="' . $CONFIG['plugin_social_bookmarks_columns'] . '"><img src="images/icons/close.png" border="0" width="16" height="16" alt="" title="' . $lang_common['close'] . '" id="social_bookmarks_close" /></td></tr>';
        }
    }
    $return .= $return_start . $LINEBREAK;
    $loopCounter = 0;
    foreach ($return_array as $service_record) {
        if ($CONFIG['plugin_social_bookmarks_columns'] != 1 && $loopCounter == 0) {
            $return .= '<tr>' . $LINEBREAK;
        }
        $return .= $record_start . $service_record . $record_end . $LINEBREAK;
        $loopCounter++;
        if ($CONFIG['plugin_social_bookmarks_columns'] != 1 && $loopCounter == $CONFIG['plugin_social_bookmarks_columns']) {
            $return .= '</tr>' . $LINEBREAK;
            $loopCounter = 0;
        }
    }
    if ($CONFIG['plugin_social_bookmarks_columns'] != 1 && $loopCounter < $CONFIG['plugin_social_bookmarks_columns']) {
        // Add the missing table cells form well-formedness
        for ($i = $loopCounter; $i < $CONFIG['plugin_social_bookmarks_columns']; $i++) {
            $return .= $record_start . ' ' . $record_end . $LINEBREAK;
        }
        $return .= '</tr>' . $LINEBREAK;
    }
    $return .= $return_end . $LINEBREAK;
    return $return;
}