Version Description
Download this release
Release Info
Developer | jackdewey |
Plugin | Link Library |
Version | 7.3.0.Beta1 |
Comparing to | |
See all releases |
Code changes from version 7.2.9 to 7.3.0.Beta1
- link-library-admin.php +96 -39
- link-library-defaults.php +2 -0
- link-library.php +27 -24
- linkpopup.php +1 -1
- readme.txt +4 -0
- render-link-library-addlink-sc.php +16 -8
- render-link-library-alpha-filter.php +1 -1
- render-link-library-cats-sc.php +8 -6
- render-link-library-sc.php +21 -18
- render-link-library-tag-filter-sc.php +1 -1
- render-rss-library-sc.php +7 -7
- rssfeed.php +6 -3
- usersubmission.php +13 -13
link-library-admin.php
CHANGED
@@ -18,6 +18,9 @@ $pagehookreciprocal = '';
|
|
18 |
class link_library_plugin_admin {
|
19 |
|
20 |
function __construct() {
|
|
|
|
|
|
|
21 |
add_action( 'admin_init', array( $this, 'action_admin_init' ) );
|
22 |
|
23 |
//add filter for WordPress 2.8 changed backend box system !
|
@@ -56,9 +59,11 @@ class link_library_plugin_admin {
|
|
56 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ), 99 );
|
57 |
add_action( 'enqueue_block_editor_assets', array( $this, 'admin_scripts' ), 99 );
|
58 |
|
59 |
-
add_action( 'restrict_manage_posts', array( $this, 'll_link_cat_filter_list' ) );
|
60 |
|
61 |
-
|
|
|
|
|
|
|
62 |
|
63 |
add_filter( 'manage_edit-link_library_category_columns', array( $this, 'll_category_custom_column_header' ), 10);
|
64 |
add_filter( 'manage_link_library_category_custom_column', array( $this, 'll_add_category_id' ), 10, 3 );
|
@@ -164,6 +169,7 @@ class link_library_plugin_admin {
|
|
164 |
|
165 |
public function render_modal() {
|
166 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
167 |
?>
|
168 |
<div id="select_linklibrary_shortcode" style="display:none;">
|
169 |
<div class="wrap">
|
@@ -412,6 +418,7 @@ class link_library_plugin_admin {
|
|
412 |
|
413 |
function set_plugin_row_meta( $links_array, $plugin_file ) {
|
414 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
415 |
|
416 |
if ( substr( $plugin_file, 0, 25 ) == substr( plugin_basename( __FILE__ ), 0, 25 ) && ( isset( $genoptions['hidedonation'] ) && !$genoptions['hidedonation'] ) ) {
|
417 |
$links_array = array_merge( $links_array, array( '<a target="_blank" href="https://ylefebvre.github.io/wordpress-plugins/link-library/">Donate</a>' ) );
|
@@ -596,7 +603,12 @@ class link_library_plugin_admin {
|
|
596 |
*/
|
597 |
|
598 |
function action_admin_init() {
|
599 |
-
|
|
|
|
|
|
|
|
|
|
|
600 |
wp_redirect( 'https://github.com/ylefebvre/link-library/wiki' );
|
601 |
exit();
|
602 |
} elseif ( isset( $_GET['page'] ) && $_GET['page'] == 'link-library-donate' ) {
|
@@ -642,16 +654,12 @@ class link_library_plugin_admin {
|
|
642 |
add_action( 'admin_post_save_link_library_stylesheet', array( $this, 'on_save_changes_stylesheet' ) );
|
643 |
add_action( 'admin_post_save_link_library_reciprocal', array( $this, 'on_save_changes_reciprocal' ) );
|
644 |
|
645 |
-
$catnames = get_terms( '
|
646 |
|
647 |
if ( empty( $catnames ) ) {
|
648 |
add_action( 'admin_notices', array( $this, 'll_missing_categories' ) );
|
649 |
}
|
650 |
|
651 |
-
$genoptions = get_option( 'LinkLibraryGeneral' );
|
652 |
-
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
653 |
-
extract( $genoptions );
|
654 |
-
|
655 |
if ( !empty( $genoptions ) ) {
|
656 |
if ( empty( $numberstylesets ) ) {
|
657 |
$numberofsets = 1;
|
@@ -895,6 +903,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
895 |
wp_enqueue_script( 'postbox' );
|
896 |
|
897 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
898 |
|
899 |
//add several metaboxes now, all metaboxes registered during load page can be switched off/on at "Screen Options" automatically, nothing special to do therefore
|
900 |
add_meta_box( 'linklibrary_moderation_meta_box', __( 'Links awaiting moderation', 'link-library' ), array( $this, 'moderate_meta_box' ), $pagehookmoderate, 'normal', 'high' );
|
@@ -905,7 +914,6 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
905 |
|
906 |
//executed to show the plugins complete admin page
|
907 |
function on_show_page() {
|
908 |
-
//we need the global screen column value to beable to have a sidebar in WordPress 2.8
|
909 |
global $screen_layout_columns;
|
910 |
|
911 |
$settings = ( isset( $_GET['settings'] ) ? intval( $_GET['settings'] ) : 1 );
|
@@ -990,7 +998,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
990 |
|
991 |
if ( $options['categorylist_cpt'] != "" && !isset( $_GET['genthumbsingle'] ) && !isset( $_GET['genfaviconsingle'] ) ) {
|
992 |
$link_query_args['tax_query'] = array(
|
993 |
-
array( 'taxonomy' => '
|
994 |
'field' => 'term-id',
|
995 |
'terms' => $options['categorylist_cpt'],
|
996 |
'operator' => 'IN' )
|
@@ -1647,6 +1655,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
1647 |
$successfulupdate = 0;
|
1648 |
|
1649 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
1650 |
|
1651 |
if ( isset( $_POST['importlinks'] ) ) {
|
1652 |
wp_defer_term_counting( true );
|
@@ -1692,7 +1701,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
1692 |
}
|
1693 |
|
1694 |
foreach ( $new_link_cats_slugs_array as $index => $new_link_cat_slug ) {
|
1695 |
-
$cat_matched_term = get_term_by( 'slug', $new_link_cat_slug, '
|
1696 |
|
1697 |
if ( false !== $cat_matched_term ) {
|
1698 |
$matched_link_cats[] = $cat_matched_term->term_id;
|
@@ -1704,7 +1713,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
1704 |
$new_link_cat = $new_link_cat_slug;
|
1705 |
}
|
1706 |
|
1707 |
-
$new_cat_term_data = wp_insert_term( $new_link_cat, '
|
1708 |
if ( is_wp_error( $new_cat_term_data ) ) {
|
1709 |
print_r( 'Failed creating category ' . $new_link_cat );
|
1710 |
} else {
|
@@ -1727,7 +1736,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
1727 |
}
|
1728 |
|
1729 |
foreach ( $new_link_tags_slugs_array as $index => $new_link_tag_slug ) {
|
1730 |
-
$tag_matched_term = get_term_by( 'slug', $new_link_tag_slug, '
|
1731 |
|
1732 |
if ( false !== $tag_matched_term ) {
|
1733 |
$matched_link_tags[] = $tag_matched_term->term_id;
|
@@ -1739,7 +1748,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
1739 |
$new_link_tag = $new_link_tag_slug;
|
1740 |
}
|
1741 |
|
1742 |
-
$new_tag_term_data = wp_insert_term( $new_link_tag, '
|
1743 |
if ( is_wp_error( $new_tag_term_data ) ) {
|
1744 |
print_r( 'Failed creating tag ' . $new_link_tag );
|
1745 |
} else {
|
@@ -1815,7 +1824,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
1815 |
'post_type' => 'link_library_links',
|
1816 |
'post_content' => '',
|
1817 |
'post_title' => $post_title,
|
1818 |
-
'tax_input' => array( '
|
1819 |
'post_status' => $post_status,
|
1820 |
'post_date' => $link_publication
|
1821 |
);
|
@@ -2169,7 +2178,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
2169 |
'post_type' => 'link_library_links',
|
2170 |
'post_content' => '',
|
2171 |
'post_title' => esc_html( $node->nodeValue ),
|
2172 |
-
'tax_input' => array( '
|
2173 |
'post_status' => 'publish'
|
2174 |
);
|
2175 |
|
@@ -2232,7 +2241,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
2232 |
|
2233 |
$link_cats_array = array();
|
2234 |
$link_cats_slugs_array = array();
|
2235 |
-
$link_categories = wp_get_post_terms( get_the_ID(), '
|
2236 |
if ( $link_categories ) {
|
2237 |
foreach ( $link_categories as $link_category ) {
|
2238 |
$link_cats_array[] = $link_category->name;
|
@@ -2250,7 +2259,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
2250 |
$link_tags_slugs_array = array();
|
2251 |
$link_tags_string = '';
|
2252 |
$link_tags_slugs = '';
|
2253 |
-
$link_tags = wp_get_post_terms( get_the_ID(), '
|
2254 |
if ( $link_tags ) {
|
2255 |
foreach ( $link_tags as $link_tag ) {
|
2256 |
$link_tags_array[] = $link_tag->name;
|
@@ -2380,7 +2389,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
2380 |
$link_cat_object['Version 5.9 Category ID'] = $link_cat->term_id;
|
2381 |
|
2382 |
$cat_string = $link_cat->name;
|
2383 |
-
$cat_matched_term = get_term_by( 'name', $cat_string, '
|
2384 |
|
2385 |
if ( false !== $cat_matched_term ) {
|
2386 |
$link_cat_object['Version 6.0 Category ID'] = $cat_matched_term->term_id;
|
@@ -2517,7 +2526,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
2517 |
'extraprotocols', 'thumbnailsize', 'thumbnailgenerator', 'rsscachedelay', 'single_link_layout', 'rolelevel', 'editlevel', 'cptslug',
|
2518 |
'defaultlinktarget', 'bp_link_page_url', 'bp_link_settings', 'defaultprotocoladmin', 'pagepeekerid', 'pagepeekersize', 'stwthumbnailsize', 'shrinkthewebaccesskey', 'customurl1label', 'customurl2label',
|
2519 |
'customurl3label', 'customurl4label', 'customurl5label', 'customtext1label', 'customtext2label', 'customtext3label', 'customtext4label', 'customtext5label', 'customlist1label', 'customlist2label', 'customlist3label', 'customlist4label', 'customlist5label', 'customlist1values', 'customlist2values', 'customlist3values', 'customlist4values', 'customlist5values',
|
2520 |
-
'customlist1html', 'customlist2html', 'customlist3html', 'customlist4html', 'customlist5html', 'global_search_results_layout', 'globalsearchresultstitleprefix'
|
2521 |
) as $option_name
|
2522 |
) {
|
2523 |
if ( isset( $_POST[$option_name] ) ) {
|
@@ -2685,6 +2694,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
2685 |
$options = get_option( $settingsname );
|
2686 |
|
2687 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
2688 |
|
2689 |
if ( $options['rsslibraryitemspersite'] != $_POST['rsslibraryitemspersite'] || $options['rsslibrarymaxwordsitem'] != $_POST['rsslibrarymaxwordsitem'] ) {
|
2690 |
global $wpdb;
|
@@ -2868,7 +2878,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
2868 |
$link_categories_query_args = array( 'hide_empty' => false );
|
2869 |
|
2870 |
$link_categories_query_args['include'] = array( $categoryid );
|
2871 |
-
$catnames = get_terms( '
|
2872 |
|
2873 |
if ( !$catnames ) {
|
2874 |
$messages[] = '2';
|
@@ -2883,7 +2893,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
2883 |
$link_categories_query_args = array( 'hide_empty' => false );
|
2884 |
|
2885 |
$link_categories_query_args['include'] = array( $categoryid );
|
2886 |
-
$catnames = get_terms( '
|
2887 |
|
2888 |
if ( !$catnames ) {
|
2889 |
$messages[] = '3';
|
@@ -2935,6 +2945,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
2935 |
$message = '';
|
2936 |
|
2937 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
2938 |
|
2939 |
if ( isset( $_POST['approvelinks'] ) && ( isset( $_POST['links'] ) && count( $_POST['links'] ) > 0 ) ) {
|
2940 |
$section = 'moderate';
|
@@ -2944,21 +2955,21 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
2944 |
|
2945 |
if ( !empty( $link_data ) ) {
|
2946 |
if ( isset( $_POST['link_category_' . $approved_link] ) && !empty( $_POST['link_category_' . $approved_link] ) ) {
|
2947 |
-
wp_set_post_terms( $approved_link, $_POST['link_category_' . $approved_link], '
|
2948 |
} elseif ( !isset( $_POST['link_category_' . $approved_link] ) ) {
|
2949 |
-
wp_delete_object_term_relationships( $approved_link, '
|
2950 |
}
|
2951 |
|
2952 |
if ( isset( $_POST['link_tags_' . $approved_link] ) && !empty( $_POST['link_tags_' . $approved_link] ) ) {
|
2953 |
$link_terms_array = array();
|
2954 |
foreach ( $_POST['link_tags_' . $approved_link] as $tag_id ) {
|
2955 |
-
$link_tag = get_term_by( 'ID', $tag_id, '
|
2956 |
$link_terms_array[] = $link_tag->name;
|
2957 |
|
2958 |
}
|
2959 |
-
wp_set_post_terms( $approved_link, $link_terms_array, '
|
2960 |
} elseif ( !isset( $_POST['link_tags_' . $approved_link] ) ) {
|
2961 |
-
wp_delete_object_term_relationships( $approved_link, '
|
2962 |
}
|
2963 |
|
2964 |
wp_update_post( array( 'ID' => $approved_link, 'post_status' => 'publish' ) );
|
@@ -3071,6 +3082,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
3071 |
|
3072 |
if ( isset( $_POST['submitstyle'] ) ) {
|
3073 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
3074 |
|
3075 |
$genoptions['fullstylesheet'] = $_POST['fullstylesheet'];
|
3076 |
|
@@ -3078,6 +3090,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
3078 |
$message = 1;
|
3079 |
} elseif ( isset( $_POST['resetstyle'] ) ) {
|
3080 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
3081 |
|
3082 |
$stylesheetlocation = plugin_dir_path( __FILE__ ) . 'stylesheettemplate.css';
|
3083 |
|
@@ -3108,6 +3121,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
3108 |
$message = - 1;
|
3109 |
|
3110 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
3111 |
|
3112 |
$genoptions['recipcheckaddress'] = ( ( isset( $_POST['recipcheckaddress'] ) && $_POST['recipcheckaddress'] !== '' ) ? esc_url( $_POST['recipcheckaddress'] ) : '' );
|
3113 |
$genoptions['rsscheckdays'] = ( ( isset( $_POST['rsscheckdays'] ) && $_POST['rsscheckdays'] !== '' ) ? sanitize_text_field( $_POST['rsscheckdays'] ) : '' );
|
@@ -3207,6 +3221,20 @@ wp_editor( $post->post_content, 'content', $editor_config );
|
|
3207 |
<input type="text" id="cptslug" name="cptslug" size="20" value="<?php echo $genoptions['cptslug']; ?>" />
|
3208 |
</td>
|
3209 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3210 |
<tr>
|
3211 |
<td><?php _e( 'Individual link pages can be seen by visitors', 'link-library' ); ?></td>
|
3212 |
<td><input type="checkbox" id="publicly_queryable" name="publicly_queryable" <?php checked( $genoptions['publicly_queryable'] ); ?>/></td>
|
@@ -4070,7 +4098,7 @@ function general_custom_fields_meta_box( $data ) {
|
|
4070 |
|
4071 |
<?php
|
4072 |
|
4073 |
-
$linkcats = get_terms( '
|
4074 |
|
4075 |
if ( $linkcats ) { ?>
|
4076 |
Category for new links <select name="siteimportcat" id="siteimportcat">
|
@@ -4106,6 +4134,7 @@ function general_custom_fields_meta_box( $data ) {
|
|
4106 |
|
4107 |
function moderate_meta_box() {
|
4108 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
4109 |
?>
|
4110 |
<table class='wp-list-table widefat fixed striped table-view-list'>
|
4111 |
<tr>
|
@@ -4129,7 +4158,7 @@ function general_custom_fields_meta_box( $data ) {
|
|
4129 |
|
4130 |
$link_url = esc_url( get_post_meta( get_the_ID(), 'link_url', true ) );
|
4131 |
$link_description = esc_html( get_post_meta( get_the_ID(), 'link_description', true ) );
|
4132 |
-
$link_categories = wp_get_post_terms( get_the_ID(), '
|
4133 |
$link_comment = esc_html( get_post_meta( get_the_ID(), 'submitter_comment', true ) );
|
4134 |
$link_reference = get_post_meta( get_the_ID(), 'link_reference', true );
|
4135 |
$referenced_link = '';
|
@@ -4158,7 +4187,7 @@ function general_custom_fields_meta_box( $data ) {
|
|
4158 |
$link_cat_id_string = implode( ',', $link_cat_IDs );
|
4159 |
}
|
4160 |
|
4161 |
-
$link_tags = wp_get_post_terms( get_the_ID(), '
|
4162 |
$link_tags_string = '';
|
4163 |
$link_tag_id_string = '';
|
4164 |
$link_tag_IDs = array();
|
@@ -4183,8 +4212,8 @@ function general_custom_fields_meta_box( $data ) {
|
|
4183 |
<tr>
|
4184 |
<td><input type="checkbox" name="links[]" value="<?php echo get_the_ID(); ?>" /></td>
|
4185 |
<td><?php echo "<a title='Edit Link: " . get_the_title() . "' href='" . esc_url( add_query_arg( array( 'action' => 'edit', 'post' => get_the_ID() ), admin_url( 'post.php' ) ) ) . "'>" . get_the_title() . "</a>"; ?></td>
|
4186 |
-
<td><?php wp_dropdown_categories( array( 'taxonomy' => '
|
4187 |
-
<td><?php wp_dropdown_categories( array( 'taxonomy' => '
|
4188 |
<td><?php echo "<a href='" . $link_url . "'>" . $link_url . "</a>"; ?></td>
|
4189 |
<td><?php echo $link_description; ?></td>
|
4190 |
<td><?php echo esc_html( $link_comment ); ?></td>
|
@@ -4449,6 +4478,8 @@ function general_custom_fields_meta_box( $data ) {
|
|
4449 |
<?php }
|
4450 |
|
4451 |
function render_category_list( $categories, $select_name, $depth, $selected_items, $order ) {
|
|
|
|
|
4452 |
|
4453 |
$output = '';
|
4454 |
if ( !empty( $categories ) ) {
|
@@ -4462,7 +4493,7 @@ function general_custom_fields_meta_box( $data ) {
|
|
4462 |
|
4463 |
foreach ( $categories as $category ) {
|
4464 |
$output .= '<option value="' . $category->term_id . '" ' . selected( in_array( $category->term_id, $selected_items ), true, false ) . ' >' . str_repeat( ' ', 4 * $depth ) . $category->name . '</option>';
|
4465 |
-
$child_categories = get_terms( '
|
4466 |
|
4467 |
if ( !empty( $child_categories ) ) {
|
4468 |
$output .= $this->render_category_list( $child_categories, $select_name, $depth + 1, $selected_items, $order );
|
@@ -4511,7 +4542,7 @@ function general_custom_fields_meta_box( $data ) {
|
|
4511 |
</td>
|
4512 |
<?php
|
4513 |
} else {
|
4514 |
-
$top_categories = get_terms( '
|
4515 |
|
4516 |
$categorylistarray = explode( ',', $options['categorylist_cpt'] );
|
4517 |
?>
|
@@ -4555,7 +4586,7 @@ function general_custom_fields_meta_box( $data ) {
|
|
4555 |
</td>
|
4556 |
<?php
|
4557 |
} else {
|
4558 |
-
$top_tags = get_terms( '
|
4559 |
|
4560 |
$taglistarray = explode( ',', $options['taglist_cpt'] );
|
4561 |
?>
|
@@ -6829,7 +6860,7 @@ function general_custom_fields_meta_box( $data ) {
|
|
6829 |
$link_categories_query_args = array( 'hide_empty' => false );
|
6830 |
$link_categories_query_args['include'] = $include_links_array;
|
6831 |
$link_categories_query_args['exclude'] = $excluded_links_array;
|
6832 |
-
$linkcats = get_terms( '
|
6833 |
|
6834 |
if ( $linkcats ) { ?>
|
6835 |
<select name="addlinkdefaultcat" id="addlinkdefaultcat" value="<?php echo $options['addlinkdefaultcat']; ?>">
|
@@ -7434,6 +7465,8 @@ function general_custom_fields_meta_box( $data ) {
|
|
7434 |
|
7435 |
function ll_link_image_info( $link ) {
|
7436 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
|
|
7437 |
$link_image = get_post_meta( $link->ID, 'link_image', true );
|
7438 |
?>
|
7439 |
<table>
|
@@ -7647,6 +7680,8 @@ function general_custom_fields_meta_box( $data ) {
|
|
7647 |
|
7648 |
function ll_link_edit_extra( $link ) {
|
7649 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
|
|
|
|
7650 |
$link_image = get_post_meta( $link->ID, 'link_image', true );
|
7651 |
|
7652 |
$link_featured = get_post_meta( $link->ID, 'link_featured', true );
|
@@ -8045,10 +8080,20 @@ function general_custom_fields_meta_box( $data ) {
|
|
8045 |
}
|
8046 |
|
8047 |
function ll_add_columns( $columns ) {
|
|
|
|
|
|
|
8048 |
$columns['link_library_updated'] = 'Updated';
|
8049 |
$columns['link_library_url'] = 'URL';
|
8050 |
-
|
8051 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8052 |
$columns['link_library_rating'] = 'Rating';
|
8053 |
$columns['link_library_visits'] = 'Hits';
|
8054 |
$columns['date'] = 'Publication Date';
|
@@ -8057,6 +8102,9 @@ function general_custom_fields_meta_box( $data ) {
|
|
8057 |
}
|
8058 |
|
8059 |
function ll_populate_columns( $column ) {
|
|
|
|
|
|
|
8060 |
if ( 'link_library_updated' == $column ) {
|
8061 |
$link_updated = get_post_meta( get_the_ID(), 'link_updated', true );
|
8062 |
|
@@ -8237,6 +8285,9 @@ function general_custom_fields_meta_box( $data ) {
|
|
8237 |
|
8238 |
/************************************************ Delete extra field data when link is deleted ***********************************/
|
8239 |
function ll_link_cat_filter_list() {
|
|
|
|
|
|
|
8240 |
$screen = get_current_screen();
|
8241 |
global $wp_query;
|
8242 |
|
@@ -8276,6 +8327,9 @@ function general_custom_fields_meta_box( $data ) {
|
|
8276 |
}
|
8277 |
|
8278 |
function ll_perform_link_cat_filtering( $query ) {
|
|
|
|
|
|
|
8279 |
$qv = &$query->query_vars;
|
8280 |
|
8281 |
if ( !empty( $qv['link_library_category'] ) && is_numeric( $qv['link_library_category'] ) ) {
|
@@ -8335,6 +8389,9 @@ function general_custom_fields_meta_box( $data ) {
|
|
8335 |
}
|
8336 |
|
8337 |
function link_library_empty_cat_link_checker( $ll_admin_class ) {
|
|
|
|
|
|
|
8338 |
global $wpdb; // Kept with CPT update
|
8339 |
echo "<strong>" . __( 'Empty Cat Link Checker Report', 'link-library' ) . "</strong><br /><br />";
|
8340 |
|
@@ -8343,7 +8400,7 @@ function general_custom_fields_meta_box( $data ) {
|
|
8343 |
$linkquery .= "and pm.meta_key = 'link_url'AND NOT EXISTS ( SELECT * FROM " . $ll_admin_class->db_prefix() . "term_relationships rel ";
|
8344 |
$linkquery .= "JOIN " . $ll_admin_class->db_prefix() . "term_taxonomy tax ";
|
8345 |
$linkquery .= "ON tax.term_taxonomy_id = rel.term_taxonomy_id ";
|
8346 |
-
$linkquery .= "AND tax.taxonomy = '
|
8347 |
$linkquery .= "JOIN " . $ll_admin_class->db_prefix() . "terms term ";
|
8348 |
$linkquery .= "ON term.term_id = tax.term_id ";
|
8349 |
$linkquery .= "WHERE p.ID = rel.object_id )";
|
18 |
class link_library_plugin_admin {
|
19 |
|
20 |
function __construct() {
|
21 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
22 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
23 |
+
|
24 |
add_action( 'admin_init', array( $this, 'action_admin_init' ) );
|
25 |
|
26 |
//add filter for WordPress 2.8 changed backend box system !
|
59 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ), 99 );
|
60 |
add_action( 'enqueue_block_editor_assets', array( $this, 'admin_scripts' ), 99 );
|
61 |
|
|
|
62 |
|
63 |
+
if ( $genoptions['cattaxonomy'] == 'link_library_category' ) {
|
64 |
+
add_action( 'restrict_manage_posts', array( $this, 'll_link_cat_filter_list' ) );
|
65 |
+
add_filter( 'parse_query', array( $this, 'll_perform_link_cat_filtering' ) );
|
66 |
+
}
|
67 |
|
68 |
add_filter( 'manage_edit-link_library_category_columns', array( $this, 'll_category_custom_column_header' ), 10);
|
69 |
add_filter( 'manage_link_library_category_custom_column', array( $this, 'll_add_category_id' ), 10, 3 );
|
169 |
|
170 |
public function render_modal() {
|
171 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
172 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
173 |
?>
|
174 |
<div id="select_linklibrary_shortcode" style="display:none;">
|
175 |
<div class="wrap">
|
418 |
|
419 |
function set_plugin_row_meta( $links_array, $plugin_file ) {
|
420 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
421 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
422 |
|
423 |
if ( substr( $plugin_file, 0, 25 ) == substr( plugin_basename( __FILE__ ), 0, 25 ) && ( isset( $genoptions['hidedonation'] ) && !$genoptions['hidedonation'] ) ) {
|
424 |
$links_array = array_merge( $links_array, array( '<a target="_blank" href="https://ylefebvre.github.io/wordpress-plugins/link-library/">Donate</a>' ) );
|
603 |
*/
|
604 |
|
605 |
function action_admin_init() {
|
606 |
+
|
607 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
608 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
609 |
+
extract( $genoptions );
|
610 |
+
|
611 |
+
if ( isset($_GET['page']) && $_GET['page'] == 'link-library-faq' ) {
|
612 |
wp_redirect( 'https://github.com/ylefebvre/link-library/wiki' );
|
613 |
exit();
|
614 |
} elseif ( isset( $_GET['page'] ) && $_GET['page'] == 'link-library-donate' ) {
|
654 |
add_action( 'admin_post_save_link_library_stylesheet', array( $this, 'on_save_changes_stylesheet' ) );
|
655 |
add_action( 'admin_post_save_link_library_reciprocal', array( $this, 'on_save_changes_reciprocal' ) );
|
656 |
|
657 |
+
$catnames = get_terms( $genoptions['cattaxonomy'], array( 'hide_empty' => false ) );
|
658 |
|
659 |
if ( empty( $catnames ) ) {
|
660 |
add_action( 'admin_notices', array( $this, 'll_missing_categories' ) );
|
661 |
}
|
662 |
|
|
|
|
|
|
|
|
|
663 |
if ( !empty( $genoptions ) ) {
|
664 |
if ( empty( $numberstylesets ) ) {
|
665 |
$numberofsets = 1;
|
903 |
wp_enqueue_script( 'postbox' );
|
904 |
|
905 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
906 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
907 |
|
908 |
//add several metaboxes now, all metaboxes registered during load page can be switched off/on at "Screen Options" automatically, nothing special to do therefore
|
909 |
add_meta_box( 'linklibrary_moderation_meta_box', __( 'Links awaiting moderation', 'link-library' ), array( $this, 'moderate_meta_box' ), $pagehookmoderate, 'normal', 'high' );
|
914 |
|
915 |
//executed to show the plugins complete admin page
|
916 |
function on_show_page() {
|
|
|
917 |
global $screen_layout_columns;
|
918 |
|
919 |
$settings = ( isset( $_GET['settings'] ) ? intval( $_GET['settings'] ) : 1 );
|
998 |
|
999 |
if ( $options['categorylist_cpt'] != "" && !isset( $_GET['genthumbsingle'] ) && !isset( $_GET['genfaviconsingle'] ) ) {
|
1000 |
$link_query_args['tax_query'] = array(
|
1001 |
+
array( 'taxonomy' => $genoptions['cattaxonomy'],
|
1002 |
'field' => 'term-id',
|
1003 |
'terms' => $options['categorylist_cpt'],
|
1004 |
'operator' => 'IN' )
|
1655 |
$successfulupdate = 0;
|
1656 |
|
1657 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
1658 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
1659 |
|
1660 |
if ( isset( $_POST['importlinks'] ) ) {
|
1661 |
wp_defer_term_counting( true );
|
1701 |
}
|
1702 |
|
1703 |
foreach ( $new_link_cats_slugs_array as $index => $new_link_cat_slug ) {
|
1704 |
+
$cat_matched_term = get_term_by( 'slug', $new_link_cat_slug, $genoptions['cattaxonomy'] );
|
1705 |
|
1706 |
if ( false !== $cat_matched_term ) {
|
1707 |
$matched_link_cats[] = $cat_matched_term->term_id;
|
1713 |
$new_link_cat = $new_link_cat_slug;
|
1714 |
}
|
1715 |
|
1716 |
+
$new_cat_term_data = wp_insert_term( $new_link_cat, $genoptions['cattaxonomy'], array( 'slug' => $new_link_cat_slug ) );
|
1717 |
if ( is_wp_error( $new_cat_term_data ) ) {
|
1718 |
print_r( 'Failed creating category ' . $new_link_cat );
|
1719 |
} else {
|
1736 |
}
|
1737 |
|
1738 |
foreach ( $new_link_tags_slugs_array as $index => $new_link_tag_slug ) {
|
1739 |
+
$tag_matched_term = get_term_by( 'slug', $new_link_tag_slug, $genoptions['tagtaxonomy'] );
|
1740 |
|
1741 |
if ( false !== $tag_matched_term ) {
|
1742 |
$matched_link_tags[] = $tag_matched_term->term_id;
|
1748 |
$new_link_tag = $new_link_tag_slug;
|
1749 |
}
|
1750 |
|
1751 |
+
$new_tag_term_data = wp_insert_term( $new_link_tag, $genoptions['tagtaxonomy'], array( 'slug' => $new_link_tag_slug ) );
|
1752 |
if ( is_wp_error( $new_tag_term_data ) ) {
|
1753 |
print_r( 'Failed creating tag ' . $new_link_tag );
|
1754 |
} else {
|
1824 |
'post_type' => 'link_library_links',
|
1825 |
'post_content' => '',
|
1826 |
'post_title' => $post_title,
|
1827 |
+
'tax_input' => array( $genoptions['cattaxonomy'] => $matched_link_cats, $genoptions['tagtaxonomy'] => $matched_link_tags ),
|
1828 |
'post_status' => $post_status,
|
1829 |
'post_date' => $link_publication
|
1830 |
);
|
2178 |
'post_type' => 'link_library_links',
|
2179 |
'post_content' => '',
|
2180 |
'post_title' => esc_html( $node->nodeValue ),
|
2181 |
+
'tax_input' => array( $genoptions['cattaxonomy'] => $incomingcatdata ),
|
2182 |
'post_status' => 'publish'
|
2183 |
);
|
2184 |
|
2241 |
|
2242 |
$link_cats_array = array();
|
2243 |
$link_cats_slugs_array = array();
|
2244 |
+
$link_categories = wp_get_post_terms( get_the_ID(), $genoptions['cattaxonomy'] );
|
2245 |
if ( $link_categories ) {
|
2246 |
foreach ( $link_categories as $link_category ) {
|
2247 |
$link_cats_array[] = $link_category->name;
|
2259 |
$link_tags_slugs_array = array();
|
2260 |
$link_tags_string = '';
|
2261 |
$link_tags_slugs = '';
|
2262 |
+
$link_tags = wp_get_post_terms( get_the_ID(), $genoptions['tagtaxonomy'] );
|
2263 |
if ( $link_tags ) {
|
2264 |
foreach ( $link_tags as $link_tag ) {
|
2265 |
$link_tags_array[] = $link_tag->name;
|
2389 |
$link_cat_object['Version 5.9 Category ID'] = $link_cat->term_id;
|
2390 |
|
2391 |
$cat_string = $link_cat->name;
|
2392 |
+
$cat_matched_term = get_term_by( 'name', $cat_string, $genoptions['cattaxonomy'] );
|
2393 |
|
2394 |
if ( false !== $cat_matched_term ) {
|
2395 |
$link_cat_object['Version 6.0 Category ID'] = $cat_matched_term->term_id;
|
2526 |
'extraprotocols', 'thumbnailsize', 'thumbnailgenerator', 'rsscachedelay', 'single_link_layout', 'rolelevel', 'editlevel', 'cptslug',
|
2527 |
'defaultlinktarget', 'bp_link_page_url', 'bp_link_settings', 'defaultprotocoladmin', 'pagepeekerid', 'pagepeekersize', 'stwthumbnailsize', 'shrinkthewebaccesskey', 'customurl1label', 'customurl2label',
|
2528 |
'customurl3label', 'customurl4label', 'customurl5label', 'customtext1label', 'customtext2label', 'customtext3label', 'customtext4label', 'customtext5label', 'customlist1label', 'customlist2label', 'customlist3label', 'customlist4label', 'customlist5label', 'customlist1values', 'customlist2values', 'customlist3values', 'customlist4values', 'customlist5values',
|
2529 |
+
'customlist1html', 'customlist2html', 'customlist3html', 'customlist4html', 'customlist5html', 'global_search_results_layout', 'globalsearchresultstitleprefix', 'cattaxonomy', 'tagtaxonomy'
|
2530 |
) as $option_name
|
2531 |
) {
|
2532 |
if ( isset( $_POST[$option_name] ) ) {
|
2694 |
$options = get_option( $settingsname );
|
2695 |
|
2696 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
2697 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
2698 |
|
2699 |
if ( $options['rsslibraryitemspersite'] != $_POST['rsslibraryitemspersite'] || $options['rsslibrarymaxwordsitem'] != $_POST['rsslibrarymaxwordsitem'] ) {
|
2700 |
global $wpdb;
|
2878 |
$link_categories_query_args = array( 'hide_empty' => false );
|
2879 |
|
2880 |
$link_categories_query_args['include'] = array( $categoryid );
|
2881 |
+
$catnames = get_terms( $genoptions['cattaxonomy'], $link_categories_query_args );
|
2882 |
|
2883 |
if ( !$catnames ) {
|
2884 |
$messages[] = '2';
|
2893 |
$link_categories_query_args = array( 'hide_empty' => false );
|
2894 |
|
2895 |
$link_categories_query_args['include'] = array( $categoryid );
|
2896 |
+
$catnames = get_terms( $genoptions['cattaxonomy'], $link_categories_query_args );
|
2897 |
|
2898 |
if ( !$catnames ) {
|
2899 |
$messages[] = '3';
|
2945 |
$message = '';
|
2946 |
|
2947 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
2948 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
2949 |
|
2950 |
if ( isset( $_POST['approvelinks'] ) && ( isset( $_POST['links'] ) && count( $_POST['links'] ) > 0 ) ) {
|
2951 |
$section = 'moderate';
|
2955 |
|
2956 |
if ( !empty( $link_data ) ) {
|
2957 |
if ( isset( $_POST['link_category_' . $approved_link] ) && !empty( $_POST['link_category_' . $approved_link] ) ) {
|
2958 |
+
wp_set_post_terms( $approved_link, $_POST['link_category_' . $approved_link], $genoptions['cattaxonomy'] );
|
2959 |
} elseif ( !isset( $_POST['link_category_' . $approved_link] ) ) {
|
2960 |
+
wp_delete_object_term_relationships( $approved_link, $genoptions['cattaxonomy'] );
|
2961 |
}
|
2962 |
|
2963 |
if ( isset( $_POST['link_tags_' . $approved_link] ) && !empty( $_POST['link_tags_' . $approved_link] ) ) {
|
2964 |
$link_terms_array = array();
|
2965 |
foreach ( $_POST['link_tags_' . $approved_link] as $tag_id ) {
|
2966 |
+
$link_tag = get_term_by( 'ID', $tag_id, $genoptions['tagtaxonomy'] );
|
2967 |
$link_terms_array[] = $link_tag->name;
|
2968 |
|
2969 |
}
|
2970 |
+
wp_set_post_terms( $approved_link, $link_terms_array, $genoptions['tagtaxonomy'] );
|
2971 |
} elseif ( !isset( $_POST['link_tags_' . $approved_link] ) ) {
|
2972 |
+
wp_delete_object_term_relationships( $approved_link, $genoptions['tagtaxonomy'] );
|
2973 |
}
|
2974 |
|
2975 |
wp_update_post( array( 'ID' => $approved_link, 'post_status' => 'publish' ) );
|
3082 |
|
3083 |
if ( isset( $_POST['submitstyle'] ) ) {
|
3084 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
3085 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
3086 |
|
3087 |
$genoptions['fullstylesheet'] = $_POST['fullstylesheet'];
|
3088 |
|
3090 |
$message = 1;
|
3091 |
} elseif ( isset( $_POST['resetstyle'] ) ) {
|
3092 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
3093 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
3094 |
|
3095 |
$stylesheetlocation = plugin_dir_path( __FILE__ ) . 'stylesheettemplate.css';
|
3096 |
|
3121 |
$message = - 1;
|
3122 |
|
3123 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
3124 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
3125 |
|
3126 |
$genoptions['recipcheckaddress'] = ( ( isset( $_POST['recipcheckaddress'] ) && $_POST['recipcheckaddress'] !== '' ) ? esc_url( $_POST['recipcheckaddress'] ) : '' );
|
3127 |
$genoptions['rsscheckdays'] = ( ( isset( $_POST['rsscheckdays'] ) && $_POST['rsscheckdays'] !== '' ) ? sanitize_text_field( $_POST['rsscheckdays'] ) : '' );
|
3221 |
<input type="text" id="cptslug" name="cptslug" size="20" value="<?php echo $genoptions['cptslug']; ?>" />
|
3222 |
</td>
|
3223 |
</tr>
|
3224 |
+
<tr>
|
3225 |
+
<td><?php _e( 'Taxonomy for link category', 'link-library' ); ?></td>
|
3226 |
+
<td><select id="cattaxonomy" name="cattaxonomy">
|
3227 |
+
<option value="link_library_category" <?php selected( $genoptions['cattaxonomy'], 'link_library_category' ); ?>><?php _e( 'Link Library Categories', 'link-library' ); ?>
|
3228 |
+
<option value="category" <?php selected( $genoptions['cattaxonomy'], 'category' ); ?>><?php _e( 'Post Categories', 'link-library' ); ?>
|
3229 |
+
</select></td>
|
3230 |
+
</tr>
|
3231 |
+
<tr>
|
3232 |
+
<td><?php _e( 'Taxonomy for link tags', 'link-library' ); ?></td>
|
3233 |
+
<td><select id="tagtaxonomy" name="tagtaxonomy">
|
3234 |
+
<option value="link_library_tags" <?php selected( $genoptions['tagtaxonomy'], 'link_library_tags' ); ?>><?php _e( 'Link Library Tags', 'link-library' ); ?>
|
3235 |
+
<option value="post_tag" <?php selected( $genoptions['tagtaxonomy'], 'post_tag' ); ?>><?php _e( 'Post Tags', 'link-library' ); ?>
|
3236 |
+
</select></td>
|
3237 |
+
</tr>
|
3238 |
<tr>
|
3239 |
<td><?php _e( 'Individual link pages can be seen by visitors', 'link-library' ); ?></td>
|
3240 |
<td><input type="checkbox" id="publicly_queryable" name="publicly_queryable" <?php checked( $genoptions['publicly_queryable'] ); ?>/></td>
|
4098 |
|
4099 |
<?php
|
4100 |
|
4101 |
+
$linkcats = get_terms( $genoptions['cattaxonomy'], array( 'hide_empty' => false ) );
|
4102 |
|
4103 |
if ( $linkcats ) { ?>
|
4104 |
Category for new links <select name="siteimportcat" id="siteimportcat">
|
4134 |
|
4135 |
function moderate_meta_box() {
|
4136 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
4137 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
4138 |
?>
|
4139 |
<table class='wp-list-table widefat fixed striped table-view-list'>
|
4140 |
<tr>
|
4158 |
|
4159 |
$link_url = esc_url( get_post_meta( get_the_ID(), 'link_url', true ) );
|
4160 |
$link_description = esc_html( get_post_meta( get_the_ID(), 'link_description', true ) );
|
4161 |
+
$link_categories = wp_get_post_terms( get_the_ID(), $genoptions['cattaxonomy'] );
|
4162 |
$link_comment = esc_html( get_post_meta( get_the_ID(), 'submitter_comment', true ) );
|
4163 |
$link_reference = get_post_meta( get_the_ID(), 'link_reference', true );
|
4164 |
$referenced_link = '';
|
4187 |
$link_cat_id_string = implode( ',', $link_cat_IDs );
|
4188 |
}
|
4189 |
|
4190 |
+
$link_tags = wp_get_post_terms( get_the_ID(), $genoptions['tagtaxonomy'] );
|
4191 |
$link_tags_string = '';
|
4192 |
$link_tag_id_string = '';
|
4193 |
$link_tag_IDs = array();
|
4212 |
<tr>
|
4213 |
<td><input type="checkbox" name="links[]" value="<?php echo get_the_ID(); ?>" /></td>
|
4214 |
<td><?php echo "<a title='Edit Link: " . get_the_title() . "' href='" . esc_url( add_query_arg( array( 'action' => 'edit', 'post' => get_the_ID() ), admin_url( 'post.php' ) ) ) . "'>" . get_the_title() . "</a>"; ?></td>
|
4215 |
+
<td><?php wp_dropdown_categories( array( 'taxonomy' => $genoptions['cattaxonomy'], 'hierarchical' => true, 'hide_empty' => false, 'multiple' => true, 'selected' => $link_cat_id_string, 'name' => 'link_category_' . get_the_ID() ) ); ?></td>
|
4216 |
+
<td><?php wp_dropdown_categories( array( 'taxonomy' => $genoptions['tagtaxonomy'], 'hierarchical' => true, 'hide_empty' => false, 'multiple' => true, 'selected' => $link_tag_id_string, 'name' => 'link_tags_' . get_the_ID() ) ); ?></td>
|
4217 |
<td><?php echo "<a href='" . $link_url . "'>" . $link_url . "</a>"; ?></td>
|
4218 |
<td><?php echo $link_description; ?></td>
|
4219 |
<td><?php echo esc_html( $link_comment ); ?></td>
|
4478 |
<?php }
|
4479 |
|
4480 |
function render_category_list( $categories, $select_name, $depth, $selected_items, $order ) {
|
4481 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
4482 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
4483 |
|
4484 |
$output = '';
|
4485 |
if ( !empty( $categories ) ) {
|
4493 |
|
4494 |
foreach ( $categories as $category ) {
|
4495 |
$output .= '<option value="' . $category->term_id . '" ' . selected( in_array( $category->term_id, $selected_items ), true, false ) . ' >' . str_repeat( ' ', 4 * $depth ) . $category->name . '</option>';
|
4496 |
+
$child_categories = get_terms( $genoptions['cattaxonomy'], array( 'orderby' => 'name', 'parent' => $category->term_id, 'order' => $order, 'hide_empty' => false ) );
|
4497 |
|
4498 |
if ( !empty( $child_categories ) ) {
|
4499 |
$output .= $this->render_category_list( $child_categories, $select_name, $depth + 1, $selected_items, $order );
|
4542 |
</td>
|
4543 |
<?php
|
4544 |
} else {
|
4545 |
+
$top_categories = get_terms( $genoptions['cattaxonomy'], array( 'orderby' => 'name', 'order' => $options['direction'], 'parent' => 0, 'hide_empty' => false ) );
|
4546 |
|
4547 |
$categorylistarray = explode( ',', $options['categorylist_cpt'] );
|
4548 |
?>
|
4586 |
</td>
|
4587 |
<?php
|
4588 |
} else {
|
4589 |
+
$top_tags = get_terms( $genoptions['tagtaxonomy'], array( 'orderby' => 'name', 'order' => $options['direction'], 'parent' => 0, 'hide_empty' => false ) );
|
4590 |
|
4591 |
$taglistarray = explode( ',', $options['taglist_cpt'] );
|
4592 |
?>
|
6860 |
$link_categories_query_args = array( 'hide_empty' => false );
|
6861 |
$link_categories_query_args['include'] = $include_links_array;
|
6862 |
$link_categories_query_args['exclude'] = $excluded_links_array;
|
6863 |
+
$linkcats = get_terms( $genoptions['cattaxonomy'], $link_categories_query_args );
|
6864 |
|
6865 |
if ( $linkcats ) { ?>
|
6866 |
<select name="addlinkdefaultcat" id="addlinkdefaultcat" value="<?php echo $options['addlinkdefaultcat']; ?>">
|
7465 |
|
7466 |
function ll_link_image_info( $link ) {
|
7467 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
7468 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
7469 |
+
|
7470 |
$link_image = get_post_meta( $link->ID, 'link_image', true );
|
7471 |
?>
|
7472 |
<table>
|
7680 |
|
7681 |
function ll_link_edit_extra( $link ) {
|
7682 |
$genoptions = get_option( 'LinkLibraryGeneral' );
|
7683 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
7684 |
+
|
7685 |
$link_image = get_post_meta( $link->ID, 'link_image', true );
|
7686 |
|
7687 |
$link_featured = get_post_meta( $link->ID, 'link_featured', true );
|
8080 |
}
|
8081 |
|
8082 |
function ll_add_columns( $columns ) {
|
8083 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
8084 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
8085 |
+
|
8086 |
$columns['link_library_updated'] = 'Updated';
|
8087 |
$columns['link_library_url'] = 'URL';
|
8088 |
+
|
8089 |
+
if ( $genoptions['cattaxonomy'] == 'link_library_category' ) {
|
8090 |
+
$columns['link_library_categories'] = 'Categories';
|
8091 |
+
}
|
8092 |
+
|
8093 |
+
if ( $genoptions['tagtaxonomy'] == 'link_library_tags' ) {
|
8094 |
+
$columns['link_library_tags'] = 'Tags';
|
8095 |
+
}
|
8096 |
+
|
8097 |
$columns['link_library_rating'] = 'Rating';
|
8098 |
$columns['link_library_visits'] = 'Hits';
|
8099 |
$columns['date'] = 'Publication Date';
|
8102 |
}
|
8103 |
|
8104 |
function ll_populate_columns( $column ) {
|
8105 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
8106 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
8107 |
+
|
8108 |
if ( 'link_library_updated' == $column ) {
|
8109 |
$link_updated = get_post_meta( get_the_ID(), 'link_updated', true );
|
8110 |
|
8285 |
|
8286 |
/************************************************ Delete extra field data when link is deleted ***********************************/
|
8287 |
function ll_link_cat_filter_list() {
|
8288 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
8289 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
8290 |
+
|
8291 |
$screen = get_current_screen();
|
8292 |
global $wp_query;
|
8293 |
|
8327 |
}
|
8328 |
|
8329 |
function ll_perform_link_cat_filtering( $query ) {
|
8330 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
8331 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
8332 |
+
|
8333 |
$qv = &$query->query_vars;
|
8334 |
|
8335 |
if ( !empty( $qv['link_library_category'] ) && is_numeric( $qv['link_library_category'] ) ) {
|
8389 |
}
|
8390 |
|
8391 |
function link_library_empty_cat_link_checker( $ll_admin_class ) {
|
8392 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
8393 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
8394 |
+
|
8395 |
global $wpdb; // Kept with CPT update
|
8396 |
echo "<strong>" . __( 'Empty Cat Link Checker Report', 'link-library' ) . "</strong><br /><br />";
|
8397 |
|
8400 |
$linkquery .= "and pm.meta_key = 'link_url'AND NOT EXISTS ( SELECT * FROM " . $ll_admin_class->db_prefix() . "term_relationships rel ";
|
8401 |
$linkquery .= "JOIN " . $ll_admin_class->db_prefix() . "term_taxonomy tax ";
|
8402 |
$linkquery .= "ON tax.term_taxonomy_id = rel.term_taxonomy_id ";
|
8403 |
+
$linkquery .= "AND tax.taxonomy = '" . $genoptions['cattaxonomy'] . "' ";
|
8404 |
$linkquery .= "JOIN " . $ll_admin_class->db_prefix() . "terms term ";
|
8405 |
$linkquery .= "ON term.term_id = tax.term_id ";
|
8406 |
$linkquery .= "WHERE p.ID = rel.object_id )";
|
link-library-defaults.php
CHANGED
@@ -565,6 +565,8 @@ function ll_reset_gen_settings( $setoptions = 'return' ) {
|
|
565 |
$genoptions['suppresssubfolderredirection'] = false;
|
566 |
$genoptions['suppressbadconfigredirection'] = false;
|
567 |
$genoptions['rsscheckdays'] = 90;
|
|
|
|
|
568 |
|
569 |
if ( 'return_and_set' == $setoptions ) {
|
570 |
$stylesheetlocation = plugins_url( 'stylesheettemplate.css', __FILE__ );
|
565 |
$genoptions['suppresssubfolderredirection'] = false;
|
566 |
$genoptions['suppressbadconfigredirection'] = false;
|
567 |
$genoptions['rsscheckdays'] = 90;
|
568 |
+
$genoptions['cattaxonomy'] = 'link_library_category';
|
569 |
+
$genoptions['tagtaxonomy'] = 'link_library_tags';
|
570 |
|
571 |
if ( 'return_and_set' == $setoptions ) {
|
572 |
$stylesheetlocation = plugins_url( 'stylesheettemplate.css', __FILE__ );
|
link-library.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Link Library
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/link-library/
|
5 |
Description: Display links on pages with a variety of options
|
6 |
-
Version: 7.
|
7 |
Author: Yannick Lefebvre
|
8 |
Author URI: http://ylefebvre.github.io/
|
9 |
Text Domain: link-library
|
@@ -474,11 +474,11 @@ class link_library_plugin {
|
|
474 |
'menu_position' => 10,
|
475 |
'supports' =>
|
476 |
array( 'title', 'editor', 'comments' ),
|
477 |
-
'taxonomies' => array( '
|
478 |
'menu_icon' =>
|
479 |
'dashicons-admin-links',
|
480 |
'has_archive' => false,
|
481 |
-
'rewrite' => array( 'slug' => $genoptions['cptslug'] . '/%
|
482 |
);
|
483 |
|
484 |
if ( $genoptions['exclude_from_search'] && $genoptions['publicly_queryable'] ) {
|
@@ -498,7 +498,7 @@ class link_library_plugin {
|
|
498 |
'add_new_item' => 'Add New Link Library Category',
|
499 |
'new_item_name' => 'New Link Library Category'
|
500 |
),
|
501 |
-
'show_ui' => true,
|
502 |
'show_tagcloud' => false,
|
503 |
'hierarchical' => true,
|
504 |
'rewrite' => $genoptions['publicly_queryable'],
|
@@ -514,7 +514,7 @@ class link_library_plugin {
|
|
514 |
'labels' => array( 'name' => 'Tags',
|
515 |
'add_new_item' => 'Add New Link Library Tag',
|
516 |
'new_item_name' => 'New Link Library Tag' ),
|
517 |
-
'show_ui' => true,
|
518 |
'rewrite' => false,
|
519 |
'show_in_rest' => true
|
520 |
)
|
@@ -795,10 +795,10 @@ class link_library_plugin {
|
|
795 |
$post_link = $link_url;
|
796 |
}
|
797 |
} else {
|
798 |
-
if ( !empty( $post_link ) && false !== strpos( $post_link, '%
|
799 |
-
$link_cat_type_term = get_the_terms( $post->ID, '
|
800 |
if ( !empty( $link_cat_type_term ) ) {
|
801 |
-
$post_link = str_replace( '%
|
802 |
}
|
803 |
}
|
804 |
}
|
@@ -1299,7 +1299,7 @@ class link_library_plugin {
|
|
1299 |
foreach( $category_list_array as $index => $category_text ) {
|
1300 |
if ( !is_numeric( $category_text ) ) {
|
1301 |
$update_list = true;
|
1302 |
-
$matched_term = get_term_by( 'slug', $category_text, '
|
1303 |
|
1304 |
if ( $matched_term ) {
|
1305 |
$category_list_array[$index] = $matched_term->term_id;
|
@@ -1321,7 +1321,7 @@ class link_library_plugin {
|
|
1321 |
foreach( $exclude_category_list_array as $index => $category_text ) {
|
1322 |
if ( !is_numeric( $category_text ) ) {
|
1323 |
$update_list = true;
|
1324 |
-
$matched_term = get_term_by( 'slug', $category_text, '
|
1325 |
|
1326 |
if ( $matched_term ) {
|
1327 |
$exclude_category_list_array[$index] = $matched_term->term_id;
|
@@ -1343,7 +1343,7 @@ class link_library_plugin {
|
|
1343 |
foreach( $tag_list_array as $index => $tag_text ) {
|
1344 |
if ( !is_numeric( $tag_text ) ) {
|
1345 |
$update_list = true;
|
1346 |
-
$matched_term = get_term_by( 'slug', $tag_text, '
|
1347 |
|
1348 |
if ( $matched_term ) {
|
1349 |
$tag_list_array[$index] = $matched_term->term_id;
|
@@ -1365,7 +1365,7 @@ class link_library_plugin {
|
|
1365 |
foreach( $exclude_tag_list_array as $index => $tag_text ) {
|
1366 |
if ( !is_numeric( $tag_text ) ) {
|
1367 |
$update_list = true;
|
1368 |
-
$matched_term = get_term_by( 'slug', $tag_text, '
|
1369 |
|
1370 |
if ( $matched_term ) {
|
1371 |
$exclude_tag_list_array[$index] = $matched_term->term_id;
|
@@ -1533,7 +1533,7 @@ class link_library_plugin {
|
|
1533 |
|
1534 |
if ( !empty( $options['categorylist_cpt'] ) ) {
|
1535 |
$catlistarray = explode( ',', $options['categorylist_cpt'] );
|
1536 |
-
$link_query_args['tax_query'] = array( array( 'taxonomy' => '
|
1537 |
'field' => 'term_id',
|
1538 |
'terms' => $catlistarray,
|
1539 |
'operator' => 'IN' ) );
|
@@ -1541,7 +1541,7 @@ class link_library_plugin {
|
|
1541 |
|
1542 |
if ( !empty( $options['excludecategorylist_cpt'] ) ) {
|
1543 |
$catlistexcludearray = explode( ',', $options['excludecategorylist_cpt'] );
|
1544 |
-
$link_query_args['tax_query'] = array( array( 'taxonomy' => '
|
1545 |
'field' => 'term_id',
|
1546 |
'terms' => $catlistexcludearray,
|
1547 |
'operator' => 'NOT IN' ) );
|
@@ -1740,7 +1740,7 @@ class link_library_plugin {
|
|
1740 |
foreach( $category_list_array as $index => $category_text ) {
|
1741 |
if ( !is_numeric( $category_text ) ) {
|
1742 |
$update_list = true;
|
1743 |
-
$matched_term = get_term_by( 'slug', $category_text, '
|
1744 |
|
1745 |
if ( $matched_term ) {
|
1746 |
$category_list_array[$index] = $matched_term->term_id;
|
@@ -1762,7 +1762,7 @@ class link_library_plugin {
|
|
1762 |
foreach( $exclude_category_list_array as $index => $category_text ) {
|
1763 |
if ( !is_numeric( $category_text ) ) {
|
1764 |
$update_list = true;
|
1765 |
-
$matched_term = get_term_by( 'slug', $category_text, '
|
1766 |
|
1767 |
if ( $matched_term ) {
|
1768 |
$exclude_category_list_array[$index] = $matched_term->term_id;
|
@@ -1784,7 +1784,7 @@ class link_library_plugin {
|
|
1784 |
foreach( $tag_list_array as $index => $tag_text ) {
|
1785 |
if ( !is_numeric( $tag_text ) ) {
|
1786 |
$update_list = true;
|
1787 |
-
$matched_term = get_term_by( 'slug', $tag_text, '
|
1788 |
|
1789 |
if ( $matched_term ) {
|
1790 |
$tag_list_array[$index] = $matched_term->term_id;
|
@@ -1806,7 +1806,7 @@ class link_library_plugin {
|
|
1806 |
foreach( $exclude_tag_list_array as $index => $tag_text ) {
|
1807 |
if ( !is_numeric( $tag_text ) ) {
|
1808 |
$update_list = true;
|
1809 |
-
$matched_term = get_term_by( 'slug', $tag_text, '
|
1810 |
|
1811 |
if ( $matched_term ) {
|
1812 |
$exclude_tag_list_array[$index] = $matched_term->term_id;
|
@@ -1943,7 +1943,7 @@ class link_library_plugin {
|
|
1943 |
foreach( $category_list_array as $index => $category_text ) {
|
1944 |
if ( !is_numeric( $category_text ) ) {
|
1945 |
$update_list = true;
|
1946 |
-
$matched_term = get_term_by( 'slug', $category_text, '
|
1947 |
|
1948 |
if ( $matched_term ) {
|
1949 |
$category_list_array[$index] = $matched_term->term_id;
|
@@ -1965,7 +1965,7 @@ class link_library_plugin {
|
|
1965 |
foreach( $exclude_category_list_array as $index => $category_text ) {
|
1966 |
if ( !is_numeric( $category_text ) ) {
|
1967 |
$update_list = true;
|
1968 |
-
$matched_term = get_term_by( 'slug', $category_text, '
|
1969 |
|
1970 |
if ( $matched_term ) {
|
1971 |
$exclude_category_list_array[$index] = $matched_term->term_id;
|
@@ -1987,7 +1987,7 @@ class link_library_plugin {
|
|
1987 |
foreach( $tag_list_array as $index => $tag_text ) {
|
1988 |
if ( !is_numeric( $tag_text ) ) {
|
1989 |
$update_list = true;
|
1990 |
-
$matched_term = get_term_by( 'slug', $tag_text, '
|
1991 |
|
1992 |
if ( $matched_term ) {
|
1993 |
$tag_list_array[$index] = $matched_term->term_id;
|
@@ -2009,7 +2009,7 @@ class link_library_plugin {
|
|
2009 |
foreach( $exclude_tag_list_array as $index => $tag_text ) {
|
2010 |
if ( !is_numeric( $tag_text ) ) {
|
2011 |
$update_list = true;
|
2012 |
-
$matched_term = get_term_by( 'slug', $tag_text, '
|
2013 |
|
2014 |
if ( $matched_term ) {
|
2015 |
$exclude_tag_list_array[$index] = $matched_term->term_id;
|
@@ -2043,7 +2043,10 @@ class link_library_plugin {
|
|
2043 |
}
|
2044 |
|
2045 |
function link_library_tagcloud( $atts = '' ) {
|
2046 |
-
$
|
|
|
|
|
|
|
2047 |
$output = wp_generate_tag_cloud( $link_library_terms );
|
2048 |
return $output;
|
2049 |
}
|
@@ -2284,7 +2287,7 @@ class link_library_plugin {
|
|
2284 |
$link_email = esc_html( get_post_meta( get_the_ID(), 'link_email', true ) );
|
2285 |
$link_phone_number = esc_html( get_post_meta( get_the_ID(), 'link_telephone', true ) );
|
2286 |
|
2287 |
-
$link_terms = wp_get_post_terms( get_the_ID(), '
|
2288 |
$link_terms_list = '';
|
2289 |
$link_terms_array = array();
|
2290 |
if ( is_array( $link_terms ) ) {
|
3 |
Plugin Name: Link Library
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/link-library/
|
5 |
Description: Display links on pages with a variety of options
|
6 |
+
Version: 7.3
|
7 |
Author: Yannick Lefebvre
|
8 |
Author URI: http://ylefebvre.github.io/
|
9 |
Text Domain: link-library
|
474 |
'menu_position' => 10,
|
475 |
'supports' =>
|
476 |
array( 'title', 'editor', 'comments' ),
|
477 |
+
'taxonomies' => array( $genoptions['cattaxonomy'], $genoptions['tagtaxonomy'] ),
|
478 |
'menu_icon' =>
|
479 |
'dashicons-admin-links',
|
480 |
'has_archive' => false,
|
481 |
+
'rewrite' => array( 'slug' => $genoptions['cptslug'] . '/%' . $genoptions['cattaxonomy'] . '%' )
|
482 |
);
|
483 |
|
484 |
if ( $genoptions['exclude_from_search'] && $genoptions['publicly_queryable'] ) {
|
498 |
'add_new_item' => 'Add New Link Library Category',
|
499 |
'new_item_name' => 'New Link Library Category'
|
500 |
),
|
501 |
+
'show_ui' => ( $genoptions['cattaxonomy'] == 'link_library_category' ? true : false ),
|
502 |
'show_tagcloud' => false,
|
503 |
'hierarchical' => true,
|
504 |
'rewrite' => $genoptions['publicly_queryable'],
|
514 |
'labels' => array( 'name' => 'Tags',
|
515 |
'add_new_item' => 'Add New Link Library Tag',
|
516 |
'new_item_name' => 'New Link Library Tag' ),
|
517 |
+
'show_ui' => ( $genoptions['tagtaxonomy'] == 'link_library_tags' ? true : false ),
|
518 |
'rewrite' => false,
|
519 |
'show_in_rest' => true
|
520 |
)
|
795 |
$post_link = $link_url;
|
796 |
}
|
797 |
} else {
|
798 |
+
if ( !empty( $post_link ) && false !== strpos( $post_link, '%' . $genoptions['cattaxonomy'] . '%' ) ) {
|
799 |
+
$link_cat_type_term = get_the_terms( $post->ID, $genoptions['cattaxonomy'] );
|
800 |
if ( !empty( $link_cat_type_term ) ) {
|
801 |
+
$post_link = str_replace( '%' . $genoptions['cattaxonomy'] . '%', array_pop( $link_cat_type_term )->slug, $post_link );
|
802 |
}
|
803 |
}
|
804 |
}
|
1299 |
foreach( $category_list_array as $index => $category_text ) {
|
1300 |
if ( !is_numeric( $category_text ) ) {
|
1301 |
$update_list = true;
|
1302 |
+
$matched_term = get_term_by( 'slug', $category_text, $genoptions['cattaxonomy'] );
|
1303 |
|
1304 |
if ( $matched_term ) {
|
1305 |
$category_list_array[$index] = $matched_term->term_id;
|
1321 |
foreach( $exclude_category_list_array as $index => $category_text ) {
|
1322 |
if ( !is_numeric( $category_text ) ) {
|
1323 |
$update_list = true;
|
1324 |
+
$matched_term = get_term_by( 'slug', $category_text, $genoptions['cattaxonomy'] );
|
1325 |
|
1326 |
if ( $matched_term ) {
|
1327 |
$exclude_category_list_array[$index] = $matched_term->term_id;
|
1343 |
foreach( $tag_list_array as $index => $tag_text ) {
|
1344 |
if ( !is_numeric( $tag_text ) ) {
|
1345 |
$update_list = true;
|
1346 |
+
$matched_term = get_term_by( 'slug', $tag_text, $genoptions['tagtaxonomy'] );
|
1347 |
|
1348 |
if ( $matched_term ) {
|
1349 |
$tag_list_array[$index] = $matched_term->term_id;
|
1365 |
foreach( $exclude_tag_list_array as $index => $tag_text ) {
|
1366 |
if ( !is_numeric( $tag_text ) ) {
|
1367 |
$update_list = true;
|
1368 |
+
$matched_term = get_term_by( 'slug', $tag_text, $genoptions['tagtaxonomy'] );
|
1369 |
|
1370 |
if ( $matched_term ) {
|
1371 |
$exclude_tag_list_array[$index] = $matched_term->term_id;
|
1533 |
|
1534 |
if ( !empty( $options['categorylist_cpt'] ) ) {
|
1535 |
$catlistarray = explode( ',', $options['categorylist_cpt'] );
|
1536 |
+
$link_query_args['tax_query'] = array( array( 'taxonomy' => $genoptions['cattaxonomy'],
|
1537 |
'field' => 'term_id',
|
1538 |
'terms' => $catlistarray,
|
1539 |
'operator' => 'IN' ) );
|
1541 |
|
1542 |
if ( !empty( $options['excludecategorylist_cpt'] ) ) {
|
1543 |
$catlistexcludearray = explode( ',', $options['excludecategorylist_cpt'] );
|
1544 |
+
$link_query_args['tax_query'] = array( array( 'taxonomy' => $genoptions['cattaxonomy'],
|
1545 |
'field' => 'term_id',
|
1546 |
'terms' => $catlistexcludearray,
|
1547 |
'operator' => 'NOT IN' ) );
|
1740 |
foreach( $category_list_array as $index => $category_text ) {
|
1741 |
if ( !is_numeric( $category_text ) ) {
|
1742 |
$update_list = true;
|
1743 |
+
$matched_term = get_term_by( 'slug', $category_text, $genoptions['cattaxonomy'] );
|
1744 |
|
1745 |
if ( $matched_term ) {
|
1746 |
$category_list_array[$index] = $matched_term->term_id;
|
1762 |
foreach( $exclude_category_list_array as $index => $category_text ) {
|
1763 |
if ( !is_numeric( $category_text ) ) {
|
1764 |
$update_list = true;
|
1765 |
+
$matched_term = get_term_by( 'slug', $category_text, $genoptions['cattaxonomy'] );
|
1766 |
|
1767 |
if ( $matched_term ) {
|
1768 |
$exclude_category_list_array[$index] = $matched_term->term_id;
|
1784 |
foreach( $tag_list_array as $index => $tag_text ) {
|
1785 |
if ( !is_numeric( $tag_text ) ) {
|
1786 |
$update_list = true;
|
1787 |
+
$matched_term = get_term_by( 'slug', $tag_text, $genoptions['tagtaxonomy'] );
|
1788 |
|
1789 |
if ( $matched_term ) {
|
1790 |
$tag_list_array[$index] = $matched_term->term_id;
|
1806 |
foreach( $exclude_tag_list_array as $index => $tag_text ) {
|
1807 |
if ( !is_numeric( $tag_text ) ) {
|
1808 |
$update_list = true;
|
1809 |
+
$matched_term = get_term_by( 'slug', $tag_text, $genoptions['tagtaxonomy'] );
|
1810 |
|
1811 |
if ( $matched_term ) {
|
1812 |
$exclude_tag_list_array[$index] = $matched_term->term_id;
|
1943 |
foreach( $category_list_array as $index => $category_text ) {
|
1944 |
if ( !is_numeric( $category_text ) ) {
|
1945 |
$update_list = true;
|
1946 |
+
$matched_term = get_term_by( 'slug', $category_text, $genoptions['cattaxonomy'] );
|
1947 |
|
1948 |
if ( $matched_term ) {
|
1949 |
$category_list_array[$index] = $matched_term->term_id;
|
1965 |
foreach( $exclude_category_list_array as $index => $category_text ) {
|
1966 |
if ( !is_numeric( $category_text ) ) {
|
1967 |
$update_list = true;
|
1968 |
+
$matched_term = get_term_by( 'slug', $category_text, $genoptions['cattaxonomy'] );
|
1969 |
|
1970 |
if ( $matched_term ) {
|
1971 |
$exclude_category_list_array[$index] = $matched_term->term_id;
|
1987 |
foreach( $tag_list_array as $index => $tag_text ) {
|
1988 |
if ( !is_numeric( $tag_text ) ) {
|
1989 |
$update_list = true;
|
1990 |
+
$matched_term = get_term_by( 'slug', $tag_text, $genoptions['tagtaxonomy'] );
|
1991 |
|
1992 |
if ( $matched_term ) {
|
1993 |
$tag_list_array[$index] = $matched_term->term_id;
|
2009 |
foreach( $exclude_tag_list_array as $index => $tag_text ) {
|
2010 |
if ( !is_numeric( $tag_text ) ) {
|
2011 |
$update_list = true;
|
2012 |
+
$matched_term = get_term_by( 'slug', $tag_text, $genoptions['tagtaxonomy'] );
|
2013 |
|
2014 |
if ( $matched_term ) {
|
2015 |
$exclude_tag_list_array[$index] = $matched_term->term_id;
|
2043 |
}
|
2044 |
|
2045 |
function link_library_tagcloud( $atts = '' ) {
|
2046 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
2047 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
2048 |
+
|
2049 |
+
$link_library_terms = get_terms( array( 'taxonomy' => $genoptions['cattaxonomy'] ) );
|
2050 |
$output = wp_generate_tag_cloud( $link_library_terms );
|
2051 |
return $output;
|
2052 |
}
|
2287 |
$link_email = esc_html( get_post_meta( get_the_ID(), 'link_email', true ) );
|
2288 |
$link_phone_number = esc_html( get_post_meta( get_the_ID(), 'link_telephone', true ) );
|
2289 |
|
2290 |
+
$link_terms = wp_get_post_terms( get_the_ID(), $genoptions['cattaxonomy'] );
|
2291 |
$link_terms_list = '';
|
2292 |
$link_terms_array = array();
|
2293 |
if ( is_array( $link_terms ) ) {
|
linkpopup.php
CHANGED
@@ -150,7 +150,7 @@ function link_library_popup_content( $my_link_library_plugin ) {
|
|
150 |
}
|
151 |
|
152 |
$link_cat_names = '';
|
153 |
-
$link_categories = wp_get_post_terms( get_the_ID(), '
|
154 |
if ( $link_categories ) {
|
155 |
$countcats = 0;
|
156 |
foreach ( $link_categories as $link_category ) {
|
150 |
}
|
151 |
|
152 |
$link_cat_names = '';
|
153 |
+
$link_categories = wp_get_post_terms( get_the_ID(), $generaloptions['cattaxonomy'] );
|
154 |
if ( $link_categories ) {
|
155 |
$countcats = 0;
|
156 |
foreach ( $link_categories as $link_category ) {
|
readme.txt
CHANGED
@@ -48,6 +48,10 @@ Further configuration is available under the Link Library Settings panel.
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
|
|
51 |
= 7.2.9 =
|
52 |
* Fixed additional potential security issues
|
53 |
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 7.3 Beta 1 =
|
52 |
+
* Added support to use post categories instead of Link Library categories
|
53 |
+
* Added support to use post tags instead of Link Library tags
|
54 |
+
|
55 |
= 7.2.9 =
|
56 |
* Fixed additional potential security issues
|
57 |
|
render-link-library-addlink-sc.php
CHANGED
@@ -6,6 +6,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
6 |
require_once plugin_dir_path( __FILE__ ) . 'link-library-defaults.php';
|
7 |
|
8 |
function addlink_render_category_list( $categories, $select_name, $depth, $order, $libraryoptions, $captureddata ) {
|
|
|
|
|
9 |
|
10 |
$output = '';
|
11 |
if ( !empty( $categories ) ) {
|
@@ -37,7 +39,7 @@ function addlink_render_category_list( $categories, $select_name, $depth, $order
|
|
37 |
}
|
38 |
|
39 |
$output .= '>' . str_repeat( ' ', 4 * $depth ) . $category->name . '</option>';
|
40 |
-
$child_categories = get_terms( '
|
41 |
|
42 |
if ( !empty( $child_categories ) ) {
|
43 |
$output .= addlink_render_category_list( $child_categories, $select_name, $depth + 1, $order, $libraryoptions, $captureddata );
|
@@ -391,7 +393,7 @@ function RenderLinkLibraryAddLinkForm( $LLPluginClass, $generaloptions, $library
|
|
391 |
$link_categories_query_args['exclude'] = $excluded_links_array;
|
392 |
}
|
393 |
|
394 |
-
$linkcats = get_terms( '
|
395 |
|
396 |
if ( !empty( $include_links_array ) && !empty( $excluded_links_array ) ) {
|
397 |
foreach( $linkcats as $link_key => $linkcat ) {
|
@@ -403,6 +405,12 @@ function RenderLinkLibraryAddLinkForm( $LLPluginClass, $generaloptions, $library
|
|
403 |
}
|
404 |
}
|
405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
if ( $debugmode ) {
|
407 |
$output .= "\n<!-- Category query for add link form:" . print_r($linkcatquery, TRUE) . "-->\n\n";
|
408 |
$output .= "\n<!-- Results of Category query for add link form:" . print_r($linkcats, TRUE) . "-->\n";
|
@@ -458,7 +466,7 @@ function RenderLinkLibraryAddLinkForm( $LLPluginClass, $generaloptions, $library
|
|
458 |
}
|
459 |
break;
|
460 |
case 6: //------------------ Link Tags --------------------
|
461 |
-
$link_tags_query_args = array( 'hide_empty' => false, 'taxonomy' => '
|
462 |
if ( !empty( $include_links_array ) ) {
|
463 |
$link_tags_query_args['include'] = explode( ',', $libraryoptions['addlinktaglistoverride'] );
|
464 |
}
|
@@ -894,7 +902,7 @@ function RenderLinkLibraryAddLinkForm( $LLPluginClass, $generaloptions, $library
|
|
894 |
$link_categories_query_args['orderby'] = 'name';
|
895 |
$link_categories_query_args['order'] = 'ASC';
|
896 |
|
897 |
-
$link_categories = get_terms( '
|
898 |
|
899 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_only_publish' );
|
900 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_publish_pending' );
|
@@ -908,7 +916,7 @@ function RenderLinkLibraryAddLinkForm( $LLPluginClass, $generaloptions, $library
|
|
908 |
if ( !$combineresults ) {
|
909 |
$link_query_args['tax_query'][] =
|
910 |
array(
|
911 |
-
'taxonomy' => '
|
912 |
'field' => 'term_id',
|
913 |
'terms' => $link_category->term_id,
|
914 |
'include_children' => false
|
@@ -936,13 +944,13 @@ function RenderLinkLibraryAddLinkForm( $LLPluginClass, $generaloptions, $library
|
|
936 |
|
937 |
if ( isset( $_GET['link_tags'] ) && !empty( $_GET['link_tags'] ) ) {
|
938 |
$link_query_args['tax_query'][] = array(
|
939 |
-
'taxonomy' => '
|
940 |
'field' => 'slug',
|
941 |
'terms' => $tag_array,
|
942 |
);
|
943 |
} elseif ( !empty( $taglist_cpt ) ) {
|
944 |
$link_query_args['tax_query'][] = array(
|
945 |
-
'taxonomy' => '
|
946 |
'field' => 'id',
|
947 |
'terms' => $tag_array,
|
948 |
);
|
@@ -968,7 +976,7 @@ function RenderLinkLibraryAddLinkForm( $LLPluginClass, $generaloptions, $library
|
|
968 |
|
969 |
if ( !empty( $excludetaglist_cpt ) ) {
|
970 |
$link_query_args['tax_query'][] = array(
|
971 |
-
'taxonomy' => '
|
972 |
'field' => 'id',
|
973 |
'terms' => $exclude_tag_array,
|
974 |
'operator' => 'NOT IN'
|
6 |
require_once plugin_dir_path( __FILE__ ) . 'link-library-defaults.php';
|
7 |
|
8 |
function addlink_render_category_list( $categories, $select_name, $depth, $order, $libraryoptions, $captureddata ) {
|
9 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
10 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
11 |
|
12 |
$output = '';
|
13 |
if ( !empty( $categories ) ) {
|
39 |
}
|
40 |
|
41 |
$output .= '>' . str_repeat( ' ', 4 * $depth ) . $category->name . '</option>';
|
42 |
+
$child_categories = get_terms( $genoptions['cattaxonomy'], array( 'orderby' => 'name', 'parent' => $category->term_id, 'order' => $order, 'hide_empty' => false ) );
|
43 |
|
44 |
if ( !empty( $child_categories ) ) {
|
45 |
$output .= addlink_render_category_list( $child_categories, $select_name, $depth + 1, $order, $libraryoptions, $captureddata );
|
393 |
$link_categories_query_args['exclude'] = $excluded_links_array;
|
394 |
}
|
395 |
|
396 |
+
$linkcats = get_terms( $generaloptions['cattaxonomy'], $link_categories_query_args );
|
397 |
|
398 |
if ( !empty( $include_links_array ) && !empty( $excluded_links_array ) ) {
|
399 |
foreach( $linkcats as $link_key => $linkcat ) {
|
405 |
}
|
406 |
}
|
407 |
|
408 |
+
foreach( $linkcats as $link_key => $linkcat ) {
|
409 |
+
if ( $linkcat->term_id == 1 ) {
|
410 |
+
unset( $linkcats[$link_key] );
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
if ( $debugmode ) {
|
415 |
$output .= "\n<!-- Category query for add link form:" . print_r($linkcatquery, TRUE) . "-->\n\n";
|
416 |
$output .= "\n<!-- Results of Category query for add link form:" . print_r($linkcats, TRUE) . "-->\n";
|
466 |
}
|
467 |
break;
|
468 |
case 6: //------------------ Link Tags --------------------
|
469 |
+
$link_tags_query_args = array( 'hide_empty' => false, 'taxonomy' => $generaloptions['tagtaxonomy'] );
|
470 |
if ( !empty( $include_links_array ) ) {
|
471 |
$link_tags_query_args['include'] = explode( ',', $libraryoptions['addlinktaglistoverride'] );
|
472 |
}
|
902 |
$link_categories_query_args['orderby'] = 'name';
|
903 |
$link_categories_query_args['order'] = 'ASC';
|
904 |
|
905 |
+
$link_categories = get_terms( $generaloptions['cattaxonomy'], $link_categories_query_args );
|
906 |
|
907 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_only_publish' );
|
908 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_publish_pending' );
|
916 |
if ( !$combineresults ) {
|
917 |
$link_query_args['tax_query'][] =
|
918 |
array(
|
919 |
+
'taxonomy' => $generaloptions['cattaxonomy'],
|
920 |
'field' => 'term_id',
|
921 |
'terms' => $link_category->term_id,
|
922 |
'include_children' => false
|
944 |
|
945 |
if ( isset( $_GET['link_tags'] ) && !empty( $_GET['link_tags'] ) ) {
|
946 |
$link_query_args['tax_query'][] = array(
|
947 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
948 |
'field' => 'slug',
|
949 |
'terms' => $tag_array,
|
950 |
);
|
951 |
} elseif ( !empty( $taglist_cpt ) ) {
|
952 |
$link_query_args['tax_query'][] = array(
|
953 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
954 |
'field' => 'id',
|
955 |
'terms' => $tag_array,
|
956 |
);
|
976 |
|
977 |
if ( !empty( $excludetaglist_cpt ) ) {
|
978 |
$link_query_args['tax_query'][] = array(
|
979 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
980 |
'field' => 'id',
|
981 |
'terms' => $exclude_tag_array,
|
982 |
'operator' => 'NOT IN'
|
render-link-library-alpha-filter.php
CHANGED
@@ -30,7 +30,7 @@ function RenderLinkLibraryAlphaFilter( $LLPluginClass, $generaloptions, $library
|
|
30 |
|
31 |
$linkcatquery .= ' )) ';
|
32 |
|
33 |
-
$linkcatquery .= 'WHERE tt.taxonomy = "
|
34 |
|
35 |
if ( !empty( $categorylist_cpt ) ) {
|
36 |
$linkcatquery .= ' AND t.term_id in ( ' . $categorylist_cpt . ' )';
|
30 |
|
31 |
$linkcatquery .= ' )) ';
|
32 |
|
33 |
+
$linkcatquery .= 'WHERE tt.taxonomy = "' . $generaloptions['cattaxonomy'] . '"';
|
34 |
|
35 |
if ( !empty( $categorylist_cpt ) ) {
|
36 |
$linkcatquery .= ' AND t.term_id in ( ' . $categorylist_cpt . ' )';
|
render-link-library-cats-sc.php
CHANGED
@@ -47,8 +47,10 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
|
|
47 |
if ( isset($_GET['cat_id'] ) ) {
|
48 |
$categoryid = intval( $_GET['cat_id'] );
|
49 |
} elseif ( isset( $_GET['catname'] ) ) {
|
50 |
-
$categoryterm = get_term_by( 'name', sanitize_text_field( urldecode( $_GET['catname'] ) ), '
|
51 |
-
|
|
|
|
|
52 |
} elseif ( $showonecatonly ) {
|
53 |
$categoryid = $defaultsinglecat_cpt;
|
54 |
}
|
@@ -152,7 +154,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
|
|
152 |
$link_categories_query_args['order'] = in_array( $direction, $validdirections ) ? $direction : 'ASC';
|
153 |
}
|
154 |
|
155 |
-
$link_categories = get_terms( '
|
156 |
|
157 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_only_publish' );
|
158 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_publish_pending' );
|
@@ -228,7 +230,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
|
|
228 |
foreach ( $link_categories as $catname ) {
|
229 |
$linkcount = 0;
|
230 |
|
231 |
-
$childcatparams = array( 'taxonomy' => '
|
232 |
|
233 |
if ( $hide_if_empty ) {
|
234 |
$childcatparams['hide_empty'] = true;
|
@@ -271,7 +273,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
|
|
271 |
|
272 |
$link_query_args['tax_query'][] =
|
273 |
array(
|
274 |
-
'taxonomy' => '
|
275 |
'field' => 'term_id',
|
276 |
'terms' => $catname->term_id,
|
277 |
'include_children' => false
|
@@ -280,7 +282,7 @@ function RenderLinkLibraryCategories( $LLPluginClass, $generaloptions, $libraryo
|
|
280 |
if ( !empty( $tag_array ) ) {
|
281 |
$link_query_args['tax_query'][] = array(
|
282 |
array(
|
283 |
-
'taxonomy' => '
|
284 |
'field' => $tag_type,
|
285 |
'terms' => $tag_array
|
286 |
)
|
47 |
if ( isset($_GET['cat_id'] ) ) {
|
48 |
$categoryid = intval( $_GET['cat_id'] );
|
49 |
} elseif ( isset( $_GET['catname'] ) ) {
|
50 |
+
$categoryterm = get_term_by( 'name', sanitize_text_field( urldecode( $_GET['catname'] ) ), $generaloptions['cattaxonomy'] );
|
51 |
+
if ( false !== $categoryterm ) {
|
52 |
+
$categoryid = $categoryterm->term_id;
|
53 |
+
}
|
54 |
} elseif ( $showonecatonly ) {
|
55 |
$categoryid = $defaultsinglecat_cpt;
|
56 |
}
|
154 |
$link_categories_query_args['order'] = in_array( $direction, $validdirections ) ? $direction : 'ASC';
|
155 |
}
|
156 |
|
157 |
+
$link_categories = get_terms( $generaloptions['cattaxonomy'], $link_categories_query_args );
|
158 |
|
159 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_only_publish' );
|
160 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_publish_pending' );
|
230 |
foreach ( $link_categories as $catname ) {
|
231 |
$linkcount = 0;
|
232 |
|
233 |
+
$childcatparams = array( 'taxonomy' => $generaloptions['cattaxonomy'], 'child_of' => $catname->term_id );
|
234 |
|
235 |
if ( $hide_if_empty ) {
|
236 |
$childcatparams['hide_empty'] = true;
|
273 |
|
274 |
$link_query_args['tax_query'][] =
|
275 |
array(
|
276 |
+
'taxonomy' => $generaloptions['cattaxonomy'],
|
277 |
'field' => 'term_id',
|
278 |
'terms' => $catname->term_id,
|
279 |
'include_children' => false
|
282 |
if ( !empty( $tag_array ) ) {
|
283 |
$link_query_args['tax_query'][] = array(
|
284 |
array(
|
285 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
286 |
'field' => $tag_type,
|
287 |
'terms' => $tag_array
|
288 |
)
|
render-link-library-sc.php
CHANGED
@@ -25,12 +25,15 @@ function link_library_highlight_phrase( $str, $phrase, $tag_open = '<strong>', $
|
|
25 |
}
|
26 |
|
27 |
function link_library_get_breadcrumb_path( $slug, $rewritepage, $level = 0 ) {
|
|
|
|
|
|
|
28 |
$cat_path = '';
|
29 |
|
30 |
-
$term = get_term_by( 'slug', $slug, '
|
31 |
|
32 |
if ( !empty( $term ) ) {
|
33 |
-
$parent_term = get_term_by( 'id', $term->parent, '
|
34 |
if ( !empty( $parent_term ) ) {
|
35 |
$cat_path .= link_library_get_breadcrumb_path( $parent_term->slug, $rewritepage, $level + 1 ) . ' - ';
|
36 |
}
|
@@ -291,7 +294,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
291 |
|
292 |
if ( $level == 0 && ( ( isset( $_GET['cat_name'] ) && !empty( $_GET['cat_name'] ) ) || ( isset( $wp_query->query_vars['cat_name'] ) && !empty( $wp_query->query_vars['cat_name'] ) ) ) ) {
|
293 |
if ( !empty( $_GET['cat_name'] ) ) {
|
294 |
-
$category_entry = get_term_by( 'slug', sanitize_text_field( $_GET['cat_name'] ), '
|
295 |
} elseif ( !empty( $wp_query->query_vars['cat_name'] ) ) {
|
296 |
$last_slash_pos = strripos( $wp_query->query_vars['cat_name'], '/' );
|
297 |
if ( $last_slash_pos != 0 ) {
|
@@ -300,7 +303,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
300 |
$cat_string = $wp_query->query_vars['cat_name'];
|
301 |
}
|
302 |
|
303 |
-
$category_entry = get_term_by( 'slug', $cat_string, '
|
304 |
}
|
305 |
|
306 |
if ( !empty( $category_entry ) ) {
|
@@ -354,7 +357,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
354 |
$linkeditoruser = current_user_can( 'manage_options' );
|
355 |
|
356 |
if ( $level == 0 ) {
|
357 |
-
$output = "
|
358 |
} else {
|
359 |
$output = '';
|
360 |
}
|
@@ -465,7 +468,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
465 |
$show_one_cat_query_args['order'] = in_array( $direction, $validdirections ) ? $direction : 'ASC';
|
466 |
}
|
467 |
|
468 |
-
$show_one_cat_query_args['taxonomy'] = '
|
469 |
|
470 |
$show_one_cat_link_categories = get_terms( $show_one_cat_query_args );
|
471 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_only_publish' );
|
@@ -599,7 +602,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
599 |
$no_sub_cat = true;
|
600 |
if ( !empty( $link_categories_query_args['include'] ) ) {
|
601 |
foreach ( $link_categories_query_args['include'] as $include_cat ) {
|
602 |
-
$cat_term = get_term_by( 'id', $include_cat, '
|
603 |
if ( !empty( $cat_term ) ) {
|
604 |
if ( $cat_term->parent != 0 && $level == 0 ) {
|
605 |
$no_sub_cat = false;
|
@@ -612,7 +615,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
612 |
}
|
613 |
}
|
614 |
|
615 |
-
$link_categories = get_terms( '
|
616 |
|
617 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_only_publish' );
|
618 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_publish_pending' );
|
@@ -665,7 +668,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
665 |
'post_type' => 'link_library_links',
|
666 |
'tax_query' => array(
|
667 |
array(
|
668 |
-
'taxonomy' => '
|
669 |
'field' => 'term_id',
|
670 |
'terms' => $link_category->term_id
|
671 |
)
|
@@ -676,7 +679,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
676 |
if ( !empty( $tag_array ) ) {
|
677 |
$args['tax_query'][] = array(
|
678 |
array(
|
679 |
-
'taxonomy' => '
|
680 |
'field' => 'slug',
|
681 |
'terms' => $tag_array
|
682 |
)
|
@@ -781,7 +784,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
781 |
if ( !$combineresults ) {
|
782 |
$link_query_args['tax_query'][] =
|
783 |
array(
|
784 |
-
'taxonomy' => '
|
785 |
'field' => 'term_id',
|
786 |
'terms' => $link_category->term_id,
|
787 |
'include_children' => false
|
@@ -806,13 +809,13 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
806 |
|
807 |
if ( isset( $_GET['link_tags'] ) && !empty( $_GET['link_tags'] ) ) {
|
808 |
$link_query_args['tax_query'][] = array(
|
809 |
-
'taxonomy' => '
|
810 |
'field' => 'slug',
|
811 |
'terms' => $tag_array,
|
812 |
);
|
813 |
} elseif ( !empty( $taglist_cpt ) ) {
|
814 |
$link_query_args['tax_query'][] = array(
|
815 |
-
'taxonomy' => '
|
816 |
'field' => 'id',
|
817 |
'terms' => $tag_array,
|
818 |
);
|
@@ -834,7 +837,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
834 |
|
835 |
if ( !empty( $excludetaglist_cpt ) ) {
|
836 |
$link_query_args['tax_query'][] = array(
|
837 |
-
'taxonomy' => '
|
838 |
'field' => 'id',
|
839 |
'terms' => $exclude_tag_array,
|
840 |
'operator' => 'NOT IN'
|
@@ -985,7 +988,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
985 |
$output .= '<!-- showonecatmode: ' . $showonecatonly . ', AJAXnocatset: ' . $AJAXnocatset . ', nocatonstartup: ' . $nocatonstartup . '-->';
|
986 |
}
|
987 |
|
988 |
-
$child_cat_params = array( 'taxonomy' => '
|
989 |
|
990 |
if ( $hide_if_empty ) {
|
991 |
$child_cat_params['hide_empty'] = true;
|
@@ -1418,7 +1421,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
1418 |
|
1419 |
$linkitem['category_name'] = '';
|
1420 |
if ( $combineresults ) {
|
1421 |
-
$link_terms = wp_get_post_terms( get_the_ID(), '
|
1422 |
if ( !empty( $link_terms ) ) {
|
1423 |
$link_term_array = array();
|
1424 |
foreach( $link_terms as $link_term ) {
|
@@ -2388,7 +2391,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
2388 |
|
2389 |
case 15: //------------------ Link Tags Output --------------------
|
2390 |
|
2391 |
-
$link_tags = wp_get_post_terms( $linkitem['proper_link_id'], '
|
2392 |
|
2393 |
if ( $suppress_link_tags_if_empty && empty( $link_tags ) ) {
|
2394 |
break;
|
@@ -2484,7 +2487,7 @@ function RenderLinkLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $s
|
|
2484 |
if ( 'currentcatname' == $catnameformat ) {
|
2485 |
$current_cat_output .= $linkitem['category_name'];
|
2486 |
} elseif( 'allcatnames' == $catnameformat ) {
|
2487 |
-
$link_terms = wp_get_post_terms( get_the_ID(), '
|
2488 |
|
2489 |
$link_terms_array = array();
|
2490 |
if ( !empty( $link_terms ) ) {
|
25 |
}
|
26 |
|
27 |
function link_library_get_breadcrumb_path( $slug, $rewritepage, $level = 0 ) {
|
28 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
29 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
30 |
+
|
31 |
$cat_path = '';
|
32 |
|
33 |
+
$term = get_term_by( 'slug', $slug, $genoptions['cattaxonomy'] );
|
34 |
|
35 |
if ( !empty( $term ) ) {
|
36 |
+
$parent_term = get_term_by( 'id', $term->parent, $genoptions['cattaxonomy'] );
|
37 |
if ( !empty( $parent_term ) ) {
|
38 |
$cat_path .= link_library_get_breadcrumb_path( $parent_term->slug, $rewritepage, $level + 1 ) . ' - ';
|
39 |
}
|
294 |
|
295 |
if ( $level == 0 && ( ( isset( $_GET['cat_name'] ) && !empty( $_GET['cat_name'] ) ) || ( isset( $wp_query->query_vars['cat_name'] ) && !empty( $wp_query->query_vars['cat_name'] ) ) ) ) {
|
296 |
if ( !empty( $_GET['cat_name'] ) ) {
|
297 |
+
$category_entry = get_term_by( 'slug', sanitize_text_field( $_GET['cat_name'] ), $generaloptions['cattaxonomy'], OBJECT );
|
298 |
} elseif ( !empty( $wp_query->query_vars['cat_name'] ) ) {
|
299 |
$last_slash_pos = strripos( $wp_query->query_vars['cat_name'], '/' );
|
300 |
if ( $last_slash_pos != 0 ) {
|
303 |
$cat_string = $wp_query->query_vars['cat_name'];
|
304 |
}
|
305 |
|
306 |
+
$category_entry = get_term_by( 'slug', $cat_string, $generaloptions['cattaxonomy'], OBJECT );
|
307 |
}
|
308 |
|
309 |
if ( !empty( $category_entry ) ) {
|
357 |
$linkeditoruser = current_user_can( 'manage_options' );
|
358 |
|
359 |
if ( $level == 0 ) {
|
360 |
+
$output = "<!-- Beginning of Link Library Output -->";
|
361 |
} else {
|
362 |
$output = '';
|
363 |
}
|
468 |
$show_one_cat_query_args['order'] = in_array( $direction, $validdirections ) ? $direction : 'ASC';
|
469 |
}
|
470 |
|
471 |
+
$show_one_cat_query_args['taxonomy'] = $generaloptions['cattaxonomy'];
|
472 |
|
473 |
$show_one_cat_link_categories = get_terms( $show_one_cat_query_args );
|
474 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_only_publish' );
|
602 |
$no_sub_cat = true;
|
603 |
if ( !empty( $link_categories_query_args['include'] ) ) {
|
604 |
foreach ( $link_categories_query_args['include'] as $include_cat ) {
|
605 |
+
$cat_term = get_term_by( 'id', $include_cat, $generaloptions['cattaxonomy'] );
|
606 |
if ( !empty( $cat_term ) ) {
|
607 |
if ( $cat_term->parent != 0 && $level == 0 ) {
|
608 |
$no_sub_cat = false;
|
615 |
}
|
616 |
}
|
617 |
|
618 |
+
$link_categories = get_terms( $generaloptions['cattaxonomy'], $link_categories_query_args );
|
619 |
|
620 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_only_publish' );
|
621 |
remove_filter( 'get_terms', 'link_library_get_terms_filter_publish_pending' );
|
668 |
'post_type' => 'link_library_links',
|
669 |
'tax_query' => array(
|
670 |
array(
|
671 |
+
'taxonomy' => $generaloptions['cattaxonomy'],
|
672 |
'field' => 'term_id',
|
673 |
'terms' => $link_category->term_id
|
674 |
)
|
679 |
if ( !empty( $tag_array ) ) {
|
680 |
$args['tax_query'][] = array(
|
681 |
array(
|
682 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
683 |
'field' => 'slug',
|
684 |
'terms' => $tag_array
|
685 |
)
|
784 |
if ( !$combineresults ) {
|
785 |
$link_query_args['tax_query'][] =
|
786 |
array(
|
787 |
+
'taxonomy' => $generaloptions['cattaxonomy'],
|
788 |
'field' => 'term_id',
|
789 |
'terms' => $link_category->term_id,
|
790 |
'include_children' => false
|
809 |
|
810 |
if ( isset( $_GET['link_tags'] ) && !empty( $_GET['link_tags'] ) ) {
|
811 |
$link_query_args['tax_query'][] = array(
|
812 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
813 |
'field' => 'slug',
|
814 |
'terms' => $tag_array,
|
815 |
);
|
816 |
} elseif ( !empty( $taglist_cpt ) ) {
|
817 |
$link_query_args['tax_query'][] = array(
|
818 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
819 |
'field' => 'id',
|
820 |
'terms' => $tag_array,
|
821 |
);
|
837 |
|
838 |
if ( !empty( $excludetaglist_cpt ) ) {
|
839 |
$link_query_args['tax_query'][] = array(
|
840 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
841 |
'field' => 'id',
|
842 |
'terms' => $exclude_tag_array,
|
843 |
'operator' => 'NOT IN'
|
988 |
$output .= '<!-- showonecatmode: ' . $showonecatonly . ', AJAXnocatset: ' . $AJAXnocatset . ', nocatonstartup: ' . $nocatonstartup . '-->';
|
989 |
}
|
990 |
|
991 |
+
$child_cat_params = array( 'taxonomy' => $generaloptions['cattaxonomy'], 'child_of' => $link_category->term_id );
|
992 |
|
993 |
if ( $hide_if_empty ) {
|
994 |
$child_cat_params['hide_empty'] = true;
|
1421 |
|
1422 |
$linkitem['category_name'] = '';
|
1423 |
if ( $combineresults ) {
|
1424 |
+
$link_terms = wp_get_post_terms( get_the_ID(), $generaloptions['cattaxonomy'] );
|
1425 |
if ( !empty( $link_terms ) ) {
|
1426 |
$link_term_array = array();
|
1427 |
foreach( $link_terms as $link_term ) {
|
2391 |
|
2392 |
case 15: //------------------ Link Tags Output --------------------
|
2393 |
|
2394 |
+
$link_tags = wp_get_post_terms( $linkitem['proper_link_id'], $generaloptions['tagtaxonomy'] );
|
2395 |
|
2396 |
if ( $suppress_link_tags_if_empty && empty( $link_tags ) ) {
|
2397 |
break;
|
2487 |
if ( 'currentcatname' == $catnameformat ) {
|
2488 |
$current_cat_output .= $linkitem['category_name'];
|
2489 |
} elseif( 'allcatnames' == $catnameformat ) {
|
2490 |
+
$link_terms = wp_get_post_terms( get_the_ID(), $generaloptions['cattaxonomy'] );
|
2491 |
|
2492 |
$link_terms_array = array();
|
2493 |
if ( !empty( $link_terms ) ) {
|
render-link-library-tag-filter-sc.php
CHANGED
@@ -37,7 +37,7 @@ function RenderLinkLibraryFilterBox( $LLPluginClass, $generaloptions, $libraryop
|
|
37 |
|
38 |
$output .= '<div class="tag-filters">';
|
39 |
$output .= '<div class="tag-filters-title">' . $tag_label . '</div>';
|
40 |
-
$link_terms = get_terms( array( 'taxonomy' => '
|
41 |
|
42 |
if ( isset( $_GET['link_tags'] ) && !empty( $_GET['link_tags'] ) ) {
|
43 |
$prev_link_tags = sanitize_text_field( $_GET['link_tags'] );
|
37 |
|
38 |
$output .= '<div class="tag-filters">';
|
39 |
$output .= '<div class="tag-filters-title">' . $tag_label . '</div>';
|
40 |
+
$link_terms = get_terms( array( 'taxonomy' => $generaloptions['tagtaxonomy'], 'include' => $include_tags, 'exclude' => $exclude_tags ) );
|
41 |
|
42 |
if ( isset( $_GET['link_tags'] ) && !empty( $_GET['link_tags'] ) ) {
|
43 |
$prev_link_tags = sanitize_text_field( $_GET['link_tags'] );
|
render-rss-library-sc.php
CHANGED
@@ -149,7 +149,7 @@ function RenderRSSLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $se
|
|
149 |
$link_categories_query_args['orderby'] = 'name';
|
150 |
$link_categories_query_args['order'] = in_array( $direction, $validdirections ) ? $direction : 'ASC';
|
151 |
|
152 |
-
$link_categories = get_terms( '
|
153 |
|
154 |
if ( $level == 0 ) {
|
155 |
$output .= "<div id='rsslist" . $settings . "' class='rsslist'><!-- Div Rsslist -->\n";
|
@@ -167,7 +167,7 @@ function RenderRSSLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $se
|
|
167 |
|
168 |
$link_query_args['tax_query'][] =
|
169 |
array(
|
170 |
-
'taxonomy' => '
|
171 |
'field' => 'term_id',
|
172 |
'terms' => $link_category->term_id,
|
173 |
'include_children' => false
|
@@ -189,13 +189,13 @@ function RenderRSSLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $se
|
|
189 |
|
190 |
if ( isset( $_GET['link_tags'] ) && !empty( $_GET['link_tags'] ) ) {
|
191 |
$link_query_args['tax_query'][] = array(
|
192 |
-
'taxonomy' => '
|
193 |
'field' => 'slug',
|
194 |
'terms' => $tag_array,
|
195 |
);
|
196 |
} elseif ( !empty( $taglist_cpt ) ) {
|
197 |
$link_query_args['tax_query'][] = array(
|
198 |
-
'taxonomy' => '
|
199 |
'field' => 'id',
|
200 |
'terms' => $tag_array,
|
201 |
);
|
@@ -216,7 +216,7 @@ function RenderRSSLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $se
|
|
216 |
|
217 |
if ( !empty( $excludetaglist_cpt ) ) {
|
218 |
$link_query_args['tax_query'][] = array(
|
219 |
-
'taxonomy' => '
|
220 |
'field' => 'id',
|
221 |
'terms' => $exclude_tag_array,
|
222 |
'operator' => 'NOT IN'
|
@@ -249,7 +249,7 @@ function RenderRSSLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $se
|
|
249 |
$output .= "\n<!-- Link Query Execution Time: " . ( microtime( true ) - $linkquerystarttime ) . "-->\n\n";
|
250 |
}
|
251 |
|
252 |
-
$child_cat_params = array( 'taxonomy' => '
|
253 |
|
254 |
if ( $hide_if_empty ) {
|
255 |
$child_cat_params['hide_empty'] = true;
|
@@ -284,7 +284,7 @@ function RenderRSSLibrary( $LLPluginClass, $generaloptions, $libraryoptions, $se
|
|
284 |
$linkitem['link_name'] = get_the_title();
|
285 |
$link_meta = get_metadata( 'post', get_the_ID() );
|
286 |
|
287 |
-
$link_terms = wp_get_post_terms( get_the_ID(), '
|
288 |
if ( !empty( $link_terms ) ) {
|
289 |
$link_term_array = array();
|
290 |
foreach( $link_terms as $link_term ) {
|
149 |
$link_categories_query_args['orderby'] = 'name';
|
150 |
$link_categories_query_args['order'] = in_array( $direction, $validdirections ) ? $direction : 'ASC';
|
151 |
|
152 |
+
$link_categories = get_terms( $generaloptions['cattaxonomy'], $link_categories_query_args );
|
153 |
|
154 |
if ( $level == 0 ) {
|
155 |
$output .= "<div id='rsslist" . $settings . "' class='rsslist'><!-- Div Rsslist -->\n";
|
167 |
|
168 |
$link_query_args['tax_query'][] =
|
169 |
array(
|
170 |
+
'taxonomy' => $generaloptions['cattaxonomy'],
|
171 |
'field' => 'term_id',
|
172 |
'terms' => $link_category->term_id,
|
173 |
'include_children' => false
|
189 |
|
190 |
if ( isset( $_GET['link_tags'] ) && !empty( $_GET['link_tags'] ) ) {
|
191 |
$link_query_args['tax_query'][] = array(
|
192 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
193 |
'field' => 'slug',
|
194 |
'terms' => $tag_array,
|
195 |
);
|
196 |
} elseif ( !empty( $taglist_cpt ) ) {
|
197 |
$link_query_args['tax_query'][] = array(
|
198 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
199 |
'field' => 'id',
|
200 |
'terms' => $tag_array,
|
201 |
);
|
216 |
|
217 |
if ( !empty( $excludetaglist_cpt ) ) {
|
218 |
$link_query_args['tax_query'][] = array(
|
219 |
+
'taxonomy' => $generaloptions['tagtaxonomy'],
|
220 |
'field' => 'id',
|
221 |
'terms' => $exclude_tag_array,
|
222 |
'operator' => 'NOT IN'
|
249 |
$output .= "\n<!-- Link Query Execution Time: " . ( microtime( true ) - $linkquerystarttime ) . "-->\n\n";
|
250 |
}
|
251 |
|
252 |
+
$child_cat_params = array( 'taxonomy' => $generaloptions['cattaxonomy'], 'child_of' => $link_category->term_id );
|
253 |
|
254 |
if ( $hide_if_empty ) {
|
255 |
$child_cat_params['hide_empty'] = true;
|
284 |
$linkitem['link_name'] = get_the_title();
|
285 |
$link_meta = get_metadata( 'post', get_the_ID() );
|
286 |
|
287 |
+
$link_terms = wp_get_post_terms( get_the_ID(), $generaloptions['cattaxonomy'] );
|
288 |
if ( !empty( $link_terms ) ) {
|
289 |
$link_term_array = array();
|
290 |
foreach( $link_terms as $link_term ) {
|
rssfeed.php
CHANGED
@@ -14,6 +14,9 @@ function link_library_generate_rss_feed () {
|
|
14 |
$settingsetid = 1;
|
15 |
}
|
16 |
|
|
|
|
|
|
|
17 |
$settingsname = 'LinkLibraryPP' . $settingsetid;
|
18 |
$options = get_option( $settingsname );
|
19 |
|
@@ -57,7 +60,7 @@ function link_library_generate_rss_feed () {
|
|
57 |
if ( !empty( $options['categorylist_cpt'] ) ) {
|
58 |
$link_query_args['tax_query'] = array(
|
59 |
array(
|
60 |
-
'taxonomy' => '
|
61 |
'field' => 'term_id',
|
62 |
'terms' => explode( ',', $options['categorylist_cpt'] ),
|
63 |
'operator' => 'IN',
|
@@ -71,7 +74,7 @@ function link_library_generate_rss_feed () {
|
|
71 |
}
|
72 |
|
73 |
$link_query_args['tax_query'][] = array(
|
74 |
-
'taxonomy' => '
|
75 |
'field' => 'term_id',
|
76 |
'terms' => explode( ',', $options['excludecategorylist_cpt'] ),
|
77 |
'operator' => 'NOT IN',
|
@@ -95,7 +98,7 @@ function link_library_generate_rss_feed () {
|
|
95 |
|
96 |
$human_date = date( "Y-m-d H:i", $link_updated );
|
97 |
|
98 |
-
$link_categories = wp_get_post_terms( get_the_ID(), '
|
99 |
|
100 |
$cat_names = '';
|
101 |
if ( $link_categories ) {
|
14 |
$settingsetid = 1;
|
15 |
}
|
16 |
|
17 |
+
$genoptions = get_option( 'LinkLibraryGeneral' );
|
18 |
+
$genoptions = wp_parse_args( $genoptions, ll_reset_gen_settings( 'return' ) );
|
19 |
+
|
20 |
$settingsname = 'LinkLibraryPP' . $settingsetid;
|
21 |
$options = get_option( $settingsname );
|
22 |
|
60 |
if ( !empty( $options['categorylist_cpt'] ) ) {
|
61 |
$link_query_args['tax_query'] = array(
|
62 |
array(
|
63 |
+
'taxonomy' => $genoptions['cattaxonomy'],
|
64 |
'field' => 'term_id',
|
65 |
'terms' => explode( ',', $options['categorylist_cpt'] ),
|
66 |
'operator' => 'IN',
|
74 |
}
|
75 |
|
76 |
$link_query_args['tax_query'][] = array(
|
77 |
+
'taxonomy' => $genoptions['cattaxonomy'],
|
78 |
'field' => 'term_id',
|
79 |
'terms' => explode( ',', $options['excludecategorylist_cpt'] ),
|
80 |
'operator' => 'NOT IN',
|
98 |
|
99 |
$human_date = date( "Y-m-d H:i", $link_updated );
|
100 |
|
101 |
+
$link_categories = wp_get_post_terms( get_the_ID(), $genoptions['cattaxonomy'] );
|
102 |
|
103 |
$cat_names = '';
|
104 |
if ( $link_categories ) {
|
usersubmission.php
CHANGED
@@ -269,10 +269,10 @@ function link_library_process_user_submission( $my_link_library_plugin ) {
|
|
269 |
foreach ( $captureddata['link_category'] as $cat_element ) {
|
270 |
if ( $cat_element == 'new' && !empty( $captureddata['link_user_category'] ) ) {
|
271 |
|
272 |
-
$existingcat = get_term_by( 'name', $captureddata['link_user_category'], '
|
273 |
|
274 |
if ( empty( $existingcat ) ) {
|
275 |
-
$new_category = wp_insert_term( $captureddata['link_user_category'], '
|
276 |
|
277 |
$newlinkcat[] = $new_category['term_id'];
|
278 |
$newlinkcatlist[$new_category['term_id']] = sanitize_text_field( $captureddata['link_user_category'] );
|
@@ -287,7 +287,7 @@ function link_library_process_user_submission( $my_link_library_plugin ) {
|
|
287 |
$message = 7;
|
288 |
} else {
|
289 |
$newlinkcat[] = $cat_element;
|
290 |
-
$existingcat = get_term_by( 'id', $cat_element, '
|
291 |
$newlinkcatlist[$existingcat->term_id] = $existingcat->name;
|
292 |
|
293 |
$message = 8;
|
@@ -305,10 +305,10 @@ function link_library_process_user_submission( $my_link_library_plugin ) {
|
|
305 |
$user_tag_array = explode( ',', $captureddata['link_user_tags'] );
|
306 |
|
307 |
foreach( $user_tag_array as $user_tag ) {
|
308 |
-
$existingtag = get_term_by( 'name', $user_tag, '
|
309 |
|
310 |
if ( empty( $existingtag ) ) {
|
311 |
-
$new_tag = wp_insert_term( $user_tag, '
|
312 |
|
313 |
$newlinktags[] = $new_tag['term_id'];
|
314 |
} else {
|
@@ -318,7 +318,7 @@ function link_library_process_user_submission( $my_link_library_plugin ) {
|
|
318 |
} elseif ( $cat_element == 'new' && empty( $captureddata['link_user_tags'] ) ) {
|
319 |
$message = 24;
|
320 |
} else {
|
321 |
-
$existingtagid = get_term_by( 'id', $tag_element, '
|
322 |
$newlinktags[] = $existingtagid->name;
|
323 |
}
|
324 |
}
|
@@ -377,7 +377,7 @@ function link_library_process_user_submission( $my_link_library_plugin ) {
|
|
377 |
|
378 |
$cattext .= $new_cat_id . '">';
|
379 |
} elseif ( 'HTMLGETSLUG' == $showonecatmode ) {
|
380 |
-
$temp_term = get_term_by( 'id', $new_cat_id, '
|
381 |
$cattext = '<a href="';
|
382 |
|
383 |
if ( !empty( $genoptions['bp_link_page_url'] ) && strpos( $genoptions['bp_link_page_url'], '?' ) != false ) {
|
@@ -390,12 +390,12 @@ function link_library_process_user_submission( $my_link_library_plugin ) {
|
|
390 |
|
391 |
$cattext .= $temp_term->slug . '">';
|
392 |
} elseif ( 'HTMLGETPERM' == $showonecatmode ) {
|
393 |
-
$temp_term = get_term_by( 'id', $new_cat_id, '
|
394 |
$cattext = '<a href="' . $genoptions['bp_link_page_url'] . '/' . $catname->slug . '">';
|
395 |
}
|
396 |
} else if ( $catanchor ) {
|
397 |
if ( !$pagination ) {
|
398 |
-
$temp_term = get_term_by( 'id', $new_cat_id, '
|
399 |
|
400 |
$cattext = '<a href="' . $genoptions['bp_link_page_url'] . '/#' . $temp_term->slug . '">';
|
401 |
}
|
@@ -429,11 +429,11 @@ function link_library_process_user_submission( $my_link_library_plugin ) {
|
|
429 |
if ( !empty( $new_link_ID ) ) {
|
430 |
|
431 |
if ( !empty( $newlinkcat ) ) {
|
432 |
-
wp_set_post_terms( $new_link_ID, $newlinkcat, '
|
433 |
}
|
434 |
|
435 |
if ( !empty( $newlinktags ) ) {
|
436 |
-
wp_set_post_terms( $new_link_ID, $newlinktags, '
|
437 |
}
|
438 |
|
439 |
if ( isset( $_FILES['linkfile'] ) ) {
|
@@ -555,7 +555,7 @@ function link_library_process_user_submission( $my_link_library_plugin ) {
|
|
555 |
|
556 |
if ( !empty( $newlinkcat ) ) {
|
557 |
foreach ( $newlinkcat as $link_cat ) {
|
558 |
-
$existingcat = get_term_by( 'id', $link_cat, '
|
559 |
if ( !empty( $existingcat ) ) {
|
560 |
$link_category_names_array[] = $existingcat->name;
|
561 |
}
|
@@ -571,7 +571,7 @@ function link_library_process_user_submission( $my_link_library_plugin ) {
|
|
571 |
|
572 |
if ( !empty( $newlinktags ) ) {
|
573 |
foreach ( $newlinktags as $link_tag ) {
|
574 |
-
$existingtag = get_term_by( 'id', $link_tag, '
|
575 |
if ( !empty( $existingtag ) ) {
|
576 |
$link_tags_names_array[] = $existingtag->name;
|
577 |
}
|
269 |
foreach ( $captureddata['link_category'] as $cat_element ) {
|
270 |
if ( $cat_element == 'new' && !empty( $captureddata['link_user_category'] ) ) {
|
271 |
|
272 |
+
$existingcat = get_term_by( 'name', $captureddata['link_user_category'], $genoptions['cattaxonomy'] );
|
273 |
|
274 |
if ( empty( $existingcat ) ) {
|
275 |
+
$new_category = wp_insert_term( $captureddata['link_user_category'], $genoptions['cattaxonomy'], array( 'description' => '', 'slug' => sanitize_text_field( $captureddata['link_user_category'] ) ) );
|
276 |
|
277 |
$newlinkcat[] = $new_category['term_id'];
|
278 |
$newlinkcatlist[$new_category['term_id']] = sanitize_text_field( $captureddata['link_user_category'] );
|
287 |
$message = 7;
|
288 |
} else {
|
289 |
$newlinkcat[] = $cat_element;
|
290 |
+
$existingcat = get_term_by( 'id', $cat_element, $genoptions['cattaxonomy'] );
|
291 |
$newlinkcatlist[$existingcat->term_id] = $existingcat->name;
|
292 |
|
293 |
$message = 8;
|
305 |
$user_tag_array = explode( ',', $captureddata['link_user_tags'] );
|
306 |
|
307 |
foreach( $user_tag_array as $user_tag ) {
|
308 |
+
$existingtag = get_term_by( 'name', $user_tag, $genoptions['tagtaxonomy'] );
|
309 |
|
310 |
if ( empty( $existingtag ) ) {
|
311 |
+
$new_tag = wp_insert_term( $user_tag, $genoptions['tagtaxonomy'], array( 'description' => '', 'slug' => sanitize_text_field( $captureddata['link_user_tags'] ) ) );
|
312 |
|
313 |
$newlinktags[] = $new_tag['term_id'];
|
314 |
} else {
|
318 |
} elseif ( $cat_element == 'new' && empty( $captureddata['link_user_tags'] ) ) {
|
319 |
$message = 24;
|
320 |
} else {
|
321 |
+
$existingtagid = get_term_by( 'id', $tag_element, $genoptions['tagtaxonomy'] );
|
322 |
$newlinktags[] = $existingtagid->name;
|
323 |
}
|
324 |
}
|
377 |
|
378 |
$cattext .= $new_cat_id . '">';
|
379 |
} elseif ( 'HTMLGETSLUG' == $showonecatmode ) {
|
380 |
+
$temp_term = get_term_by( 'id', $new_cat_id, $genoptions['cattaxonomy'] );
|
381 |
$cattext = '<a href="';
|
382 |
|
383 |
if ( !empty( $genoptions['bp_link_page_url'] ) && strpos( $genoptions['bp_link_page_url'], '?' ) != false ) {
|
390 |
|
391 |
$cattext .= $temp_term->slug . '">';
|
392 |
} elseif ( 'HTMLGETPERM' == $showonecatmode ) {
|
393 |
+
$temp_term = get_term_by( 'id', $new_cat_id, $genoptions['cattaxonomy'] );
|
394 |
$cattext = '<a href="' . $genoptions['bp_link_page_url'] . '/' . $catname->slug . '">';
|
395 |
}
|
396 |
} else if ( $catanchor ) {
|
397 |
if ( !$pagination ) {
|
398 |
+
$temp_term = get_term_by( 'id', $new_cat_id, $genoptions['cattaxonomy'] );
|
399 |
|
400 |
$cattext = '<a href="' . $genoptions['bp_link_page_url'] . '/#' . $temp_term->slug . '">';
|
401 |
}
|
429 |
if ( !empty( $new_link_ID ) ) {
|
430 |
|
431 |
if ( !empty( $newlinkcat ) ) {
|
432 |
+
wp_set_post_terms( $new_link_ID, $newlinkcat, $genoptions['cattaxonomy'], false );
|
433 |
}
|
434 |
|
435 |
if ( !empty( $newlinktags ) ) {
|
436 |
+
wp_set_post_terms( $new_link_ID, $newlinktags, $genoptions['tagtaxonomy'], false );
|
437 |
}
|
438 |
|
439 |
if ( isset( $_FILES['linkfile'] ) ) {
|
555 |
|
556 |
if ( !empty( $newlinkcat ) ) {
|
557 |
foreach ( $newlinkcat as $link_cat ) {
|
558 |
+
$existingcat = get_term_by( 'id', $link_cat, $genoptions['cattaxonomy'] );
|
559 |
if ( !empty( $existingcat ) ) {
|
560 |
$link_category_names_array[] = $existingcat->name;
|
561 |
}
|
571 |
|
572 |
if ( !empty( $newlinktags ) ) {
|
573 |
foreach ( $newlinktags as $link_tag ) {
|
574 |
+
$existingtag = get_term_by( 'id', $link_tag, $genoptions['tagtaxonomy'] );
|
575 |
if ( !empty( $existingtag ) ) {
|
576 |
$link_tags_names_array[] = $existingtag->name;
|
577 |
}
|