Glype
Glype plugins
1.If you want to create new plugin first register that plugin in in settings.php with $CONFIG['plugins'] = 'facebook.com, google.com'
2. Create file in /includes/facebook.com.php
3. Inside plugin you can use functions which are called from browse.php:
- preRequest()
- preParse($document, $fetch->parseType)
- postParse($document, $fetch->parseType, $origelem_arr)
4. In browse.php plugins are included automatically with (line 261):
global $foundPlugin;
$plugins = explode(',', $CONFIG['plugins']);
if ($foundPlugin = in_array($URL['domain'], $plugins)) {
include(GLYPE_ROOT.'/plugins/'.$URL['domain'].'.php');
}
Glype Plugins - Site specific solutions
1. facebook.com
- #chmod 777 /tmp/cookies/ -otherwise login will not work
2. google.com
- Modified code in browse.php because of redirection of google.com to google.hr cant load plugin google.com.php
if ($foundPlugin = in_array($URL['domain'], $plugins) || substr_count($URL['domain'], 'google')!=0) {
/**
* Due to google's redirection from google.com to local domain for example google.hr
* plugin google.com.php will not be loaded
* The following code repair that so evach will use google.com.php for the google domain
*/
if( substr_count($URL['domain'], 'google')!=0 ) {
include(GLYPE_ROOT.'/plugins/google.com.php');
}
else {
include(GLYPE_ROOT.'/plugins/'.$URL['domain'].'.php');
}
//test if plugin is included
//var_dump($URL['domain']);
}
- put $toSet[CURLOPT_USERAGENT] = 'Mozilla/1.0'; in google.com plugin to simulate old web browser. This is due to google images.