コード例 #1
0
ファイル: sidekick.php プロジェクト: aguidetta/americanfence
        function footer()
        {
            global $current_user;
            require_once 'libs/sk_config_data.php';
            $sk_config_data = new sk_config_data();
            $current_user = get_option('sk_track_data') ? wp_get_current_user() : null;
            $autostart_network_walkthrough_id = get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : null;
            $autostart_walkthrough_id = get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id;
            $theme = wp_get_theme();
            $installed_plugins = $sk_config_data->get_plugins();
            $file_editor_enabled = $sk_config_data->get_file_editor_enabled();
            $affiliate_id = $this->getAffiliateId();
            $sk_hide_composer_taskbar_button = false;
            if (get_option('sk_hide_composer_taskbar_button') || get_site_option('sk_hide_composer_taskbar_button')) {
                $sk_hide_composer_taskbar_button = true;
            }
            $sk_hide_config_taskbar_button = false;
            if (get_option('sk_hide_config_taskbar_button') || get_site_option('sk_hide_config_taskbar_button')) {
                $sk_hide_config_taskbar_button = true;
            }
            $sk_config = array("compatibilities" => array("comment_count" => $sk_config_data->get_comments(), "domain" => str_replace("http://", "", $_SERVER["SERVER_NAME"]), "installed_plugins" => isset($installed_plugins) ? $installed_plugins : array(), "installed_theme" => sanitize_title($theme->Name), "is_multisite" => is_multisite() ? true : false, "main_soft_version" => get_bloginfo("version"), "number_of_themes" => $sk_config_data->get_themes(), "page_for_posts" => intval(get_option('page_for_posts')), "page_on_front" => intval(get_option('page_on_front')), "plugin_count" => isset($installed_plugins) && is_array($installed_plugins) ? count($installed_plugins) : 0, "role" => $sk_config_data->get_user_role(), "show_on_front" => get_option('show_on_front'), "theme_version" => $theme->Version), "baseClientUrl" => site_url(), "base_url" => site_url(), "activation_id" => get_option("sk_activation_id") ? get_option("sk_activation_id") : '', "custom_class" => get_option("sk_custom_class") ? get_option("sk_custom_class") : '', "affiliate_id" => $affiliate_id, "user_email" => $current_user ? $current_user->user_email : '', "autostart_walkthrough_id" => $autostart_walkthrough_id ? $autostart_walkthrough_id : '', "disable_wts" => !isset($_POST['is_ms_admin']) || !$_POST['is_ms_admin'] ? $sk_config_data->get_disabled_wts() : array(), "disable_network_wts" => $sk_config_data->get_disabled_network_wts(), "hide_taskbar_composer_button" => $sk_hide_composer_taskbar_button, "hide_taskbar_config_button" => $sk_hide_config_taskbar_button, "show_login" => get_option('sk_just_activated') ? true : false, "embed_partner_id" => SK_EMBEDDED_PARTNER, "plugin_version" => '2.6.2', "site_url" => $sk_config_data->get_domain(), "domain" => str_replace("http://", "", $_SERVER["SERVER_NAME"]), "plugin_url" => admin_url("admin.php?page=sidekick"));
            if ($file_editor_enabled) {
                //
                $sk_config["compatibilities"]["file_editor_enabled"] = $file_editor_enabled;
            }
            $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'], $sk_config_data->get_post_types());
            $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'], $sk_config_data->get_taxonomies());
            $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'], $sk_config_data->get_user_data());
            $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'], $sk_config_data->get_post_statuses());
            $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'], $sk_config_data->get_post_types_and_statuses());
            $sk_config['compatibilities'] = array_merge($sk_config['compatibilities'], $sk_config_data->get_framework());
            $sk_config = apply_filters('sk_config', $sk_config);
            delete_option('sk_just_activated');
            ?>

			<!-- Old IE Not Supported -->
			<?php 
            if (!preg_match('/(?i)msie [6-8]/', $_SERVER['HTTP_USER_AGENT'])) {
                ?>

				<script type="text/preloaded" data-provider="sidekick">
					<?php 
                echo json_encode($sk_config);
                ?>
				</script>

				<script type="text/javascript">
					var sk_nonce_upgrade = '<?php 
                echo wp_create_nonce('sk_upgrade');
                ?>
'
				</script>

			<?php 
            }
            ?>

			<?php 
        }
コード例 #2
0
        function footer()
        {
            global $current_user;
            require_once 'libs/sk_config_data.php';
            $sk_config_data = new sk_config_data();
            $current_user = wp_get_current_user();
            $sk_just_activated = get_option('sk_just_activated');
            $sk_track_data = get_option('sk_track_data');
            $sk_composer_button = get_option('sk_composer_button');
            $activation_id = get_option("sk_activation_id") ? get_option("sk_activation_id") : '';
            $autostart_network_walkthrough_id = get_site_option('sk_autostart_walkthrough_id') ? get_site_option('sk_autostart_walkthrough_id') : 'null';
            $autostart_walkthrough_id = get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : $autostart_network_walkthrough_id;
            $custom_class = get_option("sk_custom_class") ? get_option("sk_custom_class") : '';
            $theme = wp_get_theme();
            $not_supported_ie = false;
            $user_email = '';
            if ($sk_track_data) {
                $user_email = $current_user->user_email;
            }
            $disabled_wts = !is_network_admin() ? $sk_config_data->get_disabled_wts() : '[]';
            $user_role = $sk_config_data->get_user_role();
            $site_url = $sk_config_data->get_domain();
            $installed_plugins = $sk_config_data->get_plugins();
            $plugin_count = isset($plugins) && is_array($plugins) ? count($plugins) : array();
            $disabled_network_wts = $sk_config_data->get_disabled_network_wts();
            $current_url = $sk_config_data->get_current_url();
            $post_types = $sk_config_data->get_post_types();
            $taxonomies = $sk_config_data->get_taxonomies();
            $user_data = $sk_config_data->get_user_data();
            $comments = $sk_config_data->get_comments();
            $post_statuses = $sk_config_data->get_post_statuses();
            $post_types_and_statuses = $sk_config_data->get_post_types_and_statuses();
            $number_of_themes = $sk_config_data->get_themes();
            $frameworks = $sk_config_data->get_framework();
            $file_editor_enabled = $sk_config_data->get_file_editor_enabled();
            delete_option('sk_just_activated');
            if (preg_match('/(?i)msie [6-8]/', $_SERVER['HTTP_USER_AGENT'])) {
                $not_supported_ie = true;
            }
            ?>


			<?php 
            if (!$not_supported_ie) {
                ?>

				<script type="text/javascript">

					<?php 
                if (is_network_admin()) {
                    ?>
var is_network_admin = true;		<?php 
                }
                ?>

					var sk_config = {
						// Compatibility

						compatibilities: {
							<?php 
                echo $post_types;
                ?>
							<?php 
                echo $taxonomies;
                ?>
							<?php 
                echo $user_data;
                ?>
							<?php 
                echo $comments;
                ?>
							<?php 
                echo $post_statuses;
                ?>
							<?php 
                echo $frameworks;
                ?>
							<?php 
                echo $post_types_and_statuses;
                ?>
							installed_plugins:        	<?php 
                echo json_encode($installed_plugins);
                ?>
,
							plugin_count: 				<?php 
                echo $plugin_count ? $plugin_count : 0;
                ?>
,
							is_multisite:             	<?php 
                echo is_multisite() ? "true" : "false";
                ?>
,
							number_of_themes:         	<?php 
                echo $number_of_themes;
                ?>
,
							installed_theme:          	'<?php 
                echo sanitize_title($theme->Name);
                ?>
',
							theme_version:            	'<?php 
                echo $theme->Version;
                ?>
',
							main_soft_version:        	'<?php 
                echo get_bloginfo("version");
                ?>
',
							user_level:               	'<?php 
                echo $user_role;
                ?>
',
							main_soft_name: 			'WordPress',
							file_editor_enabled: 		<?php 
                echo $file_editor_enabled ? $file_editor_enabled : 'null';
                ?>
,
							role:               		'<?php 
                echo $user_role;
                ?>
'
						},

						disable_wts:              	<?php 
                echo $disabled_wts;
                ?>
,
						disable_network_wts: 		<?php 
                echo $disabled_network_wts;
                ?>
,
						main_soft_name:           	'WordPress',
						embeded:					false,

						// User Settings
						activation_id:                  '<?php 
                echo $activation_id;
                ?>
',
						auto_open_root_bucket_id:       79,
						auto_open_product:              'default',
						disable_wts_in_root_bucket_ids: [5,87],
						autostart_walkthrough_id:       <?php 
                echo $autostart_walkthrough_id;
                ?>
,
						sk_composer_button:             <?php 
                echo $sk_composer_button ? "true" : "false";
                ?>
,
						track_data:                     '<?php 
                echo $sk_track_data;
                ?>
',
						user_email:                     '<?php 
                echo $user_email;
                ?>
',
						custom_class:                   '<?php 
                echo $custom_class;
                ?>
',

						// Toggles
						path_not_found_continue: true,
						show_powered_by:         true,
						show_powered_by_link:    true,
						sk_autostart_only_once:  true,
						use_native_controls:     false,
						composer_upgrade_off:    false,
						basics_upgrade:          true,

						// Platform Info
						library_version: 2,
						platform_id:     1,
						embed_partner:   '<?php 
                echo SK_EMBED_PARTNER;
                ?>
',

						// Generic Info
						just_activated:           	<?php 
                echo $sk_just_activated ? "true" : "false";
                ?>
,
						platform_version:         	null,
						plugin_version:           	'2.2.4',
						show_login:               	<?php 
                echo $sk_just_activated ? "true" : "false";
                ?>
,

						// SIDEKICK URLS
						assets:       				'<?php 
                echo SK_ASSETS;
                ?>
',
						api:          				'<?php 
                echo SK_API;
                ?>
',
						tracking_api: 				'<?php 
                echo SK_TRACKING_API;
                ?>
',
						sk_path:      				'<?php 
                echo PLAYER_PATH;
                ?>
',
						audio:        				'<?php 
                echo SK_AUDIO;
                ?>
',
						library: 					'<?php 
                echo SK_LIBRARY;
                ?>
',

						// URLS
						site_url:                 '<?php 
                echo $site_url;
                ?>
',
						domain:                   '<?php 
                echo str_replace("http://", "", $_SERVER["SERVER_NAME"]);
                ?>
',
						domain_used:              '//<?php 
                echo PLAYER_DOMAIN;
                ?>
/',
						plugin_url:               '<?php 
                echo admin_url("admin.php?page=sidekick");
                ?>
',
						base_url:                 '<?php 
                echo site_url();
                ?>
',
						current_url:              '<?php 
                echo $current_url;
                ?>
'
						// fallback_notfication_mp3: '//assets.sidekick.pro/fallback.mp3'
					}

					var skc_config = {
						audioPlaceholderUrl: '<?php 
                echo SK_ASSETS;
                ?>
walkthrough-audio-placeholder.mp3',
						audioBaseUrl:        '<?php 
                echo SK_AUDIO;
                ?>
',
						apiUrl:              '<?php 
                echo SK_COMPOSER_API;
                ?>
',
						trackingUrl:         '<?php 
                echo SK_TRACKING_API;
                ?>
',
						js:                  '//<?php 
                echo COMPOSER_DOMAIN;
                ?>
/<?php 
                echo COMPOSER_PATH;
                ?>
/sidekick-composer.js',
						css:                 '//<?php 
                echo COMPOSER_DOMAIN;
                ?>
/<?php 
                echo COMPOSER_PATH;
                ?>
/sidekick-composer.css',
						baseSiteUrl:         sk_config.base_url,
						platformId:          1,
						compatibilities:     sk_config.compatibilities,
						siteAjaxUrl:         window.ajaxurl || ''
					}

				</script>
			<?php 
            }
            ?>

			<?php 
        }