get_plugin_options() статический публичный Метод

static public get_plugin_options ( )
Пример #1
0
 function publish_to_discourse()
 {
     global $post;
     $options = Discourse::get_plugin_options();
     if (in_array($post->post_type, $options['allowed_post_types'])) {
         if ($post->post_status == 'auto-draft') {
             $value = $options['auto-publish'];
         } else {
             $value = get_post_meta($post->ID, 'publish_to_discourse', true);
         }
         echo '<div class="misc-pub-section misc-pub-section-last">
        <span>' . '<input type="hidden" name="showed_publish_option" value="1">' . '<label><input type="checkbox"' . ($value == "1" ? ' checked="checked" ' : null) . 'value="1" name="publish_to_discourse" /> Publish to Discourse</label>' . '</span></div>';
     }
 }
Пример #2
0
 function publish_to_discourse()
 {
     global $post;
     $options = Discourse::get_plugin_options();
     if (in_array($post->post_type, $options['allowed_post_types'])) {
         if ($post->post_status == 'auto-draft') {
             $value = $options['auto-publish'];
         } else {
             $value = get_post_meta($post->ID, 'publish_to_discourse', true);
         }
         $categories = self::get_discourse_categories('0');
         if (is_wp_error($categories)) {
             echo '<span>' . __('Unable to retrieve Discourse categories. Please check the wp-discourse plugin settings page to establish a connection.', 'wp-discourse') . '</span>';
         } else {
             echo '<div class="misc-pub-section misc-pub-section-discourse">';
             echo '<label>' . __('Publish to Discourse: ', 'wp-discourse') . '</label>';
             echo '<input type="checkbox"' . ($value == "1" ? ' checked="checked" ' : null) . 'value="1" name="publish_to_discourse" />';
             echo '</div>';
             echo '<div class="misc-pub-section misc-pub-section-category">' . '<input type="hidden" name="showed_publish_option" value="1">';
             echo '<label>' . __('Discourse Category: ', 'wp-discourse') . '</label>';
             $publish_post_category = get_post_meta($post->ID, 'publish_post_category', true);
             $default_category = isset($options['publish-category']) ? $options['publish-category'] : '';
             $selected = !empty($publish_post_category) ? $publish_post_category : $default_category;
             self::option_input('publish_post_category', $categories, $selected);
             echo '</div>';
         }
     }
 }