Plugin Directory

Changeset 2936577


Ignore:
Timestamp:
07/10/2023 02:13:48 PM (3 years ago)
Author:
deano1987
Message:

2.1.0

  • PHP 8 compatibility
  • Added ability to remove final crumb from display
Location:
schema-breadcrumbs
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • schema-breadcrumbs/trunk/readme.txt

    r2859044 r2936577  
    55Requires at least: 2.2
    66Tested up to: 6.1
    7 stable tag: 2.00
     7stable tag: 2.1.0
    88
    99Very easily add breadcrumbs to your site with valid Schema Breadcrumb Markup, this plugin is also a drop-in replacement for RDFa Breadcrumb, just install this and deactivate RDFa Breadcrumb.
     
    3535
    3636== Changelog ==
     37
     38= 2.1.0 =
     39* PHP 8 compatibility
     40* Added ability to remove final crumb from display
    3741
    3842= 2.0.0 =
  • schema-breadcrumbs/trunk/schema-breadcrumbs.php

    r2859068 r2936577  
    33Plugin URI:   http://webdesires.co.uk
    44Description:  Outputs a fully Schema valid breadcrumb
    5 Version:      2.0.0
     5Version:      2.1.0
    66Author:       Dean Williams
    77Author URI:   http://deano.me
     
    2828$opt['boldlast']            = true;
    2929$opt['blogparent']          = true;
     30$opt['removefinal']             = false;
    3031$opt['nofollowhome']        = false;
    3132$opt['nofollowcurrent']         = false;
     
    6364                }
    6465
    65                 foreach (array('boldlast', 'blogparent', 'nofollowhome', 'nofollowcurrent', 'singlecatprefix', 'trytheme') as $option_name) {
     66                foreach (array('boldlast', 'blogparent', 'removefinal', 'nofollowhome', 'nofollowcurrent', 'singlecatprefix', 'trytheme') as $option_name) {
    6667                    if (isset($_POST[$option_name])) {
    6768                        $opt[$option_name] = true;
     
    160161                                    "desc" => __('Enable/Disable the Blog crumb in the breadcrumb'),
    161162                                    "content" => '<input type="checkbox" name="blogparent" id="blogparent" '.checked($opt['blogparent'],true,false).'/>',
     163                                );
     164                                $rows[] = array(
     165                                    "id" => "removefinal",
     166                                    "label" => __('Remove Final Crumb'),
     167                                    "desc" => __('Remove the final crumb in the breadcrumb, ie the page you are on.'),
     168                                    "content" => '<input type="checkbox" name="removefinal" id="removefinal" '.checked($opt['removefinal'],true,false).'/>',
    162169                                );
    163170                                $rows[] = array(
     
    278285                        "@id": "'.$actual_link.'",
    279286                            "url": "'.$actual_link.'",
    280                         "name": "'.addslashes($input).'"
     287                        "name": "'.str_replace('"', '', $input).'"
    281288                        }
    282289                      }';
     
    337344                        "@id": "'.$dat['link'].'",
    338345                            "url": "'.$dat['link'].'",
    339                         "name": "'.$dat['name'].'"
     346                        "name": "'.str_replace('"', '', $dat['name']).'"
    340347                        }
    341348                    }';
     
    383390                "@id": "'.get_permalink(get_option('page_on_front')).'",
    384391                    "url": "'.get_permalink(get_option('page_on_front')).'",
    385                 "name": "'.addslashes($opt['home']).'"
     392                "name": "'.str_replace('"', '', $opt['home']).'"
    386393                }
    387394              }';
     
    454461                        "@id": "'.$page_url.'",
    455462                            "url": "'.$page_url.'",
    456                         "name": "'.addslashes($page_name).'"
     463                        "name": "'.str_replace('"', '', $page_name).'"
    457464                        }
    458465                      }';
     
    490497                        "@id": "'.get_bloginfo('url').'",
    491498                            "url": "'.get_bloginfo('url').'",
    492                         "name": "'.addslashes($opt['home']).'"
     499                        "name": "'.str_replace('"', '', $opt['home']).'"
    493500                        }
    494501                      }';
     
    496503            $bloglink[] = $homelink;
    497504        }
    498         if(count($link) > 4){
     505        //if(count($link) > 4){
    499506            //print_r($bloglink);
    500507            //print_r($homelink);
    501         }
     508        //}
    502509
    503510        if ( ($on_front == "page" && is_front_page()) || ($on_front == "posts" && is_home()) ) {
     
    559566                            "@id": "'.get_term_link($category->slug, $obj->taxonomies[0]).'",
    560567                            "url": "'.get_term_link($category->slug, $obj->taxonomies[0]).'",
    561                             "name": "'.addslashes($category->name).'"
     568                            "name": "'.str_replace('"', '', $category->name).'"
    562569                            }
    563570                          }';
     
    568575
    569576                if ($customtax === false) {
    570                     if (is_single() && count(get_the_category()) > 1) {
     577                    if (is_single() && is_array(get_the_category()) && count(get_the_category()) > 1) {
    571578                        if ($opt['showsinglecategoryifmultiple'] === true) {
    572579                            $cats = get_the_category();
     
    623630                                "@id": "'.get_category_link($cat->term_id).'",
    624631                                    "url": "'.get_category_link($cat->term_id).'",
    625                                 "name": "'.addslashes($cat->name).'"
     632                                "name": "'.str_replace('"', '', $cat->name).'"
    626633                                }
    627634                              }';
     
    635642                                "@id": "'.get_category_link($cat->term_id).'",
    636643                                    "url": "'.get_category_link($cat->term_id).'",
    637                                 "name": "'.addslashes($cat->name).'"
     644                                "name": "'.str_replace('"', '', $cat->name).'"
    638645                                }
    639646                              }';
     
    677684                             "@id": "'.$ancestor_link.'",
    678685                                 "url": "'.$ancestor_link.'",
    679                              "name": "'.addslashes($ancestor_term->name).'"
     686                             "name": "'.str_replace('"', '', $ancestor_term->name).'"
    680687                             }
    681688                           }';
     
    697704                            "@id": "'.$descendant_link.'",
    698705                                "url": "'.$descendant_link.'",
    699                             "name": "'.addslashes($descendant->name).'"
     706                            "name": "'.str_replace('"', '', $descendant->name).'"
    700707                            }
    701708                        }';
     
    718725                            "@id": "'.$actual_link.'",
    719726                                "url": "'.$actual_link.'",
    720                             "name": "'.addslashes(woocommerce_page_title( false )).'"
     727                            "name": "'.str_replace('"', '', woocommerce_page_title( false )).'"
    721728                            }
    722729                        }';
     
    809816                        "@id": "'.$linker.$link['url'].'",
    810817                            "url": "'.$linker.$link['url'].'",
    811                         "name": "'.addslashes($link['title']).'"
     818                        "name": "'.str_replace('"', '', $link['title']).'"
    812819                        }
    813820                      }';
     
    824831
    825832        $html = '';
     833
     834        if ($opt['removefinal'] === true) {
     835            array_pop($output);
     836        }
    826837
    827838        foreach ($output as $key => $out) {
     
    854865                                "@id": "'.$actual_link.'",
    855866                                    "url": "'.$actual_link.'",
    856                                 "name": "'.get_the_title().'"
     867                                "name": "'.str_replace('"', '', get_the_title()).'"
    857868                                }
    858869                            }';
Note: See TracChangeset for help on using the changeset viewer.