Ой, людоньки добрые...
Jul. 29th, 2009 12:45 pmЕсть вот такой вот кусок PHP-текста. Это, фрагмент из вордпресовского плагина, который делает кроспостинг в ЖЖ. К сожалению, написан он несколько дубово, без учета того, что синтаксис тега "<!--more-->" несколько сложнее, и он может применяться в виде "<!--more Продолжим подробнее. -->"
Я, к стыду своему в php ничего не понимаю, а разбираться сейчас нету желания и времени - если кто в курсе, подскажите, как поправить тут строчку, где идет проверка на more. Идеально было бы конечно всобачивать строку из more в качестве строки-заместителя в lj-cut, но и без этого было бы хорошо.
Заранее благодарю.
if(!$post->post_password) {
// and if there's no <!--more--> tag, we can spit it out and go on our
// merry way
if(strpos($post->post_content, "<!--more-->") === false) {
$the_event .= apply_filters('the_content', $post->post_content);
}
else {
$content = explode("<!--more-->", $post->post_content, 2);
$the_event .= apply_filters('the_content', $content[0]);
switch($options['more']) {
case "copy":
$the_event .= apply_filters('the_content', $content[1]);
break;
case "link":
$the_event .= sprintf('<p><a href="%s#more-%s">', get_permalink($post_id), $post_id) .
__('Read the rest of this entry »', LJXP_DOMAIN) .
'</a></p>';
break;
case "lj-cut":
$the_event .= '<lj-cut text="' .
__('Read the rest of this entry &raquo;', LJXP_DOMAIN) .
'">' . apply_filters('the_content', $content[1]) . '</lj-cut>';
break;
}
}
}
Я, к стыду своему в php ничего не понимаю, а разбираться сейчас нету желания и времени - если кто в курсе, подскажите, как поправить тут строчку, где идет проверка на more. Идеально было бы конечно всобачивать строку из more в качестве строки-заместителя в lj-cut, но и без этого было бы хорошо.
Заранее благодарю.
if(!$post->post_password) {
// and if there's no <!--more--> tag, we can spit it out and go on our
// merry way
if(strpos($post->post_content, "<!--more-->") === false) {
$the_event .= apply_filters('the_content', $post->post_content);
}
else {
$content = explode("<!--more-->", $post->post_content, 2);
$the_event .= apply_filters('the_content', $content[0]);
switch($options['more']) {
case "copy":
$the_event .= apply_filters('the_content', $content[1]);
break;
case "link":
$the_event .= sprintf('<p><a href="%s#more-%s">', get_permalink($post_id), $post_id) .
__('Read the rest of this entry »', LJXP_DOMAIN) .
'</a></p>';
break;
case "lj-cut":
$the_event .= '<lj-cut text="' .
__('Read the rest of this entry &raquo;', LJXP_DOMAIN) .
'">' . apply_filters('the_content', $content[1]) . '</lj-cut>';
break;
}
}
}