Last active
March 12, 2019 18:09
-
-
Save davidsword/0aa554ff8fff8591609851c7237bb72f to your computer and use it in GitHub Desktop.
PHP - part of an Alfred Workflow that changes a development url to production
This file contains hidden or 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 // don't actually use the php in workflow | |
// get the result of Apple Script action | |
$url = '{query}'; | |
$a = ['http:','.loc']; // dev | |
$b = ['https:','.com']; // production | |
// identify if production and invert if so | |
if (strstr($url,$b[1])) | |
list($a,$b) = [$b,$a]; | |
// the ol switcher'oo | |
$newurl = str_replace($a,$b,$url); | |
// give next action the new url | |
echo trim($newurl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment