Example #1
0
        function extra_tablenav($which)
        {
            if ($which == "top") {
                $HAS_FILTERS = false;
                $filters = $this->check_table_filters();
                ?>
				<div class="alignleft actions"><?php 
                /*
                				if (is_multisite()) {
                					$blog_counts = array();
                					if ((isset(WPMUDEVSnapshot::instance()->config_data['items'])) && (count(WPMUDEVSnapshot::instance()->config_data['items']))) {
                
                						foreach(WPMUDEVSnapshot::instance()->config_data['items'] as $idx => $item) {
                
                							if (!isset($blog_counts[$item['blog-id']]))
                								$blog_counts[$item['blog-id']] = 1;
                							else
                								$blog_counts[$item['blog-id']] += 1;
                						}
                					}
                
                					// We need to display a column showing the blog for a snapshot.
                					// Simply gets all blogs then builds a local array using the blog_id as the key to the blog url.
                					$blogs = Snapshot_Helper_Utility::get_blogs();
                					if ($blogs) {
                						$tmp_blogs = array();
                						foreach($blogs as $blog) {
                							// Does this blog_id exist in our count array?
                							if (isset($blog_counts[$blog->blog_id]))
                								$tmp_blogs[$blog->blog_id] = $blog->blogname ."<br /> (". $blog->domain .") (". $blog_counts[$blog->blog_id] .")";
                						}
                						$blogs = $tmp_blogs;
                					}
                
                					if (($blogs) && (count($blogs))) {
                						$HAS_FILTERS = true;
                
                						?>
                						<select
                							name="snapshot-filter-blog-id" id="snapshot-filter-blog-id">
                							<option value="">Show All Blogs</option>
                							<?php
                								foreach($blogs as $blog_id => $blog_domain) {
                									?><option <?php if ($blog_id == $filters['blog-id']) { echo ' selected="selected" '; } ?>
                										value="<?php echo $blog_id ?>"><?php echo $blog_domain; ?></option><?php
                								}
                							?>
                						</select>
                						<?php
                					}
                				}
                */
                if (isset(WPMUDEVSnapshot::instance()->config_data['destinations']) && count(WPMUDEVSnapshot::instance()->config_data['destinations'])) {
                    $HAS_FILTERS = true;
                    ?>
					<select
						name="snapshot-filter-destination" id="snapshot-filter-destination">
						<option value=""><?php 
                    _e('Show All Destinations', SNAPSHOT_I18N_DOMAIN);
                    ?>
</option>

						<?php 
                    Snapshot_Helper_UI::destination_select_options_groups(WPMUDEVSnapshot::instance()->config_data['destinations'], $filters['destination'], WPMUDEVSnapshot::instance()->get_setting('destinationClasses'));
                    ?>
					</select>
				<?php 
                }
                if ($HAS_FILTERS) {
                    ?>
<input id="post-query-submit" class="button-secondary" type="submit" value="Filter"
					         name="snapshot-filter"><?php 
                }
                ?>
</div><?php 
            }
        }
Example #2
0
        /**
         * Metabox to show the backup destination options
         *
         * @since 1.0.2
         *
         * @param string $title - Title to be displayed in header of metabox
         * @param array $item - The current viewed item
         *
         * @return none
         */
        function snapshot_metabox_show_destination_options($title, $item, $display_only = false)
        {
            if (!isset($item['destination'])) {
                $item['destination'] = "local";
            }
            ?>
			<div class="postbox">
				<h3 class="hndle"><span><?php 
            echo $title;
            ?>
</span></h3>

				<div class="inside">
					<table class="form-table snapshot-backup-destinations">
						<tr class="form-field">
							<th scope="row">
								<label
									for="snapshot-destination"><?php 
            _e('Backup Destination', SNAPSHOT_I18N_DOMAIN);
            ?>
</label><br/>
								<a href="admin.php?page=snapshots_destinations_panel"><?php 
            _e('Add more Destinations', SNAPSHOT_I18N_DOMAIN);
            ?>
</a>
							</th>
							<td>
								<select name="snapshot-destination" id="snapshot-destination">
									<?php 
            // This global is set within the next calling function. Helps determine which set of descriptions to show.
            global $snapshot_destination_selected_type;
            Snapshot_Helper_UI::destination_select_options_groups(WPMUDEVSnapshot::instance()->config_data['destinations'], $item['destination'], WPMUDEVSnapshot::instance()->get_setting('destinationClasses'));
            ?>
								</select><br/>

								<p class="description"><?php 
            _e("If you select a remote destination and the 'Interval' is set as Immediate, the snapshot backup file will not be sent during the normal backup step. Instead the transfer of the backup file will be scheduled at a later time. This is to prevent the screen from locking while the backup file is sent to the remote destination.", SNAPSHOT_I18N_DOMAIN);
            ?>
</p>

							</td>
						</tr>
						<tr class="form-field">
							<th scope="row">
								<label
									for="snapshot-destination-directory"><?php 
            _e('Directory (optional)', SNAPSHOT_I18N_DOMAIN);
            ?>
</label>
							</th>
							<td>
								<input type="text" name="snapshot-destination-directory"
								       id="snapshot-destination-directory"
								       value="<?php 
            if (isset($item['destination-directory'])) {
                echo stripslashes($item['destination-directory']);
            }
            ?>
"/>


								<?php 
            //echo "snapshot_destination_selected_type[". $snapshot_destination_selected_type ."]<br />";
            ?>
								<div id="snapshot-destination-directory-description" <?php 
            if ($snapshot_destination_selected_type == 'google-drive') {
                echo ' style="display:none" ';
            }
            ?>
>

									<p class="description"><?php 
            _e("The optional Directory can be used to override or supplement the selected destination directory value. If 'local server' is selected and if the directory does not start with a forward slash '/' the directory will be relative to the site root.", SNAPSHOT_I18N_DOMAIN);
            ?>
</p>

									<p class="description"><?php 
            _e("This field support tokens you can use to create dynamic values. You can use any combination of the following tokens. Use the forward slash '/' to separate directory elements.", SNAPSHOT_I18N_DOMAIN);
            ?>
</p>
									<ul class="description">
										<li>
											<strong>[DEST_PATH]</strong> &ndash; <?php 
            _e("This represents the Directory/Bucket used by the selected Backup Destination or if local, the Settings Folder Location. This can be used to supplement a value entered into this Snapshot. If [DEST_PATH] is not used the Directory value here will override the complete value from the selected Destination.");
            ?>
										</li>
										<li>
											<strong>[SITE_DOMAIN]</strong> &ndash; <?php 
            _e('This represents the full domain of the selected site per this snapshot');
            ?>
											: <?php 
            if (isset($item['blog-id'])) {
                if (is_multisite()) {
                    $blog_info = get_blog_details($item['blog-id']);
                    if ($blog_info->domain) {
                        $domain = $blog_info->domain;
                    }
                } else {
                    $siteurl = get_option('siteurl');
                    if ($siteurl) {
                        $domain = parse_url($siteurl, PHP_URL_HOST);
                    }
                }
                if (isset($domain) && strlen($domain)) {
                    echo "<strong>" . $domain . "</strong>";
                }
            }
            ?>
</li>
										<li>
											<strong>[SNAPSHOT_ID]</strong> &ndash; <?php 
            _e('This is the unique ID assigned to this Snapshot set');
            ?>
											:
											<?php 
            if (isset($item['timestamp'])) {
                echo "<strong>" . $item['timestamp'] . "</strong>";
            }
            ?>
</li>
									</ul>
								</div>
								<div
									id="snapshot-destination-directory-description-google-drive" <?php 
            if ($snapshot_destination_selected_type != 'google-drive') {
                echo ' style="display:none" ';
            }
            ?>
>
									<p><?php 
            echo sprintf(__('For Google Drive destinations this is not a normal directory path. Instead you must provide the Directory ID. Go to your %s. Navigate to or create a new directory where you want to upload the Snapshot archives. Make sure you are viewing the destination directory. The URL for the directory will be something similar to <em>https://drive.google.com/#folders/0B6GD66ctHXXCOWZKNDRIRGJJXS3</em>. The Directory ID would be the last part after /#folders/ <strong><em>0B6GD66ctHXXCOWZKNDRIRGJJXS3</em></strong>.', SNAPSHOT_I18N_DOMAIN), '<a href="https://drive.google.com/#my-drive">' . __('Drive account', SNAPSHOT_I18N_DOMAIN) . '</a>');
            ?>
</p>
								</div>
							</td>
						</tr>

					</table>
				</div>
				<!-- end inside -->
			</div><!-- end postbox -->
		<?php 
        }