GithubHelp home page GithubHelp logo

bloke / smd_tags Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 5.0 479 KB

A Textpattern CMS plugin for unlimited, structured taxonomy across content types.

License: GNU General Public License v2.0

PHP 100.00%
textpattern textpattern-plugin

smd_tags's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

smd_tags's Issues

Add support for inline help

The field labels on the admin panel(s) need to be rendered correctly so they can be hooked into _instruction lang strings.

if_first and if_last of type not recognised

When passing smd_related_tags to a form like this:

<txp:smd_related_tags section="news" type="article" wraptag="" break="" form="detail_listitem" />

… the if_first_article and if_last_article containers in the linked form are not processed.

Home diagnosis

As far as I can tell, this is because the {content-type}['is_first'] and {content-type}['is_last'] array keys are not set by the plugin like they are in txplib_publish.php, and these are the triggers for the if_first / if_last functions.

Replicating the same pattern in the smd_related_tags function of the plugin seems to produce the desired result for articles, e.g. adding a counter and setting the array keys in this code block. The function already saves the total matches in $contentCount.

$itemCount = 0;

foreach ($rs as $row) {
    if (!in_array($row['ID'], $uniqrs)) {
        $itemCount++;
        $safe = ($thisarticle) ? $thisarticle : NULL;
        $thisarticle['is_first'] = ($itemCount == 1);
        $thisarticle['is_last'] = ($itemCount == $contentCount);
        populateArticleData($row);
        $row['Title'] = ($no_widow) ? noWidow(escape_title($row['Title'])) : escape_title($row['Title']);
        $out[] = ($form) ? parse_form($form) : (($thing) ? parse($thing) : href($row['Title'], permlinkurl($row)));
        $uniqrs[] = $row['ID'];
        $thisarticle = $safe;

    }
}

Analog for the cases “image”, “file” and “link”.

Is that all it needs?

each() deprecated in php 7.2

I get the following tag error notice on php 7.2:

Tag error: <txp:smd_tag_list parent='<txp:variable name="tag_language" />' wraptag="" break="">
<li><a href="<txp:site_url /><txp:variable name="tag_language" />/<txp:if_variable name="tag_language" value="referenzen">thema<txp:else/>topic</txp:if_variable>/<txp:smd_tag_name title="0" link="0" />"><txp:smd_tag_name title="1" link="0" /></a></li></txp:smd_tag_list> -> 8192: The each() function is deprecated. This message will be suppressed on further calls while parsing form reference_list_item on page references

I think it's referring to this line.

Might changing:

while (list($key, $row) = each($rs)) {

to:

foreach ($rs as $key => $row) {

resolve the error?

Auto name removes characters with accents

At the moment if 'auto name' is enabled and you enter a tag name with an accent the accented character will be removed from the generated name. This is a little annoying, as you have to go and add the unaccented version of the character yourself. This behaviour also feels inconsistent with the rest of Textpattern, for example the automatically generated 'URL-only title' replaces accented characters with their non-accented equivalent by itself.

This isn't a bug, but it would be a nice enhancement.

(I guess some people might want an 'ü' to convert to 'ue' instead 'u' (etc.), but I think just a simple replacement would be most useful.)

@ error suppression operator no longer silences potential empty buffer in PHP8

With PHP8 one encounters a ob_end_clean(): failed to delete buffer. No buffer to delete error message on the manage tags pane.

The message refers to line 3044 which has an @-error suppression operator in front of ob_end_clean(). There are two further instances at lines 3116 and 3137.

Might this be a suitable replacement?

if(ob_get_length() > 0) {
    while(ob_end_clean()); // Get rid of any page so far
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.