[Plugin] PD_Scripting

Third Party Plugins to CMSimple - how to install, use and create plugins

Moderator: Tata

Re: [Plugin] PD_Scripting

Postby Holger » Thu May 13, 2010 8:29 pm

Hi jerry,

that's true. pd_scripting only inserts "normal" #CMSimple ... # plugin-calls.
I wrote in the help file that it's impossible to insert plugins like the gallery with pd_scripting, because here the admin-part don't work because the list of galleries are
build by a look at the function calls in the content.
So it's at the moment not possible to insert plugins which need their call in the content with pd_scripting.
Maybe Leenm or MVWD wan't to change the PL to configure a "first loaded plugin". It's IMO possible doing that, but I'm not sure if this is really working.

I don't think that there're so much plugins in the wild working that way.
But I'll have a closer look on it.


WBR
Holger
Holger
Site Admin
 
Posts: 2582
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: [Plugin] PD_Scripting

Postby Holger » Fri May 14, 2010 7:49 am

Hi jerry!

Now I've managed to load the pd_scipting plugin before the gallery and it seems to work.
So I think you're right. It could be a solution when we could manage to load pd_scripting as the first plugin.

Holger
Holger
Site Admin
 
Posts: 2582
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: [Plugin] PD_Scripting

Postby jerry » Fri May 14, 2010 9:37 pm

Hi Holger

I'm happy to be right, it means less work to me :D

It's not a big deal to rewrite Newsletter and even AdvancedSearch to read directly in pagedata.php, but i doesn't make sense to do it if the soluton is as easy as to change the reading order of plugins. I will try again if I can change the reading order some way so I can test if I'm realy right.

I thought that page_params will search hidden pages too if loaded after AdvancedSearch but it seems to work properly. I have no idea why.

regards jerry
jerry/simplesolutions
jerry
 
Posts: 177
Joined: Fri Jul 25, 2008 8:54 pm
Location: Denmark

Re: [Plugin] PD_Scripting

Postby Holger » Sat May 15, 2010 12:01 pm

Hi jerry,
jerry wrote:Hi Holger

I'm happy to be right, it means less work to me :D

It's not a big deal to rewrite Newsletter and even AdvancedSearch to read directly in pagedata.php, but i doesn't make sense to do it if the soluton is as easy as to change the reading order of plugins.

Yes, that's my opinion too.
So I hope Leenm, mvwd or another responsible member of the dev-team provide a solution.
That would be best and compatible way.

WBR
Holger
Holger
Site Admin
 
Posts: 2582
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: [Plugin] PD_Scripting

Postby jerry » Sat May 15, 2010 11:11 pm

Hi Holger

I wasn’t quite right. Finally I have taken my time to look at what happens inside of pd_scripting and as far as I can see the cmsimple script is only included in the current page. Then when I search through all pages for newsletter calls so I would still not find the script on the pages regardless plugins reading order. In case of Newsletter the error happened in administration section so all plugins were loaded in advance and reading order of plugins wasn’t important.

Having said so, I still think that page_param and pd_scripting should be loaded as the first (or even better became the part of the core CMSimple_XH) because they are essential for all other plugins.

I have solved newsletters problems by searching through both content and pagedata.php and it seems to be a viable solution. You have probably to do something similar in the gallery plugin
Code: Select all
$count=0;
foreach ($c as $i) {
   $page[$l[$count]]=$h[$count];
      preg_match('/#cmsimple\s+.*newsletter\(["|\'].*["|\']\).*#/i',$i,$mres);
      preg_match('/newsletter\(["|\'].*["|\']\)/',$mres[0],$mres);
      if (trim($mres[0]=="")) { //not found on the page, search hi_pd_scripting for newsletter calls
         if (isset($pd_router)) { //if page_param is activated then search through pagedata.php
            $page_pd = $pd_router -> find_page($count); // get page
            // search for newsletter in hi_pd_scripting fields in pagedata.php
            for ($pd_i = 1; ($pd_i <= $plugin_cf['hi_pd_scripting']['scripts_max_on_page']); $pd_i++) {
               if ($page_pd['hi_pd_scripting_active'.$pd_i] == '1') {  // activated
                  preg_match('/newsletter\(["|\'].*["|\']\)/',trim($page_pd['hi_pd_scripting_code'.$pd_i]),$mres);
                  if ($mres[0]!="")
                     $pd_i=$plugin_cf['hi_pd_scripting']['scripts_max_on_page']; // found, destroy loop   
         }   
      }
   }
}

$mres[0] contains then a function name with parameters.
I need to rewrite AdvancedSearch to do same thing.
jerry
jerry/simplesolutions
jerry
 
Posts: 177
Joined: Fri Jul 25, 2008 8:54 pm
Location: Denmark

Re: [Plugin] PD_Scripting

Postby jerry » Mon May 17, 2010 10:27 pm

Hi holger

I did it :D
Newsletter ver 2.0 and AdvancedSearch ver. 1.4 are compatible with pd_scripting plugin.
jerry
jerry/simplesolutions
jerry
 
Posts: 177
Joined: Fri Jul 25, 2008 8:54 pm
Location: Denmark

Re: [Plugin] PD_Scripting

Postby bastingse » Tue Jun 15, 2010 7:40 pm

Any news about the "gallery" plugin working together with this plugin??
bastingse
 
Posts: 79
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands, Maastricht

Re: [Plugin] PD_Scripting

Postby Holger » Tue Jun 15, 2010 8:55 pm

bastingse wrote:Any news about the "gallery" plugin working together with this plugin??
Hi Emile, you have PM'ed and I've PM'ed back ;)
Holger
Site Admin
 
Posts: 2582
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: [Plugin] PD_Scripting

Postby bastingse » Tue Jun 15, 2010 9:11 pm

:lol: :lol:
bastingse
 
Posts: 79
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands, Maastricht

Re: [Plugin] PD_Scripting

Postby Holger » Fri Jul 02, 2010 9:32 pm

Hi jerry!
jerry wrote:I have solved newsletters problems by searching through both content and pagedata.php and it seems to be a viable solution.

Thanks for keeping your plugins compatible for my pd_scripting!

I had a look on your posted code and I have some small suggestions:
Code: Select all
if (isset($pd_router)) { //if page_param is activated then search through pagedata.php           
You should better check if pd_scripting is installed, because pd_router is always set in CMSimple_XH but pd_scripting is maybe not installed. As an example you can use
Code: Select all
if (isset($plugin_cf['hi_pd_scripting']['scripts_max_on_page'])) { // only if pd_scripting is installed search through pagedata.php            


It seems that you only need the parameters of function newsletter($params) inside your admin.php?
If so, you may save the two additional lines for replacing the brackets and qouotes (Line 252 & 253) by changing the regexp a bit:
Code: Select all
preg_match('/newsletter\(["|\'].*["|\']\)/',trim($page_pd['hi_pd_scripting_code'.$pd_i]),$mres); 
should become
Code: Select all
preg_match('/newsletter\(["|\'](.*)["|\']\)/i',trim($page_pd['hi_pd_scripting_code'.$pd_i]),$mres); 

$mres[1] then contains only the parameters of the newsletter-call in pagedata.php without the quotes and brackets. The i - modifier makes the regex caseinsensitive.

WBR
Holger
Holger
Site Admin
 
Posts: 2582
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

PreviousNext

Return to Addons and Plugins

Who is online

Users browsing this forum: No registered users and 3 guests

cron