PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Guru Evi   DCOP calls for PHP   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Script
Class: DCOP calls for PHP
Execute actions of KDE applications using DCOP
Author: By
Last change:
Date: 19 years ago
Size: 1,175 bytes
 

Contents

Class file image Download
<?php
require("../includes/dcop.class.php");

$dcop = new dcop;

$dcop->application("juk","guruevi"); //1st argument is necessary, 2nd and 3rd are either specified in your class
                         //or the defaults will be used

$dcop->app_function("Player","playingString"); //call juk's player function and get playingstring as an argument
$playingstring = implode(" ",$dcop->call()); //This should return what's currently playing on juk

$dcop->app_function("Player","trackProperty","Album"); //gimme the album
$playingalbum = implode(" ",$dcop->call());

$dcop->app_function("Player","totalTime"); //how much is the total time (in seconds)
$playing_tot_time = implode(" ",$dcop->call());

$dcop->app_function("Player","currentTime"); //how much is the current time (in seconds)
$playing_cur_time = implode(" ",$dcop->call());

echo
"Currently playing in JuK: " . $playingstring . " from the album: " . $playingalbum . "\n";
echo
"Currently " . $playing_cur_time . " seconds far in the " . $playing_tot_time . " seconds long song\n\n";
echo
"This is just an example of what DCOP for you can do - submit bugs in the PHP scripts to evi@valerieandevi.be\n";
echo
"License: GPL\n";

?>