Submit process from Plugin parameter screen once when the parameters are saved - joomla

I want to process a script whenever a plugin parameter is changed and the save button is clicked in Joomla. I do not want to run it everytime, but as soon the save button is pressed, the script should execute and then should lie dormant until it is invoked again

I think you could use either of these events (from com_plugins/models/plugin.php )
/**
* #var string The event to trigger after saving the data.
* #since 1.6
*/
protected $event_after_save = 'onExtensionAfterSave';
/**
* #var string The event to trigger after before the data.
* #since 1.6
*/
protected $event_before_save = 'onExtensionBeforeSave';
If you look at the base/core plugins installed with Joomla! in /plugins/ you can find examples of these and other triggers being used.

Related

Problem with logging in (Laravel Jetstream)

I have the following problem: Always when I try to log in, on the first attempt the page is just reloading without performing any action like showing up a message for wrong credentials or something like this. On the second attempt everything works fine. Any ideas?
Laravel version: 8
After many, many researches for this kind of problem I think I found my specific solution. I've actually built a route long time ago for logging out which had the following code:
Auth::logout();
return redirect()->route('site.home');
I have no idea why I've created and used this route at all. According to jetstream's core code and my understandings that's not how you fully logout a user and destroy session. But here's how:
/**
* Destroy an authenticated session.
*
* #param \Illuminate\Http\Request $request
* #return \Laravel\Fortify\Contracts\LogoutResponse
*/
public function destroy(Request $request): LogoutResponse
{
$this->guard->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return app(LogoutResponse::class);
}
I've tested it right now and everything works fine.

Joomla Plugin onAfterRender

How do I make the onAfterRender to be called last?
The problem is I wan't to make changes to the JResponse:getBody() when everything is all done.
But sadly to say the custom plugin that I created is not being called in last, so after I do my changes to the content there is another plugin that will do its changes, which is not good on my side.
Is there any other way or setup to do, in order my onAfterRender get call in last?
[update]
Found and answer from Joomla Forum, but still not working that changing the ordering of plugin to the last, this might work but for some other reason the other plugin is still not following the order.
As of now, I guess the sequence of constructing the plugin is fine but the event is a bit odd.
My theory is Custom Plugin might have a less process which will call the onAfterRender than the Other Plugin instead of being in a sequence of Other Plugin __construct ()Custom Plugin __construct ()Other Plugin onAfterRender ()Custom Plugin onAfterRender ()
I manage to fix the issue by detaching and attaching it on JEventDispatcher::getInstance();
/**
* [onAfterInitialise description]
* #return [type] [description]
*/
public function onAfterInitialise()
{
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->detach($this);
$dispatcher->attach($this);
}
/**
* [onBeforeRender description]
* #return [type] [description]
*/
public function onBeforeRender()
{
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->detach($this);
$dispatcher->attach($this);
}
Still I'm in question, hope someone could explain it to me :)

Show full documentation for functions Xcode?

When i'm using xcode with a C header, i see only the first line of documentation for a function:
For example, this is a function in my header.
In my header, the documentation looks like this:
/**
* Perform a ticket-create request and return the result.
*
* All logs uploaded between this ticket and the last ticket created for this device will
* automatically be included with this ticket.
*
* #param p0 The details to include with the ticket.
* #param p1 The contact information to include with the ticket.
*
* #return a structure where r0 contains the ticket id or -1 if there was an error and r1 contains an error if any.
*/
extern struct VcbLogCreateTicket_return VcbLogCreateTicket(char* p0, char* p1);
But when i go to that function in xcode, i only see the first line like so:
How do I get it to show the full documentation, preferably including parameters and return? Is this even an option in xcode?
You can option-click on any symbol to get its full documentation.

Silverstripe Filter Search

I have a News section in my silverstripe site and I want to use the FulltextSeach functionality of Silverstripe:
FulltextSearchable::enable();
That works fine so far. But I´d like to have only NewsPages in my result. Is there a way to filter the search so that you get only certin pageType as a result for example?
Thanks in advance,
Chris
This is untested code but I've just had a look the source code of sapphire/search/FulltextSearchable.php
in mysite/_config.php you could add:
FulltextSearchable::enable(array());
which should remove the default searched classes which are SiteTree (all pages) and File
Then you can add an object extension in mysite/_config.php:
Object::add_extension('NewsPage', "FulltextSearchable('Title,MenuTitle,Content,MetaTitle,MetaDescription,MetaKeywords')");
Below is the comments from within the FulltextSearchable.php file
/**
* Enable the default configuration of MySQL full-text searching on the given data classes.
* It can be used to limit the searched classes, but not to add your own classes.
* For this purpose, please use {#link Object::add_extension()} directly:
* <code>
* Object::add_extension('MyObject', "FulltextSearchable('MySearchableField,'MyOtherField')");
* </code>
*
* Caution: This is a wrapper method that should only be used in _config.php,
* and only be called once in your code.
*
* #param Array $searchableClasses The extension will be applied to all DataObject subclasses
* listed here. Default: {#link SiteTree} and {#link File}.
*/

Code completion for CodeIgniter with zend studio not working

Ok so i tried doing what this post says about adding code completion to zend studio, even with the libraries added code hinting/completion still fails to show. As my libraries are growing it's becoming more important to have this feature as i'm starting to forget what my methods were actually designed for or what there called. from within a controller, model maybe even view i would like to have it show after typing $this->router->(show completion) as an example. I have also added application/libraries path for my custom made libraries and they too wont show.
I have done a bit off google searching but most just say to do what the above post says. I attempted to try /* #var $var Class */ but wasnt able to assign it with a property eg. /* #var $this->router CI_Router */ only a standard variable..
This was solved simply by doing comment as such
/**
* #var CI_Loader
*/
$load
and not just doing
/* #var ........ */

Resources