56 Commits

Author SHA1 Message Date
jarebear6expepjozn6rakjq5iczi3irqwphcvbswgkahd6b6twnxxid
8e57e1a30a
Use sandbox for all included files (#3478)
- updated calls to functions
- deprecate function yourls_activate_plugin_sandbox()
- add unit tests
- log loaded files
- tweak yourls_debug_log to allow early uses

Co-authored-by: e-ht <1045813+e-ht@users.noreply.github>
Co-authored-by: eht <1045813+e-ht@users.noreply.github.com>
Co-authored-by: ྅༻ Ǭɀħ ༄༆ཉ <ozh@ozh.org>

Closes #3321
2023-02-12 13:31:46 +01:00
྅༻ Ǭɀħ ༄༆ཉ
6da30dfab0
Add missing inline documentation (#3325) 2022-05-05 21:36:13 +02:00
྅༻ Ǭɀħ ༄༆ཉ
9def41dba8
Remove warnings on PHP 8.1 (#3317)
Also, minor code styles doc & typo
* Refactor yourls_filter_unique_id() to remove useless vars
* Comply with phpstan level 4
* add some tests to cover newly discovered potential issues
2022-05-02 08:09:18 +02:00
྅༻ Ǭɀħ ༄༆ཉ
ead7397c76
Promote docs.yourls.org (#3291) 2022-04-19 17:51:57 +02:00
྅༻ Ǭɀħ ༄༆ཉ
7067e9412b
More plugin functions (#3281)
Introduce yourls_get_actions() and yourls_get_filters(), and their tests
2022-04-12 14:50:59 +02:00
྅༻ Ǭɀħ ༄༆ཉ
5deeec7edb
Plugin API : sandbox and uninstall procedure (#3258)
- foolproof (?) activation sandbox that actually works
- uninstall method
- Plugin activation sandbox and unit tests
- Uninstall script and tests
2022-04-03 21:59:35 +02:00
྅༻ Ǭɀħ ༄༆ཉ
57fe8f23ea
Support for 'all' hook (#2860)
* Improve inline doc & comments
* Introduce support for the 'all' hook
* Unit test nitpicking
2021-03-06 11:53:50 +01:00
྅༻ Ǭɀħ ༄༆ཉ
fb1415027c
Replace call_user_func() with variable functions (#2763)
Fixes #2714
2020-10-11 19:57:35 +02:00
྅༻ Ǭɀħ ༄༆ཉ
347971f25d
Remove global $ydb calls and prefer helper function (#2762)
Fixes #2698

Changes : 
- Replace all global $ydb; and $ydb->... with yourls_get_db()-> in code and tests
- Add tests
- Introduce yourls_set_db()
2020-10-11 19:02:15 +02:00
྅༻ Ǭɀħ ༄༆ཉ
04495e8b17
Sanitize plugin file header before display (#2761)
Avoid improbable case such as:

/**
 * Plugin Name: anything"><img src=x onerror=prompt("name")>
 * Plugin URI: anything"><img src=x onerror=prompt("")>
 * Description: anything"><img src=x onerror=prompt("desc")>
 * Version: anything"><img src=x onerror=prompt('version')>
 * Author: anything"><img src=x onerror=prompt('author')>
 * Author URI: anything"><img src=x onerror=prompt("desc")>
 */
2020-10-11 13:37:44 +02:00
hdkjjsk612
78a7e226b5
Correcting minor typo 2020-05-24 23:53:58 +09:00
Ozh
c2cc75c835
More flexible plugin headers, and tests 2020-05-24 12:31:41 +02:00
Paul Goodchild
19da8de9ec
Begin functions cleaning, starting with GEO. (#2670)
* cleanup geo functions
* add support for CloudFlare's Country GEO header without the need for IP resolution and database
* ensure flag URL always returns a string, instead of false on failure as the result is always used as a string (without validation)
* add helper yours_get_db() so we don't need to use "global $ydb" throughout and it ensures that ydb is always initialised correctly and hasn't ever been changed to something incompatible.
* simplify debug get log
* tidy up code and phpdocs for functions-plugins
* cleanup & phpdocs for parts of functions.php
Co-authored-by: ྅༻ Ǭɀħ ༄༆ཉ <ozh@ozh.org>
2020-05-06 16:24:52 +02:00
྅༻ Ǭɀħ ༄༆ཉ
fd4b927808
Split functions.php in smaller files
New function files for:
* debug
* options
* links
* geo
* shorturls
Fixes #2654

* Regroup and always load auth functions
Fixes #2662
Fixes #2661 

Co-authored-by: paulgoodchild <paulgoodchild@users.noreply.github.com>
2020-05-01 12:05:15 +02:00
྅༻ Ǭɀħ ༄༆ཉ
84c48cd58a
Make tests independent from each others
This merge commit is about testing the plugin API with a dummy plugin, not a real one that will affect YOURLS behavior.

- Provide dummy plugin to test the API
- Simplify logic of tests in NextDecimal_Tests to only test what is supposed to be tested.
- Enhance documentation comments
- Cleanup after tests
- Specific error message if misconfig
- Unit test debug functions

Co-authored-by: Léo Colombaro <git@colombaro.fr>
2020-03-31 18:00:05 +02:00
ozh
e1cc70d4be More checks before loading plugins.
(Will help boot process of unit tests)
2017-09-13 22:33:50 +02:00
ozh
a22c1c30eb Backward compatibility finished.
As of now, all unit tests (some slightly rewritten) pass.
Now, onto rewriting queries

[skip ci]
2017-08-28 21:08:21 +02:00
ozh
499b296a6f Logger object & ezSQL get_row() compat
[skip ci]
2017-08-21 15:19:55 +02:00
ozh
21e857cfa0 Plugins
I think in the end we could have a couple nice objects (Plugins/API.php, Plugins/Files.php and Plugins/Pages.php) to take all the complex logic out of functions-plugins.php

[skip ci]
2017-08-20 17:57:19 +02:00
ozh
d295898f4e Code coverage syntax nitpicking
functions-plugins.php not at 99.10%, 221 lines out of 223, covered :)
2015-05-11 20:03:43 +02:00
ozh
0071965c12 Add yourls_remove_all_(filters|actions) 2015-05-11 11:50:01 +02:00
ozh
f3bc0bd336 Get die() ouf of yourls_plugin_admin_page()
This will make testing this function a lot easier, and it makes more sense to die after the function call, not within it.

[skip ci]
2015-05-11 10:28:17 +02:00
ozh
faabf0edb4 Improve global declarations 2015-05-11 09:42:01 +02:00
ozh
5c34bc4b83 Simpler syntax 2015-05-07 21:48:09 +02:00
ozh
f678cd5887 Remove unnecessary function_exists()
spl_object_hash() is PHP 5.2+
2015-05-06 22:07:26 +02:00
ozh
28693f801d Close output buffer. Should fix UT on Travis. 2014-11-03 23:46:54 +01:00
ozh
37f54c7922 Allow hooks with anonymous closures. See #1800. 2014-11-02 09:51:08 +01:00
ozh
88a7fe28fe Deprecate yourls_apply_filters (plural). Fixes #1671. 2014-10-26 16:34:41 +01:00
ozh
ff6f22f6c3 Avoid notices with incomplete plugin headers 2014-05-06 11:29:21 +02:00
LeoColomb
546057fc5a Include once to avoid duplication 2013-09-07 17:49:56 +02:00
ozh
85f6840768 Avoid checking an empty array when loading plugins 2013-09-02 16:44:41 +02:00
ozh
550c829c1e Don't load plugins when installing/upgrading 2013-05-04 23:50:09 +02:00
ozh
da12eb6fe8 Typos and unused variables. Good job, PhpStorm! 2013-05-03 17:48:23 +02:00
LeoColomb
3daf6593d8 Fix end of line 2013-04-07 12:52:52 +02:00
Ozh
69852a0574 Fix: incorrect error message.
git-svn-id: http://yourls.googlecode.com/svn/trunk@893 12232710-3e20-11de-b438-597f59cd7555
2013-03-18 21:38:52 +00:00
Ozh
7f609b30d2 Translation leftovers. Now that's it. Honestly.
git-svn-id: http://yourls.googlecode.com/svn/trunk@872 12232710-3e20-11de-b438-597f59cd7555
2013-02-10 21:23:57 +00:00
Ozh
ee25057169 Aaaaaand more translation readyness.
git-svn-id: http://yourls.googlecode.com/svn/trunk@868 12232710-3e20-11de-b438-597f59cd7555
2013-02-10 13:52:00 +00:00
Ozh
bc9e544b97 Plugin management page: now properly sorted by name.
git-svn-id: http://yourls.googlecode.com/svn/trunk@833 12232710-3e20-11de-b438-597f59cd7555
2013-01-09 10:07:26 +00:00
Ozh
8c808f55bb Alias: yourls_apply_filters()
git-svn-id: http://yourls.googlecode.com/svn/trunk@810 12232710-3e20-11de-b438-597f59cd7555
2012-12-09 15:37:42 +00:00
Ozh
59fff1242a Less constants, more functions. Fixes issue 1232.
git-svn-id: http://yourls.googlecode.com/svn/trunk@803 12232710-3e20-11de-b438-597f59cd7555
2012-11-21 11:23:35 +00:00
ozhozh
465a2b6468 Add function yourls_did_action()
git-svn-id: http://yourls.googlecode.com/svn/trunk@775 12232710-3e20-11de-b438-597f59cd7555
2012-10-14 15:10:49 +00:00
ozhozh
9fbb4595af Whitespaces, bitches!! Because, you know, CodingStandards.
git-svn-id: http://yourls.googlecode.com/svn/trunk@743 12232710-3e20-11de-b438-597f59cd7555
2012-08-20 19:24:31 +00:00
ozhozh
52aaca6799 Don't modify/return values passed by actions.
git-svn-id: http://yourls.googlecode.com/svn/trunk@696 12232710-3e20-11de-b438-597f59cd7555
2011-09-19 19:02:03 +00:00
ozhozh
87641ae03a Fully filterable admin menu links. Mucho mas cleano.
git-svn-id: http://yourls.googlecode.com/svn/trunk@691 12232710-3e20-11de-b438-597f59cd7555
2011-09-15 21:55:51 +00:00
ozhozh
50891113fb Looser pattern matching for plugin header
git-svn-id: http://yourls.googlecode.com/svn/trunk@654 12232710-3e20-11de-b438-597f59cd7555
2011-06-24 19:55:50 +00:00
ozhozh
f233ecc1d0 Enforce space after semicolon in plugin header data (ie "Something: Some text") (avoid parsing 'http://' for instance)
git-svn-id: http://yourls.googlecode.com/svn/trunk@608 12232710-3e20-11de-b438-597f59cd7555
2011-04-23 17:29:33 +00:00
ozhozh
f48c6452cc New function: yourls_plugin_url()
git-svn-id: http://yourls.googlecode.com/svn/trunk@525 12232710-3e20-11de-b438-597f59cd7555
2010-11-06 21:27:26 +00:00
ozhozh
732d7668c1 Added functions to register and draw plugin admin pages. Uber cool.
git-svn-id: http://yourls.googlecode.com/svn/trunk@449 12232710-3e20-11de-b438-597f59cd7555
2010-07-01 20:44:39 +00:00
ozhozh
e3d0e0cc97 Update active plugin list if one is missing upon activation
git-svn-id: http://yourls.googlecode.com/svn/trunk@367 12232710-3e20-11de-b438-597f59cd7555
2010-05-28 15:14:26 +00:00
ozhozh
3b14c167be Plugin API & management update: active plugins stored in DB, (de)activation within interface
git-svn-id: http://yourls.googlecode.com/svn/trunk@361 12232710-3e20-11de-b438-597f59cd7555
2010-05-27 17:13:33 +00:00