authorization = $authorization;
}
public function do_placeholder( $listing, $placeholder, $context ) {
if ( ! is_user_logged_in() ) {
return '';
}
if ( ! $this->authorization->is_current_user_allowed_to_edit_listing( $listing ) ) {
return '';
}
return $this->generate_edit_listing_link( $listing );
}
private function generate_edit_listing_link( $listing ) {
$template = '';
$template = str_replace( '', esc_url( awpcp_get_edit_listing_url( $listing ) ), $template );
$template = str_replace( '', esc_attr( $this->generate_link_title( $listing ) ), $template );
$template = str_replace( '', esc_html( _x( 'Edit Ad', 'text for edit listing link', 'another-wordpress-classifieds-plugin' ) ), $template );
return $template;
}
private function generate_link_title( $listing ) {
$template = _x( 'Edit ', 'title attribute for edit listing link', 'another-wordpress-classifieds-plugin' );
$template = str_replace( '', $listing->get_title(), $template );
return $template;
}
}