WordPress AutoUpdater

installare wp-cli -> http://wp-cli.org/

utilizzare questo script

#!/bin / bash

updater(){
        aggiornamento nucleo wp --allow-root
        nucleo wp update-db --allow-root
        aggiorna il plug-wp --all --allow-root
        aggiornamento wp tema --all --allow-root
        aggiornamento linguaggio di base wp --allow-root
        Cgroup = $(stat -c '% G' wp-cron.php)
        CUser = $(stat -c '% U' wp-cron.php)
        chown $ CUser:$cgroup ./* -Rf
}

for i in $(trovare / var / www / vhosts -name wp-cron.php); fare
        wpdir = $(echo $ i | sed -r 's / wp-cron.php // g')
        echo $ wpdir
        cd $ wpdir
        updater
fatto

W3 Total Cache – Errori di decodifica intermittente del browser

Ho modificato il mio W3TC cache del browser di configurazione per disabilitare la compressione gzip.

Tuttavia ho ancora un'intestazione codifica gzip. Sembra che ho introdotto un problema di configurazione con phpfpm (la mia ipotesi in questo momento). Pensavo di aver escluso doppia codifica già, ma ha sbagliato qualcosa. Io confermo la mia ipotesi tardi, ma non sembra W3TC ha nulla a che fare con il mio problema dopo ulteriori indagini.

RSS non funziona – Errore di analisi XML

i had this problem on my WordPress Site. The issue was that i had a blank line at the beginning of my side.

La soluzione:

-> after a long time of research i found out that i had anreturnon my wp-config.php file in the section where i configured the WP-Multisite future.

Collegamento fornitore di miniature cambiamento libary

you must use Version: 5.8.6.7 and change the main php file to

<?php
/*
Plugin Name: Link Library
Plugin URI: http://wordpress.org/extend/plugins/link-library/
Description: Display links on pages with a variety of options
Version: 5.8.6.7
Autore: Yannick Lefebvre
Author URI: http://ylefebvre.ca/

A plugin for the blogging MySQL/PHP-based WordPress.
Diritto d'autore 2014 Yannick Lefebvre

Translations:
French Translation courtesy of Luc Capronnier
Danish Translation courtesy of GeorgWP (http://wordpress.blogos.dk)
Italian Translation courtesy of Gianni Diurno

This program is free software; you can redistribute it and/or
modify it under the terms of the GNUs General Public License
as published addlinkcatlistoverrideby the Free Software Foundation; either version 2
of the License, o (at your option) any later version.

Questo programma è distribuito nella speranza che possa essere utile,
ma SENZA ALCUNA GARANZIA; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; altrimenti, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, Stati Uniti d'America.

You can also view a copy of the HTML version of the GNU General Public
License at http://www.gnu.org/copyleft/gpl.html

I, Yannick Lefebvre, can be contacted via e-mail at ylefebvre@gmail.com
*/

require_once(ABSPATH . '/wp-admin/includes/bookmark.php');

global $my_link_library_plugin;
global $my_link_library_plugin_admin;

Se ( !get_option( 'link_manager_enabled' ) )
    add_filter( 'pre_option_link_manager_enabled', '__return_true' );

Se ( is_admin() ) {
    global $my_link_library_plugin_admin;
    require plugin_dir_path( __FILE__ ) . 'link-library-admin.php';
    $my_link_library_plugin_admin = new link_library_plugin_admin();
}

/*********************************** Link Library Class *****************************************************************************/
class link_library_plugin {

	//constructor of class, PHP4 compatible construction for backward compatibility
	function link_library_plugin() {

        // Functions to be called when plugin is activated and deactivated
        register_activation_hook( __FILE__, array($this, 'll_install' ) );
        register_deactivation_hook( __FILE__, array($this, 'll_uninstall' ) );

		$newoptions = get_option('LinkLibraryPP1', "");

		Se ( $newoptions == "" ) {
            global $my_link_library_plugin_admin;

            Se ( empty( $my_link_library_plugin_admin ) ) {
                require plugin_dir_path( __FILE__ ) . 'link-library-admin.php';
                $my_link_library_plugin_admin = new link_library_plugin_admin();
            }

			$my_link_library_plugin_admin->ll_reset_options(1, 'list');
			$my_link_library_plugin_admin->ll_reset_gen_settings();
		}

		// wp_ajax_... is only run for logged usrs
		//add_action( 'wp_ajax_scn_check_url_action', array( &$this, 'ajax_action_check_url' ) );

		// Add short codes
		add_shortcode('link-library-cats', array($this, 'link_library_cats_func'));
		add_shortcode('link-library-search', array($this, 'link_library_search_func'));
		add_shortcode('link-library-addlink', array($this, 'link_library_addlink_func'));
		add_shortcode('link-library-addlinkcustommsg', array($this, 'link_library_addlink_func'));
		add_shortcode('link-library', array($this, 'link_library_func'));

		// Function to print information in page header when plugin present
		add_action('wp_head', array($this, 'll_rss_link'));

		// Function to determine if Link Library is used on a page before printing headers
		add_filter('the_posts', array($this, 'conditionally_add_scripts_and_styles'));
        // the_posts gets triggered before wp_head

		add_filter('wp_title', array($this, 'll_title_creator'));

		// Re-write rules filters to allow for custom permalinks
		add_filter('rewrite_rules_array', array($this, 'll_insertMyRewriteRules'));
		add_filter('query_vars', array($this, 'll_insertMyRewriteQueryVars'));

        add_action( 'template_redirect', array( $this, 'll_template_redirect' ) );
        add_action( 'wp_ajax_link_library_tracker', array( $this, 'link_library_ajax_tracker' ) );
        add_action( 'wp_ajax_nopriv_link_library_tracker', array( $this, 'link_library_ajax_tracker' ) );
        add_action( 'wp_ajax_link_library_ajax_update', array( $this, 'link_library_ajax_update') );
        add_action( 'wp_ajax_nopriv_link_library_ajax_update', array( $this, 'link_library_ajax_update') );
        add_action( 'wp_ajax_link_library_generate_image', array( $this, 'link_library_generate_image') );
        add_action( 'wp_ajax_nopriv_link_library_generate_image', array( $this, 'link_library_generate_image') );

		// Load text domain for translation of admin pages and text strings
		load_plugin_textdomain( 'link-library', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );

        global $wpdb;

        $wpdb->linkcategorymeta = $wpdb->get_blog_prefix() . "linkcategorymeta";
	}

    /************************** Link Library Installation Function **************************/
    function ll_install() {
        global $wpdb;

        Se (function_exists('is_multisite') && is_multisite()) {
            Se (isset($_GET['networkwide']) && ($_GET['networkwide'] == 1))
            {
                $originalblog = $wpdb->blogid;

                $bloglist = $wpdb->get_col($wpdb->preparare("SELECT blog_id FROM $wpdb->blogs"));
                foreach ($bloglist as $blog) {
                    switch_to_blog($blog);
                    $this->create_table_and_settings();
                }
                switch_to_blog($originalblog);
                return;
            }
        }
        $this->create_table_and_settings();
    }

    function new_network_site($blog_id, $user_id, $domain, $sentiero, $site_id, $meta )
    {
        global $wpdb;

        Se ( ! function_exists('is_plugin_active_for_network') )
            require_once( ABSPATH . '/wp-admin/includes/plugin.php' );

        Se (is_plugin_active_for_network('link-library/link-library.php')) {
            $originalblog = $wpdb->blogid;
            switch_to_blog($blog_id);
            $this->create_table_and_settings();
            switch_to_blog($originalblog);
        }
    }

    function create_table_and_settings()
    {
        global $wpdb;

        $wpdb->links_extrainfo = $this->db_prefix().'links_extrainfo';

        $creationquery = "CREATE TABLE " . $wpdb->links_extrainfo . " (
				link_id bigint(20) NOT NULL DEFAULT '0',
				link_second_url varchar(255) CHARACTER SET utf8 DEFAULT NULL,
				link_telephone varchar(128) CHARACTER SET utf8 DEFAULT NULL,
				link_email varchar(128) CHARACTER SET utf8 DEFAULT NULL,
				link_visits bigint(20) DEFAULT '0',
				link_reciprocal varchar(255) DEFAULT NULL,
				link_submitter varchar(255) DEFAULT NULL,
				link_submitter_name VARCHAR( 128 ) NULL,
				link_submitter_email VARCHAR( 128 ) NULL,
				link_textfield TEXT NULL,
				link_no_follow VARCHAR(1) NULL,
				link_featured VARCHAR(1) NULL,
				link_manual_updated VARCHAR(1) NULL,
				UNIQUE KEY link_id (link_id)
				);";

        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
        dbDelta( $creationquery );

        $wpdb->linkcategorymeta = $this->db_prefix().'linkcategorymeta';

        $meta_creation_query =
            'CREATE TABLE ' . $wpdb->linkcategorymeta . ' (
        meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
        linkcategory_id bigint(20) unsigned NOT NULL DEFAULT "0",
        meta_key varchar(255) DEFAULT NULL,
        meta_value longtext,
        UNIQUE KEY (meta_id)
        );';

        dbDelta ( $meta_creation_query );

        $genoptions = get_option('LinkLibraryGeneral');

        Se ($genoptions != '')
        {
            Se ($genoptions['schemaversion'] == '' || floatval($genoptions['schemaversion']) < 3.5)
            {
                $genoptions['schemaversion'] = "3.5";
                update_option('LinkLibraryGeneral', $genoptions);
            }
            elseif (floatval($genoptions['schemaversion']) < "4.6")
            {
                $genoptions['schemaversion'] = "4.6";
                $wpdb->get_results("ALTER TABLE `" . $this->db_prefix() . "links_extrainfo` ADD `link_submitter_name` VARCHAR( 128 ) NULL, ADD `link_submitter_email` VARCHAR( 128 ) NULL , ADD `link_textfield` TEXT NULL ;");

                update_option('LinkLibraryGeneral', $genoptions);
            }
            elseif (floatval($genoptions['schemaversion']) < "4.7")
            {
                $genoptions['schemaversion'] = "4.7";
                $wpdb->get_results("ALTER TABLE `" . $this->db_prefix() . "links_extrainfo` ADD `link_no_follow` VARCHAR( 1 ) NULL;");

                update_option('LinkLibraryGeneral', $genoptions);
            }
            elseif (floatval($genoptions['schemaversion']) < "4.9")
            {
                $genoptions['schemaversion'] = "4.9";
                $wpdb->get_results("ALTER TABLE `" . $this->db_prefix() . "links_extrainfo` ADD `link_featured` VARCHAR( 1 ) NULL;");

                update_option('LinkLibraryGeneral', $genoptions);
            }

            for ($i = 1; $i <= $genoptions['numberstylesets']; $i++) {
                $settingsname = 'LinkLibraryPP' . $i;
                $options = get_option($settingsname);

                Se ($options != '')
                {
                    Se ($options['showname'] == '')
                        $options['showname'] = true;

                    Se ( isset($options['show_image_and_name'] ) && $options['show_image_and_name'] == true)
                    {
                        $options['showname'] = true;
                        $options['show_images'] = true;
                    }

                    Se ($options['sourcename'] == '')
                        $options['sourcename'] = 'primary';

                    Se ($options['sourceimage'] == '')
                        $options['sourceimage'] = 'primary';

                    Se ($options['dragndroporder'] == '')
                    {
                        Se ($options['imagepos'] == 'beforename')
                            $options['dragndroporder'] = '1,2,3,4,5,6,7,8,9,10,11,12';
                        elseif ($options['imagepos'] == 'aftername')
                            $options['dragndroporder'] = '2,1,3,4,5,6,7,8,9,10,11,12';
                        elseif ($options['imagepos'] == 'afterrssicons')
                            $options['dragndroporder'] = '2,3,4,5,6,1,7,8,9,10,11,12';
                    }
                    else if ($options['dragndroporder'] != '')
                    {
                        $elementarray = explode(',', $options['dragndroporder']);

                        $allelements = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12');
                        foreach ($allelements as $element)
                        {
                            Se (!in_array($element, $elementarray))
                            {
                                $elementarray[] = $element;
                                $options['dragndroporder'] = implode(",", $elementarray);
                            }
                        }
                    }

                    Se ($options['flatlist'] === true) $options['flatlist'] = 'unordered';
                    elseif ($options['flatlist'] === false) $options['flatlist'] = 'table';
                }

                update_option($settingsname, $options);
            }
        }
    }

    function remove_querystring_var($url, $chiave) {

        $keypos = strpos($url, $chiave);
        Se ($keypos)
        {
            $ampersandpos = strpos($url, '&', $keypos);
            $newurl = substr($url, 0, $keypos - 1);

            Se ($ampersandpos)
                $newurl .= substr($url, $ampersandpos);
        }
        else
            $newurl = $url;

        return $newurl;
    }

    /************************** Link Library Uninstall Function **************************/
    function ll_uninstall() {
        $genoptions = get_option('LinkLibraryGeneral');

        Se ($genoptions != '')
        {
            Se ( isset( $genoptions['stylesheet'] ) && isset( $genoptions['fullstylesheet'] ) && $genoptions['stylesheet'] != '' && $genoptions['fullstylesheet'] == '')
            {
                $stylesheetlocation = plugins_url( $genoptions['stylesheet'], __FILE__ );
                Se ( file_exists( $stylesheetlocation ) )
                    $genoptions['fullstylesheet'] = file_get_contents( $stylesheetlocation );

                update_option('LinkLibraryGeneral', $genoptions);
            }
        }
    }

    function db_prefix() {
		global $wpdb;
		Se (method_exists($wpdb, "get_blog_prefix"))
			return $wpdb->get_blog_prefix();
		else
			return $wpdb->prefix;
	}

    	/******************************************** Print style data to header *********************************************/

	function ll_rss_link() {
		global $llstylesheet, $rss_settings;

		Se ($rss_settings != "")
		{
			$settingsname = 'LinkLibraryPP' . $rss_settings;
			$options = get_option($settingsname);

			$feedtitle = ($options['rssfeedtitle'] == "" ? __('Link Library Generated Feed', 'link-library') : $options['rssfeedtitle']);

			$xpath = $this->relativePath( dirname( __FILE__ ), ABSPATH );
			echo '<link rel="alternate" type="application/rss+xml" title="' . esc_html(stripslashes($feedtitle)) . '" href="' . home_url('/?link_library_rss_feed=1&settingset=' . $rss_settings/* . '&xpath=' . $xpath*/) . '" />';
			unset( $xpath );
		}

		Se ($llstylesheet == true)
		{
			$genoptions = get_option('LinkLibraryGeneral');

			eco "<style id='LinkLibraryStyle' type='text/css'>n";
			echo stripslashes($genoptions['fullstylesheet']);
			eco "</style>n";
		}
	}

	/****************************************** Add Link Category name to page title when option is present ********************************/
	function ll_title_creator($title) {
		global $wp_query;
		global $wpdb;
                global $llstylesheet;

                Se ($llstylesheet)
                {
                    $genoptions = get_option('LinkLibraryGeneral');

                    $categoryname = ( isset( $wp_query->query_vars['cat_name'] ) ? $wp_query->query_vars['cat_name'] : '' );
                    $catid = ( isset( $_GET['cat_id'] ) ? intval($_GET['cat_id']) : '' );

                    $linkcatquery = "SELECT t.name ";
                    $linkcatquery .= "FROM " . $this->db_prefix() . "terms t LEFT JOIN " . $this->db_prefix(). "term_taxonomy tt ON (t.term_id = tt.term_id) ";
                    $linkcatquery .= "LEFT JOIN " . $this->db_prefix() . "term_relationships tr ON (tt.term_taxonomy_id = tr.term_taxonomy_id) ";
                    $linkcatquery .= "WHERE tt.taxonomy = 'link_category' AND ";

                    Se ($categoryname != '')
                    {
                            $linkcatquery .= "t.slug = '" . $categoryname . "'";
                            $nicecatname = $wpdb->get_var($linkcatquery);
                            return $title . $genoptions['pagetitleprefix'] . $nicecatname . $genoptions['pagetitlesuffix'];
                    }
                    elseif ($catid != '')
                    {
                            $linkcatquery .= "t.term_id = '" . $catid . "'";
                            //echo $linkcatquery;
                            $nicecatname = $wpdb->get_var($linkcatquery);
                            return $title . $genoptions['pagetitleprefix'] . $nicecatname . $genoptions['pagetitlesuffix'];
                    }
                }

		return $title;
	}

    	/************************************* Function to add to rewrite rules for permalink support **********************************/
	function ll_insertMyRewriteRules($rules)
	{
		$newrules = array();

		$genoptions = get_option('LinkLibraryGeneral');

		Se ($genoptions != '')
		{
			for ($i = 1; $i <= $genoptions['numberstylesets']; $i++) {
				$settingsname = 'LinkLibraryPP' . $i;
				$options = get_option($settingsname);

				Se ($options['enablerewrite'] == true && $options['rewritepage'] != '')
					$newrules['(' . $options['rewritepage'] . ')/(.+?)$'] = 'index.php?pagename=$matches[1]&cat_name=$matches[2]';

				Se ($options['publishrssfeed'] == true)
				{
					$xpath = $this->relativePath( dirname( __FILE__ ), ABSPATH );

					Se ($options['rssfeedaddress'] != '')
						$newrules['(' . $options['rssfeedaddress'] . ')/(.+?)$'] = home_url() . '?link_library_rss_feed=1&settingset=$matches[1]';
					elseif ($options['rssfeedaddress'] == '')
						$newrules['(linkrss)/(.+?)$'] = plugins_url( 'link_library_rss_feed=1?settingset=$matches[1]' . '&xpath=' . $xpath, __FILE__ );

					unset( $xpath );
				}
			}
		}

		return $newrules + $rules;
	}

	// Adding the id var so that WP recognizes it
	function ll_insertMyRewriteQueryVars($vars)
	{
		array_push($vars, 'cat_name');
		return $vars;
	}

    function addhttp( $url ) {
        Se (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
            $url = "http://" . $url;
        }
        return $url;
    }

	/*********************************************** Private Link Library Categories Function *************************************/

	function PrivateLinkLibraryCategories($order = 'name', $hide_if_empty = true, $table_width = 100, $num_columns = 1, $catanchor = true,
				   $flatlist = 'table', $categorylist = '', $excludecategorylist = '', $showcategorydescheaders = false,
				   $showonecatonly = false, $settings = '', $loadingicon = '/icons/Ajax-loader.gif', $catlistdescpos = 'right',
				   $debugmode = false, $pagination = false, $linksperpage = 5, $showcatlinkcount = false, $showonecatmode = 'AJAX',
				   $cattargetaddress = '', $rewritepage = '', $showinvisible = false, $showuserlinks = false, $showcatonsearchresults = false) {

		global $wpdb;

		$output = '';

                $categoryid = '';

		Se (isset($_GET['cat_id']))
			$categoryid = intval($_GET['cat_id']);

		Se (!isset($_GET['searchll']) || $showcatonsearchresults == true)
		{
			$countcat = 0;

			$order = strtolower($order);

			$output .= "<!-- Link Library Categories Output -->nn";

			Se ($showonecatonly == true && ($showonecatmode == 'AJAX' || $showonecatmode == ''))
			{
                $nonce = wp_create_nonce( 'link_library_ajax_refresh' );

				$output .= "<SCRIPT LANGUAGE="JavaScript">n";
				$output .= "var ajaxobject;n";
				$output .= "function showLinkCat ( _incomingID, _settingsID, _pagenumber) {n";
				$output .= "Se (typeof(ajaxobject) != "undefined") { ajaxobject.abort(); }n";

				$output .= "tjQuery('#contentLoading').toggle();" .
                           "jQuery.ajax( {" .
                           "    genere: 'POST', " .
                           "    url: '" . admin_url( 'admin-ajax.php' ) . "', " .
                           "    data: { action: 'link_library_ajax_update', " .
                           "            _ajax_nonce: '" . $nonce . "', " .
                           "            id : _incomingID, " .
                           "            impostazioni : _settingsID, " .
                           "            linkresultpage: _pagenumber }, " .
                           "    success: function( data ){ " .
                           "            jQuery('#linklist" . $impostazioni. "').html( data ); " .
                           "            jQuery('#contentLoading').toggle();n" .
                           "            } } ); ";
				$output .= "}n";

				$output .= "</SCRIPT>nn";
			}

			// Handle link category sorting
			$direction = 'ASC';
			Se (substr($order,0,1) == '_') {
				$direction = 'DESC';
				$order = substr($order,1);
			}

			Se (!isset($direction)) $direction = '';
			// Fetch the link category data as an array of hashesa

			$linkcatquery = "SELECT ";
            Se ( $showcatlinkcount || $pagination ) {
                $linkcatquery .= "count(l.link_name) as linkcount, ";
            }
			$linkcatquery .= "t.name, t.term_id, t.slug as category_nicename, tt.description as category_description ";
			$linkcatquery .= "FROM " . $this->db_prefix() . "terms t LEFT JOIN " . $this->db_prefix(). "term_taxonomy tt ON (t.term_id = tt.term_id)";
			$linkcatquery .= " LEFT JOIN " . $this->db_prefix() . "term_relationships tr ON (tt.term_taxonomy_id = tr.term_taxonomy_id) ";

			$linkcatquery .= " LEFT JOIN " . $this->db_prefix() . "links l on (tr.object_id = l.link_id";

			Se ($showinvisible == false)
				$linkcatquery .= " AND l.link_visible != 'N'";

			Se (!$showuserlinks)
				$linkcatquery .= " AND l.link_description not like '%LinkLibrary:AwaitingModeration:RemoveTextToApprove%' ";

			$linkcatquery .= " ) ";

			$linkcatquery .= "WHERE tt.taxonomy = 'link_category'";

			Se ($categorylist != "")
				$linkcatquery .= " AND t.term_id in (" . $categorylist. ")";

			Se ($excludecategorylist != "")
				$linkcatquery .= " AND t.term_id not in (" . $excludecategorylist . ")";

			Se ($hide_if_empty == true)
				$linkcatquery .= " AND l.link_name != '' ";

			$linkcatquery .= " GROUP BY t.name ";

			Se ($order == "name")
				$linkcatquery .= " ORDER by t.name " . $direction;
			elseif ($order == "id")
				$linkcatquery .= " ORDER by t.term_id " . $direction;
			elseif ($order == "order")
				$linkcatquery .= " ORDER by t.term_order " . $direction;
			elseif ($order == "catlist")
				$linkcatquery .= " ORDER by FIELD(t.term_id," . $categorylist . ") ";

			$catnames = $wpdb->get_results($linkcatquery);

			Se ($debugmode)
			{
				$output .= "n<!-- Category Query: " . print_r($linkcatquery, TRUE) . "-->nn";
				$output .= "n<!-- Category Results: " . print_r($catnames, TRUE) . "-->nn";
			}

			// Display each category

			if ($catnames) {

				$output .=  "<div id="linktable" class="linktable">";

				Se ($flatlist == 'table')
					$output .= "<table width="" . $table_width . "%">n";
				elseif ($flatlist == 'unordered')
					$output .= "<ul class='menu'>n";
				elseif ($flatlist == 'dropdown')
					$output .= "<form name='catselect'><select name='catdropdown' class='catdropdown'>";

				$linkcount = 0;

				foreach ( (array) $catnames as $catname) {
					// Handle each category.
					// Primo, fix the sort_order info
					//$orderby = $cat['sort_order'];
					//$orderby = (bool_from_yn($gatto['sort_desc'])?'_':'') . $orderby;

					$catfront = '';
					$cattext = '';
					$catitem = '';

					// Display the category name
					$countcat += 1;
					Se ($flatlist == 'table' and (($countcat % $num_columns == 1) o ($num_columns == 1) )) $output .= "<tr>n";

					Se ($flatlist == 'table')
						$catfront = '	<td>';
					elseif ($flatlist == 'unordered')
						$catfront = '	<li>';
					elseif ($flatlist == 'dropdown')
					{
						$catfront = '	<option ';
						Se ($categoryid != '' && $categoryid == $catname->term_id)
							$catfront .= 'selected="selected" ';
						$catfront .= 'value="';
					}

					Se ($showonecatonly)
					{
						Se ($showonecatmode == 'AJAX' || $showonecatmode == '')
						{
							Se ($flatlist != 'dropdown')
								$cattext = "<a href='#' onClick="showLinkCat('" . $catname->term_id. "', '" . $impostazioni . "', 1);return false;" >";
							elseif ($flatlist == 'dropdown')
								$cattext = $catname->term_id;
						}
						elseif ($showonecatmode == 'HTMLGET')
						{
							Se ($flatlist != 'dropdown')
								$cattext = "<a href='";

							Se ($cattargetaddress != '' && strpos($cattargetaddress, "?") != false)
							{
								$cattext .= $cattargetaddress;
								$cattext .= "&cat_id=";
							}
							elseif ($cattargetaddress != '' && strpos($cattargetaddress, "?") == false)
							{
								$cattext .= $cattargetaddress;
								$cattext .= "?cat_id=";
							}
							elseif ($cattargetaddress == '')
								$cattext .= "?cat_id=";

							$cattext .= $catname->term_id;

							Se ($flatlist != 'dropdown')
								$cattext .= "'>";
						}
						elseif ($showonecatmode == 'HTMLGETPERM')
						{
							Se ($flatlist != 'dropdown')
								$cattext = "<a href='";

							$cattext .= "/" . $rewritepage . "/" . $catname->category_nicename;

							Se ($flatlist != 'dropdown')
								$cattext .= "'>";
						}
					}
					else if ($catanchor)
					{
						Se (!$pagination)
						{
							Se ($flatlist != 'dropdown')
								$cattext = '<a href="';

							$cattext .= '#' . $catname->category_nicename;

							Se ($flatlist != 'dropdown')
								$cattext .= '">';
						}
						elseif ($pagination)
						{
							Se ($linksperpage == 0 && $linksperpage == '')
								$linksperpage = 5;

							$pageposition = ( $linkcount + 1 ) / $linksperpage;
							$ceilpageposition = ceil($pageposition);
							Se ( $ceilpageposition == 0 && !isset( $_GET['linkresultpage'] ) ) {
								Se ($flatlist != 'dropdown')
									$cattext = '<a href="';

								$cattext .= get_permalink() . '#' . $catname->category_nicename;

								Se ( $flatlist != 'dropdown' )
									$cattext .= '">';
							} altro {
								Se ( $flatlist != 'dropdown' )
									$cattext = '<a href="';

								$cattext .= '?linkresultpage=' . ($ceilpageposition == 0 ? 1 : $ceilpageposition) . '#' . $catname->category_nicename;

								Se ( $flatlist != 'dropdown' )
									$cattext .= '">';
							}

							$linkcount = $linkcount + $catname->linkcount;
						}
					}
					else
						$cattext = '';

					Se ( $flatlist == 'dropdown' )
						$cattext .= '">';

					Se ( $catlistdescpos == 'right' || $catlistdescpos == '' ) {
						$catitem .= '<div class="linkcatname">' . $catname->name . '</div>';
						Se ($showcatlinkcount)
							$catitem .= " (" . $catname->linkcount . ")";
					}

					Se ( $showcategorydescheaders ) {
						$catname->category_description = esc_html($catname->category_description);
						$catname->category_description = str_replace("[", "<", $catname->category_description);
						$catname->category_description = str_replace("]", ">", $catname->category_description);
						$catname->category_description = str_replace("&quot;", """, $catname->category_description);
						$catitem .= "<span class='linkcatdesc'>" . $catname->category_description . "</span>";
					}

					Se ($catlistdescpos == 'left')
					{
						$catitem .= '<div class="linkcatname">' . $catname->name . '</div>';
						Se ($showcatlinkcount)
							$catitem .= " (" . $catname->linkcount . ")";
					}

					Se (($catanchor || $showonecatonly) && $flatlist != 'dropdown')
						$catitem .= "</un>";

					$output .= ($catfront . $cattext . $catitem );

					Se ($flatlist == 'table')
						$catterminator = "	</td>n";
					elseif ($flatlist == 'unordered')
						$catterminator = "	</li>n";
					elseif ($flatlist == 'dropdown')
						$catterminator = "	</option>n";

					$output .= ($catterminator);

					Se ($flatlist == "table" e ($countcat % $num_columns == 0)) $output .= "</tr>n";
				}

				Se ($flatlist == "table" e ($countcat % $num_columns == 3)) $output .= "</tr>n";
				Se ($flatlist == "table" && $catnames)
					$output .= "</table>n";
				elseif ($flatlist == 'unordered' && $catnames)
					$output .= "</ul>n";
				elseif ($flatlist == 'dropdown' && $catnames)
				{
					$output .= "</select>n";
					$output .= "<button type='button' onclick='showcategory()'>" . __('Go!', 'link-library') . "</button>";
					$output .= "</form>";
				}

				$output .= "</div>n";

				Se ($showonecatonly && ($showonecatmode == 'AJAX' || $showonecatmode == ''))
				{
					Se ($loadingicon == '') $loadingicon = '/icons/Ajax-loader.gif';
					$output .= "<div class='contentLoading' id='contentLoading' style='display: none;'><img src='" . plugins_url( $loadingicon, __FILE__ ) . "' alt='Loading data, please wait...'></div>n";
				}

				Se ($flatlist == 'dropdown')
				{
					$output .= "<SCRIPT TYPE='text/javascript'>n";
					$output .= "tfunction showcategory(){n";

					Se ($showonecatonly && ($showonecatmode == 'AJAX' || $showonecatmode == '') )
					{
						$output .= "catidvar = document.catselect.catdropdown.options[document.catselect.catdropdown.selectedIndex].value;";
						$output .= "showLinkCat(catidvar, '" . $impostazioni . "', 1);return false; }";
					}
					altro
					{
						$output .= "ttlocation=n";
						$output .= "document.catselect.catdropdown.options[document.catselect.catdropdown.selectedIndex].value }n";

					}
					$output .= "</SCRIPT>n";
				}
			}
			altro
			{
				$output .= "<div>" . __('No categories found', 'link-library') . ".</div>";
			}

			$output .= "n<!-- End of Link Library Categories Output -->nn";
		}
		return $output;
	}

	function ll_highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>')
	{
		Se ($str == '')
		{
			return '';
		}

		Se ($phrase != '')
		{
			return preg_replace('/('.preg_quote($phrase, '/').'(?![^<]*>))/i', $tag_open."\1".$tag_close, $str);
		}

		return $str;
	}

    function link_library_display_pagination( $previouspagenumber, $nextpagenumber, $numberofpages, $pagenumber, $showonecatonly, $showonecatmode, $AJAXcatid, $impostazioni, $pageID ) {

        $dotbelow = false;
        $dotabove = false;

        $incomingget = $_GET;
        unset ( $incomingget['page_id'] );
        unset ( $incomingget['linkresultpage'] );
        unset ( $incomingget['cat_id'] );

        Se ($numberofpages > 1)
        {
            $paginationoutput = "<div class='pageselector'>";

            Se ($pagenumber != 1)
            {
                $paginationoutput .= "<span class='previousnextactive'>";

                Se (!$showonecatonly) {
                    $argumentarray = array ( 'page_id' => get_the_ID(), 'linkresultpage' => $previouspagenumber );
                    $argumentarray = array_merge( $argumentarray, $incomingget );
                    $targetaddress = add_query_arg( $argumentarray );

                    $paginationoutput .= "<a href='" . $targetaddress . "'>" . __('Previous', 'link-library') . "</un>";
                } elseif ($showonecatonly) {
                    Se ($showonecatmode == 'AJAX' || $showonecatmode == '')
                        $paginationoutput .= "<a href='#' onClick="showLinkCat('" . $AJAXcatid . "', '" . $impostazioni . "', " . $previouspagenumber . ");return false;" >" . __('Previous', 'link-library') . "</un>";
                    elseif ($showonecatmode == 'HTMLGET') {
                        $argumentarray = array ( 'page_id' => $pageID, 'linkresultpage' => $previouspagenumber, 'cat_id' => $AJAXcatid );
                        $argumentarray = array_merge( $argumentarray, $incomingget );
                        $targetaddress = add_query_arg( $argumentarray );

                        $paginationoutput .= "<a href='" . $targetaddress . "' >" . __('Previous', 'link-library') . "</un>";
                    }

                }

                $paginationoutput .= "</span>";
            }
            else
                $paginationoutput .= "<span class='previousnextinactive'>" . __('Previous', 'link-library') . "</span>";

            for ($counter = 1; $counter <= $numberofpages; $counter++)
            {
                Se ($counter <= 2 || $counter >= $numberofpages - 1 || ($counter <= $pagenumber + 2 && $counter >= $pagenumber - 2))
                {
                    Se ($counter != $pagenumber)
                        $paginationoutput .= "<span class='unselectedpage'>";
                    else
                        $paginationoutput .= "<span class='selectedpage'>";

                    Se (!$showonecatonly) {
                        $argumentarray = array ( 'page_id' => $pageID, 'linkresultpage' => $counter );
                        $argumentarray = array_merge( $argumentarray, $incomingget );
                        $targetaddress = add_query_arg( $argumentarray );

                        $paginationoutput .= "<a href='" . $targetaddress . "'>" . $counter . "</un>";
                    } elseif ($showonecatonly) {
                        Se ($showonecatmode == 'AJAX' || $showonecatmode == '')
                            $paginationoutput .= "<a href='#' onClick="showLinkCat('" . $AJAXcatid . "', '" . $impostazioni . "', " . $counter . ");return false;" >" . $counter . "</un>";
                        elseif ($showonecatmode == 'HTMLGET') {
                            $argumentarray = array ( 'page_id' => $pageID, 'linkresultpage' => $counter, 'cat_id' => $AJAXcatid );
                            $argumentarray = array_merge( $argumentarray, $incomingget );
                            $targetaddress = add_query_arg( $argumentarray );

                            $paginationoutput .= "<a href='" . $targetaddress . "' >" . $counter . "</un>";
                        }

                    }

                    $paginationoutput .= "</un></span>";
                }

                Se ($counter >= 2 && $counter < $pagenumber - 2 && $dotbelow == false)
                {
                    $paginationoutput .= "...";
                    $dotbelow = true;
                }

                Se ($counter > $pagenumber + 2 && $counter < $numberofpages - 1 && $dotabove == false)
                {
                    $paginationoutput .= "...";
                    $dotabove = true;
                }
            }

            Se ($pagenumber != $numberofpages)
            {
                $paginationoutput .= "<span class='previousnextactive'>";

                Se (!$showonecatonly) {
                    $argumentarray = array ( 'page_id' => $pageID, 'linkresultpage' => $nextpagenumber );
                    $argumentarray = array_merge( $argumentarray, $incomingget );
                    $targetaddress = add_query_arg( $argumentarray );

                    $paginationoutput .= "<a href='" . $targetaddress . "'>" . __('Next', 'link-library') . "</un>";
                }

                elseif ($showonecatonly)
                {
                    Se ($showonecatmode == 'AJAX' || $showonecatmode == '')
                        $paginationoutput .= "<a href='#' onClick="showLinkCat('" . $AJAXcatid . "', '" . $impostazioni . "', " . $nextpagenumber . ");return false;" >" . __('Next', 'link-library') . "</un>";
                    elseif ($showonecatmode == 'HTMLGET') {
                        $argumentarray = array ( 'page_id' => $pageID, 'linkresultpage' => $nextpagenumber );
                        $argumentarray = array_merge( $argumentarray, $incomingget );
                        $targetaddress = add_query_arg( $argumentarray );

                        $paginationoutput .= "<a href='" . $targetaddress . "' >" . __('Next', 'link-library') . "</un>";
                    }

                }

                $paginationoutput .= "</span>";
            }
            else
                $paginationoutput .= "<span class='previousnextinactive'>" . __('Next', 'link-library') . "</span>";

            $paginationoutput .= "</div>";
        }

        return $paginationoutput;
    }

	function PrivateLinkLibrary($order = 'name', $hide_if_empty = true, $catanchor = true,
									$showdescription = false, $shownotes = false, $showrating = false,
									$showupdated = false, $categorylist = '', $show_images = false,
									$show_image_and_name = false, $use_html_tags = false,
									$show_rss = false, $beforenote = '<br />', $nofollow = false, $excludecategorylist = '',
									$afternote = '', $beforeitem = '<li>', $afteritem = '</li>', $beforedesc = '', $afterdesc = '',
									$displayastable = false, $beforelink = '', $afterlink = '', $showcolumnheaders = false,
									$linkheader = '', $descheader = '', $notesheader = '', $catlistwrappers = 1, $beforecatlist1 = '',
									$beforecatlist2 = '', $beforecatlist3 = '', $divorheader = false, $catnameoutput = 'linklistcatname',
									$show_rss_icon = false, $linkaddfrequency = 0, $addbeforelink = '', $addafterlink = '', $linktarget = '',
									$showcategorydesclinks = false, $showadmineditlinks = true, $showonecatonly = false, $AJAXcatid = '',
									$defaultsinglecat = '', $rsspreview = false, $rsspreviewcount = 3, $rssfeedinline = false,
									$rssfeedinlinecontent = false, $rssfeedinlinecount = 1, $beforerss = '', $afterrss = '',
									$rsscachedir = '', $direction = 'ASC', $linkdirection = 'ASC', $linkorder = 'name',
									$pagination = false, $linksperpage = 5, $hidecategorynames = false, $settings = '',
									$showinvisible = false, $showdate = false, $beforedate = '', $afterdate = '', $catdescpos = 'right',
									$showuserlinks = false, $rsspreviewwidth = 900, $rsspreviewheight = 700, $beforeimage = '', $afterimage = '',
									$imagepos = 'beforename', $imageclass = '', $AJAXpageid = 1, $debugmode = false, $usethumbshotsforimages = false,
									$showonecatmode = 'AJAX', $dragndroporder = '1,2,3,4,5,6,7,8,9,10', $showname = true, $displayweblink = 'false',
									$sourceweblink = 'primary', $showtelephone = 'false', $sourcetelephone = 'primary', $showemail = 'false', $showlinkhits = false,
									$beforeweblink = '', $afterweblink = '', $weblinklabel = '', $beforetelephone = '', $aftertelephone = '', $telephonelabel = '',
									$beforeemail = '', $afteremail = '', $emaillabel = '', $beforelinkhits = '', $afterlinkhits = '', $emailcommand = '',
									$sourceimage = '', $sourcename = '', $thumbshotscid = '', $maxlinks = '', $beforelinkrating = '', $afterlinkrating = '',
									$showlargedescription = false, $beforelargedescription = '', $afterlargedescription = '', $featuredfirst = false, $shownameifnoimage = false,
                                    $enablelinkpopup = false, $popupwidth = 300, $popupheight = 400, $nocatonstartup = false, $linktitlecontent = 'linkname', $paginationposition = 'AFTER', $uselocalimagesoverthumbshots = false, $showlinksonclick = false ) {

		global $wpdb;

		$output = "n<!-- Beginning of Link Library Output -->nn";

        $currentcategory = 1;
        $categoryname = "";

        Se ( $showonecatonly && $showonecatmode == 'AJAX' && $AJAXcatid == '' ) {
            $AJAXnocatset = true;
        } altro {
            $AJAXnocatset = false;
        }

		Se ($showonecatonly && $showonecatmode == 'AJAX' && $AJAXcatid != '' && $_GET['searchll'] == "")
		{
			$categorylist = $AJAXcatid;
		}
		elseif ($showonecatonly && $showonecatmode == 'HTMLGET' && isset($_GET['cat_id']) && ( !isset( $_GET['searchll'] ) || ( isset( $_GET['searchll'] ) && $_GET['searchll'] == "" ) ) )
		{
			$categorylist = intval($_GET['cat_id']);
			$AJAXcatid = $categorylist;
		}
		elseif ($showonecatonly && $showonecatmode == 'HTMLGETPERM' && $_GET['searchll'] == "")
		{
			global $wp_query;

			$categoryname = $wp_query->query_vars['cat_name'];
			$AJAXcatid = $categoryname;
		}
		elseif ($showonecatonly && $AJAXcatid == '' && $defaultsinglecat != '' && ( !isset( $_GET['searchll'] ) || ( isset( $_GET['searchll'] ) && $_GET['searchll'] == "" ) ) )
		{
			$categorylist = $defaultsinglecat;
			$AJAXcatid = $categorylist;
		}
		elseif ($showonecatonly && $AJAXcatid == '' && $defaultsinglecat == '' && $_GET['searchll'] == "")
		{
			$catquery = "SELECT distinct t.name, t.term_id ";
			$catquery .= "FROM " . $this->db_prefix() . "terms t ";
			$catquery .= "LEFT JOIN " . $this->db_prefix() . "term_taxonomy tt ON (t.term_id = tt.term_id) ";
			$catquery .= "LEFT JOIN " . $this->db_prefix() . "term_relationships tr ON (tt.term_taxonomy_id = tr.term_taxonomy_id) ";
			$catquery .= "LEFT JOIN " . $this->db_prefix() . "links l ON (tr.object_id = l.link_id) ";
            $catquery .= "LEFT JOIN " . $this->db_prefix() . "links_extrainfo le ON (l.link_id = le.link_id) ";
			$catquery .= "WHERE tt.taxonomy = 'link_category' ";

			Se ($hide_if_empty)
				$catquery .= "AND l.link_id is not NULL AND l.link_description not like '%LinkLibrary:AwaitingModeration:RemoveTextToApprove%' ";

			Se ($categorylist != "")
				$catquery .= " AND t.term_id in (" . $categorylist. ")";

			Se ($excludecategorylist != "")
				$catquery .= " AND t.term_id not in (" . $excludecategorylist . ")";

			Se ($showinvisible == false)
				$catquery .= " AND l.link_visible != 'N'";

			$mode = "normal";

			$catquery .= " ORDER by ";

			Se ($featuredfirst == true)
				$catquery .= "le.link_featured DESC, ";

			Se ($order == "name")
				$catquery .= " name " . $direction;
			elseif ($order == "id")
				$catquery .= " t.term_id " . $direction;
			elseif ($order == "order")
				$catquery .= " t.term_order " . $direction;
			elseif ($order == "catlist")
				$catquery .= " FIELD(t.term_id," . $categorylist . ") ";

			Se ($linkorder == "name")
				$catquery .= ", link_name " . $linkdirection;
			elseif ($linkorder == "id")
				$catquery .= ", link_id " . $linkdirection;
			elseif ($linkorder == "order")
				$catquery .= ", link_order ". $linkdirection;
			elseif ($linkorder == "Data")
				$catquery .= ", link_updated ". $linkdirection;

			$catitems = $wpdb->get_results($catquery);

			Se ($debugmode)
			{
				$output .= "n<!-- AJAX Default Category Query: " . print_r($catquery, TRUE) . "-->nn";
				$output .= "n<!-- AJAX Default Category Results: " . print_r($catitems, TRUE) . "-->nn";
			}

			Se ($catitems)
			{
				$categorylist = $catitems[0]->term_id;
				$AJAXcatid = $categorylist;
			}
		}

		$linkquery = "SELECT distinct *, l.link_id as proper_link_id, UNIX_TIMESTAMP(l.link_updated) as link_date, ";
		$linkquery .= "IF (DATE_ADD(l.link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated ";
		$linkquery .= "FROM " . $this->db_prefix() . "terms t ";
		$linkquery .= "LEFT JOIN " . $this->db_prefix() . "term_taxonomy tt ON (t.term_id = tt.term_id) ";
		$linkquery .= "LEFT JOIN " . $this->db_prefix() . "term_relationships tr ON (tt.term_taxonomy_id = tr.term_taxonomy_id) ";
		$linkquery .= "LEFT JOIN " . $this->db_prefix() . "links l ON (tr.object_id = l.link_id) ";
		$linkquery .= "LEFT JOIN " . $this->db_prefix() . "links_extrainfo le ON (l.link_id = le.link_id) ";
		$linkquery .= "WHERE tt.taxonomy = 'link_category' ";

		Se ($hide_if_empty)
			$linkquery .= "AND l.link_id is not NULL AND l.link_description not like '%LinkLibrary:AwaitingModeration:RemoveTextToApprove%' ";

		Se ($categorylist != "" || isset($_GET['cat_id']))
			$linkquery .= " AND t.term_id in (" . $categorylist. ")";

		Se ( isset($categoryname) && $categoryname != "" && $showonecatmode == 'HTMLGETPERM')
			$linkquery .= " AND t.slug = '" . $categoryname. "'";

		Se ($excludecategorylist != "")
			$linkquery .= " AND t.term_id not in (" . $excludecategorylist . ")";

		Se ($showinvisible == false)
			$linkquery .= " AND l.link_visible != 'N'";

		Se (isset($_GET['searchll']) && $_GET['searchll'] != "")
		{
            $searchterms = array();
            $searchstring = $_GET['searchll'];

            $offset = 0;
            mentre ( strpos( $searchstring, '"', $offset ) !== false ) {
                Se ( $offset == 0 ) {
                    $offset = strpos( $searchstring, '"' );
                } altro {
                    $endpos = strpos( $searchstring, '"', $offset + 1);
                    $searchterms[] = substr( $searchstring, $offset + 1, $endpos - $offset - 2 );
                    $strlength = ( $endpos + 1 ) - ( $offset + 1 );
                    $searchstring = substr_replace( $searchstring, '', $offset - 1, $endpos + 2 - ( $offset)  );
                    $offset = 0;
                }
            }

            Se ( !empty( $searchstring ) )
            {
                $searchterms = array_merge( $searchterms, explode(" ", $searchstring ) );
            }

			Se ($searchterms)
			{
				$mode = "search";
				$termnb = 1;

				foreach($searchterms as $searchterm)
				{
                    Se ( !empty( $searchterm ) ) {
                        $searchterm = str_replace( '--', '', $searchterm );
                        $searchterm = str_replace( ';', '', $searchterm );
                        $searchterm = esc_html( stripslashes( $searchterm ) );
                        Se ( $searchterm  == true )
                        {
                            Se ($termnb == 1)
                            {
                                $linkquery .= ' AND (link_name like "%' . $searchterm . '%" ';
                                $termnb++;
                            }
                            altro
                            {
                                $linkquery .= ' OR link_name like "%' . $searchterm . '%" ';
                            }

                            Se ($hidecategorynames == false)
                                $linkquery .= ' OR name like "%' . $searchterm . '%" ';
                            Se ($shownotes)
                                $linkquery .= ' OR link_notes like "%' . $searchterm . '%" ';
                            Se ($showdescription)
                                $linkquery .= ' OR link_description like "%' . $searchterm . '%" ';
                            Se ($showlargedescription)
                                $linkquery .= ' OR link_textfield like "%' . $searchterm . '%" ';
                        }
                    }
				}

				$linkquery .= ")";
			}
		}
		else
			$mode = "normal";

		$linkquery .= " ORDER by ";

		Se ($featuredfirst == true)
			$linkquery .= "link_featured DESC, ";

		Se ($order == "name")
			$linkquery .= " name " . $direction;
		elseif ($order == "id")
			$linkquery .= " t.term_id " . $direction;
		elseif ($order == "order")
			$linkquery .= " t.term_order " . $direction;
		elseif ($order == "catlist")
			$linkquery .= " FIELD(t.term_id," . $categorylist . ") ";

		Se ($linkorder == "name" || $linkorder == 'random')
			$linkquery .= ", l.link_name " . $linkdirection;
		elseif ($linkorder == "id")
			$linkquery .= ", l.link_id " . $linkdirection;
		elseif ($linkorder == "order")
			$linkquery .= ", l.link_order ". $linkdirection;
		elseif ($linkorder == "Data")
			$linkquery .= ", l.link_updated ". $linkdirection;

		Se ($pagination && $mode != 'search')
		{
			$linkitemsforcount = $wpdb->get_results($linkquery);

			$numberoflinks = count($linkitemsforcount);

			$quantity = $linksperpage + 1;

            Se ( isset( $_POST['linkresultpage'] ) || isset( $_GET['linkresultpage'] ) ) {

                Se ( isset( $_POST['linkresultpage'] ) ) {
                    $pagenumber = $_POST['linkresultpage'];
                } elseif ( isset( $_GET['linkresultpage'] ) ) {
                    $pagenumber = $_GET['linkresultpage'];
                }

				$startingitem = ($pagenumber - 1) * $linksperpage;
				$linkquery .= " LIMIT " . $startingitem . ", " . $quantity;
			} altro {
				$pagenumber = 1;
				$linkquery .= " LIMIT 0, " . $quantity;
			}
		}

		$linkitems = $wpdb->get_results($linkquery, ARRAY_A);

		Se ($debugmode)
		{
			$output .= "n<!-- Link Query: " . print_r($linkquery, TRUE) . "-->nn";
			$output .= "n<!-- Link Results: " . print_r($linkitems, TRUE) . "-->nn";
		}

		Se ($pagination)
		{
			Se ($linksperpage == 0 && $linksperpage == '')
				$linksperpage = 5;

			Se (count($linkitems) > $linksperpage)
			{
				array_pop($linkitems);
				$nextpage = true;
			}
			else
				$nextpage = false;

			Se( isset( $numberoflinks ) ) {
				$preroundpages = $numberoflinks / $linksperpage;
				$numberofpages = ceil( $preroundpages * 1 ) / 1;
			}
		}

		Se ($linkorder == 'random')
		{
			shuffle($linkitems);
		}

		Se ( $maxlinks != '' ) {
			Se ( is_numeric( $maxlinks ) ) {
				array_splice( $linkitems, $maxlinks );
			}
		}

        Se ($pagination && $mode != "search" && $paginationposition == 'BEFORE' )
        {
            $previouspagenumber = $pagenumber - 1;
            $nextpagenumber = $pagenumber + 1;
            $pageID = get_the_ID();

            $output .= $this->link_library_display_pagination( $previouspagenumber, $nextpagenumber, $numberofpages, $pagenumber, $showonecatonly, $showonecatmode, $AJAXcatid, $impostazioni, $pageID );
        }

        eco "<!-- showonecatmode: " . $showonecatonly . ", AJAXnocatset: " . $AJAXnocatset . ", nocatonstartup: " . $nocatonstartup . "-->";

		// Display links
        if ( ( $linkitems && $showonecatonly && $AJAXnocatset && $nocatonstartup && !isset( $_GET['searchll'] ) ) || ( empty( $linkitems ) && $nocatonstartup && empty( $_GET['searchll'] ) ) ) {
                $output .= "<div id='linklist" . $impostazioni . "' class='linklist'>n";
                $output .= '</div>';
        } elseif ( $linkitems ) {
			$output .= "<div id='linklist" . $impostazioni . "' class='linklist'>n";

			Se ( $mode == 'search' ) {
				$output .= "<div class='resulttitle'>" . __('Search Results for', 'link-library') . " '" . stripslashes( $_GET['searchll'] ) . "'</div>";
			}

			$currentcategoryid = -1;

            $xpath = $this->relativePath( dirname( __FILE__ ), ABSPATH );

			foreach ( $linkitems as $linkitem ) {

				Se ($currentcategoryid != $linkitem['term_id'])
				{
					Se ($currentcategoryid != -1 && $showonecatonly && $_GET['searchll'] == "")
					{
						break;
					}
					Se ($currentcategoryid != -1)
					{
						// Close the last category
						if ($displayastable)
							$output .= "t</table>n";
						else
							$output .= "t</ul>n";

						Se ($catlistwrappers != '')
							$output .= "</div>";

			            Se ( $showlinksonclick ) {
							$output .= "</div>";
						}

						$output .= "</div>";

						$currentcategory = $currentcategory + 1;
					}

					$currentcategoryid = $linkitem['term_id'];
					$output .= "<div class='LinkLibraryCat LinkLibraryCat" . $currentcategoryid . "'>";
					$linkcount = 0;
                    $catlink = '';
                    $cattext = '';
                    $catenddiv = '';

					Se ($catlistwrappers == 1)
						$output .= "<div class="" . $beforecatlist1 . "">";
					else if ($catlistwrappers == 2)
					{
						$remainder = $currentcategory % $catlistwrappers;
						switch ($remainder) {

							Astuccio 0:
								$output .= "<div class="" . $beforecatlist2 . "">";
								break;

							Astuccio 1:
								$output .= "<div class="" . $beforecatlist1 . "">";
								break;
						}
					}
					else if ($catlistwrappers == 3)
					{
						$remainder = $currentcategory % $catlistwrappers;
						switch ($remainder) {

							Astuccio 0:
								$output .= "<div class="" . $beforecatlist3 . "">";
								break;

							Astuccio 2:
								$output .= "<div class="" . $beforecatlist2 . "">";
								break;

							Astuccio 1:
								$output .= "<div class="" . $beforecatlist1 . "">";
								break;
						}
					}

					// Display the category name
					if ($hidecategorynames == false || $hidecategorynames == "")
					{
                        $caturl = get_metadata( 'linkcategory', $linkitem['term_id'], 'linkcaturl', true );

						Se ($catanchor)
							$cattext = '<div id="' . $linkitem['slug'] . '">';
						else
							$cattext = '';

						Se ($divorheader == false)
						{
							Se ($mode == "search")
								foreach ($searchterms as $searchterm)
								{
									$linkitem['name'] = $this->ll_highlight_phrase($linkitem['name'], $searchterm, '<span class="highlight_word">', '</span>');
								}

							$catlink = '<div class="' . $catnameoutput . '">';

							Se ($catdescpos == "right" || $catdescpos == '') {
                                Se ( !empty( $caturl ) ) {
                                    $catlink .= '<a href="' . $this->addhttp( $caturl ) . '" ';

                                    Se ( !empty( $linktarget ) )
                                        $catlink .= ' target="' . $linktarget . '"';

                                    $catlink .= '>';
                                }
                                $catlink .= $linkitem['name'];
                                Se ( !empty( $caturl ) ) {
                                    $catlink .= '</un>';
                                }
                            }

							Se ($showcategorydesclinks)
							{
								$catlink .= "<span class='linklistcatnamedesc'>";
								$linkitem['description'] = str_replace("[", "<", $linkitem['description']);
								$linkitem['description'] = str_replace("]", ">", $linkitem['description']);
								$catlink .= $linkitem['description'];
								$catlink .= '</span>';
							}

							Se ($catdescpos == "left") {
                                Se ( !empty( $caturl ) ) {
                                    $catlink .= '<a href="' . $this->addhttp( $caturl ) . '" ';

                                    Se ( !empty( $linktarget ) )
                                        $catlink .= ' target="' . $linktarget . '"';

                                    $catlink .= '>';
                                }
                                $catlink .= $linkitem['name'];
                                Se ( !empty( $caturl ) ) {
                                    $catlink .= '</un>';
                                }
                            }

                            Se ( $showlinksonclick ) {
                                $catlink .= '<span class="expandlinks" id="LinksInCat' . $linkitem['term_id'] . '">';
                                $catlink .= '<img src="' . plugins_url( 'icons/expand-32.png', __FILE__ ) . '" />';
                                $catlink .= '</span>';
                            }

							$catlink .= "</div>";
						}
						else if ($divorheader == true)
						{
							Se ($mode == "search")
							foreach ($searchterms as $searchterm)
							{
								$linkitem['name'] = $this->ll_highlight_phrase($linkitem['name'], $searchterm, '<span class="highlight_word">', '</span>');
							}

							$catlink = '<div class="'. $catnameoutput . '">';

							Se ($catdescpos == "right" || $catdescpos == '') {
                                Se ( !empty( $caturl ) ) {
                                    $catlink .= '<a href="' . $this->addhttp( $caturl ). '" ';

                                    Se ( !empty( $linktarget ) )
                                        $catlink .= ' target="' . $linktarget . '"';

                                    $catlink .= '>';
                                }
                                $catlink .= $linkitem['name'];
                                Se ( !empty( $caturl ) ) {
                                    $catlink .= '</un>';
                                }
                            }


							Se ($showcategorydesclinks)
							{
								$catlink .= "<span class='linklistcatnamedesc'>";
								$linkitem['description'] = str_replace("[", "<", $linkitem['description']);
								$linkitem['description'] = str_replace("]", ">", $linkitem['description']);
								$catlink .= $linkitem['description'];
								$catlink .= '</span>';
							}

							Se ($catdescpos == "left") {
                                Se ( !empty( $caturl ) ) {
                                    $catlink .= '<a href="' . $this->addhttp( $caturl ) . '" ';

                                    Se ( !empty( $linktarget ) )
                                        $catlink .= ' target="' . $linktarget . '"';

                                    $catlink .= '>';
                                }
                                $catlink .= $linkitem['name'];
                                Se ( !empty( $caturl ) ) {
                                    $catlink .= '</un>';
                                }
                            }

                            Se ( $showlinksonclick ) {
                                $catlink .= '<span class="expandlinks" id="LinksInCat' . $linkitem['term_id'] . '">';
                                $catlink .= '<img src="' . plugins_url( 'icons/expand-32.png', __FILE__ ) . '" />';
                                $catlink .= '</span>';
                            }

							$catlink .= '</div>';
						}

						Se ($catanchor)
							$catenddiv = '</div>';
						else
							$catenddiv = '';
					}

                    $output .= $cattext . $catlink . $catenddiv;

                    Se ( $showlinksonclick ) {
                        $output .= '<div class="LinksInCat' . $currentcategoryid . ' LinksInCat">';
                    }

					Se ($displayastable == true)
					{
						$catstartlist = "nt<table class='linklisttable'>n";
						Se ($showcolumnheaders == true)
						{
							$catstartlist .= "<div class='linklisttableheaders'><tr>";

							Se ($linkheader != "")
								$catstartlist .= "<th><div class='linklistcolumnheader'>".$linkheader."</div></th>";

							Se ($descheader != "")
								$catstartlist .= "<th><div class='linklistcolumnheader'>".$descheader."</div></th>";

							Se ($notesheader != "")
								$catstartlist .= "<th><div class='linklistcolumnheader'>".$notesheader."</div></th>";

							$catstartlist .= "</tr></div>n";
						}
						else
							$catstartlist .= '';
					}
					else
						$catstartlist = "nt<ul>n";

					$output .= $catstartlist;
				}

				$between = "n";

				Se ($rssfeedinline == true)
					include_once(ABSPATH . WPINC . '/feed.php');

				Se ($showuserlinks == true || strpos($linkitem['link_description'], "LinkLibrary:AwaitingModeration:RemoveTextToApprove") == false)
				{
					$linkcount = $linkcount + 1;

					Se ($linkaddfrequency > 0)
						Se (($linkcount - 1) % $linkaddfrequency == 0)
							$output .= stripslashes($addbeforelink);

					Se (!isset($linkitem['recently_updated'])) $linkitem['recently_updated'] = false;
					$output .= stripslashes($beforeitem);
					Se ($showupdated && $linkitem['recently_updated'])
						$output .= get_option('links_recently_updated_prepend');

					$the_link = '#';
					Se (!empty($linkitem['link_url']) )
						$the_link = esc_html($linkitem['link_url']);

					$the_second_link = '#';
					Se (!empty($linkitem['link_second_url']) )
						$the_second_link = esc_html($linkitem['link_second_url']);

					$rel = $linkitem['link_rel'];
					Se ('' != $rel and !$nofollow and !$linkitem['link_no_follow'])
						$rel = ' rel="' . $rel . '"';
					else if ('' != $rel and ($nofollow or $linkitem['link_no_follow']))
						$rel = ' rel="' . $rel . ' nofollow"';
					else if ('' == $rel and ($nofollow or $linkitem['link_no_follow']))
						$rel = ' rel="nofollow"';

					Se ($use_html_tags) {
						$descnotes = $linkitem['link_notes'];
						$descnotes = str_replace("[", "<", $descnotes);
						$descnotes = str_replace("]", ">", $descnotes);
					}
					else
						$descnotes = esc_html($linkitem['link_notes'], ENT_QUOTES);

					Se ($use_html_tags) {
						$desc = $linkitem['link_description'];
						$desc = str_replace("[", "<", $desc);
						$desc = str_replace("]", ">", $desc);
					} altro {
						$desc = esc_html($linkitem['link_description'], ENT_QUOTES);
					}

					$cleandesc = $desc;
					$cleanname = esc_html($linkitem['link_name'], ENT_QUOTES);

                    Se ( $use_html_tags ) {
                        $textfield = stripslashes( $linkitem['link_textfield'] );
                        $textfield = str_replace( '[', '<', $textfield );
						$textfield = str_replace( ']', '>', $textfield );
                    } altro {
                        $textfield = stripslashes( $linkitem['link_textfield'] );
                    }


					Se ($mode == "search")
					{
						foreach ($searchterms as $searchterm)
						{
							$descnotes = $this->ll_highlight_phrase($descnotes, $searchterm, '<span class="highlight_word">', '</span>');
							$desc = $this->ll_highlight_phrase($desc, $searchterm, '<span class="highlight_word">', '</span>');
							$name = $this->ll_highlight_phrase($linkitem['link_name'], $searchterm, '<span class="highlight_word">', '</span>');
							$textfield = $this->ll_highlight_phrase($textfield, $searchterm, '<span class="highlight_word">', '</span>');
						}
				}
					else
						$name = $cleanname;

                    Se ( $linktitlecontent == 'linkname' ) {
                        $title = $cleanname;
                    } elseif ($linktitlecontent == 'linkdesc' ) {
                        $title = $cleandesc;
                    }

					Se ($showupdated) {
					   Se (substr($linkitem['wp.dev'],0,2) != '00') {
							$title .= ' ('.__('Last updated', 'link-library') . '  ' . date_i18n(get_option('links_updated_date_format'), strtotime( $linkitem['link_updated'] ) ) .')';
						}
					}

					Se (!empty( $title ) )
						$title = ' title="' . $title . '"';

					$alt = ' alt="' . $cleanname . '"';

					$target = $linkitem['link_target'];
					Se ('' != $target)
						$target = ' target="' . $target . '"';
					altro
					{
						$target = $linktarget;
						Se ('' != $target)
							$target = ' target="' . $target . '"';
					}

					Se ($dragndroporder == '') $dragndroporder = '1,2,3,4,5,6,7,8,9,10';
						$dragndroparray = explode(',', $dragndroporder);
						Se ($dragndroparray)
						{
							foreach ($dragndroparray as $arrayelements) {
								switch ($arrayelements) {
									Astuccio 1: 	//------------------ Image Output --------------------
                                        $imageoutput = '';
										Se ( (($linkitem['link_image'] != '' || $usethumbshotsforimages)) && ($show_images)) {
											$imageoutput .= stripslashes($beforeimage) . '<a href="';

                                            Se ( !$enablelinkpopup ) {
                                                Se ($sourceimage == 'primary' || $sourceimage == '')
                                                    $imageoutput .= $the_link;
                                                elseif ($sourceimage == 'secondary')
                                                    $imageoutput .= $the_second_link;
                                            } altro {
                                                    $imageoutput .= home_url() . '/?link_library_popup_content=1&linkid=' . $linkitem['proper_link_id'] . '&settings=' . $impostazioni . '&height=' . ( empty( $popupheight ) ? 300 : $popupheight ) . '&width=' . ( empty( $popupwidth ) ? 400 : $popupwidth ) . '&xpath=' . $xpath;
                                                }

											$imageoutput .= '" id="link-' . $linkitem['proper_link_id'] . '" class="' . ( $enablelinkpopup ? 'thickbox' : 'track_this_link' ) . ' ' . ( $linkitem['link_featured'] ? 'featured' : '' ). '" ' . $rel . $title . $target. '>';

											Se ( $usethumbshotsforimages && ( !$uselocalimagesoverthumbshots || empty( $uselocalimagesoverthumbshots ) || ( $uselocalimagesoverthumbshots && empty( $linkitem['link_image'] ) ) ) ) {
												Se ( !empty( $thumbshotscid ) )
													$imageoutput .= '<img src="http://free.pagepeeker.com/v2/thumbs.php?size=s&url='  . $the_link . '"';


											} else if ( !$usethumbshotsforimages || ( $usethumbshotsforimages && $uselocalimagesoverthumbshots && !empty( $linkitem['link_image'] ) ) ) {
                                                Se ( strpos($linkitem['link_image'], 'http') !== false )
                                                    $imageoutput .= '<img src="http://free.pagepeeker.com/v2/thumbs.php?size=s&url='  . $the_link . '"';
                                                altro // If it's a relative path
                                                    $imageoutput .= '<img src="http://free.pagepeeker.com/v2/thumbs.php?size=s&url='  . $the_link . '"';
                                            }

                                            Se ( !$usethumbshotsforimages || ($usethumbshotsforimages && !empty( $thumbshotscid ) ) || ( $usethumbshotsforimages && $uselocalimagesoverthumbshots && !empty( $linkitem['link_image'] ) ) ) {

                                                $imageoutput .= $alt . $title;

                                                Se ($imageclass != '')
                                                    $imageoutput .= ' class="' . $imageclass . '" ';

                                                $imageoutput .= "/>";

                                                $imageoutput .= '</un>' . stripslashes($afterimage);
                                            }
                                        }

										Se ( ( !empty( $imageoutput ) || ( $usethumbshotsforimages && !empty( $thumbshotscid ) ) )  && ($show_images) ) {
											$output .= $imageoutput;
											break;
										}
										elseif ($show_images == false || $shownameifnoimage == false)
											break;

									Astuccio 2: 	//------------------ Name Output --------------------
										Se (($showname == true) || ($show_images == true && $linkitem['link_image'] == '' && $arrayelements == 1))
										{
											$output .= stripslashes($beforelink);

											Se (($sourcename == 'primary' && $the_link != '#') || ($sourcename == 'secondary' && $the_second_link != '#'))
											{
												$output .= '<a href="';

												Se ( !$enablelinkpopup ) {
                                                    Se ( $sourcename == 'primary' || $sourcename == '' )
                                                        $output .= $the_link;
                                                    elseif ( $sourcename == 'secondary' )
    													$output .= $the_second_link;
                                                } altro {
                                                    $output .= home_url() . '/?link_library_popup_content=1&linkid=' . $linkitem['proper_link_id'] . '&settings=' . $impostazioni . '&height=' . ( empty( $popupheight ) ? 300 : $popupheight ) . '&width=' . ( empty( $popupwidth ) ? 400 : $popupwidth ) . '&xpath=' . $xpath;
                                                }

												$output .= '" id="link-' . $linkitem['proper_link_id'] . '" class="' . ( $enablelinkpopup ? 'thickbox' : 'track_this_link' ) . ' ' . ( $linkitem['link_featured'] ? ' featured' : '' ). '" ' . $rel . $title . $target. '>';
											}

											$output .= $name;

											Se (($sourcename == 'primary' && $the_link != '#') || ($sourcename == 'secondary' && $the_second_link != '#'))
												$output .= '</un>';

											Se (($showadmineditlinks) && current_user_can("manage_links")) {
												$output .= $between . '<a href="' . add_query_arg( array( 'action' => 'edit', 'link_id' => $linkitem['proper_link_id'] ), admin_url( 'link.php' ) ) . '">(' . __('Edit', 'link-library') . ')</un>';
											}

											Se ($showupdated && $linkitem['recently_updated']) {
												$output .= get_option('links_recently_updated_append');
											}

											$output .= stripslashes($afterlink);
										}

										break;

									Astuccio 3: 	//------------------ Date Output --------------------

										$formatteddate = date_i18n(get_option('links_updated_date_format'), $linkitem['link_date']);

										Se ($showdate)
											$output .= $between . stripslashes($beforedate) . $formatteddate . stripslashes($afterdate);

										break;

									Astuccio 4: 	//------------------ Description Output --------------------

										Se ($showdescription)
											$output .= $between . stripslashes($beforedesc) . $desc . stripslashes($afterdesc);

										break;

									Astuccio 5: 	//------------------ Notes Output --------------------

										Se ($shownotes) {
											$output .= $between . stripslashes($beforenote) . $descnotes . stripslashes($afternote);
										}

										break;

									Astuccio 6: 	//------------------ RSS Icons Output --------------------

										Se ($show_rss || $show_rss_icon || $rsspreview)
											$output .= stripslashes($beforerss) . '<div class="rsselements">';

										Se ($show_rss && ($linkitem['link_rss'] != '')) {
											$output .= $between . '<a class="rss" href="' . $linkitem['link_rss'] . '">RSS</un>';
										}
										Se ($show_rss_icon && ($linkitem['link_rss'] != '')) {
											$output .= $between . '<a class="rssicon" href="' . $linkitem['link_rss'] . '"><img src="' . plugins_url( 'icons/feed-icon-14x14.png', __FILE__ ) . '" /></un>';
										}
										Se ($rsspreview && $linkitem['link_rss'] != '')
										{
											$output .= $between . '<a href="' . home_url() . '/?link_library_rss_preview=1&keepThis=true&linkid=' . $linkitem['proper_link_id'] . '&previewcount=' . $rsspreviewcount . 'height=' . (($rsspreviewwidth == "") ?  900 : $rsspreviewwidth) . '&width=' . (($rsspreviewheight == "") ? 700 : $rsspreviewheight) . '&xpath=' . urlencode( $xpath ) . '" title="' . __('Preview of RSS feed for', 'link-library') . ' ' . $cleanname . '" class="thickbox"><img src="' . plugins_url( 'icons/preview-16x16.png', __FILE__ ) . '" /></un>';
										}

										Se ($show_rss || $show_rss_icon || $rsspreview)
											$output .= '</div>' . stripslashes($afterrss);

										Se ($rssfeedinline && $linkitem['link_rss'])
										{
											$rss = fetch_feed($linkitem['link_rss']);
											Se (!is_wp_error( $rss ) ) :
												$maxitems = $rss->get_item_quantity($rssfeedinlinecount);

												$rss_items = $rss->get_items(0, $maxitems);

												Se ($rss_items)
												{
													$output .= '<div id="ll_rss_results">';

													foreach($rss_items as $item)
													{
														$output .= '<div class="chunk" style="padding:0 5px 5px;">';
														$output .= '<div class="rsstitle"><a target="feedwindow" href="' . $item->get_permalink() . '">' . $item->get_title() . '</un> - ' . $item->get_date('j F Y | g:i a') . '</div>';
														Se ($rssfeedinlinecontent) $output .= '<div class="rsscontent">' . $item->get_description() . '</div>';
														$output .= '</div>';
														$output .= '<br />';													}

													$output .= '</div>';
												}

											endif;
										}
										break;
									Astuccio 7: 	//------------------ Web Link Output --------------------

										Se ($displayweblink != 'false') {
											$output .= $between . stripslashes($beforeweblink) . "<a href='";

											Se ($sourceweblink == "primary" || $sourceweblink == "")
												$output .= $the_link;
											elseif ($sourceweblink == "secondary")
												$output .= $the_second_link;

											$output .= "' id='link-" . $linkitem['proper_link_id'] . "' class='track_this_link' " . $target . ">";

											Se ($displayweblink == 'address')
											{
												Se (($sourceweblink == "primary" || $sourceweblink == '') && $the_link != '')
													$output .= $the_link;
												elseif ($sourceweblink == "secondary" && $the_second_link != '')
													$output .= $the_second_link;
											}
											elseif ($displayweblink == 'label' && $weblinklabel != '')
												$output .= $weblinklabel;

											$output .= "</un>" . stripslashes($afterweblink);
										}

										break;
									Astuccio 8: 	//------------------ Telephone Output --------------------

										Se ($showtelephone != 'false')
										{
											$output .= $between . stripslashes($beforetelephone);

											Se ($showtelephone != 'plain')
											{
												$output .= "<a href='";

												Se (($sourcetelephone == "primary" || $sourcetelephone == '') && $the_link != '')
													$output .= $the_link;
												elseif ($sourcetelephone == "secondary" && $the_second_link != '')
													$output .= $the_second_link;

												$output .= "' id='link-" . $linkitem['proper_link_id'] . "' class='track_this_link' >";
											}

											Se ($showtelephone == 'link' || $showtelephone == "plain")
												$output .= $linkitem['link_telephone'];
											elseif ($showtelephone == 'label')
												$output .= $telephonelabel;

											Se ($showtelephone != 'plain')
												$output .= "</un>";

											$output .= stripslashes($aftertelephone);
										}
										break;
									Astuccio 9: 	//------------------ E-mail Output --------------------

										Se ($showemail != 'false')
										{
											$output .= $between . stripslashes($beforeemail);

											Se ($showemail != 'plain')
											{
												$output .= "<a href='";

												Se ($showemail == 'mailto' || $showemail == 'mailtolabel')
													$output .= "mailto:" . $linkitem['link_email'];
												elseif ($showemail == 'command' || $showemail == 'commandlabel')
												{
													$newcommand = str_replace("#e-mail", $linkitem['link_email'], $emailcommand);
													$cleanlinkname = str_replace(" ", "%20", $linkitem['link_name']);
													$newcommand = str_replace("#azienda", $cleanlinkname, $newcommand);
													$output .= $newcommand;
												}

												$output .= "'>";
											}

											Se ($showemail == 'plain' || $showemail == 'mailto' || $showemail == 'command')
												$output .= $linkitem['link_email'];
											elseif ($showemail == 'mailtolabel' || $showemail == 'commandlabel')
												$output .= $emaillabel;

											Se ($showemail != 'plain')
												$output .= "</un>";

											$output .= stripslashes($afteremail);
										}

										break;
									Astuccio 10: 	//------------------ Link Hits Output --------------------

										Se ($showlinkhits)
										{
											$output .= $between . stripslashes($beforelinkhits);

											$output .= $linkitem['link_visits'];

											$output .= stripslashes($afterlinkhits);
										}

										break;

									Astuccio 11: 	//------------------ Link Rating Output --------------------

										Se ($showrating)
										{
											$output .= $between . stripslashes($beforelinkrating);

											$output .= $linkitem['link_rating'];

											$output .= stripslashes($afterlinkrating);
										}

										break;

									Astuccio 12: 	//------------------ Link Large Description Output --------------------

										Se ($showlargedescription)
										{
											$output .= $between . stripslashes($beforelargedescription);

											$output .= $textfield;

											$output .= stripslashes($afterlargedescription);
										}

										break;
									}
								}
							}

					$output .= stripslashes($afteritem) . "n";

					Se ($linkaddfrequency > 0)
						Se ($linkcount % $linkaddfrequency == 0)
							$output .= stripslashes($addafterlink);

				}

			} // end while

			// Close the last category
			if ($displayastable)
				$output .= "t</table>n";
			else
				$output .= "t</ul>n";

			Se ($catlistwrappers != '')
				$output .= "</div>";

            Se ( $showlinksonclick ) {
                $output .= "</div>";
            }

			$output .= "</div>";

			Se ( $pagination && $mode != "search" && ( $paginationposition == 'AFTER' || empty( $pagination ) ) ) {
                $previouspagenumber = $pagenumber - 1;
                $nextpagenumber = $pagenumber + 1;
                $pageID = get_the_ID();

                $output .= $this->link_library_display_pagination( $previouspagenumber, $nextpagenumber, $numberofpages, $pagenumber, $showonecatonly, $showonecatmode, $AJAXcatid, $impostazioni, $pageID );
			}

			$xpath = $this->relativePath( dirname( __FILE__ ), ABSPATH );
            $nonce = wp_create_nonce( 'll_tracker' );

			$output .= "<script type='text/javascript'>n";
			$output .= "jQuery(document).ready(function()n";
			$output .= "{n";
			$output .= "jQuery('a.track_this_link').click(function() {n";
			$output .= "linkid = this.id;n";
			$output .= "linkid = linkid.substring(5);";
			$output .= "path = '" . $xpath . "';";
			$output .= "jQuery.ajax( {" .
                       "    genere: 'POST'," .
                       "    url: '" . admin_url( 'admin-ajax.php' ) . "', " .
                       "    data: { action: 'link_library_tracker', " .
                       "            _ajax_nonce: '" . $nonce . "', " .
                       "            id:linkid, xpath:sentiero } " .
                       "    });n";
			$output .= "return true;n";
			$output .= "});n";
            $output .= "jQuery('#linklist" . $impostazioni . " .expandlinks').click(function() {n";
            $output .= "target = '.' + jQuery(this).attr('id');n";
            $output .= "Se ( jQuery( target ).è(':visible') ) {n";
            $output .= "jQuery(target).slideUp();n";
            $output .= "jQuery(this).children('img').attr('src', '" . plugins_url( 'icons/expand-32.png', __FILE__ ) . "');n";
            $output .= "} altro {n";
            $output .= "jQuery(target).slideDown();n";
            $output .= "jQuery(this).children('img').attr('src', '" . plugins_url( 'icons/collapse-32.png', __FILE__ ) . "');n";
            $output .= "}n";
            $output .= "});n";
			$output .= "});n";
			$output .= "</script>";
			unset( $xpath );
			$currentcategory = $currentcategory + 1;

			$output .= "</div>n";

		} else if ( isset( $_GET['searchll'] ) ) {
            $output .= "<div id='linklist" . $impostazioni . "' class='linklist'>n";
            $output .= __('No links found matching your search criteria', 'link-library') . ".n";
            $output .= "</div>";
        } altro {
			$output .= "<div id='linklist" . $impostazioni . "' class='linklist'>n";
			$output .= __('No links found', 'link-library') . ".n";
			$output .= "</div>";
		}

		$output .= "n<!-- End of Link Library Output -->nn";

		return $output;
	}

	function PrivateLinkLibrarySearchForm($searchlabel = 'Search', $searchresultsaddress = '') {

		Se ($searchlabel == "") $searchlabel = __('Search', 'link-library');
		$output = "<form method='get' id='llsearch'";
                Se ($searchresultsaddress != '')
                    $output .= " action='" . $searchresultsaddress . "'";
                $output .= ">n";
		$output .= "<div>n";
		$output .= "<input type='text' onfocus="this.value=''" value='" . $searchlabel . "...' name='searchll' id='searchll' />";
		$output .= "<input type='hidden' value='" .  get_the_ID() . "' name='page_id' id='page_id' />";
		$output .= "<input type='submit' value='" . $searchlabel . "' />";
		$output .= "</div>n";
		$output .= "</form>nn";

		return $output;
	}

	function PrivateLinkLibraryAddLinkForm($selectedcategorylist = '', $excludedcategorylist = '', $addnewlinkmsg = '', $linknamelabel = '', $linkaddrlabel = '',
											$linkrsslabel = '', $linkcatlabel = '', $linkdesclabel = '', $linknoteslabel = '', $addlinkbtnlabel = '', $hide_if_empty = true,
											$showaddlinkrss = false, $showaddlinkdesc = false, $showaddlinkcat = false, $showaddlinknotes = false,
											$addlinkreqlogin = false, $debugmode = false, $addlinkcustomcat = false, $linkcustomcatlabel = '',
											$linkcustomcatlistentry = 'User-submitted category (define below)', $showaddlinkreciprocal = false,
											$linkreciprocallabel = '', $showaddlinksecondurl = false, $linksecondurllabel = '',
											$showaddlinktelephone = false, $linktelephonelabel = '', $showaddlinkemail = false, $linkemaillabel = '',
											$showcaptcha = false, $captureddata = '', $linksubmitternamelabel = '', $showlinksubmittername = false,
											$linksubmitteremaillabel = '', $showaddlinksubmitteremail = false, $linksubmittercommentlabel = '',
											$showlinksubmittercomment = false, $linksubmissionthankyouurl = '', $addlinkcatlistoverride = '',
											$showcustomcaptcha = false, $customcaptchaquestion = '', $linklargedesclabel = 'Large Description', $showuserlargedescription = false, $usetextareaforusersubmitnotes = false, $settings = 1, $code = 'link-library-addlink') {

		global $wpdb;
                $output = "";

                $settingsname = 'LinkLibraryPP' . $impostazioni;
                $options = get_option($settingsname);

                Se ($code == 'link-library-addlink' || $code == 'link-library-addlinkcustommsg')
                {
                    Se (isset($_GET['addlinkmessage']))
                        {
                            Se ($_GET['addlinkmessage'] == 1)
                                $output = "<div class='llmessage'>" . __('Confirm code not given', 'link-library') . ".</div>";
                            elseif ($_GET['addlinkmessage'] == 2)
                                $output = "<div class='llmessage'>" . __('Captcha code is wrong', 'link-library') . ".</div>";
                            elseif ($_GET['addlinkmessage'] == 3)
                                $output = "<div class='llmessage'>" . __('Captcha code is only valid for 5 minutes', 'link-library') . ".</div>";
                            elseif ($_GET['addlinkmessage'] == 4)
                                $output = "<div class='llmessage'>" . __('No captcha cookie given. Make sure cookies are enabled', 'link-library') . ".</div>";
                            elseif ($_GET['addlinkmessage'] == 5)
                                $output = "<div class='llmessage'>" . __('Captcha answer was not provided.', 'link-library') . "</div>";
                            elseif ($_GET['addlinkmessage'] == 6)
                                $output = "<div class='llmessage'>" . __('Captcha answer is incorrect', 'link-library') . ".</div>";
                            elseif ($_GET['addlinkmessage'] == 7)
                                $output = "<div class='llmessage'>" . __('User Category was not provided correctly. Link insertion failed.', 'link-library') . "</div>";
                            elseif ($_GET['addlinkmessage'] == 8)
                            {
                                $output .= "<div class='llmessage'>" . $options['newlinkmsg'];
                                Se ($options['showuserlinks'] == false)
                                        $output .= " " . $options['moderatemsg'];
                                $output .= "</div>";
                            }
                            elseif ($_GET['addlinkmessage'] == 9)
                                $output = "<div class='llmessage'>" . __('Error: Link does not have an address.', 'link-library') . "</div>";
                            elseif ($_GET['addlinkmessage'] == 10)
                                $output = "<div class='llmessage'>" . __('Error: Link already exists.', 'link-library') . "</div>";
                        }
                }

		Se ($code == 'link-library-addlink' && (($addlinkreqlogin && current_user_can("read")) || !$addlinkreqlogin))
		{
			$output .= "<form method='post' id='lladdlink' action=''>n";

            $output .= wp_nonce_field('LL_ADDLINK_FORM', '_wpnonce', true, false);
            $output .= "<input type='hidden' name='thankyouurl' value='" . $linksubmissionthankyouurl . "' />";
            $output .= '<input type="hidden" name="link_library_user_link_submission" value="1" />';
            global $wp_query;
            $thePostID = $wp_query->post->ID;
            $output .= "<input type='hidden' name='pageid' value='" . $thePostID . "' />";
            $output .= "<input type='hidden' name='settingsid' value='" . $impostazioni . "' />";

            $xpath = $this->relativePath( dirname( __FILE__ ), ABSPATH );
            $output .= "<input type='hidden' name='xpath' value='" . esc_attr( $xpath ) . "' />";
            unset( $xpath );

			$output .= "<div class='lladdlink'>n";

			Se ($addnewlinkmsg == "") $addnewlinkmsg = __('Add new link', 'link-library');
			$output .= "<div id='lladdlinktitle'>" . $addnewlinkmsg . "</div>n";

			$output .= "<table>n";

			Se ($linknamelabel == "") $linknamelabel = __('Link name', 'link-library');
			$output .= "<tr><th>" . $linknamelabel . "</th><td><input type='text' name='link_name' id='link_name' value='" . ( isset( $_GET['addlinkname'] ) ? esc_html(stripslashes($_GET['addlinkname']), '1') : '') . "' /></td></tr>n";

			Se ($linkaddrlabel == "") $linkaddrlabel = __('Link address', 'link-library');
			$output .= "<tr><th>" . $linkaddrlabel . "</th><td><input type='text' name='link_url' id='link_url' value='" . ( isset( $_GET['addlinkurl'] ) ? esc_html(stripslashes($_GET['addlinkurl']), '1') : '' ) . "' /></td></tr>n";

			Se ($showaddlinkrss)
			{
				Se ($linkrsslabel == "") $linkrsslabel = __('Link RSS', 'link-library');
				$output .= "<tr><th>" . $linkrsslabel . "</th><td><input type='text' name='link_rss' id='link_rss' value='" . ( isset( $_GET['addlinkrss'] ) ? esc_html(stripslashes($_GET['addlinkrss']), '1') : '' ) . "' /></td></tr>n";
			}

			$linkcatquery = "SELECT distinct t.name, t.term_id, t.slug as category_nicename, tt.description as category_description ";
			$linkcatquery .= "FROM " . $this->db_prefix() . "terms t ";
			$linkcatquery .= "LEFT JOIN " . $this->db_prefix() . "term_taxonomy tt ON (t.term_id = tt.term_id) ";
			$linkcatquery .= "LEFT JOIN " . $this->db_prefix() . "term_relationships tr ON (tt.term_taxonomy_id = tr.term_taxonomy_id) ";

			$linkcatquery .= "WHERE tt.taxonomy = 'link_category' ";

			Se ($selectedcategorylist != "")
			{
				$linkcatquery .= " AND t.term_id in (" . $selectedcategorylist. ")";
			}

			Se ($excludedcategorylist != "")
			{
				$linkcatquery .= " AND t.term_id not in (" . $excludedcategorylist . ")";
			}

			$linkcatquery .= " ORDER by t.name ASC";

			$linkcats = $wpdb->get_results($linkcatquery);

			Se ($debugmode)
			{
				$output .= "n<!-- Category query for add link form:" . print_r($linkcatquery, TRUE) . "-->nn";
				$output .= "n<!-- Results of Category query for add link form:" . print_r($linkcats, TRUE) . "-->n";
			}

			Se ($linkcats)
			{
				Se ($showaddlinkcat)
				{
					Se ($linkcatlabel == "") $linkcatlabel = __('Link category', 'link-library');

					$output .= "<tr><th>" . $linkcatlabel . "</th><td><SELECT name='link_category' id='link_category'>";

					Se ($linkcustomcatlistentry == "") $linkcustomcatlistentry = __('User-submitted category (define below)', 'link-library');

					foreach ($linkcats as $linkcat)
					{
						$output .= "<OPTION VALUE='" . $linkcat->term_id . "' ";
						Se ( isset($_GET['addlinkcat']) && $_GET['addlinkcat'] == $linkcat->term_id)
							$output .= "selected";
						$output .= ">" . $linkcat->name;
					}

					Se ($addlinkcustomcat)
						$output .= "<OPTION VALUE='new'>" . stripslashes($linkcustomcatlistentry) . "n";

					$output .= "</SELECT></td></tr>n";
				}
				altro
				{
					$output .= "<input type='hidden' name='link_category' id='link_category' value='" . $linkcats[0]->term_id . "'>";
				}

				Se ($addlinkcustomcat)
					$output .= "<tr><th>" .  $linkcustomcatlabel . "</th><td><input type='text' name='link_user_category' id='link_user_category' value='" . ( isset( $_GET['addlinkusercat']) ? esc_html(stripslashes($_GET['addlinkusercat']), '1') : '') . "' /></td></tr>n";
			}

			Se ($showaddlinkdesc)
			{
				Se ($linkdesclabel == "") $linkdesclabel = __('Link description', 'link-library');
				$output .= "<tr><th>" . $linkdesclabel . "</th><td><input type='text' name='link_description' id='link_description' value='" . ( isset( $_GET['addlinkdesc'] ) ? esc_html(stripslashes($_GET['addlinkdesc']), '1') : '' ) . "' /></td></tr>n";
			}

			Se ($showuserlargedescription)
			{
				Se ($linklargedesclabel == "") $linklargedesclabel = __('Large description', 'link-library');
				$output .= "<tr><th style='vertical-align: top'>" . $linklargedesclabel . "</th><td><textarea name='link_textfield' id='link_textfield' cols='66'>" . ( isset( $_GET['addlinktextfield'] ) ? esc_html(stripslashes($_GET['addlinktextfield']), '1') : '' ) . "</textarea></td></tr>n";
			}

			Se ($showaddlinknotes)
			{
				Se ($linknoteslabel == "") $linknoteslabel = __('Link notes', 'link-library');
				$output .= "<tr><th>" . $linknoteslabel . "</th><td>";

				Se ($usetextareaforusersubmitnotes == false || $usetextareaforusersubmitnotes == '')
					$output .= "<input type='text' name='link_notes' id='link_notes' value='";
				elseif ($usetextareaforusersubmitnotes == true)
					$output .= "<textarea name='link_notes' id='link_notes'>";

				$output .= ( isset( $_GET['addlinknotes'] ) ? esc_html(stripslashes($_GET['addlinknotes']), '1') : '' );

				Se ($usetextareaforusersubmitnotes == false || $usetextareaforusersubmitnotes == '')
					$output .= "' />";
				elseif ($usetextareaforusersubmitnotes == true)
					$output .= "</textarea>";

				$output .= "</td></tr>n";
			}

			Se ($showaddlinkreciprocal)
			{
				Se ($linkreciprocallabel == "") $linkreciprocallabel = __('Reciprocal Link', 'link-library');
				$output .= "<tr><th>" . $linkreciprocallabel . "</th><td><input type='text' name='ll_reciprocal' id='ll_reciprocal' value='" . ( isset( $_GET['addlinkreciprocal'] ) ? esc_html(stripslashes($_GET['addlinkreciprocal']), '1') : '' ) . "' /></td></tr>n";
			}

			Se ($showaddlinksecondurl)
			{
				Se ($linksecondurllabel == "") $linksecondurllabel = __('Secondary Address', 'link-library');
				$output .= "<tr><th>" . $linksecondurllabel . "</th><td><input type='text' name='ll_secondwebaddr' id='ll_secondwebaddr' value='" . ( isset( $_GET['addlinksecondurl'] ) ? esc_html(stripslashes($_GET['addlinksecondurl']), '1') : '' ) . "' /></td></tr>n";
			}

			Se ($showaddlinktelephone)
			{
				Se ($linktelephonelabel == "") $linktelephonelabel = __('Telephone', 'link-library');
				$output .= "<tr><th>" . $linktelephonelabel . "</th><td><input type='text' name='ll_telephone' id='ll_telephone' value='" . ( isset( $_GET['addlinktelephone'] ) ? esc_html(stripslashes($_GET['addlinktelephone']), '1') : '' ) . "' /></td></tr>n";
			}

			Se ($showaddlinkemail)
			{
				Se ($linkemaillabel == "") $linkemaillabel = __('E-mail', 'link-library');
				$output .= "<tr><th>" . $linkemaillabel . "</th><td><input type='text' name='ll_email' id='ll_email' value='" . ( isset( $_GET['addlinkemail'] ) ? esc_html(stripslashes($_GET['addlinkemail']), '1') : '' ) . "' /></td></tr>n";
			}

			Se ($showlinksubmittername)
			{
				Se ($linksubmitternamelabel == "") $linksubmitternamelabel = __('Submitter Name', 'link-library');
				$output .= "<tr><th>" . $linksubmitternamelabel . "</th><td><input type='text' name='ll_submittername' id='ll_submittername' value='" . ( isset( $_GET['addlinksubmitname'] ) ? esc_html(stripslashes($_GET['addlinksubmitname']), '1') : '' ) . "' /></td></tr>n";
			}

			Se ($showaddlinksubmitteremail)
			{
				Se ($linksubmitteremaillabel == "") $linksubmitteremaillabel = __('Submitter E-mail', 'link-library');
				$output .= "<tr><th>" . $linksubmitteremaillabel . "</th><td><input type='text' name='ll_submitteremail' id='ll_submitteremail' value='" . ( isset( $_GET['addlinksubmitemail'] ) ? esc_html(stripslashes($_GET['addlinksubmitemail']), '1') : '' ). "' /></td></tr>n";
			}

			Se ($showlinksubmittercomment)
			{
				Se ($linksubmittercommentlabel == "") $linksubmittercommentlabel = __('Submitter Comment', 'link-library');
				$output .= "<tr><th style='vertical-align: top;'>" . $linksubmittercommentlabel . "</th><td><textarea name='ll_submittercomment' id='ll_submittercomment' cols='38''>" . ( isset( $_GET['addlinksubmitcomment'] ) ? esc_html(stripslashes($_GET['addlinksubmitcomment']), '1') : '' ) . "</textarea></td></tr>n";
			}

			Se ($showcaptcha)
			{
				$output .= "<tr><td></td><td><span id='captchaimage'><img src='" . plugins_url( 'captcha/easycaptcha.php', __FILE__ ) . "' /></span></td></tr>n";
				$output .= "<tr><th>" . __('Enter code from above image', 'link-library') . "</th><td><input type='text' name='confirm_code' /></td></tr>n";
			}

			Se ($showcustomcaptcha)
			{
				Se ($customcaptchaquestion == "") $customcaptchaquestion = __('Is boiling water hot or cold?', 'link-library');
				$output .= "<tr><th style='vertical-align: top;'>" . $customcaptchaquestion . "</th><td><input type='text' name='ll_customcaptchaanswer' id='ll_customcaptchaanswer' value='" . (isset( $_GET['ll_customcaptchaanswer'] ) ? esc_html(stripslashes($_GET['ll_customcaptchaanswer']), '1') : '' ) . "' /></td></tr>n";
			}

			$output .= "</table>n";

			Se ($addlinkbtnlabel == "") $addlinkbtnlabel = __('Add link', 'link-library');
			$output .= '<span style="border:0;" class="LLUserLinkSubmit"><input type="submit" name="submit" value="' . $addlinkbtnlabel . '" /></span>';

			$output .= "</div>n";
			$output .= "</form>nn";
		}

		return $output;
	}

	function relativePath($a partire dal, $a, $ps = DIRECTORY_SEPARATOR) {
		$arFrom = explode($ps, rtrim($a partire dal, $ps));
		$arTo = explode($ps, rtrim($a, $ps));
		mentre(count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0])) {
			array_shift($arFrom);
			array_shift($arTo);
		}
		$return = str_pad("", count($arFrom) * 3, '..'.$ps).implode($ps, $arTo);

		// Don't disclose anything about the path is it's not needed, i.e. is the standard
		if( $return === '../../../' ) {
			$return = '';
        }

		return $return;
	}

	/*
	 * function LinkLibraryCategories()
	 *
	 * added by Yannick Lefebvre
	 *
	 * Output a list of all links categories, listed by category, using the
	 * settings in $wpdb->linkcategories and output it as table
	 *
	 * Parameters:
	 *   order (default 'name')  - Sort link categories by 'name' or 'id' or 'category-list'. When set to 'AdminSettings', will use parameters set in Admin Settings Panel.
	 *   hide_if_empty (default true)  - Supress listing empty link categories
	 *   table_witdh (default 100) - Width of table, percentage
	 *   num_columns (default 1) - Number of columns in table
	 *   catanchor (default true) - Determines if links to generated anchors should be created
	 *   flatlist (default 'table') - When set to true, displays an unordered list instead of a table
	 *   categorylist (default null) - Specifies a comma-separate list of the only categories that should be displayed
	 *   excludecategorylist (default null) - Specifies a comma-separate list of the categories that should not be displayed
	 *   showcategorydescheaders (default null) - Show category descriptions in category list
	 *   showonecatonly (default false) - Enable AJAX mode showing only one category at a time
	 *   impostazioni (default NULL) - Settings Set ID, only used when showonecatonly is true
	 *   loadingicon (default NULL) - Path to icon to display when only show one category at a time
	 *   catlistdescpos (default 'right') - Position of category description relative to name
	 *   debugmode (default false)
	 *   pagination (default false)
	 *   linksperpage (default 5)
	 *   showcatlinkcount (default false)
	 *   showonecatmode (default 'AJAX')
	 *   cattargetaddress
	 *   rewritepage
	 *   showinvisible
	 */

	function LinkLibraryCategories($order = 'name', $hide_if_empty = true, $table_width = 100, $num_columns = 1, $catanchor = true,
								   $flatlist = 'table', $categorylist = '', $excludecategorylist = '', $showcategorydescheaders = false,
								   $showonecatonly = false, $settings = '', $loadingicon = '/icons/Ajax-loader.gif', $catlistdescpos = 'right', $debugmode = false,
								   $pagination = false, $linksperpage = 5, $showcatlinkcount = false, $showonecatmode = 'AJAX', $cattargetaddress = '',
								   $rewritepage = '', $showinvisible = false, $showuserlinks = true, $showcatonsearchresults = false) {

		Se (strpos($order, 'AdminSettings') != false)
		{
			$settingsetid = substr($order, 13);
			$settingsetname = "LinkLibraryPP" . $settingsetid;
			$options = get_option($settingsetname);

			$genoptions = get_option('LinkLibraryGeneral');

			return $this->PrivateLinkLibraryCategories($options['order'], $options['hide_if_empty'], $options['table_width'], $options['num_columns'], $options['catanchor'], $options['flatlist'],
									 $options['categorylist'], $options['excludecategorylist'], $options['showcategorydescheaders'], $options['showonecatonly'], '',
									 $options['loadingicon'], $options['catlistdescpos'], $genoptions['debugmode'], $options['pagination'], $options['linksperpage'],
									 $options['showcatlinkcount'], $options['showonecatmode'], $options['cattargetaddress'], $options['rewritepage'], $options['showinvisible'], $options['showuserlinks'], $options['showcatonsearchresults']);
		}
		else
			return $this->PrivateLinkLibraryCategories($order, $hide_if_empty, $table_width, $num_columns, $catanchor, $flatlist, $categorylist, $excludecategorylist, $showcategorydescheaders,
			$showonecatonly, $impostazioni, $loadingicon, $catlistdescpos, $debugmode, $pagination, $linksperpage, $showcatlinkcount, $showonecatmode, $cattargetaddress,
			$rewritepage, $showinvisible, $showuserlinks, $showcatonsearchresults);

	}

	/*
	 * function LinkLibrary()
	 *
	 * added by Yannick Lefebvre
	 *
	 * Output a list of all links, listed by category, using the
	 * settings in $wpdb->linkcategories and output it as a nested
	 * HTML unordered list. Can also insert anchors for categories
	 *
	 * Parameters:
	 *   order (default 'name')  - Sort link categories by 'name' or 'id'. When set to 'AdminSettings', will use parameters set in Admin Settings Panel.
	 *   hide_if_empty (default true)  - Supress listing empty link categories
	 *   catanchor (default true) - Adds name anchors to categorie links to be able to link directly to categories
	 *   showdescription (default false) - Displays link descriptions. Added for 2.1 since link categories no longer have this setting
	 *   shownotes (default false) - Shows notes in addition to description for links (useful since notes field is larger than description)
	 *   showrating (default false) - Displays link ratings. Added for 2.1 since link categories no longer have this setting
	 *   showupdated (default false) - Displays link updated date. Added for 2.1 since link categories no longer have this setting
	 *   categorylist (default null) - Only show links inside of selected categories. Enter category numbers in a string separated by commas
	 *   showimages (default false) - Displays link images. Added for 2.1 since link categories no longer have this setting
	 *   show_image_and_name (default false) - Show both image and name instead of only one or the other
	 *   use_html_tags (default false) - Use HTML tags for formatting instead of just displaying them
	 *   show_rss (default false) - Display RSS URI if available in link description
	 *   beforenote (default <br />) - Code to print out between the description and notes
	 *   nofollow (default false) - Adds nofollow tag to outgoing links
	 *   excludecategorylist (default null) - Specifies a comma-separate list of the categories that should not be displayed
	 *   afternote (default null) - Code / Text to be displayed after note
	 *   beforeitem (default null) - Code / Text to be displayed before item
	 *   afteritem (default null) - Code / Text to be displayed after item
	 *   beforedesc (default null) - Code / Text to be displayed before description
	 *   afterdesc (default null) - Code / Text to be displayed after description
	 *   displayastable (default false) - Display lists of links as a table (when true) or as an unordered list (when false)
	 *   beforelink (default null) - Code / Text to be displayed before link
	 *   afterlink (default null) - Code / Text to be displayed after link
	 *   showcolumnheaders (default false) - Show column headers if rendering in table mode
	 *   linkheader (default null) - Text to be shown in link column when displaying as table
	 *   descheader (default null) - Text to be shown in desc column when displaying as table
	 *   notesheader (default null) - Text to be shown in notes column when displaying as table
	 *   catlistwrappers (default 1) - Number of different sets of alternating elements to be placed before and after each link category section
	 *   beforecatlist1 (default null) - First element to be placed before a link category section
	 *   beforecatlist2 (default null) - Second element to be placed before a link category section
	 *   beforecatlist3 (default null) - Third element to be placed before a link category section
	 *   divorheader (default false) - Output div before and after cat name if false, output heading tag if true
	 *   catnameoutput (default linklistcatname) - Name of div class or heading to output
	 *   showrssicon (default false) - Output RSS URI if available and assign to standard RSS icon
	 *   linkaddfrequency (default 0) - Frequency at which extra before and after output should be placed around links
	 *   addbeforelink (default null) - Addition output to be placed before link
	 *   addafterlink (default null) - Addition output to be placed after link
	 *   linktarget (default null) - Specifies the link target window
	 *   showcategorydescheaders (default false) - Display link category description when printing category list
	 *   showcategorydesclinks (default false) - Display link category description when printing links
	 *   showadmineditlinks (default false) - Display edit links in output if logged in as administrator
	 *   showonecatonly (default false) - Only show one category at a time
	 *   AJAXcatid (default null) - Category ID for AJAX sub-queries
	 *   defaultsinglecat (default null) - ID of first category to be shown in single category mode
	 *   rsspreview (default false) - Add preview links after RSS feed addresses
	 *   rssfeedpreviewcount(default 3) - Number of RSS feed items to show in preview
	 *   rssfeedinline (default false) - Shows latest feed items inline with link list
	 *   rssfeedinlinecontent (default false) - Shows latest feed items contents inline with link list
	 *   rssfeedinlinecount (default 1) - Number of RSS feed items to show inline
	 *   beforerss (default null) - String to output before RSS block
	 *   afterrss (default null) - String to output after RSS block
	 *   rsscachedir (default null) - Path for SimplePie library to store RSS cache information - Obsolete
	 *   direction (default ASC) - Sort direction for Link Categories
	 *   linkdirection (default ASC) - Sort direction for Links within each category
	 *   linkorder (default 'name') - Sort order for Links within each category
	 *   pagination (default false) - Limit number of links displayed per page
	 *   linksperpage (default 5) - Number of links to be shown per page in Pagination Mode
	 *   hidecategorynames (default false) - Show category names in Link Library list
	 *   impostazioni (default NULL) - Setting Set ID
	 *   showinvisible (default false) - Shows links that are set to be invisible
	 *   showdate (default false) - Determines is link update date should be displayed
	 *   beforedate (default null) - Code/Text to be displayed before link date
	 *   afterdate (default null) - Code/Text to be displated after link date
	 *   catdescpos (default 'right') - Position of link category description output
	 *   showuserlinks (default false) - Specifies if user submitted links should be shown immediately after submission
	 *   rsspreviewwidth (default 900) - Specifies the width of the box in which RSS previews are displayed
	 *   rsspreviewheight (default 700) - Specifies the height of the box in which RSS previews are displayed
	 *   beforeimage (default null) - Code/Text to be displayed before link image
	 *   afterimage (default null) - Code/Text to be displayed after link image
	 *   imagepos (default beforename) - Position of image relative to link name
	 *   imageclass (default null) - Class that will be assigned to link images
	 *   debugmode (default false) - Adds debug information as comments in the WordPress output to facilitate remote debugging
	 *   usethumbshotsforimages (default false) - Uses thumbshots.org to generate images for links
	 *   showonecatmode (default AJAX) - Method used to load different categories when only showing one at a time
	 *   dragndroporder (default 1,2,3,4,5,6,7,8,9,10) - Order to display link sub-sections
	 *   displayweblink (default 'false')
	 *   sourceweblink (default 'primary')
	 *   showtelephone (default 'false')
	 *   sourcetelephone (default 'primary')
	 *   showemail (default 'false')
	 *   showlinkhits (default false)
	 *   beforeweblink (default null)
	 *   afterweblink (default null)
	 *   weblinklabel (default null)
	 *   beforetelephone (default null)
	 *   aftertelephone (default null)
	 *   telephonelabel (default null)
	 *   beforeemail (default null)
	 *   afteremail (default null)
	 *   emaillabel (default null)
	 *   beforelinkhits (default null)
	 *   afterlinkhits (default null)
	 *   emailcommand (default null)
	 */

	function LinkLibrary($order = 'name', $hide_if_empty = true, $catanchor = true,
									$showdescription = false, $shownotes = false, $showrating = false,
									$showupdated = false, $categorylist = '', $show_images = false,
									$show_image_and_name = false, $use_html_tags = false,
									$show_rss = false, $beforenote = '<br />', $nofollow = false, $excludecategorylist = '',
									$afternote = '', $beforeitem = '<li>', $afteritem = '</li>', $beforedesc = '', $afterdesc = '',
									$displayastable = false, $beforelink = '', $afterlink = '', $showcolumnheaders = false,
									$linkheader = '', $descheader = '', $notesheader = '', $catlistwrappers = 1, $beforecatlist1 = '',
									$beforecatlist2 = '', $beforecatlist3 = '', $divorheader = false, $catnameoutput = 'linklistcatname',
									$show_rss_icon = false, $linkaddfrequency = 0, $addbeforelink = '', $addafterlink = '', $linktarget = '',
									$showcategorydesclinks = false, $showadmineditlinks = true, $showonecatonly = false, $AJAXcatid = '',
									$defaultsinglecat = '', $rsspreview = false, $rsspreviewcount = 3, $rssfeedinline = false, $rssfeedinlinecontent = false,
									$rssfeedinlinecount = 1, $beforerss = '', $afterrss = '', $rsscachedir = NULL, $direction = 'ASC',
									$linkdirection = 'ASC', $linkorder = 'name', $pagination = false, $linksperpage = 5, $hidecategorynames = false,
									$settings = '', $showinvisible = false, $showdate = false, $beforedate = '', $afterdate = '', $catdescpos = 'right',
									$showuserlinks = false, $rsspreviewwidth = 900, $rsspreviewheight = 700, $beforeimage = '', $afterimage = '', $imagepos = 'beforename',
									$imageclass = '', $AJAXpageid = 1, $debugmode = false, $usethumbshotsforimages = false, $showonecatmode = 'AJAX',
									$dragndroporder = '1,2,3,4,5,6,7,8,9,10', $showname = true, $displayweblink = 'false', $sourceweblink = 'primary', $showtelephone = 'false',
									$sourcetelephone = 'primary', $showemail = 'false', $showlinkhits = false, $beforeweblink = '', $afterweblink = '', $weblinklabel = '',
									$beforetelephone = '', $aftertelephone = '', $telephonelabel = '', $beforeemail = '', $afteremail = '', $emaillabel = '', $beforelinkhits = '',
									$afterlinkhits = '', $emailcommand = '', $sourceimage = 'primary', $sourcename = 'primary', $thumbshotscid = '',
									$maxlinks = '', $beforelinkrating = '', $afterlinkrating = '', $showlargedescription = false, $beforelargedescription = '',
									$afterlargedescription = '', $featuredfirst = false, $shownameifnoimage = false, $enablelinkpopup = false, $popupwidth = 300, $popupheight = 400, $nocatonstartup = false, $linktitlecontent = 'linkname', $paginationposition = 'AFTER', $uselocalimagesoverthumbshots = false, $showlinksonclick = false ) {

		Se (strpos($order, 'AdminSettings') !== false)
		{
			$settingsetid = substr($order, 13);
			$settingsetname = "LinkLibraryPP" . $settingsetid;
			$options = get_option($settingsetname);

			$genoptions = get_option('LinkLibraryGeneral');

			return $this->PrivateLinkLibrary($options['order'], $options['hide_if_empty'], $options['catanchor'], $options['showdescription'], $options['shownotes'],
									  $options['showrating'], $options['showupdated'], $options['categorylist'], $options['show_images'],
									  false, $options['use_html_tags'], $options['show_rss'], $options['beforenote'],
									  $options['nofollow'], $options['excludecategorylist'], $options['afternote'], $options['beforeitem'],
									  $options['afteritem'], $options['beforedesc'], $options['afterdesc'], $options['displayastable'],
									  $options['beforelink'], $options['afterlink'], $options['showcolumnheaders'], $options['linkheader'],
									  $options['descheader'], $options['notesheader'], $options['catlistwrappers'], $options['beforecatlist1'],
									  $options['beforecatlist2'], $options['beforecatlist3'], $options['divorheader'], $options['catnameoutput'],
									  $options['show_rss_icon'], $options['linkaddfrequency'], $options['addbeforelink'], $options['addafterlink'],
									  $options['linktarget'], $options['showcategorydesclinks'], $options['showadmineditlinks'], $options['showonecatonly'],
									  $AJAXcatid, $options['defaultsinglecat'], $options['rsspreview'], $options['rsspreviewcount'], $options['rssfeedinline'],
									  $options['rssfeedinlinecontent'], $options['rssfeedinlinecount'], $options['beforerss'], $options['afterrss'],
									  NULL, $options['direction'], $options['linkdirection'], $options['linkorder'],
									  $options['pagination'], $options['linksperpage'], $options['hidecategorynames'], $settingsetid, $options['showinvisible'],
									  $options['showdate'], $options['beforedate'], $options['afterdate'], $options['catdescpos'], $options['showuserlinks'],
									  $options['rsspreviewwidth'], $options['rsspreviewheight'], $options['beforeimage'], $options['afterimage'], $options['imagepos'],
									  $options['imageclass'], $AJAXpageid, $genoptions['debugmode'], $options['usethumbshotsforimages'], 'AJAX', $options['dragndroporder'],
									  $options['showname'], $options['displayweblink'], $options['sourceweblink'], $options['showtelephone'], $options['sourcetelephone'],
									  $options['showemail'], $options['showlinkhits'], $options['beforeweblink'], $options['afterweblink'], $options['weblinklabel'],
									  $options['beforetelephone'], $options['aftertelephone'], $options['telephonelabel'], $options['beforeemail'], $options['afteremail'],
									  $options['emaillabel'], $options['beforelinkhits'], $options['afterlinkhits'], $options['emailcommand'], $options['sourceimage'],
									  $options['sourcename'], $genoptions['thumbshotscid'], $options['maxlinks'], $options['beforelinkrating'],
									  $options['afterlinkrating'], $options['showlargedescription'], $options['beforelargedescription'],
									  $options['afterlargedescription'], $options['featuredfirst'], $options['shownameifnoimage'], $options['enable_link_popup'],
                                      $options['popup_width'], $options['popup_height'], $options['nocatonstartup'], $options['linktitlecontent'], $options['paginationposition'], $options['uselocalimagesoverthumbshots'], $options['showlinksonclick'] );
		}
		else
			return $this->PrivateLinkLibrary($order, $hide_if_empty, $catanchor, $showdescription, $shownotes, $showrating,
									$showupdated, $categorylist, $show_images, false, $use_html_tags,
									$show_rss, $beforenote, $nofollow, $excludecategorylist, $afternote, $beforeitem, $afteritem,
									$beforedesc, $afterdesc, $displayastable, $beforelink, $afterlink, $showcolumnheaders,
									$linkheader, $descheader, $notesheader, $catlistwrappers, $beforecatlist1,
									$beforecatlist2, $beforecatlist3, $divorheader, $catnameoutput, $show_rss_icon,
									$linkaddfrequency, $addbeforelink, $addafterlink, $linktarget, $showcategorydesclinks, $showadmineditlinks,
									$showonecatonly, '', $defaultsinglecat, $rsspreview, $rsspreviewcount, $rssfeedinline, $rssfeedinlinecontent, $rssfeedinlinecount,
									$beforerss, $afterrss, NULL, $direction, $linkdirection, $linkorder,
									$pagination, $linksperpage, $hidecategorynames, $impostazioni, $showinvisible, $showdate, $beforedate, $afterdate, $catdescpos,
									$showuserlinks, $rsspreviewwidth, $rsspreviewheight, $beforeimage, $afterimage, $imagepos, $imageclass, '', $debugmode,
									$usethumbshotsforimages, $showonecatmode, $dragndroporder, $showname, $displayweblink, $sourceweblink, $showtelephone,
									$sourcetelephone, $showemail, $showlinkhits, $beforeweblink, $afterweblink, $weblinklabel, $beforetelephone, $aftertelephone,
									$telephonelabel, $beforeemail, $afteremail, $emaillabel, $beforelinkhits, $afterlinkhits, $emailcommand, $sourceimage, $sourcename,
									$thumbshotscid, $maxlinks, $beforelinkrating, $afterlinkrating, $showlargedescription, $beforelargedescription,
									$afterlargedescription, $featuredfirst, $shownameifnoimage, $enablelinkpopup, $popupwidth, $popupheight, $nocatonstartup, $linktitlecontent, $paginationposition, $uselocalimagesoverthumbshots, $showlinksonclick );
	}

	/********************************************** Function to Process 





 shortcode *********************************************/

	function link_library_cats_func($atts) {
		$categorylistoverride = '';
		$excludecategoryoverride = '';
		$settings = '';

		extract(shortcode_atts(array(
			'categorylistoverride' => '',
			'excludecategoryoverride' => '',
			'settings' => ''
		), $atts));

		Se ($settings == '')
		{
			$settings = 1;
			$options = get_option('LinkLibraryPP1');
		}
		altro
		{
			$settingsname = 'LinkLibraryPP' . $impostazioni;
			$options = get_option($settingsname);
		}

		Se ($categorylistoverride != '')
			$selectedcategorylist = $categorylistoverride;
		else
			$selectedcategorylist = $options['categorylist'];

		Se ($excludecategoryoverride != '')
			$excludedcategorylist = $excludecategoryoverride;
		else
			$excludedcategorylist = $options['excludecategorylist'];

		$genoptions = get_option('LinkLibraryGeneral');

		return $this->PrivateLinkLibraryCategories($options['order'], $options['hide_if_empty'], $options['table_width'], $options['num_columns'], $options['catanchor'], $options['flatlist'],
									 $selectedcategorylist, $excludedcategorylist, $options['showcategorydescheaders'], $options['showonecatonly'], $impostazioni,
									 $options['loadingicon'], $options['catlistdescpos'], $genoptions['debugmode'], $options['pagination'], $options['linksperpage'],
									 $options['showcatlinkcount'], $options['showonecatmode'], $options['cattargetaddress'], $options['rewritepage'],
									 $options['showinvisible'], $options['showuserlinks'], $options['showcatonsearchresults']);
	}

	/********************************************** Function to Process 
shortcode *********************************************/ function link_library_search_func($atts) { $settings = ''; extract(shortcode_atts(array( 'settings' => '' ), $atts)); Se ($settings == '') $options = get_option('LinkLibraryPP1'); altro { $settingsname = 'LinkLibraryPP' . $impostazioni; $options = get_option($settingsname); } return $this->PrivateLinkLibrarySearchForm($options['searchlabel'], $options['searchresultsaddress']); } /********************************************** Function to Process [link-library-add-link] shortcode *********************************************/ function link_library_insert_link( $linkdata, $wp_error = false, $addlinknoaddress = false) { global $wpdb; $link_name = ''; $link_url = ''; $defaults = array( 'link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 ); $linkdata = wp_parse_args( $linkdata, $defaults ); $linkdata = sanitize_bookmark( $linkdata, 'db' ); extract( stripslashes_deep( $linkdata ), EXTR_SKIP ); $update = false; Se ( !empty( $link_id ) ) $update = true; Se ( trim( $link_name ) == '' ) { Se ( trim( $link_url ) != '' ) { $link_name = $link_url; } altro { return 0; } } Se ($addlinknoaddress == false) { Se ( trim( $link_url ) == '' ) return 0; } Se ( empty( $link_rating ) ) $link_rating = 0; Se ( empty( $link_image ) ) $link_image = ''; Se ( empty( $link_target ) ) $link_target = ''; Se ( empty( $link_visible ) ) $link_visible = 'Y'; Se ( empty( $link_owner ) ) $link_owner = get_current_user_id(); Se ( empty( $link_notes ) ) $link_notes = ''; Se ( empty( $link_description ) ) $link_description = ''; Se ( empty( $link_rss ) ) $link_rss = ''; Se ( empty( $link_rel ) ) $link_rel = ''; // Make sure we set a valid category if ( ! isset( $link_category ) || 0 == count( $link_category ) || !is_array( $link_category ) ) { $link_category = array( get_option( 'default_link_category' ) ); } Se ( $update ) { Se ( false === $wpdb->update( $wpdb->links, compact('link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_rating', 'link_rel', 'link_notes', 'link_rss'), compact('link_id') ) ) { Se ( $wp_error ) return new WP_Error( 'db_update_error', __( 'Could not update link in the database', 'link-library' ), $wpdb->last_error ); else return 0; } } altro { Se ( false === $wpdb->insert( $wpdb->links, compact('link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss') ) ) { Se ( $wp_error ) return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database', 'link-library' ), $wpdb->last_error ); else return 0; } $link_id = (int) $wpdb->insert_id; } wp_set_link_cats( $link_id, $link_category ); Se ( $update ) do_action( 'edit_link', $link_id ); else do_action( 'add_link', $link_id ); clean_bookmark_cache( $link_id ); return $link_id; } function link_library_addlink_func($atts, $content, $code) { $settings = ''; $categorylistoverride = ''; $excludecategoryoverride = ''; extract(shortcode_atts(array( 'settings' => '', 'categorylistoverride' => '', 'excludecategoryoverride' => '' ), $atts)); Se ($settings == '') $settings = 1; $settingsname = 'LinkLibraryPP' . $impostazioni; $options = get_option($settingsname); $genoptions = get_option('LinkLibraryGeneral'); Se ($categorylistoverride != '') $selectedcategorylist = $categorylistoverride; elseif ($options['addlinkcatlistoverride'] != '') $selectedcategorylist = $options['addlinkcatlistoverride']; else $selectedcategorylist = $options['categorylist']; Se ($excludecategoryoverride != '') $excludedcategorylist = $excludecategoryoverride; else $excludedcategorylist = $options['excludecategorylist']; return ( isset( $outputmessage ) ? $outputmessage : '') . $this->PrivateLinkLibraryAddLinkForm($selectedcategorylist, $excludedcategorylist, $options['addnewlinkmsg'], $options['linknamelabel'], $options['linkaddrlabel'], $options['linkrsslabel'], $options['linkcatlabel'], $options['linkdesclabel'], $options['linknoteslabel'], $options['addlinkbtnlabel'], $options['hide_if_empty'], $options['showaddlinkrss'], $options['showaddlinkdesc'], $options['showaddlinkcat'], $options['showaddlinknotes'], $options['addlinkreqlogin'], $genoptions['debugmode'], $options['addlinkcustomcat'], $options['linkcustomcatlabel'], $options['linkcustomcatlistentry'], $options['showaddlinkreciprocal'], $options['linkreciprocallabel'], $options['showaddlinksecondurl'], $options['linksecondurllabel'], $options['showaddlinktelephone'], $options['linktelephonelabel'], $options['showaddlinkemail'], $options['linkemaillabel'], $options['showcaptcha'], (isset($captureddata) ? $captureddata : null), $options['linksubmitternamelabel'], $options['showlinksubmittername'], $options['linksubmitteremaillabel'], $options['showaddlinksubmitteremail'], $options['linksubmittercommentlabel'], $options['showlinksubmittercomment'], $genoptions['linksubmissionthankyouurl'], $options['addlinkcatlistoverride'], $options['showcustomcaptcha'], $options['customcaptchaquestion'], $options['linklargedesclabel'], $options['showuserlargedescription'], $options['usetextareaforusersubmitnotes'], $impostazioni, $code); } /********************************************** Function to Process shortcode *********************************************/ function link_library_func($atts) { $settings = ''; $notesoverride = ''; $descoverride = ''; $rssoverride = ''; $categorylistoverride = ''; $excludecategoryoverride = ''; $tableoverride = ''; extract(shortcode_atts(array( 'categorylistoverride' => '', 'excludecategoryoverride' => '', 'notesoverride' => '', 'descoverride' => '', 'rssoverride' => '', 'tableoverride' => '', 'settings' => '' ), $atts)); Se ($settings == '') { $settings = 1; $options = get_option('LinkLibraryPP1'); } altro { $settingsname = 'LinkLibraryPP' . $impostazioni; $options = get_option($settingsname); } Se ($notesoverride != '') $selectedshownotes = $notesoverride; else $selectedshownotes = $options['shownotes']; Se ($descoverride != '') $selectedshowdescription = $descoverride; else $selectedshowdescription = $options['showdescription']; Se ($rssoverride != '') $selectedshowrss = $rssoverride; else $selectedshowrss = $options['show_rss']; Se ($categorylistoverride != '') $selectedcategorylist = $categorylistoverride; else $selectedcategorylist = $options['categorylist']; Se ($excludecategoryoverride != '') $excludedcategorylist = $excludecategoryoverride; else $excludedcategorylist = $options['excludecategorylist']; Se ($tableoverride != '') $overridedisplayastable = $tableoverride; else $overridedisplayastable = $options['displayastable']; $genoptions = get_option('LinkLibraryGeneral'); $linklibraryoutput = ""; Se (floatval($genoptions['schemaversion']) < "4.6") { $this->ll_install(); $genoptions = get_option('LinkLibraryGeneral'); Se ($settings == '') $options = get_option('LinkLibraryPP1'); altro { $settingsname = 'LinkLibraryPP' . $impostazioni; $options = get_option($settingsname); } } Se ($genoptions['debugmode'] == true) $linklibraryoutput .= "n<!-- Library Settings Info:" . print_r($options, TRUE) . "-->n"; $linklibraryoutput .= $this->PrivateLinkLibrary( $options['order'], $options['hide_if_empty'], $options['catanchor'], $selectedshowdescription, $selectedshownotes, $options['showrating'], $options['showupdated'], $selectedcategorylist, $options['show_images'], false, $options['use_html_tags'], $options['show_rss'], $options['beforenote'], $options['nofollow'], $excludedcategorylist, $options['afternote'], $options['beforeitem'], $options['afteritem'], $options['beforedesc'], $options['afterdesc'], $overridedisplayastable, $options['beforelink'], $options['afterlink'], $options['showcolumnheaders'], $options['linkheader'], $options['descheader'], $options['notesheader'], $options['catlistwrappers'], $options['beforecatlist1'], $options['beforecatlist2'], $options['beforecatlist3'], $options['divorheader'], $options['catnameoutput'], $options['show_rss_icon'], $options['linkaddfrequency'], $options['addbeforelink'], $options['addafterlink'], $options['linktarget'], $options['showcategorydesclinks'], $options['showadmineditlinks'], $options['showonecatonly'], '', $options['defaultsinglecat'], $options['rsspreview'], $options['rsspreviewcount'], $options['rssfeedinline'], $options['rssfeedinlinecontent'], $options['rssfeedinlinecount'], $options['beforerss'], $options['afterrss'], NULL, $options['direction'], $options['linkdirection'], $options['linkorder'], $options['pagination'], $options['linksperpage'], $options['hidecategorynames'], $impostazioni, $options['showinvisible'], $options['showdate'], $options['beforedate'], $options['afterdate'], $options['catdescpos'], $options['showuserlinks'], $options['rsspreviewwidth'], $options['rsspreviewheight'], $options['beforeimage'], $options['afterimage'], $options['imagepos'], $options['imageclass'], '', $genoptions['debugmode'], $options['usethumbshotsforimages'], $options['showonecatmode'], $options['dragndroporder'], $options['showname'], $options['displayweblink'], $options['sourceweblink'], $options['showtelephone'], $options['sourcetelephone'], $options['showemail'], $options['showlinkhits'], $options['beforeweblink'], $options['afterweblink'], $options['weblinklabel'], $options['beforetelephone'], $options['aftertelephone'], $options['telephonelabel'], $options['beforeemail'], $options['afteremail'], $options['emaillabel'], $options['beforelinkhits'], $options['afterlinkhits'], $options['emailcommand'], $options['sourceimage'], $options['sourcename'], $genoptions['thumbshotscid'], $options['maxlinks'], $options['beforelinkrating'], $options['afterlinkrating'], $options['showlargedescription'], $options['beforelargedescription'], $options['afterlargedescription'], $options['featuredfirst'], $options['shownameifnoimage'], ( isset($options['enable_link_popup']) ? $options['enable_link_popup'] : false ), ( isset($options['popup_width']) ? $options['popup_width'] : 300 ), ( isset( $options['popup_height'] ) ? $options['popup_height'] : 400 ), $options['nocatonstartup'], $options['linktitlecontent'], ( isset( $options['paginationposition'] ) ? $options['paginationposition'] : 'AFTER' ), $options['uselocalimagesoverthumbshots'], $options['showlinksonclick'] ); return $linklibraryoutput; } function conditionally_add_scripts_and_styles($posts){ Se (empty($posts)) return $posts; $load_jquery = false; $load_thickbox = false; $load_style = false; global $testvar; $genoptions = get_option('LinkLibraryGeneral'); Se (is_admin()) { $load_jquery = false; $load_thickbox = false; $load_style = false; } altro { foreach ($posts as $post) { $continuesearch = true; $searchpos = 0; $settingsetids = array(); mentre ($continuesearch) { $linklibrarypos = stripos($post->post_content, 'link-library ', $searchpos); Se ($linklibrarypos == false) { $linklibrarypos = stripos($post->post_content, 'link-library]', $searchpos); Se ($linklibrarypos == false) Se (stripos($post->post_content, 'link-library-cats') || stripos($post->post_content, 'link-library-addlink')) $load_style = true; } $continuesearch = $linklibrarypos; Se ($continuesearch) { $load_style = true; $load_jquery = true; $shortcodeend = stripos($post->post_content, ']', $linklibrarypos); Se ($shortcodeend) $searchpos = $shortcodeend; else $searchpos = $linklibrarypos + 1; Se ($shortcodeend) { $settingconfigpos = stripos($post->post_content, 'settings=', $linklibrarypos); Se ($settingconfigpos && $settingconfigpos < $shortcodeend) { $settingset = substr($post->post_content, $settingconfigpos + 9, $shortcodeend - $settingconfigpos - 9); $settingsetids[] = $settingset; } else if (count($settingsetids) == 0) { $settingsetids[] = 1; } } } } } Se ($settingsetids) { foreach ($settingsetids as $settingsetid) { $settingsname = 'LinkLibraryPP' . $settingsetid; $options = get_option($settingsname); Se ( $options['showonecatonly'] ) { $load_jquery = true; } Se ( $options['rsspreview'] || ( isset( $options['enable_link_popup'] ) && $options['enable_link_popup'] ) ) { $load_thickbox = true; } Se ($options['publishrssfeed'] == true) { global $rss_settings; $rss_settings = $settingsetid; } } } Se ($genoptions['includescriptcss'] != '') { $pagelist = explode (',', $genoptions['includescriptcss']); $loadscripts = false; foreach($pagelist as $pageid) { Se ( ( $pageid == 'front' && is_front_page() ) || ( $pageid == 'category' && is_category() ) || ( $pageid == 'all') || ( is_page( $pageid ) ) ) { $load_jquery = true; $load_thickbox = true; $load_style = true; } } } } global $llstylesheet; Se ( $load_style ) { $llstylesheet = true; } altro { $llstylesheet = false; } Se ( $load_jquery ) { wp_enqueue_script( 'jquery' ); } Se ( $load_thickbox ) { wp_enqueue_script( 'thickbox' ); wp_enqueue_style ( 'thickbox' ); } return $posts; } function ll_template_redirect( $template ) { Se ( !empty( $_POST['link_library_user_link_submission'] ) ) { require_once plugin_dir_path( __FILE__ ) . 'usersubmission.php'; link_library_process_user_submission( $this ); return ''; } else if ( !empty( $_GET['link_library_rss_feed'] ) ) { require_once plugin_dir_path( __FILE__ ) . 'rssfeed.php'; link_library_generate_rss_feed(); return ''; } else if ( !empty( $_GET['link_library_popup_content'] ) ) { require_once plugin_dir_path( __FILE__ ) . 'linkpopup.php'; link_library_popup_content( $this ); return ''; } else if ( !empty( $_GET['link_library_rss_preview'] ) ) { require_once plugin_dir_path( __FILE__ ) . 'rsspreview.php'; link_library_generate_rss_preview( $this ); return ''; } altro { return $template; } } function link_library_ajax_tracker() { require_once plugin_dir_path( __FILE__ ) . 'tracker.php'; link_library_process_ajax_tracker( $this ); } function link_library_ajax_update() { require_once plugin_dir_path( __FILE__ ) . 'link-library-ajax.php'; link_library_render_ajax( $this ); } function link_library_generate_image() { global $my_link_library_plugin_admin; Se ( empty( $my_link_library_plugin_admin ) ) { require plugin_dir_path( __FILE__ ) . 'link-library-admin.php'; $my_link_library_plugin_admin = new link_library_plugin_admin(); } require plugin_dir_path( __FILE__ ) . 'link-library-image-generator.php'; link_library_ajax_image_generator( $my_link_library_plugin_admin ); } } global $my_link_library_plugin; $my_link_library_plugin = new link_library_plugin(); ?>

 

WordPress multisito correzione reimpostazione della password

to fix the issue with the wrong URLs

http://www.site2.com forgot password links to

http://www.site1.com/wp-login.php?action=lostpassword
and not
http://www.site2.com/wp-login.php?action=lostpassword

the fix is:

you change on the most lines network_site_url -> site_url
wp-includes/general-template.php

function wp_lostpassword_url( $redirect = '' ) {
	        $args = array( 'action' => 'lostpassword' );
	        Se ( !empty($redirect) ) {
	                $args['redirect_to'] = $redirect;
	        }

	        $lostpassword_url = add_query_arg( $args, network_site_url('wp-login.php', 'login') );
	        return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect );
}

should be

function wp_lostpassword_url( $redirect = '' ) {
	        $args = array( 'action' => 'lostpassword' );
	        Se ( !empty($redirect) ) {
	                $args['redirect_to'] = $redirect;
	        }

	        $lostpassword_url = add_query_arg( $args, site_url('wp-login.php', 'login') );
	        return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect );
}

Also WordPress is generating the incorrect email in wp-login.php

$message = __('Someone requested that the password be reset for the following account:') . "rnrn";
	$message .= network_home_url( '/' ) . "rnrn";
	$message .= sprintf(__('Username: %s'), $user_login) . "rnrn";
	$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "rnrn";
	$message .= __('To reset your password, visit the following address:') . "rnrn";
	$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">rn";

should be

$message = __('Someone requested that the password be reset for the following account:') . "rnrn";
	$message .= home_url( '/' ) . "rnrn";
	$message .= sprintf(__('Username: %s'), $user_login) . "rnrn";
	$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "rnrn";
	$message .= __('To reset your password, visit the following address:') . "rnrn";
	$message .= '<' . site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_

 

<form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">

should be

<form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">

 

$login_header_url   = network_home_url();

should be

$login_header_url   = home_url();

 

wp_die( __('The e-mail could not be sent.') . "<br />n" . __('Possible reason: your host may have disabled the mail() function.') );

should be

wp_die( __('The e-mail could not be sent.') . "<br />n" . __('Possible reason: your host may have disabled the mail() function, or enable the Plugin WP-Mail-SMTP and configure it.') );

 

$blogname = ['current_site']->site_name;

should be

$blogname = home_url( '/' );

 

 

Accelerazione WordPress su Synology

Fuori dalla scatola, WordPress in esecuzione su un Synology è molto lenta (Cerca nei Synology.com o Google se non mi credete). Questo articolo spiega come ottimizzare Synology e il vostro sito WordPress per la velocità.

disconoscimento

Il sotto sono modifiche che ho implementato con successo. Non so l'estensione completa della loro validità; che sembra solo per portare estremamente notevoli miglioramenti delle prestazioni positivo alla mia Synology. Oltre a questi cambiamenti non funziona come previsto su Synology, essi sono rischiosi. Prima di apportare modifiche, il backup dei dati e la configurazione Synology fuori Synology in caso accadesse il peggio. Con l'implementazione di uno qualsiasi dei suggerimenti qui sotto, si sta procedendo a proprio rischio, senza alcuna aspettativa di responsabilità e o sostegno da me. Ho solo prendersi il merito se i cambiamenti che portare risultati positivi

Mi aspetto anche di avere moderati competenze tecniche - in grado di modificare la Synology DSM tramite la console, installare e configurare i plugin, uso telnet, eseguire eseguibili e modificare / salvare i file di testo in Linux, eccetera.

Synology sintonia

Synology produce alcuni piuttosto potenti dispositivi di storage di rete. Queste sono fondamentalmente piccoli computer ottimizzati per memorizzare / servire i dati e in grado di eseguire programmi per lo streaming di musica, Video, fotografie, siti web, e più. Per impostazione predefinita, WordPress verrà eseguito relativamente lento su una Synology in quanto è configurato in modo da ridurre al minimo su disco, processore, e l'utilizzo della memoria. Semplicemente facendo alcuni cambiamenti, è possibile rendere WordPress sul proprio correre più veloce di Synology sito media senza compromettere la sua capacità di eseguire altre funzioni.

Abilita cache PHP

Per impostazione predefinita, Synology è configurato per consentire di cache PHP. Assicurarsi che "Abilita cache PHP" è ancora verificato in Pannello di controllo | Servizi web | Impostazioni PHP.

Synology DSM-5-PHP-caching

 

Configurazioni di sintonia

Accordare le seguenti configurazioni vi darà il più grande guadagno di prestazioni di una qualsiasi delle altre raccomandazioni elencate in questo articolo. E 'anche il più pericoloso, come si può facilmente causare un eccessivo consumo delle risorse rallentare parti di tutti Synology o peggio ancora può rompere WordPress o l'intero Synology. Prima di procedere, accertarsi di aver eseguito il backup di tutto OFF Synology in caso di necessità di eseguire un ripristino completo Synology. Ora che abbiamo che buio e sorte avversa finita, avanti con la sintonizzazione ... Per eseguire nessuna delle modifiche indicati, è necessario prima attivare Telnet selezionando "Enable servizio Telnet" in Pannello di controllo | terminale & SNMP | terminale.

Synology DSM-5-Enable-Telnet

Nota: L'abilitazione consente l'accesso telnet da riga di comando remoto al Synology. Si dovrebbe abilitare solo quando necessario e se la rete sia adeguatamente protetta.

OPCache

Codice operativo è preinstallato meccanismo di caching su Synology memorizzare nella cache l'esecuzione di codice PHP in memoria e per richiamare il codice dalla memoria invece che dal disco. Per configurare il motore di codice operativo a consumare più risorse e quindi di velocizzare WordPress:

  1. Telnet alla Synology con l'account di root
  2. Modificare e salvare /etc / php / conf.d /opcache.ini con le modifiche desiderate
  3. Riavviare Apache eseguendo /usr / Syno / etc / rc.d / restart S97apache-sys.sh

Qui di seguito sono alcuni dei cambiamenti che ho implementato con risultati positivi:

Configurazione PHP

PHP è il linguaggio di WordPress è scritto in. Synology ha il motore PHP preinstallato e preconfigurato per consumare risorse minime come la memoria e la CPU. Per configurare il motore PHP a consumare più risorse e quindi di velocizzare WordPress:

  1. Telnet alla Synology con l'account di root
  2. Modificare e salvare /etc / php / php.ini con le modifiche desiderate
  3. Riavviare Apache eseguendo /usr / Syno / etc / rc.d / restart S97apache-sys.sh

Qui di seguito sono alcuni dei cambiamenti che ho implementato con risultati positivi:

memory_limit = 512M
max_execution_time = 2000

Apache è il server web preinstallato sul Synology per tutte le applicazioni web (come WordPress). La configurazione di Apache è preconfigurato per consumare risorse minime come la memoria e la CPU. Per configurare Apache a consumare più risorse e quindi di velocizzare WordPress:

  1. Telnet alla Synology con l'account di root
  2. Modificare e salvare /etc / httpd / conf / extra / httpd-mpm.conf-utente con le modifiche desiderate
  3. Riavviare Apache eseguendo /usr / Syno / etc / rc.d / restart S97apache-sys.sh

Qui di seguito sono alcuni dei cambiamenti che ho implementato con risultati positivi:

MariaDB è il server di database è possibile installare per l'esecuzione con Wordpress. La configurazione MariaDB è preconfigurato per consumare risorse minime come la memoria e la CPU. Per configurare MariaDB a consumare più risorse e quindi di velocizzare WordPress:

  1. Telnet alla Synology con l'account di root
  2. Modificare e salvare /volume1/@appstore/MariaDB/etc/mysql/my.cnf con le modifiche desiderate (Nota: potrebbe essere necessario cambiare "Volume1" per la posizione in cui è stato installato MariaDB).
  3. Riavviare MariaDB eseguendo /usr / share / mysql / riavvio mysql.server

Qui di seguito sono alcuni dei cambiamenti che ho implementato con risultati positivi:

WordPress Ottimizzazione

WordPress di default non è anche ottimizzato per la velocità, ma per fortuna ci sono alcuni ottimi plugin e cambia la può fare per rendere il vostro grido sito.

Abilita Site Caching

Scaricare, attivare, e configurare il W3 Total Cache collegare.

W3-Total-Cache

Fondamentalmente questo plugin memorizza nella cache tutti i contenuti dinamici sul tuo sito web, mentre anche riducendo le code, ove possibile,. La prestazione maturata a causa di questo plugin è come la notte e il giorno. Se siete ombroso sull'implementazione di uno qualsiasi dei suggerimenti in questo articolo, questo è quello di non saltare.

Ci sono tonnellate di impostazioni e tonnellate di articoli già sul web su come configurare in modo ottimale questo plugin. Ecco alcuni suggerimenti rapidi:

  • Abilita pagina, minify, Banca dati, oggetto, e cache del browser
  • Selezionare "OpCode: Cache PHP alternativa (APC)"Come metodo di cache (se non "Disco: Migliorata", "Disco: Basic "o semplicemente" disco ")
  • Deselezionare tutti gli elementi all'interno della sezione "Debug"
  • Attiva "inizializzazione Late" nella pagina delle opzioni "Pagina Cache"
  • Aggiornamento "Pagine per Intervallo" per 15 Nella pagina Opzioni "Pagina Cache"

Shrink le vostre immagini

Scaricare, attivare, e utilizzare il WP Smush.it collegare.

Smush-It

Fondamentalmente questo plugin esegue le operazioni per ridurre la dimensione delle immagini del tuo sito web senza perdita di qualità.

Alle immagini "Smush", basta andare alla sezione WordPress "Media" sul cruscotto di amministrazione e fare clic su "Smish.it Ora!"O" Remush "accanto all'immagine desiderata.

O per "Smush" un gruppo di immagini in una sola volta, andare al tuo WordPress "media | sezione Bulk Smush.it "sul cruscotto di amministrazione.

Disattivare i plugin non necessari

I plugin possono aggiungere ulteriori codice che esegue ogni volta che una pagina o un'immagine viene caricata. Questo codice aggiuntivo causerà la pagina per visualizzare più lento. Disattivare tutti i plugin che non sono necessari.

Scegliere un tema veloce

Non tutti i temi sono creati uguali. Esperimento attivando diversi temi e notando il tempo necessario per caricare ogni. Selezionare il tema che riempie la necessità ma anche di caricare il più veloce.

Ottimizzare il database

Scaricare, attivare, e utilizzare il WP-Optimize collegare.

Fondamentalmente questo plugin esegue una serie di database e ottimizza le routine di pulizia per velocizzare le chiamate di database. chiamate al database più veloce significa più veloce caricamento della pagina web.

Per ottimizzare il database, cliccare su "WP-Optimize" nel cruscotto di amministrazione, controllare tutto, e fare clic su "Processo".

Conclusione

Mentre i cambiamenti sopra portare enormi miglioramenti delle prestazioni, ho ancora 2 cose che mi Quirk di essere completamente soddisfatti. Primo, Io non so davvero quali parti delle modifiche di configurazione sono veramente essenziale, che non sono richieste, e se sono ottimizzate per portare le prestazioni ottimali. Secondo, Non vedo il mio Synology utilizzando memoria evidente, nonostante invocando ulteriori consumi di memoria nei file di configurazione. Questo mi fa mettere in discussione il valore che portano.

Ma con quella parte, So WordPress sul mio Synology ora corre sostanzialmente più veloce dopo aver attuato le modifiche di cui sopra. Ed infatti, qualsiasi applicazione web sul tuo Synology deve correre più veloce pure (ex. la console DSM). Fatemi sapere se funzionano bene anche per te per simpatia o la condivisione di questa pagina su Facebook. Sentitevi liberi così di mandarmi qualsiasi migliorare le prestazioni suggerimenti per rendere WordPress sulla pista da Synology ancora più veloce.