Exemple #1
0
<?php

addPollenPlugin('deletepage', 'se_on_delete_page');
addPollenPlugin('savepage', 'se_on_save_page');
addPollenPlugin('renamepage', 'se_on_rename_page');
addPollenPlugin('addPluginsTabs', 'seConfigTab');
addPollenPlugin('adminHeader', 'seAdminHeader');
function seChangeLocale()
{
    setLocalePath(dirname(__FILE__) . SLASH . 'locale', 'search_engine');
    _('ACTIVATE');
    _('HOST');
    _('LOGIN');
    _('PASSWD');
    _('BASE');
    _('PREFIX');
}
function seAdminHeader()
{
    $oDir = new PDir(dirname(__FILE__));
    $strCurrUrl = $oDir->getUrl();
    $strReturn = '
	<!-- Add By Plugin seAdminHeader -->
		<script language="JavaScript" src="' . $strCurrUrl . 'include/js/apply-se.js" ></script>
	<!-- // -->
	';
    return $strReturn;
}
function seConfigTab($tabExtraPlugins)
{
    $oPlugin = new PPluginDir(dirname(__FILE__));
<?php

addPollenPlugin('extrapage', 'extrapage_sitemap');
addSmartyPlugin('insert', 'google_sitemap_fct', 'google_sitemap');
/**
 * extrapage_sitemap
 * This is the extrapagesite map event function
 * This function check the name of the page and if it is sitemap.xml, generate the site map.
 *
 * @param unknown_type $strPage
 * @param unknown_type $site
 * @return unknown
 */
function extrapage_sitemap($strPage, &$site)
{
    if ($strPage == 'sitemap.xml') {
        $strTplFile = dirname(__FILE__) . SLASH . 'google_sitemap.tpl';
        if (!$site->template_exists($strTplFile)) {
            setError('Error in plugin google site map. Can not find the google_sitemap.tpl file.');
            printFatalHtmlError();
            die;
        }
        header('Content-Type: text/xml;');
        $site->display($strTplFile);
        return true;
    }
    return false;
}
/**
 * google_sitemap_fct
 * This is the smarty function used in the google_sitemap.tpl.
Exemple #3
0
<?php

addPollenPlugin('extrapage', 'images_tools_extrapage_imagestoolsresize');
addPollenPlugin('uploadfile', 'images_tools_OnUpload_ResizeImage');
addPollenPlugin('addPluginsTabs', 'images_tools_TabConfig');
addSmartyPlugin('output', 'images_tools_addjs_fancyzoom_and_ifixpng');
addSmartyPlugin('output', 'images_tools_change_image_src_to_autoresize');
function images_tools_TabConfig($tabExtraPlugins)
{
    $oPlugin = new PPluginDir(dirname(__FILE__));
    $oConfigFile =& $oPlugin->oConfig;
    $tabExtraPlugins[] = array('FRAG_NAME' => 'plugins_imagestools', 'TAB_NAME' => _('Images Tools'), 'TAB_CONTENT' => $oConfigFile->DisplayEditor());
    return true;
}
function images_tools_extrapage_imagestoolsresize($strPage, &$site)
{
    if ($strPage != 'imagestoolsresize.php') {
        return false;
    }
    require SITE_PATH . 'core/lib/pimage.php';
    if (!isset($_GET['img']) || !isset($_GET['width']) || !isset($_GET['height'])) {
        return false;
    }
    $strImgUrl = urldecode($_GET['img']);
    if (strstr($strImgUrl, '..') !== FALSE) {
        return false;
    }
    //check that image is a sub file of POLLEN MEDIAS directory
    if (!($oDirUpload = getFileObjectAndFind(MEDIAS_PATH))) {
        return false;
    }
Exemple #4
0
<?php

addPollenPlugin('extrapage', 'page404', 1);
function page404($strPage, &$site)
{
    if (!($oPage =& $site->getPage('404.html'))) {
        return false;
    }
    header("HTTP/1.0 404 Not Found");
    return $oPage;
}
Exemple #5
0
<?php

addPollenPlugin('adminmainmenu', 'admin_btn_news');
addPollenPlugin('extrapage', 'extrapage_rss_feed');
addPollenPlugin('getpagecontent', 'news_content');
addSmartyPlugin('insert', 'insert_newsrss', 'news_rss');
addSmartyPlugin('insert', 'tplfct_news_rss', 'rss_page');
/**
 * tplfct_news_rss
 * This is the template function rss_page use by the get feed template rss_page
 *
 * @param array $params, parameters from the template
 * @param Pollen CMS object $smarty
 * @return the feed in xml
 */
function tplfct_news_rss($params, &$smarty)
{
    $strTplChannel = '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>%CHANNEL_TITLE%</title>
		<link>%CHANNEL_LINK%</link>
		<description>%CHANNEL_DESCRIPTION%</description>
		<pubDate>%CHANNEL_PUBDATE%</pubDate>
		<generator>%CHANNEL_GENERATOR%</generator>
		%ITEMS%
	</channel>
</rss>
';
    $strServerUrl = strstr(SITE_URL, 'http') ? '' : 'http://' . $_SERVER['SERVER_NAME'] . '';
    $tabInfosChannel = array('title' => 'test', 'link' => $strServerUrl . SITE_URL, 'description' => 'ceci est la description', 'pubDate' => gmdate('D, d M Y H:i:s', time()) . ' GMT', 'generator' => 'POLLEN CMS');
Exemple #6
0
<?php

addSmartyPlugin('output', 'add_phpmyvisites_tag');
addPollenPlugin('addPluginsTabs', 'tabPhpMyVisitesConfig');
function tabPhpMyVisitesConfig($tabExtraPlugins)
{
    $oPlugin = new PPluginDir(dirname(__FILE__));
    $oConfigFile =& $oPlugin->oConfig;
    $tabExtraPlugins[] = array('FRAG_NAME' => 'plugins_phpmyvisites', 'TAB_NAME' => _('Php My Visites'), 'TAB_CONTENT' => $oConfigFile->DisplayEditor());
    return true;
}
function add_phpmyvisites_tag($source, &$smarty)
{
    $oPlugin = new PPluginDir(dirname(__FILE__));
    $oConfigFile =& $oPlugin->oConfig;
    if ($oConfigFile->getDirectParam('PHP_MYVISITES_ACTIVATE') !== "true") {
        return $source;
    }
    $id = intval($oConfigFile->getDirectParam("PHP_MYVISITES_ID"));
    $strPhpmvUrl = $oConfigFile->getDirectParam("PHP_MYVISITES_URL");
    if ($id != '' && $id > 0 && $strPhpmvUrl != '' && strstr($source, '</body>') !== FALSE) {
        $strPageName = preg_replace('/^' . preg_quote(SITE_URL, '/~') . '/', '', $smarty->oPageCurrent->getUrl());
        $strphpmv = '
<!-- Add By PhpMyVisites Plugin  -->
	<div style="display:none">
		<a href="http://www.phpmyvisites.us/" title="phpMyVisites | Open source web analytics" onclick="window.open(this.href);return(false);">
		<script type="text/javascript">
		<!--
		var a_vars = Array();
		var pagename = "' . $strPageName . '";