Created
December 16, 2013 22:12
-
-
Save mckelvey/7995379 to your computer and use it in GitHub Desktop.
One example code block... do remember to not have whitespace either before the opening <?php or after the closing ?>.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_LW->REGISTERED_APPS['private_things_stay_private']=array( // register this application | |
'title' => 'Private Things Stay Private', | |
'handlers' => array('onLoad', 'onWidgetLoad'), | |
); | |
class LiveWhaleApplicationPrivateThingsStayPrivate { | |
protected $private_allowed = array( | |
'/careers/', | |
); | |
public function onLoad() { | |
global $_LW; | |
$_LW->logDebug("PRIVATE LOADED"); | |
} | |
public function onWidgetLoad($xml) { // alter widget arguments prior to execution; $xml is a SimpleXML object. | |
global $_LW; | |
// there should be some if statement here that applies this to everywhere but certain paths | |
// perhaps using some paths in a protected array, above? (Whatever works here.) | |
// it could be: if (strpos($_SERVER['PHP_SELF'], $doc_root_path) === 0) return $xml; | |
// otherwise apply the following | |
$arg = $xml->addChild('arg', 'LawKey-Private'); // add a child node to the root <widget> element | |
$arg->addAttribute('id', 'exclude_tag'); // add the id attribute | |
return $xml; // return the updated widget | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment