On Mon, Mar 2, 2009 at 3:01 PM, Hans <[email protected]> wrote:
>
> 2009/3/2 The Editor <[email protected]>:
>
>> P.S. The fix on the end of target triggers the target command to strip
>> punctions (see commands.php). We could do space-to-hyphen here if we
>> wanted. Without the fix, spaces get converted to underscores in the
>> BOLTfixpageshortcuts function, and some punctuation triggers various
>> page name shortcuts. Or you get an invalid page name. Thinking about
>> it, those shortcuts could also be made configurable--see $rr1 and $rr2
>> in lines 1552-1553 in engine.php. That would be a nice hook into the
>> code.
>
> so apart from a new hook for making page name shortcuts configurable
> my request does not need any core changes, and all can be written as a
> "solution", yes?
I'm still not 100% sure the best approach. Currently in the target
command you have a configurable
$BOLTfixPage = array('"', "'", ',', '?', '!', ''','"');
which determines which characters to strip out. We should probably add
more... But no easy way to turn spaces to another character. Still,
this seems like the best place to do this, as this was the part
designed to convert human readable titles to proper page names. ie,
blogs and forums...
I could make the pageshortcuts function (engine.php) configurable
also, so it would be easy to change _ to - but I'm not sure that's the
best default behavior for non "fixed" pages.
This pageshortcuts function is really more a mini scripting language
for links and page shortcuts, etc. There are lot's of related issues
as everything as virtually every link in BoltWire runs through it. But
only forms with a target command can be fixed, so that's a more
special case scenario. One option is to leave the pageshortcuts
hardcoded, and then allow the $BOLTfixPage to be fully configurable
(ie, in and out). Or a second $BOLTfixSpace variable that could be set
with one extra str_replacement.
There's other possibilities... Just not 100% sure the best approach.
My current inclination is to simply change the target command in
commands.php to:
if (strpos($field, 'fix') !== false) {
global $BOLTfixPage, $BOLTfixSpace;
if (isset($BOLTfixPage)) $fix = $BOLTfixPage;
else $fix = array('"', "'", ',', '?', '!', ''','"');
$value = str_replace($fix, '', $value);
if (isset($BOLTfixSpace)) $value = str_replace(' ',
$BOLTfixSpace, $value);
}
If you like it, I'm willing to make the change. Or if we wanted to
make it the default behavior for target_fix commands, we could do...
if (strpos($field, 'fix') !== false) {
global $BOLTfixPage, $BOLTfixSpace;
if (isset($BOLTfixPage)) $fix = $BOLTfixPage;
else $fix = array('"', "'", ',', '?', '!', ''','"');
$value = str_replace($fix, '', $value);
if ($BOLTfixSpace != false) $value = str_replace(' ', '-',
$value);
}
I think I like this latter one a bit better... (We could also make the
$BOLTfixPage a full array of in's and out's). If we do it, do we
still really want to keep the space-to-underline in the page shortcuts
function? And/or make those replacements configurable? My fear is
these may be used in various plugins and even core scripts.
Configuring them differently might wreak havoc on a site... While the
target_fix command is pretty specific in it's uses... Much safer.
Just thinking out loud...
Cheers,
Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---