[pLog-svn] r6743 - in plugins/branches/lifetype-1.2: . sapeclient sapeclient/class sapeclient/class/action sapeclient/class/view sapeclient/locale sapeclient/templates
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Wed Nov 19 10:42:20 EST 2008
Author: jondaley
Date: 2008-11-19 10:42:20 -0500 (Wed, 19 Nov 2008)
New Revision: 6743
Added:
plugins/branches/lifetype-1.2/sapeclient/
plugins/branches/lifetype-1.2/sapeclient/class/
plugins/branches/lifetype-1.2/sapeclient/class/action/
plugins/branches/lifetype-1.2/sapeclient/class/action/pluginsapeclientconfigaction.class.php
plugins/branches/lifetype-1.2/sapeclient/class/action/pluginsapeclientupdateconfigaction.class.php
plugins/branches/lifetype-1.2/sapeclient/class/view/
plugins/branches/lifetype-1.2/sapeclient/class/view/pluginsapeclientconfigview.class.php
plugins/branches/lifetype-1.2/sapeclient/locale/
plugins/branches/lifetype-1.2/sapeclient/locale/locale_en_UK.php
plugins/branches/lifetype-1.2/sapeclient/locale/locale_ru_RU.php
plugins/branches/lifetype-1.2/sapeclient/pluginsapeclient.class.php
plugins/branches/lifetype-1.2/sapeclient/readme.txt
plugins/branches/lifetype-1.2/sapeclient/readme_ru.txt
plugins/branches/lifetype-1.2/sapeclient/templates/
plugins/branches/lifetype-1.2/sapeclient/templates/sapeclient.template
Log:
link exchange plugin. http://forums.lifetype.net/viewtopic.php?f=4&t=9318
Added: plugins/branches/lifetype-1.2/sapeclient/class/action/pluginsapeclientconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/sapeclient/class/action/pluginsapeclientconfigaction.class.php (rev 0)
+++ plugins/branches/lifetype-1.2/sapeclient/class/action/pluginsapeclientconfigaction.class.php 2008-11-19 15:42:20 UTC (rev 6743)
@@ -0,0 +1,27 @@
+<?php
+
+ lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+ lt_include( PLOG_CLASS_PATH."plugins/sapeclient/class/view/pluginsapeclientconfigview.class.php" );
+
+ /**
+ * shows a form with the current configuration
+ */
+ class PluginSapeClientConfigAction extends AdminAction
+ {
+
+ function PluginSapeClientConfigAction( $actionInfo, $request )
+ {
+ $this->AdminAction( $actionInfo, $request );
+ }
+
+ function perform()
+ {
+ $this->_view = new PluginSapeClientConfigView( $this->_blogInfo );
+
+ $this->setCommonData();
+
+ return true;
+ }
+ }
+?>
Added: plugins/branches/lifetype-1.2/sapeclient/class/action/pluginsapeclientupdateconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/sapeclient/class/action/pluginsapeclientupdateconfigaction.class.php (rev 0)
+++ plugins/branches/lifetype-1.2/sapeclient/class/action/pluginsapeclientupdateconfigaction.class.php 2008-11-19 15:42:20 UTC (rev 6743)
@@ -0,0 +1,78 @@
+<?php
+ lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+ lt_include( PLOG_CLASS_PATH."plugins/sapeclient/class/view/pluginsapeclientconfigview.class.php" );
+
+ /**
+ * updates the plugin configuration
+ */
+ class PluginSapeClientUpdateConfigAction extends AdminAction
+ {
+ var $_pluginEnabled;
+ var $_sapeuser;
+
+ function PluginStickyPostsUpdateConfigAction( $actionInfo, $request )
+ {
+ $this->AdminAction( $actionInfo, $request );
+ }
+
+ function validate()
+ {
+ $errorMessages = array();
+ $this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );
+ $this->_pluginEnabled = ($this->_pluginEnabled != "" );
+
+ $this->_sapeuser = $this->_request->getValue( "sapeuser" );
+ if( $this->_pluginEnabled && empty($this->_sapeuser) ) {
+ $errorMessages[] = "sapeclient_error_sapeuser";
+ $isError = true;
+ }
+
+ if( count($errorMessages) > 0 ) {
+ $this->_view = new PluginSapeClientConfigView( $this->_blogInfo );
+ $allerror='';
+ foreach( $errorMessages as $error ){
+ $allerror .= $this->_locale->tr($error).'<br />';
+ }
+ $this->_view->setErrorMessage( $this->_locale->tr($allerror));
+ $this->setCommonData();
+ return false;
+ }
+
+ return true;
+ }
+
+ function perform()
+ {
+ // // update the plugin configurations to blog setting
+ $blogSettings = $this->_blogInfo->getSettings();
+ $blogSettings->setValue( "plugin_sapeclient_enabled", $this->_pluginEnabled );
+ $blogSettings->setValue( "plugin_sapeclient_sapeuser", $this->_sapeuser );
+ $this->_blogInfo->setSettings( $blogSettings );
+
+ // save the blogs settings
+ $blogs = new Blogs();
+ if( !$blogs->updateBlog( $this->_blogInfo )) {
+ $this->_view = new PluginStickyPostsConfigView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_updating_settings"));
+ $this->setCommonData();
+
+ return false;
+ }
+
+ // if everything went ok...
+ $this->_blogInfo->setSettings( $blogSettings );
+ $this->_session->setValue( "blogInfo", $this->_blogInfo );
+ $this->saveSession();
+
+ $this->_view = new PluginSapeClientConfigView( $this->_blogInfo );
+ $this->_view->setSuccessMessage( $this->_locale->tr("sapeclient_settings_saved_ok"));
+ $this->setCommonData();
+
+ // clear the cache
+ CacheControl::resetBlogCache( $this->_blogInfo->getId());
+
+ return true;
+ }
+ }
+?>
Added: plugins/branches/lifetype-1.2/sapeclient/class/view/pluginsapeclientconfigview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/sapeclient/class/view/pluginsapeclientconfigview.class.php (rev 0)
+++ plugins/branches/lifetype-1.2/sapeclient/class/view/pluginsapeclientconfigview.class.php 2008-11-19 15:42:20 UTC (rev 6743)
@@ -0,0 +1,30 @@
+<?php
+
+ lt_include( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+
+ /**
+ * implements the main view of the SAPE client plugin
+ */
+ class PluginSapeClientConfigView extends AdminPluginTemplatedView
+ {
+
+ function PluginSapeClientConfigView( $blogInfo )
+ {
+ $this->AdminPluginTemplatedView( $blogInfo, "sapeclient", "sapeclient" );
+ }
+
+ function render()
+ {
+ // load some configuration settings
+ $blogSettings = $this->_blogInfo->getSettings();
+ $pluginEnabled = $blogSettings->getValue( "plugin_sapeclient_enabled" );
+ $sapeuser = $blogSettings->getValue( "plugin_sapeclient_sapeuser");
+
+ // create a view and export the settings to the template
+ $this->setValue( "pluginEnabled", $pluginEnabled );
+ $this->setValue( "sapeuser", $sapeuser );
+
+ parent::render();
+ }
+ }
+?>
Added: plugins/branches/lifetype-1.2/sapeclient/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.2/sapeclient/locale/locale_en_UK.php (rev 0)
+++ plugins/branches/lifetype-1.2/sapeclient/locale/locale_en_UK.php 2008-11-19 15:42:20 UTC (rev 6743)
@@ -0,0 +1,10 @@
+<?php
+$messages["sapeclient"] = "SAPE Client";
+$messages["Sape Client"] = "SAPE Client";
+$messages["sapeclient_plugin"] = "Sape Client Configuration";
+$messages["sapeclient_plugin_enabled"] = "Enable SAPE Client Plugin.";
+$messages["label_sapeuser"] = "SAPE_USER code";
+$messages["sapeclient_sapeuser"] = "Please fill in the SAPE_USER code. You can find this code in your SAPE code settings.";
+$messages["sapeclient_error_sapeuser"] = "You must fill in the SAPE_USER code.";
+$messages["sapeclient_settings_saved_ok"] = "SAPE Client configuration update successed !";
+?>
Added: plugins/branches/lifetype-1.2/sapeclient/locale/locale_ru_RU.php
===================================================================
--- plugins/branches/lifetype-1.2/sapeclient/locale/locale_ru_RU.php (rev 0)
+++ plugins/branches/lifetype-1.2/sapeclient/locale/locale_ru_RU.php 2008-11-19 15:42:20 UTC (rev 6743)
@@ -0,0 +1,10 @@
+<?php
+$messages["sapeclient"] = "SAPE Клиент";
+$messages["Sape Client"] = "SAPE Клиент";
+$messages["sapeclient_plugin"] = "Конфигурация SAPE Клиента";
+$messages["sapeclient_plugin_enabled"] = "Включть плагин SAPE Клиент.";
+$messages["label_sapeuser"] = "код SAPE_USER";
+$messages["sapeclient_sapeuser"] = "Пожалуйста, введите код SAPE_USER. Вы можете найти его в ваших настройках кода SAPE на сайте sape.ru.";
+$messages["sapeclient_error_sapeuser"] = "Вам необходимо ввести код SAPE_USER.";
+$messages["sapeclient_settings_saved_ok"] = "Конфигурация SAPE Клиента успешно сохранена !";
+?>
Added: plugins/branches/lifetype-1.2/sapeclient/pluginsapeclient.class.php
===================================================================
--- plugins/branches/lifetype-1.2/sapeclient/pluginsapeclient.class.php (rev 0)
+++ plugins/branches/lifetype-1.2/sapeclient/pluginsapeclient.class.php 2008-11-19 15:42:20 UTC (rev 6743)
@@ -0,0 +1,78 @@
+<?php
+
+ lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+
+ /**
+ * offers features to insert SAPE codes in template.
+ */
+ class PluginSapeClient extends PluginBase
+ {
+ var $pluginEnabled;
+ var $sapeuser;
+ var $sape;
+
+ function PluginSapeClient( $source = "" )
+ {
+ $this->PluginBase($source);
+
+ $this->id = "sapeclient";
+ $this->author = "ModernStudio";
+ $this->desc = "This plugin offers features to insert SAPE codes in template";
+ $this->version = "20081112";
+
+ $this->locales = Array( "en_UK" , "ru_RU" );
+
+ if( $source == "admin" )
+ $this->initAdmin();
+ }
+
+ function initAdmin()
+ {
+ $this->registerAdminAction( "sapeclient", "PluginSapeClientConfigAction" );
+ $this->registerAdminAction( "updatesapeclient", "PluginSapeClientUpdateConfigAction" );
+
+ $menu =& Menu::getMenu();
+ $this->addMenuEntry( "/menu/controlCenter/manageSettings", "SapeClient", "?op=sapeclient");
+ }
+
+ function register()
+ {
+ $blogSettings = $this->blogInfo->getSettings();
+ $this->pluginEnabled = $blogSettings->getValue( "plugin_sapeclient_enabled" );
+ $this->sapeuser = $blogSettings->getValue( "plugin_sapeclient_sapeuser" );
+
+ }
+
+ function isEnabled()
+ {
+ return $this->pluginEnabled;
+ }
+
+ /**
+ * Returns sape code
+ */
+ function getSapeLinks($n=0){
+ $sapeCode = "";
+ $n = intval($n);
+ if ($n > 5) {
+ $n = 5;
+ }
+ if( $this->isEnabled() ){
+ define('_SAPE_USER', $this->sapeuser);
+ require_once($_SERVER['DOCUMENT_ROOT']."/sape/sape.php");
+ $o['multi_site'] = true;
+ $o['host'] = $_SERVER['HTTP_HOST'];
+ $o['charset'] = 'UTF-8';
+ $sape = new SAPE_client($o);
+ if ($n) {
+ $sapeCode = $sape->return_links($n);
+ } else {
+ $sapeCode = $sape->return_links();
+ }
+ unset($o);
+ }
+ return $sapeCode;
+ }
+
+ }
+?>
Added: plugins/branches/lifetype-1.2/sapeclient/readme.txt
===================================================================
--- plugins/branches/lifetype-1.2/sapeclient/readme.txt (rev 0)
+++ plugins/branches/lifetype-1.2/sapeclient/readme.txt 2008-11-19 15:42:20 UTC (rev 6743)
@@ -0,0 +1,29 @@
+SAPE Client Plugin v0.1
+
+Based on Google Analytics plugin by lss.
+
+Description
+This plugin do 2 things.
+1.It offers a settings page in blog settings. Blogger can fill in his SAPE_USER code which can be found in his SAPE code settings.
+2.It offers a method call getSapeLinks returning SAPE links code which can be add to template file. A number of links could be specified (5 by default).
+
+Installation
+1. Unpack the plugin zip file to your lifetype plugins folder, then refresh browser in plugins center. You can find sapeclient plugin installed.
+2. Create directory named "sape" in the root of your LifeType installation
+3. Place standard SAPE script (sape.php) in this directory
+4. Provide write permissions for web-server on this directory
+
+Configuration
+1.Enter admin page, goto control center -> Sape Client.
+2.Enable this plugin and fill in you SAPE_USER code. You can find this code in SAPE code settings.
+
+Template
+Add template code below to any part of your template.
+
+{if $sapeclient}
+{$sapeclient->getSapeLinks(x)}
+{/if}
+
+where x - number of links
+
+Of course, you must get a SAPE account first.
Added: plugins/branches/lifetype-1.2/sapeclient/readme_ru.txt
===================================================================
--- plugins/branches/lifetype-1.2/sapeclient/readme_ru.txt (rev 0)
+++ plugins/branches/lifetype-1.2/sapeclient/readme_ru.txt 2008-11-19 15:42:20 UTC (rev 6743)
@@ -0,0 +1,34 @@
+SAPE Client Plugin v0.1
+
+При разработке использован код планина Google Analytics от lss.
+
+Description
+Этот плагин дает следующие возможности:
+1. Страница в параметрах блога. Блоггер имеет возможность задать параметр SAPE_USER, который можно найти в установках кода SAPE.
+2. Предоставляет метод getSapeLinks, который можно указать в файле шаблона, возвращающий ссылки SAPE для текущей страницы.
+При вызове метода можно указать количество выводимых ссылок (по умолчанию выводятся все).
+
+Установка
+1. Распакуйте архив плагина в директорию plugins вашей инсталляции LifeType, затем обновите в браузере страницу "Управление плагинами". Вы увидите,
+что плагин sapeclient установлен
+2. Создайте поддиректорию "sape" в корневой директории вашей инсталляции LifeType
+3. Скопируйте стандартный скрипт SAPE (sape.php) в эту поддиректорию
+4. Предоставьте веб-серверу права на запись в этой поддиректории
+
+Конфигурация
+1. Зайдите в Панель Администрирования -> Настройки -> Клиент SAPE.
+2. Включите плагин и заполните поле SAPE_USER. Вы можете найти SAPE_USER у установках вашего кода на сайте http://sape.ru.
+
+
+Шаблон
+Добавьте следующий код в любое место вашего шаблона.
+
+{dynamic}
+{if $sapeclient}
+{$sapeclient->getSapeLinks()}
+{/if}
+{/dynamic}
+
+В вызове можно использовать параметр: getSapeLinks(x), где x - количество отображаемых ссылок. Если x отсутствует, то выводятся все ссылки одним блоком. Не забудьте, что если вы показываете ссылки несколькими блоками, используя параметр "x", то последний вызов getSapeLinks() должен обязательно быть без параметра.
+
+Естественно, вы должны быть зарегистрированы как вебмастер на бирже ссылок Sape (http://sape.ru).
Added: plugins/branches/lifetype-1.2/sapeclient/templates/sapeclient.template
===================================================================
--- plugins/branches/lifetype-1.2/sapeclient/templates/sapeclient.template (rev 0)
+++ plugins/branches/lifetype-1.2/sapeclient/templates/sapeclient.template 2008-11-19 15:42:20 UTC (rev 6743)
@@ -0,0 +1,30 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=SapeClient title=$locale->tr("sapeclient_plugin")}
+<form name="sapeclientPluginConfig" method="post">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("label_configuration")}</legend>
+ {include file="$admintemplatepath/successmessage.template"}
+ {include file="$admintemplatepath/errormessage.template"}
+ <div class="field">
+ <label for="pluginEnabled">{$locale->tr("label_enable")}</label>
+ <span class="required"></span>
+ <div class="formHelp">
+ <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" />{$locale->tr("sapeclient_plugin_enabled")}
+ </div>
+ </div>
+
+ <div class="field">
+ <label for="sapeuser">{$locale->tr("label_sapeuser")}</label>
+ <span class="required">*</span>
+ <div class="formHelp">{$locale->tr("sapeclient_sapeuser")}</div>
+ <input class="text" type="text" name="sapeuser" id="sapeuser" value="{$sapeuser}" width="20" />
+ </div>
+ </div>
+ <div class="buttons">
+ <input type="hidden" name="op" value="updatesapeclient" />
+ <input type="reset" name="{$locale->tr("reset")}" />
+ <input type="submit" name="{$locale->tr("update_settings")}" value="{$locale->tr("update")}" />
+ </div>
+</form>
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}
More information about the pLog-svn
mailing list