Looks like this expression a little buggy:

return strip_tags($return, '<script>');

It remove ALL promo text, not a only <script>,  IF some <script></
script> stand at the top of the post.





How to do something like this?

$return = str_replace( "/((<[\s\/]*script\b[^>]*>)([^>]*)(<\/script>))/
i", ' ', $return);

I guess it will be easy to do a quick str_replace for <script> tags.

On 7 июн, 05:53, Paul <[email protected]> wrote:
> Works excellent, many thanks!
>
> 2010/6/7, Arthus Erea <[email protected]>:
>
> > Just adding this line should work: (in the filter_ function, above the
> > return line).
>
> > $return = str_replace( "Click on pictures to enlarge", '', $return);
>
> > Hope this helps,
> > Arthus
>
> > On Jun 6, 2010, at 10:38 PM, Paul wrote:
>
> >> I know that Habari have a very friendly community, but it's
> >> interesting how soon you'll kick off me for a lot of stupid
> >> questions :-)
>
> >> Anyway, I'll try another one :-)
>
> >> There is some phrase... I use it under pictures, sound like "Click on
> >> picture to enlarge", but after filtering all pictures are disappear of
> >> course, leaving this text description alone and it looks strange
> >> without image :-)
>
> >> Is there any chance to filter exact phrase, like "Click on picture to
> >> enlarge" ?
>
> >> On 6 ÉÀÎ, 13:10, Paul <[email protected]> wrote:
> >>> It works! Thanks for help!
>
> >>> Habari ROCKS! :-)
>
> >>> On 6 ÉÀÎ, 12:56, Colin <[email protected]> wrote:
>
> >>>> That'll be it then.  Try changing your strip_tags line to look as
> >>>> follows:
>
> >>>> return strip_tags($return, '<script>');
>
> >>>> This should strip all tags except the <script> tags.
>
> >>>> HTH
> >>>> Colin
>
> >>>> On Sun, Jun 6, 2010 at 10:50 AM, Paul <[email protected]> wrote:
> >>>>> Yep, I have it too:
>
> >>>>>        public function filter_post_content_excerpt($return)
> >>>>>        {
> >>>>>                return strip_tags($return);
> >>>>>        }
>
> >>>>> I use "charcoal" as current theme.
>
> >>>>> On 6 ÉÀÎ, 12:02, Colin <[email protected]> wrote:
> >>>>>> Worked it out for me: in my theme.php where I can reproduce the issue,
> >>>>>> I have a filter_post_content_excerpt() method that further processes
> >>>>>> the content before it is displayed.  One of the things it does is
> >>>>>> passes the contents through php's strip_tags() method.  This removes
> >>>>>> the <script> tags and hence I see the problem.
>
> >>>>>> Check your themes and possibly plugins to see if you're using any of
> >>>>>> these methods that could be affecting excerpts text only.
>
> >>>>>> HTH
> >>>>>> Colin
>
> >>>>>> On Sun, Jun 6, 2010 at 9:54 AM, Colin <[email protected]> wrote:
> >>>>>>> Initial tests puts this down to something you're doing in your theme,
> >>>>>>> though I'm not sure what yet.  I can reproduce the issue with one of
> >>>>>>> my themes, but not another.
>
> >>>>>>> Will investigate further...
>
> >>>>>>> On Sun, Jun 6, 2010 at 9:43 AM, Paul <[email protected]> wrote:
> >>>>>>>> Yep, I use:
>
> >>>>>>>> Format::apply_with_hook_params( 'more', 'post_content_excerpt', '',
> >>>>>>>> 55, 1 );
>
> >>>>>>>> On 6 ÉÀÎ, 11:40, Colin <[email protected]> wrote:
> >>>>>>>>> Ignore me,  I think I've reproduced it.  You're probably just
> >>>>>>>>> using:
>
> >>>>>>>>>         Format::apply_with_hook_params( 'more',
> >>>>>>>>> 'post_content_excerpt', '', 60, 0);
>
> >>>>>>>>> ... or similar in your theme.php (as discussed earlier this week).
>
> >>>>>>>>> Will see what I can find :-)
>
> >>>>>>>>> On Sun, Jun 6, 2010 at 9:38 AM, Colin <[email protected]> wrote:
> >>>>>>>>>> Actually, how are you displaying the 'short text of "Previous
> >>>>>>>>>> Posts"'?
>
> >>>>>>>>>> On Sun, Jun 6, 2010 at 9:33 AM, Colin <[email protected]> wrote:
> >>>>>>>>>>> Hmmmm, either the script tags are being stripped or the code is
> >>>>>>>>>>> being
> >>>>>>>>>>> escaped to display rather than run.
>
> >>>>>>>>>>> This will need further investigating.
>
> >>>>>>>>>>> On Sun, Jun 6, 2010 at 9:15 AM, Paul <[email protected]> wrote:
> >>>>>>>>>>>> I use the jwmediaplayer plugin and it output such code:
>
> >>>>>>>>>>>> <script type="text/
> >>>>>>>>>>>> javascript">swfobject.registerObject("media-1bc5db37f31585926cfa9ba7cfc44568",
> >>>>>>>>>>>> "9.0.0", "http://localhost.com/user/plugins/jwmediaplayer/
> >>>>>>>>>>>> expressInstall.swf");</script>
>
> >>>>>>>>>>>> But in short text of "Previous Posts" I can see this:
>
> >>>>>>>>>>>> swfobject.registerObject("media-1bc5db37f31585926cfa9ba7cfc44568",
> >>>>>>>>>>>> "9.0.0", "http://localhost.com/user/plugins/jwmediaplayer/
> >>>>>>>>>>>> expressInstall.swf");
>
> >>>>>>>>>>>> On 6 ÉÀÎ, 11:06, Colin <[email protected]> wrote:
> >>>>>>>>>>>>> Hi Paul
>
> >>>>>>>>>>>>> Could you please elaborate further and provide an example of
> >>>>>>>>>>>>> what you
> >>>>>>>>>>>>> are doing and what you are getting as it's not clear from this
> >>>>>>>>>>>>> description.
>
> >>>>>>>>>>>>> Cheers,
> >>>>>>>>>>>>> Colin
>
> >>>>>>>>>>>>> On Sun, Jun 6, 2010 at 5:42 AM, Paul <[email protected]> wrote:
> >>>>>>>>>>>>>> And another one... :-)
>
> >>>>>>>>>>>>>> It seems that there is no proper filter in the format.php for
> >>>>>>>>>>>>>> such
> >>>>>>>>>>>>>> case:
>
> >>>>>>>>>>>>>> <script type="text/javascript">SOME_CODE</script>
>
> >>>>>>>>>>>>>> 'Cause I get the SOME_CODE in the Previous Posts output, under
> >>>>>>>>>>>>>> the
> >>>>>>>>>>>>>> main.
>
> >>>>>>>>>>>>>> --
> >>>>>>>>>>>>>> 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/habari-dev
>
> >>>>>>>>>>>>> --
> >>>>>>>>>>>>> Colin Seymour
> >>>>>>>>>>>>> Blog:http://colinseymour.co.uk
> >>>>>>>>>>>>> Tech Stuff:http://www.lildude.co.uk
> >>>>>>>>>>>>> Barefoot Running:http://barefootrunner.co.uk
> >>>>>>>>>>>>> IRC: lildude #habari
>
> >>>>>>>>>>>> --
> >>>>>>>>>>>> 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/habari-dev
>
> >>>>>>>>>>> --
> >>>>>>>>>>> Colin Seymour
> >>>>>>>>>>> Blog:http://colinseymour.co.uk
> >>>>>>>>>>> Tech Stuff:http://www.lildude.co.uk
> >>>>>>>>>>> Barefoot Running:http://barefootrunner.co.uk
> >>>>>>>>>>> IRC: lildude #habari
>
> >>>>>>>>>> --
> >>>>>>>>>> Colin Seymour
> >>>>>>>>>> Blog:http://colinseymour.co.uk
> >>>>>>>>>> Tech Stuff:http://www.lildude.co.uk
> >>>>>>>>>> Barefoot Running:http://barefootrunner.co.uk
> >>>>>>>>>> IRC: lildude #habari
>
> >>>>>>>>> --
> >>>>>>>>> Colin Seymour
> >>>>>>>>> Blog:http://colinseymour.co.uk
> >>>>>>>>> Tech Stuff:http://www.lildude.co.uk
> >>>>>>>>> Barefoot Running:http://barefootrunner.co.uk
> >>>>>>>>> IRC: lildude #habari
>
> >>>>>>>> --
> >>>>>>>> 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/habari-dev
>
> >>>>>>> --
> >>>>>>> Colin Seymour
> >>>>>>> Blog:http://colinseymour.co.uk
> >>>>>>> Tech Stuff:http://www.lildude.co.uk
> >>>>>>> Barefoot Running:http://barefootrunner.co.uk
> >>>>>>> IRC: lildude #habari
>
> >>>>>> --
> >>>>>> Colin Seymour
> >>>>>> Blog:http://colinseymour.co.uk
> >>>>>> Tech Stuff:http://www.lildude.co.uk
> >>>>>> Barefoot Running:http://barefootrunner.co.uk
> >>>>>> IRC: lildude #habari
>
> >>>>> --
> >>>>> 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/habari-dev
>
> >>>> --
> >>>> Colin Seymour
> >>>> Blog:http://colinseymour.co.uk
> >>>> Tech Stuff:http://www.lildude.co.uk
> >>>> Barefoot Running:http://barefootrunner.co.uk
> >>>> IRC: lildude #habari
>
> >> --
> >> 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/habari-dev
>
> > --
> > 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/habari-dev

-- 
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/habari-dev

Reply via email to