Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

PHP Question

R_JR_J Ex-FanboyMunich Admin

I was thinking about creating a little plugin that makes navigating through the long list of plugins easier by providing an alphabetical shortcut list. This is what I started with:

class PluginNavigatorPlugin extends Gdn_Plugin {
   public function SettingsController_BeforeRenderAsset_Handler($Sender) {
      // stop if not Content of Plugins section
      if (($Sender->EventArguments['AssetName'] != 'Content') || (substr($Sender->SelfUrl,0, 16) != 'settings/plugins')) {
         return;
      }
      $Content = $Sender->Assets['Content'];
      // some regex magic here
      $ContentNew = preg_replace('/(< div class="Info">)/', '$1Index: A B C D E F...< /div>$1', $Content);
      $Sender->Assets['Content'] = $ContentNew;
   }
}

Looks clean and easy but does not do anything :(

If I look at where the event is fired, I see this (class.controller.php):

public function RenderAsset($AssetName) {
   $Asset = $this->GetAsset($AssetName);

   $this->EventArguments['AssetName'] = $AssetName;
   $this->FireEvent('BeforeRenderAsset');

   //$LengthBefore = ob_get_length();

   if(is_string($Asset)) {
      echo $Asset;
...

So I would have to change the var $Asset in the scope of the function RenderAsset. Is this possible?

Best Answers

Answers

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Yes, I've thought about js and later on I remembered I could simply create a custom view. I think I simply create such a view. Thanks for answering even simple php questions :)

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    @peregrine said:
    edited out.

    But it was also true ;)

  • Options
    peregrineperegrine MVP
    edited January 2014

    ok edited back in. :) But perhaps I wish I didn't.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.