1 sean_cz Jan 16, 2007 13:57
3 sean_cz Jan 22, 2007 14:08
¥åßßå wrote:
Hi,
Have you managed to solve your problem with this plugin yet?
¥
Hi .. I still need help to solve this. If you can help me, your help will be appreciated.
4 sean_cz Jan 22, 2007 17:22
I made some small mods of this plugin so this is actual code:
<?php
/*
* Texy! plugin for b2evolution
* ----------------------------
* http://www.texy.info
*
* Copyright (c) David Grudl, 2005
*
* This will allow you to type up items using Texy! (www.texy.info).
*
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
/**
* Includes:
*/
require_once dirname(__FILE__).'/texy_plugin/texy-compact.php';
require_once dirname(__FILE__).'/texy_plugin/fshl/fshl.php';
/**
* @package plugins
*/
class texy_plugin extends Plugin
{
var $code = 'b2Texy';
var $name = 'Texy!';
var $priority = 90;
var $version = '1.9-dev';
var $apply_rendering = 'opt-in';
var $short_desc;
var $long_desc;
var $texy;
var $cachePath;
var $enableSmilies = false;
var $enableFSHL = true;
/**
* Init
*/
function PluginInit( & $params )
{
$this->short_desc = T_('Texy! humane formatting');
$this->long_desc = T_('No description available' );
$this->cachePath = dirname(__FILE__) . '/texy_plugin/cache/';
$this->texy = &new Texy();
$this->texy->utf = true;
# classes for left- or right- aligned images
$this->texy->imageModule->leftClass = 'left';
$this->texy->imageModule->rightClass = 'right';
# definition for image root
$this->texy->imageModule->root = '';
$this->texy->imageModule->linkedRoot = '';
$this->texy->headingModule->top = 1;
if ($this->enableSmilies) {
$this->texy->smiliesModule->allowed = true;
$this->texy->smiliesModule->root = ''; // ???
$this->texy->smiliesModule->class = 'smiley';
}
if ($this->enableFSHL && class_exists('fshlParser')) {
$this->texy->blockModule->codeHandler = array(&$this, 'callbackSyntaxHighlight');
}
}
// -------------------------------------------------------------
/**
* Perform rendering
*
* @param string content to render (by reference) / rendered content
* @param string Output format, see {@link format_to_output()}
* @return boolean true if we can render something for the required output format
*/
function RenderItemAsHtml( & $content, $format )
{
if( ! parent::RenderItemAsHtml( $content, $format ) ) {
// We cannot render the required format
return false;
}
$md5 = md5($content); // md5 is key for caching
// check, if cached file exists
$cacheFile = $this->cachePath . $md5 . '.html';
$cache = is_file($cacheFile) ? unserialize(file_get_contents($cacheFile)) : null;
if ($cache) { // read from cache
list($content, $this->texy->styleSheet) = $cache;
} else { // doesn't exists
$content = $this->texy->process($content);
if (is_writable($this->cachePath))
fwrite(fopen($cacheFile, 'w'),
serialize( array($content, $this->texy->styleSheet) )
);
}
}
// this is user callback function for processing inlin `code` or block @code
function callbackSyntaxHighlight(&$element)
{
$lang = strtoupper($element->lang);
if ($lang == 'JAVASCRIPT') $lang = 'JS';
if (in_array($lang, array('CPP', 'CSS', 'HTML', 'JAVA', 'PHP', 'JS', 'SQL'))) {
$parser = new fshlParser($element->texy->utf ? 'HTML_UTF8' : 'HTML', P_TAB_INDENT);
$element->setContent($parser->highlightString($lang, $element->content), true);
}
}
} // end class
/*
nolog */
?>
Problems with disabled plugins are solved .. Unfortunately Plugin is still nonfunctional and when I use it I got this message:
Warning: Missing argument 2 for renderitemashtml() in /www/snor/www/komunikatory/dev/plugins/_texy.plugin.php on line 80
Do you know what is wrong?
5 sean_cz Jan 22, 2007 17:39
And actual verison of Texy! plugin for b2evo 1.9 as an attachment of this post.
Basic English doc for Texy using is here: http://texy.info/en/
6 yabba Jan 23, 2007 16:53
function RenderItemAsHtml() now gets passed "$params" so you need to change at least this piece of your code:-
function RenderItemAsHtml( & $content, $format )
{
if( ! parent::RenderItemAsHtml( $content, $format ) ) {
// We cannot render the required format
return false;
}
$md5 = md5($content); // md5 is key for caching
to something like :-
function RenderItemAsHtml( & $params )
{
$content = $params['data'];
$md5 = md5($content); // md5 is key for caching
¥
7 sean_cz Jan 31, 2007 08:20
Unfortunately .. it still doesnt work .. d8-\
8 yabba Jan 31, 2007 11:15
Actually, your main problem is the html checker. Uninstall the current version of your plugin and delete the files from your plugins directory.
Then unzip the attached file and upload the texy_plugin folder to your plugins_folder (I've also moved texy.plugin.php inside the folder). Reinstall the plugin and see if it works as it should.
¥
9 sean_cz Feb 01, 2007 22:57
¥åßßå wrote:
Actually, your main problem is the html checker. Uninstall the current version of your plugin and delete the files from your plugins directory.
Then unzip the attached file and upload the texy_plugin folder to your plugins_folder (I've also moved texy.plugin.php inside the folder). Reinstall the plugin and see if it works as it should.
¥
Thank you very much .. Texy is fully functional now .. d8-D
Thank you again .. d8-D
10 sean_cz Mar 30, 2007 16:47
I have another one question. Is it possible to use texy plugin for formatting comments on my web? If some formatter have this solved, plz just give me a link and I will try to solve this. Thanks.
Hi,
Have you managed to solve your problem with this plugin yet?
¥