- Domain (i.e. example.com)
- Subdomain(s): (i.e. www.example.com)
- Username
- App name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Forgot where this came from | |
function rand_date($min_date, $max_date) { | |
$min_epoch = strtotime($min_date); | |
$max_epoch = strtotime($max_date); | |
$rand_epoch = rand($min_epoch, $max_epoch); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Bootstrap ProcessWire | |
include 'index.php'; | |
// Process CSV | |
$rows = array_map('str_getcsv', file('fields.csv')); | |
$header = array_shift($rows); | |
$fields = array(); | |
foreach ($rows as $row) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
for ($i = 1; $i <= 20; $i++) | |
{ | |
$title = file_get_contents("http://loripsum.net/api/1/plaintext/long/prude/"); | |
$body = file_get_contents("http://loripsum.net/api/3/decorate/link/ul/prude/long/"); | |
$template = "INSERT_TEMPLATE_HERE"; // i.e. 'basic-page' | |
$parent = "INSERT_PARENT_HERE"; // i.e. /about-us/ | |
$c = new Page(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Thanks to netcarver > https://processwire.com/talk/topic/7803-implement-array-chunk/?p=75573 | |
$items = $pages->find('#whatever'); // Find your stuff | |
$parts = 3; // How many items should there be in 1 chunk? | |
$chunked = array_chunk($items->getArray(), $parts); | |
foreach ($chunked as $chunk) { | |
foreach ($chunk as $item) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Thanks to http://steindom.com/articles/shortest-php-code-convert-csv-associative-array */ | |
ini_set('auto_detect_line_endings', TRUE); | |
$rows = array_map('str_getcsv', file('myfile.csv')); | |
$header = array_shift($rows); | |
$csv = array(); | |
foreach ($rows as $row) { |
OlderNewer