<commit_before># The Blog class represents the one and only blog.  It stores most
# configuration settings and is linked to most of the assorted content
# classes via has_many.
#
# Once upon a time, there were plans to make publify handle multiple blogs,
# but it never happened and publify is now firmly single-blog.
#
class Blog < ActiveRecord::Base
  include ConfigManager
  include Rails.application.routes.url_helpers

  attr_accessor :custom_permalink

  default_scope -> { order('id') }

  validate(on: :create) { |blog|
    unless Blog.count.zero?
      blog.errors.add(:base, 'There can only be one...')
    end
  }

  validates :blog_name, presence: true

  serialize :settings, Hash

  # Description
  setting :blog_name,                  :string, 'My Shiny Weblog!'
  setting :blog_subtitle,              :string, ''
  setting :geourl_location,            :string, ''
  setting :canonical_server_url,       :string, ''  # Deprecated
  setting :lang,                       :string, 'en_US'
  setting :title_prefix,               :integer, 0 # Deprecated but needed for a migration

  # Spam
  setting :sp_global,                  :boolean, false
  setting :sp_article_auto_close,      :integer, 0
  setting :sp_url_limit,               :integer, 0
  setting :sp_akismet_key,             :string, ''
  setting :use_recaptcha,              :boolean, false

  # Mostly Behaviour
  setting :text_filter,                :string, 'markdown smartypants'
  setting :comment_text_filter,        :string, 'markdown smartypants'
  setting :limit_article_display,      :integer, 10
  setting :limit_rss_display,          :integer, 10
  setting :default_allow_pings,        :boolean, false
  setting :default_allow_comments,     :boolean, true
  setting :default_moderate_comments,  :boolean, false
  setting :link_to_author,             :boolean, false
  setting :show_extended_on_rss,       :boolean, true # deprecated but still needed for backward compatibility
  setting :hide_extended_on_rss,       :boolean, false
  setting :plugin_avatar,              :string, ''
  setting :global_pings_disable,       :boolean, false
  setting :ping_urls,                  :string, "http://blogsearch.google.com/ping/RPC2\nhttp://rpc.technorati.com/rpc/ping\nhttp://ping.blo.gs/\nhttp://rpc.weblogs.com/RPC2"
  setting :send_outbound_pings,        :boolean, true
  setting :email_from,                 :string, '<EMAIL>'
  setting :allow_signup,               :integer, 0
  setting :date_format,                :string, '%d/%m/%Y'
  setting :time_format,                :string, '%Hh%M'
  setting :image_avatar_size,          :integer, 48
  setting :image_thumb_size,           :integer, 125
  setting :image_medium_size,          :integer, 600

  # SEO
  setting :meta_description,           :string, ''
  setting :meta_keywords,              :string, ''
  setting :google_analytics,           :string, ''
  setting :feedburner_url,             :string, ''
  setting :rss_description,            :boolean, false
  setting :rss_description_text,       :string, "<hr /><p><small>Original article written by %author% and published on <a href='%blog_url%'>%blog_name%</a> | <a href='%permalink_url%'>direct link to this article</a> | If you are reading this article anywhere other than on <a href='%blog_url%'>%blog_name%</a>, it has been illegally reproduced and without proper authorization.</small></p>"
  setting :permalink_format,           :string, '/%year%/%month%/%day%/%title%'
  setting :robots,                     :string, 'User-agent: *\nAllow: /\nDisallow: /admin\n'
  setting :humans,                     :string, "/* TEAM */\nYour title: Your name.\nSite: email, link to a contact form, etc.\nTwitter: your Twitter username.\n\n/* SITE */\nSoftware: Publify [http://publify.co] #{PUBLIFY_VERSION}"

  setting :index_categories,           :boolean, true # deprecated but still needed for backward compatibility
  setting :unindex_categories,         :boolean, false
  setting :index_tags,                 :boolean, true # deprecated but still needed for backward compatibility
  setting :unindex_tags,               :boolean, false<commit_msg>altered date format to closer match design of article page<commit_after># The Blog class represents the one and only blog.  It stores most
# configuration settings and is linked to most of the assorted content
# classes via has_many.
#
# Once upon a time, there were plans to make publify handle multiple blogs,
# but it never happened and publify is now firmly single-blog.
#
class Blog < ActiveRecord::Base
  include ConfigManager
  include Rails.application.routes.url_helpers

  attr_accessor :custom_permalink

  default_scope -> { order('id') }

  validate(on: :create) { |blog|
    unless Blog.count.zero?
      blog.errors.add(:base, 'There can only be one...')
    end
  }

  validates :blog_name, presence: true

  serialize :settings, Hash

  # Description
  setting :blog_name,                  :string, 'My Shiny Weblog!'
  setting :blog_subtitle,              :string, ''
  setting :geourl_location,            :string, ''
  setting :canonical_server_url,       :string, ''  # Deprecated
  setting :lang,                       :string, 'en_US'
  setting :title_prefix,               :integer, 0 # Deprecated but needed for a migration

  # Spam
  setting :sp_global,                  :boolean, false
  setting :sp_article_auto_close,      :integer, 0
  setting :sp_url_limit,               :integer, 0
  setting :sp_akismet_key,             :string, ''
  setting :use_recaptcha,              :boolean, false

  # Mostly Behaviour
  setting :text_filter,                :string, 'markdown smartypants'
  setting :comment_text_filter,        :string, 'markdown smartypants'
  setting :limit_article_display,      :integer, 10
  setting :limit_rss_display,          :integer, 10
  setting :default_allow_pings,        :boolean, false
  setting :default_allow_comments,     :boolean, true
  setting :default_moderate_comments,  :boolean, false
  setting :link_to_author,             :boolean, false
  setting :show_extended_on_rss,       :boolean, true # deprecated but still needed for backward compatibility
  setting :hide_extended_on_rss,       :boolean, false
  setting :plugin_avatar,              :string, ''
  setting :global_pings_disable,       :boolean, false
  setting :ping_urls,                  :string, "http://blogsearch.google.com/ping/RPC2\nhttp://rpc.technorati.com/rpc/ping\nhttp://ping.blo.gs/\nhttp://rpc.weblogs.com/RPC2"
  setting :send_outbound_pings,        :boolean, true
  setting :email_from,                 :string, '<EMAIL>'
  setting :allow_signup,               :integer, 0
  setting :date_format,                :string, '%B %d %Y'
  setting :time_format,                :string, '%Hh%M'
  setting :image_avatar_size,          :integer, 48
  setting :image_thumb_size,           :integer, 125
  setting :image_medium_size,          :integer, 600

  # SEO
  setting :meta_description,           :string, ''
  setting :meta_keywords,              :string, ''
  setting :google_analytics,           :string, ''
  setting :feedburner_url,             :string, ''
  setting :rss_description,            :boolean, false
  setting :rss_description_text,       :string, "<hr /><p><small>Original article written by %author% and published on <a href='%blog_url%'>%blog_name%</a> | <a href='%permalink_url%'>direct link to this article</a> | If you are reading this article anywhere other than on <a href='%blog_url%'>%blog_name%</a>, it has been illegally reproduced and without proper authorization.</small></p>"
  setting :permalink_format,           :string, '/%year%/%month%/%day%/%title%'
  setting :robots,                     :string, 'User-agent: *\nAllow: /\nDisallow: /admin\n'
  setting :humans,                     :string, "/* TEAM */\nYour title: Your name.\nSite: email, link to a contact form, etc.\nTwitter: your Twitter username.\n\n/* SITE */\nSoftware: Publify [http://publify.co] #{PUBLIFY_VERSION}"

  setting :index_categories,           :boolean, true # deprecated but still needed for backward compatibility
  setting :unindex_categories,         :boolean, false
  setting :index_tags,                 :boolean, true # deprecated but still needed for backward compatibility
  setting :unindex_tags,               :boolean, false
{'fraction_non_alphanumeric': 0.10413917216556688, 'fraction_numerical': 0.004319136172765447, 'mean_word_length': 2.7685352622061483, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7203746', 'n_tokens_mistral': 2485, 'n_tokens_neox': 2362, 'n_words': 704}