diff --git a/hypothesis.php b/hypothesis.php
index 9dd3e6e..62b943c 100644
--- a/hypothesis.php
+++ b/hypothesis.php
@@ -1,29 +1,295 @@
options = get_option( 'wp_hypothesis_options' );
+ ?>
+
+
+
+ options["allow-on-blog-page"]) ? $this->options["allow-on-blog-page"]: null, 1, false ).'/>',
+ isset( $this->options['allow-on-blog-page'] ) ? esc_attr( $this->options['allow-on-blog-page']) : 0
+ );
+ }
+
+ /**
+ * Get the settings option array and print one of its values
+ */
+ public function allow_on_front_page_callback()
+ {
+ printf(
+ 'options["allow-on-front-page"]) ? $this->options["allow-on-front-page"]: null, 1, false ).' />',
+ isset( $this->options['allow-on-front-page'] ) ? esc_attr( $this->options['allow-on-front-page']) : 0
+ );
+ }
+
+ /**
+ * Get the settings option array and print one of its values
+ */
+ public function allow_on_posts_callback()
+ {
+ printf(
+ 'options["allow-on-posts"]) ? $this->options["allow-on-posts"]: null, 1, false ).' />',
+ isset( $this->options['allow-on-posts'] ) ? esc_attr( $this->options['allow-on-posts']) : 0
+ );
+ }
+
+ /**
+ * Get the settings option array and print one of its values
+ */
+ public function allow_on_pages_callback()
+ {
+ printf(
+ 'options["allow-on-pages"]) ? $this->options["allow-on-pages"]: null, 1, false ).' />',
+ isset( $this->options['allow-on-pages'] ) ? esc_attr( $this->options['allow-on-pages']) : 0
+ );
+ }
+
+ /**
+ * Get the settings option array and print one of its values
+ */
+ public function post_ids_override_callback()
+ {
+ printf(
+ '',
+ isset( $this->options['post_ids_override'] ) ? esc_attr( implode(',', $this->options['post_ids_override'])) : ''
+ );
+ }
+
+ /**
+ * Get the settings option array and print one of its values
+ */
+ public function page_ids_override_callback()
+ {
+ printf(
+ '',
+ isset( $this->options['page_ids_override'] ) ? esc_attr( implode(',',$this->options['page_ids_override'])) : ''
+ );
+ }
+
+ /**
+ * Get the settings option array and print one of its values
+ */
+ public function category_ids_override_callback()
+ {
+ printf(
+ '',
+ isset( $this->options['category_ids_override'] ) ? esc_attr( implode(',',$this->options['category_ids_override'])) : ''
+ );
+ }
}
-add_action( 'init', 'add_hypothesis' );
+if( is_admin() )
+ $hypothesis_settings_page = new HypothesisSettingsPage();
+
+/**
+ * Add Hypothesis over https based on conditions set in the plugin settings.
+ */
+add_action('wp', 'add_hypothesis');
+
+function add_hypothesis($param) {
+ $options = get_option( 'wp_hypothesis_options' );
+ if (isset($options['allow-on-blog-page']) && is_home()):
+ wp_enqueue_script( 'hypothesis', '//hypothes.is/embed.js', '', false, true );
+ elseif (isset($options['allow-on-front-page']) && is_front_page()):
+ wp_enqueue_script( 'hypothesis', '//hypothes.is/embed.js', '', false, true );
+ elseif (isset($options['allow-on-posts']) && is_single()):
+ if (isset($options['post_ids_override']) && is_single($options['post_ids_override']));
+ elseif (isset($options['category_ids_override']) && in_category($options['category_ids_override']));
+ else
+ wp_enqueue_script( 'hypothesis', '//hypothes.is/embed.js', '', false, true );
+ elseif (isset($options['allow-on-pages']) && is_page() && !is_front_page() && !is_home()):
+ if (isset($options['page_ids_override']) && is_page($options['page_ids_override']));
+ else
+ wp_enqueue_script( 'hypothesis', '//hypothes.is/embed.js', '', false, true );
+ endif;
+}
?>