function cfct_init() { cfct_admin_request_handler(); if (cfct_get_option('cfct_ajax_load') == 'yes') { cfct_ajax_load(); } }
/** * * @param string $key option name to get * @param mixed $default What to return if the given option is not set * @return mixed */ function annowf_get_option($key, $default = false) { $option = cfct_get_option('workflow_settings'); if (is_null($option[$key])) { return $default; } else { return $option[$key]; } }
function cfct_head() { cfct_get_option('cfct_ajax_load') == 'no' ? $ajax_load = 'false' : ($ajax_load = 'true'); echo ' <script type="text/javascript"> var CFCT_URL = "' . get_bloginfo('url') . '"; var CFCT_AJAX_LOAD = ' . $ajax_load . '; </script> '; }
function cfct_get_custom_colors($type = 'option') { global $cfct_color_options; $colors = array(); foreach ($cfct_color_options as $option => $value) { switch ($type) { case 'preview': !empty($_GET[$option]) ? $colors[$option] = strip_tags(stripslashes($_GET[$option])) : ($colors[$option] = ''); break; case 'option': default: $colors[$option] = cfct_get_option($option); break; } } return $colors; }
/** * Output Google Analytics Code if a GA ID is present */ function anno_ga_js() { $ga_id = cfct_get_option('ga_id'); if (!empty($ga_id)) { ?> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', '<?php echo esc_js($ga_id); ?> ']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <?php } }
// http://www.opensource.org/licenses/gpl-license.php // // ********************************************************************** // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // ********************************************************************** if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die; } if (CFCT_DEBUG) { cfct_banner(__FILE__); } $blog_desc = get_bloginfo('description'); is_home() && !empty($blog_desc) ? $title_description = ' - ' . $blog_desc : ($title_description = ''); cfct_get_option('cfct_css_background_images') == 'no' ? $css_ext = '?type=noimg' : ($css_ext = ''); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?> > <head profile="http://gmpg.org/xfn/11"> <title><?php wp_title('-', true, 'right'); echo wp_specialchars(get_bloginfo('name'), 1) . $title_description; ?> </title> <meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>
// http://www.opensource.org/licenses/gpl-license.php // // ********************************************************************** // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // ********************************************************************** if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die; } if (CFCT_DEBUG) { cfct_banner(__FILE__); } $blog_desc = get_bloginfo('description'); is_home() && !empty($blog_desc) ? $title_description = ' - ' . $blog_desc : ($title_description = ''); $use_background_img = cfct_get_option('cfct_css_background_images'); $use_background_img == 'no' ? $css_ext = '?type=noimg' : ($css_ext = ''); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?> > <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?> ; charset=<?php bloginfo('charset'); ?> " />
function cfct_blog_settings_form() { global $cfct_color_options; $options = array('yes' => __('Yes', 'carrington-blog'), 'no' => __('No', 'carrington-blog')); $ajax_load_options = ''; $color_options = ''; foreach ($options as $k => $v) { if ($k == cfct_get_option('cfct_ajax_load')) { $ajax_load_selected = 'selected="selected"'; } else { $ajax_load_selected = ''; } $ajax_load_options .= "\n\t<option value='{$k}' {$ajax_load_selected}>{$v}</option>"; if ($k == cfct_get_option('cfct_custom_colors')) { $color_options_selected = 'selected="selected"'; } else { $color_options_selected = ''; } $color_options .= "\n\t<option value='{$k}' {$color_options_selected}>{$v}</option>"; } $cfct_posts_per_archive_page = get_option('cfct_posts_per_archive_page'); if (intval($cfct_posts_per_archive_page) == 0) { $cfct_posts_per_archive_page = 25; } cfct_get_option('cfct_custom_colors') == 'no' ? $colors_class = 'hidden' : ($colors_class = ''); $html = ' <table class="form-table"> <tbody> <tr valign="top"> <th scope="row">' . sprintf(__('Design', 'carrington-blog'), $key) . '</td> <td> <fieldset> <p> <label for="cfct_custom_colors">' . __('Customize Colors:', 'carrington-blog') . '</label> <select name="cfct_custom_colors" id="cfct_custom_colors">' . $color_options . '</select> </p> <fieldset class="' . $colors_class . '" id="cfct_color_options_panel"> <legend>Custom Colors</legend> '; foreach ($cfct_color_options as $option => $default) { $value = get_option($option); $value == '' ? $value = $default : ($value = attribute_escape($value)); $label = ucwords(str_replace(array('cfct_', '_'), array('', ' '), $option)); $html .= ' <p> <label for="' . $option . '">' . __($label . ':', 'carrington-blog') . '</label> #<input type="text" name="' . $option . '" id="' . $option . '" value="' . $value . '" size="6" maxlength="6" class="cfct_colorpicker" /> </p> '; } $html .= ' <p class="submit"> <input type="hidden" name="cfct_header_image_type" id="cfct_header_image_type" value="dark" /> <input id="reset_colors" type="reset" name="reset_button" value="' . __('Reset to Default Colors', 'carrington-blog') . '" /> </p> </fieldset> <p>TODO: Header Image</p> </fieldset> </td> </tr> </tbody> </table> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row">' . sprintf(__('Behavior', 'carrington-blog'), $key) . '</td> <td> <fieldset> <p> <label for="cfct_ajax_load">' . __('Load archives and comments with AJAX:', 'carrington-blog') . '</label> <select name="cfct_ajax_load" id="cfct_ajax_load">' . $ajax_load_options . '</select> </p> <p> <label for="cfct_posts_per_archive_page">' . __('Posts shown on archives pages:', 'carrington-blog') . '</label> <input type="text" name="cfct_posts_per_archive_page" id="cfct_posts_per_archive_page" value="' . $cfct_posts_per_archive_page . '" size="3" /> </p> </fieldset> </td> </tr> </tbody> </table> '; echo $html; }
/** * Determines whether or not a DOI lookup is feasible with the credentials given * * @return bool */ function anno_doi_lookup_enabled() { // A login (optional password) is required for DOI lookup. $crossref_login = cfct_get_option('crossref_login'); return !empty($crossref_login); }
/** * Returns the number of posts to display on an archive page * * @return int The number of posts to display on an archive page **/ function cfct_posts_per_archive_page_setting() { $count = cfct_get_option('posts_per_archive_page'); intval($count) > 0 ? $count = $count : ($count = 25); return $count; }
if (CFCT_DEBUG) { cfct_banner(__FILE__); } ?> </div><!-- .container --> </section><!-- #content --> <footer id="footer"> <div class="container clearfix"> <p class="credit"><?php _e('Powered by <a href="http://wordpress.org/">WordPress</a> · <a href="http://github.com/alexkingorg/wp-personal/">Get Personal</a>', 'favepersonal'); ?> </p> <?php $colophon = cfct_get_option('cfcp_copyright', false); $sep = $colophon ? ' · ' : ''; $loginout = cfct_get_loginout('', $sep); if ($colophon || $loginout) { echo '<p>' . $colophon . $loginout . '</p>'; } ?> </div><!--.container--> </footer><!-- #footer --> <?php wp_footer(); ?> </body> </html>
if (CFCT_DEBUG) { cfct_banner(__FILE__); } ?> <div class="clear"></div> </div><!-- .wrapper --> </div><!-- #main --> <hr class="lofi" /> <div id="footer" class="section"> <div class="wrapper"> <p id="generator-link"><?php _e('Proudly powered by <a href="http://wordpress.org/" rel="generator">WordPress</a> and <a href="http://carringtontheme.com" title="Carrington theme for WordPress">Carrington</a>.', 'carrington-blog'); ?> </p> <?php if (cfct_get_option('cfct_credit') == 'yes') { ?> <p id="developer-link"><?php printf(__('<a href="http://crowdfavorite.com" title="Custom WordPress development, design and backup services." rel="developer designer">%s</a>', 'carrington-blog'), 'Carrington Theme by Crowd Favorite'); ?> </p> <?php } ?> </div><!--.wrapper--> </div><!--#footer --> </div><!--#page--> <?php wp_footer(); ?> </body>
/** * Generate the Front portion of an article XML * * @param postObject $article Article to generate the XML for. * @return string XML generated */ private function xml_front($article) { // Journal Title $journal_title = cfct_get_option('journal_name'); if (!empty($journal_title)) { $journal_title_xml = '<journal-title-group> <journal-title>' . esc_html($journal_title) . '</journal-title> </journal-title-group>'; } else { $journal_title_xml = ''; } // Journal ID $journal_id = cfct_get_option('journal_id'); if (!empty($journal_id)) { $journal_id_type = cfct_get_option('journal_id_type'); if (!empty($journal_id_type)) { $journal_id_type_xml = ' journal-id-type="' . esc_attr($journal_id_type) . '"'; } else { $journal_id_type_xml = ''; } $journal_id_xml = '<journal-id' . $journal_id_type_xml . '>' . esc_html($journal_id) . '</journal-id>'; } else { $journal_id_xml = ''; } // Publisher ISSN $pub_issn = cfct_get_option('publisher_issn'); if (!empty($pub_issn)) { $pub_issn_xml = '<issn pub-type="epub">' . esc_html($pub_issn) . '</issn>'; } else { $pub_issn_xml = ''; } // Abstract $abstract = $article->post_excerpt; if (!empty($abstract)) { $abstract_xml = ' <abstract>' . $abstract . '</abstract>'; } else { $abstract_xml = ''; } // Funding Statement $funding = get_post_meta($article->ID, '_anno_funding', true); if (!empty($funding)) { $funding_xml = '<funding-group> <funding-statement>' . esc_html($funding) . '</funding-statement> </funding-group>'; } else { $funding_xml = ''; } // DOI $doi = get_post_meta($article->ID, '_anno_doi', true); if (!empty($doi)) { $doi_xml = '<article-id pub-id-type="doi">' . esc_html($doi) . '</article-id>'; } else { $doi_xml = ''; } // Article category. Theoretically, there can only be one! $cats = wp_get_object_terms($article->ID, 'article_category'); if (!empty($cats) && is_array($cats)) { $category = get_category($cats[0]); if (!empty($category)) { $category_xml = '<article-categories> <subj-group> <subject>' . esc_html($category->name) . '</subject> </subj-group> </article-categories>'; } else { $category_xml = ''; } } else { $category_xml = ''; } // Article Tags $tags = wp_get_object_terms($article->ID, 'article_tag'); if (!empty($tags) && is_array($tags)) { $tag_xml = '<kwd-group kwd-group-type="simple">'; foreach ($tags as $tag) { $tag = get_term($tag, 'article_tag'); $tag_xml .= '<kwd>' . esc_html($tag->name) . '</kwd>'; } $tag_xml .= ' </kwd-group>'; } else { $tag_xml = ''; } // Article title/subtitle $subtitle = get_post_meta($article->ID, '_anno_subtitle', true); $title_xml = '<title-group>'; if (!empty($article->post_title) || !empty($subtitle)) { $title_xml = '<title-group>'; if (!empty($article->post_title)) { $title_xml .= ' <article-title>' . esc_html($article->post_title) . '</article-title>'; } else { $title_xml .= ' <article-title />'; } if (!empty($subtitle)) { $title_xml .= ' <subtitle>' . esc_html($subtitle) . '</subtitle>'; } } $title_xml .= ' </title-group>'; // Publisher info $pub_name = cfct_get_option('publisher_name'); $pub_loc = cfct_get_option('publisher_location'); if (!empty($pub_name) || !empty($pub_loc)) { $publisher_xml = '<publisher>'; if (!empty($pub_name)) { $publisher_xml .= ' <publisher-name>' . esc_html($pub_name) . '</publisher-name>'; } if (!empty($pub_loc)) { $publisher_xml .= ' <publisher-loc>' . esc_html($pub_loc) . '</publisher-loc>'; } $publisher_xml .= ' </publisher>'; } else { $publisher_xml = ''; } $pub_date_xml = $this->xml_pubdate($article->post_date); // Authors $authors = get_post_meta($article->ID, '_anno_author_snapshot', true); if (!empty($authors) && is_array($authors)) { $author_xml = '<contrib-group>'; foreach ($authors as $author) { $author_xml .= ' <contrib>'; if (isset($author['surname']) && !empty($author['surname']) || isset($author['given_names']) && !empty($author['given_names']) || isset($author['prefix']) && !empty($author['prefix']) || isset($author['suffix']) && !empty($author['suffix'])) { $author_xml .= ' <name>'; if (isset($author['surname']) && !empty($author['surname'])) { $author_xml .= ' <surname>' . esc_html($author['surname']) . '</surname>'; } if (isset($author['given_names']) && !empty($author['given_names'])) { $author_xml .= ' <given-names>' . esc_html($author['given_names']) . '</given-names>'; } if (isset($author['prefix']) && !empty($author['prefix'])) { $author_xml .= ' <prefix>' . esc_html($author['prefix']) . '</prefix>'; } if (isset($author['suffix']) && !empty($author['suffix'])) { $author_xml .= ' <suffix>' . esc_html($author['suffix']) . '</suffix>'; } $author_xml .= ' </name>'; } // Affiliation legacy support if (!empty($author['affiliation']) || !empty($author['institution'])) { $author_xml .= ' <aff>'; if (!empty($author['affiliation'])) { $author_xml .= esc_html($author['affiliation']); } if (!empty($author['institution'])) { $author_xml .= '<institution>' . esc_html($author['institution']) . '</institution>'; } $author_xml .= '</aff>'; } if (isset($author['bio']) && !empty($author['bio'])) { $author_xml .= ' <bio><p>' . esc_html($author['bio']) . '</p></bio>'; } if (isset($author['link']) && !empty($author['link'])) { $author_xml .= ' <ext-link ext-link-type="uri" xlink:href="' . esc_url($author['link']) . '">' . esc_html($author['link']) . '</ext-link>'; } $author_xml .= ' </contrib>'; } $author_xml .= ' </contrib-group>'; } // Related Articles $related_xml = ''; if (anno_workflow_enabled()) { $related_articles = annowf_clone_get_ancestors($article->ID); } if (!empty($related_articles) && is_array($related_articles)) { foreach ($related_articles as $related_article_id) { $related_article = get_post($related_article_id); if (!empty($related_article) && $related_article->post_status == 'publish') { $related_xml .= '<related-article id="' . esc_attr('a' . $related_article->ID) . '" related-article-type="companion" ext-link-type="uri" xlink:href="' . esc_attr(get_permalink($related_article_id)) . '" '; $related_doi = get_post_meta($related_article_id, '_anno_doi', true); if (!empty($related_doi)) { $related_xml .= 'elocation-id="' . esc_attr($related_doi) . '" '; } // Queried for above if (!empty($journal_id)) { $related_xml .= 'journal_id="' . esc_attr($journal_id) . '" '; } // Queried for above if (!empty($journal_id_type)) { $related_xml .= 'journal_id_type="' . esc_attr($journal_id_type) . '" '; } $related_xml .= ' />'; } } } return '<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "journalpublishing3.dtd"> <article article-type="research-article" xml:lang="en" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <?origin annotum?> <front> <journal-meta> ' . $journal_id_xml . ' ' . $journal_title_xml . ' ' . $pub_issn_xml . ' ' . $publisher_xml . ' </journal-meta> <article-meta> ' . $doi_xml . ' ' . $category_xml . ' ' . $title_xml . ' ' . $author_xml . ' ' . $pub_date_xml . ' ' . $abstract_xml . ' ' . $tag_xml . ' ' . $funding_xml . ' ' . $related_xml . ' </article-meta> </front>'; }
/** * Display a form for image header customization * * @return string Markup displaying the form * **/ function cfct_header_image_form() { global $wpdb; $images = $wpdb->get_results("\n\t\tSELECT * FROM {$wpdb->posts}\n\t\tWHERE post_type = 'attachment'\n\t\tAND post_mime_type LIKE 'image%'\n\t\tAND post_parent = 0\n\t\tORDER BY post_date_gmt DESC\n\t\tLIMIT 50\n\t"); $upload_url = admin_url('media-new.php'); $header_image = cfct_get_option('header_image'); if (empty($header_image)) { $header_image = 0; } $output = ' <ul style="width: ' . (count($images) + 1) * 152 . 'px"> <li style="background: #666;"> <label for="cfct_header_image_0"> <input type="radio" name="' . esc_attr(cfct_option_name('header_image')) . '" value="0" id="' . esc_attr(cfct_option_name('header_image_0')) . '" ' . checked($header_image, 0, false) . '/>' . __('No Image', 'carrington-core') . ' </label> </li> '; if (count($images)) { foreach ($images as $image) { $id = cfct_option_name('header_image_' . $image->ID); $thumbnail = wp_get_attachment_image_src($image->ID); $output .= ' <li style="background-image: url(' . $thumbnail[0] . ')"> <label for="' . $id . '"> <input type="radio" name="' . esc_attr(cfct_option_name('header_image')) . '" value="' . $image->ID . '" id="' . $id . '"' . checked($header_image, $image->ID, false) . ' />' . esc_html($image->post_title) . ' </label> </li>'; } } $output .= '</ul>'; return '<p>' . sprintf(__('Header Image — <a href="%s">Upload Images</a>', 'carrington-core'), $upload_url) . '</p><div class="cfct_header_image_carousel">' . $output . '</div>'; }
/** * Generate the Front portion of an article XML * * @param postObject $article Article to generate the XML for. * @return string XML generated */ private function xml_front($article) { // Journal Title $journal_title = cfct_get_option('journal_name'); if (!empty($journal_title)) { $journal_title_xml = '<journal-title-group> <journal-title>' . esc_html($journal_title) . '</journal-title> </journal-title-group>'; } else { $journal_title_xml = ''; } // Journal ID $journal_id = cfct_get_option('journal_id'); if (!empty($journal_id)) { $journal_id_type = cfct_get_option('journal_id_type'); if (!empty($journal_id_type)) { $journal_id_type_xml = ' journal-id-type="' . esc_attr($journal_id_type) . '"'; } else { $journal_id_type_xml = ''; } $journal_id_xml = '<journal-id' . $journal_id_type_xml . '>' . esc_html($journal_id) . '</journal-id>'; } else { $journal_id_xml = ''; } // Publisher ISSN $pub_issn = cfct_get_option('publisher_issn'); if (!empty($pub_issn)) { $pub_issn_xml = '<issn pub-type="ppub">' . esc_html($pub_issn) . '</issn>'; } else { $pub_issn_xml = ''; } // Abstract $abstract = $article->post_excerpt; if (!empty($abstract)) { $abstract_xml = '<abstract> <title>' . _x('Abstract', 'xml abstract title', 'anno') . '</title> <p>' . esc_html($abstract) . '</p> </abstract>'; } else { $abstract_xml = ''; } // Funding Statement $funding = get_post_meta($article->ID, '_anno_funding', true); if (!empty($funding)) { $funding_xml = '<funding-group> <funding-statement><bold>' . esc_html($funding) . '</bold></funding-statement> </funding-group>'; } else { $funding_xml = ''; } // DOI $doi = get_post_meta($article->ID, '_anno_doi', true); if (!empty($doi)) { $doi_xml = '<article-id pub-id-type="doi">' . esc_html($doi) . '</article-id>'; } else { $doi_xml = ''; } // Article category. Theoretically, there can only be one! $cats = wp_get_object_terms($article->ID, 'article_category'); if (!empty($cats) && is_array($cats)) { $category = get_category($cats[0]); if (!empty($category)) { $category_xml = '<article-categories> <subj-group> <subject><bold>' . esc_html($category->name) . '</bold></subject> </subj-group> </article-categories>'; } else { $category_xml = ''; } } else { $category_xml = ''; } // Article Tags $tags = wp_get_object_terms($article->ID, 'article_tag'); if (!empty($tags) && is_array($tags)) { $tag_xml = '<kwd-group kwd-group-type="simple">'; foreach ($tags as $tag) { $tag = get_term($tag, 'article_tag'); $tag_xml .= '<kwd><bold>' . esc_html($tag->name) . '</bold></kwd>'; } $tag_xml .= ' </kwd-group>'; } else { $tag_xml = ''; } // Article title/subtitle $subtitle = get_post_meta($article->ID, '_anno_subtitle', true); $title_xml = '<title-group>'; if (!empty($article->post_title) || !empty($subtitle)) { $title_xml = '<title-group>'; if (!empty($article->post_title)) { $title_xml .= ' <article-title><bold>' . esc_html($article->post_title) . '</bold></article-title>'; } else { $title_xml .= ' <article-title />'; } if (!empty($subtitle)) { $title_xml .= ' <subtitle><bold>' . esc_html($subtitle) . '</bold></subtitle>'; } } $title_xml .= ' </title-group>'; // Publisher info $pub_name = cfct_get_option('publisher_name'); $pub_loc = cfct_get_option('publisher_location'); if (!empty($pub_name) || !empty($pub_loc)) { $publisher_xml = '<publisher>'; if (!empty($pub_name)) { $publisher_xml .= ' <publisher-name>' . esc_html($pub_name) . '</publisher-name>'; } if (!empty($pub_loc)) { $publisher_xml .= ' <publisher-loc>' . esc_html($pub_loc) . '</publisher-loc>'; } $publisher_xml .= ' </publisher>'; } else { $publisher_xml = ''; } $pub_date_xml = $this->xml_pubdate($article->post_date); // Authors $authors = get_post_meta($article->ID, '_anno_author_snapshot', true); $author_xml = '<contrib-group>'; if (!empty($authors) && is_array($authors)) { foreach ($authors as $author) { $author_xml .= ' <contrib>'; if (isset($author['surname']) && !empty($author['surname']) || isset($author['given_names']) && !empty($author['given_names']) || isset($author['prefix']) && !empty($author['prefix']) || isset($author['suffix']) && !empty($author['suffix'])) { $author_xml .= ' <name>'; if (isset($author['surname']) && !empty($author['surname'])) { $author_xml .= ' <surname>' . esc_html($author['surname']) . '</surname>'; } if (isset($author['given_names']) && !empty($author['given_names'])) { $author_xml .= ' <given-names>' . esc_html($author['given_names']) . '</given-names>'; } if (isset($author['prefix']) && !empty($author['prefix'])) { $author_xml .= ' <prefix>' . esc_html($author['prefix']) . '</prefix>'; } if (isset($author['suffix']) && !empty($author['suffix'])) { $author_xml .= ' <suffix>' . esc_html($author['suffix']) . '</suffix>'; } $author_xml .= ' </name>'; } // @TODO TDB whether or not to include email // if (isset($author['email']) && !empty($author['email'])) { // $author_xml .= ' // <email>'.esc_html($author['email']).'</email>'; // } if (isset($author['degrees']) && !empty($author['degrees'])) { $author_xml .= ' <degrees>' . esc_html($author['degrees']) . '</degrees>'; } if (isset($author['affiliation']) && !empty($author['affitliation'])) { $author_xml .= ' <affiliation>' . esc_html($author['affiliation']) . '</affiliation>'; } if (isset($author['bio']) && !empty($author['bio'])) { $author_xml .= ' <bio><p>' . esc_html($author['bio']) . '</p></bio>'; } if (isset($author['link']) && !empty($author['link'])) { $author_xml .= ' <ext-link ext-link-type="uri" xlink:href="' . esc_url($author['link']) . '">' . esc_html($author['link']) . '</ext-link>'; } $author_xml .= ' </contrib>'; } } $author_xml .= ' </contrib-group>'; return '<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE article SYSTEM "http://dtd.nlm.nih.gov/ncbi/kipling/kipling-jp3.dtd"> <article xmlns:xlink="http://www.w3.org/1999/xlink" article-type="research-article" xml:lang="en"> <front> <journal-meta> ' . $journal_id_xml . ' ' . $journal_title_xml . ' ' . $pub_issn_xml . ' ' . $publisher_xml . ' </journal-meta> <article-meta> ' . $doi_xml . ' ' . $category_xml . ' ' . $title_xml . ' ' . $author_xml . ' ' . $pub_date_xml . ' ' . $abstract_xml . ' ' . $tag_xml . ' ' . $funding_xml . ' </article-meta> </front>'; }
/** * Get an existing DOI for a post, or generate a new one * * @param int $post_id * @param bool $generate_new_doi whether or not to force a new DOI generation * * @return string DOI for this article */ function anno_get_doi($post_id, $generate_new_doi = false) { if ($generate_new_doi) { $registrant_code = cfct_get_option('registrant_code'); $doi = '10.' . $registrant_code . '/' . uniqid('', false); update_post_meta($post_id, '_anno_doi', $doi); } else { $doi = get_post_meta($post_id, '_anno_doi', true); if (empty($doi)) { $registrant_code = cfct_get_option('registrant_code'); $doi = '10.' . $registrant_code . '/' . uniqid('', false); update_post_meta($post_id, '_anno_doi', $doi); } } return $doi; }
function cfct_blog_head() { // see enqueued style in cfct_blog_init, we'll activate that in the future echo ' <link rel="stylesheet" type="text/css" media="screen" href="' . get_bloginfo('template_directory') . '/carrington-core/lightbox/css/thickbox.css" /> '; cfct_get_option('cfct_ajax_load') == 'no' ? $ajax_load = 'false' : ($ajax_load = 'true'); echo ' <script type="text/javascript"> var CFCT_URL = "' . get_bloginfo('url') . '"; var CFCT_AJAX_LOAD = ' . $ajax_load . '; </script> '; if (cfct_get_option('cfct_lightbox') != 'no') { echo ' <script type="text/javascript"> tb_pathToImage = "' . get_bloginfo('template_directory') . '/carrington-core/lightbox/img/loadingAnimation.gif"; jQuery(function($) { $("a.thickbox").each(function() { var url = $(this).attr("rel"); var post_id = $(this).parents("div.post").attr("id"); $(this).attr("href", url).attr("rel", post_id); }); }); </script> '; } if (cfct_get_option('cfct_custom_colors') == 'yes') { if (get_option('cfct_header_image_type') == 'light') { $header_img_type = 'light'; $header_grad_type = 'dark'; } else { $header_img_type = 'dark'; $header_grad_type = 'light'; } get_option('cfct_footer_image_type') == 'light' ? $footer_img_type = 'light' : ($footer_img_type = 'dark'); ?> <style type="text/css"> #header { background-color: #<?php echo get_option('cfct_header_background_color'); ?> ; color: #<?php echo get_option('cfct_header_text_color'); ?> ; } #header a, #header a:visited { color: #<?php echo get_option('cfct_header_link_color'); ?> ; } #sub-header, .nav ul{ background-color: #<?php echo get_option('cfct_header_nav_background_color'); ?> ; color: #<?php echo get_option('cfct_header_nav_text_color'); ?> ; } #sub-header a, #sub-header a:visited, .nav li li a, .nav li li a:visited { color: #<?php echo get_option('cfct_header_nav_link_color'); ?> !important; } h1, h1 a, h1 a:hover, h1 a:visited { color: #<?php echo get_option('cfct_page_title_color'); ?> ; } h2, h2 a, h2 a:hover, h2 a:visited { color: #<?php echo get_option('cfct_page_subtitle_color'); ?> ; } a, a:hover, a:visited { color: #<?php echo get_option('cfct_link_color'); ?> ; } .hentry .edit, .hentry .edit a, .hentry .edit a:visited, .hentry .edit a:hover, .comment-reply-link, .comment-reply-link:visited, .comment-reply-link:hover { background-color: #<?php echo get_option('cfct_link_color'); ?> ; } #footer { background-color: #<?php echo get_option('cfct_footer_background_color'); ?> ; color: #<?php echo get_option('cfct_footer_text_color'); ?> ; } #footer a, #footer a:visited { color: #<?php echo get_option('cfct_footer_link_color'); ?> ; } #footer p#developer-link a, #footer p#developer-link a:visited { background-image: url(<?php bloginfo('template_directory'); ?> /img/footer/by-crowd-favorite-<?php echo $footer_img_type; ?> .png); } <?php if (cfct_get_option('cfct_css_background_images') != 'no') { ?> #header { background-image: url(<?php bloginfo('template_directory'); ?> /img/header/gradient-<?php echo $header_grad_type; ?> .png); } #header .wrapper { background-image: url(<?php bloginfo('template_directory'); ?> /img/header/texture-<?php echo $header_img_type; ?> .png); } #footer { background-image: url(<?php bloginfo('template_directory'); ?> /img/footer/gradient-<?php echo $footer_img_type; ?> .png); } <?php } ?> </style> <?php } if (cfct_get_option('cfct_custom_header_image') == 'yes') { $header_image = cfct_get_option('cfct_header_image'); if ($header_image != 0 && ($img = wp_get_attachment_image_src($header_image, 'large'))) { ?> <style type="text/css"> #header .wrapper { background-image: url(<?php echo $img[0]; ?> ); background-repeat: no-repeat; height: <?php echo $img[2]; ?> px; } </style> <?php } else { ?> <style type="text/css"> #header .wrapper { background-image: url(); } </style> <?php } } }
/** * Header markup for pdfs **/ public static function header_markup() { $header_img = get_header_image(); if (empty($header_img)) { $journal_name = cfct_get_option('journal_name'); $out = empty($journal_name) ? '' : $journal_name . '. '; $section_name = get_bloginfo('name'); $out .= empty($section_name) ? '' : $section_name . '.'; } else { $out = '<img src="' . esc_url($header_img) . '" />'; } return $out; }
function cfct_text_head() { // see enqueued style in cfct_blog_init, we'll activate that in the future if (cfct_get_option('cfct_lightbox') != 'no') { echo ' <link rel="stylesheet" type="text/css" media="screen" href="' . get_bloginfo('template_directory') . '/carrington-core/lightbox/css/thickbox.css" /> '; } cfct_get_option('cfct_ajax_load') == 'no' ? $ajax_load = 'false' : ($ajax_load = 'true'); echo ' <script type="text/javascript"> var CFCT_URL = "' . get_bloginfo('url') . '"; var CFCT_AJAX_LOAD = ' . $ajax_load . '; </script> '; if (cfct_get_option('cfct_lightbox') != 'no') { echo ' <script type="text/javascript"> tb_pathToImage = "' . get_bloginfo('template_directory') . '/carrington-core/lightbox/img/loadingAnimation.gif"; jQuery(function($) { $("a.thickbox").each(function() { var url = $(this).attr("rel"); var post_id = $(this).parents("div.post, div.page").attr("id"); $(this).attr("href", url).attr("rel", post_id); }); }); </script> '; } // preview if (isset($_GET['cfct_action']) && $_GET['cfct_action'] == 'custom_color_preview' && current_user_can('manage_options')) { cfct_text_custom_colors('preview'); } else { if (cfct_get_option('cfct_text_custom_colors') == 'yes') { cfct_text_custom_colors(); } } if (cfct_get_option('cfct_text_custom_header_image') == 'yes') { $header_image = cfct_get_option('cfct_header_image'); if ($header_image != 0 && ($img = wp_get_attachment_image_src($header_image, 'large'))) { ?> <style type="text/css"> #header .wrapper { background-image: url(<?php echo $img[0]; ?> ); background-repeat: no-repeat; height: <?php echo $img[2]; ?> px; } </style> <?php } else { ?> <style type="text/css"> #header .wrapper { background-image: url(); } </style> <?php } } }
// // Released under the GPL license // http://www.opensource.org/licenses/gpl-license.php // // ********************************************************************** // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // ********************************************************************** if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die; } if (CFCT_DEBUG) { cfct_banner(__FILE__); } cfct_get_option('cfct_css_background_images') == 'no' ? $css_ext = '?type=attachment-noimg' : ($css_ext = '?type=attachment'); global $post; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?> > <head profile="http://gmpg.org/xfn/11"> <title><?php wp_title('-', true, 'right'); echo wp_specialchars(get_bloginfo('name'), 1); ?> </title> <meta http-equiv="content-type" content="<?php
/** * Generate markup for login/logout links * * @param string $redirect URL to redirect after the login or logout * @param string $before Markup to display before * @param string $after Markup to display after * @return string Generated login/logout Markup */ function cfct_get_loginout($redirect = '', $before = '', $after = '') { if (cfct_get_option('login_link_enabled') != 'no') { return $before . wp_loginout($redirect, false) . $after; } }
/** * Display option for home columns * **/ function cfct_options_home_column($key) { $categories = get_categories('hide_empty=0'); $cat_options = ''; $home_col_cat = get_option('cfct_home_col_' . $key . '_cat'); foreach ($categories as $category) { $cat_options .= "\n\t" . '<option value="' . $category->term_id . '" ' . selected($category->term_id, $home_col_cat, false) . '>' . $category->name . '</option>'; } $col_content_array = array('latest' => __('Latest Post Preview', 'carrington'), 'list' => __('List of Recent Post Titles', 'carrington')); $show_options = ''; $show_option = cfct_get_option('cfct_home_column_' . $key . '_content'); foreach ($col_content_array as $content_key => $content_value) { $content_options .= "\n\t" . '<option value="' . $content_key . '" ' . selected($content_key, $show_option, false) . '>' . $content_value . '</option>'; } $html = ' <tr valign="top"> <th scope="row"><b>' . sprintf(__('Home Column %s', 'carrington'), $key) . '</b></td> <td> <fieldset> <p> <label for="cfct_home_column_' . $key . '_cat">' . __('Category:', 'carrington') . '</label> <select name="cfct_home_column_' . $key . '_cat" id="cfct_home_column_' . $key . '_cat">' . $cat_options . '</select> </p> <p> <label for="cfct_home_column_' . $key . '_content">' . __('Show:', 'carrington') . '</label> <select name="cfct_home_column_' . $key . '_content" id="cfct_home_column_' . $key . '_content" class="home_column_select">' . $content_options . '</select> </p> <p id="cfct_latest_limit_' . $key . '_option" class="hidden"> <label for="cfct_latest_limit_' . $key . '">' . __('Length of preview, in characters (250 recommended):', 'carrington') . '</label> <input type="text" name="cfct_latest_limit_' . $key . '" id="cfct_latest_limit_' . $key . '" value="' . cfct_get_option('cfct_latest_limit_' . $key) . '" /> </p> <p id="cfct_list_limit_' . $key . '_option" class="hidden"> <label for="cfct_list_limit_' . $key . '">' . __('Number of titles to show in list (5 recommended):', 'carrington') . '</label> <input type="text" name="cfct_list_limit_' . $key . '" id="cfct_list_limit_' . $key . '" value="' . cfct_get_option('cfct_list_limit_' . $key) . '" /> </p> </fieldset> </td> </tr> '; return $html; }
function cfct_options_home_column($key) { $categories = get_categories('hide_empty=0'); $cat_options = ''; foreach ($categories as $category) { if ($category->term_id == get_option('cfct_home_col_' . $key . '_cat')) { $selected = 'selected="selected"'; } else { $selected = ''; } $cat_options .= "\n\t<option value='{$category->term_id}' {$selected}>{$category->name}</option>"; } $show_options = ''; $show_option = cfct_get_option('cfct_home_column_' . $key . '_content'); if ($show_option == 'latest') { $latest_selected = 'selected="selected"'; $list_selected = ''; } else { $latest_selected = ''; $list_selected = 'selected="selected"'; } $html = ' <tr valign="top"> <th scope="row">' . sprintf(__('Home Column %s', 'carrington'), $key) . '</td> <td> <fieldset> <p> <label for="cfct_home_column_' . $key . '_cat">' . __('Category:', 'carrington') . '</label> <select name="cfct_home_column_' . $key . '_cat" id="cfct_home_column_' . $key . '_cat">' . $cat_options . '</select> </p> <p> <label for="cfct_home_column_' . $key . '_content">' . __('Show:', 'carrington') . '</label> <select name="cfct_home_column_' . $key . '_content" id="cfct_home_column_' . $key . '_content" class="home_column_select"> <option value="latest" ' . $latest_selected . '>' . __('Latest Post Preview', 'carrington') . '</option> <option value="list" ' . $list_selected . '>' . __('List of Recent Post Titles', 'carrington') . '</option> </select> </p> <p id="cfct_latest_limit_' . $key . '_option" class="hidden"> <label for="cfct_latest_limit_' . $key . '">' . __('Length of preview, in characters (250 recommended):', 'carrington') . '</label> <input type="text" name="cfct_latest_limit_' . $key . '" id="cfct_latest_limit_' . $key . '" value="' . cfct_get_option('cfct_latest_limit_' . $key) . '" /> </p> <p id="cfct_list_limit_' . $key . '_option" class="hidden"> <label for="cfct_list_limit_' . $key . '">' . __('Number of titles to show in list (5 recommended):', 'carrington') . '</label> <input type="text" name="cfct_list_limit_' . $key . '" id="cfct_list_limit_' . $key . '" value="' . cfct_get_option('cfct_list_limit_' . $key) . '" /> </p> </fieldset> </td> </tr> '; return $html; }
function cfct_blog_settings_form() { global $cfct_color_options; $ajax_load_options = ''; $color_options = ''; $lightbox_options = ''; $values = array('yes' => __('Yes', 'carrington-blog'), 'no' => __('No', 'carrington-blog')); $settings = array('cfct_ajax_load', 'cfct_custom_colors', 'cfct_custom_header_image', 'cfct_lightbox', 'cfct_css_background_images'); foreach ($values as $k => $v) { foreach ($settings as $setting) { $options = $setting . '_options'; if ($k == cfct_get_option($setting)) { $selected = 'selected="selected"'; } else { $selected = ''; } ${$options} .= "\n\t<option value='{$k}' {$selected}>{$v}</option>"; } } $cfct_posts_per_archive_page = get_option('cfct_posts_per_archive_page'); if (intval($cfct_posts_per_archive_page) == 0) { $cfct_posts_per_archive_page = 25; } cfct_get_option('cfct_custom_colors') == 'no' ? $colors_class = 'hidden' : ($colors_class = ''); cfct_get_option('cfct_custom_header_image') == 'no' ? $header_image_class = 'hidden' : ($header_image_class = ''); $html = ' <table class="form-table"> <tbody> <tr valign="top"> <th scope="row">' . sprintf(__('Design', 'carrington-blog'), $key) . '</td> <td> <fieldset> <p> <label for="cfct_css_background_images">' . __('Show Pretty Background Images:', 'carrington-blog') . '</label> <select name="cfct_css_background_images" id="cfct_css_background_images">' . $cfct_css_background_images_options . '</select> </p> <p> <label for="cfct_custom_colors">' . __('Customize Colors:', 'carrington-blog') . '</label> <select name="cfct_custom_colors" id="cfct_custom_colors">' . $cfct_custom_colors_options . '</select> </p> <fieldset class="' . $colors_class . '" id="cfct_color_options_panel"> <legend>' . __('Custom Colors', 'carrington-blog') . '</legend> '; foreach ($cfct_color_options as $option => $default) { $value = get_option($option); $value == '' ? $value = $default : ($value = attribute_escape($value)); $label = ucwords(str_replace(array('cfct_', '_'), array('', ' '), $option)); $html .= ' <p> <label for="' . $option . '">' . __($label . ':', 'carrington-blog') . '</label> #<input type="text" name="' . $option . '" id="' . $option . '" value="' . $value . '" size="6" maxlength="6" class="cfct_colorpicker" /> </p> '; } $html .= ' <p class="submit"> <input type="hidden" name="cfct_header_image_type" id="cfct_header_image_type" value="dark" /> <input type="hidden" name="cfct_footer_image_type" id="cfct_footer_image_type" value="dark" /> <input id="reset_colors" type="reset" name="reset_button" value="' . __('Reset to Default Colors', 'carrington-blog') . '" /> <input id="preview_colors" type="button" name="preview_colors" value="' . __('Preview', 'carrington-blog') . '" onclick="alert(\'Coming Soon...\'); return false;" /> </p> </fieldset> <p> <label for="cfct_custom_header_image">' . __('Customize Header Image:', 'carrington-blog') . '</label> <select name="cfct_custom_header_image" id="cfct_custom_header_image">' . $cfct_custom_header_image_options . '</select> </p> <fieldset class="' . $header_image_class . '" id="cfct_header_image_panel"> ' . cfct_header_image_form() . ' </fieldset> </fieldset> </td> </tr> </tbody> </table> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row">' . sprintf(__('Behavior', 'carrington-blog'), $key) . '</td> <td> <fieldset> <p> <label for="cfct_ajax_load">' . __('Load archives and comments with AJAX:', 'carrington-blog') . '</label> <select name="cfct_ajax_load" id="cfct_ajax_load">' . $cfct_ajax_load_options . '</select> </p> <p> <label for="cfct_lightbox">' . __('Use a lightbox effect for image galleries:', 'carrington') . '</label> <select name="cfct_lightbox" id="cfct_lightbox">' . $cfct_lightbox_options . '</select> </p> <p> <label for="cfct_posts_per_archive_page">' . __('Posts shown on archives pages:', 'carrington-blog') . '</label> <input type="text" name="cfct_posts_per_archive_page" id="cfct_posts_per_archive_page" value="' . $cfct_posts_per_archive_page . '" size="3" /> </p> </fieldset> </td> </tr> </tbody> </table> '; echo $html; }
function cfct_blog_init() { if (cfct_get_option('cfct_ajax_load') == 'yes') { cfct_ajax_load(); } }
/** * Markup for depositing */ function anno_deposit_doi_meta_box($post) { $crossref_login = cfct_get_option('crossref_login'); $crossref_password = cfct_get_option('crossref_pass'); $crossref_registrant = cfct_get_option('registrant_code'); if (empty($crossref_login) || empty($crossref_password) || empty($crossref_registrant)) { $deposit_enabled = false; $deposit_value = _x('CrossRef Credentials Required', 'disabled DOI lookup message', 'anno'); $deposit_id = 'doi-deposit-disabled'; } else { $deposit_enabled = true; $deposit_value = anno_get_doi($post->ID); $deposit_id = 'doi-deposit-submit'; } ?> <div id="doi-status"></div> <input id="doi" type="text" name="doi-deposit" class="meta-doi-input" value="<?php echo $deposit_value; ?> "<?php disabled(true, true, true); ?> /> <?php wp_nonce_field('anno_doi_deposit', '_ajax_nonce-doi-deposit', false); ?> <!-- <input id="<?php echo $deposit_id; ?> " type="button" value="<?php _ex('Deposit', 'doi deposit button label', 'anno'); ?> "<?php disabled($deposit_enabled, false, true); ?> /> --> <?php }
function cfct_blog_custom_colors($type = 'option') { $colors = cfct_get_custom_colors($type); if (get_option('cfct_header_image_type') == 'light') { $header_img_type = 'light'; $header_grad_type = 'dark'; } else { $header_img_type = 'dark'; $header_grad_type = 'light'; } get_option('cfct_footer_image_type') == 'light' ? $footer_img_type = 'light' : ($footer_img_type = 'dark'); ?> <style type="text/css"> #header { background-color: #<?php echo $colors['cfct_header_background_color']; ?> ; color: #<?php echo $colors['cfct_header_text_color']; ?> ; } #header a, #header a:visited { color: #<?php echo $colors['cfct_header_link_color']; ?> ; } #sub-header, .nav ul{ background-color: #<?php echo $colors['cfct_header_nav_background_color']; ?> ; color: #<?php echo $colors['cfct_header_nav_text_color']; ?> ; } #sub-header a, #sub-header a:visited, .nav li li a, .nav li li a:visited { color: #<?php echo $colors['cfct_header_nav_link_color']; ?> !important; } h1, h1 a, h1 a:hover, h1 a:visited { color: #<?php echo $colors['cfct_page_title_color']; ?> ; } h2, h2 a, h2 a:hover, h2 a:visited { color: #<?php echo $colors['cfct_page_subtitle_color']; ?> ; } a, a:hover, a:visited { color: #<?php echo $colors['cfct_link_color']; ?> ; } .hentry .edit, .hentry .edit a, .hentry .edit a:visited, .hentry .edit a:hover, .comment-reply-link, .comment-reply-link:visited, .comment-reply-link:hover { background-color: #<?php echo $colors['cfct_link_color']; ?> ; } #footer { background-color: #<?php echo $colors['cfct_footer_background_color']; ?> ; color: #<?php echo $colors['cfct_footer_text_color']; ?> ; } #footer a, #footer a:visited { color: #<?php echo $colors['cfct_footer_link_color']; ?> ; } #footer p#developer-link a, #footer p#developer-link a:visited { background-image: url(<?php bloginfo('template_directory'); ?> /img/footer/by-crowd-favorite-<?php echo $footer_img_type; ?> .png); } <?php if (cfct_get_option('cfct_css_background_images') != 'no') { ?> #header { background-image: url(<?php bloginfo('template_directory'); ?> /img/header/gradient-<?php echo $header_grad_type; ?> .png); } #header .wrapper { background-image: url(<?php bloginfo('template_directory'); ?> /img/header/texture-<?php echo $header_img_type; ?> .png); } #footer { background-image: url(<?php bloginfo('template_directory'); ?> /img/footer/gradient-<?php echo $footer_img_type; ?> .png); } <?php } ?> </style> <?php }
/** * Get an existing DOI for a post, or generate a new one * * @param int $post_id * @param bool $generate_new_doi whether or not to force a new DOI generation * * @return mixed DOI for this article/false if a valid article id is not passed in. */ function anno_get_doi($post_id, $generate_new_doi = false) { if ($generate_new_doi) { $post = get_post($post_id); $doi = false; if ($post) { $doi_prefix = cfct_get_option('doi_prefix'); $doi_prefix .= empty($doi_prefix) ? '' : '.'; $registrant_code = cfct_get_option('registrant_code'); $doi = '10.' . $registrant_code . '/' . $doi_prefix . md5($post->guid); update_post_meta($post_id, '_anno_doi', $doi); } } else { $doi = get_post_meta($post_id, '_anno_doi', true); if (empty($doi)) { $doi = anno_get_doi($post_id, true); } } return $doi; }