Plugin Directory

Changeset 1460249


Ignore:
Timestamp:
07/25/2016 01:58:26 PM (10 years ago)
Author:
selectyco
Message:

is_single, is_page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • selectyco/trunk/selectyco.php

    r1431480 r1460249  
    1414  define("SELECTYCO_DIR", plugin_dir_path( __FILE__ ));
    1515  //define("SELECTYCO_HOST", "http://api.selectyco.local");
    16   define("SELECTYCO_HOST", "http://api-qa.selectyco.com");
    17   //define("SELECTYCO_HOST", "https://api-qa.selectyco.com");
     16  //define("SELECTYCO_HOST", "http://api-qa.selectyco.com");
     17  define("SELECTYCO_HOST", "https://api-qa.selectyco.com");
    1818  //define("SELECTYCO_HOST", "https://api.selectyco.com");
    1919
     20    require('FirePHPCore/fb.php');
     21    ob_start();
     22   
    2023  if(!class_exists('syc_class')) {
    2124    class syc_class {
     
    4245        }
    4346        else {
    44           add_filter( 'the_content', array($this, 'mod_single_post') );
    4547          add_filter( 'the_content', array($this, 'add_button_to_post') );
    4648        }
     
    239241         
    240242        curl_setopt_array($ch, array(
     243                        CURLOPT_SSL_VERIFYPEER => FALSE,
    241244            CURLOPT_POST => TRUE,
    242245            CURLOPT_RETURNTRANSFER => TRUE,
     
    327330     
    328331
    329      
    330       function mod_single_post($sycContent) {
    331         if ( !is_front_page() && !is_home() ) {
    332           if(isset($_POST['token'])) {
     332            function add_button_to_post($sycContent) {
     333                $a = array('is_admin' => is_admin(),'is_home' => is_home(), 'is_front_page' => is_front_page(), 'is_single' => is_single(), 'is_page' => is_page());
     334                fb($a);
     335               
     336                //posts over-view
     337                if(is_front_page() && is_home()) {
     338                    fb('is_front_page && is_home');
     339                    return $this->generate_button();
     340                }
     341                //single post-view
     342                elseif(is_single()) {
     343                    fb($sycContent);
     344                   
     345                    //purchasing process
     346                    if(isset($_POST['token'])) {
    333347            $sig_req = $_POST['token'];
    334348            $fsi = new VerificateSycItem();
    335349            $success = $fsi->parse_signed_request($sig_req);
    336350            if($success) {
    337               echo $sycContent;
     351              return $sycContent;
    338352            }
    339353          }
    340           else {
    341             echo $this->generate_button();
    342           }
    343         }
    344       }
    345      
    346       function add_button_to_post()
    347       {
    348         if ( is_home() ) {
    349           return $this->generate_button();
    350         }
    351       }
    352  
     354                    //direct link
     355                    else {
     356                        return $this->generate_button();
     357                    }
     358                }
     359                elseif(is_page()) {
     360                    fb($sycContent);
     361                    return $sycContent;
     362                }
     363            }
     364           
    353365
    354366      function generate_button()
Note: See TracChangeset for help on using the changeset viewer.