/**
  * Set display options and make sure there is no conflict with LiveChat
  */
 private static function set_display_options()
 {
     $excludes = array('_builtin' => false);
     $post_types = get_post_types($args = $excludes);
     $post_types = array_merge(array('post' => 'post', 'page' => 'page'), $post_types);
     foreach ($post_types as $post_type) {
         $post_type_name_comments = 'livefyre_display_' . $post_type;
         $post_type_name_chat = 'livefyre_chat_display_' . $post_type;
         $display_comments = get_option('livefyre_apps-' . $post_type_name_comments, '');
         $display_chat = get_option('livefyre_apps-' . $post_type_name_chat, '');
         $display = false;
         if ($display_comments === '') {
             if (Livefyre_Apps::is_app_enabled('chat') && ($display_chat === '' || $display_chat === false)) {
                 $display = true;
             } elseif (!Livefyre_Apps::is_app_enabled('chat')) {
                 $display = true;
             }
         } elseif ($display_comments === true) {
             $display = true;
         }
         update_option('livefyre_apps-' . $post_type_name_comments, $display);
     }
 }
Ejemplo n.º 2
0
                                        <p><a target="_blank" href="http://web.livefyre.com/streamhub/#liveBlog">Click here</a> for more information.</p>
                                    </div>
                                </div>
                                <div class='lfapps-appmgt-box enterprise-only'>
                                    <label for='lfapps_chat_enable'>
                                        <?php 
$icon_src = Livefyre_Apps::is_app_enabled('chat') ? 'lf-chat-icon.png' : 'lf-chat-icon-grey.png';
?>
                                        <img id="lfapps_chat_icon" src="<?php 
echo esc_url(LFAPPS__PLUGIN_URL . 'assets/img/' . $icon_src);
?>
"/>
                                    </label>
                                    <div class="lfapps-appmgt-controls">
                                        <input id="lfapps_chat_enable" name="livefyre_apps-apps[]" type="checkbox" value="chat" <?php 
echo Livefyre_Apps::is_app_enabled('chat') ? 'checked' : '';
?>
>
                                        <label for='lfapps_chat_enable'>
                                            <span><?php 
esc_html_e('Chat™', 'lfapps');
?>
</span>
                                        </label>
                                        <p><a target="_blank" href="http://web.livefyre.com/streamhub/#liveChat">Click here</a> for more information.</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div id="major-publishing-actions">
                            <div id="publishing-action">
 public static function show_chat()
 {
     global $post;
     /* Is this a post and is the settings checkbox on? */
     $display_posts = is_single() && get_option('livefyre_apps-livefyre_chat_display_post');
     /* Is this a page and is the settings checkbox on? */
     $display_pages = is_page() && get_option('livefyre_apps-livefyre_chat_display_page');
     /* Are comments open on this post/page? */
     $comments_open = $post->comment_status == 'open';
     $display = $display_posts || $display_pages;
     $post_type = get_post_type();
     if ($post_type != 'post' && $post_type != 'page') {
         $post_type_name = 'livefyre_chat_display_' . $post_type;
         $display = get_option('livefyre_apps-' . $post_type_name, 'true') == 'true';
     }
     return $display && Livefyre_Apps::is_app_enabled('chat') && !is_preview() && $comments_open;
 }
 /**
  * Get list of post types where LiveChat is enabled
  * @return array
  */
 public static function get_chat_display_post_types()
 {
     $used_types = array();
     if (Livefyre_Apps::is_app_enabled('chat')) {
         $excludes = array('_builtin' => false);
         $post_types = get_post_types($excludes);
         $post_types = array_merge(array('post' => 'post', 'page' => 'page'), $post_types);
         foreach ($post_types as $post_type) {
             $post_type_name = 'livefyre_chat_display_' . $post_type;
             if (get_option('livefyre_apps-' . $post_type_name) === true || get_option('livefyre_apps-' . $post_type_name) === 'true') {
                 $used_types[$post_type_name] = $post_type_name;
             }
         }
     }
     return $used_types;
 }