public static function process_data()
 {
     if (isset($_POST['ml_preview_upload_image'])) {
         if ($_POST['ml_preview_upload_image'] != get_option('ml_preview_upload_image')) {
             update_option("ml_preview_upload_image_time", time());
         }
         update_option("ml_preview_upload_image", $_POST['ml_preview_upload_image']);
     }
     if (isset($_POST['ml_preview_theme_color'])) {
         update_option("ml_preview_theme_color", $_POST['ml_preview_theme_color']);
         if ($_POST['ml_preview_theme_color'] != get_option('ml_preview_theme_color')) {
             ml_track_mixpanel('menubar_color_change');
         }
     }
     if (isset($_POST['ml_preview_os'])) {
         update_option("ml_preview_os", $_POST['ml_preview_os']);
     }
     if (isset($_POST['ml_article_list_view_type'])) {
         Mobiloud::set_option('ml_article_list_view_type', sanitize_text_field($_POST['ml_article_list_view_type']));
     }
     if (isset($_POST['ml_datetype'])) {
         Mobiloud::set_option('ml_datetype', sanitize_text_field($_POST['ml_datetype']));
     }
     if (isset($_POST['ml_dateformat'])) {
         Mobiloud::set_option('ml_dateformat', sanitize_text_field($_POST['ml_dateformat']));
     }
 }
Exemple #2
0
function ml_pb_post_published_notification($new_status, $old_status, $post)
{
    if (ml_is_notified($post->ID) || !ml_check_post_notification_required($post->ID)) {
        return;
    }
    $push_types = Mobiloud::get_option("ml_push_post_types", "post");
    if (strlen($push_types) > 0) {
        $push_types = explode(",", $push_types);
        if ($new_status == 'publish' && $old_status != 'publish' && in_array($post->post_type, $push_types)) {
            // only send push if it's a new publish
            $payload = array('post_id' => strval($post->ID));
            $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
            if (is_array($image)) {
                $payload['featured_image'] = $image[0];
            }
            $tags = ml_get_post_tag_ids($post->ID);
            $tags[] = 'all';
            $tagNames = ml_get_post_tags($post->ID);
            $tagNames[] = 'all';
            $data = array('platform' => array(0, 1), 'msg' => strip_tags(trim($post->post_title)), 'sound' => 'default', 'badge' => null, 'notags' => true, 'tags' => $tags, 'payload' => $payload, "chunk" => 1000, "rate" => 120);
            ml_pb_send_batch_notification($data, $tagNames);
        }
    }
}
    echo esc_attr($editor_key);
    ?>
'><?php 
    echo stripslashes(htmlspecialchars(Mobiloud::get_option($editor_key, '')));
    ?>
</textarea>
            <?php 
}
?>
            
            <h4>Preview the results</h4>
            <p>Select a post or page to preview the results of your edits.</p>
            <select id="preview_popup_post_select">
                <?php 
$posts_query = array(base64_decode('cG9zdHNfcGVyX3BhZ2U=') => 10, base64_decode('b3JkZXJieQ==') => base64_decode('cG9zdF9kYXRl'), base64_decode('b3JkZXI=') => base64_decode('REVTQw=='), base64_decode('cG9zdF90eXBl'));
$included_post_types = explode(base64_decode('LA=='), Mobiloud::get_option(base64_decode('bWxfYXJ0aWNsZV9saXN0X2luY2x1ZGVfcG9zdF90eXBlcw=='), array()));
foreach ($included_post_types as $post_type) {
    $posts_query[base64_decode('cG9zdF90eXBl')] = $post_type;
    $posts = get_posts($posts_query);
    if (count($posts) > 0) {
        ?>
                    
                        <optgroup label="<?php 
        echo ucfirst($post_type);
        ?>
">
                        <?php 
        foreach ($posts as $post) {
            ?>

                        <option value="<?php 
/>
                            <label for="postypes_<?php 
        echo esc_attr($v);
        ?>
"><?php 
        echo esc_html($v);
        ?>
</label>
                        </div>
                        <?php 
    }
}
?>
            </div>
        </div>
        <h4>Security settings (advanced)</h4>
        <div class='ml-col-row'>
            <div class='ml-col-half'>
                <p>Choose whether to use SSL to communicate with our push service.</p>            
            </div>
            <div class="ml-form-row ml-checkbox-wrap no-margin">
                <input type="checkbox" id="ml_pb_use_ssl" name="ml_pb_use_ssl" value="true" <?php 
echo Mobiloud::get_option('ml_pb_use_ssl') ? 'checked' : '';
?>
/>
                <label for="ml_pb_use_ssl">Enable SSL for push notifications</label>
            </div>
        </div>
        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    </form>
</div>
<div id="ml_settings_membership" class="tabs-panel ml-compact">
    <form method="post" action="<?php 
echo admin_url('admin.php?page=mobiloud_settings&tab=membership');
?>
">
        <?php 
wp_nonce_field('form-settings_membership');
?>
        <h3>Membership</h3>
        <div class='ml-col-twothirds'>
            <p>MobiLoud can integrate with a number of WordPress membership plugins and require your users to authenticate to access the contents of your app.</p>
			<p>Don't see your membership plugin here? <a class="ml-intercom" href="#">Contact us</a> for more information.</p>
            <div class="ml-form-row ml-checkbox-wrap">
                <input type="checkbox" id="ml_subscriptions_enable" name="ml_subscriptions_enable" value="true" <?php 
echo Mobiloud::get_option('ml_subscriptions_enable') ? 'checked' : '';
?>
/>
                <label for="ml_subscriptions_enable">Enable <a target="_blank" href="https://wordpress.org/plugins/groups/">WP-Groups</a> subscriptions</label>
            </div>
        </div>        
        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    </form>
</div>
<div id="ml_push_notifications" class="tabs-panel ml-compact">
    <?php 
if (strlen(Mobiloud::get_option('ml_pb_app_id')) <= 0 && strlen(Mobiloud::get_option('ml_pb_secret_key')) <= 0) {
    ?>
    <div id="ml_admin_push" style="padding-top:30px">

		<p>This page will be accessible once you have <a target='_blank' href="http://www.mobiloud.com/publish/?utm_source=wp-plugin-admin&utm_medium=web&utm_campaign=plugin-admin-push">purchased your app</a> and <a href="./admin.php?page=mobiloud_settings&tab=license">entered a valid license key</a>. Note notifications cannot be tested using the preview app, as they will only be available once your app is published.
			
		<br/><br/>
		
		 You'll be able to send manual push notification messages to your users, attaching posts and pages to every message. You'll also find here a convenient log of all messages previously sent.</p>
 		
		<p>Any questions on push notifications? <a class="ml-intercom" href="mailto:h89uu5zu@incoming.intercom.io">Ask us anything</a>.</p>
		 
			
    </div>
    <?php 
} else {
    ?>
    <form method="post" action="<?php 
    echo admin_url('admin.php?page=mobiloud_push&tab=notifications');
    ?>
">
        <?php 
    wp_nonce_field('form-push_notifications');
    ?>
        <h3>Send manual message</h3>
        <div id="success-message" class="updated" style="display: none;">Your message has been sent!</div>
        <?php 
    ml_push_notification_manual_send();
    ?>
                </td>
            </tr>
            <tr valign="top">
                <th scope="row">Your email</th>
                <td>
                    <input size="36" type="email" id="ml-user-email" name="email" placeholder="Enter your email" value='<?php 
echo Mobiloud::get_option('ml_user_email', $current_user->user_email);
?>
' required>
                </td>
            </tr>
            <tr valign="top">
                <th scope="row">Your website</th>
                <td>
                    <input size="36" type="text" id="ml-user-site" name="website" placeholder="Enter your website" value='<?php 
echo Mobiloud::get_option('ml_site_url', get_site_url());
?>
'>
                </td>
            </tr>
			
            <tr valign="top" id="form-apptype">
                <td colspan="2">
	                <h3>What kind of app would you like to build?</h3>
					<input type="radio" id="radio_apptype_news" class="radio_apptype" name="apptype" value="news" checked>A News or Blog app
					<input type="radio" id="radio_apptype_other" class="radio_apptype" name="apptype" value="other">Something else
                </td>
            </tr>
			
			
			<tr valign="top" id="select-sitetype">
?>
        <h3>Facebook Analytics for Apps</h3>
        <p>Facebook Analytics for Apps gives you the ability to learn about the types of people using your app, how they got there, and what they’re doing in the app.</p>
        <p>Read more <a target="_blank" href="https://developers.facebook.com/docs/analytics/overview">about Facebook Analytics</a> and <a target="_blank" href="https://developers.facebook.com/docs/apps/register">Configure your App ID.</a></p>
        <table class="form-table">
            <tbody>
            <tr valign="top">
                <th scope="row">Facebook App ID</th>
                <td>
                    <input size="36" type="text" id="ml_fb_app_id" name="ml_fb_app_id" placeholder="XXXXXXXXXXXXXXX" value='<?php 
echo Mobiloud::get_option('ml_fb_app_id');
?>
'>
                </td>
            </tr>
            </tbody>
        </table>

        <?php 
if (strlen(Mobiloud::get_option('ml_pb_app_id')) > 0 && Mobiloud::get_option('ml_pb_app_id') < "543e7b3f1d0ab16d148b4599") {
    ?>
            <div class='update-nag'>
                <p> The settings above are only available for recently published apps.</p>
                <p> Your app was built wih a pre-configured Analytics ID, get in touch at <a href='mailto:support@mobiloud.com'>support@mobiloud.com</a> to know more.</p>
            </div>
        <?php 
}
?>
        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    </form>
</div>
?utm_source=wp-plugin-admin&utm_medium=web&utm_campaign=license_page">signed up</a> for one of our plans and your app has been published, enter here the License keys we have sent you.</p>
			
             <table class="form-table">
                <tbody>
                    <tr valign="top">
                        <th scope="row">License Key</th>
                        <td>
                            <input size="36" type="text" id="ml_pb_app_id" name="ml_pb_app_id" placeholder="Enter License Key" value='<?php 
echo Mobiloud::get_option('ml_pb_app_id');
?>
'>
                        </td>
                    </tr>
                    <tr valign="top">
                        <th scope="row">Secret Key</th>
                        <td>
                            <input size="36" type="text" id="ml_pb_secret_key" name="ml_pb_secret_key" placeholder="Enter Secret Key" value='<?php 
echo Mobiloud::get_option('ml_pb_secret_key');
?>
'>
                        </td>
                    </tr>
                </tbody>
             </table>
			 
			<p>Can't find your license keys? <a class="ml-intercom" href="#">Request your keys</a> from our support team.</p>

        </div>       
        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    </form>
</div>
Exemple #10
0
function ml_init_intercom()
{
    //var_dump($user);exit;
    if (is_admin() && current_user_can('administrator') && Mobiloud::get_option('ml_initial_details_saved') && ml_using_mobiloud()) {
        $user_email = Mobiloud::get_option('ml_user_email');
        $user_name = Mobiloud::get_option('ml_user_name');
        $user_site = Mobiloud::get_option('ml_user_site');
        $user_apptype = Mobiloud::get_option('ml_user_apptype');
        $user_sitetype = Mobiloud::get_option('ml_user_sitetype');
        ?>
            <script id="IntercomSettingsScriptTag">
              window.intercomSettings = {
                email: "<?php 
        echo esc_js($user_email);
        ?>
",
                name: "<?php 
        echo esc_js($user_name);
        ?>
",
                site: "<?php 
        echo esc_js($user_site);
        ?>
",
                sitetype: "<?php 
        echo esc_js($user_sitetype);
        ?>
",
				installurl: "<?php 
        echo get_site_url();
        ?>
",              
                sitename: "<?php 
        echo get_bloginfo('name');
        ?>
",
                pb_key: "<?php 
        echo Mobiloud::get_option('ml_pb_app_id');
        ?>
",
                version: "<?php 
        echo MOBILOUD_PLUGIN_VERSION;
        ?>
",
				post_count: "<?php 
        echo wp_count_posts()->publish;
        ?>
",
				app_type: "<?php 
        echo esc_js($user_apptype);
        ?>
",
				homepage_type: "<?php 
        echo get_option('show_on_front ');
        ?>
",
                app_id: "h89uu5zu",
                user_id: "<?php 
        echo esc_js($user_email);
        ?>
",
                user_hash: "<?php 
        echo hash_hmac("sha256", $user_email, "2d8ReoNHhovD4NhWCb72DgrghadvKVwGJsR0t6YR");
        ?>
",
                haswoocommerce:<?php 
        echo is_plugin_active('woocommerce/woocommerce.php') || class_exists('Woocommerce') ? '"yes"' : '"no"';
        ?>
,
                hasbuddypress:<?php 
        echo is_plugin_active('buddypress/bp-loader.php') || class_exists('BuddyPress') ? '"yes"' : '"no"';
        ?>
,
              };
            </script>
			<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/h89uu5zu';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
        <?php 
    }
}
        <table class="form-table">
            <tbody>
            <tr valign="top">
                <th scope="row">Facebook App ID</th>
                <td>
                    <input size="36" type="text" id="ml_fb_app_id" name="ml_fb_app_id" placeholder="XXXXXXXXXXXXXXX" value='<?php 
echo Mobiloud::get_option(base64_decode('bWxfZmJfYXBwX2lk'));
?>
'>
                </td>
            </tr>
            </tbody>
        </table>

        <?php 
if (strlen(Mobiloud::get_option(base64_decode('bWxfcGJfYXBwX2lk'))) > 0 && Mobiloud::get_option(base64_decode('bWxfcGJfYXBwX2lk')) < base64_decode('NTQzZTdiM2YxZDBhYjE2ZDE0OGI0NTk5')) {
    ?>
            <div class='update-nag'>
                <p> The settings above are only available for recently published apps.</p>
                <p> Your app was built wih a pre-configured Analytics ID, get in touch at <a href='mailto:support@mobiloud.com'>support@mobiloud.com</a> to know more.</p>
            </div>
        <?php 
}
?>

        <h3>Other Analytics tools</h3>
        Beyond Google Analytics, our developers can setup other Analytics solutions for your app, for more information,
        contact <a href="mailto:support@mobiloud.com">support@mobiloud.com</a>.
        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    </form>
</div>
<div id="get_started_menu_config" class="tabs-panel">
    <h3>Test your app in the simulator</h3>
    <p>
	   Test-drive your app in the simulator before signing up and publishing it.
    </p>
	
    <?php 
$user_email = Mobiloud::get_option('ml_user_email');
$user_name = Mobiloud::get_option('ml_user_name');
$user_site = Mobiloud::get_option('ml_user_site');
$plugin_url = Mobiloud::get_plugin_url();
$plugin_version = MOBILOUD_PLUGIN_VERSION;
$http_prefix = 'http';
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
    $http_prefix = 'https';
}
?>
    <?php 
add_thickbox();
?>
    <a href="<?php 
echo $http_prefix;
?>
://www.mobiloud.com/simulator/?name=<?php 
echo urlencode(esc_attr($user_name));
?>
&email=<?php 
echo urlencode(esc_attr($user_email));
?>
&site=<?php 
echo urlencode(esc_url($user_site));
Exemple #13
0
/**
 * Generate posts array
 *
 * @param $posts
 * @param $offset
 * @param $taxonomy
 * @param $eager_loading
 * @param $post_type
 * @param $final_posts
 *
 * @return mixed
 */
function get_final_posts($posts, $offset, $taxonomy, $eager_loading, $final_posts)
{
    foreach ($posts as $post) {
        $final_post = array();
        $post_id = $post->ID;
        $key = http_build_query(array('post_id' => "{$post_id}", "type" => "ml_post"));
        $cache = get_cache('ml_post', $key);
        if (!empty($cache)) {
            $final_posts["posts"][] = unserialize($cache);
            continue;
        }
        $final_post["post_id"] = "{$post_id}";
        $final_post["post_type"] = $post->post_type;
        $final_post["author"] = array();
        $final_post["categories"] = array();
        $final_post["author"]["name"] = html_entity_decode(get_author_name($post->post_author));
        $final_post["author"]["author_id"] = $post->post_author;
        $final_post["title"] = strip_tags($post->post_title);
        $final_post["title"] = html_entity_decode($final_post["title"], ENT_QUOTES);
        $final_post["videos"] = array();
        $final_post["images"] = array();
        if ($offset > 0 && is_sticky($post_id)) {
            continue;
        }
        /** comments
            ========================================================================
             **/
        $images = get_children(array('post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image'));
        $comments_count = wp_count_comments($post_id);
        $final_post["comments-count"] = 0;
        if ($comments_count) {
            $final_post["comments-count"] = intval($comments_count->approved);
        }
        /** permalink
            ========================================================================
             **/
        $final_post["permalink"] = get_permalink($post_id);
        if (strlen(trim(get_option('ml_custom_field_url', ''))) > 0) {
            $custom_url_value = get_post_meta($post->ID, get_option('ml_custom_field_url'), true);
            if (strlen(trim($custom_url_value)) > 0) {
                $final_post["permalink"] = $custom_url_value;
            }
        }
        /** categories
            ========================================================================
             **/
        $categories = get_the_category($post_id);
        foreach ($categories as $category) {
            $final_post["categories"][] = array("cat_id" => "{$category->cat_ID}", "name" => $category->cat_name, "slug" => $category->category_nicename);
        }
        if ($taxonomy !== 'category' && !empty($taxonomy)) {
            $terms = wp_get_post_terms($post_id, $taxonomy);
            foreach ($terms as $term) {
                $final_post["categories"][] = array("cat_id" => "{$term->term_id}", "name" => $term->name, "slug" => $term->slug);
            }
        }
        /** date
            ========================================================================
             **/
        $final_post["date"] = $post->post_date;
        if (get_option('ml_datetype', 'prettydate') == 'datetime') {
            $final_post["date_display"] = date_i18n(get_option('ml_dateformat', 'F j, Y'), strtotime($post->post_date), get_option('gmt_offset'));
        }
        /** media
            ========================================================================
             **/
        try {
            $video_id = get_the_first_youtube_id($post);
        } catch (Exception $e) {
        }
        try {
            //featured image
            $main_image_url = get_the_first_image($post);
        } catch (Exception $e) {
            //error getting or resizing the images
        }
        if ($video_id != null) {
            $final_post["videos"][] = $video_id;
        }
        if ($main_image_url != null) {
            $image = array("full" => $main_image_url, "thumb" => array("url" => $main_image_url), "big-thumb" => array("url" => $main_image_url));
            $final_post["images"][0] = $image;
        }
        if (strlen(get_option('ml_custom_featured_image')) > 0 && class_exists('MultiPostThumbnails')) {
            $customImageUrl = MultiPostThumbnails::get_post_thumbnail_url(get_post_type($post->ID), Mobiloud::get_option('ml_custom_featured_image'), $post->ID, 'large');
            if ($customImageUrl !== false) {
                $final_post["images"][0] = array("full" => $customImageUrl, "thumb" => array("url" => $customImageUrl), "big-thumb" => array("url" => $customImageUrl));
            }
        }
        foreach ((array) $images as $image) {
            $imageToAdd = array();
            $imageToAdd["full"] = wp_get_attachment_image_src($image->ID, 'full');
            $imageToAdd["thumb"] = wp_get_attachment_image_src($image->ID, 'thumbnail');
            $imageToAdd["imageId"] = $image->ID;
            $final_post["images"][] = $imageToAdd;
        }
        /** Content
            ========================================================================
             **/
        //capturing the html output generated
        ob_start();
        include "post/post.php";
        $html_content = ob_get_clean();
        //replace relative URLs with absolute
        $html_content = preg_replace("#(<\\s*a\\s+[^>]*href\\s*=\\s*[\"'])(?!http|/)([^\"'>]+)([\"'>]+)#", '$1' . $final_post["permalink"] . '/$2$3', $html_content);
        $final_post["content"] = $html_content;
        /** Sticky
            ========================================================================
             **/
        //sticky ?
        $final_post["sticky"] = is_sticky($post->ID) || $post->sticky;
        /** Custom field
            ========================================================================
             **/
        if (strlen(get_option('ml_custom_field_name', '')) > 0) {
            if (get_option('ml_custom_field_name', '') == "excerpt") {
                $custom_field_val = html_entity_decode(urldecode(strip_tags(get_post_excerpt($post->ID))));
                $final_post['custom1'] = $custom_field_val;
            } else {
                $custom_field_val = get_post_meta($post->ID, get_option('ml_custom_field_name', ''), true);
                $final_post['custom1'] = $custom_field_val;
            }
        }
        //excerpt
        $final_post['excerpt'] = html_entity_decode(urldecode(strip_tags(get_post_excerpt($post->ID))));
        $final_post['excerpt'] = str_replace('Read More', '', $final_post['excerpt']);
        if (get_post_format($post) == 'status') {
            $final_post["title"] = $post->post_content;
            $final_post["content"] = "";
            $final_post['custom1'] = "";
            $final_post['excerpt'] = "";
        }
        set_cache('ml_post', $key, serialize($final_post));
        $final_posts["posts"][] = $final_post;
    }
    return $final_posts;
}
<div id="ml_settings_membership" class="tabs-panel ml-compact">
    <form method="post" action="<?php 
echo admin_url(base64_decode('YWRtaW4ucGhwP3BhZ2U9bW9iaWxvdWRfc2V0dGluZ3MmdGFiPW1lbWJlcnNoaXA='));
?>
">
        <?php 
wp_nonce_field(base64_decode('Zm9ybS1zZXR0aW5nc19tZW1iZXJzaGlw'));
?>
        <h3>Membership</h3>
        <div class='ml-col-twothirds'>
            <p>Mobiloud can integrate with a number of WordPress membership plugins and require your users to authenticate to access the contents of your app.</p>
			<p>Don't see your membership plugin here? <a class="ml-intercom" href="mailto:h89uu5zu@incoming.intercom.io">Contact our developers</a> for help.</p>
            <div class="ml-form-row ml-checkbox-wrap">
                <input type="checkbox" id="ml_subscriptions_enable" name="ml_subscriptions_enable" value="true" <?php 
echo Mobiloud::get_option(base64_decode('bWxfc3Vic2NyaXB0aW9uc19lbmFibGU=')) ? base64_decode('Y2hlY2tlZA==') : '';
?>
/>
                <label for="ml_subscriptions_enable">Enable <a target="_blank" href="https://wordpress.org/plugins/groups/">WP-Groups</a> subscriptions</label>
            </div>
        </div>        
        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    </form>
</div>
<div id="get_started_menu_config" class="tabs-panel">
    <h3>Test your app in the Live Preview</h3>
    <p>
	   Test-drive your app in the Live Preview simulator before signing up and publishing it.
    </p>
	
    <?php 
$user_email = Mobiloud::get_option('ml_user_email');
$user_name = Mobiloud::get_option('ml_user_name');
$user_site = Mobiloud::get_option('ml_user_site');
$plugin_url = plugins_url();
$plugin_version = MOBILOUD_PLUGIN_VERSION;
$http_prefix = 'http';
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
    $http_prefix = 'https';
}
?>
    <?php 
add_thickbox();
?>
    <a href="<?php 
echo $http_prefix;
?>
://www.mobiloud.com/simulator/?name=<?php 
echo urlencode(esc_attr($user_name));
?>
&email=<?php 
echo urlencode(esc_attr($user_email));
?>
&site=<?php 
echo urlencode(esc_url($user_site));
 public static function set_default_options()
 {
     if (Mobiloud::get_option('ml_article_list_include_post_types', 'none') == 'none') {
         Mobiloud::set_option('ml_article_list_include_post_types', 'post');
     }
     if (Mobiloud::get_option('ml_custom_featured_image', 'none') == 'none') {
         Mobiloud::set_option('ml_custom_featured_image', '');
     }
     if (Mobiloud::get_option('ml_menu_show_favorites', 'none') == 'none') {
         Mobiloud::set_option('ml_menu_show_favorites', true);
     }
     if (Mobiloud::get_option('ml_show_android_cat_tabs', 'none') == 'none') {
         Mobiloud::set_option('ml_show_android_cat_tabs', true);
     }
     if (Mobiloud::get_option('ml_article_list_enable_dates', 'none') == 'none') {
         Mobiloud::set_option('ml_article_list_enable_dates', true);
     }
     if (Mobiloud::get_option('ml_show_article_featuredimage', 'none') == 'none') {
         Mobiloud::set_option('ml_show_article_featuredimage', true);
     }
     if (Mobiloud::get_option('ml_post_author_enabled', 'none') == 'none') {
         Mobiloud::set_option('ml_post_author_enabled', true);
     }
     if (Mobiloud::get_option('ml_page_author_enabled', 'none') == 'none') {
         Mobiloud::set_option('ml_page_author_enabled', false);
     }
     if (Mobiloud::get_option('ml_followimagelinks', 'none') == 'none') {
         Mobiloud::set_option('ml_followimagelinks', 0);
     }
     if (Mobiloud::get_option('ml_post_date_enabled', 'none') == 'none') {
         Mobiloud::set_option('ml_post_date_enabled', true);
     }
     if (Mobiloud::get_option('ml_page_date_enabled', 'none') == 'none') {
         Mobiloud::set_option('ml_page_date_enabled', false);
     }
     if (Mobiloud::get_option('ml_post_title_enabled', 'none') == 'none') {
         Mobiloud::set_option('ml_post_title_enabled', true);
     }
     if (Mobiloud::get_option('ml_page_title_enabled', 'none') == 'none') {
         Mobiloud::set_option('ml_page_title_enabled', true);
     }
     $lang = get_bloginfo('language');
     if (Mobiloud::get_option('ml_rtl_text_enable', 'none') == 'none' && (is_rtl() || $lang == 'ar' || $lang == 'he-IL')) {
         Mobiloud::set_option('ml_rtl_text_enable', true);
     }
     if (Mobiloud::get_option('ml_article_list_view_type', 'none') == 'none') {
         Mobiloud::set_option('ml_article_list_view_type', 'extended');
     }
     if (Mobiloud::get_option('ml_datetype', 'none') == 'none') {
         Mobiloud::set_option('ml_datetype', 'prettydate');
     }
     if (Mobiloud::get_option('ml_dateformat', 'none') == 'none') {
         Mobiloud::set_option('ml_dateformat', 'F j, Y');
     }
     if (Mobiloud::get_option('ml_show_email_contact_link', 'none') == 'none') {
         Mobiloud::set_option('ml_show_email_contact_link', true);
     }
     if (Mobiloud::get_option('ml_contact_link_email', 'none') == 'none') {
         Mobiloud::set_option('ml_contact_link_email', get_bloginfo('admin_email'));
     }
     if (Mobiloud::get_option('ml_copyright_string', 'none') == 'none') {
         Mobiloud::set_option('ml_copyright_string', '&copy; ' . date('Y') . ' ' . get_bloginfo('name'));
     }
     if (Mobiloud::get_option('ml_comments_system', 'none') == 'none' || Mobiloud::get_option('ml_comments_system', 'none') == '') {
         Mobiloud::set_option('ml_comments_system', 'wordpress');
     }
 }
                </div>
            </div>
        </div>
		
        <h4>Custom field in article list</h4>
        <div class='ml-col-row'>
            <div class='ml-col-half'>
                <p>Your app's article list can show data from a Custom Field (e.g. author, price, source) defined in your posts.</p>            
            </div>
            <div class='ml-col-half'>
                <div class="ml-form-row ml-checkbox-wrap">
                    <input type="checkbox" id="ml_custom_field_enable" name="ml_custom_field_enable" value="true" <?php 
echo Mobiloud::get_option('ml_custom_field_enable') ? 'checked' : '';
?>
/>
                    <label for="ml_custom_field_enable">Show custom field in article list</label>
                </div>
                <div class="ml-form-row ml-left-align clearfix">
                    <label class='ml-width-120' for="ml_custom_field_name">Field Name</label>
                    <input type="text" placeholder="Custom Field Name" id="ml_custom_field_name" name="ml_custom_field_name" value="<?php 
echo esc_attr(Mobiloud::get_option('ml_custom_field_name'));
?>
"/>
                </div>
            </div>
        </div>
		
		
        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    </form>
</div>
        </div>
        <div class='ml-preview-article-list <?php 
echo get_option('ml_article_list_view_type', 'extended') == 'extended' ? 'ml-view-extended' : 'ml-view-compact';
?>
'>
            <div class='scroller'>
                <?php 
$posts = Mobiloud_App_Preview::get_preview_posts();
if (count($posts) > 0) {
    foreach ($posts as $post) {
        $imageUrl = null;
        if (has_post_thumbnail($post->ID)) {
            $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
            $imageUrl = $image[0];
            if (strlen(Mobiloud::get_option('ml_custom_featured_image')) > 0 && class_exists('MultiPostThumbnails')) {
                $customImageUrl = MultiPostThumbnails::get_post_thumbnail_url(get_post_type($post->ID), Mobiloud::get_option('ml_custom_featured_image'), $post->ID);
                if ($customImageUrl !== false) {
                    $imageUrl = $customImageUrl;
                }
            }
        }
        ?>
                        <div class='ml-preview-article'>
                            <?php 
        if ($imageUrl) {
            ?>
                                <div class="ml-post-img-wrapper">
                                    <img class='ml-preview-img' src='<?php 
            echo $imageUrl;
            ?>
'/>   
                </div>
            </div>
        </div>
		
        <h4>Custom field in article list</h4>
        <div class='ml-col-row'>
            <div class='ml-col-half'>
                <p>Your app's article list can show data from a Custom Field (e.g. author, price, source) defined in your posts.</p>            
            </div>
            <div class='ml-col-half'>
                <div class="ml-form-row ml-checkbox-wrap">
                    <input type="checkbox" id="ml_custom_field_enable" name="ml_custom_field_enable" value="true" <?php 
echo Mobiloud::get_option(base64_decode('bWxfY3VzdG9tX2ZpZWxkX2VuYWJsZQ==')) ? base64_decode('Y2hlY2tlZA==') : '';
?>
/>
                    <label for="ml_custom_field_enable">Show custom field in article list</label>
                </div>
                <div class="ml-form-row ml-left-align clearfix">
                    <label class='ml-width-120' for="ml_custom_field_name">Field Name</label>
                    <input type="text" placeholder="Custom Field Name" id="ml_custom_field_name" name="ml_custom_field_name" value="<?php 
echo esc_attr(Mobiloud::get_option(base64_decode('bWxfY3VzdG9tX2ZpZWxkX25hbWU=')));
?>
"/>
                </div>
            </div>
        </div>
		
		
        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    </form>
</div>
            </div>
			
			<p class="description">We recommend showing a list of your articles on your home screen. If you'd like to show a page from your mobile or responsive site within the app's home screen, enter its full URL in the field above.</p>
			
            <div class="ml-form-row ml-home-screen-label">
                <label>Articles Menu Item</label>
                <p>Enter the label you'd like to use for the 'Articles' menu item, letting users list your articles.</p>
                <div class="ml-form-row ml-checkbox-wrap">
                    <input type="checkbox" id="ml_show_article_list_menu_item" name="ml_show_article_list_menu_item" value="true" <?php 
echo Mobiloud::get_option('ml_show_article_list_menu_item') ? 'checked' : '';
?>
/>
                    <label for="ml_show_article_list_menu_item">Show 'Article' list menu item</label>
                </div>
                <input type='text' id='ml_article_list_menu_item_title' name='ml_article_list_menu_item_title' value='<?php 
echo Mobiloud::get_option('ml_article_list_menu_item_title', 'Articles');
?>
'/>
            </div>
            <div class="ml-form-row">
                <label>Article List Style</label>
                <div class="ml-radio-wrap">
                    <input type="radio" id="ml_article_list_view_type_extended" name="ml_article_list_view_type" value="extended" <?php 
echo get_option('ml_article_list_view_type', 'extended') == 'extended' ? 'checked' : '';
?>
/>
                    <label for="ml_article_list_view_type_extended">Extended (large thumbnails)</label>
                </div>
                <div class="ml-radio-wrap">
                    <input type="radio" id="ml_article_list_view_type_compact" name="ml_article_list_view_type" value="compact" <?php 
echo get_option('ml_article_list_view_type') == 'compact' ? 'checked' : '';
function ml_init_getvero()
{
    if (is_admin() && current_user_can(base64_decode('YWRtaW5pc3RyYXRvcg==')) && Mobiloud::get_option(base64_decode('bWxfaW5pdGlhbF9kZXRhaWxzX3NhdmVk')) && ml_using_mobiloud()) {
        $user_email = Mobiloud::get_option(base64_decode('bWxfdXNlcl9lbWFpbA=='));
        $user_name = Mobiloud::get_option(base64_decode('bWxfdXNlcl9uYW1l'));
        $user_site = Mobiloud::get_option(base64_decode('bWxfdXNlcl9zaXRl'));
        ?>
        <script type="text/javascript">
            var _veroq = _veroq || [];

            _veroq.push(['init', {
              api_key: '36bd54bf9afde30628102337cf6dc4306a6a212a',
              development_mode: false 
              // Turn this off when you decide to 'go live'.
            } ]);

            _veroq.push(['user', {
                id: "<?php 
        echo esc_js($user_email);
        ?>
", 
                email: "<?php 
        echo esc_js($user_email);
        ?>
", 
                name: "<?php 
        echo esc_js($user_name);
        ?>
",
                website: "<?php 
        echo esc_js($user_site);
        ?>
",
				installurl: "<?php 
        echo get_site_url();
        ?>
",              
                website_name: "<?php 
        echo get_bloginfo(base64_decode('bmFtZQ=='));
        ?>
",
				post_count: "<?php 
        echo wp_count_posts()->publish;
        ?>
",
				homepage_type: "<?php 
        echo get_option(base64_decode('c2hvd19vbl9mcm9udCA='));
        ?>
",
                sitename: "<?php 
        echo get_bloginfo(base64_decode('bmFtZQ=='));
        ?>
",
                version: "<?php 
        echo MOBILOUD_PLUGIN_VERSION;
        ?>
",
                user_lever: 'administrator',
                version: "<?php 
        echo MOBILOUD_PLUGIN_VERSION;
        ?>
",
              }]);

            (function() {var ve = document.createElement('script'); ve.type = 'text/javascript'; ve.async = true; ve.src = '//getvero.com/assets/m.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ve, s);})();

        </script>
        <?php 
    }
}
Exemple #22
0
//advertising
$return_config['advertising_platform'] = Mobiloud::get_option('ml_advertising_platform');
$return_config['ios_phone_banner_unit_id'] = Mobiloud::get_option('ml_ios_phone_banner_unit_id');
$return_config['ios_tablet_banner_unit_id'] = Mobiloud::get_option('ml_ios_tablet_banner_unit_id');
$return_config['ios_banner_position'] = Mobiloud::get_option('ml_ios_banner_position');
$return_config['ios_interstitial_unit_id'] = Mobiloud::get_option('ml_ios_interstitial_unit_id');
$return_config['ios_interstitial_interval'] = Mobiloud::get_option('ml_ios_interstitial_interval');
$return_config['ios_native_ad_unit_id'] = Mobiloud::get_option('ml_ios_native_ad_unit_id');
$return_config['ios_native_ad_interval'] = Mobiloud::get_option('ml_ios_native_ad_interval');
$return_config['android_phone_banner_unit_id'] = Mobiloud::get_option('ml_android_phone_banner_unit_id');
$return_config['android_tablet_banner_unit_id'] = Mobiloud::get_option('ml_android_tablet_banner_unit_id');
$return_config['android_banner_position'] = Mobiloud::get_option('ml_android_banner_position');
$return_config['android_interstitial_unit_id'] = Mobiloud::get_option('ml_android_interstitial_unit_id');
$return_config['android_interstitial_interval'] = Mobiloud::get_option('ml_android_interstitial_interval');
$return_config['android_native_ad_unit_id'] = Mobiloud::get_option('ml_android_native_ad_unit_id');
$return_config['android_native_ad_interval'] = Mobiloud::get_option('ml_android_native_ad_interval');
$return_config["enable_hierarchical_pages"] = get_option('ml_hierarchical_pages_enabled', false);
$return_config["show_favorites"] = get_option('ml_menu_show_favorites', true);
$return_config["followimagelinks"] = get_option('ml_followimagelinks', 1);
$return_config['interface_images_updated'] = date('c', get_option('ml_preview_upload_image_time'));
$return_config['interface_images'] = array('navigation_bar_logo' => get_option("ml_preview_upload_image"));
$navigation_bar_text = '#000000';
if (Mobiloud_App_Preview::get_color_brightness(get_option('ml_preview_theme_color')) < 190) {
    $navigation_bar_text = '#FFFFFF';
}
$return_config['interface_colors'] = array('navigation_bar_background' => get_option('ml_preview_theme_color'), 'navigation_bar_text' => $navigation_bar_text, 'navigation_bar_button_text' => $navigation_bar_text);
if (!empty($return_config)) {
    foreach ($return_config as $key => $val) {
        if ($val === null) {
            $return_config[$key] = '';
        }
    echo esc_attr($position_key);
    ?>
'><?php 
    echo stripslashes(htmlspecialchars(Mobiloud::get_option($position_key, '')));
    ?>
</textarea>
            <?php 
}
?>
            
            <h4>Preview the results</h4>
            <p>Select a post or page to preview the results of your edits.</p>
            <select id="preview_popup_post_select">
                <?php 
$posts_query = array('posts_per_page' => 10, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type');
$included_post_types = explode(",", Mobiloud::get_option('ml_article_list_include_post_types', array()));
foreach ($included_post_types as $post_type) {
    $posts_query['post_type'] = $post_type;
    $posts = get_posts($posts_query);
    if (count($posts) > 0) {
        ?>
                    
                        <optgroup label="<?php 
        echo ucfirst($post_type);
        ?>
">
                        <?php 
        foreach ($posts as $post) {
            ?>

                        <option value="<?php 
                        <?php 
}
?>
                </ul>
            </div>
        </div>
        <h3 class="ml-push-top">Menu Settings</h3>
        <div class='ml-col-row'>
            <div class="ml-col-half">
                <p>Customise your app menu by adjusting what it should display.</p>
            </div>
            <div class="ml-col-half">
                <div class="ml-form-row ml-checkbox-wrap">
                    <input type="checkbox" id="ml_menu_show_favorites" name="ml_menu_show_favorites" value="true" <?php 
echo Mobiloud::get_option('ml_menu_show_favorites') ? 'checked' : '';
?>
/>
                    <label for="ml_menu_show_favorites">Show Favourites in the app menu</label>
                </div>
                <div class="ml-form-row ml-checkbox-wrap no-margin">
                    <input type="checkbox" id="ml_show_android_cat_tabs" name="ml_show_android_cat_tabs" value="true" <?php 
echo Mobiloud::get_option('ml_show_android_cat_tabs') ? 'checked' : '';
?>
/>
                    <label for="ml_show_android_cat_tabs">Show categories tab menu at the top of the screen on Android</label>
                </div>
            </div>
        </div>
        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    </form>
</div>
    public static function track_user_event($event)
    {
        if (Mobiloud::get_option('ml_initial_details_saved')) {
            ml_track_mixpanel($event);
            ?>
            <script type='text/javascript'>
                Intercom("trackUserEvent", "<?php 
            echo esc_js($event);
            ?>
");
            </script>

            <?php 
        }
    }
">signed up</a> for one of our plans and your app has been published, enter here the License keys we have sent you.</p>
			
             <table class="form-table">
                <tbody>
                    <tr valign="top">
                        <th scope="row">License Key</th>
                        <td>
                            <input size="36" type="text" id="ml_pb_app_id" name="ml_pb_app_id" placeholder="Enter License Key" value='<?php 
echo Mobiloud::get_option(base64_decode('bWxfcGJfYXBwX2lk'));
?>
'>
                        </td>
                    </tr>
                    <tr valign="top">
                        <th scope="row">Secret Key</th>
                        <td>
                            <input size="36" type="text" id="ml_pb_secret_key" name="ml_pb_secret_key" placeholder="Enter Secret Key" value='<?php 
echo Mobiloud::get_option(base64_decode('bWxfcGJfc2VjcmV0X2tleQ=='));
?>
'>
                        </td>
                    </tr>
                </tbody>
             </table>
			 
			<p>Can't find your license keys? <a class="ml-intercom" href="mailto:h89uu5zu@incoming.intercom.io">Request your keys</a> from our support team.</p>

        </div>       
        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"></p>
    </form>
</div>