THANKS~
Insert some codes copied from another plugin php to over-wright the
old info.tags.
And put this function into a cron page, it works now. :)

function BOLTinfoClean($info, $args) {
        $before = count($info);
        $exists = implode(',', BOLTsearchPageList(Array()));
        foreach ($info as $p => $v) {
                $pp = BOLTutf2url($p);
                if (strpos(",$exists,", ",$pp,") === false) unset($info[$pp]);
                }
        $after = count($info);
//////////////////////////////
        $myFile = "pages/info.tags";
        $fh = fopen($myFile, 'w') or die("can't open file");
                foreach ($info as $p => $v) $out .= "$p: $v\n";
        fwrite($fh, $out);
        fclose($fh);
//////////////////////////////
        return "Info fields cleaned.\nBefore: $before, After: $after.";
        }


On 4月21日, 上午5時20分, The Editor <[email protected]> wrote:
> How about changing the code to this. Note the asterisks for the changed lines:
>
> function BOLTinfoClean($info, $args) {
>         $before = count($info);
>         $exists = implode(',', BOLTsearchPageList(Array()));
>         foreach ($info as $p => $v) {
> **              $pp = BOLTutf2url($p);
> **              if (strpos(",$exists,", ",$pp,") === false) unset($info[$p]);
>                 }
>         $after = count($info);
>         return "Info fields cleaned.\nBefore: $before, After: $after.";
>         }
>
> If this helps let me know and I will update the plugin. I haven't tested 
> it....
>
> Cheers,
> Dan
>
>
>
>
>
> On Mon, Apr 19, 2010 at 5:28 AM, Phoenix Wu <[email protected]> 
> wrote:
> > I found a solution in this extension -- infox(info extension)
> >http://www.boltwire.com/index.php?p=solutions.system.infox
>
> > There is a build-in clean function should be working.
> > function BOLTinfoClean($info, $args) {
> >        $before = count($info);
> >        $exists = implode(',', BOLTsearchPageList(Array()));
> >        foreach ($info as $p => $v) {
> >                if (strpos(",$exists,", ",$p,") === false) unset($info[$p]);
> >                }
> >        $after = count($info);
> >        return "Info fields cleaned.\nBefore: $before, After: $after.";
> >        }
> > But it seems have the unicode(utf-8) problem?
> > The return of strpos() will be wrong if the entry in info.tags
> > contains Chinese or Parentheses ()
> > Try to use mb_strpos() instead but still not working...
>
> --
> 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 
> athttp://groups.google.com/group/boltwire?hl=en.

-- 
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.

Reply via email to