/var/www/hkosl.com/aga/wp-content/plugins/so-widgets-bundle/base/inc/fields/link.class.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php

/**
 * Class SiteOrigin_Widget_Field_Link
 */
class SiteOrigin_Widget_Field_Link extends SiteOrigin_Widget_Field_Text_Input_Base {

    
/**
     * An array of post types to use in the query for posts when the 'Select Content' button is clicked.
     *
     * @access protected
     * @var array
     */
    
protected $post_types;

    protected function 
render_before_field$value$instance ) {
        
parent::render_before_field$value$instance );
        
$post_types = ! empty( $this->post_types ) && is_array$this->post_types ) ? implode','$this->post_types ) : '';
        
?>
        <a href="#" class="select-content-button button button-small"><?php esc_html_e('Select Content''so-widgets-bundle'?></a>
        <div class="existing-content-selector">

            <input type="text" class="content-text-search"
                   data-post-types="<?php echo esc_attr$post_types ?>"
                   placeholder="<?php esc_attr_e'Search Content''so-widgets-bundle' ?>"/>

            <ul class="posts"></ul>

            <div class="buttons">
                <a href="#" class="button-close button"><?php esc_html_e('Close''so-widgets-bundle'?></a>
            </div>
        </div>
        <div class="url-input-wrapper">
        <?php
    
}

    protected function 
render_after_field$value$instance ) {
        
?>
        </div>
        <?php
        parent
::render_after_field$value$instance );
    }

    protected function 
sanitize_field_input$value$instance ) {
        
$sanitized_value trim$value );
        if ( 
preg_match'/^post\: *([0-9]+)/'$sanitized_value$matches ) ) {
            
$sanitized_value 'post: ' $matches[1];
        } else {
            
$sanitized_value sow_esc_url_raw$sanitized_value );
        }

        return 
$sanitized_value;
    }


}