Changeset 1998157
- Timestamp:
- 12/19/2018 03:18:31 PM (7 years ago)
- Location:
- platformly/trunk
- Files:
-
- 3 added
- 12 edited
-
css/ply_styles.css (modified) (1 diff)
-
css/select2.min.css (added)
-
inc/pages/ply.events.php (modified) (5 diffs)
-
inc/pages/ply.optins.page.php (modified) (7 diffs)
-
inc/pages/ply.pages.php (modified) (3 diffs)
-
inc/pages/ply.settings.php (modified) (2 diffs)
-
inc/ply.functions.php (modified) (4 diffs)
-
js/events.js (modified) (3 diffs)
-
js/optins.js (modified) (7 diffs)
-
js/pages.js (modified) (4 diffs)
-
js/ply_add_link_functions.js (modified) (4 diffs)
-
js/select2.min.js (added)
-
js/settings.js (added)
-
platformly.php (modified) (13 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
platformly/trunk/css/ply_styles.css
r1955138 r1998157 140 140 vertical-align: middle !important; 141 141 } 142 #btnVisitAccount{ 143 display: inline-block; 144 margin-top: 10px; 145 } 146 .table-name{ 147 display: inline-block; 148 margin-right: 8px; 149 margin-bottom: 18px; 150 } 151 #links_table_toggle .ply_serch_not_result{ 152 display: none; 153 } 154 #msgPlyGetProgectCodeError, #plyLoadingProjectCode{ 155 display: none; 156 } 157 #plyCheckboxSetProjectCode{ 158 margin-left: 0px !important; 159 } 160 #plyProjectCodeSettings{ 161 display: none; 162 } 163 #msgPlyGetProgectCodeError{ 164 color:#cb2727; 165 } 166 #msgPlyGetProgectCodeActivated span{ 167 font-weight: bold; 168 } 169 .ply_label_optin_form{ 170 margin-bottom: 0px; 171 margin-left: 3px; 172 font-weight: normal; 173 } 174 #msgPlyGetProgectCodeActivated{ 175 margin-top: 8px; 176 } 177 #optinWherePage{ 178 min-width: 160px; 179 width: 20%; 180 } 181 #plyBlockListWpPages dd, li{ 182 margin-bottom: 0px; 183 } -
platformly/trunk/inc/pages/ply.events.php
r1955138 r1998157 5 5 $get_projects = wp_remote_retrieve_body($get_projects); 6 6 $projects = json_decode($get_projects, true); 7 7 $projectCodeInclude = get_option('ply_project_code_active'); 8 $projectCode = ply_get_project_code(); 8 9 ?> 9 <?php if(isset($msg)) {10 <?php if(isset($msg)){ 10 11 echo $msg; 11 12 wp_add_inline_script('ply_events_script', "jQuery(document).ready(function() {setTimeout(function(){jQuery('#ply_closeNotification').fadeOut();}, 5000);});"); … … 23 24 </div> 24 25 <div class="col-md-12"> 25 <select onchange='loadEvents(this.value)'>26 <select id='plyProjectSelect'> 26 27 <option value='-1'>Please choose...</option> 27 28 <?php foreach($projects as $pid => $pname): ?> … … 33 34 <div class="row"> 34 35 <div class="col-md-12"> 35 <h4>Active Optins</h4><hr> 36 <h4 class="table-name">Active Events</h4> 37 <a target="_blank" href="<?php echo $user['main_url'] ?>/?page=setup.events" class="btn btn-default">View Events</a> 38 <a href="javascript:;" id="btnPlyRefreshEvents" class="btn btn-default" title="Refresh">↻</a> 39 <hr> 36 40 <table id="plyEventsTable" class="table"> 37 41 <thead> … … 60 64 <div class="modal-body"> 61 65 <div class="created-code" id="evCode"> 62 < div style="margin-bottom: 15px;">66 <?php /* <div style="margin-bottom: 15px;"> 63 67 <a href="#" id="eventTabJs" class="active event-tabs">Javascript Code</a> | <a id="eventTabPixel" class="event-tabs" href="#">Pixel Code</a> 64 </div> 68 </div> */ ?> 65 69 <div id="eventTabContentJs"> 66 < p>Place below code within your <head> section.</p>70 <?php /* <p>Place below code within your <head> section.</p> 67 71 <textarea name="evCode_top" id="evCode_top" class="form-control" onclick="jQuery(this).select()" style="background-color:#f4f4f4; font-size:12px; height:100px;"></textarea> 72 */ ?> 73 <?php if(!empty($projectCodeInclude) && !empty($projectCode)): ?> 74 <p class='ply_successMsg'>A code from Project '<span><?php echo $projects[$projectCode['ply_project_id']] ?></span>' is being used on this site.</p> 75 <?php else: ?> 76 <p class='ply_errorMsg'> 77 You must include a Platform.ly project code within your site, please <a href="<?php echo get_admin_url(null, 'admin.php?page=ply') ?>">"click here"</a> to do it now. 78 </p> 79 <?php endif; ?> 68 80 <p style="margin-top: 15px;">Place below code where you want to fire the event. The events can be fired in any HTML code, onClick,onChange events, JS functions...</p> 69 81 <div style="margin-bottom: 10px;"> … … 78 90 </div> 79 91 </div> 92 <?php /* 80 93 <div id="eventTabContentPixel" style="display:none;"> 81 94 <p>Place below code where you want to fire the event.</p> 82 95 <textarea name="evCode_bottom_pixel" id="evCode_bottom_pixel" class="form-control" onclick="jQuery(this).select()" style="background-color:#f4f4f4; font-size:12px;"></textarea> 96 </div> */ ?> 83 97 </div> 84 98 </div> 85 </div>86 99 <div class="modal-footer"> 87 <button type="button" class="btn btn-default" data-dismiss="modal"> Cancel</button>100 <button type="button" class="btn btn-default" data-dismiss="modal">Done</button> 88 101 </div> 89 102 </div> -
platformly/trunk/inc/pages/ply.optins.page.php
r1955138 r1998157 38 38 $editOptin = ply_get_optin_by_id((int)$_POST['editOptin']); 39 39 } 40 41 $postList = get_posts(array('post_status' => 'publish,future,private')); 42 $pageList = get_pages(array('post_status' => 'publish,future,private')); 40 43 ?> 41 44 … … 90 93 <div class="row"> 91 94 <div class="col-md-12"> 92 <h4 >Please select optin</h4><hr>95 <h4 style='display: inline-block; margin-right: 5px'>Please select optin</h4><a target="_blank" href="<?php echo $user['main_url'] ?>/?page=lead_capture.forms" class="btn btn-default">View Optins</a><hr style="margin-top: 5px !important"> 93 96 </div> 94 97 <div class="col-md-12" id="tdOptins"> … … 104 107 <?php 105 108 $loc = "all"; 109 $optinExceptPage = array(); 110 $optionSpecificPage = 0; 106 111 if($editOptin != false){ 107 112 $options = json_decode($editOptin->ply_optin_options, true); 108 113 $loc = $options['optinLoc']; 109 } 110 ?> 111 <input type="radio" name="optinwhere" id="optinWhereAll" value="all" <?= ($loc == 'all') ? 'checked' : '' ?>> Every WordPress page 112 <input type="radio" name="optinwhere" id="optinWherePosts" value="posts" <?= ($loc == 'posts') ? 'checked' : '' ?>> Only on posts 114 if(empty($options['optinPages'])){ 115 $optinExceptPage = array(); 116 }else{ 117 $optinExceptPage = $options['optinPages']; 118 } 119 } 120 ?> 121 <input type="radio" name="optinwhere" id="optinWhereAll" value="all" <?php echo ($loc == 'all') ? 'checked' : '' ?>> 122 <label for='optinWhereAll' class='ply_label_optin_form'> Everywhere</label> 123 <input type="radio" name="optinwhere" id="optinWherePages" value="pages" <?php echo ($loc == 'pages') ? 'checked' : '' ?>> 124 <label for='optinWherePages' class='ply_label_optin_form'> On Pages</label> 125 <input type="radio" name="optinwhere" id="optinWherePosts" value="posts" <?php echo ($loc == 'posts') ? 'checked' : '' ?>> 126 <label for='optinWherePosts' class='ply_label_optin_form'> On Posts</label> 127 <input type="radio" name="optinwhere" id="optinWhereExcept" value="except" <?php echo ($loc == 'except') ? 'checked' : '' ?>> 128 <label for='optinWhereExcept' class='ply_label_optin_form'> Everywhere except</label> 129 <input type="radio" name="optinwhere" id="optinWhereSpecific" value="specific" <?php echo ($loc == 'specific') ? 'checked' : '' ?>> 130 <label for='optinWhereSpecific' class='ply_label_optin_form'> Show only on a specific page/post</label> 131 </div> 132 </div> 133 <div id='plyBlockListWpPages' class="row" <?php echo in_array($loc, array('except', 'specific')) ? '' : 'style="display:none;"' ?>> 134 <div class="col-md-12"> 135 <h4>Please select pages/posts</h4><hr> 136 </div> 137 <div class="col-md-12"> 138 <select id='optinWherePage' multiple name='optinWherePage[]'> 139 <?php foreach($postList as $post): ?> 140 <option value="<?php echo $post->ID ?>" <?php echo in_array($post->ID, $optinExceptPage) ? 'selected' : '' ?>><?php echo $post->post_title ?></option> 141 <?php endforeach; ?> 142 <?php foreach($pageList as $page): ?> 143 <option value="<?php echo $page->ID ?>" <?php echo in_array($page->ID, $optinExceptPage) ? 'selected' : '' ?>><?php echo $page->post_title ?></option> 144 <?php endforeach; ?> 145 </select> 113 146 </div> 114 147 </div> … … 202 235 <div class="row"> 203 236 <div class="col-md-12"> 204 < h4 style="display: inline-block;">Close optin if user clicks away?</h4>237 <label for='ply_clickAway'><h4>Close optin if user clicks away?</h4></label> 205 238 <?php 206 239 //by default true … … 217 250 <div class="row"> 218 251 <div class="col-md-12"> 219 < h4 style="display: inline-block;">Blur the page while the optin is visible?</h4>252 <label for='ply_blurBack'><h4>Blur the page while the optin is visible?</h4></label> 220 253 <?php 221 254 //by default true … … 245 278 <div class="row"> 246 279 <div class="col-md-12"> 247 <h4>Active Optins</h4><hr> 280 <h4 class="table-name">Active Optins</h4> 281 <?php /* <a target="_blank" href="<?php echo $user['main_url'] ?>/?page=lead_capture.forms" class="btn btn-default">View Optin</a> 282 <a class="btn btn-default" title="Refresh">↻</a> */ ?> 283 <hr> 248 284 <table class="table"> 249 285 <thead> … … 327 363 <input type="text" name="formOptinClickAway" id="formOptinClickAway" value="" /> 328 364 <input type="text" name="formOptinBlurBack" id="formOptinBlurBack" value="" /> 329 365 <input type="hidden" name='formOptinWherePages' id='formOptinWherePages' value=''/> 366 330 367 <input type="hidden" name="saveOptin" value="1" /> 331 368 </form> -
platformly/trunk/inc/pages/ply.pages.php
r1955138 r1998157 99 99 <div class="row"> 100 100 <div class="col-md-12"> 101 <h4 >Please select page</h4><hr>101 <h4 style='display: inline-block; margin-right: 5px'>Please select page</h4><a target="_blank" href="<?php echo $user['main_url'] ?>/?page=lead_capture.pages" class="btn btn-default">View Pages</a><hr style="margin-top: 5px !important"> 102 102 </div> 103 103 <div class="col-md-12" id="tdPages"> … … 127 127 <p>Homepage</p> 128 128 </a> 129 < a id="welcome" href="javascript:" onclick="choosePageType(jQuery(this));" class="<?= ($pageType == 'welcome') ? 'selected' : '' ?>">129 <?php /* <a id="welcome" href="javascript:" onclick="choosePageType(jQuery(this));" class="<?= ($pageType == 'welcome') ? 'selected' : '' ?>"> 130 130 <img src="<?= plugins_url('', dirname(__FILE__)) ?>/../img/welcome-page-type.png" width="100" height="100"/> 131 131 <p>Welcome</p> 132 </a> 132 </a> */ ?> 133 133 <a id="404" href="javascript:" onclick="choosePageType(jQuery(this));" class="<?= ($pageType == '404') ? 'selected' : '' ?>"> 134 134 <img src="<?= plugins_url('', dirname(__FILE__)) ?>/../img/error-page-type.png" width="100" height="100"/> … … 156 156 <div class="row"> 157 157 <div class="col-md-12"> 158 <h4>Active Pages</h4><hr> 158 <h4 class="table-name">Active Pages</h4> 159 160 <hr> 159 161 <table class="table"> 160 162 <thead> -
platformly/trunk/inc/pages/ply.settings.php
r1955138 r1998157 13 13 $access = 1; 14 14 include plugin_dir_path(__FILE__) . 'input.php'; 15 $projectCode = array(); 16 $projectCodeInclude = 0; 17 if(!empty($user) && $user['status'] == 'active'){ 18 $get_projects = wp_remote_get( PLATFORMLY_URL . "/plugin/plugin.actions.php?plugin_key=".ply_get_plugin_key()."&action=listProjects" ); 19 $get_projects = wp_remote_retrieve_body($get_projects); 20 $projects = json_decode($get_projects, true); 21 $projectCodeInclude = get_option('ply_project_code_active'); 22 $projectCode = ply_get_project_code(); 23 } 15 24 ?> 16 25 <table width="100%" border="0" cellspacing="0" cellpadding="3"> … … 54 63 <td width="90" valign="top"> 55 64 <?php 65 $default = plugins_url('', dirname(__FILE__)) . "/../img/profile_img.png"; 56 66 if(isset($user['profile_image']) && strlen($user['profile_image']) > 0){ 57 $img_url = urldecode($user['main_url']) . '/images_v2/profile_images/' . $user['profile_image']; 67 if(!empty($user['use_gravatar'])){ 68 $img_url = $user['profile_image']."?d=".urlencode( $default )."&s=90"; 69 }else{ 70 $img_url = $user['profile_image']; 71 } 58 72 } else{ 59 $default = plugins_url('', dirname(__FILE__)) . "/../img/profile_img.png";60 73 $size = 80; 61 74 $img_url = $default; 62 } 63 ?><img src="<?= $img_url ?>" width="80" height="80" class="round" style="border:3px #f4f4f4 solid;" title="<?= $user['first_name'] ?>" /> 75 }//var_dump($user);die; 76 ?> 77 <img src="<?= $img_url ?>" width="80" height="80" class="round" style="border:3px #f4f4f4 solid;" title="<?= $user['first_name'] ?>" /> 64 78 </td> 65 <td valign="top"><h2 style="margin-bottom:5px; padding-bottom:5px;">Welcome <?= $user['first_name'] . ' ' . $user['last_name'] ?></h2> 66 <strong>Email: </strong><?= $user['email'] ?><br /> 79 <td valign="top"> 80 <h2 style="margin-bottom:0; display: inline-block;margin-top: 5px;">Welcome <?= $user['first_name'] . ' ' . $user['last_name'] ?></h2> 81 <div><strong>Email: </strong><?= $user['email'] ?></div> 82 <form id="btnVisitAccount" method="get" target="_blank" action="<?php echo $user['main_url'] ?>"> 83 <input type='hidden' name='page' value='settings.personal_information'/> 84 <input type="submit" class="button" value="Visit your Account" /> 85 </form> 67 86 </td> 68 87 </tr> 69 88 </table> 89 <br/> 90 <div id="plyProjectCodeBlock"> 91 <h2 style="margin-bottom: 5px;">Add a Project Code</h2> 92 <div style="margin-bottom: 8px;"> 93 <input id="plyCheckboxSetProjectCode" value='1' type="checkbox" <?php echo !empty($projectCodeInclude) && !empty($projectCode) ? 'checked' : '' ?>/> 94 <label for="plyCheckboxSetProjectCode">Click here to include a Platform.ly project code within your blog</label> 95 </div> 96 <div id='plyProjectCodeSettings' <?php echo !empty($projectCodeInclude) && !empty($projectCode) ? 'style="display:block"' : '' ?>> 97 <select id="plyProjectSelect"> 98 <option value='-1'>Please choose...</option> 99 <?php foreach($projects as $pid => $pname): ?> 100 <option value="<?php echo $pid ?>" <?php echo isset($projectCode['ply_project_id']) && $projectCode['ply_project_id'] == $pid ? 'selected' : '' ?>><?php echo $pname ?></option> 101 <?php endforeach; ?> 102 </select> 103 <input id="btnPlySaveProjectCode" class="button" type="button" value="Save"/> 104 <div id="msgPlyGetProgectCodeError"></div> 105 <div id='plyLoadingProjectCode'>Loading...</div> 106 <div id="msgPlyGetProgectCodeActivated" class='ply_successMsg' <?php echo !isset($projectCode['ply_project_id']) ? 'style="display:none"' : '' ?> >A code from Project '<span><?php echo isset($projectCode['ply_project_id']) ? $projects[$projectCode['ply_project_id']] : '' ?></span>' is being used on this site. <a id="plyRemoveProjectCode" href="javascript:;">Remove Project code.</a></div> 107 </div> 108 </div> 70 109 <?php } ?> 71 110 </div> -
platformly/trunk/inc/ply.functions.php
r1955138 r1998157 64 64 $optinType = "pop"; 65 65 } 66 if(isset($_POST['formOptinWhere']) && in_array($_POST['formOptinWhere'], array('all', 'posts' ))){66 if(isset($_POST['formOptinWhere']) && in_array($_POST['formOptinWhere'], array('all', 'posts', 'pages', 'except', 'specific'))){ 67 67 $optinWhere = $_POST['formOptinWhere']; 68 68 }else{ … … 89 89 $optinBlurBack = "false"; 90 90 } 91 if(isset($_POST['formOptinWherePages']) && ($optinWhere == 'except' || $optinWhere == 'specific') && !empty($_POST['formOptinWherePages'])){ 92 $wpPages = explode(',', $_POST['formOptinWherePages']); 93 $optinPages = array(); 94 foreach($wpPages as $wpPage){ 95 $optinPages[] = (int)$wpPage; 96 } 97 }else{ 98 $optinPages = 0; 99 } 100 91 101 $plyOptinInfo = array( 92 102 "optinPosition" => $optinPosition, … … 96 106 "optinLoc" => $optinWhere, 97 107 "optinClickAway" => $optinClickAway, 98 "optinBlurBack" => $optinBlurBack 108 "optinBlurBack" => $optinBlurBack, 109 "optinPages" => $optinPages 99 110 ); 100 111 $plyOptinInfo = json_encode($plyOptinInfo); … … 383 394 } 384 395 396 function ply_set_project_code($projectId, $projectCode){ 397 global $wpdb; 398 $ply_plugin_cid = get_option('ply_plugin_cid'); 399 $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}ply_project_code WHERE ply_cid = %d", array($ply_plugin_cid))); 400 $query = $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->prefix}ply_project_code(ply_project_id, ply_cid, ply_project_code) VALUES (%d, %d, %s)", array($projectId, $ply_plugin_cid, $projectCode))); 401 /*$sql = $wpdb->prepare("SELECT id FROM {$wpdb->prefix}ply_project_code WHERE ply_project_id = %d AND ply_cid = %d", array($projectId, $ply_plugin_cid)); 402 $existsProjectCode = $wpdb->get_row($sql, ARRAY_A); 403 if(!empty($existsProjectCode)){ 404 $query = $wpdb->query($wpdb->prepare("UPDATE {$wpdb->prefix}ply_project_code SET ply_project_code = %s WHERE ply_project_id = %d AND ply_cid = %d", array($projectCode, $projectId, $ply_plugin_cid))); 405 }else{ 406 $query = $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->prefix}ply_project_code(ply_project_id, ply_cid, ply_project_code) VALUES (%d, %d, %s)", array($projectId, $ply_plugin_cid, $projectCode))); 407 }*/ 408 if($query){ 409 return true; 410 }else{ 411 return false; 412 } 413 } 414 415 function ply_get_project_code($projectId = null){ 416 global $wpdb; 417 $ply_plugin_cid = get_option('ply_plugin_cid'); 418 if($projectId){ 419 $sql = $wpdb->prepare("SELECT id, ply_project_code, ply_project_id FROM {$wpdb->prefix}ply_project_code WHERE ply_project_id = %d AND ply_cid = %d", array($projectId, $ply_plugin_cid)); 420 return $wpdb->get_row($sql, ARRAY_A); 421 }else{ 422 $sql = $wpdb->prepare("SELECT id, ply_project_code, ply_project_id FROM {$wpdb->prefix}ply_project_code WHERE ply_cid = %d", array($ply_plugin_cid)); 423 //return $wpdb->get_results($sql, ARRAY_A); 424 return $wpdb->get_row($sql, ARRAY_A); 425 } 426 } 427 428 function ply_remove_project_code(){ 429 global $wpdb; 430 $ply_plugin_cid = get_option('ply_plugin_cid'); 431 $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}ply_project_code WHERE ply_cid = %d", array($ply_plugin_cid))); 432 } 433 434 function ply_project_code_include($v){ 435 if($v === true){ 436 update_option('ply_project_code_active', 1); 437 }else{ 438 update_option('ply_project_code_active', 0); 439 } 440 } 385 441 ?> -
platformly/trunk/js/events.js
r1955138 r1998157 9 9 jQuery('#plyEventsTable tbody').html('<tr><td colspan="6">'+data.status+'</td></tr>'); 10 10 }else{ 11 jQuery('#evCode_top').text(data.eventCode);11 //jQuery('#evCode_top').text(data.eventCode); 12 12 if(data.events.length > 0){ 13 13 var tbody = ''; … … 47 47 var eventCode = "<script type='text/javascript'>plyt('"+action.replace(/[^a-zA-Z0-9_ ]/gi, "")+"', '"+description.replace(/[^a-zA-Z0-9_ ]/gi, "")+"','"+encodeURIComponent(id)+"');<\/script>"; 48 48 var eventCodeClick = "onclick=\"plyt('"+action.replace(/[^a-zA-Z0-9_ ]/gi, "")+"', '"+description.replace(/[^a-zA-Z0-9_ ]/gi, "")+"','"+encodeURIComponent(id)+"');\""; 49 var eventPixelCode = '<img height="1" width="1" style="display:none" src="https://www.platform.ly/platformly.php?a='+encodeURIComponent(action.replace(/[^a-zA-Z0-9_ ]/gi, ""))+'&d='+encodeURIComponent(description.replace(/[^a-zA-Z0-9_ ]/gi, ""))+'&e='+encodeURIComponent(id)+'"/>';49 //var eventPixelCode = '<img height="1" width="1" style="display:none" src="https://www.platform.ly/platformly.php?a='+encodeURIComponent(action.replace(/[^a-zA-Z0-9_ ]/gi, ""))+'&d='+encodeURIComponent(description.replace(/[^a-zA-Z0-9_ ]/gi, ""))+'&e='+encodeURIComponent(id)+'"/>'; 50 50 51 51 $("#eventType").val(1).trigger('change'); 52 52 $("#evCode_bottom_click").val(eventCodeClick); 53 53 $("#evCode_bottom").val(eventCode); 54 $("#evCode_bottom_pixel").val(eventPixelCode);54 //$("#evCode_bottom_pixel").val(eventPixelCode); 55 55 $('#plyEventsModal').modal('show'); 56 56 }); … … 77 77 } 78 78 }); 79 $('#btnPlyRefreshEvents').click(function(e){ 80 e.preventDefault(); 81 var projectId = $('#plyProjectSelect').val(); 82 loadEvents(projectId); 83 }); 84 $('#plyProjectSelect').click(function(){ 85 var projectId = $(this).val(); 86 /*$('#msgPlyGetProgectCodeActivated').hide(); 87 $('#plyProjectCodeMsgNotExist').hide(); 88 $.post(ajaxurl, {'action': 'ply_check_project_code','projectId': projectId}, function(response){ 89 if(response){ 90 $('#msgPlyGetProgectCodeActivated span').text($('#plyProjectSelect option:selected').text()); 91 $('#msgPlyGetProgectCodeActivated').show(); 92 }else{ 93 $('#plyProjectCodeMsgNotExist').show(); 94 } 95 });*/ 96 loadEvents(projectId); 97 }); 79 98 })(jQuery); -
platformly/trunk/js/optins.js
r1955138 r1998157 45 45 function updateOptin(edit) { 46 46 (function($) { 47 var optinWhere = $('input[name="optinwhere"]:checked').val(); 48 var optinWherePage = $('#optinWherePage').val(); 49 47 50 if ($("#ply_project").val() == -1) { 48 51 alert("Please select optin form first!"); … … 61 64 return; 62 65 } 63 66 if((optinWhere == 'except' || optinWhere == 'specific') && optinWherePage === null){ 67 alert("Please choose a page/post!"); 68 return; 69 } 70 64 71 if (edit) { 65 72 var projectId = $("#edit_ply_optin_pid").val(); … … 77 84 optinId = -1; 78 85 79 var optinWhere = ''; 80 if ($("#optinWhereAll").is(":checked")) 86 /*if ($("#optinWhereAll").is(":checked")) 81 87 optinWhere = 'all'; 82 88 else if ($("#optinWherePosts").is(":checked")) 83 89 optinWhere = 'posts'; 84 90 */ 85 91 var clickAway = false; 86 92 if ($("#ply_clickAway").is(":checked")) … … 90 96 if ($("#ply_blurBack").is(":checked")) 91 97 blurBack = true; 92 98 if(optinWherePage !== null){ 99 optinWherePage = optinWherePage.join(","); 100 }else{ 101 optinWherePage = 0; 102 } 93 103 $("#formProjectId").val(projectId); 94 104 $("#formOptinId").val(optinId); … … 101 111 $("#formOptinClickAway").val(clickAway); 102 112 $("#formOptinBlurBack").val(blurBack); 103 113 $("#formOptinWherePages").val(optinWherePage); 114 104 115 $("#optinSaveForm").submit(); 105 116 })(jQuery); … … 111 122 $("#thTrigger").html("Please select the delay (in seconds) before this optins is shown:"); 112 123 113 $("#tdTrigger").html("<input type='text' name='triggerValue' id='triggerValue' value='" + value + "' /> seconds");124 $("#tdTrigger").html("<input type='text' name='triggerValue' id='triggerValue' style='width: 50px' value='" + value + "' /> seconds"); 114 125 } else if (type == 'scroll') { 115 126 $("#thTrigger").html("Please select the scroll percentage before this optins is shown"); … … 151 162 })(jQuery); 152 163 } 164 165 (function($){ 166 $(document).ready(function(){ 167 $('#optinWherePage').select2({ 168 placeholder: "Please choose...", 169 width: '20%' 170 }); 171 }); 172 $('input[name="optinwhere"]').change(function(){ 173 if($(this).val() == 'except' || $(this).val() == 'specific'){ 174 $('#plyBlockListWpPages').show(); 175 }else{ 176 $('#plyBlockListWpPages').hide(); 177 } 178 }); 179 })(jQuery); -
platformly/trunk/js/pages.js
r1955138 r1998157 1 plyPageSlug = ''; 1 2 function loadPages(projectId, pageId) { 2 3 if (projectId == -1) … … 86 87 (function($){ 87 88 text = typeof text !== 'undefined' ? text : false; 88 if (value == undefined) 89 value = ''; 89 if (typeof value != 'undefined'){ 90 plyPageSlug = value; 91 } 90 92 if (elem != '') { 91 93 $('#plugin-type a').removeClass('selected'); … … 94 96 95 97 if ($(elem).attr('id') == 'normal' || $(elem).attr('id') == 'welcome' || text != false) { 96 $("#pageSlugContainer").html("<h4>Choose a slug name: <input type='text' name='pageSlug' id='pageSlug' value='" + value+ "' /><br><small>* Only allowed: A-Z, a-z, 0-9, - and _</small> <br> <small>** Blank spaces will be automatically converted to hyphens (-)</small> </h4> ");98 $("#pageSlugContainer").html("<h4>Choose a slug name: <input type='text' name='pageSlug' id='pageSlug' value='" + plyPageSlug + "' /><br><small>* Only allowed: A-Z, a-z, 0-9, - and _</small> <br> <small>** Blank spaces will be automatically converted to hyphens (-)</small> </h4> "); 97 99 if ($(elem).attr("id") == "welcome") { 98 100 $("#pageSlugContainer").append("* If you already have a page of this type it will be overwritten as only one at a time can exist."); … … 113 115 })(jQuery); 114 116 } 117 (function($){ 118 $(document).on('change', '#pageSlug', function(){ 119 plyPageSlug = $(this).val(); 120 }); 121 })(jQuery); -
platformly/trunk/js/ply_add_link_functions.js
r1955138 r1998157 1 1 plyAddLinkDialog = '<div id="ply-add-link-dialog" class="hidden" style="max-width:800px"></div>'; 2 plySearchWord = ''; 2 3 function get_ply_tracking_links(){ 3 4 jQuery.post(ajaxurl, {action: 'ply_get_tracking_links'}, function(response){ … … 14 15 if(data.links[key]['disabled'] != 'disabled'){ 15 16 tbody += '<tr>\n\ 16 <td style="font-size:12px;">'+data.links[key]['cat_name']+'</td>\n\ 17 <td style="font-size:12px;"><a href="javascript:;" style="text-decoration: none; color: inherit;" onclick="load_trackingLinks_inDetails('+data.links[key]['id']+')"><strong>'+data.links[key]['name']+'</strong></a></td>\n\ 17 <td class="ply_search_link" style="font-size:12px;">'+data.links[key]['project_name']+'</td>\n\ 18 <td class="ply_search_link" style="font-size:12px;">'+data.links[key]['cat_name']+'</td>\n\ 19 <td class="ply_search_link" style="font-size:12px;"><a href="javascript:;" style="text-decoration: none; color: inherit;" onclick="load_trackingLinks_inDetails('+data.links[key]['id']+')"><strong>'+data.links[key]['name']+'</strong></a></td>\n\ 18 20 <td style="font-size:12px; text-align:left"><a style="word-break: break-all" href="'+data.links[key]['target_link']+'" target="_blank">'+data.links[key]['target_link']+'</a></td>\n\ 19 21 </tr>'; 20 22 } 21 23 } 22 var table = '<table id="links_table_toggle">\n\ 24 var search = '<div><input id="ply_links_table_search" type="text" placeholder="Enter search word"/></div>'; 25 var table = search+'<table id="links_table_toggle">\n\ 23 26 <thead>\n\ 27 <th>Project</th>\n\ 24 28 <th>Category</th>\n\ 25 29 <th>Campaign</th>\n\ … … 29 33 </table>'; 30 34 $('#ply-add-link-dialog').html(table); 31 $('#ply-add-link-dialog').dialog('widget').position({ my: "center", at: "center", of: window }); 35 if(plySearchWord){ 36 $('#ply_links_table_search').val(plySearchWord).keyup(); 32 37 } 38 $('#ply-add-link-dialog').on('keyup', '#ply_links_table_search', function(){ 39 $('#links_table_toggle tr').removeClass('ply_search_has_result'); 40 plySearchWord = $('#ply_links_table_search').val(); 41 //$('#links_table_toggle td.ply_search_link:not(:contains("'+plySearchWord+'"))').parents('tr').addClass('ply_serch_not_result'); 42 var lowerPlySearchWord = plySearchWord.toLowerCase(); 43 $('#links_table_toggle td.ply_search_link').each(function(){ 44 if($(this).text().toLowerCase().indexOf(lowerPlySearchWord) < 0){ 45 if(!$(this).parent('tr').hasClass('ply_search_has_result')){ 46 $(this).parent('tr').addClass('ply_serch_not_result'); 47 } 48 }else{ 49 $(this).parent('tr').addClass('ply_search_has_result').removeClass('ply_serch_not_result'); 50 } 51 }); 52 }); 53 $('#ply-add-link-dialog').dialog({width: '600px'}).position({ my: "center", at: "center", of: window }); 54 } 33 55 }); 34 56 } … … 83 105 $('#ply-add-link-dialog').html('<div>Loading . . .</div>'); 84 106 } 85 -
platformly/trunk/platformly.php
r1955138 r1998157 4 4 Plugin Name: Platform.ly Official 5 5 Description: Platform.ly plugin is the easiest way to setup your optins and pages that your created with Platform.ly. After building your optin or page with our interactive WYSIWYG builders, you can set them up to show on your site with just a couple of clicks. 6 Version: 1. 26 Version: 1.3 7 7 Author: Platform.ly 8 8 Author URI: https://www.platform.ly/ … … 44 44 45 45 function ply_settings(){ 46 wp_enqueue_script('ply_optins_script', plugin_dir_url(__FILE__)."js/settings.js"); 46 47 include plugin_dir_path(__FILE__) . 'inc/pages/ply.settings.php'; 47 48 } … … 50 51 wp_enqueue_style('bootstrap_styles', plugin_dir_url(__FILE__)."css/bootstrap.min.css"); 51 52 wp_enqueue_style('bootstrap_theme_styles', plugin_dir_url(__FILE__)."css/bootstrap-theme.min.css"); 53 wp_enqueue_style('select2', plugin_dir_url(__FILE__)."css/select2.min.css"); 54 wp_enqueue_script('select2', plugin_dir_url(__FILE__)."js/select2.min.js"); 52 55 wp_enqueue_script('ply_optins_script', plugin_dir_url(__FILE__)."js/optins.js"); 53 56 include plugin_dir_path(__FILE__) . 'inc/pages/ply.optins.page.php'; … … 72 75 delete_option('ply_plugin_key'); 73 76 delete_option('ply_plugin_cid'); 77 delete_option('ply_project_code_active'); 74 78 global $wpdb; 75 79 //remove optin_forms table … … 79 83 $table_name = $wpdb->prefix . "ply_pages"; 80 84 $sql = "DROP TABLE " . $table_name; 85 $wpdb->query($sql); 86 $table_name = $wpdb->prefix."ply_project_code"; 87 $sql = "DROP TABLE ".$table_name; 81 88 $wpdb->query($sql); 82 89 } … … 95 102 }; 96 103 $table_name = $wpdb->prefix . "ply_optins"; 97 $val = $wpdb->get_results('select 1 from ' . $table_name); 98 if(!empty($val)){ 99 //DO NOTHING! IT EXISTS! 100 } else{ 101 //I can't find it... Create table 102 $sql = "CREATE TABLE $table_name ( 103 id mediumint(9) NOT NULL AUTO_INCREMENT, 104 ply_cid int NOT NULL, 105 ply_optin_name VARCHAR(255) NULL, 106 ply_optin_id int NOT NULL UNIQUE, 107 ply_optin_pid int NULL, 108 ply_optin_options text NULL, 109 ply_optin_stats text NULL, 110 PRIMARY KEY (id) 111 ) {$charset_collate};"; 112 dbDelta($sql); 113 } 104 $sql = "CREATE TABLE IF NOT EXISTS $table_name ( 105 id mediumint(9) NOT NULL AUTO_INCREMENT, 106 ply_cid int NOT NULL, 107 ply_optin_name VARCHAR(255) NULL, 108 ply_optin_id int NOT NULL UNIQUE, 109 ply_optin_pid int NULL, 110 ply_optin_options text NULL, 111 ply_optin_stats text NULL, 112 ply_optin_except_page int NULL, 113 ply_optin_specific_page int NULL, 114 PRIMARY KEY (id) 115 ) {$charset_collate};"; 116 dbDelta($sql); 117 114 118 $table_name = $wpdb->prefix . "ply_pages"; 115 $val = $wpdb->get_results( 'select 1 from ' . $table_name);119 $val = $wpdb->get_results("SHOW TABLES LIKE '{$table_name}'"); 116 120 if(!empty($val)){ 117 121 //IT EXISTS! Fresh update every active page html … … 123 127 }else{ 124 128 //I can't find it... Create table 125 $sql = "CREATE TABLE $table_name (129 $sql = "CREATE TABLE IF NOT EXISTS $table_name ( 126 130 id mediumint(9) NOT NULL AUTO_INCREMENT, 127 131 ply_cid int NOT NULL, … … 139 143 dbDelta($sql); 140 144 } 145 $table_name = $wpdb->prefix."ply_project_code"; 146 $sql = "CREATE TABLE IF NOT EXISTS {$table_name} ( 147 `id` int NOT NULL AUTO_INCREMENT, 148 `ply_project_id` int NOT NULL, 149 `ply_cid` int NOT NULL, 150 `ply_project_code` text NULL, 151 PRIMARY KEY (`id`), 152 UNIQUE KEY `ply_project_id` (`ply_project_id`,`ply_cid`), 153 KEY `ply_cid` (`ply_cid`) 154 ) {$charset_collate};"; 155 dbDelta($sql); 156 141 157 } 142 158 … … 149 165 add_action('wp_ajax_ply_load_events', 'ply_load_events_callback'); 150 166 add_action('wp_ajax_ply_get_tracking_links_details', 'ply_get_tracking_links_details_callback'); 167 add_action('wp_ajax_ply_save_project_code', 'ply_save_project_code_callback'); 168 add_action('wp_ajax_ply_check_project_code', 'ply_check_project_code_callback'); 169 add_action('wp_ajax_ply_remove_project_code', 'ply_remove_project_code_callback'); 170 add_action('wp_ajax_ply_project_code_include', 'ply_project_code_include_callback'); 151 171 152 172 function ply_load_optins_callback(){ … … 186 206 $result = wp_remote_retrieve_body($result); 187 207 echo $result; 208 wp_die(); 209 } 210 211 function ply_save_project_code_callback(){ 212 $projectId = intval($_POST['projectId']); 213 $result = wp_remote_get(PLATFORMLY_URL."/plugin/plugin.actions.php?plugin_key=".ply_get_plugin_key()."&action=getProjectCode&projectId=".$projectId); 214 $result = wp_remote_retrieve_body($result); 215 $data = json_decode($result, true); 216 if($data['status'] != 'success'){ 217 echo $result; 218 }else{ 219 if(isset($data['projectCode']) && !empty($data['projectCode'])){ 220 $setProject = ply_set_project_code($projectId, $data['projectCode']); 221 if($setProject === true){ 222 echo json_encode(array('status' => 'success', 'projectName' => wp_strip_all_tags($data['projectName']))); 223 }else{ 224 echo json_encode(array('status' => 'An error occured.')); 225 } 226 }else{ 227 echo json_encode(array('status' => 'An error occured.')); 228 } 229 } 230 wp_die(); 231 } 232 function ply_check_project_code_callback(){ 233 $projectId = intval($_POST['projectId']); 234 $projectCode = ply_get_project_code($projectId); 235 if(empty($projectCode)){ 236 $response = false; 237 }else{ 238 $response = true; 239 } 240 echo $response; 241 wp_die(); 242 } 243 244 function ply_remove_project_code_callback(){ 245 ply_remove_project_code(); 246 wp_die(); 247 } 248 249 function ply_project_code_include_callback(){ 250 $includeCode = isset($_POST['includeCode']) && !empty($_POST['includeCode']) ? true : false; 251 ply_project_code_include($includeCode); 188 252 wp_die(); 189 253 } … … 207 271 "oca" => $options->optinClickAway, 208 272 "obb" => $options->optinBlurBack, 209 "oloc" => $options->optinLoc 273 "oloc" => $options->optinLoc, 274 "pageId" => $post->ID, 275 "selectedPages" => $options->optinPages, 210 276 ); 211 277 $optinsBodyEncoded = json_encode($optinsBody); 212 278 $optinsString .= "'{$optinsBodyEncoded}',"; 213 279 } 214 wp_enqueue_script('ply_optins_load_script', PLATFORMLY_URL."/plugin/plyoptin.js?v=1. 2");280 wp_enqueue_script('ply_optins_load_script', PLATFORMLY_URL."/plugin/plyoptin.js?v=1.3"); 215 281 wp_add_inline_script('ply_optins_load_script', "var plyoptins = [" . rtrim($optinsString, ',') . "];var PLY = {'plugin_key':'" . ply_get_plugin_key() . "'};", 'before'); 216 282 } … … 250 316 die($res); 251 317 } */ 252 if(!empty($welcomePage) && $slug == $welcomePage['ply_page_slug']){318 /*if(!empty($welcomePage) && $slug == $welcomePage['ply_page_slug']){ 253 319 $page['ply_page_html'] = $welcomePage['ply_page_html']; 254 } elseif(is_front_page()){ 320 } else 321 */if(is_front_page()){ 255 322 $page = ply_get_page_by_options('homepage'); 256 323 } else{ … … 312 379 313 380 add_action('admin_enqueue_scripts', 'platform_ly_editor_css'); 381 382 function platform_ly_set_project_code(){ 383 $projectCodeInclude = get_option('ply_project_code_active'); 384 if(!empty($projectCodeInclude)){ 385 $projectCode = ply_get_project_code(); 386 if(isset($projectCode['ply_project_code'])){ 387 echo $projectCode['ply_project_code']; 388 } 389 } 390 /*foreach($projectCode as $code){ 391 echo $code['ply_project_code']; 392 }*/ 393 } 394 add_action('wp_head', 'platform_ly_set_project_code'); 314 395 ?> -
platformly/trunk/readme.txt
r1955138 r1998157 63 63 == Upgrade Notice == 64 64 65 = 1.3 = 66 - new feature for automatic adding the project code in the site header. 67 - extended settings to show optins. 68 65 69 = 1.2 = 66 70 Added new features, such as events and ability to insert the tracking links straight in WP default editor.
Note: See TracChangeset
for help on using the changeset viewer.