Hey everyone,
as the pencils down for this years GSOC is approaching I thought it’s time to write another blog entry to notify the world about my current status.
These past weeks (boy, the time flies…) I’ve mostly spent on hardcore KDevplatform internals. Especially getting multiple languages in a single document working was not easy. I knew it would be the most time consuming and most demanding aspect during these three months, but also by far the most important. I’m confident to say now: I’m nearly there. All projects we put into the KDevelop repository have now a multilang branch in their team clones. And if you look at e.g. the KDevplatform multilang branch or the Quanta multilang branch you hopefully agree that I didn’t slack off too much. I just wasted some time to find the right approach, often by implementing one just to find out it was not practicable.
continue reading...
Yay I got a GSOC slot :)
So I hope I don’t have to introduce myself anymore to you guys. Instead I’ll show you what I’ve planned to do over the summer:
Motivation for Proposal / Goal:
Back in KDE 3 times, Quanta+ was one of the reasons for me to use KDE. In my eyes it was the IDE for web development out there, and I loved to use it. Sadly it’s bitrotting nowadays without a finished KDE 4 port. That, combined with the fact that more and more distributions drop all KDE 3 packages, makes the need for a port more urgent than ever.
Implementation Details:
Thankfully, KDevelop 4 is nearing it’s first release and the KDevplatform is mature enough nowadays. This means that during summer I shall finish the port of Quanta+ to KDevplatform and supply it with all the plugins required for a proper webdevelopment IDE. My goal is it to provide a proper IDE for PHP webdevelopment. In more detail:
- make Quanta+ 4 compile
- remove obsolete plugins or code parts in Quanta+
- port required plugins to KDevplatform structure
- polish PHP plugin, including XDebug support
- polish Script Execute plugin
- polish CSS plugin
- get a first working version of a XHTML/XML plugin, if time allows even with HTML (SGML) support
- support autocompletion
- support inline validation
- support documents that use multiple languages (XML, PHP, CSS, JavaScript) at the same time
- polish the UI/Workflow for Webdevelopment
- hide KDevelop/C++ specific actions
- add templates for common PHP frameworks
- if time allows, get a rough support for JavaScript (at least Outline for functions)
continue reading...
Not only KDevelop gets better and better PHP support — the Kate PHP syntax file also got a few new features and fixes over the last weeks. The good thing is of course that all users of KWrite, Kate, Quanta, KDevelop and other editors leveraging the Katepart benefit from these changes.
Improved HereDocs
screenshot of improved highlighting in PHP heredocs
I went over PHP related bugs on bugs.kde.org today and spotted one that was fairly easy to fix:
continue reading...
If you cut a html-formatted string at some random position (e.g. with my truncate()
function) you might mess up the html. To circumvent that, this function will close all open tags at the end of the string:
The original function was written by connum at DONOTSPAMME dot googlemail dot com
/**
* close all open xhtml tags at the end of the string
*
* @param string $html
* @return string
* @author Milian Wolff <mail@milianw.de>
*/
function closetags($html) {
#put all opened tags into an array
preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result);
$openedtags = $result[1];
#put all closed tags into an array
preg_match_all('#</([a-z]+)>#iU', $html, $result);
$closedtags = $result[1];
$len_opened = count($openedtags);
# all tags are closed
if (count($closedtags) == $len_opened) {
return $html;
}
$openedtags = array_reverse($openedtags);
# close tags
for ($i=0; $i < $len_opened; $i++) {
if (!in_array($openedtags[$i], $closedtags)){
$html .= '</'.$openedtags[$i].'>';
} else {
unset($closedtags[array_search($openedtags[$i], $closedtags)]);
}
}
return $html;
}
continue reading...
If you write a CMS you will have to truncate your contents to automagically create summaries. The following function will do the job:
If you write a given string (default '<!--MORE-->'
) inside one of your contents, the text will be truncated to that position.
Else the function looks for the nearest word boundary after at least $len
characters and cuts there. Because that might be directly inside your text $append
will be appended. To prevent that the markup is messed up, closetags()
is called.
/**
* if $splitter is found inside the $str, everything before $splitter will be
* returned.
* else truncates $str after $length chars (actually at the nearest
* word boundary after at least $len characters). Also $append will be added to
* $str
*
* @param string &$str
* @param integer $length
* @param optional string $hardbreak
* @param optional string $append
* @return string
* @author Milian Wolff <mail@milianw.de>
*/
function truncate($str, $len = 200, $splitter = '<!--MORE-->', $append = '…') {
if (strlen($str) <= $len) {
return $str;
}
if ($len > 0 && !strstr($str, $splitter)) {
preg_match('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.$len.',}\b#U', $str, $matches);
$str = $matches[0];
# remove trailing opener tags and close all other open tags:
$str = closetags(preg_replace('#\s*<[^>]+>?\s*$#', '', $str).$append);
} else {
$arr = explode($splitter, $str, 2);
$str = $arr[0];
}
return $str;
}
continue reading...