Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

playground: image & cache #86

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/playground.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// Enable cache
hQuery::$cache_path = sys_get_temp_dir() . '/hQuery/';
hQuery::$cache_expires = (int)$_POST['ch'];// cache value = 0
$_POST['ch'] === '0' || (int)$_POST['ch'] > 0 and hQuery::$cache_expires = (int)$_POST['ch'];

// Results acumulator
$return = array();
Expand Down Expand Up @@ -281,7 +281,7 @@
<form name="hquery" action="" method="post">
<p><label>URL: <input type="url" name="url" value="<?=htmlspecialchars(@$url??'', ENT_QUOTES);?>" placeholder="e.g. https://mariauzun.com/portfolio" autofocus class="form-control" required /></label></p>
<p><label>Selector: <input type="text" name="sel" value="<?=htmlspecialchars(@$sel??'', ENT_QUOTES);?>" placeholder="e.g. 'a[href] &gt; img[src]:parent'" class="form-control" required /></label></p>
<p><label>Cache: <input type="number" name="ch" value="<?=$_POST['ch']>=0?@$_POST['ch']:1800;?>" min="0" max="3600" placeholder="e.g. 1800" class="form-control" /> (seconds)</label></p>
<p><label>Cache: <input type="number" name="ch" value="<?=$_POST['ch']==='0'||(int)$_POST['ch']>0?@$_POST['ch']:'';?>" min="0" max="3600" placeholder="e.g. 600" class="form-control" /> (seconds) <code>default: 3600</code></label></p>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line repeats the logic for ch.


<p>
<button type="submit" name="go" value="elements" <?=$go=='elements'?'aria-pressed="true"':''?> class="btn btn-success">Fetch elements</button>
Expand Down Expand Up @@ -327,7 +327,7 @@
hQuery::$cache_path: <code><?php echo hQuery::$cache_path ?></code>
</li>
<li class="list-group-item">
hQuery::$cache_expires: <code><?php echo hQuery::$cache_expires ?></code>
hQuery::$cache_expires: <code><?php echo hQuery::$cache_expires ?> s</code>
</li>
<li class="list-group-item">
Size: <span data-name="doc.size" class="badge"><?=empty($doc)?'':$doc->size;?></span>
Expand Down