Вы должны использовать версию: 5.8.6.7 и изменить основной PHP файл
<?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 автор: Yannick Lefebvre Author URI: HTTP://ylefebvre.ca/ A plugin for the blogging MySQL/PHP-based WordPress. Авторские права 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, или (at your option) any later version. Данная программа распространяется в надежде, что она будет полезна, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ; 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; если не, write to the Free Software Foundation, Инк., 59 Храм Плейс - Люкс 330, Бостон, Массачусетс 02111-1307, США. 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; если ( !get_option( 'link_manager_enabled' ) ) add_filter( 'pre_option_link_manager_enabled', '__return_true' ); если ( 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', ""); если ( $newoptions == "" ) { global $my_link_library_plugin_admin; если ( пустой( $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', ложный, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); global $wpdb; $wpdb->linkcategorymeta = $wpdb->get_blog_prefix() . "linkcategorymeta"; } /************************** Link Library Installation Function **************************/ function ll_install() { global $wpdb; если (function_exists('is_multisite') && is_multisite()) { если (isset($_GET['networkwide']) && ($_GET['networkwide'] == 1)) { $originalblog = $wpdb->blogid; $bloglist = $wpdb->get_col($wpdb->подготовить("SELECT blog_id FROM $wpdb->blogs")); для каждого ($bloglist as $blog) { switch_to_blog($blog); $this->create_table_and_settings(); } switch_to_blog($originalblog); вернуть; } } $this->create_table_and_settings(); } function new_network_site($blog_id, $user_id, $domain, $путь, $site_id, $meta ) { global $wpdb; если ( ! function_exists('is_plugin_active_for_network') ) require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); если (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'); если ($genoptions != '') { если ($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; $я <= $genoptions['numberstylesets']; $i++) { $settingsname = 'LinkLibraryPP' . $я; $options = get_option($settingsname); если ($options != '') { если ($options['showname'] == '') $options['showname'] = true; если ( isset($options['show_image_and_name'] ) && $options['show_image_and_name'] == true) { $options['showname'] = true; $options['show_images'] = true; } если ($options['sourcename'] == '') $options['sourcename'] = 'primary'; если ($options['sourceimage'] == '') $options['sourceimage'] = 'primary'; если ($options['dragndroporder'] == '') { если ($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'); для каждого ($allelements as $element) { если (!in_array($element, $elementarray)) { $elementarray[] = $element; $options['dragndroporder'] = implode(",", $elementarray); } } } если ($options['flatlist'] === true) $options['flatlist'] = 'unordered'; elseif ($options['flatlist'] === false) $options['flatlist'] = 'table'; } update_option($settingsname, $options); } } } function remove_querystring_var($URL, $ключ) { $keypos = strpos($URL, $ключ); если ($keypos) { $ampersandpos = strpos($URL, '&', $keypos); $newurl = substr($URL, 0, $keypos - 1); если ($ampersandpos) $newurl .= substr($URL, $ampersandpos); } else $newurl = $url; return $newurl; } /************************** Link Library Uninstall Function **************************/ function ll_uninstall() { $genoptions = get_option('LinkLibraryGeneral'); если ($genoptions != '') { если ( isset( $genoptions['stylesheet'] ) && isset( $genoptions['fullstylesheet'] ) && $genoptions['stylesheet'] != '' && $genoptions['fullstylesheet'] == '') { $stylesheetlocation = plugins_url( $genoptions['stylesheet'], __FILE__ ); если ( file_exists( $stylesheetlocation ) ) $genoptions['fullstylesheet'] = file_get_contents( $stylesheetlocation ); update_option('LinkLibraryGeneral', $genoptions); } } } function db_prefix() { global $wpdb; если (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; если ($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 ); } если ($llstylesheet == true) { $genoptions = get_option('LinkLibraryGeneral'); эхо "<style id='LinkLibraryStyle' type='text/css'>N"; echo stripslashes($genoptions['fullstylesheet']); эхо "</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; если ($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 "; если ($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($правила) { $newrules = array(); $genoptions = get_option('LinkLibraryGeneral'); если ($genoptions != '') { for ($i = 1; $я <= $genoptions['numberstylesets']; $i++) { $settingsname = 'LinkLibraryPP' . $я; $options = get_option($settingsname); если ($options['enablerewrite'] == true && $options['rewritepage'] != '') $newrules['(' . $options['rewritepage'] . ')/(.+?)$'] = 'index.php?pagename=$matches[1]&cat_name=$matches[2]'; если ($options['publishrssfeed'] == true) { $xpath = $this->relativePath( dirname( __FILE__ ), ABSPATH ); если ($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 + $правила; } // Adding the id var so that WP recognizes it function ll_insertMyRewriteQueryVars($vars) { array_push($vars, 'cat_name'); return $vars; } function addhttp( $URL ) { если (!preg_match("~^(?:е|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 = ''; если (isset($_GET['cat_id'])) $categoryid = intval($_GET['cat_id']); если (!isset($_GET['searchll']) || $showcatonsearchresults == true) { $countcat = 0; $order = strtolower($order); $output .= "<!-- Link Library Categories Output -->нн"; если ($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 .= "если (typeof(ajaxobject) !знак равно "undefined") { ajaxobject.abort(); }N"; $output .= "tjQuery('#contentLoading').toggle();" . "jQuery.ajax( {" . " тип: 'POST', " . " URL: '" . admin_url( 'admin-ajax.php' ) . "', " . " data: { action: 'link_library_ajax_update', " . " _ajax_nonce: '" . $nonce . "', " . " id : _incomingID, " . " настройки : _settingsID, " . " linkresultpage: _pagenumber }, " . " success: функция( data ){ " . " jQuery('#linklist" . $настройки. "').html( data ); " . " jQuery('#contentLoading').toggle();N" . " } } ); "; $output .= "}N"; $output .= "</SCRIPT>нн"; } // Handle link category sorting $direction = 'ASC'; если (substr($order,0,1) == '_') { $direction = 'DESC'; $order = substr($order,1); } если (!isset($direction)) $direction = ''; // Fetch the link category data as an array of hashesa $linkcatquery = "SELECT "; если ( $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"; если ($showinvisible == false) $linkcatquery .= " AND l.link_visible != 'N'"; если (!$showuserlinks) $linkcatquery .= " AND l.link_description not like '%LinkLibrary:AwaitingModeration:RemoveTextToApprove%' "; $linkcatquery .= " ) "; $linkcatquery .= "WHERE tt.taxonomy = 'link_category'"; если ($categorylist !знак равно "") $linkcatquery .= " AND t.term_id in (" . $categorylist. ")"; если ($excludecategorylist !знак равно "") $linkcatquery .= " AND t.term_id not in (" . $excludecategorylist . ")"; если ($hide_if_empty == true) $linkcatquery .= " AND l.link_name != '' "; $linkcatquery .= " GROUP BY t.name "; если ($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); если ($debugmode) { $output .= "N<!-- Category Query: " . print_r($linkcatquery, TRUE) . "-->нн"; $output .= "N<!-- Category Results: " . print_r($catnames, TRUE) . "-->нн"; } // Display each category if ($catnames) { $output .= "<div id="linktable" class="linktable">"; если ($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; для каждого ( (array) $catnames as $catname) { // Handle each category. // Первый, fix the sort_order info //$orderby = $cat['sort_order']; //$orderby = (bool_from_yn($cat['sort_desc'])?'_':'') . $orderby; $catfront = ''; $cattext = ''; $catitem = ''; // Display the category name $countcat += 1; если ($flatlist == 'table' and (($countcat % $num_columns == 1) или ($num_columns == 1) )) $output .= "<tr>N"; если ($flatlist == 'table') $catfront = ' <td>'; elseif ($flatlist == 'unordered') $catfront = ' <в>'; elseif ($flatlist == 'dropdown') { $catfront = ' <option '; если ($categoryid != '' && $categoryid == $catname->term_id) $catfront .= 'selected="selected" '; $catfront .= 'value="'; } если ($showonecatonly) { если ($showonecatmode == 'AJAX' || $showonecatmode == '') { если ($flatlist != 'dropdown') $cattext = "<a href='#' onClick="showLinkCat('" . $catname->term_id. "', '" . $настройки . "', 1);return false;" >"; elseif ($flatlist == 'dropdown') $cattext = $catname->term_id; } elseif ($showonecatmode == 'HTMLGET') { если ($flatlist != 'dropdown') $cattext = "<a href='"; если ($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; если ($flatlist != 'dropdown') $cattext .= "'>"; } elseif ($showonecatmode == 'HTMLGETPERM') { если ($flatlist != 'dropdown') $cattext = "<a href='"; $cattext .= "/" . $rewritepage . "/" . $catname->category_nicename; если ($flatlist != 'dropdown') $cattext .= "'>"; } } else if ($catanchor) { если (!$pagination) { если ($flatlist != 'dropdown') $cattext = '<a href="'; $cattext .= '#' . $catname->category_nicename; если ($flatlist != 'dropdown') $cattext .= '">'; } elseif ($pagination) { если ($linksperpage == 0 && $linksperpage == '') $linksperpage = 5; $pageposition = ( $linkcount + 1 ) / $linksperpage; $ceilpageposition = ceil($pageposition); если ( $ceilpageposition == 0 && !isset( $_GET['linkresultpage'] ) ) { если ($flatlist != 'dropdown') $cattext = '<a href="'; $cattext .= get_permalink() . '#' . $catname->category_nicename; если ( $flatlist != 'dropdown' ) $cattext .= '">'; } еще { если ( $flatlist != 'dropdown' ) $cattext = '<a href="'; $cattext .= '?linkresultpage=' . ($ceilpageposition == 0 ? 1 : $ceilpageposition) . '#' . $catname->category_nicename; если ( $flatlist != 'dropdown' ) $cattext .= '">'; } $linkcount = $linkcount + $catname->linkcount; } } else $cattext = ''; если ( $flatlist == 'dropdown' ) $cattext .= '">'; если ( $catlistdescpos == 'right' || $catlistdescpos == '' ) { $catitem .= '<div class="linkcatname">' . $catname->name . '</div>'; если ($showcatlinkcount) $catitem .= " (" . $catname->linkcount . ")"; } если ( $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 . "</пролет>"; } если ($catlistdescpos == 'left') { $catitem .= '<div class="linkcatname">' . $catname->name . '</div>'; если ($showcatlinkcount) $catitem .= " (" . $catname->linkcount . ")"; } если (($catanchor || $showonecatonly) && $flatlist != 'dropdown') $catitem .= "</a>"; $output .= ($catfront . $cattext . $catitem ); если ($flatlist == 'table') $catterminator = " </td>N"; elseif ($flatlist == 'unordered') $catterminator = " </в>N"; elseif ($flatlist == 'dropdown') $catterminator = " </option>N"; $output .= ($catterminator); если ($flatlist == "table" а также ($countcat % $num_columns == 0)) $output .= "</tr>N"; } если ($flatlist == "table" а также ($countcat % $num_columns == 3)) $output .= "</tr>N"; если ($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"; если ($showonecatonly && ($showonecatmode == 'AJAX' || $showonecatmode == '')) { если ($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"; } если ($flatlist == 'dropdown') { $output .= "<SCRIPT TYPE='text/javascript'>N"; $output .= "tfunction showcategory(){N"; если ($showonecatonly && ($showonecatmode == 'AJAX' || $showonecatmode == '') ) { $output .= "catidvar = document.catselect.catdropdown.options[document.catselect.catdropdown.selectedIndex].value;"; $output .= "showLinkCat(catidvar, '" . $настройки . "', 1);return false; }"; } еще { $output .= "ttlocation=n"; $output .= "document.catselect.catdropdown.options[document.catselect.catdropdown.selectedIndex].value }N"; } $output .= "</SCRIPT>N"; } } еще { $output .= "<div>" . __('No categories found', 'link-library') . ".</div>"; } $output .= "N<!-- End of Link Library Categories Output -->нн"; } return $output; } function ll_highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>') { если ($str == '') { return ''; } если ($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, $настройки, $pageID ) { $dotbelow = false; $dotabove = false; $incomingget = $_GET; unset ( $incomingget['page_id'] ); unset ( $incomingget['linkresultpage'] ); unset ( $incomingget['cat_id'] ); если ($numberofpages > 1) { $paginationoutput = "<div class='pageselector'>"; если ($pagenumber !знак равно 1) { $paginationoutput .= "<span class='previousnextactive'>"; если (!$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') . "</a>"; } elseif ($showonecatonly) { если ($showonecatmode == 'AJAX' || $showonecatmode == '') $paginationoutput .= "<a href='#' onClick="showLinkCat('" . $AJAXcatid . "', '" . $настройки . "', " . $previouspagenumber . ");return false;" >" . __('Previous', 'link-library') . "</a>"; 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') . "</a>"; } } $paginationoutput .= "</пролет>"; } else $paginationoutput .= "<span class='previousnextinactive'>" . __('Previous', 'link-library') . "</пролет>"; for ($counter = 1; $counter <= $numberofpages; $counter++) { если ($counter <знак равно 2 || $counter >= $numberofpages - 1 || ($counter <= $pagenumber + 2 && $counter >= $pagenumber - 2)) { если ($counter != $pagenumber) $paginationoutput .= "<span class='unselectedpage'>"; else $paginationoutput .= "<span class='selectedpage'>"; если (!$showonecatonly) { $argumentarray = array ( 'page_id' => $pageID, 'linkresultpage' => $counter ); $argumentarray = array_merge( $argumentarray, $incomingget ); $targetaddress = add_query_arg( $argumentarray ); $paginationoutput .= "<a href='" . $targetaddress . "'>" . $counter . "</a>"; } elseif ($showonecatonly) { если ($showonecatmode == 'AJAX' || $showonecatmode == '') $paginationoutput .= "<a href='#' onClick="showLinkCat('" . $AJAXcatid . "', '" . $настройки . "', " . $counter . ");return false;" >" . $counter . "</a>"; 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 . "</a>"; } } $paginationoutput .= "</a></пролет>"; } если ($counter >знак равно 2 && $counter < $pagenumber - 2 && $dotbelow == false) { $paginationoutput .= "..."; $dotbelow = true; } если ($counter > $pagenumber + 2 && $counter < $numberofpages - 1 && $dotabove == false) { $paginationoutput .= "..."; $dotabove = true; } } если ($pagenumber != $numberofpages) { $paginationoutput .= "<span class='previousnextactive'>"; если (!$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') . "</a>"; } elseif ($showonecatonly) { если ($showonecatmode == 'AJAX' || $showonecatmode == '') $paginationoutput .= "<a href='#' onClick="showLinkCat('" . $AJAXcatid . "', '" . $настройки . "', " . $nextpagenumber . ");return false;" >" . __('Next', 'link-library') . "</a>"; 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') . "</a>"; } } $paginationoutput .= "</пролет>"; } else $paginationoutput .= "<span class='previousnextinactive'>" . __('Next', 'link-library') . "</пролет>"; $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 = '<бр />', $nofollow = false, $excludecategorylist = '', $afternote = '', $beforeitem = '<в>', $afteritem = '</в>', $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 -->нн"; $currentcategory = 1; $categoryname = ""; если ( $showonecatonly && $showonecatmode == 'AJAX' && $AJAXcatid == '' ) { $AJAXnocatset = true; } еще { $AJAXnocatset = false; } если ($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' "; если ($hide_if_empty) $catquery .= "AND l.link_id is not NULL AND l.link_description not like '%LinkLibrary:AwaitingModeration:RemoveTextToApprove%' "; если ($categorylist !знак равно "") $catquery .= " AND t.term_id in (" . $categorylist. ")"; если ($excludecategorylist !знак равно "") $catquery .= " AND t.term_id not in (" . $excludecategorylist . ")"; если ($showinvisible == false) $catquery .= " AND l.link_visible != 'N'"; $mode = "normal"; $catquery .= " ORDER by "; если ($featuredfirst == true) $catquery .= "le.link_featured DESC, "; если ($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 . ") "; если ($linkorder == "name") $catquery .= ", link_name " . $linkdirection; elseif ($linkorder == "id") $catquery .= ", link_id " . $linkdirection; elseif ($linkorder == "order") $catquery .= ", link_order ". $linkdirection; elseif ($linkorder == "свидание") $catquery .= ", link_updated ". $linkdirection; $catitems = $wpdb->get_results($catquery); если ($debugmode) { $output .= "N<!-- AJAX Default Category Query: " . print_r($catquery, TRUE) . "-->нн"; $output .= "N<!-- AJAX Default Category Results: " . print_r($catitems, TRUE) . "-->нн"; } если ($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' "; если ($hide_if_empty) $linkquery .= "AND l.link_id is not NULL AND l.link_description not like '%LinkLibrary:AwaitingModeration:RemoveTextToApprove%' "; если ($categorylist !знак равно "" || isset($_GET['cat_id'])) $linkquery .= " AND t.term_id in (" . $categorylist. ")"; если ( isset($categoryname) && $categoryname !знак равно "" && $showonecatmode == 'HTMLGETPERM') $linkquery .= " AND t.slug = '" . $categoryname. "'"; если ($excludecategorylist !знак равно "") $linkquery .= " AND t.term_id not in (" . $excludecategorylist . ")"; если ($showinvisible == false) $linkquery .= " AND l.link_visible != 'N'"; если (isset($_GET['searchll']) && $_GET['searchll'] !знак равно "") { $searchterms = array(); $searchstring = $_GET['searchll']; $offset = 0; пока ( strpos( $searchstring, '"', $offset ) !== false ) { если ( $offset == 0 ) { $offset = strpos( $searchstring, '"' ); } еще { $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; } } если ( !пустой( $searchstring ) ) { $searchterms = array_merge( $searchterms, explode(" ", $searchstring ) ); } если ($searchterms) { $mode = "search"; $termnb = 1; для каждого($searchterms as $searchterm) { если ( !пустой( $searchterm ) ) { $searchterm = str_replace( '--', '', $searchterm ); $searchterm = str_replace( ';', '', $searchterm ); $searchterm = esc_html( stripslashes( $searchterm ) ); если ( $searchterm == true ) { если ($termnb == 1) { $linkquery .= ' AND (link_name like "%' . $searchterm . '%" '; $termnb++; } еще { $linkquery .= ' OR link_name like "%' . $searchterm . '%" '; } если ($hidecategorynames == false) $linkquery .= ' OR name like "%' . $searchterm . '%" '; если ($shownotes) $linkquery .= ' OR link_notes like "%' . $searchterm . '%" '; если ($showdescription) $linkquery .= ' OR link_description like "%' . $searchterm . '%" '; если ($showlargedescription) $linkquery .= ' OR link_textfield like "%' . $searchterm . '%" '; } } } $linkquery .= ")"; } } else $mode = "normal"; $linkquery .= " ORDER by "; если ($featuredfirst == true) $linkquery .= "link_featured DESC, "; если ($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 . ") "; если ($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 == "свидание") $linkquery .= ", l.link_updated ". $linkdirection; если ($pagination && $mode != 'search') { $linkitemsforcount = $wpdb->get_results($linkquery); $numberoflinks = count($linkitemsforcount); $quantity = $linksperpage + 1; если ( isset( $_POST['linkresultpage'] ) || isset( $_GET['linkresultpage'] ) ) { если ( isset( $_POST['linkresultpage'] ) ) { $pagenumber = $_POST['linkresultpage']; } elseif ( isset( $_GET['linkresultpage'] ) ) { $pagenumber = $_GET['linkresultpage']; } $startingitem = ($pagenumber - 1) * $linksperpage; $linkquery .= " LIMIT " . $startingitem . ", " . $quantity; } еще { $pagenumber = 1; $linkquery .= " LIMIT 0, " . $quantity; } } $linkitems = $wpdb->get_results($linkquery, ARRAY_A); если ($debugmode) { $output .= "N<!-- Link Query: " . print_r($linkquery, TRUE) . "-->нн"; $output .= "N<!-- Link Results: " . print_r($linkitems, TRUE) . "-->нн"; } если ($pagination) { если ($linksperpage == 0 && $linksperpage == '') $linksperpage = 5; если (count($linkitems) > $linksperpage) { array_pop($linkitems); $nextpage = true; } else $nextpage = false; если( isset( $numberoflinks ) ) { $preroundpages = $numberoflinks / $linksperpage; $numberofpages = ceil( $preroundpages * 1 ) / 1; } } если ($linkorder == 'random') { shuffle($linkitems); } если ( $maxlinks != '' ) { если ( is_numeric( $maxlinks ) ) { array_splice( $linkitems, $maxlinks ); } } если ($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, $настройки, $pageID ); } эхо "<!-- showonecatmode: " . $showonecatonly . ", AJAXnocatset: " . $AJAXnocatset . ", nocatonstartup: " . $nocatonstartup . "-->"; // Display links if ( ( $linkitems && $showonecatonly && $AJAXnocatset && $nocatonstartup && !isset( $_GET['searchll'] ) ) || ( пустой( $linkitems ) && $nocatonstartup && пустой( $_GET['searchll'] ) ) ) { $output .= "<div id='linklist" . $настройки . "' class='linklist'>N"; $output .= '</div>'; } elseif ( $linkitems ) { $output .= "<div id='linklist" . $настройки . "' class='linklist'>N"; если ( $mode == 'search' ) { $output .= "<div class='resulttitle'>" . __('Search Results for', 'link-library') . " '" . stripslashes( $_GET['searchll'] ) . "'</div>"; } $currentcategoryid = -1; $xpath = $this->relativePath( dirname( __FILE__ ), ABSPATH ); для каждого ( $linkitems as $linkitem ) { если ($currentcategoryid != $linkitem['term_id']) { если ($currentcategoryid !знак равно -1 && $showonecatonly && $_GET['searchll'] == "") { break; } если ($currentcategoryid !знак равно -1) { // Close the last category if ($displayastable) $output .= "T</table>N"; else $output .= "T</ul>N"; если ($catlistwrappers != '') $output .= "</div>"; если ( $showlinksonclick ) { $output .= "</div>"; } $output .= "</div>"; $currentcategory = $currentcategory + 1; } $currentcategoryid = $linkitem['term_id']; $output .= "<div class='LinkLibraryCat LinkLibraryCat" . $currentcategoryid . "'>"; $linkcount = 0; $catlink = ''; $cattext = ''; $catenddiv = ''; если ($catlistwrappers == 1) $output .= "<div class="" . $beforecatlist1 . "">"; else if ($catlistwrappers == 2) { $remainder = $currentcategory % $catlistwrappers; switch ($remainder) { случай 0: $output .= "<div class="" . $beforecatlist2 . "">"; break; случай 1: $output .= "<div class="" . $beforecatlist1 . "">"; break; } } else if ($catlistwrappers == 3) { $remainder = $currentcategory % $catlistwrappers; switch ($remainder) { случай 0: $output .= "<div class="" . $beforecatlist3 . "">"; break; случай 2: $output .= "<div class="" . $beforecatlist2 . "">"; break; случай 1: $output .= "<div class="" . $beforecatlist1 . "">"; break; } } // Display the category name if ($hidecategorynames == false || $hidecategorynames == "") { $caturl = get_metadata( 'linkcategory', $linkitem['term_id'], 'linkcaturl', правда ); если ($catanchor) $cattext = '<div id="' . $linkitem['slug'] . '">'; else $cattext = ''; если ($divorheader == false) { если ($mode == "search") для каждого ($searchterms as $searchterm) { $linkitem['name'] = $this->ll_highlight_phrase($linkitem['name'], $searchterm, '<span class="highlight_word">', '</пролет>'); } $catlink = '<div class="' . $catnameoutput . '">'; если ($catdescpos == "right" || $catdescpos == '') { если ( !пустой( $caturl ) ) { $catlink .= '<a href="' . $this->addhttp( $caturl ) . '" '; если ( !пустой( $linktarget ) ) $catlink .= ' target="' . $linktarget . '"'; $catlink .= '>'; } $catlink .= $linkitem['name']; если ( !пустой( $caturl ) ) { $catlink .= '</a>'; } } если ($showcategorydesclinks) { $catlink .= "<span class='linklistcatnamedesc'>"; $linkitem['description'] = str_replace("[", "<", $linkitem['description']); $linkitem['description'] = str_replace("]", ">", $linkitem['description']); $catlink .= $linkitem['description']; $catlink .= '</пролет>'; } если ($catdescpos == "left") { если ( !пустой( $caturl ) ) { $catlink .= '<a href="' . $this->addhttp( $caturl ) . '" '; если ( !пустой( $linktarget ) ) $catlink .= ' target="' . $linktarget . '"'; $catlink .= '>'; } $catlink .= $linkitem['name']; если ( !пустой( $caturl ) ) { $catlink .= '</a>'; } } если ( $showlinksonclick ) { $catlink .= '<span class="expandlinks" ID ="LinksInCat' . $linkitem['term_id'] . '">'; $catlink .= '<img src="' . plugins_url( 'icons/expand-32.png', __FILE__ ) . '" />'; $catlink .= '</пролет>'; } $catlink .= "</div>"; } else if ($divorheader == true) { если ($mode == "search") для каждого ($searchterms as $searchterm) { $linkitem['name'] = $this->ll_highlight_phrase($linkitem['name'], $searchterm, '<span class="highlight_word">', '</пролет>'); } $catlink = '<div class="'. $catnameoutput . '">'; если ($catdescpos == "right" || $catdescpos == '') { если ( !пустой( $caturl ) ) { $catlink .= '<a href="' . $this->addhttp( $caturl ). '" '; если ( !пустой( $linktarget ) ) $catlink .= ' target="' . $linktarget . '"'; $catlink .= '>'; } $catlink .= $linkitem['name']; если ( !пустой( $caturl ) ) { $catlink .= '</a>'; } } если ($showcategorydesclinks) { $catlink .= "<span class='linklistcatnamedesc'>"; $linkitem['description'] = str_replace("[", "<", $linkitem['description']); $linkitem['description'] = str_replace("]", ">", $linkitem['description']); $catlink .= $linkitem['description']; $catlink .= '</пролет>'; } если ($catdescpos == "left") { если ( !пустой( $caturl ) ) { $catlink .= '<a href="' . $this->addhttp( $caturl ) . '" '; если ( !пустой( $linktarget ) ) $catlink .= ' target="' . $linktarget . '"'; $catlink .= '>'; } $catlink .= $linkitem['name']; если ( !пустой( $caturl ) ) { $catlink .= '</a>'; } } если ( $showlinksonclick ) { $catlink .= '<span class="expandlinks" ID ="LinksInCat' . $linkitem['term_id'] . '">'; $catlink .= '<img src="' . plugins_url( 'icons/expand-32.png', __FILE__ ) . '" />'; $catlink .= '</пролет>'; } $catlink .= '</div>'; } если ($catanchor) $catenddiv = '</div>'; else $catenddiv = ''; } $output .= $cattext . $catlink . $catenddiv; если ( $showlinksonclick ) { $output .= '<div class="LinksInCat' . $currentcategoryid . ' LinksInCat">'; } если ($displayastable == true) { $catstartlist = "nt<table class='linklisttable'>N"; если ($showcolumnheaders == true) { $catstartlist .= "<div class='linklisttableheaders'><tr>"; если ($linkheader !знак равно "") $catstartlist .= "<th><div class='linklistcolumnheader'>".$linkheader."</div></th>"; если ($descheader !знак равно "") $catstartlist .= "<th><div class='linklistcolumnheader'>".$descheader."</div></th>"; если ($notesheader !знак равно "") $catstartlist .= "<th><div class='linklistcolumnheader'>".$notesheader."</div></th>"; $catstartlist .= "</tr></div>N"; } else $catstartlist .= ''; } else $catstartlist = "nt<ul>N"; $output .= $catstartlist; } $between = "N"; если ($rssfeedinline == true) include_once(ABSPATH . WPINC . '/feed.php'); если ($showuserlinks == true || strpos($linkitem['link_description'], "LinkLibrary:AwaitingModeration:RemoveTextToApprove") == false) { $linkcount = $linkcount + 1; если ($linkaddfrequency > 0) если (($linkcount - 1) % $linkaddfrequency == 0) $output .= stripslashes($addbeforelink); если (!isset($linkitem['recently_updated'])) $linkitem['recently_updated'] = false; $output .= stripslashes($beforeitem); если ($showupdated && $linkitem['recently_updated']) $output .= get_option('links_recently_updated_prepend'); $the_link = '#'; если (!пустой($linkitem['link_url']) ) $the_link = esc_html($linkitem['link_url']); $the_second_link = '#'; если (!пустой($linkitem['link_second_url']) ) $the_second_link = esc_html($linkitem['link_second_url']); $rel = $linkitem['link_rel']; если ('' != $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"'; если ($use_html_tags) { $descnotes = $linkitem['link_notes']; $descnotes = str_replace("[", "<", $descnotes); $descnotes = str_replace("]", ">", $descnotes); } else $descnotes = esc_html($linkitem['link_notes'], ENT_QUOTES); если ($use_html_tags) { $desc = $linkitem['link_description']; $desc = str_replace("[", "<", $desc); $desc = str_replace("]", ">", $desc); } еще { $desc = esc_html($linkitem['link_description'], ENT_QUOTES); } $cleandesc = $desc; $cleanname = esc_html($linkitem['link_name'], ENT_QUOTES); если ( $use_html_tags ) { $textfield = stripslashes( $linkitem['link_textfield'] ); $textfield = str_replace( '[', '<', $textfield ); $textfield = str_replace( ']', '>', $textfield ); } еще { $textfield = stripslashes( $linkitem['link_textfield'] ); } если ($mode == "search") { для каждого ($searchterms as $searchterm) { $descnotes = $this->ll_highlight_phrase($descnotes, $searchterm, '<span class="highlight_word">', '</пролет>'); $desc = $this->ll_highlight_phrase($desc, $searchterm, '<span class="highlight_word">', '</пролет>'); $name = $this->ll_highlight_phrase($linkitem['link_name'], $searchterm, '<span class="highlight_word">', '</пролет>'); $textfield = $this->ll_highlight_phrase($textfield, $searchterm, '<span class="highlight_word">', '</пролет>'); } } else $name = $cleanname; если ( $linktitlecontent == 'linkname' ) { $title = $cleanname; } elseif ($linktitlecontent == 'linkdesc' ) { $title = $cleandesc; } если ($showupdated) { если (substr($linkitem['wp.dev'],0,2) != '00') { $title .= ' ('.__('Last updated', 'link-library') . ' ' . date_i18n(get_option('links_updated_date_format'), strtotime( $linkitem['link_updated'] ) ) .')'; } } если (!пустой( $title ) ) $title = ' title="' . $title . '"'; $alt = ' alt="' . $cleanname . '"'; $target = $linkitem['link_target']; если ('' != $target) $target = ' target="' . $target . '"'; еще { $target = $linktarget; если ('' != $target) $target = ' target="' . $target . '"'; } если ($dragndroporder == '') $dragndroporder = '1,2,3,4,5,6,7,8,9,10'; $dragndroparray = explode(',', $dragndroporder); если ($dragndroparray) { для каждого ($dragndroparray as $arrayelements) { switch ($arrayelements) { случай 1: //------------------ Image Output -------------------- $imageoutput = ''; если ( (($linkitem['link_image'] != '' || $usethumbshotsforimages)) && ($show_images)) { $imageoutput .= stripslashes($beforeimage) . '<a href="'; если ( !$enablelinkpopup ) { если ($sourceimage == 'primary' || $sourceimage == '') $imageoutput .= $the_link; elseif ($sourceimage == 'secondary') $imageoutput .= $the_second_link; } еще { $imageoutput .= home_url() . '/?link_library_popup_content=1&linkid=' . $linkitem['proper_link_id'] . '&settings=' . $настройки . '&height=' . ( пустой( $popupheight ) ? 300 : $popupheight ) . '&width=' . ( пустой( $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. '>'; если ( $usethumbshotsforimages && ( !$uselocalimagesoverthumbshots || пустой( $uselocalimagesoverthumbshots ) || ( $uselocalimagesoverthumbshots && пустой( $linkitem['link_image'] ) ) ) ) { если ( !пустой( $thumbshotscid ) ) $imageoutput .= '<img src="HTTP://free.pagepeeker.com/v2/thumbs.php?size=s&url=' . $the_link . '"'; } else if ( !$usethumbshotsforimages || ( $usethumbshotsforimages && $uselocalimagesoverthumbshots && !пустой( $linkitem['link_image'] ) ) ) { если ( strpos($linkitem['link_image'], 'http') !== false ) $imageoutput .= '<img src="HTTP://free.pagepeeker.com/v2/thumbs.php?size=s&url=' . $the_link . '"'; еще // If it's a relative path $imageoutput .= '<img src="HTTP://free.pagepeeker.com/v2/thumbs.php?size=s&url=' . $the_link . '"'; } если ( !$usethumbshotsforimages || ($usethumbshotsforimages && !пустой( $thumbshotscid ) ) || ( $usethumbshotsforimages && $uselocalimagesoverthumbshots && !пустой( $linkitem['link_image'] ) ) ) { $imageoutput .= $alt . $title; если ($imageclass != '') $imageoutput .= ' class="' . $imageclass . '" '; $imageoutput .= "/>"; $imageoutput .= '</a>' . stripslashes($afterimage); } } если ( ( !пустой( $imageoutput ) || ( $usethumbshotsforimages && !пустой( $thumbshotscid ) ) ) && ($show_images) ) { $output .= $imageoutput; break; } elseif ($show_images == false || $shownameifnoimage == false) break; случай 2: //------------------ Name Output -------------------- если (($showname == true) || ($show_images == true && $linkitem['link_image'] == '' && $arrayelements == 1)) { $output .= stripslashes($beforelink); если (($sourcename == 'primary' && $the_link != '#') || ($sourcename == 'secondary' && $the_second_link != '#')) { $output .= '<a href="'; если ( !$enablelinkpopup ) { если ( $sourcename == 'primary' || $sourcename == '' ) $output .= $the_link; elseif ( $sourcename == 'secondary' ) $output .= $the_second_link; } еще { $output .= home_url() . '/?link_library_popup_content=1&linkid=' . $linkitem['proper_link_id'] . '&settings=' . $настройки . '&height=' . ( пустой( $popupheight ) ? 300 : $popupheight ) . '&width=' . ( пустой( $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; если (($sourcename == 'primary' && $the_link != '#') || ($sourcename == 'secondary' && $the_second_link != '#')) $output .= '</a>'; если (($showadmineditlinks) && current_user_can("manage_links")) { $output .= $between . '<a href="' . add_query_arg( array( «Действие» => 'edit', 'link_id' => $linkitem['proper_link_id'] ), admin_url( 'link.php' ) ) . '">(' . __('Edit', 'link-library') . ')</a>'; } если ($showupdated && $linkitem['recently_updated']) { $output .= get_option('links_recently_updated_append'); } $output .= stripslashes($afterlink); } break; случай 3: //------------------ Date Output -------------------- $formatteddate = date_i18n(get_option('links_updated_date_format'), $linkitem['link_date']); если ($showdate) $output .= $between . stripslashes($beforedate) . $formatteddate . stripslashes($afterdate); break; случай 4: //------------------ Description Output -------------------- если ($showdescription) $output .= $between . stripslashes($beforedesc) . $desc . stripslashes($afterdesc); break; случай 5: //------------------ Notes Output -------------------- если ($shownotes) { $output .= $between . stripslashes($beforenote) . $descnotes . stripslashes($afternote); } break; случай 6: //------------------ RSS Icons Output -------------------- если ($show_rss || $show_rss_icon || $rsspreview) $output .= stripslashes($beforerss) . '<div class="rsselements">'; если ($show_rss && ($linkitem['link_rss'] != '')) { $output .= $between . '<a class="rss" href="' . $linkitem['link_rss'] . '">RSS</a>'; } если ($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__ ) . '" /></a>'; } если ($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__ ) . '" /></a>'; } если ($show_rss || $show_rss_icon || $rsspreview) $output .= '</div>' . stripslashes($afterrss); если ($rssfeedinline && $linkitem['link_rss']) { $rss = fetch_feed($linkitem['link_rss']); если (!is_wp_error( $rss ) ) : $maxitems = $rss->get_item_quantity($rssfeedinlinecount); $rss_items = $rss->get_items(0, $maxitems); если ($rss_items) { $output .= '<div id="ll_rss_results">'; для каждого($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() . '</a> - ' . $item->get_date('j F Y | г:i a') . '</div>'; если ($rssfeedinlinecontent) $output .= '<div class="rsscontent">' . $item->get_description() . '</div>'; $output .= '</div>'; $output .= '<бр />'; } $output .= '</div>'; } endif; } break; случай 7: //------------------ Web Link Output -------------------- если ($displayweblink != 'false') { $output .= $between . stripslashes($beforeweblink) . "<a href='"; если ($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 . ">"; если ($displayweblink == 'address') { если (($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 .= "</a>" . stripslashes($afterweblink); } break; случай 8: //------------------ Telephone Output -------------------- если ($showtelephone != 'false') { $output .= $between . stripslashes($beforetelephone); если ($showtelephone != 'plain') { $output .= "<a href='"; если (($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' >"; } если ($showtelephone == 'link' || $showtelephone == "plain") $output .= $linkitem['link_telephone']; elseif ($showtelephone == 'label') $output .= $telephonelabel; если ($showtelephone != 'plain') $output .= "</a>"; $output .= stripslashes($aftertelephone); } break; случай 9: //------------------ E-mail Output -------------------- если ($showemail != 'false') { $output .= $between . stripslashes($beforeemail); если ($showemail != 'plain') { $output .= "<a href='"; если ($showemail == 'mailto' || $showemail == 'mailtolabel') $output .= "mailto:" . $linkitem['link_email']; elseif ($showemail == 'command' || $showemail == 'commandlabel') { $newcommand = str_replace("#электронная почта", $linkitem['link_email'], $emailcommand); $cleanlinkname = str_replace(" ", "%20", $linkitem['link_name']); $newcommand = str_replace("#Компания", $cleanlinkname, $newcommand); $output .= $newcommand; } $output .= "'>"; } если ($showemail == 'plain' || $showemail == 'mailto' || $showemail == 'command') $output .= $linkitem['link_email']; elseif ($showemail == 'mailtolabel' || $showemail == 'commandlabel') $output .= $emaillabel; если ($showemail != 'plain') $output .= "</a>"; $output .= stripslashes($afteremail); } break; случай 10: //------------------ Link Hits Output -------------------- если ($showlinkhits) { $output .= $between . stripslashes($beforelinkhits); $output .= $linkitem['link_visits']; $output .= stripslashes($afterlinkhits); } break; случай 11: //------------------ Link Rating Output -------------------- если ($showrating) { $output .= $between . stripslashes($beforelinkrating); $output .= $linkitem['link_rating']; $output .= stripslashes($afterlinkrating); } break; случай 12: //------------------ Link Large Description Output -------------------- если ($showlargedescription) { $output .= $between . stripslashes($beforelargedescription); $output .= $textfield; $output .= stripslashes($afterlargedescription); } break; } } } $output .= stripslashes($afteritem) . "N"; если ($linkaddfrequency > 0) если ($linkcount % $linkaddfrequency == 0) $output .= stripslashes($addafterlink); } } // end while // Close the last category if ($displayastable) $output .= "T</table>N"; else $output .= "T</ul>N"; если ($catlistwrappers != '') $output .= "</div>"; если ( $showlinksonclick ) { $output .= "</div>"; } $output .= "</div>"; если ( $pagination && $mode !знак равно "search" && ( $paginationposition == 'AFTER' || пустой( $pagination ) ) ) { $previouspagenumber = $pagenumber - 1; $nextpagenumber = $pagenumber + 1; $pageID = get_the_ID(); $output .= $this->link_library_display_pagination( $previouspagenumber, $nextpagenumber, $numberofpages, $pagenumber, $showonecatonly, $showonecatmode, $AJAXcatid, $настройки, $pageID ); } $xpath = $this->relativePath( dirname( __FILE__ ), ABSPATH ); $nonce = wp_create_nonce( 'll_tracker' ); $output .= "<script type='text/javascript'>N"; $output .= "jQuery(document).ready(функция()N"; $output .= "{N"; $output .= "jQuery('a.track_this_link').click(функция() {N"; $output .= "linkid = this.id;N"; $output .= "linkid = linkid.substring(5);"; $output .= "path = '" . $xpath . "';"; $output .= "jQuery.ajax( {" . " тип: 'POST'," . " URL: '" . admin_url( 'admin-ajax.php' ) . "', " . " data: { action: 'link_library_tracker', " . " _ajax_nonce: '" . $nonce . "', " . " id:linkid, xpath:путь } " . " });N"; $output .= "return true;N"; $output .= "});N"; $output .= "jQuery('#linklist" . $настройки . " .expandlinks').click(функция() {N"; $output .= "target = '.' + jQuery(this).attr('id');N"; $output .= "если ( 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 .= "} еще {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" . $настройки . "' class='linklist'>N"; $output .= __('No links found matching your search criteria', 'link-library') . ".N"; $output .= "</div>"; } еще { $output .= "<div id='linklist" . $настройки . "' class='linklist'>N"; $output .= __('No links found', 'link-library') . ".N"; $output .= "</div>"; } $output .= "N<!-- End of Link Library Output -->нн"; return $output; } function PrivateLinkLibrarySearchForm($searchlabel = 'Search', $searchresultsaddress = '') { если ($searchlabel == "") $searchlabel = __('Search', 'link-library'); $output = "<form method='get' id='llsearch'"; если ($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>нн"; 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' . $настройки; $options = get_option($settingsname); если ($code == 'link-library-addlink' || $code == 'link-library-addlinkcustommsg') { если (isset($_GET['addlinkmessage'])) { если ($_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']; если ($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>"; } } если ($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', правда, ложный); $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->ИДЕНТИФИКАТОР; $output .= "<input type='hidden' name='pageid' value='" . $thePostID . "' />"; $output .= "<input type='hidden' name='settingsid' value='" . $настройки . "' />"; $xpath = $this->relativePath( dirname( __FILE__ ), ABSPATH ); $output .= "<input type='hidden' name='xpath' value='" . esc_attr( $xpath ) . "' />"; unset( $xpath ); $output .= "<div class='lladdlink'>N"; если ($addnewlinkmsg == "") $addnewlinkmsg = __('Add new link', 'link-library'); $output .= "<div id='lladdlinktitle'>" . $addnewlinkmsg . "</div>N"; $output .= "<table>N"; если ($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"; если ($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"; если ($showaddlinkrss) { если ($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' "; если ($selectedcategorylist !знак равно "") { $linkcatquery .= " AND t.term_id in (" . $selectedcategorylist. ")"; } если ($excludedcategorylist !знак равно "") { $linkcatquery .= " AND t.term_id not in (" . $excludedcategorylist . ")"; } $linkcatquery .= " ORDER by t.name ASC"; $linkcats = $wpdb->get_results($linkcatquery); если ($debugmode) { $output .= "N<!-- Category query for add link form:" . print_r($linkcatquery, TRUE) . "-->нн"; $output .= "N<!-- Results of Category query for add link form:" . print_r($linkcats, TRUE) . "-->N"; } если ($linkcats) { если ($showaddlinkcat) { если ($linkcatlabel == "") $linkcatlabel = __('Link category', 'link-library'); $output .= "<tr><th>" . $linkcatlabel . "</th><td><SELECT name='link_category' id='link_category'>"; если ($linkcustomcatlistentry == "") $linkcustomcatlistentry = __('User-submitted category (define below)', 'link-library'); для каждого ($linkcats as $linkcat) { $output .= "<OPTION VALUE='" . $linkcat->term_id . "' "; если ( isset($_GET['addlinkcat']) && $_GET['addlinkcat'] == $linkcat->term_id) $output .= "selected"; $output .= ">" . $linkcat->name; } если ($addlinkcustomcat) $output .= "<OPTION VALUE='new'>" . stripslashes($linkcustomcatlistentry) . "N"; $output .= "</SELECT></td></tr>N"; } еще { $output .= "<input type='hidden' name='link_category' id='link_category' value='" . $linkcats[0]->term_id . "'>"; } если ($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"; } если ($showaddlinkdesc) { если ($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"; } если ($showuserlargedescription) { если ($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"; } если ($showaddlinknotes) { если ($linknoteslabel == "") $linknoteslabel = __('Link notes', 'link-library'); $output .= "<tr><th>" . $linknoteslabel . "</th><td>"; если ($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') : '' ); если ($usetextareaforusersubmitnotes == false || $usetextareaforusersubmitnotes == '') $output .= "' />"; elseif ($usetextareaforusersubmitnotes == true) $output .= "</textarea>"; $output .= "</td></tr>N"; } если ($showaddlinkreciprocal) { если ($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"; } если ($showaddlinksecondurl) { если ($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"; } если ($showaddlinktelephone) { если ($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"; } если ($showaddlinkemail) { если ($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"; } если ($showlinksubmittername) { если ($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"; } если ($showaddlinksubmitteremail) { если ($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"; } если ($showlinksubmittercomment) { если ($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"; } если ($showcaptcha) { $output .= "<tr><td></td><td><span id='captchaimage'><img src='" . plugins_url( 'captcha/easycaptcha.php', __FILE__ ) . "' /></пролет></td></tr>N"; $output .= "<tr><th>" . __('Enter code from above image', 'link-library') . "</th><td><input type='text' name='confirm_code' /></td></tr>N"; } если ($showcustomcaptcha) { если ($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"; если ($addlinkbtnlabel == "") $addlinkbtnlabel = __('Add link', 'link-library'); $output .= '<span style="border:0;" class="LLUserLinkSubmit"><input type="submit" name="submit" value="' . $addlinkbtnlabel . '" /></пролет>'; $output .= "</div>N"; $output .= "</form>нн"; } return $output; } function relativePath($от, $к, $ps = DIRECTORY_SEPARATOR) { $arFrom = explode($ps, rtrim($от, $ps)); $arTo = explode($ps, rtrim($к, $ps)); пока(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 * настройки (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) { если (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, $настройки, $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 <бр />) - 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 * настройки (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 = '<бр />', $nofollow = false, $excludecategorylist = '', $afternote = '', $beforeitem = '<в>', $afteritem = '</в>', $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 ) { если (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'], ложный, $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, ложный, $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, $настройки, $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)); если ($settings == '') { $settings = 1; $options = get_option('LinkLibraryPP1'); } еще { $settingsname = 'LinkLibraryPP' . $настройки; $options = get_option($settingsname); } если ($categorylistoverride != '') $selectedcategorylist = $categorylistoverride; else $selectedcategorylist = $options['categorylist']; если ($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'], $настройки, $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 Processshortcode *********************************************/ function link_library_search_func($atts) { $settings = ''; extract(shortcode_atts(array( 'settings' => '' ), $atts)); если ($settings == '') $options = get_option('LinkLibraryPP1'); еще { $settingsname = 'LinkLibraryPP' . $настройки; $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, $по умолчанию ); $linkdata = sanitize_bookmark( $linkdata, 'db' ); extract( stripslashes_deep( $linkdata ), EXTR_SKIP ); $update = false; если ( !пустой( $link_id ) ) $update = true; если ( trim( $link_name ) == '' ) { если ( trim( $link_url ) != '' ) { $link_name = $link_url; } еще { вернуть 0; } } если ($addlinknoaddress == false) { если ( trim( $link_url ) == '' ) вернуть 0; } если ( пустой( $link_rating ) ) $link_rating = 0; если ( пустой( $link_image ) ) $link_image = ''; если ( пустой( $link_target ) ) $link_target = ''; если ( пустой( $link_visible ) ) $link_visible = 'Y'; если ( пустой( $link_owner ) ) $link_owner = get_current_user_id(); если ( пустой( $link_notes ) ) $link_notes = ''; если ( пустой( $link_description ) ) $link_description = ''; если ( пустой( $link_rss ) ) $link_rss = ''; если ( пустой( $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' ) ); } если ( $update ) { если ( 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') ) ) { если ( $wp_error ) return new WP_Error( 'db_update_error', __( 'Could not update link in the database', 'link-library' ), $wpdb->last_error ); else return 0; } } еще { если ( 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') ) ) { если ( $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 ); если ( $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)); если ($settings == '') $settings = 1; $settingsname = 'LinkLibraryPP' . $настройки; $options = get_option($settingsname); $genoptions = get_option('LinkLibraryGeneral'); если ($categorylistoverride != '') $selectedcategorylist = $categorylistoverride; elseif ($options['addlinkcatlistoverride'] != '') $selectedcategorylist = $options['addlinkcatlistoverride']; else $selectedcategorylist = $options['categorylist']; если ($excludecategoryoverride != '') $excludedcategorylist = $excludecategoryoverride; else $excludedcategorylist = $options['excludecategorylist']; вернуть ( 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'], $настройки, $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)); если ($settings == '') { $settings = 1; $options = get_option('LinkLibraryPP1'); } еще { $settingsname = 'LinkLibraryPP' . $настройки; $options = get_option($settingsname); } если ($notesoverride != '') $selectedshownotes = $notesoverride; else $selectedshownotes = $options['shownotes']; если ($descoverride != '') $selectedshowdescription = $descoverride; else $selectedshowdescription = $options['showdescription']; если ($rssoverride != '') $selectedshowrss = $rssoverride; else $selectedshowrss = $options['show_rss']; если ($categorylistoverride != '') $selectedcategorylist = $categorylistoverride; else $selectedcategorylist = $options['categorylist']; если ($excludecategoryoverride != '') $excludedcategorylist = $excludecategoryoverride; else $excludedcategorylist = $options['excludecategorylist']; если ($tableoverride != '') $overridedisplayastable = $tableoverride; else $overridedisplayastable = $options['displayastable']; $genoptions = get_option('LinkLibraryGeneral'); $linklibraryoutput = ""; если (floatval($genoptions['schemaversion']) < "4.6") { $this->ll_install(); $genoptions = get_option('LinkLibraryGeneral'); если ($settings == '') $options = get_option('LinkLibraryPP1'); еще { $settingsname = 'LinkLibraryPP' . $настройки; $options = get_option($settingsname); } } если ($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'], ложный, $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'], $настройки, $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'] : ложный ), ( 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){ если (пустой($posts)) return $posts; $load_jquery = false; $load_thickbox = false; $load_style = false; global $testvar; $genoptions = get_option('LinkLibraryGeneral'); если (is_admin()) { $load_jquery = false; $load_thickbox = false; $load_style = false; } еще { для каждого ($posts as $post) { $continuesearch = true; $searchpos = 0; $settingsetids = array(); пока ($continuesearch) { $linklibrarypos = stripos($post->post_content, 'link-library ', $searchpos); если ($linklibrarypos == false) { $linklibrarypos = stripos($post->post_content, 'link-library]', $searchpos); если ($linklibrarypos == false) если (stripos($post->post_content, 'link-library-cats') || stripos($post->post_content, 'link-library-addlink')) $load_style = true; } $continuesearch = $linklibrarypos; если ($continuesearch) { $load_style = true; $load_jquery = true; $shortcodeend = stripos($post->post_content, ']', $linklibrarypos); если ($shortcodeend) $searchpos = $shortcodeend; else $searchpos = $linklibrarypos + 1; если ($shortcodeend) { $settingconfigpos = stripos($post->post_content, 'settings=', $linklibrarypos); если ($settingconfigpos && $settingconfigpos < $shortcodeend) { $settingset = substr($post->post_content, $settingconfigpos + 9, $shortcodeend - $settingconfigpos - 9); $settingsetids[] = $settingset; } else if (count($settingsetids) == 0) { $settingsetids[] знак равно 1; } } } } } если ($settingsetids) { для каждого ($settingsetids as $settingsetid) { $settingsname = 'LinkLibraryPP' . $settingsetid; $options = get_option($settingsname); если ( $options['showonecatonly'] ) { $load_jquery = true; } если ( $options['rsspreview'] || ( isset( $options['enable_link_popup'] ) && $options['enable_link_popup'] ) ) { $load_thickbox = true; } если ($options['publishrssfeed'] == true) { global $rss_settings; $rss_settings = $settingsetid; } } } если ($genoptions['includescriptcss'] != '') { $pagelist = explode (',', $genoptions['includescriptcss']); $loadscripts = false; для каждого($pagelist as $pageid) { если ( ( $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; если ( $load_style ) { $llstylesheet = true; } еще { $llstylesheet = false; } если ( $load_jquery ) { wp_enqueue_script( 'jquery' ); } если ( $load_thickbox ) { wp_enqueue_script( 'thickbox' ); wp_enqueue_style ( 'thickbox' ); } return $posts; } function ll_template_redirect( $template ) { если ( !пустой( $_POST['link_library_user_link_submission'] ) ) { require_once plugin_dir_path( __FILE__ ) . 'usersubmission.php'; link_library_process_user_submission( $this ); return ''; } else if ( !пустой( $_GET['link_library_rss_feed'] ) ) { require_once plugin_dir_path( __FILE__ ) . 'rssfeed.php'; link_library_generate_rss_feed(); return ''; } else if ( !пустой( $_GET['link_library_popup_content'] ) ) { require_once plugin_dir_path( __FILE__ ) . 'linkpopup.php'; link_library_popup_content( $this ); return ''; } else if ( !пустой( $_GET['link_library_rss_preview'] ) ) { require_once plugin_dir_path( __FILE__ ) . 'rsspreview.php'; link_library_generate_rss_preview( $this ); return ''; } еще { 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; если ( пустой( $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(); ?>