@@ -110,6 +110,10 @@ function getOption($name, $default = null)
110110 {
111111 return isset ($ _GET ['options ' ][$ name ]) ? $ _GET ['options ' ][$ name ] : $ default ;
112112 }
113+ function getResolverOption ($ name , $ default = null )
114+ {
115+ return isset ($ _GET ['resolver ' ][$ name ]) ? $ _GET ['resolver ' ][$ name ] : $ default ;
116+ }
113117 ?>
114118
115119 <body>
@@ -131,10 +135,10 @@ function getOption($name, $default = null)
131135 <fieldset class="options">
132136 <h2>Request resolver options:</h2>
133137
134- <label><span>User agent:</span> <input type="text" name="options [user_agent]" value="<?php echo getOption ('user_agent ' , 'Embed PHP Library ' ); ?> "></label>
135- <label><span>Max redirections:</span> <input type="number" name="options [max_redirections]" value="<?php echo getOption ('max_redirections ' , 20 ); ?> "></label>
136- <label><span>Connection timeout:</span> <input type="number" name="options [connection_timeout]" value="<?php echo getOption ('connection_timeout ' , 10 ); ?> "></label>
137- <label><span>Timeout:</span> <input type="number" name="options [timeout]" value="<?php echo getOption ('timeout ' , 10 ); ?> "></label>
138+ <label><span>User agent:</span> <input type="text" name="resolver [user_agent]" value="<?php echo getResolverOption ('user_agent ' , 'Embed PHP Library ' ); ?> "></label>
139+ <label><span>Max redirections:</span> <input type="number" name="resolver [max_redirections]" value="<?php echo getResolverOption ('max_redirections ' , 20 ); ?> "></label>
140+ <label><span>Connection timeout:</span> <input type="number" name="resolver [connection_timeout]" value="<?php echo getResolverOption ('connection_timeout ' , 10 ); ?> "></label>
141+ <label><span>Timeout:</span> <input type="number" name="resolver [timeout]" value="<?php echo getResolverOption ('timeout ' , 10 ); ?> "></label>
138142 </fieldset>
139143 <fieldset class="action">
140144 <button type="submit">Test</button>
@@ -144,8 +148,12 @@ function getOption($name, $default = null)
144148 <?php if (!empty ($ _GET ['url ' ])): ?>
145149 <section>
146150 <?php
147- $ url = new Embed \Request ($ _GET ['url ' ]);
148151 $ options = isset ($ _GET ['options ' ]) ? (array ) $ _GET ['options ' ] : array ();
152+ $ resolverOptions = isset ($ _GET ['resolver ' ]) ? (array ) $ _GET ['resolver ' ] : array ();
153+
154+ Embed \Request::setResolverConfig ($ resolverOptions );
155+
156+ $ url = new Embed \Request ($ _GET ['url ' ]);
149157 $ info = Embed \Embed::create ($ url , $ options );
150158 ?>
151159
@@ -184,7 +192,11 @@ function getOption($name, $default = null)
184192 </tr>
185193 <tr>
186194 <th>Image</th>
187- <td><img src="<?php echo $ info ->image ; ?> "> <?php echo $ info ->image ; ?> </td>
195+ <td>
196+ <?php if ($ info ->image ): ?>
197+ <img src="<?php echo $ info ->image ; ?> "> <?php echo $ info ->image ; ?>
198+ <?php endif ; ?>
199+ </td>
188200 </tr>
189201 <tr>
190202 <th>Image size</th>
0 commit comments