Jump to content

Search the Community

Showing results for tags 'php'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Alfred 3
  • Make the Most of Alfred
    • Discussion & Help
    • Bug Reports
    • Alfred Feature Suggestions
    • Themes
  • Alfred Workflows
    • Share your Workflows
    • Workflow Help & Questions
  • Alfred v2 Themes
  • Alfred Remote for iOS
    • Alfred Remote Discussion & Help
    • Remote Connection Troubleshooting

Categories

  • Articles
    • Forum Integration
    • Frontpage
  • Pages
  • Miscellaneous
    • Databases
    • Templates
    • Media

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Twitter


Website URL


Jabber


Location


Interests

Found 29 results

  1. Hello again. I'm rebuilding my own Alfred-Time Workflow (use Toggl and/or Harvest with Alfred) and I started developing some PHP packages to ease the development of Alfred Workflows in PHP. Last week I've released Alfred Workflow ScriptFilter that allows you to create a ScriptFilter output. This week I've worked on handling configuration settings. I think it's quite nice when we developed a Workflow not to bother spending time on things that are common to a lot of them. So if you use PHP and need to store some config, you might want to have a look at the package I've made. Here's the GitHub link: https://github.com/godbout/alfred-workflow-config Currently it's tailored for my needs. For example there's no feature to delete a config file. If you need stuff like that, you can open an issue on GitHub or we can talk about it here. I'll see how I can extend usefully. Happy productivity!
  2. Hello there. To build cleaner workflows I needed to use some of the new fields found in Alfred 3.4.1 and 3.5. I usually use the fantastic package from Joe Tannenbaum to build my workflows but it's not updated and its fluent api is starting to show its limitation with the new nested fields. So I build my own. I started using it to build the v2 of my Alfred Time package and I'm quite pleased with it so I'm thinking, if you need to build workflows that handle the new nested field, you might want to have a look at my workflow. If not, Joe's package might have a nicer API. https://github.com/godbout/alfred-workflow-php Have fun, and be productive with Alfred!
  3. I worked with small PHP scripts to write my own workflows and noticed that I often would do the same jobs with every script again, so I decided to build a little toolkit around the Symfony 4.1 Command component. It provides a way to seamless have different states for Autocompletion and an easy way to configure variables that you can use in your script (saves it to .env file). As a proof-of-concept I wrote a movie-rating workflow in which you can rate your movie in different categories. The PHP-Code is as short as this command: class MovieRatingCommand extends AlfredInteractiveContainerAwareCommand { protected function configure() { $this ->setName('movie-rating') ->addArgument('category', InputArgument::OPTIONAL) ->addArgument('stars', InputArgument::OPTIONAL) ->addArgument('movie', InputArgument::OPTIONAL + InputArgument::IS_ARRAY); } protected function initialize(InputInterface $input, OutputInterface $output) { $stars = $this->getContainer()->getParameter('stars'); $categories = $this->getContainer()->getParameter('categories'); $filename = $this->getContainer()->getParameter('filename'); $sheetname = $this->getContainer()->getParameter('sheetname'); $tablename = $this->getContainer()->getParameter('tablename'); $this->addArgumentsAllowedValues('stars', $stars); $this->addArgumentsAllowedValues('category', $categories); $this->addInputHandler(['category', 'stars'], function () { $workflow = new WorkflowResult(); $workflow->setValid(false); $workflow->setTitle('Insert movie name to rate'); return [$workflow]; }); $showQuestions = function ($arguments) use ($categories, $filename, $sheetname, $tablename) { $movie = $arguments['movie']; $category = $arguments['category']; $stars = $arguments['stars']; if (!is_array($stars)) { $result = new WorkflowResult(); $result->setValid(true); $result->setTitle('Rate ' . $movie . ' - ' . $category . ': ' . $stars . ' stars'); $result->setSubtitle('Rate ' . $movie . ' in category "' . $category . '": ' . $stars . ' stars'); $result->setLargetype('Rate ' . $movie . ' in category "' . $category . '": ' . $stars . ' stars'); $result->setArg(json_encode([ 'movie' => $movie, 'currentdate' => (new \DateTime())->format('d.m.Y'), 'category' => $category, 'stars' => $stars, ])); $this->workflowHelper->variable('movie', $movie); $this->workflowHelper->variable('currentdate', (new \DateTime())->format('d.m.Y')); $this->workflowHelper->variable('category', iconv("ISO-8859-1", "UTF-8", utf8_decode($category))); $this->workflowHelper->variable('stars', $stars); $this->workflowHelper->variable('filename', $filename ?: null); $this->workflowHelper->variable('sheetname', $sheetname ?: null); $this->workflowHelper->variable('tablename', $tablename ?: null); return [$result]; } }; $this->addInputHandler(['category', 'stars', 'movie'], $showQuestions); } } You can find the Proof-of-concept here: https://github.com/dpeuscher/alfred-movie-rating. The Alfred-Symfony Toolkit can be found here: https://github.com/dpeuscher/alfred-symfony-tools. You can also use this composer command to use it: composer req dpeuscher/alfred-symfony-tools Thoughts, ideas, contributions are highly appreciated.
  4. Hi All Apologies if this has already been dealt with (I have searched and not found any conclusive answer on the forum). Is there a way to have curly bracket placeholders other than {query} - specifically {clipboard:0}, {clipboard:1}, {clipboard:2}, ... - evaluated within a php script? It appears that {clipboard:7} does not get evaluated upon initialisation like {query} does, but rather remains a placeholder right up to the moment where it is passed to some Alfred output such as Large Type, and only then is the clipboard value retrieved from the DB. Code example: $query = "{query}"; // $query has been assigned the value passed to the script $i = 7; $history_item = "{clipboard:$i}"; // $history_item has not been assigned any value from the clipboad stack - it holds the literal string value '{clipboard:7}' That means I can't access, search, and manipulate the clipboard history items within my code. Will I need to query clipboard.alfdb manually, or is there a simpler solution? All help appreciated
  5. Hey there Alfred Community, Full disclaimer: I am a hopeless newbie when it comes to the topics I'm addressing here, so I apologize in advance for ambiguous vocabulary. Basically, I am trying to use a combination of "File Filter" and "Run Script" to open a server on a specific folder (for development's sake). In Terminal, I would do the following: cd ~/PathToRelevantFolder php -S localhost: (Port) How do I transform this into a workflow such that I can use a file filter to return my folder of interest and provide an additional argument that allows me to specify the port I wish to use for the local host (e.g. 8000, 9090, 3012...). It's the latter half (providing the port argument) that's giving me the most difficulty. My thanks in advance for any help anyone can give me! -Colin
  6. With the help of answers here I managed to make a workflow that uses Terminal to call a PHP script to delete a file on a remote server, getting the file name from the most recent item in the clipboard. I don't actually need to see the Terminal after the script has completed, but I can't seem to find a way to just run it in the background, or quit Terminal when done. Any suggestions welcome. Thanks
  7. Couldn't think of a better title. Too many questions. WORKFLOW BACKGROUND As a webdeveloper you highly likely find yourself using classic background colors as you build complex layouts. The color won't stay for long, so it has to be typed fast. It doesn't make sense to add variables of a beautiful debugging color pallet.. so you write `background: red`, `background: yellow` – But these colors just look awful. CSS has many many other names you could remember.. (https://www.w3schools.com/colors/colors_names.asp) I can't – WORKFLOW PURPOSE "Alt+Space" > "csc" > Look > CMD+5 > "LightBlueSky" gets pasted right into active application. WHAT I HAVE SO FAR (php workflow with workflows.php) – I chose my favorite colors and put them in an associative Array – I (want to) shuffle the array so you don't forcefully fall in love with colors 1-3 – You can filter the colors by their name (Woop Woop!) – dynamicIcon.php that creates an square image as preview for the color – Activating an item pastes it to active app and doesn't polute the clipboard-history (Thanks, Alfred!) Obviously it doesn't go as smooth as I wish it to. So here are the two main issues I am facing: 1) dynamicIcon.php successfully creates an image, when accessed via a browser, but as a parameter in "$wf->result()" shows me the finger! 2) Shuffling the assoc-array works in a conventional webdev-environment, but again, Alfred shows me the finger on this one! Both issues probably no-brainers for advanced workflowers (:D) and veterans– I guess the icon-parameter needs a path (string) pointing to an actual image; so .. I need to save / cache the image created by dynamicIcon.php somewhere? Why-No-Shuffle is a complete mystery to me. Here is the beautiful lady: https://www.dropbox.com/s/sfm7kh1c6hh70oc/Colorfull Alpha.alfredworkflow?dl=0 Or if you want to see the code here: Scriptfilter: // // Load the PHP workflow library. include_once("workflows.php"); // // Create the workflow object to use. $wf = new Workflows(); // // Get the raw query and store it for use. $clean = trim("{query}"); // // Set the colors $colors = array( "DarkSlateBlue" => "483D8B", "RoyalBlue" => "4169E1", "RebeccaPurple" => "663399", "LightSkyBlue" => "87CEFA", "PaleGreen" => "98FB98", "Sienna" => "A52A2A", "GreenYellow" => "ADFF2F", "RosyBrown" => "8C8F8F", "DarkKhaki" => "BDB76B", "Silver" => "C0C0C0", "MediumVioletRed" => "C71585", "Chocolate" => "D2691E", "Peru" => "CD853F", "Orchid" => "DA70D6", "Plum" => "DDA0DD", "Gainsboro" => "DCDCDC", "Lavender" => "E6E6FA", "DarkSalmon" => "E9967A", "LightCoral" => "F08080" ); // // Shuffle assoc array function shuffle_assoc($my_array) { $keys = array_keys($my_array); shuffle($keys); foreach($keys as $key) { $new[$key] = $my_array[$key]; } $my_array = $new; return $my_array; } $shuffled_colors = shuffle_assoc($colors); // // Build items foreach ($shuffled_colors as $title => $hex) { $reg = '/(.*){query}(.*)/i'; if (!empty("{query}") && !preg_match($reg, $title)) continue; $wf->result($title, $title, $title, $hex, "dynamicIcon.php?hex=" . $hex, "yes"); } // // Alfred workflow.php magic producing the items, I guess? echo $wf->toxml(); dynamicIcon.php header("Content-type: image/png"); $hex = "#" . ltrim($_GET["hex"], "#"); // to make with or without hash valid parameter; list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x"); $im = @imagecreate(64,64) or die("cannot initialize new GD image stream"); $backgroundColor = imagecolorallocate($im, $r, $g, $b); imagepng($im); imagedestroy($im); Thanks! Louis PS: Name and keyword definitely not final;
  8. I have a workflow (download it here: https://cl.ly/3C0n0e1n3W2N) that works and allows me to select some text like "12345" and use a hotkey to launch a URL of https://example.com/issues/{query} -> https://example.com/issues/12345 However, I want to enhance it to be able to support selecting text like "12345,281928", do the hotkey, then open two browser tabs: {query} -> A = 12345 B = 281928 1: open https://example.com/issues/12345 2: also open https://example.com/issues/281928 last one? then we're all done. I know PHP well so I could do explode( ',' {query} ), but I'm not sure how to use {query} (is it usable in a PHP script?) and I'm not sure how to tell it to loop through all the items in the array. If Alfred can't use PHP to do this, that's fine, but I'm not well versed in bash, AppleScript, and the rest. Thanks for any help!
  9. I am in need of a script or scripting to parse an onslaught of email data in Gmail and organized in a google sheets file which the column headers are titled in conjunction with the need data from the emails. This is how the data is relayed to me which I need a script to extract the indicated fields below into a new cell within their respected columns in Google sheets. If anyone can help I would greatly appreciate it, sure make my day a lot easier. Thank you. It was much easier to just screenshot the key I created to map out what I really need and what everything looks like on my end. (See screenshots below) The pertinent email will be subject titled: Fwd: Debt Settlement. Screenshot Screenshot2 Again thank you to anyone who can help me with this.
  10. StackOverflow Search for Alfred Search for answers on StackOverflow.com from Alfred 2. Download Get StackOverflow for Alfred from GitHub or Packal. Usage .so <query> — Search StackOverflow.com for <query>. See below for syntax. ↩ or ⌘+NUM — Open result in default browser ⌘+L — Show full question title in Alfred's Large Text window Query syntax By default, words in <query> will be search for in the title of posts. To specify a tag, prefix it with ., e.g. python will search for python in the post title, .python will search for the tag python. Results Answered questions will be shown first in the list of results (and have a tick on their icon). Licensing, thanks This workflow is released under the MIT Licence. It is heavily based on Alfred-Workflow, also MIT-licensed.
  11. Hello, every time when I try to update Alfred 2 (I think since I bought it in March 2013) I get the message "Unable to verify". This bug has followed over with every Mac OS X update and clean install since then. I know about this thread: http://www.alfredforum.com/topic/2858-update-fails-with-unable-to-verify-for-every-release/ and I am sure the PHP on my Mac is fine (OS X 10.11.5). $ php -version PHP 5.5.34 (cli) (built: Apr 22 2016 19:16:58) ... $ whereis php /usr/bin/php $ php -r 'echo "Test";' Test The only way to update Alfred seems to be to download a fresh copy of Alfred from the website. This was a little annoying, but not so much that it was worth the efford to complain. But now with Alfred 3 there is no obvious download link on the website for Alfred 2 anymore. What is it, that this bug is so persistent? How to solve it? (I know I can upgrade to Alfred 3, and maybe I will do that in the future. But honestly Alfred 3 brings nothing new that I need. And also I'm in doubt this bug is fixed by upgrading.) Best regards, Brian
  12. I'm trying to build a workflow that gathers information from a website which unfortunately does not have an API. Is it possible using the request method of the PHP Workflow Class to keep a session alive? I'd like to use a request to login, sending the required post fields, and then request another page that requires the previous authentication. Much thanks,
  13. Hi, I have a Script Filter with a keyword "KC" that populates results (using php and xml) with items I defined. This is working fine, except the fact that it also shows some unwanted items among my defined results. For example "Key Codes.app" - it shouldn't be there, but Alfred still shows them, probably because this app has letters K and C in it's name. This doesn't make sense. That's completely fine with me if Alfred show other apps like Komodo, Key Codes, Keychain Access, etc. when I start typing my keyword by typing "K". But when I finish typing my keyword "KC" it switches to my Workflow and displays results I defined. So why I still get "Key Codes.app" among these results? Thanks in advance, Romans
  14. What is Alphred? Alphred is a PHP library to aid in the creation of workflows for Alfred. Most of Alphred should work with PHP 5.3+ (OS X 10.6+), but some features need PHP 5.4+ (OS X 10.9+). Alphred generally needs Alfred v2.5+ to run. It's not quite complete because it needs some testing and a bit more documentation. Please help with the former. Features Simple AlfredXML generation for script filters, including extended XML attributes Create and manage configuration files in ini, json, or sqlite3 from a few lines of code Easy http requests with get or post, including data caching Use the system keychain to store and retrieve passwords Simple logging to single or multiple files as well as the console with variable log levels Filter results easily to match a query Make your script filters faster by using the cli-server (PHP 5.4+) with almost no change to your existing code Easily change dates into strings, exact (1 day, 3 hours, and 23 minutes ago) or fuzzy (yesterday) Use title case without any extra work fork php scripts to have them run in the background (and they know that they're in the background) send asynchonrous notifications with no external library know if the user's theme is light or dark (to set different icons) write complex workflows in 50-60 lines of code Example An example workflow (download) that takes your Github Username and Password and grabs a list of your repos and filters them by query is in the example folder. It uses the cli-server. You can see the well-documented code for the script filter and the action script. Without the comments, they reduce to about 60 lines of code together. ----- Mostly Original Post: It seems mostly complete now for a v1 release. It features easy script filter XML generation (with extended XML), an easy way to make http requests, easy results filtering (taken almost verbatim from Deanishe's Python library: thanks, Dean!), keychain interaction, AppleScript, text filters, and more. I've squashed all the bugs that I can find, but I still need to write up some tutorials on how to use it, but I figure that I'd make a pre-release available if people want to start playing with it. Do remember that I might change the API a bit before v1.0.0, and I might do that because I'd love to get some feedback on how the library feels or what doesn't work. For now, find v0.9.3-alpha on the Github release page. Just download the attached Alphred.phar file because that's all you need. To find automagically generated API docs, check out this page. There are links to both PHPDocumentor and Apigen generated docs. Let me know which ones you like better. There are also a few markdown files, for now, in the repository under the tutorial section, and there is also a very simple example workflow (or the script filter and action files) under the example directory. I'll update this post with more information as we go along, but, for now, that's what I got. Shawn
  15. So, this is just a quick tip: I you use strftime() to create a date/time string then remember to set the default time zone first, or PHP will throw an E_NOTICE error and the script will fail in Alfred.
  16. So I have the following PHP script which works well. I'm a newbie here, but trying to create a workflow where I can enter an argument, and it pings google, and returns the top result URL to me, copied to my clipboard. Like I said, on the last line, I do successfully return the top result, but not entirely sure how to hook up the rest of the workflow. Here you can see the workflow at the moment -> https://www.dropbox.com/s/pfo7b0uap41bd0g/Screenshot%202014-08-05%2016.13.02.png Any help would be much appreciated! function get_url_contents($url) { $crl = curl_init(); curl_setopt($crl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)'); curl_setopt($crl, CURLOPT_URL, $url); curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($crl, CURLOPT_CONNECTTIMEOUT, 5); $ret = curl_exec($crl); curl_close($crl); return $ret; } $q = $argv[1]; //Get user-inputted argument $json = get_url_contents('http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=.$q.'); $data = json_decode($json); foreach ($data->responseData->results as $result) { $results[] = array('url' => $result->url, 'alt' => $result->title); } $url = $results[0]['url']; echo $url;
  17. Hi everyone! So apologies if this is a crazy question, but I'm having a little trouble understanding how to pass data between scripts. In my first php script, I successfully copy a url to the clipboard (that works great). What I'd like to do now is pass that url onto the second PHP script so I can use it in another way. 1. I'm not quite sure how to have the second script run AFTER the first one. 2. I'm not sure what variable to use to pass the output on, I know it's not {query}, but is there something similar?
  18. Hi All, I've noticed with my Spotify Mini Player workflow (PHP based) (http://www.alfredforum.com/topic/1892-spotify-mini-player-version-375-now-update-library-and-playlists-from-workflow/) that the first execution after some inactivity time is quite slow compared to next consecutive ones. So i tried to create a very basic workflow to show you this behavior. Grab it there: http://d.pr/f/2BKC Launch it with "ctrl+ENTER", it just displays a result with execution time. The first execution after some time, I get above 0.320 s whereas next ones are around 0.120 s If I execute it outside of Alfred, I don't get this behavior and I constantly get around 0.120 s Any idea what could cause this? Thanks
  19. Workflow to toggle Localhost Services (Start, Stop, Restart and Check Status). Currently support Nginx, MySQL, PHP-fpm and memcached. Download here: Github
  20. An awesome way to filter through your favorited StackOverflow questions. Download it over on Github
  21. I have a workflow setup to download wordpress, extract it into my dev sites directory, clone a few repos for my starter theme and a few plugins, create a database, run npm install and grunt in a terminal window, etc. The last step I'm trying to do via an output script is run a instance of wp_install() in a PHP script to run the full installation and then have the browser open the site. Here's a gist of the PHP code I'm running: https://gist.github.com/mattbanks/5213396 I tried running it as a PHP output script and changing line 3 to $site = "{query}"; but it wasn't working. I then tried calling: php -f installing.php -- {query} via a Bash script and grabbing {query} as argv[1], but no dice there either. If I copy the file to the root directory of the WordPress install and run it in the browser with a query string of "q" (as setup in the gist), it works properly (ie http://sites.dev/mysite/installing.php?q=mysite). So I tried copying the installing.php file from the workflow directory over to the WordPress site directory I created, which works fine, but I can't get the browser to properly open the file. I know the {query} variable is passing properly because I threw a notification of it and it's there just fine. Here's what I'm trying via a bash output script: cp installing.php ~/Sites/{query} open http://sites.dev/{query}/installing.php?q={query} But it's not opening properly. It's throwing me http://sites.dev/{query} - not finishing off the full URL. Any ideas how I can get it to run properly? Thanks, Matt
  22. Hey guys, I've just created "Dev Doctor" it has autosuggestions for development amongst others http://wemakeawesomesh.it/alfred-dev-doctor/ A simple walkthorugh of the kinds of things you can do with Alfred Dev Doctor. A really simple documentation helper for alfred. Supports: Languages & Frameworks with autosuggest search PHP - php {query} JavaScript - js {query} jQuery - jq {query}, jquery {query} HTML - html {query} CSS - css {query} Python - py {query}, python {query} node.js - node {query} Ruby on Rails - rails {query} Haskell - haskell {query} Erlang - erlang {query} C - c {query} Languages & frameworks with keyword search: Laravel - larval {query} Bootstrap - bs {query} Flask - flash {query} .NET - .net {query} Java - java {query} Android - android {query} iOS - ios {query} Asset search github repos - github {query} icons - icon {query} Let me know what you think of it It's also on github https://github.com/sydlawrence/alfred-dev-doctor Syd
  23. Hi, I am starting with php and I prepare this little workflow, to quickly find something on php.net. Hope it helps some of you. Download
  24. Searches Packagist for PHP packages that can be used with Composer. Your OS X installation should have PHP 5.3.3 or newer installed. Lion or Mountain Lion should meet the minimum requirements. If not, you can install the latest version of PHP with MacPorts or Homebrew. Download! Requires Alfred 2 and the Powerpack. Updates can be found and installed using Monkey Patch, or the older Alleyoop (discontinued).
  25. A simple PHP script based workflow to transform a youtube link to a fullscreen link. usage: * ytfs {query} * output is pasted to the clipboard and the frontmost app download (2013-03-29)
×
×
  • Create New...