Beispiel #1
0
 public function testMessageSetter()
 {
     $oMessage = new \Prowl\Message();
     $sUrl = "http://xenji.com";
     $oMessage->setUrl($sUrl);
     $this->assertEquals($sUrl, $oMessage->getUrl(), "Assertion of URL setter failed, maybe due bug #7?");
 }
Beispiel #2
0
 public function testDefaultMessageWithClosure()
 {
     $oConnector = new \Prowl\Connector();
     $oConnector->setProviderKey($this->aConfig['providerkey']);
     $oMessage = new \Prowl\Message();
     $oMessage->addApiKey($this->aConfig['apikey']);
     $oMessage->setApplication("Unit Test");
     $oMessage->setPriority(0);
     $oMessage->setEvent("Unit Test");
     $oMessage->setDescription("Unit Test testDefaultMessageWithClosure");
     $oMessage->setFilterCallback(function ($sContent) {
         return $sContent;
     });
     $oResponse = $oConnector->push($oMessage);
     $this->assertFalse($oResponse->isError());
 }
 function sendMessage($type, $title, $body, $sourceUrl)
 {
     if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
         $oMsg = new \Prowl\Message();
         $oMsg->addApiKey($this->_apikey);
         $oMsg->setApplication($this->_appName);
         $oMsg->setEvent($title);
         $oMsg->setDescription($body);
         $oFilter = new \Prowl\Security\PassthroughFilterImpl();
         $this->prowlObj->setFilter($oFilter);
         $this->prowlObj->setIsPostRequest(true);
         $this->prowlObj->push($oMsg);
     }
     # if
 }
Beispiel #4
0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
/**
 * Example File
 * @author Mario Mueller <*****@*****.**>
 * @version 1.0.0
 */
require_once dirname(__FILE__) . '/bootstrap.php';
// Use \Prowl\SecureConnector to make cUrl use SSL
$oProwl = new \Prowl\Connector();
$oMsg = new \Prowl\Message();
// If you have one:
// $oProwl->setProviderKey('MY_PROVIDER_KEY');
try {
    // You can choose to pass a callback
    $oProwl->setFilterCallback(function ($sText) {
        return $sText;
    });
    // or set a filter instance:
    // $oFilter = new \Prowl\Security\PassthroughFilterImpl();
    // $oProwl->setFilter($oFilter);
    /*
     * Both, the closure and the instance, can be passed to the connector
     * or to each message. Setting it at the connector passes the closure or the instance down
     * to each message on push() execution - but only if the message has neither of them set.
     */