/** * Short code the share block. * * @return string */ protected function _shortcode_shareblock() { $output = null; $tmp = self::_tmp_shareblock(); $tmp_wrapper = self::_tmp_wrapper_shareblock(); $sns = Variable::sns_list(); $current_url = home_url(add_query_arg(array())); $current_title = wp_get_document_title(); if (!empty($current_url) && !empty($current_title)) { foreach ($sns as $key => $value) { $output[$key] = $tmp; $output[$key] = str_replace('{{prefix}}', sanitize_html_class($key), $output[$key]); $output[$key] = str_replace('{{endpoint}}', $value['endpoint'], $output[$key]); $output[$key] = str_replace('{{anchor_text}}', $value['anchor_text'], $output[$key]); $output[$key] = str_replace('{{permalink}}', rawurlencode(esc_url($current_url)), $output[$key]); $output[$key] = str_replace('{{post_title}}', urlencode($current_title), $output[$key]); } $output = implode('', $output); } if (!empty($output)) { $output = str_replace('{{content}}', $output, $tmp_wrapper); } return $output; }