| Current Path : /home/ereika83/www/wp-content/plugins/pressplay/templates/ |
| Current File : /home/ereika83/www/wp-content/plugins/pressplay/templates/settings.php |
<?php
$query = new WP_Query(
array(
'post_type' => 'page',
'meta_key' => 'pp_pid'
)
);
$page_on_front = (int) get_option( 'page_on_front' );
?>
<div class="pp_container">
<div class="pp right">
<div class="pp__header">
<div class="pp__headline">
<i class="fa fa-bars"></i> Menu
</div>
</div>
<div class="pp__app-campaignSelector">
<label>Select Campaign ( <a href="#" class="js--pp-refresh-projects-list">refresh</a> )</label>
<div class="pp__projects-select">
<?php
$projects_list = Pressplay::instance()->fetch_projects();
echo Pressplay::instance()->page_render(
'projects-list.php',
array( 'projects_list' => $projects_list )
);
?>
</div>
<a href="#" class="pp__app-button js--pp-add-page"><i class="fa fa-plus"></i>ADD THIS PAGE</a>
</div>
<div class="pp__app-key">
<div class="pp__project-apiContainer">
<input id="pp_api_key" class="pp__project-api" type="text"
value="<?php echo Pressplay::instance()->get_api_key(); ?>"
disabled=disabled/>
<div class="pp__project-apiControl">
<a href="#" class="active editAPI"><i class="fa fa-pencil-square-o"></i></a>
<a href="#" class="saveAPI"><i class="fa fa-save"></i></a>
</div>
</div>
<a href="#" target="" class="pp__app-button js--pp-api-toggle"><i class="fa fa-key"></i> SHOW SECRET KEY</a>
</div>
<div class="pp__app-link">
<a href="http://app.pressplay.io" target="_blank" class="pp__app-button"><i class="fa fa-user"></i>
PRESSPLAY ACCOUNT</i></a>
</div>
</div>
<div class="pp left">
<div class="pp__header">
<div class="pp__headline">
<i class="fa fa-bars"></i> Your Sales Pages
</div>
</div>
<div class="pp__container">
<?php
if ($query->have_posts()) {
?>
<table class="pp__projects-list">
<tr>
<th>
Project Title
</th>
<th>
Permalink
</th>
<th style="text-align: center;">
Actions
</th>
</tr>
<?php
while ($query->have_posts()) {
$query->the_post();
global $post;
?>
<tr>
<td>
<div class="js--pp-info-toggle pp__info-toggle">
<?php
if ($page_on_front === get_the_ID()) {
?>
<i class="fa fa-home"></i>
<?php
}
echo get_the_title();
?>
</div>
</td>
<td class="">
<p class="pp__project-info">
<?php
$sample_permalink = get_sample_permalink( get_the_ID() );
echo str_replace(
'%pagename%',
'<strong>' . $sample_permalink[1] . '</strong>',
$sample_permalink[0]
);
?>
</p>
</td>
<td class="pp__actions">
<?php
if (get_the_ID() !== $page_on_front) {
?>
<a href="#" title="Make homepage" class="js--pp-make-homepage"
data-page-id="<?php echo get_the_ID(); ?>">
<i class="fa fa-home"></i>
</a>
<a href="#" title="Change permalink" class="js--pp-change-permalink"
data-permalink="<?php echo $sample_permalink[1]; ?>"
data-page-id="<?php echo get_the_ID(); ?>">
<i class="fa fa fa-link"></i>
</a>
<?php } ?>
<a href="<?php the_permalink(); ?>" target="_blank" title="Open page in new tab">
<i class="fa fa fa-external-link"></i>
</a>
<a href="#" class="delete_pp_page"
data-page-id="<?php the_ID(); ?>"
title="Delete page">
<i class="fa fa-trash-o"></i>
</a>
</td>
</tr>
<?php
}
?>
</table>
<?php
wp_reset_postdata();
}
?>
</div>
</div>
</div>
<script>
jQuery(document).ready(function ($) {
$('.delete_pp_page').click(function (event) {
event.preventDefault();
if (confirm('Are you sure you want to delete this page and PressPlay files associated with it?')) {
var that = this;
$.post(ajaxurl, {
action: 'pp_delete_page',
page_id: $(this).data('page-id')
}, function (result) {
if (result.status) {
$(that).closest('tr').fadeOut(300).promise().remove();
}
}, 'json');
}
});
$('.js--pp-make-homepage').click(function (event) {
event.preventDefault();
$.post(ajaxurl, {
action: 'pp_make_homepage',
page_id: $(this).data('page-id')
}, function (result) {
if (result.status > 0) {
window.location.reload();
} else
alert(result.message);
}, 'json');
});
$('.js--pp-change-permalink').click(function (event) {
event.preventDefault();
var new_permalink = prompt("Edit permalink (lowercase alpha numeric and dash characters): ", $(this).data('permalink'));
if (new_permalink != null) {
$.post(ajaxurl, {
action: 'pp_change_permalink',
page_id: $(this).data('page-id'),
new_permalink: new_permalink
}, function (result) {
if (result.status > 0) {
window.location.reload();
} else
alert(result.message);
}, 'json');
}
});
$('.js--pp-info-toggle').click(function () {
$(this).next('.pp__project-info').slideToggle('fast');
});
$('.pp__project-apiContainer').hide();
$('.js--pp-api-toggle').click(function (event) {
event.preventDefault();
$(this).toggleClass('active');
$('.pp__project-apiContainer').slideToggle('fast');
if ($(this).hasClass("active")) {
$(this).html('<i class="fa fa-key"></i> HIDE SECRET KEY');
}
else {
$(this).html('<i class="fa fa-key"></i> SHOW SECRET KEY');
$('.editAPI').addClass('active');
$('.saveAPI').removeClass('active');
$('.pp__project-api').prop("disabled", true);
}
});
$('.editAPI').click(function (event) {
event.preventDefault();
$('.pp__project-api').prop("disabled", false).focus();
$(this).removeClass('active');
$('.saveAPI').addClass('active');
});
$('.saveAPI').click(function (event) {
event.preventDefault();
$.post(ajaxurl, {
action: 'pp_change_api_key',
api_key: $('#pp_api_key').val()
}, function (data) {
$('.editAPI').addClass('active');
$('.saveAPI').removeClass('active');
}, 'json');
});
$('.js--pp-refresh-projects-list').click(function (event) {
event.preventDefault();
$.post(ajaxurl, {
action: 'pp_refresh_projects_list'
}, function (data) {
if (data.html)
$('.pp__projects-select').html(data.html);
else
alert('Could not fetch updated projects list.');
}, 'json');
});
$('.js--pp-add-page').click(function (event) {
event.preventDefault();
$.post(ajaxurl, {
action: 'pp_pull_project',
project_id: $('#pp_projects_select').val()
}, function (data) {
if (data.status == 1)
window.location.reload();
else
alert(data.message);
}, 'json');
});
});
</script>