PHP code example of mltpss / php-sdk

1. Go to this page and download the library: Download mltpss/php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mltpss / php-sdk example snippets


    SQW_ID_SITE=YOUR_WEBSITE_ID
    SQW_SITENAME=YOUR_WEBSITE_NAME
    SQW_LANG=en_US
    

     $sqweb = new \SQweb\SQweb(['SQW_ID_SITE' => 1234, 'SQW_SITENAME' => 'SQweb']);
    

$sqweb = new SQweb\SQweb;



$sqweb->script();

if ($sqweb->checkCredits() > 0) {
    // CONTENT
} else {
    // ADS
}

if ($_COOKIE['mltpss_e']) {
    $email = base64_decode($_COOKIE['mltpss_e']);
}

$sqweb->button();

$sqweb->button('tiny');
$sqweb->button('slim');
$sqweb->button('large');

$sqweb->button('free');

/**
 * Display a "Support us" message.
 */

function supportBlock() {   }
``

For instance:


/**
 * Display a locking block.
 */

function lockingBlock() {   }
``

For instance:


if ($sqweb->waitToDisplay('15/09/16', 'd/m/y', 2)) {
    // The content here will appear 2 days after the publication date for non paying users.
} else {
    // Here you can put content that free users will see until the content above is available for all.
    $sqweb->lockingBlock();
}

/**
 * Put opacity to your text
 * Returns text  with opacity style.
 * @param $text  Text you want to limit.
 * @param int $percent Percent of your text you want to show.
 * @return string
 */

function transparent($text, $percent = 100) { ... }

echo $sqweb->transparent('one two three four', 50);

/*
 * @param string $date  When to publish the content on your site. It must be an ISO format(YYYY-MM-DD).
 * @param int $wait  Number of days you want to wait before showing this content to free users.
 */

function waitToDisplay($date, $wait = 0) { ... }

if ($sqweb->waitToDisplay('15/09/16', 'd/m/y', 2)) {
    // The content here will appear 2 days after the publication date for non paying users.
} else {
    // Here you can put content that free users will see until the content above is available for all.
}

if ($sqweb->limitArticle(5) === true) {
    echo "This is my article";
} else {
    echo "Sorry, you reached the limit of pages you can see today, come back tomorrow or subscribe to Multipass to get unlimited articles !";
}


Will display the block.

#### Display a locking div for your users
php
$sqweb = new SQweb;

$sqweb->lockingBlock();