MyBB Community Forums

Full Version: PluginLibrary 13
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
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
phptpl.php is not PluginLibrary. PluginLibrary does not use /e modifier anywhere.
Bumped version today, just a minor PHP 7 compatibility change that's been sitting in my GitHub for a while.
@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
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
(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
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);
(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.
(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
all plugin are great 

 xml_export() and xml_import() both plugins are very useful 
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16