[pLog-svn] r7227 - in plog/branches/lifetype-1.2/plugins: . fixyoutube fixyoutube/class fixyoutube/class/action fixyoutube/locale
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Tue Oct 23 06:59:39 EDT 2018
Author: jondaley
Date: 2018-10-23 06:59:38 -0400 (Tue, 23 Oct 2018)
New Revision: 7227
Added:
plog/branches/lifetype-1.2/plugins/fixyoutube/
plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginfixyoutubeaction.class.php
plog/branches/lifetype-1.2/plugins/fixyoutube/pluginfixyoutube.class.php
Removed:
plog/branches/lifetype-1.2/plugins/fixyoutube/backgrounds/
plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginauthimageconfigaction.class.php
plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginauthimageshowaction.class.php
plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginauthimageupdateconfigaction.class.php
plog/branches/lifetype-1.2/plugins/fixyoutube/class/authimage/
plog/branches/lifetype-1.2/plugins/fixyoutube/class/security/
plog/branches/lifetype-1.2/plugins/fixyoutube/class/view/
plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_de_DE.php
plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_es_ES.php
plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_zh_CN.php
plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_zh_TW.php
plog/branches/lifetype-1.2/plugins/fixyoutube/pluginauthimage.class.php
plog/branches/lifetype-1.2/plugins/fixyoutube/templates/
Modified:
plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_en_UK.php
plog/branches/lifetype-1.2/plugins/fixyoutube/readme.txt
Log:
this is a hacky plugin, but it gets the job done
Deleted: plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginauthimageconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/authimage/class/action/pluginauthimageconfigaction.class.php 2015-12-18 03:59:59 UTC (rev 7222)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginauthimageconfigaction.class.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -1,28 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
- lt_include( PLOG_CLASS_PATH."plugins/authimage/class/view/pluginauthimageconfigview.class.php" );
-
- /**
- * shows a form with the current configuration
- */
- class PluginAuthImageConfigAction extends AdminAction
- {
-
- function PluginAuthImageConfigAction( $actionInfo, $request )
- {
- $this->AdminAction( $actionInfo, $request );
-
- $this->requirePermission( "manage_plugins" );
- }
-
- function perform()
- {
- $this->_view = new PluginAuthImageConfigView( $this->_blogInfo );
-
- $this->setCommonData();
-
- return true;
- }
- }
-?>
\ No newline at end of file
Deleted: plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginauthimageshowaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/authimage/class/action/pluginauthimageshowaction.class.php 2015-12-18 03:59:59 UTC (rev 7222)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginauthimageshowaction.class.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -1,27 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
- lt_include( PLOG_CLASS_PATH."class/view/plugintemplatedview.class.php");
-
- /**
- * shows a flickr template without smarty cache
- */
- class PluginAuthImageShowAction extends BlogAction
- {
-
- function PluginAuthImageShowAction( $actionInfo, $request )
- {
- $this->BlogAction( $actionInfo, $request );
- }
-
- function perform()
- {
- $this->_view = new PluginTemplatedView( $this->_blogInfo, "authimage", "authimageshow", SMARTY_VIEW_CACHE_DISABLED );
- $this->_view->setValue( "request", $this->_request );
- // add all the common information to the view
- $this->setCommonData();
-
- return true;
- }
- }
-?>
\ No newline at end of file
Deleted: plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginauthimageupdateconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/authimage/class/action/pluginauthimageupdateconfigaction.class.php 2015-12-18 03:59:59 UTC (rev 7222)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginauthimageupdateconfigaction.class.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -1,94 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
- lt_include( PLOG_CLASS_PATH."plugins/authimage/class/view/pluginauthimageconfigview.class.php" );
-
-
- /**
- * updates the plugin configuration
- */
- class PluginAuthImageUpdateConfigAction extends AdminAction
- {
- var $_pluginEnabled;
- var $_length;
- var $_key;
- var $_expiredTime;
- var $_default;
-
- function PluginAuthImageUpdateConfigAction( $actionInfo, $request )
- {
- $this->AdminAction( $actionInfo, $request );
-
- $this->requirePermission( "manage_plugins" );
- }
-
- function validate()
- {
- $this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );
- $this->_pluginEnabled = ($this->_pluginEnabled != "" );
- $this->_length = $this->_request->getValue( "length" );
- if( $this->_length <= 0 || $this->_length > 6 || !ctype_digit($this->_length)) {
- $this->_view = new PluginAuthImageConfigView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("authimage_error_length"));
- $this->setCommonData();
-
- return false;
- }
- $this->_key = $this->_request->getValue( "key" );
- if( $this->_key == "" ) {
- $this->_view = new PluginAuthImageConfigView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("authimage_error_key"));
- $this->setCommonData();
-
- return false;
- }
- $this->_expiredTime = $this->_request->getValue( "expiredTime" );
- if( $this->_expiredTime < 0 || $this->_expiredTime > 86400 || !ctype_digit($this->_expiredTime) ) {
- $this->_view = new PluginAuthImageConfigView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("authimage_error_expiredtime"));
- $this->setCommonData();
-
- return false;
- }
- $this->_default = $this->_request->getValue( "default" );
-
- return true;
- }
-
- function perform()
- {
- // // update the plugin configurations to blog setting
- $blogSettings = $this->_blogInfo->getSettings();
- $blogSettings->setValue( "plugin_authimage_enabled", $this->_pluginEnabled );
- $blogSettings->setValue( "plugin_authimage_length", $this->_length );
- $blogSettings->setValue( "plugin_authimage_key", $this->_key );
- $blogSettings->setValue( "plugin_authimage_expiredtime", $this->_expiredTime );
- $blogSettings->setValue( "plugin_authimage_default", $this->_default );
- $this->_blogInfo->setSettings( $blogSettings );
-
- // save the blogs settings
- $blogs = new Blogs();
- if( !$blogs->updateBlog( $this->_blogInfo )) {
- $this->_view = new PluginAuthImageConfigView( $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 PluginAuthImageConfigView( $this->_blogInfo );
- $this->_view->setSuccessMessage( $this->_locale->tr("authimage_settings_saved_ok"));
- $this->setCommonData();
-
- // clear the cache
- CacheControl::resetBlogCache( $this->_blogInfo->getId());
-
- return true;
- }
- }
-?>
\ No newline at end of file
Copied: plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginfixyoutubeaction.class.php (from rev 7222, plugins/branches/lifetype-1.2/authimage/class/action/pluginauthimageconfigaction.class.php)
===================================================================
--- plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginfixyoutubeaction.class.php (rev 0)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/class/action/pluginfixyoutubeaction.class.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -0,0 +1,48 @@
+<?php
+
+lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+lt_include( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
+lt_include( PLOG_CLASS_PATH.'class/dao/articles.class.php' );
+
+class PluginFixYoutubeAction extends AdminAction
+{
+
+ function PluginFixYoutubeAction( $actionInfo, $request )
+ {
+ $this->AdminAction( $actionInfo, $request );
+ $this->requirePermission( "manage_plugins" );
+ }
+
+ function perform()
+ {
+ $this->_view = new AdminErrorView($this->_blogInfo);
+ $this->setCommonData();
+
+ $articles = new Articles();
+ $blogArticles = $articles->getBlogArticles($this->_blogInfo->getId());
+
+ foreach($blogArticles as $blogArticle){
+ $text = $blogArticle->getText();
+ if(strpos($text, "youtube.com") === false)
+ continue;
+ if(strpos($text, "<object") === false)
+ continue;
+
+ print $blogArticle->_id."\n";
+ $new = preg_replace('/<object.*youtube.com\/v\/([0-9a-zA-Z-]*).*?<\/object>/s',
+ '<iframe width="425" height="355" src="https://www.youtube.com/embed/$1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>',
+ $text);
+ if($new){
+ $blogArticle->setText($new);
+ $articles->updateArticleText( $blogArticle );
+ }
+ else{
+ $this->_view->setMessage("No text found in article after attempted replacement??");
+ break;
+ }
+ }
+ $this->_view->setMessage("Success! All articles were converted to the new format.");
+
+ return true;
+ }
+}
Deleted: plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_de_DE.php
===================================================================
--- plugins/branches/lifetype-1.2/authimage/locale/locale_de_DE.php 2015-12-18 03:59:59 UTC (rev 7222)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_de_DE.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -1,29 +0,0 @@
-<?php
-$messages["manageAntiSpamPlugins"] = "Anti Spam Management";
-$messages["AuthImage"] = "AuthImage";
-$messages["authimage_code"] = "Authentifizierung";
-
-$messages["authimage_length"] = "Länge des Authentifizierung-Code";
-$messages["authimage_key"] = "Authentifizierung-Code verschlüsseln mit";
-$messages["authimage_default"] = "Hintergrund";
-$messages["authimage_background_name"] = "Name";
-$messages["authimage_background_image"] = "Image";
-$messages["authimage_plugin_enabled"] = "Dieses Plugin aktivieren";
-$messages["authimage_plugin"] = "AuthImage Plugin";
-
-$messages["authimage_error_length"] = "Die Schlüssellänge sollte zwischen 1 and 6 liegen";
-$messages["authimage_error_key"] = "Der Authentifizierung-Code Schlüssel darf nicht leer sein!";
-
-$messages["authimage_settings_saved_ok"] = "AuthImage Einstellungen erfolgreich gespeichert!";
-
-$messages["error_you_have_been_blocked"] = "Leider können wir Ihre Anfrage nicht bearbeiten.";
-$messages["error_authimage_code"] = "Der eingegebene Authentifizierung-Code stimmt mit dem dargestellten Code überein. Bitte gehen Sie zurück und überprüfen Sie Ihre Eingabe.";
-
-$messages["label_configuration"] = "Konfiguration";
-$messages["label_enable"] = "Aktivieren";
-$messages["label_length"] = "Länge";
-$messages["label_key"] = "Schlüssel";
-$messages["label_default"] = "Einstellungen";
-
-$messages["authimage_type_code"] = 'Bitte geben Sie den unten eingeblendeten Code ein:';
-?>
Modified: plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.2/authimage/locale/locale_en_UK.php 2015-12-18 03:59:59 UTC (rev 7222)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_en_UK.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -1,33 +1,2 @@
<?php
-$messages["manageAntiSpamPlugins"] = "Anti Spam Management";
-$messages["AuthImage"] = "AuthImage";
-$messages["authimage_code"] = "Authentication";
-
-$messages["authimage_length"] = "Authentication Code Length";
-$messages["authimage_key"] = "Authentication Code Encryption Key";
-$messages["authimage_expiredtime"] = "Authentication Code Expired Time";
-$messages["authimage_default"] = "Choose Default AuthImage Background";
-$messages["authimage_background_name"] = "Name";
-$messages["authimage_background_image"] = "Image";
-$messages["authimage_plugin_enabled"] = "Enable this plugin";
-$messages["authimage_plugin"] = "AuthImage Plugin";
-
-$messages["authimage_error_length"] = "Length should be between 1 and 6";
-$messages["authimage_error_key"] = "Encryption Key can not be empty!";
-$messages["authimage_error_expiredtime"] = "The expired time must be >= 0 seconds and <= 86400 seconds (Suggest minimal value is 1800 seconds).";
-
-$messages["authimage_settings_saved_ok"] = "AuthImage settings saved successfully!";
-
-$messages["error_you_have_been_blocked"] = "Thank you! However, there was a problem processing your request.";
-
-$messages["error_authimage_code"] = "The authentication code is wrong.";
-
-$messages["label_configuration"] = "Configuration";
-$messages["label_enable"] = "Enable";
-$messages["label_lengthx"] = "Length";
-$messages["label_key"] = "Key";
-$messages["label_expiredtime"] = "Expired Time";
-$messages["label_default"] = "Default";
-
-$messages["authimage_type_code"] = 'Please type the code you can see here:';
-?>
+$messages["fixyoutube"] = "Fix/Update YouTube videos";
Deleted: plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_es_ES.php
===================================================================
--- plugins/branches/lifetype-1.2/authimage/locale/locale_es_ES.php 2015-12-18 03:59:59 UTC (rev 7222)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_es_ES.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -1,36 +0,0 @@
-<?php
-
-// Translation by Andres Bianciotto plog at a-b.com.ar
-// Date 09/Apr/2005
-// Added authimage_html_label for template label translation
-
-$messages["manageAntiSpamPlugins"] = "Anti Spam";
-$messages["AuthImage"] = "AuthImage";
-$messages["authimage_code"] = "Autenticación";
-
-$messages["authimage_html_label"] = "Código de seguridad";
-
-$messages["authimage_length"] = "Longitud del código identificador";
-$messages["authimage_key"] = "Clave de encrpición";
-$messages["authimage_default"] = "Elige un background default";
-$messages["authimage_background_name"] = "Nombre";
-$messages["authimage_background_image"] = "Imagen";
-$messages["authimage_plugin_enabled"] = "Activar este plugin";
-$messages["authimage_plugin"] = "Plugin AuthImage";
-
-$messages["authimage_error_length"] = "La longitud debe estar entre 1 y 6";
-$messages["authimage_error_key"] = "La Clave de enctripción no puede quedar vacía!";
-
-$messages["authimage_settings_saved_ok"] = "La configuración se guardó correctamente";
-
-$messages["error_you_have_been_blocked"] = "Esta solicitud ha sido bloqueada.";
-$messages["error_authimage_code"] = "El código de seguridad no es correcto.";
-
-$messages["label_configuration"] = "Configuración";
-$messages["label_enable"] = "Activar";
-$messages["label_lengthx"] = "Longitud";
-$messages["label_key"] = "Clave";
-$messages["label_default"] = "Default";
-
-$messages["authimage_type_code"] = 'Por favor introduzca el texto de la imagen:';
-?>
Deleted: plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_zh_CN.php
===================================================================
--- plugins/branches/lifetype-1.2/authimage/locale/locale_zh_CN.php 2015-12-18 03:59:59 UTC (rev 7222)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_zh_CN.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -1,29 +0,0 @@
-<?php
-$messages["manageAntiSpamPlugins"] = "鲿¢åå¾å¹²æ°ç®¡ç";
-$messages["AuthImage"] = "åå¤éªè¯è®¾ç½®";
-$messages["authimage_code"] = "éªè¯ç ";
-
-$messages["authimage_length"] = "éªè¯ç çé¿åº¦";
-$messages["authimage_key"] = "éªè¯ç çç¼ç å
³é®å";
-$messages["authimage_default"] = "éæ©é¢è®¾èæ¯å¾";
-$messages["authimage_background_name"] = "èæ¯åç§°";
-$messages["authimage_background_image"] = "èæ¯å¾è±¡";
-$messages["authimage_plugin_enabled"] = "å¯ç¨æä»¶";
-$messages["authimage_plugin"] = "åå¤éªè¯æä»¶";
-
-$messages["authimage_error_length"] = "é¿åº¦å¿
é¡»ä»äº1å°6ä¹é´ã";
-$messages["authimage_error_key"] = "ç¼ç å
³é®åé误ï¼ä¸å¯ç©ºç½ã";
-
-$messages["authimage_settings_saved_ok"] = "åå¤éªè¯è®¾ç½®å¨åæåã";
-
-$messages["error_you_have_been_blocked"] = "对ä¸èµ·ï¼æ¨æè¦è¿è¡çæä½æ æ³æ§è¡ã";
-$messages["error_authimage_code"] = "æ¨çåå¤éªè¯ç è¾å
¥æè¯¯ï¼è¯·æ£æ¥åéè¯ã";
-
-$messages["label_configuration"] = "设置";
-$messages["label_enable"] = "å¯ç¨";
-$messages["label_length"] = "é¿åº¦";
-$messages["label_key"] = "ç¼ç å
³é®å";
-$messages["label_default"] = "é»è®¤";
-
-$messages["authimage_type_code"] = 'Please type the code you can see here:';
-?>
Deleted: plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_zh_TW.php
===================================================================
--- plugins/branches/lifetype-1.2/authimage/locale/locale_zh_TW.php 2015-12-18 03:59:59 UTC (rev 7222)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/locale/locale_zh_TW.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -1,32 +0,0 @@
-<?php
-$messages["manageAntiSpamPlugins"] = "é²å¶åå¾å¹²æ¾ç®¡ç";
-$messages["AuthImage"] = "è¿´é¿é©èè¨å®";
-$messages["authimage_code"] = "é©è碼";
-
-$messages["authimage_length"] = "é©è碼çé·åº¦";
-$messages["authimage_key"] = "é©è碼ç編碼é°å";
-$messages["authimage_expiredtime"] = "é©èç¢¼çæ«åæªæææé";
-$messages["authimage_default"] = "鏿é è¨èæ¯å";
-$messages["authimage_background_name"] = "æªå";
-$messages["authimage_background_image"] = "åå";
-$messages["authimage_plugin_enabled"] = "åå夿ç¨å¼";
-$messages["authimage_plugin"] = "è¿´é¿é©è夿ç¨å¼";
-
-$messages["authimage_error_length"] = "é·åº¦å¿
é 仿¼ 1 å° 6 ä¹éã";
-$messages["authimage_error_key"] = "編碼é°åé¯èª¤ï¼ä¸å¯ç©ºç½ã";
-$messages["authimage_error_expiredtime"] = "æ«åæªæææéçº 0 ç§å° 86400 ç§ï¼å»ºè°ä¸è¦å°æ¼ 1800 ç§ï¼ã";
-
-$messages["authimage_settings_saved_ok"] = "è¿´é¿é©èè¨å®å²åæåã";
-
-$messages["error_you_have_been_blocked"] = "æ±æï¼ä½ æè¦æ±çåä½ç¡æ³ç¹¼çºã";
-$messages["error_authimage_code"] = "æ¨çè¿´é¿é©è碼輸å
¥é¯èª¤ã";
-
-$messages["label_configuration"] = "è¨å®";
-$messages["label_enable"] = "åå";
-$messages["label_length"] = "é·åº¦";
-$messages["label_key"] = "編碼é°å";
-$messages["label_expiredtime"] = "æ«å";
-$messages["label_default"] = "é è¨";
-
-$messages["authimage_type_code"] = 'é©è碼';
-?>
Deleted: plog/branches/lifetype-1.2/plugins/fixyoutube/pluginauthimage.class.php
===================================================================
--- plugins/branches/lifetype-1.2/authimage/pluginauthimage.class.php 2015-12-18 03:59:59 UTC (rev 7222)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/pluginauthimage.class.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -1,193 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
-
- define( "AUTHIMAGE_FILE", "/plugins/authimage/authimage.php" );
- define( "AUTHIMAGE_BACKGROUND_FOLDER", PLOG_CLASS_PATH."plugins/authimage/backgrounds/" );
-
- /**
- * Plugin that offers comment authentication image for current blog
- * Original Author: Gudlyf http://www.gudlyf.com/index.php?p=376
- * Modified by: Mark Wu
- */
- class PluginAuthImage extends PluginBase
- {
- var $pluginEnabled;
- var $default;
- var $cacheFolder;
-
- function PluginAuthImage( $source = "" )
- {
- $this->PluginBase( $source );
-
- $this->id = "authimage";
- $this->author = "Mark Wu";
- $this->desc = 'This plugin offers extra comment authentication for LifeType.';
- $this->version = "20100113";
-
- $this->locales = Array( "en_UK" , "zh_TW" , "zh_CN", "es_ES", "de_DE" );
-
- if( $source == "admin" )
- $this->initAdmin();
- else
- $this->init();
- }
-
- function init()
- {
- lt_include(PLOG_CLASS_PATH."plugins/authimage/class/security/authimagefilter.class.php");
- // register the filter
- $this->registerFilter( "AuthImageFilter" );
- $this->registerBlogAction( "AuthImageShow", "PluginAuthImageShowAction" );
- }
-
- function initAdmin()
- {
- $this->registerAdminAction( "authimage", "PluginAuthImageConfigAction" );
- $this->registerAdminAction( "updateAuthImageConfig", "PluginAuthImageUpdateConfigAction" );
-
- $menu =& Menu::getMenu();
- if( !$menu->entryExists( "/menu/controlCenter/manageAntiSpamPlugins" ))
- $this->addMenuEntry( "/menu/controlCenter", "manageAntiSpamPlugins", "", "" );
- $this->addMenuEntry( "/menu/controlCenter/manageAntiSpamPlugins", "AuthImage", "?op=authimage", "" );
- }
-
- function register()
- {
- $config =& Config::getConfig();
- $this->cacheFolder = $config->getValue('temp_folder');
- $this->cacheFolder = $this->cacheFolder.'/authimage/'.$this->blogInfo->getId();
- if( !File::exists( $this->cacheFolder )) {
- File::createDir( $this->cacheFolder );
- }
-
- $blogSettings = $this->blogInfo->getSettings();
- $this->pluginEnabled = $blogSettings->getValue( "plugin_authimage_enabled" );
- $this->length = $blogSettings->getValue( "plugin_authimage_length" );
- $this->key = $blogSettings->getValue( "plugin_authimage_key" );
- $this->expiredTime = $blogSettings->getValue( "plugin_authimage_expiredtime" );
- if ($this->expiredTime == "") $this->expiredTime = 3600;
- $this->default = $blogSettings->getValue( "plugin_authimage_default" );
- if( $this->default == "" )
- $this->default = "ocean.gif";
- }
-
- function isEnabled()
- {
- return $this->pluginEnabled;
- }
-
- function generateImageUrl()
- {
- lt_include( PLOG_CLASS_PATH."class/net/rawrequestgenerator.class.php" );
- $rg = new RawRequestGenerator($this->blogInfo);
-
- $rg->addParameter( "op", "AuthImageShow" );
- $rg->addParameter( "blogId", $this->blogInfo->getId());
-
- $imageUrl = $rg->getIndexUrl().$rg->getRequest();
-
- if ( !function_exists ('gd_info') ) {
- // We don't have gd support compiled in, lets inform the user about it
- return false;
- }
-
- return $imageUrl;
- }
-
- function show() {
- $authImageUrl = $this->generateImageUrl();
- if ( $authImageUrl )
- return '<img src="'.$authImageUrl.'" style="vertical-align:middle;" width="70px" height="20px" alt="authimage" />';
- else
- return 'You don\'t have GD support compiled in, we cannot create an authimage. Please activate GD Support.';
- }
-
- function showImage() {
- // Delete those cached authimage files that never used
- $this->deleteExpiredAuthImage($this->expiredTime);
-
- $code = $this->generateCode();
- $encrypt = $this->encrypt($code, $this->key);
- $background = AUTHIMAGE_BACKGROUND_FOLDER.$this->default;
- $tempFile = $this->cacheFolder."/".$encrypt.".gif";
-
- if(function_exists ( 'imagecreatefromgif' )){
- $image = @imagecreatefromgif($background) or die("Cannot Initialize new GD image stream");
- }
- else if(function_exists ( 'imagecreatefrompng' )){
- $image = @imagecreatefrompng($background) or die("Cannot Initialize new GD image stream");
- } else {
- die("Server doesn't support GIF or PNG creation. Sorry.");
- }
-
- $textColor = imageColorAllocate($image, 0x00, 0x00, 0x00);
- ImageString($image, 5, 7, 2, $code, $textColor);
-
- if ( !function_exists ( 'ImageGIF' ) ) {
- ImagePNG($image, $tempFile);
- } else {
- ImageGIF($image, $tempFile);
- }
- $temp = fopen($tempFile,"rb");
- $buffer = fread($temp,filesize($tempFile));
- fclose($temp);
-
- // Now zero-length the file. No need for its content anymore.
- $temp = fopen($tempFile,"w");
- fwrite($temp, NULL);
- fclose($temp);
-
- // Now chmod it so it can be deleted later by the user
- chmod($tempFile, 0666);
-
- header("Content-type: image/gif");
- echo $buffer;
- }
-
- // encrypt string
- function encrypt($string, $key) {
- $plainText = $string.$key;
- $encodeText = md5($plainText);
- return $encodeText;
- }
-
- function generateCode() {
- $code = "";
- for($i=0; $i < $this->length; $i++) $code .= rand(0,9);
- return $code;
- }
-
- function deleteExpiredAuthImage( $expiretime ) {
- $path = $this->cacheFolder;
- if ( is_dir($path) )
- {
- $handle=opendir($path);
- while (false!==($file = readdir($handle))) {
- if ($file != "." && $file != "..") {
- $diff = time() - filectime("$path/$file");
- if ($diff > $expiretime) unlink("$path/$file");
- }
- }
- closedir($handle);
- }
- }
-
- function getPluginConfigurationKeys()
- {
- lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
- lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
-
- return( Array(
- Array( "name" => "plugin_authimage_enabled", "type" => "boolean" ),
- Array( "name" => "plugin_authimage_length", "validator" => new IntegerValidator(), "type" => "integer", "allowEmpty" => true ),
- Array( "name" => "plugin_authimage_key", "validator" => new StringValidator(), "type" => "string", "allowEmpty" => true ),
- Array( "name" => "plugin_authimage_expiredtime",
- "validator" => new IntegerValidator(),
- "type" => "integer",
- "allowEmpty" => true ),
- ));
- }
- }
-
-?>
Copied: plog/branches/lifetype-1.2/plugins/fixyoutube/pluginfixyoutube.class.php (from rev 7222, plugins/branches/lifetype-1.2/authimage/pluginauthimage.class.php)
===================================================================
--- plog/branches/lifetype-1.2/plugins/fixyoutube/pluginfixyoutube.class.php (rev 0)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/pluginfixyoutube.class.php 2018-10-23 10:59:38 UTC (rev 7227)
@@ -0,0 +1,32 @@
+<?php
+
+lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+
+ /**
+ * Plugin that offers comment authentication image for current blog
+ * Original Author: Gudlyf http://www.gudlyf.com/index.php?p=376
+ * Modified by: Mark Wu
+ */
+class PluginFixYoutube extends PluginBase
+{
+ function PluginFixYoutube($source = ""){
+ $this->PluginBase( $source );
+
+ $this->id = "fixyoutube";
+ $this->author = "Jon Daley";
+ $this->desc = 'This plugin fixes old youtube embedded videos (<object>) and replaces them with the new format (<iframe>)';
+ $this->version = "20181023";
+
+ $this->locales = Array( "en_UK" );
+
+ if( $source == "admin" )
+ $this->initAdmin();
+ }
+
+ function initAdmin(){
+ $this->registerAdminAction( "fixYoutube", "PluginFixYoutubeAction" );
+
+ $this->addMenuEntry( "/menu/controlCenter/manageSettings", "fixyoutube",
+ "admin.php?op=fixYoutube");
+ }
+}
Modified: plog/branches/lifetype-1.2/plugins/fixyoutube/readme.txt
===================================================================
--- plugins/branches/lifetype-1.2/authimage/readme.txt 2015-12-18 03:59:59 UTC (rev 7222)
+++ plog/branches/lifetype-1.2/plugins/fixyoutube/readme.txt 2018-10-23 10:59:38 UTC (rev 7227)
@@ -1,22 +1,8 @@
-Plugin: AuthImage
-Author: Mark Wu
-Idea From: Gudlyf
-Release Date: 2005/02/15
+Plugin: FixYoutube
+Author: Jon Daley
+Release Date: 2018/10/23
Version: 1.0
-This plugin offers extra comment authentication for LifeType. The idea is inspired by <a href="http://www.gudlyf.com/index.php?p=376">WordPress AuthImage Plugin</a> written by Gudlyf.
-
-In order to use, simply include the following:
-1. $authimage->isEnabled() to check the plugin is enabled or not.
-2. $authimage->show() to get the authentication image.
-
-Install:
-Add the following code to commentform.template:
-{if $authimage && $authimage->isEnabled()}
-<div>
- <label for="authImage">{$locale->tr("authimage_type_code")}</label>
- <input type="text" name="authImage" id="authImage" value="" /> {$authimage->show()}
-</div>
-{/if}
-
-You can add your own default background image to /plugin/authimage/backgrounds. This plugin only support GIF format currently.
+This plugin goes through the database and replaces all old youtube
+embedded video format <object> tags with the new version with <iframe>
+tags.
More information about the pLog-svn
mailing list