•Component Name: Speedtest
•ID: speedtest
•Menu Name: OpenSpeedTest
•Author: TheDoggyBrad
•Description: Offer speedtest to your users, powered by OpenSpeedTest
•License: OSSN License v4
•Author URL: https://github.com/thedoggybrad/
•License URL: https://www.opensource-socialnetwork.org/licence/v4.0.html
•Latest Version: 1.8 (Available here on OSSN Website and on Github)
•Older Versions: 1.7, 1.6, 1.5.1, 1.5, 1.4, 1.3, 1.2, 1.1 and 1.0 (Available only on Github)
•Requires OSSN: version 5.6
•Tested up to: OSSN version 7.0
Alternate Download Link: https://github.com/thedoggybrad/speedtest-ossn/releases/download/1.8/speedtest.zip
This component is 100% stable and working in OSSN version 7.0. But, please always use the latest version to avoid any problems. By the way, the older versions are not maintained on this listing but they are available on my Github repository.
Note: I am willing to fix any problems related to this component, just please let me know.
Very Special Thanks to
https://www.opensource-socialnetwork.org/u/arsalanshah
https://www.opensource-socialnetwork.org/u/zetman
But I do think that it is fine to actually even I initially register it to everyone.
Since this line exists:
if (ossn_isLoggedin())
if(!ossnisLoggedin()) {
ossnerror_page();
}
Ah! this one. What should I do about the register you are saying?
Line 43 ({) and 57 (}) - Opening and Closing this:
$title = ossnprint('com:ossn:speedtest');
$contents['content'] = ossnpluginview('pages/speedtest', array(
));
$content = ossnsetpagelayout('newsfeed', $contents);
echo ossnviewpage($title, $content);
Next:
What are these strange curly braces on line 43 and 57 good for?
And:
Since you don't seem to want logged-off users to execute your speedtest page - why do you initially register that page for everyone?
If you would register that page for logged-in user only (as you did for the menu) you would not need that extra check inside your speedtest_pages function
Version 1.3 - Made the URL from https://example.com/speedtest/speedtest to just simply https://example.com/speedtest
Version 1.2 will be recalled to avoid user problems. But the older versions 1.0 to 1.2 will still be available on my Github repository.
Version 1.2 removes:
$guid = $pages;
and
switch($pages[0])
case 'speedtest':
And still results into a functional component.
Version 1.2
Fixes issues reported by https://www.opensource-socialnetwork.org/u/zetman
Version 1.1 has been taken down by me.
Thanks to @Michael Zülsdorff
Thanks for applying the first fixes.
Still in place: that obsolete $guid = $pages;
please remove it.
Then, let's go ahead and see what's still strange:
You coded: ossn_register_page('speedtest', 'speedtest_pages');
That is, whenever you enter https://somesite/speedtest
in your browser, your accompanying function speedtest_pages()
will be reliably executed.
So, why do you have that extra switch which is comparing again on 'speedtest' ?
A switch only makes sense if you are expecting different cases you need to handle.
The original version 1.0 has been taken down by me just for you not to download the version with component naming issues.
Version 1.1 - Fixes unecessary passing of guid to ossnpluginview and component naming issues
Thanks to Michael Zülsdorff