';
$stub .= '';
}
}
return $content . $stub;
}
add_filter( 'the_content', 'aptly_style_display' );
function aptly_plugin_settings_link($links) {
$settings_link = 'Settings';
array_unshift($links, $settings_link);
return $links;
}
$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", 'aptly_plugin_settings_link' );
function aptly_settings_page() {
// add top level menu page
add_menu_page(
'Aptly',
'Aptly Options',
'manage_options',
'aptly',
'aptly_settings_page_html',
'dashicons-editor-textcolor'
);
}
add_action('admin_menu', 'aptly_settings_page'); // settings_options_page
function aptly_settings_page_html() {
// $background_color = get_option('awp_background_color');
// $section_title_color = get_option('awp_section_color');
// $headline_color = get_option('awp_headline_color');
/* wp_enqueue_style('spectrumcss', plugins_url('css/spectrum.css', __FILE__));
wp_enqueue_script('spectrumjs', plugins_url('js/vendor/spectrum.js', __FILE__));
wp_enqueue_script('awporgsettingsjs', plugins_url('js/awp_org_settings.js', __FILE__));
wp_enqueue_style('cerklawpcss', plugins_url('css/cerkl_awp.min.css', __FILE__));
wp_enqueue_style('cerklformscss', plugins_url('css/cerkl_forms.css', __FILE__)); */
if (!current_user_can('manage_options')) {
echo "user is not allowed to do this operation";
return;
}
if (isset($_POST['aptly_cerkl_key'])) {
if (aptly_cerkl_key(sanitize_text_field($_POST['aptly_cerkl_key'])))
{
update_option('aptly_cerkl_key', sanitize_text_field($_POST['aptly_cerkl_key']));
$aptly_key_value = sanitize_text_field($_POST['aptly_cerkl_key']);
// what is the value of this variable?
// somewhere else, logic for hiding the tab.
}
else {
$aptly_key_value = 'invalid key';
}
}
if (isset($_POST['aptly_opt_in'])) {
update_option('aptly_opt_in', sanitize_text_field($_POST['aptly_opt_in']));
$opt_in_value = sanitize_text_field($_POST['aptly_opt_in']);
}
else {
if (isset($_POST['optin_submitted']))
{
update_option('aptly_opt_in', '1');
$opt_in_value = '1';
aptly_store_user();
}
else {
$opt_in_value = get_option('aptly_opt_in');
}
}
if (isset($_POST['awp_background_color'])) {
update_option('awp_background_color', sanitize_text_field($_POST['awp_background_color']));
$bgr_clr_value = sanitize_text_field($_POST['awp_background_color']);
}
else {
$bgr_clr_value = get_option('awp_background_color');
}
if (isset($_POST['awp_section_color'])) {
update_option('awp_section_color', sanitize_text_field($_POST['awp_section_color']));
$sec_clr_value = sanitize_text_field($_POST['awp_section_color']);
}
else {
$sec_clr_value = get_option('awp_section_color');
}
if (isset($_POST['awp_headline_color'])) {
update_option('awp_headline_color', sanitize_text_field($_POST['awp_headline_color']));
$hdl_clr_value = sanitize_text_field($_POST['awp_headline_color']);
}
else {
$hdl_clr_value = get_option('hdl_color');
}
if (isset($_POST['aptly_image_width'])) {
update_option('aptly_image_width', sanitize_text_field($_POST['aptly_image_width']));
$iw_value = sanitize_text_field($_POST['aptly_image_width']);
}
else {
$iw_value = get_option('aptly_image_width');
}
if (isset($_POST['aptly_image_type'])) {
update_option('aptly_image_type', sanitize_text_field($_POST['aptly_image_type']));
$itype_value = sanitize_text_field($_POST['aptly_image_type']);
}
else {
$itype_value = get_option('aptly_image_type');
}
if (isset($_POST['aptly_image_height'])) {
update_option('aptly_image_height', sanitize_text_field($_POST['aptly_image_height']));
$ih_value = sanitize_text_field($_POST['aptly_image_height']);
}
else {
$ih_value = get_option('aptly_image_height');
}
if (isset($_POST['aptly_headline_font_size'])) {
update_option('aptly_headline_font_size', sanitize_text_field($_POST['aptly_headline_font_size']));
$hdl_fz_value = sanitize_text_field($_POST['aptly_headline_font_size']);
}
else {
$hdl_fz_value = get_option('aptly_headline_font_size');
}
if (isset($_POST['aptly_headline_bold'])) {
update_option('aptly_headline_bold', sanitize_text_field($_POST['aptly_headline_bold']));
$hdl_bold_value = sanitize_text_field($_POST['aptly_headline_bold']);
}
else {
$hdl_bold_value = get_option('aptly_headline_bold');
}
if (isset($_POST['aptly_headline_line_height'])) {
update_option('aptly_headline_line_height', sanitize_text_field($_POST['aptly_headline_line_height']));
$hdl_lh_value = sanitize_text_field($_POST['aptly_headline_line_height']);
}
else {
$hdl_lh_value = get_option('aptly_headline_line_height');
}
if (isset($_POST['awp_background_color'])) {
update_option('awp_background_color', sanitize_text_field($_POST['awp_background_color']));
$bgr_clr_value = sanitize_text_field($_POST['awp_background_color']);
}
else {
$bgr_clr_value = get_option('awp_background_color');
}
if (isset($_POST['awp_section_color'])) {
update_option('awp_section_color', sanitize_text_field($_POST['awp_section_color']));
$sec_clr_value = sanitize_text_field($_POST['awp_section_color']);
}
else {
$sec_clr_value = get_option('awp_section_color');
}
if (isset($_POST['awp_headline_color'])) {
update_option('awp_headline_color', sanitize_text_field($_POST['awp_headline_color']));
// sanitize might strip the # character. Need to be careful.
$hdl_clr_value = sanitize_text_field($_POST['awp_headline_color']);
}
else {
$hdl_clr_value = get_option('awp_headline_color');
}
if (isset($_POST['awp_switch_color'])) {
update_option('awp_switch_color', sanitize_text_field($_POST['awp_switch_color']));
$bgc_selection_value = sanitize_text_field($_POST['awp_switch_color']);
}
else {
update_option('awp_switch_color', 'dontshow'); //validate here
$bgc_selection_value = 'dontshow';
}
if (isset($_POST['aptly_show_trending'])) {
update_option('aptly_show_trending', sanitize_text_field($_POST['aptly_show_trending']));
$sec_trnd_value = sanitize_text_field($_POST['aptly_show_trending']);
// check here
}
else {
if (isset($_POST['submitted'])) // change 'submitted' also.
{
update_option('aptly_show_trending', '0');
$sec_trnd_value = '0';
}
else {
$sec_trnd_value = get_option('aptly_show_trending');
}
}
if (isset($_POST['aptly_show_new'])) {
update_option('aptly_show_new', sanitize_text_field($_POST['aptly_show_new']));
$sec_new_value = sanitize_text_field($_POST['aptly_show_new']);
}
else {
if (isset($_POST['submitted']))
{
update_option('aptly_show_new', '0'); // may be validate here
$sec_new_value = '0'; // if aptly_show_new is not a form variable, then it will set it to one.
// is this the logic we want. Also, how will IS_SET work when the value is null. Will the
// variable be in the request variable?
}
else {
$sec_new_value = get_option('aptly_show_new');
}
}
if (isset($_POST['aptly_show_recent'])) {
update_option('aptly_show_recent', sanitize_text_field($_POST['aptly_show_recent']));
$sec_recent_value = sanitize_text_field($_POST['aptly_show_recent']);
}
else {
if (isset($_POST['submitted']))
{
update_option('aptly_show_recent', '0');
$sec_recent_value = '0'; // will not choosing it, save zero? is it int or string?
}
else {
$sec_recent_value = get_option('aptly_show_recent');
}
}
?>
Aptly Plugin Setup Page
Hi, I'm Nick and we're about to become best friends.
I am going to help you engage your audience like never before! I automatically learn about the interests of every person that visits your site and tailor contents to them based on their interests.
Cool, I know.
You will also receive free email reports from me showing how personalizing visitor experiences is increasing engagement. For me to work, I am going to grab your domain and your email address.
Ready for awesomeness?
checked="checked" value="1">
checked="checked" value="1">
checked="checked" value="1">
Having trouble? No worries. Contact our support team.
If you already have a Cerkl account, please enter the Cerkl Code below. This will help connecting your Cerkl engagement score to your Aptly plugin.
If you dont have a Cerkl account or you are not ready to connect it to the plugin yet, please leave it blank.
Note: The engagement score, insights, from the stories on your Wordpress blog will be considered as test, until you provide the Cerkl Code for your account.
Enter the Cerkl Code:
The Cerkl Key value that you entered is not correct. We will continue to use your existing Cerkl