Wrong link. :P
At sm.org, if you want to link the parsing you have to copy&paste the url linked in the text "Installation Instructions for x.x.xx". ;)
Anyway the link to the mod page is enough. ;)
Fixed it. Anyway it is at http://custom.simplemachines.org/mods/index.php?mod=3580
The license seems to be GPL2: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. I think the code may be modified and its modification may be re-distributed.
I am also going to do this step by step and post what file that has been modified in here, so that everybody can follow and correct any mistakes, if any.
Currently, I have converted some of the files i.e. package-info.xml, uninstall-optional.php and install.php.
Ever considered Hybridauth?
I'm not sure how many people are willing to pay at least 8€/month to have social logins.
They are free as above only. I am actually revising my skill in converting the code to Elkarte.
Any clue on how to start with that?
Ohhh... okay, I didn't notice it. lol
I could tell you to pick ideas from Ant59 addon, but I wouldn't influence the way you'll build it (mainly because his addon is not open source and so you should not take it verbatim).
May be I'll just finish with this social login first. I just need to check something up in converting modification.xml to hooks whenever possible. Original modification.xml file is attached together with unfinished package for reference.
[b][u]First modification[/u][/b]
<file name="$languagedir/Modifications.english.php">
<operation>
<search position="end" />
<add><![CDATA[
// OneAll Social Login (https://docs.oneall.com/plugins/)
$txt['oasl_title'] = 'OneAll Social Login';
$txt['oasl_config'] = 'Configuration';
$txt['oasl_settings_descr'] = 'OneAll Social Login Settings';
$txt['oasl_user_does_not_exist'] = "<strong>This social network has not yet been linked to an account.</strong><br /><br />Please use the registration form to create a new account. If you already have an account, open your profile settings to connect the social network to it.";
$txt['oasl_user_may_not_register'] = 'Sorry, but the admistration has disabled the registration for new users.';
$txt['oasl_user_require_activation'] = 'Your account has been created but it needs to be verified. Please check your mailbox and click on the link in the verification email.';
]]></add>
</operation>
</file>
The first modification is to add languages for the addon settings itself, so I will move the texts are move to the language file and load it via integrate_admin_areas. This will be done together with the fourth modification that will add menu in admin page.
[b][u]Fourth modification[/u][/b]
<file name="$sourcedir/Admin.php">
<operation>
<search position="after"><![CDATA['layout' => array(
'title' => $txt['layout_controls'],]]></search>
<add><![CDATA[
// OneAll Social Login (https://docs.oneall.com/plugins/)
'oasl' => array(
'title' => $txt['oasl_title'],
'permission' => array('admin_forum'),
'areas' => array(
'oasl' => array(
'label' => $txt['oasl_config'],
'file' => 'Subs-OneallSocialLogin.php',
'function' => 'oneall_social_login_config',
'custom_url' => $scripturl . '?action=admin;area=oasl;sa=settings;sesc=' . $sc,
'icon' => 'server.gif'
)
)
),
]]></add>
</operation>
</file>
For the time being the menu will be put under members areas. The above two modifications will be in 1ASL.subs.php as follows:
function 1ASL_AdminMenu(&$menudata)
{
global $scripturl, $txt;
// Load language(s)
loadLanguage('1ASL/1ASL');
// Insert 1ASL inside layout menu instead of having its main admin menu.
$menudata['members']['areas'] = array_merge(
array(
'oasl' => array(
'label' => $txt['oasl_config'],
'file' => '1ASL.subs.php',
'function' => '1ASL_config',
'custom_url' => $scripturl . '?action=admin;area=oasl;sa=settings;sesc=' . $sc,
'icon' => 'server.gif' ,
'subsections' => array(
),
),
),
$menudata['members']['areas']
);
}
The second modification can be converted to hook but the third one seems not possible to the same so it will stay as it is.
[b][u]Second and third modification[/u][/b]
<file name="$boarddir/index.php">
<operation>
<search position="before"><![CDATA[
'editpoll2' => array('Poll.php', 'EditPoll2'),]]></search>
<add><![CDATA[
'oasl' => array('Subs-OneallSocialLogin.php', 'oneall_social_login_config'),
'oasl_registration' => array('Subs-OneallSocialLogin.php', 'oneall_social_login_registration'),
'oasl_callback' => array('Subs-OneallSocialLogin.php', 'oneall_social_login_callback'),]]></add>
</operation>
</file>
<file name="$boarddir/index.php">
<operation>
<search position="after"><![CDATA['coppa', 'login',]]></search>
<add><![CDATA['oasl_registration', 'oasl_callback', ]]></add>
</operation>
</file>
I think in 1ASL.subs.php, as a hook using integrate_actions, the second modification should look something like this:
function 1ASL_Action(&$actionArray, &$adminActions)
{
$actionArray = array(
'oasl' => array('BOARDDIR/addons/1ASL/1ASL.subs.php', '1ASL_login_config'),
'oasl_registration' => array('BOARDDIR/addons/1ASL/', '1ASL_login_registration'),
'oasl_callback' => array('BOARDDIR/addons/1ASL/', '1ASL_login_callback'),
);
return $actionArray;
}
I am not so sure about the fifth modification below:
[b][u]Fifth modification[/u][/b]
<file name="$sourcedir/Load.php">
<operation>
<search position="before"><![CDATA[// Some basic information...
if (!isset($context['html_headers']))
$context['html_headers'] = '';]]></search>
<add><![CDATA[
// OneAll Social Login (https://docs.oneall.com/plugins/)
if ( ! empty ($modSettings['oasl_api_subdomain']))
{
$context['html_headers'] .= "\n<!-- OneAll.com / Social Login for SMF //-->\n";
$context['html_headers'] .= '<script type="text/javascript" src="//' . htmlspecialchars ($modSettings['oasl_api_subdomain']) . '.api.oneall.com/socialize/library.js"></script>';
}]]></add>
</operation>
</file>
I am thinking to load this as early as intergrate_pre_load or during integrate_theme_load. May be the later is more appropriate.
function 1ASL_PreLoad(&$actionArray, &$adminActions)
{
global $context, $modSettings;
if (!empty($modSettings['oasl_api_subdomain']))
$context['html_headers'] .= '<script type="text/javascript" src="//' . htmlspecialchars ($modSettings['oasl_api_subdomain']) . '.api.oneall.com/socialize/library.js"></script>';
}
Just few more lines to be converted and then finish this up for a good test. Any supports, feedbacks and comments on the above and other converted files are appreciated.
Social log in is an awesome concept. Especially in these days.
http://php.net/manual/en/functions.user-defined.php
You cannot use 1 as first letter of a function name.
I think I converted everything as it installed fine now but its settings menu do not appear. Nothing in the error log. I attached the packaged file.
Where did you put the files?
add_integration_function('integrate_pre_include', 'SOURCEDIR/OASL.subs.php');
add_integration_function('integrate_pre_load', 'OASL_PreLoad');
add_integration_function('integrate_actions', 'OASL_Action');
add_integration_function('integrate_admin_areas', 'OASL_Admin_Menu');
in SOURCEDIR or in ADDONSDIR?
And are you coding it for 1.1 or 1.0?
Noted that. I think I have moved it to ADDONSDIR. Anyway, there are lots of bugs in this package. May be I'll redo it again later.
@ahrasis Glad you took this on, but it isn't visible in the addon area. Did you get this to work, or give up on in? Sure would be a great thing to have!
Sorry. I forgot this addon altogether. I'll see to it soon.
While fixing the addon's broken code I got this error:
Line 921 is this function:
function OASL_PreLoad(&$actionArray, &$adminActions)
{
global $context, $modSettings;
if (!empty($modSettings['oasl_api_subdomain']))
$context['html_headers'] .= '<script type="text/javascript" src="//' . htmlspecialchars ($modSettings['oasl_api_subdomain']) . '.api.oneall.com/socialize/library.js"></script>';
}
The latest package (containing the above error) is attached.
I forgot why did I want to preload the above but I think it has to be put in the header so I did minor changes to to the hook. Now, it get to another error causing admin page not accessible (it will get you back to forum frontpage):
A non well formed numeric value encountered
index.php?action=admin;area=packages;sa=install2;package=OASL.zip;pid=0
/sources/ext/cssmin.php
Line: 769
What does this means anyway?
The latest package is attached.
Would you mind having a look and see what line 769 of cssmin.php looks like?
@emanuele, the above could be due to using php7.1 though (int) seems in place. Using php5.6 seems fine though.
765: private function normalize_int($size)
766: {
767: if (is_string($size)) {
768: switch (substr($size, -1)) {
==>769: case 'M': case 'm': return $size * 1048576;
770: case 'K': case 'k': return $size * 1024;
771: case 'G': case 'g': return $size * 1073741824;
772: }
773: }
774:
775: return (int) $size;
Anyway, the package has re-converted and so far it went smooth except for minor error. I attached it here for everybody's testing.
Missed changing $sourcedir to SOURCEDIR in subs file. I attached here the latest one. Hopefully, this time is more useful. You can check https://elkarte.sch.my by clicking on its login and registration button.
Can you report the bug?
It's in SiteCombiner:
$compressor = new CSSmin($this->_cache);
should be:
$compressor = new CSSmin();
Done.
Note that the error is still there when I did the required change inn SiteCombiner and tried installing two more addons (after the above post). Do I have to clear caches / cookies or anything first?
EDITED: I cleared the caches and the cookies but the error is still there.
Please try the attached version of cssmin.php (for sources/ext)
@emanuele if this fixes the issue we should add this to 1.0.10 since its another php7 fix :(
Thank you very much. That fixed it alright.
Hooray! :D