1 | <?php |
||
3 | abstract class AMP_Base_Sanitizer { |
||
4 | const FALLBACK_HEIGHT = 400; |
||
5 | |||
6 | protected $DEFAULT_ARGS = array(); |
||
7 | |||
8 | protected $dom; |
||
9 | protected $args; |
||
10 | protected $did_convert_elements = false; |
||
11 | |||
12 | public function __construct( $dom, $args = array() ) { |
||
16 | |||
17 | abstract public function sanitize(); |
||
18 | |||
19 | public function get_scripts() { |
||
22 | |||
23 | public function get_styles() { |
||
26 | |||
27 | protected function get_body_node() { |
||
30 | |||
31 | public function sanitize_dimension( $value, $dimension ) { |
||
53 | |||
54 | public function enforce_fixed_height( $attributes ) { |
||
66 | |||
67 | /** |
||
68 | * This is our workaround to enforce max sizing with layout=responsive. |
||
69 | * |
||
70 | * We want elements to not grow beyond their width and shrink to fill the screen on viewports smaller than their width. |
||
71 | * |
||
72 | * See https://github.com/ampproject/amphtml/issues/1280#issuecomment-171533526 |
||
73 | * See https://github.com/Automattic/amp-wp/issues/101 |
||
74 | */ |
||
75 | public function enforce_sizes_attribute( $attributes ) { |
||
91 | |||
92 | public function add_or_append_attribute( &$attributes, $key, $value, $separator = ' ' ) { |
||
99 | |||
100 | /** |
||
101 | * Decide if we should remove a src attribute if https is required. |
||
102 | * If not required, the implementing class may want to try and force https instead. |
||
103 | * |
||
104 | * @param string $src |
||
105 | * @param boolean $force_https |
||
106 | * @return string |
||
107 | */ |
||
108 | public function maybe_enforce_https_src( $src, $force_https = false ) { |
||
124 | } |
||
125 |