Jump to content

Sephiroth

Members
  • Content Count

    298
  • Joined

  • Last visited

  • Days Won

    1

Sephiroth last won the day on June 8 2015

Sephiroth had the most liked content!

Community Reputation

283 Excellent

About Sephiroth

  • Rank
    Sr. Member
  • Birthday 02/19/1986

Contact Methods

  • Website URL
    http://okeowoaderemi.com
  • Skype
    okeowo.aderemi

Profile Information

  • Gender
    Male
  • Location
    Nigeria
  • Interests
    Mostly Programming and reading about Emulating game consoles in C++, watching movies that mess my mind and spending hours playing my favorite game "Skyrim" am an Anime/Final Fantasy Fan and yes Sephiroth is my fav character

Recent Profile Visitors

4,367 profile views
  1. have you covered this ? Enabling Pagination Make sure the "Pager" (MarkupPagerNav) module is installed in Admin > Modules. If it's not installed, click the Install link next to it. Determine what template(s) you want to use pagination with. Go to Admin > Setup > Templates > [Your Template] > URLs, and check the box for: Allow Page Numbers. Save. Pagination should now be enabled and ready to use in your templates.
  2. Hi you might call it dumb, but this is actually interesting, I was thinking is there any mechanism to /condition to stop a Hook from being called, so pardon this jargon, so I took the time to see if such exists public function runHooks($method, $arguments, $type = 'method') { $result = array( 'return' => null, 'numHooksRun' => 0, 'methodExists' => false, 'replace' => false, ); $realMethod = "___$method"; if($type == 'method') $result['methodExists'] = method_exists($this, $realMethod); if(!$result['methodExists'] && !self::isHooked($method . ($type == 'method' ? '()' : ''))) { return $result; // The condition for not running is when not hooked or method doesn't exist } $hooks = $this->getHooks($method); foreach(array('before', 'after') as $when) { if($type === 'method' && $when === 'after' && $result['replace'] !== true) { if($result['methodExists']) { $result['return'] = call_user_func_array(array($this, $realMethod), $arguments); } else { $result['return'] = null; } } foreach($hooks as $priority => $hook) { if(!$hook['options'][$when]) continue; if(!empty($hook['options']['objMatch'])) { $objMatch = $hook['options']['objMatch']; // object match comparison to determine at runtime whether to execute the hook if(is_object($objMatch)) { if(!$objMatch->matches($this)) continue; } else { if(((string) $this) != $objMatch) continue; } } if($type == 'method' && !empty($hook['options']['argMatch'])) { // argument comparison to determine at runtime whether to execute the hook $argMatches = $hook['options']['argMatch']; $matches = true; foreach($argMatches as $argKey => $argMatch) { $argVal = isset($arguments[$argKey]) ? $arguments[$argKey] : null; if(is_object($argMatch)) { // Selectors object if(is_object($argVal)) { $matches = $argMatch->matches($argVal); } else { // we don't work with non-object here $matches = false; } } else { if(is_array($argVal)) { // match any array element $matches = in_array($argMatch, $argVal); } else { // exact string match $matches = $argMatch == $argVal; } } if(!$matches) break; } if(!$matches) continue; // don't run hook } $event = new HookEvent(); $event->object = $this; $event->method = $method; $event->arguments = $arguments; $event->when = $when; $event->return = $result['return']; $event->id = $hook['id']; $event->options = $hook['options']; $toObject = $hook['toObject']; $toMethod = $hook['toMethod']; if(is_null($toObject)) $toMethod($event); else $toObject->$toMethod($event); $result['numHooksRun']++; if($when == 'before') { $arguments = $event->arguments; $result['replace'] = $event->replace === true || $result['replace'] === true; if($result['replace']) $result['return'] = $event->return; } if($when == 'after') $result['return'] = $event->return; } } return $result; } As you can see there isn't any logic to stop hooks from running other than if the arguments are wrong and method doesn't exist or the method itself in question is not hookable. However using an exit should work since the exit method stop the execution of the current script. I think the concept of Hooks is you attaching to them and not stopping them. But another alternative would be to remove the check from the hook and and have the check determining whether to call the WireHttp::send Let me know if that suffices
  3. Oops I get the confusion now, sorry my fault I assumed it was the same when i saw horst name here is the link:
  4. Sorry I was referring to topic you posted, the author there had an issue making PATCH Request using WireHttp, I was only pointing that out should you encounter such.
  5. Horst beat me to it, WireHttp is basically a wrapper around CURL, However that thread you linked, pointed out something about making a PATCH Request.
  6. Out of curiosity, can you dump the data being sent out and validate it's the proper data you intend to send also this stackoverflow also details a way of making PATCH curl calls. https://stackoverflow.com/questions/14451401/how-do-i-make-a-patch-request-in-php-using-curl
  7. I have written tutorials here and various tutorials before, it's fun for me however I think starting small is a good idea. I will create a thread for this today or tomorrow where we can deliberate on table of contents and all.
  8. I don't know if this is in works, because I have much free time ( Change of Job) , I am thinking of picking this up, using something that generates from Markdown via Github, I have looked at Leanpub, @HMC is right, a table of content is necessary, I will create a thread for this, because I think it is long due for this. However I will prefer somewhere , where people can edit and push for changes, Git seems to fit for this purpose if anyone has any comments, please feel free to chime in.
  9. Here is a link to the source of my website, I used Twig for it, I will try and create a repo for this, this week https://github.com/dojoVader/My-Website/blob/master/remipw-next
  10. That's not a bad idea, I love writing tutorial and that thought has always been there, maybe it is something I can look at except that payment issues is one that discourages me from sure since my country has so many restrictions, but it is something that is due. A book someone can follow from scratch to finish. Good idea
  11. I have been absent in the PW scene, I am still curious about this ChangeLog i think it's long due, is there a repo on it ? or anyone working on it, so i can contribute.
  12. {block name="content"}{/block} Sorry about that, that was a smarty template, my brain went into Smarty mode the correct syntax is what you provided, in your layout where you arr inheritting from, ensure you have something like this {% block content %} {% endblock %}
  13. Sephiroth

    Nexoc Notebooks

    How i think i might need a new laptop for gaming. nice site. My Nvidia 830M is outdated
  14. function insert($data) { $this->site->pages->find(....); // <= use the site through the class handle } The problem i find with this, is that now your class knows too much about the site pages, it would be better to simply pass the data, else this would lead to tight coupling, unless you have to create an interface and ensure the contracts are followed.
  15. Lol I write Java in the office so i make the mistake of fusing Java into PHP.
×
×
  • Create New...