Builds the like or unlike link

 @return [String] the html needed to display the like/unlike link
507612
def link_to_like_or_unlike
      return unless helpers.current_user

      options = current_user_likes? ? like_options : unlike_options

      like_or_unlike_link(options: options)
    end
456540
def linkify(props):
    
    match = props['match']
    protocol = match.group(1)
    url = match.group(2)
    href = protocol + url

    if props['block']['type'] == BLOCK_TYPES.CODE:
        return href

    link_props = {
        'href': href,
    }

    if href.startswith('www'):
        link_props['href'] = 'http://' + href

    return DOM.create_element('a', link_props, href)
246426
def search
      # if full name provided then get the key and redirect to it, otherwise return similar in json
      if params[:search_key_name].present?
        @translation_key = TranslationKey.find_by_name(params[:search_key_name])
      else
        @key_names = TranslationKey.where('name LIKE ?', "%#{params[:query]}%")
      end

      respond_to do |format|
        format.html { redirect_to @translation_key}
        format.json { render json: @key_names.map(&:name) }
      end
    end
849597
def render_alternate(tags)
      alternate = meta_tags.extract(:alternate)
      return unless alternate

      if alternate.kind_of?(Hash)
        alternate.each do |hreflang, href|
          tags << Tag.new(:link, rel: 'alternate', href: href, hreflang: hreflang) if href.present?
        end
      elsif alternate.kind_of?(Array)
        alternate.each do |link_params|
          tags << Tag.new(:link, { rel: 'alternate' }.with_indifferent_access.merge(link_params))
        end
      end
    end
473724
def build_string
      if flags
        build_string_with_flags_and_maybe_issues_and_info_and_name
      elsif issues
        build_string_with_issues_and_maybe_info_and_name
      elsif info
        build_string_with_info_and_maybe_name
      elsif name
        build_string_with_name
      else
        build_base_string
      end
    end
351395
def remote_link_to(name, url, options = {}, &block)
      options[:href] ||= url
      Effective::FormInputs::RemoteLinkTo.new(name, options, builder: self).to_html(&block)
    end
198341
def build_query_string(options)
      options = camelcase_keys(options)
      
      query = ''

      options.each do |k,v|
        if k == :address
          if RUBY_VERSION.to_f >= 1.9
            if v.instance_of?(String)
              v.each_line { |address| query += "#{ '&' if query != '' }address=#{CGI.escape address}" }
            else
              v.each { |address| query += "#{ '&' if query != '' }address=#{CGI.escape address}" }
            end
          else
            v.each { |address| query += "#{ '&' if query != '' }address=#{CGI.escape address}" }
          end
        else
          query += "#{ '&' if query != '' }#{k.to_s}=#{CGI.escape v}"
        end
      end

      query
    end
190594
def index
      @search = Snippet.order('title asc').search(params[:q])
      @snippets = @search.result(distinct: true).per_page_kaminari(params[:page]).per(10)

      respond_to do |format|
        format.html # index.html.erb
        format.json { render json: @snippets }
      end
    end
522568
def normalize_links
      stack = @links.dup

      @links.clear

      while link = stack.pop
        relationship = case link
          when Symbol, String
            @relationships[link]
          else
            link
        end

        if relationship.respond_to?(:links)
          stack.concat(relationship.links)
        elsif !@links.include?(relationship)
          @links << relationship
        end
      end

      @links.reverse!
    end
255207
def render(txt):
    

    # Removing links to other channels
    txt = re.sub(r'<#[^\|]*\|(.*)>', r'#\g<1>', txt)

    # Removing links to other users
    txt = re.sub(r'<(@.*)>', r'\g<1>', txt)

    # handle named hyperlinks
    txt = re.sub(r'<([^\|]*)\|([^\|]*)>', r'<a href="\g<1>" target="blank">\g<2></a>', txt)

    # handle unnamed hyperlinks
    txt = re.sub(r'<([^a|/a].*)>', r'<a href="\g<1>" target="blank">\g<1></a>', txt)

    # handle ordered and unordered lists
    for delimeter in LIST_DELIMITERS:
        slack_tag = delimeter
        class_name = LIST_DELIMITERS[delimeter]

        # Wrap any lines that start with the slack_tag in <li></li>
        list_regex = u'(?:^|\n){}\s?(.*)'.format(slack_tag)
        list_repl = r'<li class="list-item-{}">\g<1></li>'.format(class_name)
        txt = re.sub(list_regex, list_repl, txt)

    # hanlde blockquotes
    txt = re.sub(u'(^|\n)(?:&gt;){3}\s?(.*)$', r'\g<1><blockquote>\g<2></blockquote>', txt, flags=re.DOTALL)
    txt = re.sub(u'(?:^|\n)&gt;\s?(.*)\n?', r'<blockquote>\g<1></blockquote>', txt)

    # handle code blocks
    txt = re.sub(r'```\n?(.*)```', r'<pre>\g<1></pre>', txt, flags=re.DOTALL)
    txt = re.sub(r'\n(</pre>)', r'\g<1>', txt)

    # handle bolding, italics, and strikethrough
    for wrapper in FORMATTERS:
        slack_tag = wrapper
        html_tag = FORMATTERS[wrapper]

        # Grab all text in formatted characters on the same line unless escaped
        regex = r'(?<!\\)\{t}([^\{t}|\n]*)\{t}'.format(t=slack_tag)
        repl = r'<{t}>\g<1></{t}>'.format(t=html_tag)
        txt = re.sub(regex, repl, txt)

    # convert line breaks
    txt = txt.replace('\n', '<br />')

    # clean up bad HTML
    parser = CustomSlackdownHTMLParser(txt)
    txt = parser.clean()

    # convert multiple spaces
    txt = txt.replace(r'  ', ' &nbsp')

    return txt
1077902
def unlike(likeable)
    	if @@likeable_model_names.include? likeable.class.to_s.downcase
    		likeable.likers.delete self
    		self.save
    	else 
    		false
    	end
    end
26988
def show
      if params[:page_name] == "website"
        return render json: Website.unique_instance.as_json_for_page
      end

      page = Pwb::Page.find_by_slug(params[:page_name])
      if page
        render json: page.as_json_for_admin
      else
        render json: {}
      end
    end
874714
public function like_match($like_match)
    {
        switch ($like_match) {
            case self::LIKE_MATCH_AND:
            case self::LIKE_MATCH_OR:
                $this->like_match = $like_match;
                break;
            default:
                break;
        }
        $this->total = $this->page = $this->total_page = null;

        return $this;
    }
104233
def show
      prevent_browser_caching
      cms_edit_links!
      with_email_locale do
        if @preview.respond_to?(:preview_mail)
          @mail, body     = mail_and_body
          @mail_body_html = render_to_string(inline: body, layout: 'rails_email_preview/email')
        else
          raise ArgumentError.new("#{@preview} is not a preview class, does not respond_to?(:preview_mail)")
        end
      end
    end
322496
def _html_link_cells(self):
        
        new_table = self.copy()
        for row in new_table:
            for c in new_table.columns:
                link = '%s <Link>' % c
                if row.get(link, None):
                    row[c] = '<a href="%s">%s</a>' % (row[link], row[c])

        new_table.columns = [c for c in self.columns if '<Link>' not in c]
        return new_table
1211003
def find_link(from_group, to_group)
      @links.find do |l|
        /\A#{ from_group }\z/.match(l.from_group) and /\A#{ to_group }\z/.match(l.to_group)
      end
    end
786717
def list_url?(u = nil, parsed: nil)
      return false if (u.nil? || u.empty?) && parsed.nil?
      parsed ||= parse_url(u)
      child_type = parsed[:child_type]
      parsed[:type] == 'lists' && (child_type.nil? || child_type.empty?)
    end