Plugin Directory

Changeset 2963072


Ignore:
Timestamp:
09/05/2023 12:14:30 PM (3 years ago)
Author:
nickjamescom
Message:

3.6.3
Share Your Success logic changed
Notice for Empty Google reCPATCHA Key
*Version update

Location:
apm-child/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • apm-child/trunk/admin/share-your-success.php

    r2917796 r2963072  
    2929    $form['share_success_headline'] = isset($_POST['share_success_headline']) ? sanitize_text_field($_POST['share_success_headline']) : '';
    3030    $form['social_share_message']   = isset($_POST['social_share_message']) ? wp_kses_post(stripslashes($_POST['social_share_message'])) : '';
     31    $form['set_success_story_amount']   = isset($_POST['set_success_story_amount']) ? wp_kses_post(stripslashes($_POST['set_success_story_amount'])) : '';
     32    $form['share_success_image']        = isset($_POST['share_success_image']) ? sanitize_text_field($_POST['share_success_image']) : '';
    3133   
    3234    update_option('apm_apm_cron_daily', $form['apm_cron_daily']);
     
    3739    update_option('apm_share_success_headline', $form['share_success_headline']);
    3840    update_option('apm_social_share_message', $form['social_share_message']);
     41    update_option('apm_set_success_story_amount', $form['set_success_story_amount']);
     42    update_option('apm_share_success_image', $form['share_success_image']);
    3943}
    4044
     
    4650$share_success_headline = get_option('apm_share_success_headline');
    4751$social_share_message = get_option('apm_social_share_message');
     52$set_success_story_amount = get_option('apm_set_success_story_amount');
     53$share_success_image = get_option('apm_share_success_image');
    4854
    4955if($egmail_error_found == TRUE && isset($egmail_errors[0]) == TRUE)
     
    7884                <label class="apm_radio_container">Daily<input type="radio" <?php if ($apm_post_schedule == 'Daily'){?> checked="checked" <?php } ?> name="apm_post_schedule" value="Daily" onclick="apm_post_schedule_cron('daily');" /><span class="checkmark"></span></label>
    7985                <label class="apm_radio_container">Weekly<input type="radio" <?php if ($apm_post_schedule == 'Weekly'){?> checked="checked" <?php } ?> name="apm_post_schedule" value="Weekly" onclick="apm_post_schedule_cron('weekly');" /><span class="checkmark"></span></label>
     86                <label class="apm_radio_container">Fix Price<input type="radio" <?php if ($apm_post_schedule == 'fixprice'){?> checked="checked" <?php } ?> name="apm_post_schedule" value="fixprice" onclick="apm_post_schedule_cron('fixprice');" /><span class="checkmark"></span></label>
    8087                <label class="apm_radio_container">Turn Off<input type="radio" <?php if ($apm_post_schedule == 'TurnOff'){?> checked="checked" <?php } ?> name="apm_post_schedule" value="TurnOff" onclick="apm_post_schedule_cron('TurnOff');" /><span class="checkmark"></span></label>
    8188            </div>
     
    112119                    <option value="Sun" <?php if($apm_cron_week == 'Sun'){?> selected="selected" <?php } ?>>Sun</option>
    113120                </select>
     121             
    114122               <!--<input style="width:100px;" class="txt-apmbox" id="apm-filter-date" type="text" name="apm_cron_weekly" value="<?php echo $apm_cron_weekly; ?>" />-->
    115123                 
     
    130138                 <p>Choose as per GMT Time Zone</p>
    131139            </div>
    132            
     140           
     141           
     142           <div class="row-full-width apm_schedule_cron" id="apm_cron_fixprice" style="display:none;">
     143                <label for="share_success_headline">Set Target Amount</label>       
     144                <strong style="font-size: 16px;">$</strong><input type="number" class="txt-apmbox" min="0" id="set_success_story_amount" name="set_success_story_amount" value="<?php echo $set_success_story_amount;?>" />
     145                <span style="display: block; font-style: italic;">When the commission amount reaches this threshold, a new post will be triggered.</span>
     146           </div>
    133147           
    134148           <div class="row-full-width hide-on-turn-off">
     
    161175                <input type="text" class="txt-apmbox" id="share_success_headline" name="share_success_headline" value="<?php echo $share_success_headline;?>" />
    162176           </div>
     177           
     178           <div class="row-full-width hide-on-turn-off">
     179                <label for="share_success_headline">Post Feature Image URL</label>     
     180                <input type="text" class="txt-apmbox" id="share_success_image" name="share_success_image" value="<?php echo $share_success_image;?>"  style="max-width:600px" />
     181           </div>
    163182           
    164183           <div class="row-full-width hide-on-turn-off">
     
    183202</div>         
    184203<script>
     204
    185205    function apm_post_schedule_cron(val)
    186206    {
    187207        if(val == "TurnOff" || val == "turnoff")
    188208        {
     209            jQuery(".apm_schedule_cron").hide();
    189210            jQuery(".hide-on-turn-off").hide();
    190211        }
     
    199220
    200221    apm_post_schedule_cron('<?php echo strtolower($apm_post_schedule);?>');
     222   
    201223</script>
  • apm-child/trunk/affiliate-jvzoo-ipn-listener.php

    r2344825 r2963072  
    4545            $wpdb->query($sql);
    4646            $insert_id = $wpdb->insert_id;
    47             //fwrite($fp, "\n".$sql);
    48            
    49             $apm_post_schedule = get_option('apm_apm_post_schedule');
    50            
    51             if( $apm_post_schedule == 'Instant' )
    52             {
    53                 create_post_for_social_media(array("income_id" => $insert_id));
    54             }
    5547        }
    5648       
  • apm-child/trunk/functions/core-function.php

    r2917821 r2963072  
    4848
    4949    global $wpdb;
     50    $flag_publish_post = false;
    5051   
    5152    $income_id = $arr_request_val['income_id'];
     
    5859    $social_share_message = get_option('apm_social_share_message');
    5960    $share_success_headline = get_option('apm_share_success_headline');
     61    $share_success_imageURL = get_option('apm_share_success_image');
    6062   
    6163    //--> create category when it is not selected at settings page
     
    9193    $post_title = $apm_cron_weekly.'-'.$apm_cron_weekly_time;
    9294   
     95   
     96   
    9397    $post_title = $share_success_headline.' '.$post_title;
    9498   
    9599   
    96100    //--> Affiliate Information
     101   
     102   
    97103    $egSqlCrediantial = "SELECT * FROM `".$wpdb->prefix."cso_options` WHERE 1";
    98104    $record = array();
    99105    $recordCrediantial = $wpdb->get_row($egSqlCrediantial, ARRAY_A);
    100106   
     107   
    101108    //--> Get Information of income.
    102109    if($income_id > 0)
    103110    {
     111       
    104112        //--> Instant
    105113        $egSql = "SELECT * FROM `".$wpdb->prefix."cso_my_income` WHERE ID = '".$income_id."'";
     
    110118       
    111119        $egUpdate = $wpdb->prepare("UPDATE ".$wpdb->prefix."cso_my_income SET `social_post_created` = 'Yes' WHERE ID = %s ", array($income_id));
    112         $wpdb->query($egUpdate);   
     120        $wpdb->query($egUpdate);
     121        $flag_publish_post = true;
     122           
     123    }
     124    elseif($apm_post_schedule == 'fixprice')
     125    {
     126        $flag_publish_post = false;
     127       
     128        $egSql = "SELECT * FROM `".$wpdb->prefix."cso_my_income` WHERE social_post_created = 'No'";
     129        $egRecords =   $wpdb->get_results($egSql, ARRAY_A);
     130       
     131        $inc_ctransamount = 0;
     132        $inc_commision_amt = 0;
     133       
     134        foreach ($egRecords as $egRecord)
     135        {
     136            $inc_ctransamount  += $egRecord['inc_ctransamount'];
     137            $inc_commision_amt += $egRecord['inc_commision_amt'];
     138           
     139            $arr_income_ids[] = $egRecord['ID'];
     140           
     141            if( $inc_commision_amt >= $set_success_story_amount )
     142            {
     143                $flag_publish_post = true;
     144                break;
     145            }
     146        }
    113147    }
    114148    else
     
    130164           
    131165            $egUpdate = $wpdb->prepare("UPDATE ".$wpdb->prefix."cso_my_income SET `social_post_created` = 'Yes' WHERE ID = %s ", array($record->ID));
     166            $wpdb->query($egUpdate);   
     167            $flag_publish_post = true; 
     168        }
     169    }
     170   
     171    /* This is for the fix amount set */
     172    if( ( $inc_commision_amt >= $set_success_story_amount ) && count($arr_income_ids) > 0)
     173    {
     174        foreach($arr_income_ids as $income_ids)
     175        {
     176            $egUpdate = $wpdb->prepare("UPDATE ".$wpdb->prefix."cso_my_income SET `social_post_created` = 'Yes' WHERE ID = %s ", array($income_ids));
    132177            $wpdb->query($egUpdate);       
    133178        }
     
    140185   
    141186    //--> Replace Title short code
    142    
    143     $post_title = str_replace("[Platform]", $egRecord['inc_income_type'], $post_title);
    144     $post_title = str_replace("[Vendor]", $egRecord['inc_ctransvendor'], $post_title);
    145     $post_title = str_replace("[CustomerName]", $egRecord['inc_ccustname'], $post_title);
    146     $post_title = str_replace("[CustomerEmail]", $egRecord['inc_ccustemail'], $post_title);
    147     $post_title = str_replace("[AffiliateName]", $recordCrediantial['first_name'].' '.$recordCrediantial['last_name'], $post_title);
    148     $post_title = str_replace("[AffiliateID]", $egRecord['inc_ctransaffiliate'], $post_title);
    149     $post_title = str_replace("[Clickid]", $egRecord['inc_caffitid'], $post_title);
    150     $post_title = str_replace("[ItemName]", $egRecord['inc_cprodtitle'], $post_title);
    151     $post_title = str_replace("[SalesAmount]", $inc_ctransamount, $post_title);
    152     $post_title = str_replace("[CommissionAmount]", $inc_commision_amt, $post_title);
    153    
    154    
    155    
    156     //--> Post Body
    157     $social_share_message = wpautop($social_share_message);
    158    
    159     $social_share_message = str_replace("[Platform]", $egRecord['inc_income_type'], $social_share_message);
    160     $social_share_message = str_replace("[Vendor]", $egRecord['inc_ctransvendor'], $social_share_message);
    161     $social_share_message = str_replace("[CustomerName]", $egRecord['inc_ccustname'], $social_share_message);
    162     $social_share_message = str_replace("[CustomerEmail]", $egRecord['inc_ccustemail'], $social_share_message);
    163     $social_share_message = str_replace("[AffiliateName]", $recordCrediantial['first_name'].' '.$recordCrediantial['last_name'], $social_share_message);
    164     $social_share_message = str_replace("[AffiliateID]", $egRecord['inc_ctransaffiliate'], $social_share_message);
    165     $social_share_message = str_replace("[Clickid]", $egRecord['inc_caffitid'], $social_share_message);
    166     $social_share_message = str_replace("[ItemName]", $egRecord['inc_cprodtitle'], $social_share_message);
    167     $social_share_message = str_replace("[SalesAmount]", $inc_ctransamount, $social_share_message);
    168     $social_share_message = str_replace("[CommissionAmount]", $inc_commision_amt, $social_share_message);
    169 
    170     if($inc_ctransamount > 0)
    171     {
    172         $page_data = array(
    173                 'post_status'    => 'publish',
    174                 'post_type'      => 'post',
    175                 'post_author'    => 1,
    176                 'post_name'      => $post_title,
    177                 'post_title'     => $post_title,
    178                 'post_content'   => $social_share_message,
    179                 'post_parent'    => '',
    180                 'post_category' => array( $share_success_category ),
    181                 'comment_status' => 'closed',
    182         );
    183        
    184         wp_insert_post( $page_data );
    185     }
    186        
    187     $TodaysDate = date('Y-m-d H:i:s');
    188     update_option('success_story_last_execution_time', $TodaysDate);
     187    if($flag_publish_post == true)
     188    {
     189        $post_title = str_replace("[Platform]", $egRecord['inc_income_type'], $post_title);
     190        $post_title = str_replace("[Vendor]", $egRecord['inc_ctransvendor'], $post_title);
     191        $post_title = str_replace("[CustomerName]", $egRecord['inc_ccustname'], $post_title);
     192        $post_title = str_replace("[CustomerEmail]", $egRecord['inc_ccustemail'], $post_title);
     193        $post_title = str_replace("[AffiliateName]", $recordCrediantial['first_name'].' '.$recordCrediantial['last_name'], $post_title);
     194        $post_title = str_replace("[AffiliateID]", $egRecord['inc_ctransaffiliate'], $post_title);
     195        $post_title = str_replace("[Clickid]", $egRecord['inc_caffitid'], $post_title);
     196        $post_title = str_replace("[ItemName]", $egRecord['inc_cprodtitle'], $post_title);
     197        $post_title = str_replace("[SalesAmount]", $inc_ctransamount, $post_title);
     198        $post_title = str_replace("[CommissionAmount]", $inc_commision_amt, $post_title);
     199       
     200       
     201       
     202        //--> Post Body
     203        $social_share_message = wpautop($social_share_message);
     204       
     205        $social_share_message = str_replace("[Platform]", $egRecord['inc_income_type'], $social_share_message);
     206        $social_share_message = str_replace("[Vendor]", $egRecord['inc_ctransvendor'], $social_share_message);
     207        $social_share_message = str_replace("[CustomerName]", $egRecord['inc_ccustname'], $social_share_message);
     208        $social_share_message = str_replace("[CustomerEmail]", $egRecord['inc_ccustemail'], $social_share_message);
     209        $social_share_message = str_replace("[AffiliateName]", $recordCrediantial['first_name'].' '.$recordCrediantial['last_name'], $social_share_message);
     210        $social_share_message = str_replace("[AffiliateID]", $egRecord['inc_ctransaffiliate'], $social_share_message);
     211        $social_share_message = str_replace("[Clickid]", $egRecord['inc_caffitid'], $social_share_message);
     212        $social_share_message = str_replace("[ItemName]", $egRecord['inc_cprodtitle'], $social_share_message);
     213        $social_share_message = str_replace("[SalesAmount]", $inc_ctransamount, $social_share_message);
     214        $social_share_message = str_replace("[CommissionAmount]", $inc_commision_amt, $social_share_message);
     215   
     216        if($inc_ctransamount > 0)
     217        {
     218            $page_data = array(
     219                    'post_status'    => 'publish',
     220                    'post_type'      => 'post',
     221                    'post_author'    => 1,
     222                    'post_name'      => $post_title,
     223                    'post_title'     => $post_title,
     224                    'post_content'   => $social_share_message,
     225                    'post_parent'    => '',
     226                    'post_category' => array( $share_success_category ),
     227                    'comment_status' => 'closed',
     228            );
     229           
     230            $post_id = wp_insert_post( $page_data );
     231           
     232           
     233           
     234            $image = media_sideload_image( $share_success_imageURL, $post_id, $post_title, 'id' );
     235            set_post_thumbnail( $post_id, $image );
     236
     237           
     238        }
     239           
     240        $TodaysDate = date('Y-m-d H:i:s');
     241        update_option('success_story_last_execution_time', $TodaysDate);
     242    }
    189243   
    190244    return true;
  • apm-child/trunk/mc-main.php

    r2933347 r2963072  
    99Author: Nick James
    1010E-mail: admin@nickjamesadmin.com
    11 Version: 3.6.2
     11Version: 3.6.3
    1212Author URI: http://www.pluginpixie.com
    1313*/
    1414
    1515global $APM_SUBSCRIPTION_VER;
    16 $APM_SUBSCRIPTION_VER = "3.6.2";
     16$APM_SUBSCRIPTION_VER = "3.6.3";
    1717
    1818define('APM_SUBSCRIPTION_PATH', plugins_url().'/'. basename(dirname(__FILE__)).'/');
     
    2222define("APM_MASTER_PLUGIN_URL", "https://affiliatepromembership.com/");
    2323define('APM_PLUGIN_PATH', plugins_url() . '/apm-child/');
     24
     25require_once(ABSPATH . 'wp-admin/includes/media.php');
     26require_once(ABSPATH . 'wp-admin/includes/file.php');
     27require_once(ABSPATH . 'wp-admin/includes/image.php');
    2428
    2529
     
    204208{
    205209    wp_clear_scheduled_hook( 'apm_social_post_weekly_cron_hook' );
     210    wp_clear_scheduled_hook( 'apm_social_post_regular_cron_hook' );
    206211   
    207212    if ( ! wp_next_scheduled( 'apm_social_post_daily_cron_hook' ) )
     
    215220{
    216221    wp_clear_scheduled_hook( 'apm_social_post_daily_cron_hook' );
     222    wp_clear_scheduled_hook( 'apm_social_post_regular_cron_hook' );
    217223   
    218224    if ( ! wp_next_scheduled( 'apm_social_post_weekly_cron_hook' ) )
     
    223229}
    224230
    225 
    226 ///Hook into that action that'll fire every day
     231if($apm_post_schedule == 'Fix Price')
     232{
     233    wp_clear_scheduled_hook( 'apm_social_post_weekly_cron_hook' );
     234    wp_clear_scheduled_hook( 'apm_social_post_daily_cron_hook' );
     235   
     236    if ( ! wp_next_scheduled( 'apm_social_post_regular_cron_hook' ) )
     237    {
     238        wp_schedule_event( strtotime("23:30"), 'daily', 'apm_social_post_regular_cron_hook' );
     239    }
     240}
     241
     242
     243
     244//--> Hook into that action that'll fire every day
    227245add_action( 'apm_social_post_daily_cron_hook', 'apm_social_post_daily_cron' );
    228246function apm_social_post_daily_cron() {
     
    231249
    232250
    233 ///Hook into that action that'll fire every week
     251//--> Hook into that action that'll fire every week
    234252add_action( 'apm_social_post_weekly_cron_hook', 'apm_social_post_weekly_cron' );
    235253function apm_social_post_weekly_cron() {
     
    238256
    239257
     258//--> Hook into that action that'll fire every day to target fix price
     259add_action( 'apm_social_post_regular_cron_hook', 'apm_social_post_daily_cron_fix_price' );
     260function apm_social_post_daily_cron_fix_price() {
     261    create_post_for_social_media(array("income_id" => 0));
     262}
     263
     264
     265
     266
    240267function apm_powered_by_arpreach_aweber() {
    241268  $content = '<div class="powered-by-alert">Powered By Aweber.com and ARPreach.com</div>';
  • apm-child/trunk/optin-monster-settings.php

    r2933347 r2963072  
    9898    $recaptcha_site_key = $resultList->google_recaptcha_key;
    9999   
     100    $recaptcha_key_message = '';
     101
     102    if($recaptcha_site_key == '')
     103    {
     104        $recaptcha_key_message = "Google reCAPTCHA key has not assigned for this affiliate member.";
     105    }
    100106   
    101107?>
     
    106112    function OptinMonsterCustomVariables(app)
    107113    {
    108        
    109        
     114        app.setCustomVariable('val_error_message', '<?php echo $recaptcha_key_message;?>');
     115
    110116        app.setCustomVariable('account_id', '<?php echo esc_html($recordCrediantial['aweber_account_number'],'apm-child')?>');
    111117
     
    140146
    141147    function anchorTest()
    142 
    143148    {
    144149
     
    208213
    209214   
     215   
     216
    210217
    211218</script>
  • apm-child/trunk/readme.txt

    r2933347 r2963072  
    236236Bug Fixes
    237237*Version update
     238
     2393.6.3
     240Share Your Success logic changed
     241Notice for Empty Google reCPATCHA Key
     242*Version update
Note: See TracChangeset for help on using the changeset viewer.