Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#637 2014-12-24 08:12:33

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: gbp_permanent_links

Els wrote #286807:

I’m not sure you need the second rule. I’ve used the first rule in the past without needing the second one. You could try if deleting the second rule helps.

And there is a setting in the plugin preferences that lets you omit the trailing slash.

well. it does need that. I tried a fresh txp installation – and it works ok! I am not sure, may be the secton I need with that link pattern should be made frontpage or default??? hard to say, i have to see.

Offline

#638 2015-06-25 12:25:46

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: gbp_permanent_links

CAUTION:

CHANGING PREFERENCES (actually: simply saving these) SEEMS TO DELETE ALL YOUR RULES!

The only way around this seems to first set prefs, and then build the rules. If you succeeded any other way or have patched the plugin: Please post!

Sorry, will surely be something on my side that I’ve yet to find out: Even leaving gbp_pl and returning deletes all the rules. (Are they saved at all? Hrrm.)

Last edited by uli (2015-06-25 12:43:10)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#639 2015-06-25 13:24:06

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: gbp_permanent_links

OK, I set up a brandnew DB. Now, only gbp_pl + lib installed on TXP 4.5.7 (Diagnostics: “All checks passed!”), produces this while skipping from gbp_pl tab to ~ tab:

A problem occurred while loading the plugin: gbp_permanent_links -> Notice: unserialize(): Error at offset 5 of 910 bytes on line 177

A problem occurred while loading the plugin: gbp_permanent_links -> Notice: unserialize(): Error at offset 5 of 903 bytes on line 177

The only occurrence of unserialize here in this topic has to do with using a regex which I’m not doing. Have I missed something stupid? Doesn’t it work any longer on MAMP?

Just for completeness’ sake: I still can’t save any rule, like on my previous setup/DB/installation, but I’m getting the errors that I didn’t have on my previous setup.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#640 2015-08-04 19:59:11

miles
Member
From: Plymouth
Registered: 2008-05-22
Posts: 78
Website

Re: gbp_permanent_links

Does this plugin no longer work on 4.5.7? As I can’t get any rules to save? It says its saved but doesn’t show up in the list

Offline

#641 2015-08-04 20:18:32

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: gbp_permanent_links

miles wrote #293949:

Does this plugin no longer work on 4.5.7? As I can’t get any rules to save? It says its saved but doesn’t show up in the list

Not quite sure which version broke the plugin (for me, too), see my two previous posts, I don’t even succeed in installing it when it’s a brand new database. So I’d say you must be on an updated version of TXP.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#642 2015-09-17 07:20:45

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

Re: gbp_permanent_links

is there working alternative for this plugin? cause it looks like it doesn’t work on 4.5.7 anymore….

Offline

#643 2016-02-23 15:34:42

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: gbp_permanent_links

uli wrote #292071:

A problem occurred while loading the plugin: gbp_permanent_links -> Notice: unserialize(): Error at offset 5 of 910 bytes on line 177...

The only occurrence of unserialize here in this topic has to do with using a regex which I’m not doing. Have I missed something stupid? Doesn’t it work any longer on MAMP?

I have been trying to get this to work with a recent version. When you use the Build option, you can create a new rule and it claims that it is successfully saved, but it never does.

I suspect the problem lies in here:

function post_save_permlink () {
		// The function posts or saves a permanent link to txp_prefs

		extract(gpsa(array('step', gbp_id)));

		// Grab the user defined settings from the form POST data
		$settings = gpsa(array(
			'pl_name', 'pl_precedence', 'pl_preview',
			'con_section', 'con_category',
			'des_section', 'des_category', 'des_page',
			'des_permlink', 'des_feed', 'des_location',
		));

		// Remove spaces from the permanent link preview
		$settings['pl_preview'] = preg_replace('%\s+/\s*%', '/', $settings['pl_preview']);

		// Explode the separated string of serialize components - this was made by JavaScript.
		$serialize_components = explode(gbp_separator, rtrim(gps('components'), gbp_separator));

		// Unserialize the components
		$components = array();
		foreach ($serialize_components as $c)
			$components[] = unserialize(stripslashes($c));

		// Complete the permanent link array - this is exactly what needs to be stored in the db
		$permlink = array('settings' => $settings, 'components' => $components);

		// Save it
		$this->set_preference($id, $permlink, 'gbp_serialized');

		$this->parent->message = messenger('', $settings['pl_name'], 'saved');
	}

Any PHP Gurus notice anything that stands out?

Offline

#644 2016-06-22 12:31:39

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: gbp_permanent_links

  • Txp 4.6 beta
  • mysql 5.7.13
  • php 7.0.7

I know we’re going to need to rethink our publishing build on this, but at CSF we’ve borrowed the /people section architecture that Bloke designed in the TXP Mag site to handle site contributors/profile pages, etc, which uses some gbp mechanics. Ideally we’ll want to drop use of gbp plugins entirely, but in the meantime…

I’ve just updated the CSF site on local (different from the one’s I’ve updated and wrangled the last couple of days). I didn’t get any errors in the Languages panel, as I was seeing before, but the front-side was not displaying any article content. The layout and presentation was intact, but no content.

Throwing into debug mode gave me these errors:

A problem occurred while loading the plugin: gbp_admin_library -> 8192: Methods with the same name as their class will not be constructors in a future version of PHP; GBPPlugin has a deprecated constructor on line 6
textpattern/lib/txplib_misc.php:1369 eval()
textpattern/lib/txplib_misc.php:1391 load_plugin()
textpattern/lib/txplib_misc.php(1783) : eval()'d code:9 require_plugin()
textpattern/lib/txplib_misc.php:1783 eval()
textpattern/publish.php:169 load_plugins()
index.php:104 include()

General error Notice: Undefined index: permalink_title_format on line 276
textpattern/lib/txplib_misc.php:1896 PermanentLinks->_textpattern()
textpattern/publish.php:545 callback_event()
index.php:105 textpattern()

General error Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead on line 284
textpattern/lib/txplib_misc.php(1783) : eval()'d code:284 preg_replace()
textpattern/lib/txplib_misc.php:1896 PermanentLinks->_textpattern()
textpattern/publish.php:545 callback_event()
index.php:105 textpattern()

Oi!

Offline

#645 2016-06-22 14:17:32

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: gbp_permanent_links

First Error:

Plugin Code

class GBPPlugin {
	// Redacted
        :

	// Constructor
	function GBPPlugin ($title = '', $event = '', $parent_tab = '')

Cause

PHP 4 style constructors (methods that have the same name as the class they are defined in) are deprecated, and will be removed in the future. PHP 7 will emit E_DEPRECATED if a PHP 4 constructor is the only constructor defined within a class. Classes that implement a __construct() method are unaffected. – Deprecated features in PHP 7.0.x

Second Error:

Plugin Code

						if ($prefs['permalink_title_format']) {
							$mt_search = array('/_/', '/\.html$/');
							$mt_replace = array('-', '');
						} else {
							$mt_search = array('/(?:^|_)(.)/e', '/\.html$/');
							$mt_replace = array("strtoupper('\\1')", '');
						}

Cause

Relying on the default value of an uninitialized variable is problematic in the case of including one file into another which uses the same variable name. It is also a major security risk with register_globals turned on. E_NOTICE level error is issued in case of working with uninitialized variables, however not in the case of appending elements to the uninitialized array. isset() language construct can be used to detect if a variable has been already initialized. – PHP: Notice: undefined index

Third Error (multiple locations)

	$settings['pl_preview'] = preg_replace('%\s+/\s*%', '/', $settings['pl_preview']);

	$req = preg_replace('%\?[^\/]+$%', '', $req);

	? preg_replace($mt_search, $mt_replace, $uri_c)

Cause

As of PHP 5.5 the preg_replace modifier /e is deprecated. When using it, you will get an deprecated message like E_DEPRECATED >> preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead. The update is quite easy.- Replace preg_replace with preg_replace_callback for PHP 5.5

Interestingly, there is also one occurrence of preg_replace_callback in the plugin code already.

Edit: Now that I read up on this more none of those are using the /e modifier. So I don’t get what is triggering this.

		$html = preg_replace_callback(
			'%href="('.hu.'|\?)([^"]*)"%',
			array(&$this, '_pagelinkurl'),
			$html
		);

Last edited by michaelkpate (2016-06-22 14:21:09)

Offline

#646 2016-07-23 14:40:27

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 234
Website GitHub Mastodon

Re: gbp_permanent_links

Regarding the problem of :
E_DEPRECATED >> preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead.

This is a ugly work-around for those needing it. No time to dive into the whole plugin reasonning.
Around the line 276

            //
            if ($prefs['permlink_format']) {
              $mt_search = array('/_/', '/\.html$/');
              $mt_replace = array('-', '');
              $mt_uri_c = $this->pref('redirect_mt_style_links')
                ? preg_replace($mt_search, $mt_replace, $uri_c)
                : '';
            } else {
              $mt_search = array('/(?:^|_)(.)/', '/\.html$/');
              $mt_replace = array("strtoupper('\\1')", '');
              $mt_uri_c = $this->pref('redirect_mt_style_links')
                ? preg_replace_callback(
                    $mt_search, 
                    function($matches) { return strtoupper($matches[1]); },
                    $uri_c)
                : '';
            }

Edited to reflect new pref : permlink_format in replacement of permalink_title_format

Last edited by planeth (2016-07-23 15:16:05)

Offline

#647 2016-10-13 13:20:40

beechy
Member
Registered: 2006-03-02
Posts: 92

Re: gbp_permanent_links

Has anyone managed to get gbp_permanent_links working with textpattern 4.6.1 yet without any errors?

I looking to upgrade my textpattern install but currently rely on gbp_permanent_links for quite a few sections of my site.

Offline

#648 2016-11-02 19:47:31

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 637
Website

Re: gbp_permanent_links

Hi, I’m also wish this plugin will work again so I will not need to downgrade the TXP just for that please.
If it require a lot of time and work then please do contact me and name a price :) and then of course publish it for everyone too.
I personally only need to allow URLs with en/ plain-text part at the beginning, then I’m using PHP to detect if there’s en/ and create a variable with it.
I don’t need to make the permlink tag to work as I’m building my own URLs, just to allow TXP to accept a plain-text in the beginning of URLs which in my case as I mentioned before is en/, for example:

example.com/en
example.com/en/section
example.com/en/section/id

Offline

Board footer

Powered by FluxBB