PluginLibrary 13
Tis is not working with php 7 i get a blank page on mybb and a error on error log

File: inc/plugins/phptpl.php (Line no. 92)
Message
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
Reply
This user has been denied support. This user has been denied support.
phptpl.php is not PluginLibrary. PluginLibrary does not use /e modifier anywhere.
Reply
This user has been denied support. This user has been denied support.
Bumped version today, just a minor PHP 7 compatibility change that's been sitting in my GitHub for a while.
Reply
@frostschutz Thank You for the plugins Library 13

Today download the plugin to install and have some questions:

1. When Install Hello PluginLibrary! its ok and  displays the message on all pages.
2. When Install PluginLibrary 13 the plugin still in Inactive Plugins,   ...so it is not installed?  or it was installed correctly?   Lightbulb
[Image: Captura-de-pantalla-2019-11-04-a-la-s-11-08-36-p-m.png]

Thanks in Advance for the Support!

bye
Reply
Hello plugin is like mybb hello plugin to only show how it work with a simple sample.

And plugin library is an extension only to use into your plugins to make it easy for developer to write it.

This extension is not necessary to install or anything only you need to put into your plugins dir and that's all the library should work and you can use those functions to add some plugin items easily Smile
The only infinite thing is the universe and human stupidity, but the universe is not for sure

Plugins 1.6.x

Plugins 1.8.x

Reply
(2019-11-05, 05:57 AM)Whiteneo Wrote: Hello plugin is like mybb hello plugin to only show how it work with a simple sample.

And plugin library is an extension only to use into your plugins to make it easy for developer to write it.

This extension is not necessary to install or anything only you need to put into your plugins dir and that's all the library should work and you can use those functions to add some plugin items easily Smile

Now understand... thank you so much @Whiteneo for the Support.

thanks  Big Grin
Reply
can the edit_core edit a same file twice?

i tried

	$PL->edit_core('test', 'showthread.php', array('search' => '$query = $db->query("
            SELECT p.username, p.uid, p.pid, p.replyto, p.subject, p.dateline
            FROM ".TABLE_PREFIX."posts p
            WHERE p.tid=\'$tid\'
            $visible
            ORDER BY p.dateline
        ");', 'replace' => '$query = $db->query("SELECT p.username, p.uid, p.pid, p.replyto, p.subject, p.dateline, p.optanon_posted FROM ".TABLE_PREFIX."posts p WHERE p.tid=\'$tid\' $visible ORDER BY p.dateline");'),true);
		
	$PL->edit_core('test', 'showthread.php', array('search' => 'htmlspecialchars_uni($post[\'username\'])',
                     'before' => 'if($post[\'optanon_posted\']) {$post[\'username\'] = \'Anonymoose\';}'),true);

but it only edit one but not the other

figured it out

$PL->edit_core('test', 'showthread.php', [['search' => '$query = $db->query("
            SELECT p.username, p.uid, p.pid, p.replyto, p.subject, p.dateline
            FROM ".TABLE_PREFIX."posts p
            WHERE p.tid=\'$tid\'
            $visible
            ORDER BY p.dateline
        ");', 'replace' => '$query = $db->query("SELECT p.username, p.uid, p.pid, p.replyto, p.subject, p.dateline, p.optanon_posted FROM ".TABLE_PREFIX."posts p WHERE p.tid=\'$tid\' $visible ORDER BY p.dateline");'],['search' => 'htmlspecialchars_uni($post[\'username\'])',

                    'before' => 'if($post[\'optanon_posted\']) {$post[\'username\'] = \'Anonymoose\';$post[\'uid\']=0;}']],true);
Reply
This user has been denied support. This user has been denied support.
(2020-05-23, 04:10 PM)8guawong Wrote: can the edit_core edit a same file twice?

You can specify multiple edits in a single call by simply adding more array entries with edit specifications.

Example in my Google SEO plugin: https://github.com/frostschutz/MyBB-Goog...1161-L1362

You can also do separate calls but then you'd have to use a different prefix for each edit, and make a call for each prefix when reverting individually.

What happens in your code is it does the first edit, then it undoes the first edit and does the second edit. This happens because this function is for both making as well as reverting edits, rolled into one.

That's assuming your search string matches. Including that much whitespace in the search pattern may be prone to errors. You're welcome to use a more concise pattern.
Reply
(2020-05-23, 04:56 PM)frostschutz Wrote:
(2020-05-23, 04:10 PM)8guawong Wrote: can the edit_core edit a same file twice?

You can specify multiple edits in a single call by simply adding more array entries with edit specifications.

Example in my Google SEO plugin: https://github.com/frostschutz/MyBB-Goog...1161-L1362

You can also do separate calls but then you'd have to use a different prefix for each edit, and make a call for each prefix when reverting individually.

What happens in your code is it does the first edit, then it undoes the first edit and does the second edit. This happens because this function is for both making as well as reverting edits, rolled into one.

That's assuming your search string matches. Including that much whitespace in the search pattern may be prone to errors. You're welcome to use a more concise pattern.

thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)