示例#1
0
        function handle_addons_panel()
        {
            global $action, $page;
            wp_reset_vars(array('action', 'page'));
            $messages = array();
            $messages[1] = __('Add-on updated.', 'popover');
            $messages[2] = __('Add-on not updated.', 'popover');
            $messages[3] = __('Add-on activated.', 'popover');
            $messages[4] = __('Add-on not activated.', 'popover');
            $messages[5] = __('Add-on deactivated.', 'popover');
            $messages[6] = __('Add-on not deactivated.', 'popover');
            $messages[7] = __('Add-on activation toggled.', 'popover');
            ?>
            <div class='wrap'>
                <div class="icon32" id="icon-plugins"><br></div>
                <h2><?php 
            _e('Edit Add-ons', 'popover');
            ?>
</h2>

            <?php 
            if (isset($_GET['msg'])) {
                echo '<div id="message" class="updated fade"><p>' . $messages[(int) $_GET['msg']] . '</p></div>';
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            ?>

                <form method="get" action="?page=<?php 
            echo esc_attr($page);
            ?>
" id="posts-filter">

                    <input type='hidden' name='page' value='<?php 
            echo esc_attr($page);
            ?>
' />

                    <div class="tablenav">

                        <div class="alignleft actions">
                            <select name="action">
                                <option selected="selected" value=""><?php 
            _e('Bulk Actions', 'popover');
            ?>
</option>
                                <option value="toggle"><?php 
            _e('Toggle activation', 'popover');
            ?>
</option>
                            </select>
                            <input type="submit" class="button-secondary action" id="doaction" name="doaction" value="<?php 
            _e('Apply', 'popover');
            ?>
">

                        </div>

                        <div class="alignright actions"></div>

                        <br class="clear">
                    </div>

                    <div class="clear"></div>

            <?php 
            wp_original_referer_field(true, 'previous');
            wp_nonce_field('bulk-addons');
            $columns = array("name" => __('Add-on Name', 'popover'), "file" => __('Add-on File', 'popover'), "active" => __('Active', 'popover'));
            $columns = apply_filters('popover_addoncolumns', $columns);
            $addons = get_popover_addons();
            $active = get_option('popover_activated_addons', array());
            ?>

                    <table cellspacing="0" class="widefat fixed">
                        <thead>
                            <tr>
                                <th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th>
            <?php 
            foreach ($columns as $key => $col) {
                ?>
                                    <th style="" class="manage-column column-<?php 
                echo $key;
                ?>
" id="<?php 
                echo $key;
                ?>
" scope="col"><?php 
                echo $col;
                ?>
</th>
                        <?php 
            }
            ?>
                            </tr>
                        </thead>

                        <tfoot>
                            <tr>
                                <th style="" class="manage-column column-cb check-column" scope="col"><input type="checkbox"></th>
                    <?php 
            reset($columns);
            foreach ($columns as $key => $col) {
                ?>
                                    <th style="" class="manage-column column-<?php 
                echo $key;
                ?>
" id="<?php 
                echo $key;
                ?>
" scope="col"><?php 
                echo $col;
                ?>
</th>
                <?php 
            }
            ?>
                            </tr>
                        </tfoot>

                        <tbody>
                                <?php 
            if ($addons) {
                foreach ($addons as $key => $addon) {
                    $default_headers = array('Name' => 'Addon Name', 'Author' => 'Author', 'Description' => 'Description', 'AuthorURI' => 'Author URI');
                    $addon_data = get_file_data(popover_dir('popoverincludes/addons/' . $addon), $default_headers, 'plugin');
                    if (empty($addon_data['Name'])) {
                        continue;
                    }
                    ?>
                                    <tr valign="middle" class="alternate" id="addon-<?php 
                    echo $addon;
                    ?>
">
                                        <th class="check-column" scope="row"><input type="checkbox" value="<?php 
                    echo esc_attr($addon);
                    ?>
" name="addoncheck[]"></th>
                                        <td class="column-name">
                                            <strong><?php 
                    echo esc_html($addon_data['Name']) . "</strong>" . __(' by ', 'popover') . "<a href='" . esc_attr($addon_data['AuthorURI']) . "'>" . esc_html($addon_data['Author']) . "</a>";
                    ?>
                    <?php 
                    if (!empty($addon_data['Description'])) {
                        ?>
<br/><?php 
                        echo esc_html($addon_data['Description']);
                    }
                    $actions = array();
                    if (in_array($addon, $active)) {
                        $actions['toggle'] = "<span class='edit activate'><a href='" . wp_nonce_url("?page=" . $page . "&amp;action=deactivate&amp;addon=" . $addon . "", 'toggle-addon-' . $addon) . "'>" . __('Deactivate', 'popover') . "</a></span>";
                    } else {
                        $actions['toggle'] = "<span class='edit deactivate'><a href='" . wp_nonce_url("?page=" . $page . "&amp;action=activate&amp;addon=" . $addon . "", 'toggle-addon-' . $addon) . "'>" . __('Activate', 'popover') . "</a></span>";
                    }
                    ?>
                                                <br><div class="row-actions"><?php 
                    echo implode(" | ", $actions);
                    ?>
</div>
                                        </td>

                                        <td class="column-name">
                                    <?php 
                    echo esc_html($addon);
                    ?>
                                        </td>
                                        <td class="column-active">
                    <?php 
                    if (in_array($addon, $active)) {
                        echo "<strong>" . __('Active', 'popover') . "</strong>";
                    } else {
                        echo __('Inactive', 'popover');
                    }
                    ?>
                                        </td>
                                    </tr>
                                                <?php 
                }
            } else {
                $columncount = count($columns) + 1;
                ?>
                                <tr valign="middle" class="alternate" >
                                    <td colspan="<?php 
                echo $columncount;
                ?>
" scope="row"><?php 
                _e('No Add-ons where found for this install.', 'popover');
                ?>
</td>
                                </tr>
                <?php 
            }
            ?>

                        </tbody>
                    </table>


                    <div class="tablenav">

                        <div class="alignleft actions">
                            <select name="action2">
                                <option selected="selected" value=""><?php 
            _e('Bulk Actions', 'popover');
            ?>
</option>
                                <option value="toggle"><?php 
            _e('Toggle activation', 'popover');
            ?>
</option>
                            </select>
                            <input type="submit" class="button-secondary action" id="doaction2" name="doaction2" value="<?php 
            _e('Apply', 'popover');
            ?>
">
                        </div>
                        <div class="alignright actions"></div>
                        <br class="clear">
                    </div>

                </form>

            </div> <!-- wrap -->
                            <?php 
        }
function wpjam_form($form_fields, $form_url, $nonce_action = '', $submit_text = '')
{
    global $plugin_page;
    $nonce_action = $nonce_action ? $nonce_action : $plugin_page;
    wpjam_admin_errors();
    // 显示错误
    ?>
	<form method="post" action="<?php 
    echo $form_url;
    ?>
" enctype="multipart/form-data" id="form">
		<?php 
    wpjam_form_fields($form_fields);
    ?>
		<?php 
    wp_nonce_field($nonce_action);
    ?>
		<?php 
    wp_original_referer_field(true, 'previous');
    ?>
		<?php 
    if ($submit_text !== false) {
        submit_button($submit_text);
    }
    ?>
	</form>
	<?php 
}
示例#3
0
        /**
         * Prepare and display the configuration view for editorial metadata.
         * There are four primary components:
         * - Form to add a new Editorial Metadata term
         * - Form generated by the settings API for managing Editorial Metadata options
         * - Table of existing Editorial Metadata terms with ability to take actions on each
         * - Full page width view for editing a single Editorial Metadata term
         *
         * @since 0.7
         */
        function print_configure_view()
        {
            global $edit_flow;
            $wp_list_table = new EF_Editorial_Metadata_List_Table();
            $wp_list_table->prepare_items();
            ?>
		<script type="text/javascript">
			var ef_confirm_delete_term_string = "<?php 
            echo esc_js(__('Are you sure you want to delete this term? Any metadata for this term will remain but will not be visible unless this term is re-added.', 'edit-flow'));
            ?>
";
		</script>
		<?php 
            if (!isset($_GET['action']) || isset($_GET['action']) && $_GET['action'] != 'edit-term') {
                ?>
		<div id="col-right">
		<div class="col-wrap">
		<form id="posts-filter" action="" method="post">
			<?php 
                $wp_list_table->display();
                ?>
			<?php 
                wp_nonce_field('editorial-metadata-sortable', 'editorial-metadata-sortable');
                ?>
		</form>
		</div>
		</div><!-- /col-right -->
		<?php 
                $wp_list_table->inline_edit();
                ?>
		<?php 
            }
            ?>
	
		
		<?php 
            if (isset($_GET['action'], $_GET['term-id']) && $_GET['action'] == 'edit-term') {
                ?>
		<?php 
                /** Full page width view for editing a given editorial metadata term **/
                ?>
		<?php 
                // Check whether the term exists
                $term_id = (int) $_GET['term-id'];
                $term = $this->get_editorial_metadata_term_by('id', $term_id);
                if (!$term) {
                    echo '<div class="error"><p>' . $this->module->messages['term-missing'] . '</p></div>';
                    return;
                }
                $metadata_types = $this->get_supported_metadata_types();
                $type = $term->type;
                $edit_term_link = $this->get_link(array('action' => 'edit-term', 'term-id' => $term->term_id));
                $name = isset($_POST['name']) ? stripslashes($_POST['name']) : $term->name;
                $description = isset($_POST['description']) ? stripslashes($_POST['description']) : $term->description;
                if ($term->viewable) {
                    $viewable = 'yes';
                } else {
                    $viewable = 'no';
                }
                $viewable = isset($_POST['viewable']) ? stripslashes($_POST['viewable']) : $viewable;
                ?>
		
		<form method="post" action="<?php 
                echo esc_url($edit_term_link);
                ?>
" >
		<input type="hidden" name="action" value="editedtag" />
		<input type="hidden" name="tag_id" value="<?php 
                echo esc_attr($term->term_id);
                ?>
" />
		<input type="hidden" name="taxonomy" value="<?php 
                echo esc_attr(self::metadata_taxonomy);
                ?>
" />
		<?php 
                wp_original_referer_field();
                wp_nonce_field('editorial-metadata-edit-nonce');
                ?>
		<table class="form-table">
			<tr class="form-field form-required">
				<th scope="row" valign="top"><label for="name"><?php 
                _e('Name');
                ?>
</label></th>
				<td><input name="name" id="name" type="text" value="<?php 
                echo esc_attr($name);
                ?>
" size="40" aria-required="true" />
				<?php 
                $edit_flow->settings->helper_print_error_or_description('name', __('The name is for labeling the metadata field.', 'edit-flow'));
                ?>
			</tr>
			<tr class="form-field">
				<th scope="row" valign="top"><?php 
                _e('Slug', 'edit-flow');
                ?>
</th>
				<td>
					<input type="text" disabled="disabled" value="<?php 
                echo esc_attr($term->slug);
                ?>
" />
					<p class="description"><?php 
                _e('The slug cannot be changed once the term has been created.', 'edit-flow');
                ?>
</p>
				</td>
			</tr>			
			<tr class="form-field">
				<th scope="row" valign="top"><label for="description"><?php 
                _e('Description', 'edit-flow');
                ?>
</label></th>
				<td>
					<textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php 
                echo esc_html($description);
                ?>
</textarea>
				<?php 
                $edit_flow->settings->helper_print_error_or_description('description', __('The description can be used to communicate with your team about what the metadata is for.', 'edit-flow'));
                ?>
				</td>
			</tr>
			<tr class="form-field">
				<th scope="row" valign="top"><?php 
                _e('Type', 'edit-flow');
                ?>
</th>
				<td>
					<input type="text" disabled="disabled" value="<?php 
                echo esc_attr($metadata_types[$type]);
                ?>
" />
					<p class="description"><?php 
                _e('The metadata type cannot be changed once created.', 'edit-flow');
                ?>
</p>
				</td>
			</tr>
			<tr class="form-field">
				<th scope="row" valign="top"><?php 
                _e('Viewable', 'edit-flow');
                ?>
</th>
				<td>
					<?php 
                $metadata_viewable_options = array('no' => __('No', 'edit-flow'), 'yes' => __('Yes', 'edit-flow'));
                ?>
					<select id="viewable" name="viewable">
					<?php 
                foreach ($metadata_viewable_options as $metadata_viewable_key => $metadata_viewable_value) {
                    ?>
						<option value="<?php 
                    echo esc_attr($metadata_viewable_key);
                    ?>
" <?php 
                    selected($viewable, $metadata_viewable_key);
                    ?>
><?php 
                    echo esc_attr($metadata_viewable_value);
                    ?>
</option>
					<?php 
                }
                ?>
					</select>
					<?php 
                $edit_flow->settings->helper_print_error_or_description('viewable', __('When viewable, metadata can be seen on views other than the edit post view (e.g. calendar, manage posts, story budget, etc.)', 'edit-flow'));
                ?>
				</td>
			</tr>
		<input type="hidden" name="<?php 
                echo self::metadata_taxonomy;
                ?>
'_type" value="<?php 
                echo $type;
                ?>
" />
		</table>
		<p class="submit">
		<?php 
                submit_button(__('Update Metadata Term', 'edit-flow'), 'primary', 'submit', false);
                ?>
		<a class="cancel-settings-link" href="<?php 
                echo esc_url(add_query_arg('page', $this->module->settings_slug, get_admin_url(null, 'admin.php')));
                ?>
"><?php 
                _e('Cancel', 'edit-flow');
                ?>
</a>
		</p>
		</form>
		
		<?php 
            } else {
                ?>
		<?php 
                /** If not in full-screen edit term mode, we can create new terms or change options **/
                ?>
		<div id="col-left">
			<div class="col-wrap">	
			<div class="form-wrap">
			<h3 class="nav-tab-wrapper">
				<a href="<?php 
                echo esc_url(add_query_arg(array('page' => $this->module->settings_slug), get_admin_url(null, 'admin.php')));
                ?>
" class="nav-tab<?php 
                if (!isset($_GET['action']) || $_GET['action'] != 'change-options') {
                    echo ' nav-tab-active';
                }
                ?>
"><?php 
                _e('Add New', 'edit-flow');
                ?>
</a>
				<a href="<?php 
                echo esc_url(add_query_arg(array('page' => $this->module->settings_slug, 'action' => 'change-options'), get_admin_url(null, 'admin.php')));
                ?>
" class="nav-tab<?php 
                if (isset($_GET['action']) && $_GET['action'] == 'change-options') {
                    echo ' nav-tab-active';
                }
                ?>
"><?php 
                _e('Options', 'edit-flow');
                ?>
</a>
			</h3>
			
		<?php 
                if (isset($_GET['action']) && $_GET['action'] == 'change-options') {
                    ?>
		<?php 
                    /** Basic form built on WP Settings API for outputting Editorial Metadata options **/
                    ?>
		<form class="basic-settings" action="<?php 
                    echo esc_url(add_query_arg(array('page' => $this->module->settings_slug, 'action' => 'change-options'), get_admin_url(null, 'admin.php')));
                    ?>
" method="post">
			<?php 
                    settings_fields($this->module->options_group_name);
                    ?>
			<?php 
                    do_settings_sections($this->module->options_group_name);
                    ?>
	
			<?php 
                    echo '<input id="edit_flow_module_name" name="edit_flow_module_name" type="hidden" value="' . esc_attr($this->module->name) . '" />';
                    ?>
			<?php 
                    submit_button();
                    ?>
		</form>
		<?php 
                } else {
                    ?>
		<?php 
                    /** Custom form for adding a new Editorial Metadata term **/
                    ?>
			<form class="add:the-list:" action="<?php 
                    echo esc_url(add_query_arg(array('page' => $this->module->settings_slug), get_admin_url(null, 'admin.php')));
                    ?>
" method="post" id="addmetadata" name="addmetadata">
			<div class="form-field form-required">
				<label for="metadata_name"><?php 
                    _e('Name', 'edit-flow');
                    ?>
</label>
				<input type="text" aria-required="true" size="20" maxlength="200" id="metadata_name" name="metadata_name" value="<?php 
                    if (!empty($_POST['metadata_name'])) {
                        echo esc_attr(stripslashes($_POST['metadata_name']));
                    }
                    ?>
" />
				<?php 
                    $edit_flow->settings->helper_print_error_or_description('name', __('The name is for labeling the metadata field.', 'edit-flow'));
                    ?>
			</div>
			<div class="form-field form-required">
				<label for="metadata_slug"><?php 
                    _e('Slug', 'edit-flow');
                    ?>
</label>
				<input type="text" aria-required="true" size="20" maxlength="200" id="metadata_slug" name="metadata_slug" value="<?php 
                    if (!empty($_POST['metadata_slug'])) {
                        echo esc_attr($_POST['metadata_slug']);
                    }
                    ?>
" />
				<?php 
                    $edit_flow->settings->helper_print_error_or_description('slug', __('The "slug" is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'edit-flow'));
                    ?>
			</div>
			<div class="form-field">
				<label for="metadata_description"><?php 
                    _e('Description', 'edit-flow');
                    ?>
</label>
				<textarea cols="40" rows="5" id="metadata_description" name="metadata_description"><?php 
                    if (!empty($_POST['metadata_description'])) {
                        echo esc_html(stripslashes($_POST['metadata_description']));
                    }
                    ?>
</textarea>
				<?php 
                    $edit_flow->settings->helper_print_error_or_description('description', __('The description can be used to communicate with your team about what the metadata is for.', 'edit-flow'));
                    ?>
			</div>
			<div class="form-field form-required">
				<label for="metadata_type"><?php 
                    _e('Type', 'edit-flow');
                    ?>
</label>
				<?php 
                    $metadata_types = $this->get_supported_metadata_types();
                    // Select the previously selected metadata type if a valid one exists
                    $current_metadata_type = isset($_POST['metadata_type']) && in_array($_POST['metadata_type'], array_keys($metadata_types)) ? $_POST['metadata_type'] : false;
                    ?>
				<select id="metadata_type" name="metadata_type">
				<?php 
                    foreach ($metadata_types as $metadata_type => $metadata_type_name) {
                        ?>
					<option value="<?php 
                        echo esc_attr($metadata_type);
                        ?>
" <?php 
                        selected($metadata_type, $current_metadata_type);
                        ?>
><?php 
                        echo esc_attr($metadata_type_name);
                        ?>
</option>
				<?php 
                    }
                    ?>
				</select>
				<?php 
                    $edit_flow->settings->helper_print_error_or_description('type', __('Indicate the type of editorial metadata.', 'edit-flow'));
                    ?>
			</div>
			<div class="form-field form-required">
				<label for="metadata_viewable"><?php 
                    _e('Viewable', 'edit-flow');
                    ?>
</label>
				<?php 
                    $metadata_viewable_options = array('no' => __('No', 'edit-flow'), 'yes' => __('Yes', 'edit-flow'));
                    $current_metadata_viewable = isset($_POST['metadata_viewable']) && in_array($_POST['metadata_viewable'], array_keys($metadata_viewable_options)) ? $_POST['metadata_viewable'] : 'no';
                    ?>
				<select id="metadata_viewable" name="metadata_viewable">
				<?php 
                    foreach ($metadata_viewable_options as $metadata_viewable_key => $metadata_viewable_value) {
                        ?>
					<option value="<?php 
                        echo esc_attr($metadata_viewable_key);
                        ?>
" <?php 
                        selected($current_metadata_viewable, $metadata_viewable_key);
                        ?>
><?php 
                        echo esc_attr($metadata_viewable_value);
                        ?>
</option>
				<?php 
                    }
                    ?>
				</select>
				<?php 
                    $edit_flow->settings->helper_print_error_or_description('viewable', __('When viewable, metadata can be seen on views other than the edit post view (e.g. calendar, manage posts, story budget, etc.)', 'edit-flow'));
                    ?>
			</div>
			<?php 
                    wp_nonce_field('editorial-metadata-add-nonce');
                    ?>
			<input type="hidden" id="form-action" name="form-action" value="add-term" />
			<p class="submit"><?php 
                    submit_button(__('Add New Metadata Term', 'edit-flow'), 'primary', 'submit', false);
                    ?>
<a class="cancel-settings-link" href="<?php 
                    echo EDIT_FLOW_SETTINGS_PAGE;
                    ?>
"><?php 
                    _e('Back to Edit Flow', 'edit-flow');
                    ?>
</a></p>
			</form>
		<?php 
                }
                ?>
			</div>
			</div>
		</div>
		
		<?php 
            }
        }
 /**
  * Adds "_wp_original_referer" field to login form
  *
  * Callback for "tml_login_form" hook in file "login-form.php", included by method Theme_My_Login_Template::display()
  *
  * @see Theme_My_Login_Template::display()
  * @since 6.0
  * @access public
  *
  * @param object $template Reference to $theme_my_login_template object
  */
 function login_form(&$template)
 {
     $jump_back_to = empty($template->instance) ? 'previous' : 'current';
     wp_original_referer_field(true, $jump_back_to);
     echo "\n";
 }
        function handle_gateways_panel()
        {
            global $action, $page, $M_Gateways;
            wp_reset_vars(array('action', 'page'));
            switch (addslashes($action)) {
                case 'edit':
                    if (isset($M_Gateways[addslashes($_GET['gateway'])])) {
                        $M_Gateways[addslashes($_GET['gateway'])]->settings();
                    }
                    return;
                    // so we don't show the list below
                    break;
                case 'transactions':
                    if (isset($M_Gateways[addslashes($_GET['gateway'])])) {
                        $M_Gateways[addslashes($_GET['gateway'])]->transactions();
                    }
                    return;
                    // so we don't show the list below
                    break;
            }
            $messages = array();
            $messages[1] = __('Gateway updated.', 'membership');
            $messages[2] = __('Gateway not updated.', 'membership');
            $messages[3] = __('Gateway activated.', 'membership');
            $messages[4] = __('Gateway not activated.', 'membership');
            $messages[5] = __('Gateway deactivated.', 'membership');
            $messages[6] = __('Gateway not deactivated.', 'membership');
            $messages[7] = __('Gateway activation toggled.', 'membership');
            ?>
			<div class='wrap'>
				<div class="icon32" id="icon-plugins"><br></div>
				<h2><?php 
            _e('Edit Gateways', 'membership');
            ?>
</h2>

				<?php 
            if (isset($_GET['msg'])) {
                echo '<div id="message" class="updated fade"><p>' . $messages[(int) $_GET['msg']] . '</p></div>';
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            if ($this->show_user_help($page)) {
                ?>
					<div class='screenhelpheader'>
						<a href="admin.php?page=<?php 
                echo $page;
                ?>
&amp;action=removeheader" class="welcome-panel-close"><?php 
                _e('Dismiss', 'membership');
                ?>
</a>
						<?php 
                ob_start();
                include_once membership_dir('membershipincludes/help/header.gateways.php');
                echo ob_get_clean();
                ?>
					</div>
					<?php 
            }
            ?>

				<form method="get" action="?page=<?php 
            echo esc_attr($page);
            ?>
" id="posts-filter">

				<input type='hidden' name='page' value='<?php 
            echo esc_attr($page);
            ?>
' />

				<div class="tablenav">

				<div class="alignleft actions">
				<select name="action">
				<option selected="selected" value=""><?php 
            _e('Bulk Actions', 'membership');
            ?>
</option>
				<option value="toggle"><?php 
            _e('Toggle activation', 'membership');
            ?>
</option>
				</select>
				<input type="submit" class="button-secondary action" id="doaction" name="doaction" value="<?php 
            _e('Apply', 'membership');
            ?>
">

				</div>

				<div class="alignright actions"></div>

				<br class="clear">
				</div>

				<div class="clear"></div>

				<?php 
            wp_original_referer_field(true, 'previous');
            wp_nonce_field('bulk-gateways');
            $columns = array("name" => __('Gateway Name', 'membership'), "active" => __('Active', 'membership'));
            $columns = apply_filters('membership_gatewaycolumns', $columns);
            $gateways = get_membership_gateways();
            $active = get_option('membership_activated_gateways', array());
            ?>

				<table cellspacing="0" class="widefat fixed">
					<thead>
					<tr>
					<th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th>
					<?php 
            foreach ($columns as $key => $col) {
                ?>
							<th style="" class="manage-column column-<?php 
                echo $key;
                ?>
" id="<?php 
                echo $key;
                ?>
" scope="col"><?php 
                echo $col;
                ?>
</th>
							<?php 
            }
            ?>
					</tr>
					</thead>

					<tfoot>
					<tr>
					<th style="" class="manage-column column-cb check-column" scope="col"><input type="checkbox"></th>
					<?php 
            reset($columns);
            foreach ($columns as $key => $col) {
                ?>
							<th style="" class="manage-column column-<?php 
                echo $key;
                ?>
" id="<?php 
                echo $key;
                ?>
" scope="col"><?php 
                echo $col;
                ?>
</th>
							<?php 
            }
            ?>
					</tr>
					</tfoot>

					<tbody>
						<?php 
            if ($gateways) {
                foreach ($gateways as $key => $gateway) {
                    $default_headers = array('Name' => 'Addon Name', 'Author' => 'Author', 'Description' => 'Description', 'AuthorURI' => 'Author URI', 'gateway_id' => 'Gateway ID');
                    $gateway_data = get_file_data(membership_dir('membershipincludes/gateways/' . $gateway), $default_headers, 'plugin');
                    if (empty($gateway_data['Name'])) {
                        continue;
                    }
                    ?>
								<tr valign="middle" class="alternate" id="gateway-<?php 
                    echo $gateway_data['gateway_id'];
                    ?>
">
									<th class="check-column" scope="row"><input type="checkbox" value="<?php 
                    echo esc_attr($gateway_data['gateway_id']);
                    ?>
" name="gatewaycheck[]"></th>
									<td class="column-name">
										<strong><?php 
                    echo esc_html($gateway_data['Name']);
                    ?>
</strong>
										<?php 
                    if (!empty($gateway_data['Description'])) {
                        ?>
<br/><?php 
                        echo esc_html($gateway_data['Description']);
                    }
                    $actions = array();
                    if (in_array($gateway_data['gateway_id'], $active)) {
                        $actions['edit'] = "<span class='edit'><a href='?page=" . $page . "&amp;action=edit&amp;gateway=" . $gateway_data['gateway_id'] . "'>" . __('Settings', 'membership') . "</a></span>";
                        $actions['transactions'] = "<span class='edit'><a href='?page=" . $page . "&amp;action=transactions&amp;gateway=" . $gateway_data['gateway_id'] . "'>" . __('View transactions', 'membership') . "</a></span>";
                        $actions['toggle'] = "<span class='edit deactivate'><a href='" . wp_nonce_url("?page=" . $page . "&amp;action=deactivate&amp;gateway=" . $gateway_data['gateway_id'] . "", 'toggle-gateway-' . $gateway_data['gateway_id']) . "'>" . __('Deactivate', 'membership') . "</a></span>";
                    } else {
                        $actions['toggle'] = "<span class='edit activate'><a href='" . wp_nonce_url("?page=" . $page . "&amp;action=activate&amp;gateway=" . $gateway_data['gateway_id'] . "", 'toggle-gateway-' . $gateway_data['gateway_id']) . "'>" . __('Activate', 'membership') . "</a></span>";
                    }
                    ?>
										<br><div class="row-actions"><?php 
                    echo implode(" | ", $actions);
                    ?>
</div>
										</td>

									<td class="column-active">
										<?php 
                    if (in_array($gateway_data['gateway_id'], $active)) {
                        echo "<span  class='membershipactivestatus'>" . __('Active', 'membership') . "</span>";
                    } else {
                        echo "<span  class='membershipinactivestatus'>" . __('Inactive', 'membership') . "</span>";
                    }
                    ?>
									</td>
							    </tr>
								<?php 
                }
            } else {
                $columncount = count($columns) + 1;
                ?>
							<tr valign="middle" class="alternate" >
								<td colspan="<?php 
                echo $columncount;
                ?>
" scope="row"><?php 
                _e('No Gateways where found for this install.', 'membership');
                ?>
</td>
						    </tr>
							<?php 
            }
            ?>

					</tbody>
				</table>


				<div class="tablenav">

				<div class="alignleft actions">
				<select name="action2">
					<option selected="selected" value=""><?php 
            _e('Bulk Actions');
            ?>
</option>
					<option value="toggle"><?php 
            _e('Toggle activation');
            ?>
</option>
				</select>
				<input type="submit" class="button-secondary action" id="doaction2" name="doaction2" value="<?php 
            _e('Apply', 'membership');
            ?>
">
				</div>
				<div class="alignright actions"></div>
				<br class="clear">
				</div>

				</form>

			</div> <!-- wrap -->
			<?php 
        }
	$heading = __('Add Tag');
	$submit_text = __('Add Tag');
	$form = '<form name="addtag" id="addtag" method="post" action="edit-tags.php" class="add:the-list: validate">';
	$action = 'addtag';
	$nonce_action = 'add-tag';
	do_action('add_tag_form_pre', $tag);
}
?>

<div class="wrap">
<h2><?php echo $heading ?></h2>
<div id="ajax-response"></div>
<?php echo $form ?>
<input type="hidden" name="action" value="<?php echo $action ?>" />
<input type="hidden" name="tag_ID" value="<?php echo $tag->term_id ?>" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field($nonce_action); ?>
	<table class="form-table">
		<tr class="form-field form-required">
			<th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
			<td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" />
            <p><?php _e('The name is how the tag appears on your site.'); ?></p></td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
			<td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape($tag->slug); ?>" size="40" />
            <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
		</tr>
	</table>
<p class="submit"><input type="submit" class="button" name="submit" value="<?php echo $submit_text ?>" /></p>
<?php do_action('edit_tag_form', $tag); ?>
</form>
示例#7
0
        static function handle_gateways_panel()
        {
            global $action, $page, $EM_Gateways, $EM_Pro;
            wp_reset_vars(array('action', 'page'));
            switch (addslashes($action)) {
                case 'edit':
                    if (isset($EM_Gateways[addslashes($_GET['gateway'])])) {
                        $EM_Gateways[addslashes($_GET['gateway'])]->settings();
                    }
                    return;
                    // so we don't show the list below
                    break;
                case 'transactions':
                    if (isset($EM_Gateways[addslashes($_GET['gateway'])])) {
                        global $EM_Gateways_Transactions;
                        $EM_Gateways_Transactions->output();
                    }
                    return;
                    // so we don't show the list below
                    break;
            }
            $messages = array();
            $messages[1] = __('Gateway updated.');
            $messages[2] = __('Gateway not updated.');
            $messages[3] = __('Gateway activated.');
            $messages[4] = __('Gateway not activated.');
            $messages[5] = __('Gateway deactivated.');
            $messages[6] = __('Gateway not deactivated.');
            $messages[7] = __('Gateway activation toggled.');
            ?>
		<div class='wrap'>
			<div class="icon32" id="icon-plugins"><br></div>
			<h2><?php 
            _e('Edit Gateways', 'em-pro');
            ?>
</h2>
			<?php 
            if (isset($_GET['msg'])) {
                echo '<div id="message" class="updated fade"><p>' . $messages[(int) $_GET['msg']] . '</p></div>';
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            ?>
			<form method="post" action="" id="posts-filter">
				<div class="tablenav">
					<div class="alignleft actions">
						<select name="action">
							<option selected="selected" value=""><?php 
            _e('Bulk Actions');
            ?>
</option>
							<option value="toggle"><?php 
            _e('Toggle activation');
            ?>
</option>
						</select>
						<input type="submit" class="button-secondary action" value="<?php 
            _e('Apply', 'em-pro');
            ?>
">		
					</div>		
					<div class="alignright actions"></div>		
					<br class="clear">
				</div>	
				<div class="clear"></div>	
				<?php 
            wp_original_referer_field(true, 'previous');
            wp_nonce_field('emp-gateways');
            $columns = array("name" => __('Gateway Name', 'em-pro'), "active" => __('Active', 'em-pro'), "transactions" => __('Transactions', 'em-pro'));
            $columns = apply_filters('em_gateways_columns', $columns);
            $gateways = self::gateways_list();
            $active = self::active_gateways();
            ?>
	
				<table class="widefat fixed">
					<thead>
					<tr>
					<th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th>
						<?php 
            foreach ($columns as $key => $col) {
                ?>
							<th style="" class="manage-column column-<?php 
                echo $key;
                ?>
" id="<?php 
                echo $key;
                ?>
" scope="col"><?php 
                echo $col;
                ?>
</th>
							<?php 
            }
            ?>
					</tr>
					</thead>	
					<tfoot>
					<tr>
					<th style="" class="manage-column column-cb check-column" scope="col"><input type="checkbox"></th>
						<?php 
            reset($columns);
            foreach ($columns as $key => $col) {
                ?>
							<th style="" class="manage-column column-<?php 
                echo $key;
                ?>
" id="<?php 
                echo $key;
                ?>
" scope="col"><?php 
                echo $col;
                ?>
</th>
							<?php 
            }
            ?>
					</tr>
					</tfoot>
					<tbody>
						<?php 
            if ($gateways) {
                foreach ($gateways as $key => $gateway) {
                    if (!isset($EM_Gateways[$key])) {
                        continue;
                    }
                    $EM_Gateway = $EM_Gateways[$key];
                    /* @var $EM_Gateway EM_Gateway */
                    ?>
								<tr valign="middle" class="alternate">
									<th class="check-column" scope="row"><input type="checkbox" value="<?php 
                    echo esc_attr($key);
                    ?>
" name="gateways[]"></th>
									<td class="column-name">
										<strong><a title="Edit <?php 
                    echo esc_attr($gateway);
                    ?>
" href="<?php 
                    echo EM_ADMIN_URL;
                    ?>
&amp;page=<?php 
                    echo $page;
                    ?>
&amp;action=edit&amp;gateway=<?php 
                    echo $key;
                    ?>
" class="row-title"><?php 
                    echo esc_html($gateway);
                    ?>
</a></strong>
										<?php 
                    //Check if Multi-Booking Ready
                    if (get_option('dbem_multiple_bookings') && !$EM_Gateway->supports_multiple_bookings) {
                        echo '<br/><em>' . __('This gateway cannot be activated because it does not support multiple bookings mode.', 'em-pro') . '</em>';
                    }
                    $actions = array();
                    $actions['edit'] = "<span class='edit'><a href='" . EM_ADMIN_URL . "&amp;page=" . $page . "&amp;action=edit&amp;gateway=" . $key . "'>" . __('Settings') . "</a></span>";
                    if (array_key_exists($key, $active)) {
                        $actions['toggle'] = "<span class='edit activate'><a href='" . wp_nonce_url(EM_ADMIN_URL . "&amp;page=" . $page . "&amp;action=deactivate&amp;gateway=" . $key . "", 'toggle-gateway_' . $key) . "'>" . __('Deactivate') . "</a></span>";
                    } else {
                        if (!get_option('dbem_multiple_bookings') || get_option('dbem_multiple_bookings') && $EM_Gateway->supports_multiple_bookings) {
                            $actions['toggle'] = "<span class='edit deactivate'><a href='" . wp_nonce_url(EM_ADMIN_URL . "&amp;page=" . $page . "&amp;action=activate&amp;gateway=" . $key . "", 'toggle-gateway_' . $key) . "'>" . __('Activate') . "</a></span>";
                        }
                    }
                    ?>
										<br><div class="row-actions"><?php 
                    echo implode(" | ", $actions);
                    ?>
</div>
										</td>
									<td class="column-active">
										<?php 
                    if (array_key_exists($key, $active)) {
                        echo "<strong>" . __('Active', 'em-pro') . "</strong>";
                    } else {
                        echo __('Inactive', 'em-pro');
                    }
                    ?>
									</td>
									<td class="column-transactions">
										<a href='<?php 
                    echo EM_ADMIN_URL;
                    ?>
&amp;page=<?php 
                    echo $page;
                    ?>
&amp;action=transactions&amp;gateway=<?php 
                    echo $key;
                    ?>
'><?php 
                    _e('View transactions', 'em-pro');
                    ?>
</a>
									</td>
							    </tr>
								<?php 
                }
            } else {
                $columncount = count($columns) + 1;
                ?>
							<tr valign="middle" class="alternate" >
								<td colspan="<?php 
                echo $columncount;
                ?>
" scope="row"><?php 
                _e('No Payment gateways were found for this install.', 'em-pro');
                ?>
</td>
						    </tr>
							<?php 
            }
            ?>
					</tbody>
				</table>
			</form>

		</div> <!-- wrap -->
		<?php 
        }
 function show_tag_edit_form($tagid)
 {
     global $taxonomy;
     $tag = get_term($tagid, $taxonomy, OBJECT, 'edit');
     echo '<div class="wrap">';
     echo '<div class="icon32" id="icon-edit"><br></div>';
     echo '<h2>' . __('Edit Tag') . '</h2>';
     echo '<div id="ajax-response"></div>';
     echo '<form name="edittag" id="edittag" method="post" action="" class="validate">';
     echo '<input type="hidden" name="action" value="editedtag" />';
     echo '<input type="hidden" name="tag_ID" value="' . esc_attr($tag->term_id) . '" />';
     echo '<input type="hidden" name="taxonomy" value="' . esc_attr($taxonomy) . '" />';
     wp_original_referer_field(true, 'previous');
     wp_nonce_field('update-tag_' . $tagid);
     echo '<table class="form-table">';
     echo '<tr class="form-field form-required">';
     echo '<th scope="row" valign="top"><label for="name">' . __('Tag name') . '</label></th>';
     echo '<td><input name="name" id="name" type="text" value="';
     if (isset($tag->name)) {
         echo esc_attr($tag->name);
     }
     echo '" size="40" aria-required="true" />';
     echo '<p class="description">' . __('The name is how the tag appears on your site.') . '</p></td>';
     echo '</tr>';
     echo '<tr class="form-field">';
     echo '<th scope="row" valign="top"><label for="slug">' . __('Slug') . '</label></th>';
     echo '<td><input name="slug" id="slug" type="text" value="';
     if (isset($tag->slug)) {
         echo esc_attr(apply_filters('editable_slug', $tag->slug));
     }
     echo '" size="40" />';
     echo '<p class="description">' . __('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.') . '</p></td>';
     echo '</tr>';
     echo '<tr class="form-field">';
     echo '<th scope="row" valign="top"><label for="description">' . __('Description') . '</label></th>';
     echo '<td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;">' . esc_html($tag->description) . '</textarea><br />';
     echo '<span class="description">' . __('The description is not prominent by default, however some themes may show it.') . '</span></td>';
     echo '</tr>';
     echo '</table>';
     echo '<p class="submit"><input type="submit" class="button-primary" name="submit" value="' . esc_attr('Update Tag') . '" />';
     echo '&nbsp;';
     echo '<a href="' . wp_get_referer() . '" style="margin-left: 20px;">' . __('Cancel edit', 'property') . '</a>';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
示例#9
0
        /**
         * Build a configuration view so we can manage our usergroups
         *
         * @since 0.7
         */
        function print_configure_view()
        {
            global $edit_flow;
            if (isset($_GET['action'], $_GET['usergroup-id']) && $_GET['action'] == 'edit-usergroup') {
                /** Full page width view for editing a given usergroup **/
                // Check whether the usergroup exists
                $usergroup_id = (int) $_GET['usergroup-id'];
                $usergroup = $this->get_usergroup_by('id', $usergroup_id);
                if (!$usergroup) {
                    echo '<div class="error"><p>' . $this->module->messages['usergroup-missing'] . '</p></div>';
                    return;
                }
                $name = isset($_POST['name']) ? stripslashes($_POST['name']) : $usergroup->name;
                $description = isset($_POST['description']) ? stripslashes($_POST['description']) : $usergroup->description;
                ?>
		<form method="post" action="<?php 
                echo esc_url($this->get_link(array('action' => 'edit-usergroup', 'usergroup-id' => $usergroup_id)));
                ?>
">
		<div id="col-right"><div class="col-wrap"><div id="ef-usergroup-users" class="form-wrap">
			<h4><?php 
                _e('Users', 'edit-flow');
                ?>
</h4>
			<?php 
                $select_form_args = array('list_class' => 'ef-post_following_list', 'input_id' => 'usergroup_users');
                ?>
			<?php 
                $this->users_select_form($usergroup->user_ids, $select_form_args);
                ?>
		</div></div></div>
		<div id="col-left"><div class="col-wrap"><div class="form-wrap">		
			<input type="hidden" name="form-action" value="edit-usergroup" />
			<input type="hidden" name="usergroup_id" value="<?php 
                echo esc_attr($usergroup_id);
                ?>
" />
			<?php 
                wp_original_referer_field();
                wp_nonce_field('edit-usergroup');
                ?>
			<div class="form-field form-required">
				<label for="name"><?php 
                _e('Name', 'edit-flow');
                ?>
</label>
				<input name="name" id="name" type="text" value="<?php 
                echo esc_attr($name);
                ?>
" size="40" maxlength="40" aria-required="true" />
				<?php 
                $edit_flow->settings->helper_print_error_or_description('name', __('The name is used to identify the user group.', 'edit-flow'));
                ?>
			</div>
			<div class="form-field">
				<label for="description"><?php 
                _e('Description', 'edit-flow');
                ?>
</label>
				<textarea name="description" id="description" rows="5" cols="40"><?php 
                echo esc_html($description);
                ?>
</textarea>
				<?php 
                $edit_flow->settings->helper_print_error_or_description('description', __('The description is primarily for administrative use, to give you some context on what the user group is to be used for.', 'edit-flow'));
                ?>
			</div>
			<p class="submit">
			<?php 
                submit_button(__('Update User Group', 'edit-flow'), 'primary', 'submit', false);
                ?>
			<a class="cancel-settings-link" href="<?php 
                echo esc_url($this->get_link());
                ?>
"><?php 
                _e('Cancel', 'edit-flow');
                ?>
</a>
			</p>
		</div></div></div>
		</form>
		
		<?php 
            } else {
                /** Full page width view to allow adding a usergroup and edit the existing ones **/
                $wp_list_table = new EF_Usergroups_List_Table();
                $wp_list_table->prepare_items();
                ?>
			<script type="text/javascript">
				var ef_confirm_delete_usergroup_string = "<?php 
                _e('Are you sure you want to delete the user group?', 'edit-flow');
                ?>
";
			</script>
			<div id="col-right"><div class="col-wrap">
				<?php 
                $wp_list_table->display();
                ?>
			</div></div>
			<div id="col-left"><div class="col-wrap"><div class="form-wrap">
				<h3 class="nav-tab-wrapper">
					<a href="<?php 
                echo esc_url($this->get_link());
                ?>
" class="nav-tab<?php 
                if (!isset($_GET['action']) || $_GET['action'] != 'change-options') {
                    echo ' nav-tab-active';
                }
                ?>
"><?php 
                _e('Add New', 'edit-flow');
                ?>
</a>
					<a href="<?php 
                echo esc_url($this->get_link(array('action' => 'change-options')));
                ?>
" class="nav-tab<?php 
                if (isset($_GET['action']) && $_GET['action'] == 'change-options') {
                    echo ' nav-tab-active';
                }
                ?>
"><?php 
                _e('Options', 'edit-flow');
                ?>
</a>
				</h3>
				<?php 
                if (isset($_GET['action']) && $_GET['action'] == 'change-options') {
                    ?>
				<form class="basic-settings" action="<?php 
                    echo esc_url($this->get_link(array('action' => 'change-options')));
                    ?>
" method="post">
					<?php 
                    settings_fields($this->module->options_group_name);
                    ?>
					<?php 
                    do_settings_sections($this->module->options_group_name);
                    ?>
	
					<?php 
                    echo '<input id="edit_flow_module_name" name="edit_flow_module_name" type="hidden" value="' . esc_attr($this->module->name) . '" />';
                    ?>
					<?php 
                    submit_button();
                    ?>
				</form>
				<?php 
                } else {
                    ?>
				<?php 
                    /** Custom form for adding a new Usergroup **/
                    ?>
					<form class="add:the-list:" action="<?php 
                    echo esc_url($this->get_link());
                    ?>
" method="post" id="addusergroup" name="addusergroup">
					<div class="form-field form-required">
						<label for="name"><?php 
                    _e('Name', 'edit-flow');
                    ?>
</label>
						<input type="text" aria-required="true" id="name" name="name" maxlength="40" value="<?php 
                    if (!empty($_POST['name'])) {
                        echo esc_attr($_POST['name']);
                    }
                    ?>
" />
						<?php 
                    $edit_flow->settings->helper_print_error_or_description('name', __('The name is used to identify the user group.', 'edit-flow'));
                    ?>
					</div>
					<div class="form-field">
						<label for="description"><?php 
                    _e('Description', 'edit-flow');
                    ?>
</label>
						<textarea cols="40" rows="5" id="description" name="description"><?php 
                    if (!empty($_POST['description'])) {
                        echo esc_html($_POST['description']);
                    }
                    ?>
</textarea>
						<?php 
                    $edit_flow->settings->helper_print_error_or_description('description', __('The description is primarily for administrative use, to give you some context on what the user group is to be used for.', 'edit-flow'));
                    ?>
					</div>
					<?php 
                    wp_nonce_field('add-usergroup');
                    ?>
					<?php 
                    echo '<input id="form-action" name="form-action" type="hidden" value="add-usergroup" />';
                    ?>
					<p class="submit"><?php 
                    submit_button(__('Add New User Group', 'edit-flow'), 'primary', 'submit', false);
                    ?>
<a class="cancel-settings-link" href="<?php 
                    echo EDIT_FLOW_SETTINGS_PAGE;
                    ?>
"><?php 
                    _e('Back to Edit Flow', 'edit-flow');
                    ?>
</a></p>
					</form>
				<?php 
                }
                ?>
			</div></div></div>
			<?php 
                $wp_list_table->inline_edit();
                ?>
		<?php 
            }
        }
        function show_options_page()
        {
            $messages = array();
            $messages[1] = __('Settings updated.', 'expirepassword');
            $messages[2] = __('Settings could not be updated.', 'expirepassword');
            ?>
			<div class="wrap">
			<div class="icon32" id="icon-options-general"><br></div>
			<h2><?php 
            _e('Expire Password Settings', 'expirepassword');
            ?>
</h2>

			<?php 
            if (isset($_GET['msg'])) {
                echo '<div id="message" class="updated fade"><p>' . $messages[(int) $_GET['msg']] . '</p></div>';
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('msg'), $_SERVER['REQUEST_URI']);
            }
            ?>

			<form action="?page=<?php 
            echo esc_attr($_GET['page']);
            ?>
" method="post">
				<input type='hidden' name='action' value='updateexpirepassword' />
				<?php 
            wp_original_referer_field(true, 'previous');
            wp_nonce_field('update-expirespasswordsettings');
            if (is_network_admin()) {
                // Add in network admin specific options here
                ?>
					<h3><?php 
                _e('Restrict Settings Access', 'expirepassword');
                ?>
</h3>
					<table class="form-table">
						<tbody>
							<tr valign="top">
								<th scope="row">
									<label for="expirepassword_limittonetworkadmin"><?php 
                _e('Limit Settings to Network Admin', 'expirepassword');
                ?>
</label>
								</th>
								<td>
									<?php 
                $limittonetworkadmin = get_site_option('_shrkey_limit_expirepasswords_to_networkadmin', 'no');
                ?>
									<select name='expirepassword_limittonetworkadmin'>
										<option value='no' <?php 
                selected('no', $limittonetworkadmin);
                ?>
><?php 
                _e('No, thanks', 'expirepassword');
                ?>
</option>
										<option value='yes' <?php 
                selected('yes', $limittonetworkadmin);
                ?>
><?php 
                _e('Yes, please', 'expirepassword');
                ?>
</option>
									</select>
									<br>
									<?php 
                _e('Set this to <strong>Yes, please</strong> if you do not want individual site admin pages.', 'expirepassword');
                ?>
								</td>
							</tr>
						</tbody>
					</table>
					<?php 
            }
            ?>
					<h3><?php 
            _e('Registration Settings', 'expirepassword');
            ?>
</h3>
					<p><?php 
            _e('You can use this option to force a new user to change their password from the system generated one when they first sign in.', 'expirepassword');
            ?>
</p>
					<table class="form-table">
						<tbody>
							<tr valign="top">
								<th scope="row">
									<label for="expirepassword_expireimmediately"><?php 
            _e('Force change on first sign in', 'expirepassword');
            ?>
</label>
								</th>
								<td>
									<?php 
            $expireimmediately = shrkey_get_option('_shrkey_expirepassword_expireimmediately', 'no');
            ?>
									<select name='expirepassword_expireimmediately'>
										<option value='no' <?php 
            selected('no', $expireimmediately);
            ?>
><?php 
            _e('No, thanks', 'expirepassword');
            ?>
</option>
										<option value='yes' <?php 
            selected('yes', $expireimmediately);
            ?>
><?php 
            _e('Yes, please', 'expirepassword');
            ?>
</option>
									</select>
								</td>
							</tr>
						</tbody>
					</table>

					<h3><?php 
            _e('Automatic Expiration Settings', 'expirepassword');
            ?>
</h3>
					<p><?php 
            _e('You can set passwords to automatically expire after a set period of time. The expiration timer for a user will start the next time the user logs in to the site.', 'expirepassword');
            ?>
</p>
					<table class="form-table">
						<tbody>
							<tr valign="top">
								<th scope="row">
									<label for="expirepassword_expirationperiod"><?php 
            _e('Expiration period', 'expirepassword');
            ?>
</label>
								</th>
								<td>
									<?php 
            $expirationperiod = shrkey_get_option('_shrkey_expirepassword_expirationperiod', 0);
            ?>
									<select name='expirepassword_expirationperiod'>
										<?php 
            for ($n = 0; $n <= (int) EXPIREPASSWORD_MAXIMUM_PERIOD; $n++) {
                switch ($n) {
                    case 0:
                        ?>
															<option value='<?php 
                        echo $n;
                        ?>
' <?php 
                        selected($n, $expirationperiod);
                        ?>
><?php 
                        _e('No automatic expiration', 'expirepassword');
                        ?>
</option>
															<?php 
                        break;
                    case 1:
                        ?>
															<option value='<?php 
                        echo $n;
                        ?>
' <?php 
                        selected($n, $expirationperiod);
                        ?>
><?php 
                        echo sprintf(__('%d day', 'expirepassword'), $n);
                        ?>
</option>
															<?php 
                        break;
                    default:
                        ?>
															<option value='<?php 
                        echo $n;
                        ?>
' <?php 
                        selected($n, $expirationperiod);
                        ?>
><?php 
                        echo sprintf(__('%d days', 'expirepassword'), $n);
                        ?>
</option>
															<?php 
                        break;
                }
            }
            ?>
									</select>
								</td>
							</tr>
						</tbody>
					</table>

					<h3><?php 
            _e('Post Password Change Settings', 'expirepassword');
            ?>
</h3>
					<p><?php 
            _e('Once a password has been changed, you can either force the user to login again with the new details, or complete the authentication process and log them in automatically.', 'expirepassword');
            ?>
</p>
					<table class="form-table">
						<tbody>
							<tr valign="top">
								<th scope="row">
									<label for="expirepassword_autoauthenticate"><?php 
            _e('Force Re-Login', 'expirepassword');
            ?>
</label>
								</th>
								<td>
									<?php 
            $autoauthenticate = shrkey_get_option('_shrkey_expirepassword_autoauthenticate', 'no');
            ?>
									<select name='expirepassword_autoauthenticate'>
										<option value='yes' <?php 
            selected('yes', $expireimmediately);
            ?>
><?php 
            _e('No, let the user carry on to their destination', 'expirepassword');
            ?>
</option>
										<option value='no' <?php 
            selected('no', $expireimmediately);
            ?>
><?php 
            _e('Yes, send the user to the login page', 'expirepassword');
            ?>
</option>
									</select>
								</td>
							</tr>
						</tbody>
					</table>

				<p class="submit">
					<input type="submit" value="<?php 
            _e('Save Changes', 'expirepassword');
            ?>
" class="button button-primary" id="submit" name="submit">
				</p>

			</form>

			</div>
			<?php 
        }
示例#11
0
/**
 * gmediaLib()
 *
 * @return mixed content
 */
function gmediaLib()
{
    global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
    $url = add_query_arg(array('page' => $gmProcessor->page, 'mode' => $gmProcessor->mode), admin_url('admin.php'));
    $endpoint = $gmGallery->options['endpoint'];
    $gm_screen_options = get_user_meta($user_ID, 'gm_screen_options', true);
    if (!is_array($gm_screen_options)) {
        $gm_screen_options = array();
    }
    $gm_screen_options = array_merge($gmGallery->options['gm_screen_options'], $gm_screen_options);
    if ($gmCore->caps['gmedia_show_others_media']) {
        if ($author = $gmCore->_get('author')) {
            $author = wp_parse_id_list($author);
        }
    } else {
        $author = array($user_ID);
    }
    $gmedia__in = $gmCore->_get('gmedia__in', null);
    $search_string = $gmCore->_get('s', null);
    if ('#' == substr($search_string, 0, 1)) {
        $gmedia__in = substr($search_string, 1);
        $search_string = null;
    }
    $orderby = $gm_screen_options['orderby_gmedia'];
    $order = $gm_screen_options['sortorder_gmedia'];
    if ('selected' == $gmCore->_req('filter') && !empty($gmProcessor->selected_items)) {
        $gmedia__in = $gmProcessor->selected_items;
        $orderby = 'gmedia__in';
        $order = 'ASC';
    }
    $args = array('mime_type' => $gmCore->_get('mime_type', null), 'orderby' => $orderby, 'order' => $order, 'per_page' => $gm_screen_options['per_page_gmedia'], 'page' => $gmCore->_get('pager', 1), 'tag_id' => $gmCore->_get('tag_id', null), 'tag__in' => $gmCore->_get('tag__in', null), 'cat' => $gmCore->_get('cat', null), 'category__in' => $gmCore->_get('category__in', null), 'alb' => $gmCore->_get('alb', null), 'album__in' => $gmCore->_get('album__in', null), 'author__in' => $author, 'gmedia__in' => $gmedia__in, 's' => $search_string);
    $custom_filter = false;
    if ($filter_id = (int) $gmCore->_get('custom_filter', 0)) {
        if ($gmedia_filter = $gmDB->get_term($filter_id, 'gmedia_filter')) {
            if ($gmedia_filter->global == $user_ID || $gmCore->caps['gmedia_show_others_media']) {
                $_args = $gmDB->get_metadata('gmedia_term', $gmedia_filter->term_id, 'query', true);
                $args = array_merge($args, $_args);
                $custom_filter = $gmedia_filter->name;
            } else {
                echo $gmProcessor->alert('danger', __('You are not allowed to see others media', 'gmLang'));
            }
        }
    }
    $gmediaQuery = $gmDB->get_gmedias($args);
    $gm_qty = array('total' => '', 'image' => '', 'audio' => '', 'video' => '', 'text' => '', 'application' => '', 'other' => '');
    $gmDbCount = $gmDB->count_gmedia();
    foreach ($gmDbCount as $key => $value) {
        $gm_qty[$key] = '<span class="badge pull-right">' . (int) $value . '</span>';
    }
    ?>
	<?php 
    if (!empty($author)) {
        ?>
		<div class="custom-message alert alert-info" xmlns="http://www.w3.org/1999/html">
			<strong><?php 
        _e('Selected Authors:', 'gmLang');
        ?>
</strong>
			<?php 
        $sep = '';
        foreach ($author as $a) {
            echo $sep . '<a href="#libModal" data-modal="filter_authors" data-action="gmedia_get_modal" class="gmedia-modal">' . get_the_author_meta('display_name', $a) . '</a>';
            $sep = ', ';
        }
        ?>
		</div>
	<?php 
    }
    ?>
	<?php 
    if ($custom_filter) {
        ?>
		<div class="custom-message alert alert-info" xmlns="http://www.w3.org/1999/html">
			<strong><?php 
        _e('Selected Filter:', 'gmLang');
        ?>
</strong>
			<a href="#libModal" data-modal="custom_filters" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
        echo $custom_filter;
        ?>
</a>
		</div>
	<?php 
    }
    ?>
	<div class="panel panel-default" id="gmedia-panel">
	<div class="panel-heading clearfix">
		<form class="form-inline gmedia-search-form" role="search">
			<div class="form-group">
				<?php 
    foreach ($_GET as $key => $value) {
        if (in_array($key, array('page', 'mode', 'author', 'mime_type', 'tag_id', 'tag__in', 'cat', 'category__in', 'alb', 'album__in'))) {
            ?>
						<input type="hidden" name="<?php 
            echo $key;
            ?>
" value="<?php 
            echo $value;
            ?>
"/>
					<?php 
        }
    }
    ?>
				<input id="gmedia-search" class="form-control input-sm" type="text" name="s" placeholder="<?php 
    _e('Search...', 'gmLang');
    ?>
" value="<?php 
    echo $gmCore->_get('s', '');
    ?>
"/>
			</div>
			<button type="submit" class="btn btn-default input-sm"><span class="glyphicon glyphicon-search"></span></button>
		</form>
		<?php 
    echo $gmDB->query_pager();
    ?>

		<div class="btn-toolbar pull-left">
			<?php 
    if (!$gmProcessor->mode) {
        ?>
				<div class="btn-group gm-checkgroup" id="cb_global-btn">
					<span class="btn btn-default active"><input class="doaction" id="cb_global" data-group="cb_media-object" type="checkbox"/></span>
					<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
						<span class="sr-only"><?php 
        _e('Toggle Dropdown', 'gmLang');
        ?>
</span></button>
					<ul class="dropdown-menu" role="menu">
						<li><a data-select="total" href="#"><?php 
        _e('All', 'gmLang');
        ?>
</a></li>
						<li><a data-select="none" href="#"><?php 
        _e('None', 'gmLang');
        ?>
</a></li>
						<li class="divider"></li>
						<li><a data-select="image" href="#"><?php 
        _e('Images', 'gmLang');
        ?>
</a></li>
						<li><a data-select="audio" href="#"><?php 
        _e('Audio', 'gmLang');
        ?>
</a></li>
						<li><a data-select="video" href="#"><?php 
        _e('Video', 'gmLang');
        ?>
</a></li>
						<li class="divider"></li>
						<li><a data-select="reverse" href="#" title="<?php 
        _e('Reverse only visible items', 'gmLang');
        ?>
"><?php 
        _e('Reverse', 'gmLang');
        ?>
</a></li>
					</ul>
				</div>
			<?php 
    }
    ?>

			<div class="btn-group">
				<?php 
    $curr_mime = explode(',', $gmCore->_get('mime_type', 'total'));
    ?>
				<?php 
    if ($gmDB->filter) {
        ?>
					<a class="btn btn-warning" title="<?php 
        _e('Reset Filter', 'gmLang');
        ?>
" rel="total" href="<?php 
        echo $url;
        ?>
"><?php 
        _e('Filter', 'gmLang');
        ?>
</a>
				<?php 
    } else {
        ?>
					<button type="button" class="btn btn-default"><?php 
        _e('Filter', 'gmLang');
        ?>
</button>
				<?php 
    }
    ?>
				<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
					<span class="caret"></span>
					<span class="sr-only"><?php 
    _e('Toggle Dropdown', 'gmLang');
    ?>
</span>
				</button>
				<ul class="dropdown-menu" role="menu">
					<li role="presentation" class="dropdown-header"><?php 
    _e('FILTER BY AUTHOR', 'gmLang');
    ?>
</li>
					<li class="gmedia_author">
						<a href="#libModal" data-modal="filter_authors" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
    if (!empty($author)) {
        $sep = '';
        foreach ($author as $a) {
            echo $sep . get_the_author_meta('display_name', $a);
            $sep = ', ';
        }
    } else {
        _e('Show all authors', 'gmLang');
    }
    ?>
</a></li>
					<li role="presentation" class="dropdown-header"><?php 
    _e('TYPE', 'gmLang');
    ?>
</li>
					<li class="total<?php 
    if (in_array('total', $curr_mime)) {
        echo ' active';
    }
    ?>
"><a rel="total" href="<?php 
    echo $gmCore->get_admin_url(array(), array('mime_type', 'pager'));
    ?>
"><?php 
    echo $gm_qty['total'];
    _e('All', 'gmLang');
    ?>
</a></li>
					<li class="image<?php 
    if (in_array('image', $curr_mime)) {
        echo ' active';
    }
    if (!$gmDbCount['image']) {
        echo ' disabled';
    }
    ?>
"><a rel="image" href="<?php 
    echo $gmCore->get_admin_url(array('mime_type' => 'image'), array('pager'));
    ?>
"><?php 
    echo $gm_qty['image'];
    _e('Images', 'gmLang');
    ?>
</a></li>
					<li class="audio<?php 
    if (in_array('audio', $curr_mime)) {
        echo ' active';
    }
    if (!$gmDbCount['audio']) {
        echo ' disabled';
    }
    ?>
"><a rel="audio" href="<?php 
    echo $gmCore->get_admin_url(array('mime_type' => 'audio'), array('pager'));
    ?>
"><?php 
    echo $gm_qty['audio'];
    _e('Audio', 'gmLang');
    ?>
</a></li>
					<li class="video<?php 
    if (in_array('video', $curr_mime)) {
        echo ' active';
    }
    if (!$gmDbCount['video']) {
        echo ' disabled';
    }
    ?>
"><a rel="video" href="<?php 
    echo $gmCore->get_admin_url(array('mime_type' => 'video'), array('pager'));
    ?>
"><?php 
    echo $gm_qty['video'];
    _e('Video', 'gmLang');
    ?>
</a></li>
					<li class="application<?php 
    if (in_array('application', $curr_mime) || in_array('text', $curr_mime)) {
        echo ' active';
    }
    if (!$gmDbCount['application']) {
        echo ' disabled';
    }
    ?>
">
						<a rel="application" href="<?php 
    echo $gmCore->get_admin_url(array('mime_type' => 'application,text'), array('pager'));
    ?>
"><?php 
    echo $gm_qty['other'];
    _e('Other', 'gmLang');
    ?>
</a></li>
					<li role="presentation" class="dropdown-header"><?php 
    _e('COLLECTIONS', 'gmLang');
    ?>
</li>
					<li class="filter_categories<?php 
    if (isset($gmDB->filter_tax['gmedia_category'])) {
        echo ' active';
    }
    ?>
">
						<a href="#libModal" data-modal="filter_categories" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
    _e('Categories', 'gmLang');
    ?>
</a>
					</li>
					<li class="filter_albums<?php 
    if (isset($gmDB->filter_tax['gmedia_album'])) {
        echo ' active';
    }
    ?>
"><a href="#libModal" data-modal="filter_albums" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
    _e('Albums', 'gmLang');
    ?>
</a></li>
					<li class="filter_tags<?php 
    if (isset($gmDB->filter_tax['gmedia_tag'])) {
        echo ' active';
    }
    ?>
"><a href="#libModal" data-modal="filter_tags" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
    _e('Tags', 'gmLang');
    ?>
</a></li>
					<li class="divider"></li>
					<li class="custom_filters"><a href="#libModal" data-modal="custom_filters" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
    _e('Custom Filters', 'gmLang');
    ?>
</a></li>
					<?php 
    do_action('gmedia_filter_list');
    ?>
				</ul>
			</div>

			<div class="btn-group">
				<?php 
    if (!$gmProcessor->mode) {
        $args = array('mode' => 'edit');
        $edit_mode_href = $gmCore->get_admin_url($args);
        $args2 = array('mode' => 'edit', 'filter' => 'selected', 'pager' => false, 's' => false);
        $edit_mode_data = 'data-href="' . $edit_mode_href . '" data-href_sel="' . $gmCore->get_admin_url($args2) . '"';
    } else {
        $edit_mode_href = $gmCore->get_admin_url(array(), array('mode'));
        $edit_mode_data = '';
    }
    ?>
				<?php 
    if ($gmCore->caps['gmedia_edit_media']) {
        ?>
					<a class="btn btn-default edit-mode-link" title="<?php 
        _e('Toggle Edit Mode', 'gmLang');
        ?>
" href="<?php 
        echo $edit_mode_href;
        ?>
" <?php 
        echo $edit_mode_data;
        ?>
><?php 
        _e('Action', 'gmLang');
        ?>
</a>
				<?php 
    } else {
        ?>
					<button type="button" class="btn btn-default"><?php 
        _e('Action', 'gmLang');
        ?>
</button>
				<?php 
    }
    ?>
				<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
					<span class="sr-only"><?php 
    _e('Toggle Dropdown', 'gmLang');
    ?>
</span></button>
				<?php 
    $rel_selected_show = 'rel-selected-show';
    $rel_selected_hide = 'rel-selected-hide';
    ?>
				<ul class="dropdown-menu" role="menu">
					<?php 
    if (!$gmProcessor->mode) {
        ?>
						<li class="<?php 
        if (!$gmCore->caps['gmedia_edit_media']) {
            echo 'disabled';
        }
        ?>
"><a class="edit-mode-link" href="<?php 
        echo $edit_mode_href;
        ?>
" <?php 
        echo $edit_mode_data;
        ?>
><?php 
        _e('Enter Edit Mode', 'gmLang');
        ?>
</a>
						</li>
						<li class="<?php 
        echo $rel_selected_show;
        if (!$gmCore->caps['gmedia_edit_media']) {
            echo ' disabled';
        }
        ?>
">
							<a href="#libModal" data-modal="batch_edit" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
        _e('Batch Edit', 'gmLang');
        ?>
</a>
						</li>

						<li class="divider"></li>
						<li class="<?php 
        echo $rel_selected_show;
        if (!$gmCore->caps['gmedia_gallery_manage']) {
            echo ' disabled';
        }
        ?>
">
							<a href="#libModal" data-modal="quick_gallery" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
        _e('Quick Gallery from Selected', 'gmLang');
        ?>
</a>
						</li>
						<li class="<?php 
        echo $rel_selected_show;
        if (!$gmCore->caps['gmedia_terms']) {
            echo ' disabled';
        }
        ?>
">
							<a href="#libModal" data-modal="assign_category" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
        _e('Assign Category...', 'gmLang');
        ?>
</a>
						</li>
						<li class="<?php 
        echo $rel_selected_show;
        if (!$gmCore->caps['gmedia_terms']) {
            echo ' disabled';
        }
        ?>
">
							<a href="#libModal" data-modal="assign_album" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
        _e('Move to Album...', 'gmLang');
        ?>
</a>
						</li>
						<li class="<?php 
        echo $rel_selected_show;
        if (!$gmCore->caps['gmedia_terms']) {
            echo ' disabled';
        }
        ?>
"><a href="#libModal" data-modal="add_tags" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
        _e('Add Tags...', 'gmLang');
        ?>
</a>
						</li>
						<li class="<?php 
        echo $rel_selected_show;
        if (!$gmCore->caps['gmedia_terms']) {
            echo ' disabled';
        }
        ?>
">
							<a href="#libModal" data-modal="delete_tags" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
        _e('Delete Tags...', 'gmLang');
        ?>
</a>
						</li>
						<li class="<?php 
        echo $rel_selected_show;
        if (!$gmCore->caps['gmedia_delete_media']) {
            echo ' disabled';
        }
        ?>
">
							<a href="<?php 
        echo wp_nonce_url($gmCore->get_admin_url(array('delete' => 'selected'), array('filter')), 'gmedia_delete');
        ?>
" class="gmedia-delete" data-confirm="<?php 
        _e("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang");
        ?>
"><?php 
        _e('Delete Selected Items', 'gmLang');
        ?>
</a>
						</li>

						<li class="divider <?php 
        echo $rel_selected_show;
        ?>
"></li>
						<li class="<?php 
        echo $rel_selected_show;
        if (!$gmCore->caps['gmedia_edit_media']) {
            echo ' disabled';
        }
        ?>
">
							<a href="<?php 
        echo wp_nonce_url($gmCore->get_admin_url(array('update_meta' => 'selected'), array()), 'gmedia_update_meta');
        ?>
" class="gmedia-update"><?php 
        _e('Update Metadata in Database', 'gmLang');
        ?>
</a>
						</li>

						<li class="dropdown-header <?php 
        echo $rel_selected_hide;
        ?>
"><span><?php 
        _e("Select items to see more actions", "gmLang");
        ?>
</span></li>
					<?php 
    } else {
        ?>
						<li><a href="<?php 
        echo $edit_mode_href;
        ?>
"><?php 
        _e('Exit Edit Mode', 'gmLang');
        ?>
</a></li>
					<?php 
    }
    do_action('gmedia_action_list');
    ?>
				</ul>
			</div>

			<?php 
    $filter_selected = $gmCore->_req('filter');
    $filter_selected_arg = $filter_selected ? false : 'selected';
    ?>
			<form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php 
    echo add_query_arg(array('filter' => $filter_selected_arg), $url);
    ?>
" method="post">
				<button type="submit" class="btn btn<?php 
    echo 'selected' == $filter_selected ? '-success' : '-info';
    ?>
"><?php 
    printf(__('%s selected', 'gmLang'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>');
    ?>
</button>
				<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
					<span class="sr-only"><?php 
    _e('Toggle Dropdown', 'gmLang');
    ?>
</span></button>
				<input type="hidden" id="gm-selected" data-userid="<?php 
    echo $user_ID;
    ?>
" data-key="library" name="selected_items" value="<?php 
    echo implode(',', $gmProcessor->selected_items);
    ?>
"/>
				<ul class="dropdown-menu" role="menu">
					<li><a id="gm-selected-show" href="#show"><?php 
    if (!$filter_selected) {
        _e('Show only selected items', 'gmLang');
    } else {
        _e('Show all gmedia items', 'gmLang');
    }
    ?>
</a></li>
					<li><a id="gm-selected-clear" href="#clear"><?php 
    _e('Clear selected items', 'gmLang');
    ?>
</a></li>
					<li class="<?php 
    if (!$gmCore->caps['gmedia_gallery_manage']) {
        echo 'disabled';
    }
    ?>
">
						<a href="#libModal" data-modal="quick_gallery" data-action="gmedia_get_modal" class="gmedia-modal"><?php 
    _e('Quick Gallery from Selected', 'gmLang');
    ?>
</a>
					</li>
				</ul>
			</form>

		</div>

	</div>
	<div class="panel-body"></div>
	<div class="list-group" id="gm-list-table">
	<?php 
    if (count($gmediaQuery)) {
        if ($gmProcessor->mode && $gmCore->caps['gmedia_show_others_media'] && !$gmCore->caps['gmedia_edit_others_media']) {
            ?>
		<div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
			<button type="button" class="close" data-dismiss="alert">
				<span aria-hidden="true">&times;</span><span class="sr-only"><?php 
            _e('Close', 'gmLang');
            ?>
</span></button>
			<strong><?php 
            _e('Info:', 'gmLang');
            ?>
</strong> <?php 
            _e('You are not allowed to edit others media', 'gmLang');
            ?>
		</div>
	<?php 
        }
        foreach ($gmediaQuery as $item) {
            $meta = $gmDB->get_metadata('gmedia', $item->ID);
            $_metadata = $gmDB->get_metadata('gmedia', $item->ID, '_metadata', true);
            $type = explode('/', $item->mime_type);
            $item_url = $gmCore->upload['url'] . '/' . $gmGallery->options['folder'][$type[0]] . '/' . $item->gmuid;
            $item_path = $gmCore->upload['path'] . '/' . $gmGallery->options['folder'][$type[0]] . '/' . $item->gmuid;
            if (function_exists('exif_imagetype')) {
                $is_webimage = 'image' == $type[0] && in_array(exif_imagetype($item_path), array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) ? true : false;
            } else {
                $is_webimage = 'image' == $type[0] && in_array($type[1], array('jpeg', 'png', 'gif')) ? true : false;
            }
            $modal_width = isset($_metadata['original']['width']) ? $_metadata['original']['width'] : (isset($_metadata['width']) ? $_metadata['width'] : '900');
            $modal_height = isset($_metadata['original']['height']) ? $_metadata['original']['height'] : (isset($_metadata['height']) ? $_metadata['height'] : '300');
            $modal_web_width = isset($_metadata['web']['width']) ? $_metadata['web']['width'] : (isset($_metadata['width']) ? $_metadata['width'] : '640');
            $modal_web_height = isset($_metadata['web']['height']) ? $_metadata['web']['height'] : (isset($_metadata['height']) ? $_metadata['height'] : '200');
            $tags = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_tag');
            $albs = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_album');
            $cats = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_category');
            $list_row_class = '';
            if ('public' != $item->status) {
                if ('private' == $item->status) {
                    $list_row_class = ' list-group-item-info';
                } elseif ('draft' == $item->status) {
                    $list_row_class = ' list-group-item-warning';
                }
            }
            ?>
	<?php 
            if (!$gmProcessor->mode) {
                $is_selected = in_array($item->ID, $gmProcessor->selected_items) ? true : false;
                ?>
		<div class="list-group-item d-row clearfix<?php 
                echo ($is_selected ? ' active-row' : '') . $list_row_class;
                ?>
" id="list-item-<?php 
                echo $item->ID;
                ?>
" data-id="<?php 
                echo $item->ID;
                ?>
" data-type="<?php 
                echo $type[0];
                ?>
">
			<div class="gmedia_id">#<?php 
                echo $item->ID;
                ?>
</div>
			<label class="cb_media-object col-sm-4" style="max-width:350px;">
				<input name="doaction[]" type="checkbox"<?php 
                echo $is_selected ? ' checked="checked"' : '';
                ?>
 data-type="<?php 
                echo $type[0];
                ?>
" class="hidden" value="<?php 
                echo $item->ID;
                ?>
"/>
				<span data-target="<?php 
                echo $item_url;
                ?>
" class="thumbnail">
					<?php 
                if ('image' == $type[0]) {
                    ?>
						<img class="gmedia-thumb" src="<?php 
                    echo $gmCore->gm_get_media_image($item, 'thumb');
                    ?>
" alt=""/>
					<?php 
                } else {
                    $typethumb = false;
                    ?>
						<?php 
                    if (isset($meta['cover'][0]) && !empty($meta['cover'][0])) {
                        $typethumb = true;
                        ?>
							<img class="gmedia-thumb" src="<?php 
                        echo $gmCore->gm_get_media_image($item, 'thumb');
                        ?>
" alt=""/>
						<?php 
                    } elseif (isset($_metadata['image']['data']) && !empty($_metadata['image']['data'])) {
                        $typethumb = true;
                        ?>
							<img class="gmedia-thumb" src="<?php 
                        echo $_metadata['image']['data'];
                        ?>
" alt=""/>
						<?php 
                    } else {
                        ?>
							<img class="gmedia-thumb" src="<?php 
                        echo $gmCore->gm_get_media_image($item, 'thumb', false);
                        ?>
" alt=""/>
						<?php 
                    }
                    ?>
						<?php 
                    if ($typethumb) {
                        ?>
							<img class="gmedia-typethumb" src="<?php 
                        echo $gmCore->gm_get_media_image($item, 'thumb', false);
                        ?>
" alt=""/>
						<?php 
                    }
                    ?>
					<?php 
                }
                ?>
				</span>
			</label>

			<div class="col-sm-8">
				<div class="row" style="margin:0;">
					<div class="col-lg-6">
						<p class="media-title"><?php 
                echo esc_html($item->title);
                ?>
&nbsp;</p>

						<div class="in-library media-caption"><?php 
                echo nl2br(esc_html($item->description));
                ?>
</div>

						<p class="media-meta"><span class="label label-default"><?php 
                _e('Album', 'gmLang');
                ?>
:</span>
							<?php 
                if ($albs) {
                    $terms_album = array();
                    foreach ($albs as $c) {
                        $terms_album[] = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => $c->term_id), $url)), esc_html($c->name));
                    }
                    $terms_album = join(', ', $terms_album);
                } else {
                    $terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => 0), $url)), '&#8212;');
                }
                echo $terms_album;
                if ($is_webimage) {
                    ?>
								<br/><span class="label label-default"><?php 
                    _e('Category', 'gmLang');
                    ?>
:</span>
								<?php 
                    if ($cats) {
                        $terms_category = array();
                        foreach ($cats as $c) {
                            $terms_category[] = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $c->term_id), $url)), esc_html($gmGallery->options['taxonomies']['gmedia_category'][$c->name]));
                        }
                        $terms_category = join(', ', $terms_category);
                    } else {
                        $terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => 0), $url)), __('Uncategorized', 'gmLang'));
                    }
                    echo $terms_category;
                }
                ?>
							<br/><span class="label label-default"><?php 
                _e('Tags', 'gmLang');
                ?>
:</span>
							<?php 
                if ($tags) {
                    $terms_tag = array();
                    foreach ($tags as $c) {
                        $terms_tag[] = sprintf('<a class="tag" href="%s">%s</a>', esc_url(add_query_arg(array('tag_id' => $c->term_id), $url)), esc_html($c->name));
                    }
                    $terms_tag = join(', ', $terms_tag);
                } else {
                    $terms_tag = '&#8212;';
                }
                echo $terms_tag;
                ?>

							<br/><span class="label label-default"><?php 
                _e('Views / Likes', 'gmLang');
                ?>
:</span>
								<?php 
                echo (isset($meta['views'][0]) ? $meta['views'][0] : '0') . ' / ' . (isset($meta['likes'][0]) ? $meta['likes'][0] : '0');
                ?>
							<?php 
                if (isset($meta['rating'][0])) {
                    $ratings = maybe_unserialize($meta['rating'][0]);
                    ?>
								<br/><span class="label label-default"><?php 
                    _e('Rating', 'gmLang');
                    ?>
:</span> <?php 
                    echo $ratings['value'] . ' / ' . $ratings['votes'];
                    ?>
							<?php 
                }
                ?>
						</p>
					</div>
					<div class="col-lg-6">
						<div class="media-meta">
							<span class="label label-default"><?php 
                _e('Status', 'gmLang');
                ?>
:</span> <?php 
                echo $item->status;
                ?>
						</div>
						<div class="media-meta">
							<span class="label label-default"><?php 
                _e('Type', 'gmLang');
                ?>
:</span> <?php 
                echo $item->mime_type;
                ?>
						</div>
						<?php 
                if ('image' == $type[0]) {
                    ?>
							<div class="media-meta">
								<span class="label label-default"><?php 
                    _e('Size', 'gmLang');
                    ?>
:</span> <?php 
                    echo $_metadata['original']['width'] . ' × ' . $_metadata['original']['height'];
                    ?>
							</div>
						<?php 
                }
                ?>
						<div class="media-meta"><span class="label label-default"><?php 
                _e('Filename', 'gmLang');
                ?>
:</span>
							<a href="<?php 
                echo $item_url;
                ?>
"><?php 
                echo $item->gmuid;
                ?>
</a></div>
						<div class="media-meta">
							<span class="label label-default"><?php 
                _e('Author', 'gmLang');
                ?>
:</span> <?php 
                printf('<a class="gmedia-author" href="%s">%s</a>', esc_url(add_query_arg(array('author' => $item->author), $url)), get_user_option('display_name', $item->author));
                ?>
						</div>
						<div class="media-meta"><span class="label label-default"><?php 
                _e('Date', 'gmLang');
                ?>
:</span> <?php 
                echo $item->date;
                echo ' <small class="modified" title="' . __('Last Modified Date', 'gmLang') . '">' . ($item->modified != $item->date ? $item->modified : '') . '</small>';
                ?>
</div>
						<div class="media-meta"><span class="label label-default"><?php 
                _e('Link', 'gmLang');
                ?>
:</span>
							<?php 
                if (!empty($item->link)) {
                    ?>
								<a href="<?php 
                    echo $item->link;
                    ?>
"><?php 
                    echo $item->link;
                    ?>
</a>
							<?php 
                } else {
                    echo '&#8212;';
                }
                ?>
</div>

						<p class="media-meta" style="margin:5px 4px;">
							<?php 
                $media_action_links = array();
                if ($gmCore->caps['gmedia_edit_media'] && (int) $item->author == get_current_user_id() || $gmCore->caps['gmedia_edit_others_media']) {
                    $gmedia_hashid = gmedia_hash_id_encode($item->ID, 'single');
                    if (get_option('permalink_structure')) {
                        $cloud_link = home_url(urlencode($endpoint) . '/s/' . $gmedia_hashid);
                    } else {
                        $cloud_link = add_query_arg(array("{$endpoint}" => $gmedia_hashid, 't' => 's'), home_url('index.php'));
                    }
                    $media_action_links[] = '<a target="_blank" data-target="#shareModal" data-share="' . $item->ID . '" class="share-modal" title="' . __('GmediaCloud Page', 'gmLang') . '" href="' . $cloud_link . '">' . __('Share', 'gmLang') . '</a>';
                    $media_action_links[] = '<a href="' . admin_url("admin.php?page=GrandMedia&mode=edit&gmedia__in={$item->ID}") . '">' . __('Edit Data', 'gmLang') . '</a>';
                }
                if ('image' == $type[0]) {
                    if ($gmCore->caps['gmedia_edit_media'] && (int) $item->author == get_current_user_id() || $gmCore->caps['gmedia_edit_others_media']) {
                        $media_action_links[] = '<a href="' . admin_url("admin.php?page=GrandMedia&gmediablank=image_editor&id={$item->ID}") . '" data-target="#gmeditModal" class="gmedit-modal">' . __('Edit Image', 'gmLang') . '</a>';
                    }
                    $media_action_links[] = '<a href="' . $gmCore->gm_get_media_image($item, 'original') . '" data-target="#previewModal" data-width="' . $modal_width . '" data-height="' . $modal_height . '" class="preview-modal" title="' . esc_attr($item->title) . '">' . __('View Original', 'gmLang') . '</a>';
                } elseif (in_array($type[1], array('mp4', 'mp3', 'mpeg', 'webm', 'ogg', 'wave', 'wav'))) {
                    $media_action_links[] = '<a href="' . $item_url . '" data-target="#previewModal" data-width="' . $modal_web_width . '" data-height="' . $modal_web_height . '" class="preview-modal" title="' . esc_attr($item->title) . '">' . __('Play', 'gmLang') . '</a>';
                }
                $metainfo = $gmCore->metadata_text($item->ID);
                if ($metainfo) {
                    $media_action_links[] = '<a href="#metaInfo" data-target="#previewModal" data-metainfo="' . $item->ID . '" class="preview-modal" title="' . __('Meta Info', 'gmLang') . '">' . __('Meta Info', 'gmLang') . '</a>';
                }
                if ($gmCore->caps['gmedia_delete_media'] && (int) $item->author == get_current_user_id() || $gmCore->caps['gmedia_delete_others_media']) {
                    $media_action_links[] = '<a class="text-danger" href="' . wp_nonce_url($gmCore->get_admin_url(array('delete' => $item->ID)), 'gmedia_delete') . '" data-confirm="' . sprintf(__("You are about to permanently delete %s file.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang"), $item->gmuid) . '">' . __('Delete', 'gmLang') . '</a>';
                    if ($gmCore->_get('showmore')) {
                        $media_action_links[] = '<a class="text-danger" href="' . wp_nonce_url($gmCore->get_admin_url(array('delete' => $item->ID, 'save_original_file' => 1)), 'gmedia_delete') . '" data-confirm="' . sprintf(__("You are about to delete record from DB for %s file.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang"), $item->gmuid) . '">' . __('Delete DB record (leave file on the server)', 'gmLang') . '</a>';
                    }
                }
                echo implode(' | ', $media_action_links);
                ?>
						</p>
						<?php 
                if ($metainfo) {
                    ?>
							<div class="metainfo hidden" id="metainfo_<?php 
                    echo $item->ID;
                    ?>
">
								<?php 
                    echo nl2br($metainfo);
                    ?>
							</div>
						<?php 
                }
                ?>

					</div>
				</div>
			</div>
		</div>

	<?php 
            } elseif ($gmCore->caps['gmedia_edit_media']) {
                ?>
		<?php 
                if ((int) $item->author != $user_ID && !$gmCore->caps['gmedia_edit_others_media']) {
                    ?>
		<div class="list-group-item row d-row" id="list-item-<?php 
                    echo $item->ID;
                    ?>
" data-id="<?php 
                    echo $item->ID;
                    ?>
" data-type="<?php 
                    echo $type[0];
                    ?>
">
			<div class="gmedia_id">#<?php 
                    echo $item->ID;
                    ?>
</div>
			<div class="li_media-object col-sm-4" style="max-width:350px;">
				<span data-target="<?php 
                    echo $item_url;
                    ?>
" class="thumbnail">
					<?php 
                    if ('image' == $type[0]) {
                        ?>
						<img class="gmedia-thumb" src="<?php 
                        echo $gmCore->gm_get_media_image($item, 'thumb');
                        ?>
" alt=""/>
					<?php 
                    } else {
                        $typethumb = false;
                        ?>
						<?php 
                        if (isset($meta['cover'][0]) && !empty($meta['cover'][0])) {
                            $typethumb = true;
                            ?>
							<img class="gmedia-thumb" src="<?php 
                            echo $gmCore->gm_get_media_image($item, 'thumb');
                            ?>
" alt=""/>
						<?php 
                        } elseif (isset($_metadata['image']['data']) && !empty($_metadata['image']['data'])) {
                            $typethumb = true;
                            ?>
							<img class="gmedia-thumb" src="<?php 
                            echo $_metadata['image']['data'];
                            ?>
" alt=""/>
						<?php 
                        } else {
                            ?>
							<img class="gmedia-thumb" src="<?php 
                            echo $gmCore->gm_get_media_image($item, 'thumb', false);
                            ?>
" alt=""/>
						<?php 
                        }
                        ?>
						<?php 
                        if ($typethumb) {
                            ?>
							<img class="gmedia-typethumb" src="<?php 
                            echo $gmCore->gm_get_media_image($item, 'thumb', false);
                            ?>
" alt=""/>
						<?php 
                        }
                        ?>
					<?php 
                    }
                    ?>
				</span>
			</div>

			<div class="col-sm-8">
				<div class="col-md-6">
					<p class="media-title"><?php 
                    echo esc_html($item->title);
                    ?>
&nbsp;</p>

					<p class="media-caption"><?php 
                    echo esc_html($item->description);
                    ?>
</p>

					<p class="media-meta"><span class="label label-default"><?php 
                    _e('Album', 'gmLang');
                    ?>
:</span>
						<?php 
                    if ($albs) {
                        $terms_album = array();
                        foreach ($albs as $c) {
                            $terms_album[] = sprintf('<span class="album">%s</span>', esc_html($c->name));
                        }
                        $terms_album = join(', ', $terms_album);
                    } else {
                        $terms_album = '<span class="album">&#8212;</span>';
                    }
                    echo $terms_album;
                    if ($is_webimage) {
                        ?>
							<br/><span class="label label-default"><?php 
                        _e('Category', 'gmLang');
                        ?>
:</span>
							<?php 
                        if ($cats) {
                            $terms_category = array();
                            foreach ($cats as $c) {
                                $terms_category[] = sprintf('<span class="category">%s</span>', esc_html($gmGallery->options['taxonomies']['gmedia_category'][$c->name]));
                            }
                            $terms_category = join(', ', $terms_category);
                        } else {
                            $terms_category = sprintf('<span class="category">%s</span>', __('Uncategorized'));
                        }
                        echo $terms_category;
                    }
                    ?>
						<br/><span class="label label-default"><?php 
                    _e('Tags', 'gmLang');
                    ?>
:</span>
						<?php 
                    if ($tags) {
                        $terms_tag = array();
                        foreach ($tags as $c) {
                            $terms_tag[] = sprintf('<span class="tag">%s</span>', esc_html($c->name));
                        }
                        $terms_tag = join(', ', $terms_tag);
                    } else {
                        $terms_tag = '&#8212;';
                    }
                    echo $terms_tag;
                    ?>
					</p>
				</div>
				<div class="col-md-6">
					<div class="media-meta">
						<span class="label label-default"><?php 
                    _e('Status', 'gmLang');
                    ?>
:</span> <?php 
                    echo $item->status;
                    ?>
					</div>
					<div class="media-meta">
						<span class="label label-default"><?php 
                    _e('Type', 'gmLang');
                    ?>
:</span> <?php 
                    echo $item->mime_type;
                    ?>
					</div>
					<?php 
                    if ('image' == $type[0]) {
                        ?>
						<div class="media-meta">
                            <span class="label label-default"><?php 
                        _e('Size', 'gmLang');
                        ?>
	                            :</span> <?php 
                        echo $_metadata['original']['width'] . ' × ' . $_metadata['original']['height'];
                        ?>
						</div>
					<?php 
                    }
                    ?>
					<div class="media-meta"><span class="label label-default"><?php 
                    _e('Filename', 'gmLang');
                    ?>
:</span>
						<a href="<?php 
                    echo $item_url;
                    ?>
"><?php 
                    echo $item->gmuid;
                    ?>
</a></div>
					<div class="media-meta">
                        <span class="label label-default"><?php 
                    _e('Author', 'gmLang');
                    ?>
	                        :</span> <?php 
                    printf('<span class="gmedia-author">%s</a>', get_user_option('display_name', $item->author));
                    ?>
					</div>
					<div class="media-meta"><span class="label label-default"><?php 
                    _e('Date', 'gmLang');
                    ?>
:</span> <?php 
                    echo $item->date;
                    echo ' <small class="modified" title="' . __('Last Modified Date', 'gmLang') . '">' . ($item->modified != $item->date ? $item->modified : '') . '</small>';
                    ?>
</div>
					<div class="media-meta"><span class="label label-default"><?php 
                    _e('Link', 'gmLang');
                    ?>
:</span>
						<?php 
                    if (!empty($item->link)) {
                        ?>
							<a href="<?php 
                        echo $item->link;
                        ?>
"><?php 
                        echo $item->link;
                        ?>
</a>
						<?php 
                    } else {
                        echo '&#8212;';
                    }
                    ?>
</div>
					<?php 
                    if ('image' == $type[0]) {
                        ?>
						<p class="media-meta" style="margin:5px 4px;">
							<a href="<?php 
                        echo $gmCore->gm_get_media_image($item, 'original');
                        ?>
" data-target="#previewModal" data-width="<?php 
                        echo $modal_width;
                        ?>
" data-height="<?php 
                        echo $modal_height;
                        ?>
" class="preview-modal" title="<?php 
                        echo esc_attr($item->title);
                        ?>
">
								<?php 
                        _e('View Original', 'gmLang');
                        ?>
							</a>
						</p>
					<?php 
                    } elseif (in_array($type[1], array('mp4', 'mp3', 'mpeg', 'webm', 'ogg', 'wave', 'wav'))) {
                        ?>
						<p class="media-meta" style="margin:5px 4px;">
							<a href="<?php 
                        echo $item_url;
                        ?>
" data-target="#previewModal" data-width="<?php 
                        echo $modal_web_width;
                        ?>
" data-height="<?php 
                        echo $modal_web_height;
                        ?>
" class="preview-modal" title="<?php 
                        echo esc_attr($item->title);
                        ?>
">
								<?php 
                        _e('Play', 'gmLang');
                        ?>
							</a>
						</p>
					<?php 
                    }
                    ?>
				</div>
			</div>
		</div>
		<?php 
                    continue;
                }
                ?>
		<form class="list-group-item row d-row edit-gmedia" id="list-item-<?php 
                echo $item->ID;
                ?>
" data-id="<?php 
                echo $item->ID;
                ?>
" data-type="<?php 
                echo $type[0];
                ?>
" role="form">
			<div class="col-sm-4" style="max-width:350px;">
				<input name="ID" type="hidden" value="<?php 
                echo $item->ID;
                ?>
"/>
				<?php 
                $media_action_links = array();
                if ('image' == $type[0]) {
                    ?>
					<a href="<?php 
                    echo $item_url;
                    ?>
" data-target="#previewModal" data-width="<?php 
                    echo $modal_web_width;
                    ?>
" data-height="<?php 
                    echo $modal_web_height;
                    ?>
" class="thumbnail preview-modal" title="<?php 
                    echo esc_attr($item->title);
                    ?>
">
						<img class="gmedia-thumb" src="<?php 
                    echo $gmCore->gm_get_media_image($item, 'thumb');
                    ?>
" alt=""/>
					</a>
					<?php 
                    $media_action_links[] = '<a href="' . admin_url("admin.php?page=GrandMedia&gmediablank=image_editor&id={$item->ID}") . '" data-target="#gmeditModal" class="btn btn-link btn-sm gmedit-modal">' . __('Edit Image', 'gmLang') . '</a>';
                    $media_action_links[] = '<a href="' . $gmCore->gm_get_media_image($item, 'original') . '" data-target="#previewModal" data-width="' . $modal_width . '" data-height="' . $modal_height . '" class="btn btn-link btn-sm preview-modal" title="' . esc_attr($item->title) . '">' . __('View Original', 'gmLang') . '</a>';
                } else {
                    ?>
					<a href="<?php 
                    echo $item_url;
                    ?>
" data-target="#previewModal" data-width="<?php 
                    echo $modal_web_width;
                    ?>
" data-height="<?php 
                    echo $modal_web_height;
                    ?>
" class="thumbnail preview-modal" title="<?php 
                    echo esc_attr($item->title);
                    ?>
">
						<?php 
                    $typethumb = false;
                    if (isset($meta['cover'][0]) && !empty($meta['cover'][0])) {
                        $typethumb = true;
                        ?>
							<img class="gmedia-thumb" src="<?php 
                        echo $gmCore->gm_get_media_image($item, 'thumb');
                        ?>
" alt=""/>
						<?php 
                    } elseif (isset($_metadata['image']['data']) && !empty($_metadata['image']['data'])) {
                        $typethumb = true;
                        ?>
							<img class="gmedia-thumb" src="<?php 
                        echo $_metadata['image']['data'];
                        ?>
" alt=""/>
						<?php 
                    } else {
                        ?>
							<img class="gmedia-thumb" src="<?php 
                        echo $gmCore->gm_get_media_image($item, 'thumb', false);
                        ?>
" alt=""/>
						<?php 
                    }
                    ?>
						<?php 
                    if ($typethumb) {
                        ?>
							<img class="gmedia-typethumb" src="<?php 
                        echo $gmCore->gm_get_media_image($item, 'thumb', false);
                        ?>
" alt=""/>
						<?php 
                    }
                    ?>
					</a>
					<?php 
                    if (in_array($type[1], array('mp4', 'mp3', 'mpeg', 'webm', 'ogg', 'wave', 'wav'))) {
                        $media_action_links[] = '<a href="' . $item_url . '" data-target="#previewModal" data-width="' . $modal_width . '" data-height="' . $modal_height . '" class="btn btn-link btn-sm preview-modal" title="' . esc_attr($item->title) . '">' . __('Play', 'gmLang') . '</a>';
                    }
                }
                $metainfo = $gmCore->metadata_text($item->ID);
                if ($metainfo) {
                    $media_action_links[] = '<a href="#metaInfo" data-target="#previewModal" data-metainfo="' . $item->ID . '" class="btn btn-link btn-sm preview-modal" title="' . __('Meta Info', 'gmLang') . '">' . __('Meta Info', 'gmLang') . '</a>';
                }
                if ($gmCore->caps['gmedia_delete_media'] && (int) $item->author == get_current_user_id() || $gmCore->caps['gmedia_delete_others_media']) {
                    $media_action_links[] = '<a class="btn btn-link btn-sm text-danger" href="' . wp_nonce_url($gmCore->get_admin_url(array('delete' => $item->ID)), 'gmedia_delete') . '" data-confirm="' . sprintf(__("You are about to permanently delete %s file.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang"), $item->gmuid) . '">' . __('Delete', 'gmLang') . '</a>';
                }
                echo '<p>' . implode(' | ', $media_action_links) . '</p>';
                ?>
				<?php 
                if ($metainfo) {
                    ?>
					<div class="metainfo hidden" id="metainfo_<?php 
                    echo $item->ID;
                    ?>
">
						<?php 
                    echo nl2br($metainfo);
                    ?>
					</div>
				<?php 
                }
                ?>
			</div>
			<div class="col-sm-8">
				<div class="row">
					<div class="form-group col-lg-6">
						<label><?php 
                _e('Title', 'gmLang');
                ?>
</label>
						<input name="title" type="text" class="form-control input-sm" placeholder="<?php 
                _e('Title', 'gmLang');
                ?>
" value="<?php 
                echo esc_attr($item->title);
                ?>
">
					</div>
					<div class="form-group col-lg-6">
						<label><?php 
                _e('Link URL', 'gmLang');
                ?>
</label>
						<input name="link" type="text" class="form-control input-sm" value="<?php 
                echo $item->link;
                ?>
"/>
					</div>
				</div>
				<div class="row">
					<div class="form-group col-lg-6">
						<label><?php 
                _e('Description', 'gmLang');
                ?>
</label>
						<?php 
                if ('false' == $gm_screen_options['library_edit_quicktags']) {
                    echo "<textarea id='gm{$item->ID}_description' class='form-control input-sm' name='description' cols='20' rows='4' style='height:174px'>" . esc_html($item->description) . '</textarea>';
                } else {
                    wp_editor(esc_html($item->description), "gm{$item->ID}_description", array('editor_class' => 'form-control input-sm', 'editor_height' => 140, 'wpautop' => false, 'media_buttons' => false, 'textarea_name' => 'description', 'textarea_rows' => '4', 'tinymce' => false, 'quicktags' => array('buttons' => apply_filters('gmedia_editor_quicktags', 'strong,em,link,ul,li,close'))));
                }
                ?>
					</div>
					<div class="col-lg-6">
						<?php 
                if ('image' != $type[0]) {
                    ?>
							<div class="form-group">
								<label><?php 
                    _e('Custom Cover', 'gmLang');
                    ?>
</label>
								<input name="meta[cover]" type="text" class="form-control input-sm gmedia-cover" value="<?php 
                    if (isset($meta['cover'][0])) {
                        echo $meta['cover'][0];
                    }
                    ?>
" placeholder="<?php 
                    _e('Gmedia ID or Image URL', 'gmLang');
                    ?>
"/>
							</div>
						<?php 
                }
                ?>
						<?php 
                if ($gmCore->caps['gmedia_terms']) {
                    ?>
							<?php 
                    if ($is_webimage) {
                        ?>
								<?php 
                        $cat_name = empty($cats) ? 0 : reset($cats)->name;
                        $term_type = 'gmedia_category';
                        $gm_terms = $gmGallery->options['taxonomies'][$term_type];
                        $terms_category = '';
                        if (count($gm_terms)) {
                            foreach ($gm_terms as $term_name => $term_title) {
                                $selected_option = $cat_name === $term_name ? ' selected="selected"' : '';
                                $terms_category .= '<option' . $selected_option . ' value="' . $term_name . '">' . esc_html($term_title) . '</option>' . "\n";
                            }
                        }
                        ?>
								<div class="form-group">
									<label><?php 
                        _e('Category', 'gmLang');
                        ?>
 </label>
									<select name="terms[gmedia_category]" class="gmedia_category form-control input-sm">
										<option<?php 
                        echo $cat_name ? '' : ' selected="selected"';
                        ?>
 value=""><?php 
                        _e('Uncategorized', 'gmLang');
                        ?>
</option>
										<?php 
                        echo $terms_category;
                        ?>
									</select>
								</div>
							<?php 
                    }
                    ?>

							<?php 
                    $alb_id = empty($albs) ? 0 : reset($albs)->term_id;
                    $term_type = 'gmedia_album';
                    $args = array();
                    if (!$gmCore->caps['gmedia_edit_others_media']) {
                        $args = array('global' => array(0, $user_ID), 'orderby' => 'global_desc_name');
                    }
                    $gm_terms = $gmDB->get_terms($term_type, $args);
                    $terms_album = '';
                    $album_status = 'none';
                    if (count($gm_terms)) {
                        foreach ($gm_terms as $term) {
                            $author_name = '';
                            if ($term->global) {
                                if ($gmCore->caps['gmedia_edit_others_media']) {
                                    $author_name .= ' &nbsp; ' . sprintf(__('by %s', 'gmLang'), get_the_author_meta('display_name', $term->global));
                                }
                            } else {
                                $author_name .= ' &nbsp; (' . __('shared', 'gmLang') . ')';
                            }
                            if ('public' != $term->status) {
                                $author_name .= ' [' . $term->status . ']';
                            }
                            $selected_option = '';
                            if ($alb_id == $term->term_id) {
                                $selected_option = ' selected="selected"';
                                $album_status = $term->status;
                            }
                            $terms_album .= '<option' . $selected_option . ' value="' . $term->term_id . '">' . esc_html($term->name) . $author_name . '</option>' . "\n";
                        }
                    }
                    ?>
							<div class="form-group status-album bg-status-<?php 
                    echo $album_status;
                    ?>
">
								<label><?php 
                    _e('Album ', 'gmLang');
                    ?>
</label>
								<select name="terms[gmedia_album]" class="combobox_gmedia_album form-control input-sm" placeholder="<?php 
                    _e('Album Name...', 'gmLang');
                    ?>
">
									<option<?php 
                    echo $alb_id ? '' : ' selected="selected"';
                    ?>
 value=""></option>
									<?php 
                    echo $terms_album;
                    ?>
								</select>
							</div>
							<?php 
                    if (!empty($tags)) {
                        $terms_tag = array();
                        foreach ($tags as $c) {
                            $terms_tag[] = esc_html($c->name);
                        }
                        $terms_tag = join(', ', $terms_tag);
                    } else {
                        $terms_tag = '';
                    }
                    ?>
							<div class="form-group">
								<label><?php 
                    _e('Tags ', 'gmLang');
                    ?>
</label>
								<textarea name="terms[gmedia_tag]" class="gmedia_tags_input form-control input-sm" rows="1" cols="50"><?php 
                    echo $terms_tag;
                    ?>
</textarea>
							</div>
						<?php 
                }
                ?>
					</div>
				</div>
				<div class="row">
					<div class="col-lg-6">
						<div class="form-group">
							<label><?php 
                _e('Filename', 'gmLang');
                ?>
</label>
							<input name="filename" type="text" class="form-control input-sm gmedia-filename" <?php 
                if ((int) $item->author !== $user_ID) {
                    echo 'readonly';
                }
                ?>
 value="<?php 
                echo pathinfo($item->gmuid, PATHINFO_FILENAME);
                ?>
"/>
						</div>
						<div class="form-group">
							<label><?php 
                _e('Date', 'gmLang');
                ?>
</label>

							<div class="input-group date input-group-sm" data-date-format="YYYY-MM-DD HH:mm:ss">
								<input name="date" type="text" readonly="readonly" class="form-control input-sm" value="<?php 
                echo $item->date;
                ?>
"/>
								<span class="input-group-btn"><button type="button" class="btn btn-primary">
										<span class="glyphicon glyphicon-calendar"></span></button></span>
							</div>
						</div>
						<div class="form-group status-item bg-status-<?php 
                echo $item->status;
                ?>
">
							<label><?php 
                _e('Status', 'gmLang');
                ?>
</label>
							<select name="status" class="form-control input-sm">
								<option <?php 
                selected($item->status, 'public');
                ?>
 value="public"><?php 
                _e('Public', 'gmLang');
                ?>
</option>
								<option <?php 
                selected($item->status, 'private');
                ?>
 value="private"><?php 
                _e('Private', 'gmLang');
                ?>
</option>
								<option <?php 
                selected($item->status, 'draft');
                ?>
 value="draft"><?php 
                _e('Draft', 'gmLang');
                ?>
</option>
							</select>
						</div>
					</div>
					<div class="col-lg-6">
						<div class="form-group">
							<label><?php 
                _e('Author', 'gmLang');
                ?>
</label>
							<?php 
                $user_ids = $gmCore->caps['gmedia_delete_others_media'] ? $gmCore->get_editable_user_ids() : false;
                if ($user_ids) {
                    if (!in_array($user_ID, $user_ids)) {
                        array_push($user_ids, $user_ID);
                    }
                    wp_dropdown_users(array('include' => $user_ids, 'include_selected' => true, 'name' => 'author', 'selected' => $item->author, 'class' => 'form-control', 'multi' => true));
                } else {
                    echo '<input type="hidden" name="author" value="' . $item->author . '"/>';
                    echo '<div>' . get_the_author_meta('display_name', $item->author) . '</div>';
                }
                ?>
						</div>
						<div class="media-meta"><span class="label label-default"><?php 
                _e('ID', 'gmLang');
                ?>
:</span> <strong><?php 
                echo $item->ID;
                ?>
</strong></div>
						<div class="media-meta"><span class="label label-default"><?php 
                _e('Type', 'gmLang');
                ?>
								:</span> <?php 
                echo $item->mime_type;
                ?>
</div>
						<div class="media-meta"><span class="label label-default"><?php 
                _e('File Size', 'gmLang');
                ?>
 :</span> <?php 
                echo $gmCore->filesize($item_path);
                ?>
						</div>
						<?php 
                if ('image' == $type[0]) {
                    $_metadata = unserialize($meta['_metadata'][0]);
                    ?>
							<div class="media-meta"><span class="label label-default"><?php 
                    _e('Dimensions', 'gmLang');
                    ?>
									:</span>
								<span title="<?php 
                    echo $_metadata['web']['width'] . ' × ' . $_metadata['web']['height'] . ', ' . $_metadata['thumb']['width'] . ' × ' . $_metadata['thumb']['height'];
                    ?>
"><?php 
                    echo $_metadata['original']['width'] . ' × ' . $_metadata['original']['height'];
                    ?>
</span>
							</div>
						<?php 
                }
                ?>
						<div class="media-meta"><span class="label label-default"><?php 
                _e('Uploaded', 'gmLang');
                ?>
:</span><?php 
                echo $item->date;
                ?>
</div>
						<div class="media-meta"><span class="label label-default"><?php 
                _e('Last Edited', 'gmLang');
                ?>
:</span>
							<span class="gm-last-edited modified"><?php 
                echo $item->modified;
                ?>
</span></div>
					</div>
				</div>
				<?php 
                do_action('gmedia_edit_form');
                ?>
			</div>
		</form>
	<?php 
            }
            ?>
	<?php 
        }
        ?>
		<script type="text/javascript">
			jQuery(function($){
				<?php 
        if (!$gmProcessor->mode) {
            ?>
				$('#gm-selected').on('change', function(){
					var val = $(this).val();
					$('.edit-mode-link').each(function(){
						if(val){
							$(this).attr('href', $(this).data('href_sel'));
						} else{
							$(this).attr('href', $(this).data('href'));
						}
					});
				}).trigger('change');

				<?php 
        } else {
            ?>
				<?php 
            if ($gmCore->caps['gmedia_terms']) {
                ?>
				$('.combobox_gmedia_album').selectize({
					create: <?php 
                echo $gmCore->caps['gmedia_album_manage'] ? 'true' : 'false';
                ?>
,
					persist: false
				});
				<?php 
            }
            ?>

				var gmedia_date_temp;
				$('.input-group.date').datetimepicker({useSeconds: true}).on('dp.show', function(){
					gmedia_date_temp = $('input', this).val();
				}).on('dp.hide', function(){
					if(gmedia_date_temp != $('input', this).val()){
						$('input', this).trigger('change');
					}
				});

				var inp_filename = $('input.gmedia-filename').not('[readonly]');
				if(inp_filename.length){
					inp_filename.alphanum({
						allow: '-_',
						disallow: '',
						allowSpace: false,
						allowNumeric: true,
						allowUpper: true,
						allowLower: true,
						allowCaseless: true,
						allowLatin: true,
						allowOtherCharSets: false,
						forceUpper: false,
						forceLower: false,
						maxLength: NaN
					});
				}

				<?php 
        }
        ?>
			});
			window.closeModal = function(id){
				jQuery('#' + id).modal('hide');
			};
		</script>
	<?php 
    } else {
        ?>
		<div class="list-group-item">
			<div class="well well-lg text-center">
				<h4><?php 
        _e('No items to show.', 'gmLang');
        ?>
</h4>
				<?php 
        if ($gmCore->caps['gmedia_upload']) {
            ?>
					<p>
						<a href="<?php 
            echo admin_url('admin.php?page=GrandMedia_AddMedia');
            ?>
" class="btn btn-success"><span class="glyphicon glyphicon-plus"></span> <?php 
            _e('Add Media', 'gmLang');
            ?>
						</a></p>
				<?php 
        }
        ?>
			</div>
		</div>
	<?php 
    }
    ?>
	</div>

	<div class="panel-footer clearfix">
		<?php 
    echo $gmDB->query_pager();
    ?>

		<a href="#top" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-arrow-up"></span> <?php 
    _e('Back to top', 'gmLang');
    ?>
</a>
	</div>

	<?php 
    wp_original_referer_field(true, 'previous');
    wp_nonce_field('GmediaGallery');
    ?>
	</div>

	<div class="modal fade gmedia-modal" id="libModal" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="modal-dialog"></div>
	</div>
	<?php 
    if ($gmCore->caps['gmedia_edit_media']) {
        ?>
		<div class="modal fade gmedia-modal" id="gmeditModal" tabindex="-1" role="dialog" aria-hidden="true">
			<div class="modal-dialog modal-lg">
				<div class="modal-content"></div>
			</div>
		</div>
	<?php 
    }
    ?>
	<div class="modal fade gmedia-modal" id="previewModal" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title"></h4>
				</div>
				<div class="modal-body"></div>
			</div>
		</div>
	</div>
	<div class="modal fade gmedia-modal" id="shareModal" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title"><?php 
    _e('GmediaCloud Page');
    ?>
</h4>
				</div>
				<form class="modal-body" method="post" id="shareForm">
					<div class="form-group">
						<label><?php 
    _e('Link to page', 'gmLang');
    ?>
</label>
						<input name="sharelink" type="text" class="form-control sharelink" readonly="readonly" value="" />
					</div>
					<div class="form-group">
						<label><?php 
    _e('Send this link to', 'gmLang');
    ?>
</label>
						<input name="email" type="email" class="form-control sharetoemail" value="" placeholder="<?php 
    _e('Email', 'gmLang');
    ?>
" />
						<textarea name="message" cols="20" rows="3" class="form-control" placeholder="<?php 
    _e('Message (optional)', 'gmLang');
    ?>
"></textarea>
					</div>
					<input type="hidden" name="action" value="gmedia_share_page" />
					<?php 
    wp_nonce_field('share_modal', '_sharenonce');
    ?>
				</form>
				<div class="modal-footer">
					<button type="button" class="btn btn-primary sharebutton" disabled="disabled"><?php 
    _e('Send', 'gmLang');
    ?>
</button>
					<button type="button" class="btn btn-default" data-dismiss="modal"><?php 
    _e('Close', 'gmLang');
    ?>
</button>
				</div>
			</div>
		</div>
	</div>
<?php 
}
		$category->description = '';
}

do_action('edit_category_form_pre', $category);

_fill_empty_category($category);
?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php _e('Edit Category'); ?></h2>
<div id="ajax-response"></div>
<form name="editcat" id="editcat" method="post" action="categories.php" class="validate">
<input type="hidden" name="action" value="editedcat" />
<input type="hidden" name="cat_ID" value="<?php echo esc_attr($category->term_id) ?>" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-category_' . $cat_ID); ?>
	<table class="form-table">
		<tr class="form-field form-required">
			<th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
			<td><input name="cat_name" id="cat_name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /><br />
            <span class="description"><?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></span></td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
			<td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
            <span class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></span></td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
			<td>
	  			<?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
示例#13
0
/**
 * gmediaGalleries()
 *
 * @return mixed content
 */
function gmediaGalleries()
{
    global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
    $url = add_query_arg(array('page' => $gmProcessor->page), admin_url('admin.php'));
    $endpoint = $gmGallery->options['endpoint'];
    $gm_screen_options = get_user_meta($user_ID, 'gm_screen_options', true);
    if (!is_array($gm_screen_options)) {
        $gm_screen_options = array();
    }
    $gm_screen_options = array_merge($gmGallery->options['gm_screen_options'], $gm_screen_options);
    $orderby = !empty($gm_screen_options['orderby_gmedia_galleries']) ? $gm_screen_options['orderby_gmedia_galleries'] : 'name';
    $order = !empty($gm_screen_options['sortorder_gmedia_galleries']) ? $gm_screen_options['sortorder_gmedia_galleries'] : 'ASC';
    $per_page = !empty($gm_screen_options['per_page_gmedia_galleries']) ? $gm_screen_options['per_page_gmedia_galleries'] : 30;
    $filter = 'selected' == $gmCore->_req('filter') ? $gmProcessor->selected_items : null;
    $args = array('orderby' => $gmCore->_get('orderby', $orderby), 'order' => $gmCore->_get('order', $order), 'search' => $gmCore->_get('s', ''), 'number' => $gmCore->_get('number', $per_page), 'hide_empty' => 0, 'page' => $gmCore->_get('pager', 1), 'include' => $filter);
    $args['offset'] = ($args['page'] - 1) * $args['number'];
    if ($gmCore->caps['gmedia_edit_others_media']) {
        $args['global'] = $gmCore->_get('author', '');
    } else {
        $args['global'] = array($user_ID);
    }
    $taxonomy = 'gmedia_gallery';
    $gmediaTerms = $gmDB->get_terms($taxonomy, $args);
    if (is_wp_error($gmediaTerms)) {
        echo $gmProcessor->alert('danger', $gmediaTerms->get_error_message());
        $gmediaTerms = array();
    }
    $modules = array();
    if ($plugin_modules = glob(GMEDIA_ABSPATH . 'module/*', GLOB_ONLYDIR | GLOB_NOSORT)) {
        foreach ($plugin_modules as $path) {
            $mfold = basename($path);
            $modules[$mfold] = array('module_name' => $mfold, 'module_url' => $gmCore->gmedia_url . "/module/{$mfold}", 'module_path' => $path);
        }
    }
    if ($upload_modules = glob($gmCore->upload['path'] . '/' . $gmGallery->options['folder']['module'] . '/*', GLOB_ONLYDIR | GLOB_NOSORT)) {
        foreach ($upload_modules as $path) {
            $mfold = basename($path);
            $modules[$mfold] = array('module_name' => $mfold, 'module_url' => $gmCore->upload['url'] . "/{$gmGallery->options['folder']['module']}/{$mfold}", 'module_path' => $path);
        }
    }
    ?>

	<div class="panel panel-default">
		<div class="panel-heading clearfix">
			<form class="form-inline gmedia-search-form" role="search" method="get">
				<div class="form-group">
                    <?php 
    foreach ($_GET as $key => $value) {
        if (in_array($key, array('orderby', 'order', 'number', 'global'))) {
            ?>
                            <input type="hidden" name="<?php 
            echo $key;
            ?>
" value="<?php 
            echo $value;
            ?>
"/>
                        <?php 
        }
    }
    ?>
					<input id="gmedia-search" class="form-control input-sm" type="text" name="s" placeholder="<?php 
    _e('Search...', 'gmLang');
    ?>
" value="<?php 
    echo $gmCore->_get('s', '');
    ?>
"/>
				</div>
				<button type="submit" class="btn btn-default input-sm"><span class="glyphicon glyphicon-search"></span></button>
			</form>
			<?php 
    echo $gmDB->query_pager();
    ?>

			<div class="btn-toolbar pull-left">
				<div class="btn-group gm-checkgroup" id="cb_global-btn">
					<span class="btn btn-default active"><input class="doaction" id="cb_global" data-group="cb_media-object" type="checkbox"/></span>
					<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
						<span class="caret"></span>
						<span class="sr-only"><?php 
    _e('Toggle Dropdown', 'gmLang');
    ?>
</span>
					</button>
					<ul class="dropdown-menu" role="menu">
						<li><a data-select="total" href="#"><?php 
    _e('All', 'gmLang');
    ?>
</a></li>
						<li><a data-select="none" href="#"><?php 
    _e('None', 'gmLang');
    ?>
</a></li>
						<li class="divider"></li>
						<li><a data-select="reverse" href="#" title="<?php 
    _e('Reverse only visible items', 'gmLang');
    ?>
"><?php 
    _e('Reverse', 'gmLang');
    ?>
</a></li>
					</ul>
				</div>

				<div class="btn-group" style="margin-right:20px;">
					<a class="btn btn-primary" href="#chooseModuleModal" data-toggle="modal"><?php 
    _e('Create Gallery', 'gmLang');
    ?>
</a>
				</div>

				<div class="btn-group">
					<a class="btn btn-default" href="#"><?php 
    _e('Action', 'gmLang');
    ?>
</a>
					<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
						<span class="caret"></span>
						<span class="sr-only"><?php 
    _e('Toggle Dropdown', 'gmLang');
    ?>
</span>
					</button>
					<?php 
    $rel_selected_show = 'rel-selected-show';
    $rel_selected_hide = 'rel-selected-hide';
    ?>
					<ul class="dropdown-menu" role="menu">
						<li class="dropdown-header <?php 
    echo $rel_selected_hide;
    ?>
"><span><?php 
    _e("Select items to see more actions", "gmLang");
    ?>
</span></li>
						<li class="<?php 
    echo $rel_selected_show;
    ?>
">
							<a href="<?php 
    echo wp_nonce_url($gmCore->get_admin_url(array('delete' => 'selected'), array('filter')), 'gmedia_delete');
    ?>
" class="gmedia-delete" data-confirm="<?php 
    _e("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang");
    ?>
"><?php 
    _e('Delete Selected Items', 'gmLang');
    ?>
</a>
						</li>
						<?php 
    do_action('gmedia_term_action_list');
    ?>
					</ul>
				</div>

				<form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php 
    echo add_query_arg(array('filter' => 'selected'), $url);
    ?>
" method="post">
					<button type="submit" class="btn btn<?php 
    echo 'selected' == $gmCore->_req('filter') ? '-success' : '-info';
    ?>
"><?php 
    printf(__('%s selected', 'gmLang'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>');
    ?>
</button>
					<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
						<span class="sr-only"><?php 
    _e('Toggle Dropdown', 'gmLang');
    ?>
</span></button>
					<input type="hidden" id="gm-selected" data-userid="<?php 
    echo $user_ID;
    ?>
" data-key="<?php 
    echo $taxonomy;
    ?>
" name="selected_items" value="<?php 
    echo implode(',', $gmProcessor->selected_items);
    ?>
"/>
					<ul class="dropdown-menu" role="menu">
						<li><a id="gm-selected-show" href="#show"><?php 
    _e('Show only selected items', 'gmLang');
    ?>
</a></li>
						<li><a id="gm-selected-clear" href="#clear"><?php 
    _e('Clear selected items', 'gmLang');
    ?>
</a></li>
					</ul>
				</form>

			</div>

		</div>
		<div class="panel-body" id="gmedia-msg-panel"></div>
		<form class="list-group" id="gm-list-table" style="margin-bottom:4px;">
			<?php 
    if (count($gmediaTerms)) {
        $lib_url = add_query_arg(array('page' => 'GrandMedia'), admin_url('admin.php'));
        foreach ($gmediaTerms as $term) {
            $term_meta = $gmDB->get_metadata('gmedia_term', $term->term_id);
            $term_meta = array_map('reset', $term_meta);
            $term_meta = array_map('maybe_unserialize', $term_meta);
            $module = $gmCore->get_module_path($term_meta['module']);
            $module_info = array('type' => '&#8212;');
            if (file_exists($module['path'] . '/index.php')) {
                $broken = false;
                include $module['path'] . '/index.php';
            } else {
                $broken = true;
            }
            if ($term->global == $user_ID) {
                $allow_edit = $allow_delete = true;
            } else {
                $allow_edit = $allow_delete = $gmCore->caps['gmedia_edit_others_media'];
            }
            $is_selected = in_array($term->term_id, $gmProcessor->selected_items) ? true : false;
            $list_row_class = '';
            if ('public' != $term->status) {
                if ('private' == $term->status) {
                    $list_row_class = ' list-group-item-info';
                } elseif ('draft' == $term->status) {
                    $list_row_class = ' list-group-item-warning';
                }
            }
            ?>
					<div class="list-group-item row d-row<?php 
            echo $list_row_class . ($is_selected ? ' active-row' : '');
            ?>
" id="list-item-<?php 
            echo $term->term_id;
            ?>
" data-id="<?php 
            echo $term->term_id;
            ?>
" data-type="<?php 
            echo $term_meta['module'];
            ?>
">
						<div class="term_id">#<?php 
            echo $term->term_id;
            ?>
</div>
						<div class="col-xs-7">
							<label class="cb_media-object cb_media-object-gallery">
								<input name="doaction[]" type="checkbox"<?php 
            echo $is_selected ? ' checked="checked"' : '';
            ?>
 data-type="<?php 
            echo $term_meta['module'];
            ?>
" class="hidden" value="<?php 
            echo $term->term_id;
            ?>
"/>
								<?php 
            if (!$broken) {
                ?>
									<span class="thumbnail"><img src="<?php 
                echo $module['url'] . '/screenshot.png';
                ?>
" alt="<?php 
                echo esc_attr($term->name);
                ?>
"/></span>
								<?php 
            } else {
                ?>
									<div class="bg-danger text-center"><?php 
                _e('Module broken <br>Reinstall module', 'gmLang');
                ?>
</div>
								<?php 
            }
            ?>
							</label>

							<div class="media-info-body" style="margin-left:150px;">
								<p class="media-title">
									<?php 
            if ($allow_edit) {
                ?>
										<a href="<?php 
                echo add_query_arg(array('edit_gallery' => $term->term_id), $url);
                ?>
"><?php 
                echo esc_html($term->name);
                ?>
</a>
									<?php 
            } else {
                ?>
										<span><?php 
                echo esc_html($term->name);
                ?>
</span>
									<?php 
            }
            ?>
								</p>

								<p class="media-meta">
									<span class="label label-default"><?php 
            _e('Author', 'gmLang');
            ?>
										:</span> <?php 
            echo $term->global ? get_the_author_meta('display_name', $term->global) : '&#8212;';
            ?>
								</p>

								<p class="media-caption"><?php 
            echo nl2br(esc_html($term->description));
            ?>
</p>

								<p class="media-meta" title="<?php 
            _e('Shortcode', 'gmLang');
            ?>
" style="font-weight:bold">
									<span class="label label-default"><?php 
            _e('Shortcode', 'gmLang');
            ?>
:</span> [gmedia id=<?php 
            echo $term->term_id;
            ?>
]
								</p>
							</div>
						</div>
						<div class="col-xs-5">
							<div class="object-actions gallery-object-actions">
								<?php 
            /*
            $filter_icon = '<span class="glyphicon glyphicon-filter"></span>';
            echo '<a title="' . __('Filter in Gmedia Library', 'gmLang') . '" href="#">'.$filter_icon.'</a>';
            */
            $gmedia_hashid = gmedia_hash_id_encode($term->term_id, 'gallery');
            if (get_option('permalink_structure')) {
                $cloud_link = home_url(urlencode($endpoint) . '/g/' . $gmedia_hashid);
            } else {
                $cloud_link = add_query_arg(array("{$endpoint}" => $gmedia_hashid, 't' => 'g'), home_url('index.php'));
            }
            $share_icon = '<span class="glyphicon glyphicon-share"></span>';
            if ('draft' !== $term->status) {
                echo '<a target="_blank" data-target="#shareModal" data-share="' . $term->term_id . '" class="share-modal" title="' . __('Share', 'gmLang') . '" href="' . $cloud_link . '">' . $share_icon . '</a>';
            } else {
                echo "<span class='action-inactive'>{$share_icon}</span>";
            }
            $edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
            if ($allow_edit) {
                echo '<a title="' . __('Edit', 'gmLang') . '" href="' . add_query_arg(array('edit_gallery' => $term->term_id), $url) . '">' . $edit_icon . '</a>';
            } else {
                echo "<span class='action-inactive'>{$edit_icon}</span>";
            }
            $trash_icon = '<span class="glyphicon glyphicon-trash"></span>';
            if ($allow_delete) {
                echo '<a class="trash-icon" title="' . __('Delete', 'gmLang') . '" href="' . wp_nonce_url(add_query_arg(array('term' => $taxonomy, 'delete' => $term->term_id), $url), 'gmedia_delete') . '" data-confirm="' . __("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang") . '">' . $trash_icon . '</a>';
            } else {
                echo "<span class='action-inactive'>{$trash_icon}</span>";
            }
            ?>
							</div>
							<p class="media-meta">
								<span class="label label-default"><?php 
            _e('Module', 'gmLang');
            ?>
:</span> <?php 
            echo $term_meta['module'];
            ?>
								<br><span class="label label-default"><?php 
            _e('Type', 'gmLang');
            ?>
:</span> <?php 
            echo $module_info['type'];
            ?>
								<br><span class="label label-default"><?php 
            _e('Last Edited', 'gmLang');
            ?>
:</span> <?php 
            echo $term_meta['edited'];
            ?>
								<br><span class="label label-default"><?php 
            _e('Status', 'gmLang');
            ?>
:</span> <?php 
            echo $term->status;
            ?>
								<br><span class="label label-default"><?php 
            _e('Source', 'gmLang');
            ?>
:</span>
								<?php 
            $gallery_tabs = reset($term_meta['query']);
            $tax_tabs = key($term_meta['query']);
            if ('gmedia__in' == $tax_tabs) {
                _e('Selected Gmedia', 'gmLang');
                $gmedia_ids = wp_parse_id_list($gallery_tabs[0]);
                $gal_source = sprintf('<a class="selected__in" href="%s">' . __('Show %d items in Gmedia Library', 'gmLang') . '</a>', esc_url(add_query_arg(array('gmedia__in' => implode(',', $gmedia_ids)), $lib_url)), count($gmedia_ids));
                echo " ({$gal_source})";
            } else {
                $tabs = $gmDB->get_terms($tax_tabs, array('include' => $gallery_tabs));
                $terms_source = array();
                if ('gmedia_category' == $tax_tabs) {
                    _e('Categories', 'gmLang');
                    foreach ($tabs as $t) {
                        $terms_source[] = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $t->term_id), $lib_url)), esc_html($gmGallery->options['taxonomies']['gmedia_category'][$t->name]));
                    }
                } elseif ('gmedia_album' == $tax_tabs) {
                    _e('Albums', 'gmLang');
                    foreach ($tabs as $t) {
                        $terms_source[] = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => $t->term_id), $lib_url)), esc_html($t->name));
                    }
                } elseif ('gmedia_tag' == $tax_tabs) {
                    _e('Tags', 'gmLang');
                    foreach ($tabs as $t) {
                        $terms_source[] = sprintf('<a class="tag" href="%s">%s</a>', esc_url(add_query_arg(array('tag_id' => $t->term_id), $lib_url)), esc_html($t->name));
                    }
                } elseif ('gmedia_filter' == $tax_tabs) {
                    _e('Filters', 'gmLang');
                    foreach ($tabs as $t) {
                        $terms_source[] = sprintf('<a class="filter" href="%s">%s</a>', esc_url(add_query_arg(array('stack_id' => $t->term_id), $lib_url)), esc_html($t->name));
                    }
                }
                if (!empty($terms_source)) {
                    echo ' (' . join(', ', $terms_source) . ')';
                }
            }
            ?>
							</p>
						</div>
					</div>
				<?php 
        }
    } else {
        ?>
				<div class="list-group-item">
					<div class="well well-lg text-center">
						<h4><?php 
        _e('No items to show.', 'gmLang');
        ?>
</h4>
					</div>
				</div>
			<?php 
    }
    ?>
			<?php 
    wp_original_referer_field(true, 'previous');
    wp_nonce_field('GmediaTerms');
    ?>
		</form>
	</div>

	<!-- Modal -->
	<div class="modal fade gmedia-modal" id="chooseModuleModal" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title"><?php 
    _e('Choose Module for Gallery');
    ?>
</h4>
				</div>
				<div class="modal-body linkblock">
					<?php 
    if (!empty($modules)) {
        foreach ($modules as $m) {
            /**
             * @var $module_name
             * @var $module_url
             * @var $module_path
             */
            extract($m);
            if (!file_exists($module_path . '/index.php')) {
                continue;
            }
            $module_info = array();
            include $module_path . '/index.php';
            if (empty($module_info)) {
                continue;
            }
            $mclass = ' module-' . $module_info['type'] . ' module-' . $module_info['status'];
            ?>
							<div data-href="<?php 
            echo add_query_arg(array('gallery_module' => $module_name), $url);
            ?>
" class="choose-module media<?php 
            echo $mclass;
            ?>
">
								<a href="<?php 
            echo add_query_arg(array('gallery_module' => $module_name), $url);
            ?>
" class="thumbnail pull-left">
									<img class="media-object" src="<?php 
            echo $module_url . '/screenshot.png';
            ?>
" alt="<?php 
            echo esc_attr($module_info['title']);
            ?>
" width="160" height="120"/>
								</a>

								<div class="media-body" style="margin-left:180px;">
									<h4 class="media-heading"><?php 
            echo $module_info['title'];
            ?>
</h4>

									<p class="version"><?php 
            echo __('Version', 'gmLang') . ': ' . $module_info['version'];
            ?>
</p>

									<div class="description"><?php 
            echo nl2br($module_info['description']);
            ?>
</div>
								</div>
							</div>
						<?php 
        }
    } else {
        _e('No installed modules', 'gmLang');
    }
    ?>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal"><?php 
    _e('Cancel', 'gmLang');
    ?>
</button>
				</div>
			</div>
		</div>
	</div>

	<div class="modal fade gmedia-modal" id="shareModal" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title"><?php 
    _e('GmediaCloud Page');
    ?>
</h4>
				</div>
				<form class="modal-body" method="post" id="shareForm">
					<div class="form-group">
						<label><?php 
    _e('Link to page', 'gmLang');
    ?>
</label>
						<input name="sharelink" type="text" class="form-control sharelink" readonly="readonly" value="" />
					</div>
					<div class="form-group">
						<label><?php 
    _e('Send this link to', 'gmLang');
    ?>
</label>
						<input name="email" type="email" class="form-control sharetoemail" value="" placeholder="<?php 
    _e('Email', 'gmLang');
    ?>
" />
						<textarea name="message" cols="20" rows="3" class="form-control" placeholder="<?php 
    _e('Message (optional)', 'gmLang');
    ?>
"></textarea>
					</div>
					<input type="hidden" name="action" value="gmedia_share_page" />
					<?php 
    wp_nonce_field('share_modal', '_sharenonce');
    ?>
				</form>
				<div class="modal-footer">
					<button type="button" class="btn btn-primary sharebutton" disabled="disabled"><?php 
    _e('Send', 'gmLang');
    ?>
</button>
					<button type="button" class="btn btn-default" data-dismiss="modal"><?php 
    _e('Close', 'gmLang');
    ?>
</button>
				</div>
			</div>
		</div>
	</div>
<?php 
}
示例#14
0
    function handle_addons_panel()
    {
        global $action, $page, $subpage;
        wp_reset_vars(array('action', 'page', 'subpage'));
        $messages = array();
        $messages[1] = __('Addon updated.', 'affiliate');
        $messages[2] = __('Addon not updated.', 'affiliate');
        $messages[3] = __('Addon activated.', 'affiliate');
        $messages[4] = __('Addon not activated.', 'affiliate');
        $messages[5] = __('Addon deactivated.', 'affiliate');
        $messages[6] = __('Addon not deactivated.', 'affiliate');
        $messages[7] = __('Addon activation toggled.', 'affiliate');
        if (!empty($action)) {
            $msg = $this->handle_addons_panel_updates();
        }
        //$mu_plugins = get_mu_plugins();
        //echo "mu_plugins<pre>"; print_r($mu_plugins); echo "</pre>";
        //$active_sitewide_plugins = get_site_option( 'active_sitewide_plugins');
        //echo "network active plugins<pre>"; print_r($active_sitewide_plugins); echo "</pre>";
        //$active_plugins = get_option( 'active_plugins', array());
        //echo "active plugins<pre>"; print_r($active_plugins); echo "</pre>";
        if (!empty($msg)) {
            echo '<div id="message" class="updated fade"><p>' . $messages[(int) $msg] . '</p></div>';
            $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
        }
        ?>

			<form method="get" action="?page=<?php 
        echo esc_attr($page);
        ?>
&amp;subpage=<?php 
        echo esc_attr($subpage);
        ?>
" id="posts-filter">

			<input type='hidden' name='page' value='<?php 
        echo esc_attr($page);
        ?>
' />
			<input type='hidden' name='subpage' value='<?php 
        echo esc_attr($subpage);
        ?>
' />

			<div class="tablenav">

			<div class="alignleft actions">
			<select name="action">
			<option selected="selected" value=""><?php 
        _e('Bulk Actions', 'affiliate');
        ?>
</option>
			<option value="toggle"><?php 
        _e('Toggle activation', 'affiliate');
        ?>
</option>
			</select>
			<input type="submit" class="button-secondary action" id="doaction" name="doaction" value="<?php 
        _e('Apply', 'affiliate');
        ?>
">

			</div>

			<div class="alignright actions"></div>

			<br class="clear">
			</div>

			<div class="clear"></div>

			<?php 
        wp_original_referer_field(true, 'previous');
        wp_nonce_field('bulk-addon');
        $columns = array("name" => __('Addon Name', 'affiliate'), "active" => __('Addon Status', 'affiliate'));
        $columns = apply_filters('affiliate_plugincolumns', $columns);
        $plugins = get_affiliate_addons();
        $active = aff_get_option('affiliate_activated_addons', array());
        ?>

			<table cellspacing="0" class="widefat fixed">
				<thead>
				<tr>
				<th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th>
				<?php 
        foreach ($columns as $key => $col) {
            ?>
						<th style="" class="manage-column column-<?php 
            echo $key;
            ?>
" id="<?php 
            echo $key;
            ?>
" scope="col"><?php 
            echo $col;
            ?>
</th>
						<?php 
        }
        ?>
				</tr>
				</thead>

				<tfoot>
				<tr>
				<th style="" class="manage-column column-cb check-column" scope="col"><input type="checkbox"></th>
				<?php 
        reset($columns);
        foreach ($columns as $key => $col) {
            ?>
						<th style="" class="manage-column column-<?php 
            echo $key;
            ?>
" id="<?php 
            echo $key;
            ?>
" scope="col"><?php 
            echo $col;
            ?>
</th>
						<?php 
        }
        ?>
				</tr>
				</tfoot>

				<tbody>
					<?php 
        if (!empty($plugins)) {
            $AFFILIATE_IS_NETWORK_ACTIVE = affiliate_is_plugin_active_for_network();
            foreach ($plugins as $key => $plugin) {
                $default_headers = array('Name' => 'Plugin Name', 'Description' => 'Description', 'AuthorURI' => 'Author URI', 'Network' => 'Network', 'Depends' => 'Depends', 'Class' => 'Class', 'Deprecated' => 'Deprecated');
                $plugin_data = get_file_data(affiliate_dir('affiliateincludes/addons/' . $plugin), $default_headers, 'plugin');
                //echo "plugin_data<pre>"; print_r($plugin_data); echo "</pre>";
                if (empty($plugin_data['Name'])) {
                    continue;
                }
                if (!isset($plugin_data['Network']) || empty($plugin_data['Network']) || $plugin_data['Network'] != 'true') {
                    $plugin_data['Network'] = false;
                } else {
                    if ($plugin_data['Network'] == 'true') {
                        $plugin_data['Network'] = true;
                    }
                }
                if ($plugin_data['Network'] == true && !is_multisite() && is_network_admin()) {
                    continue;
                }
                //echo "plugin_data<pre>"; print_r($plugin_data); echo "</pre>";
                $PLUGINS_CAN_BE_ACTIVE = true;
                if ($plugin_data['Network'] == true && !$AFFILIATE_IS_NETWORK_ACTIVE) {
                    $PLUGINS_CAN_BE_ACTIVE = false;
                }
                //echo "[". $plugin_data['Name'] ."] PLUGINS_CAN_BE_ACTIVE[". $PLUGINS_CAN_BE_ACTIVE ."]<br />";
                // Set the initial active
                $PLUGIN_INSTALLED = true;
                if (!isset($plugin_data['Depends']) || empty($plugin_data['Depends'])) {
                    $plugin_data['Network'] = array();
                    if (isset($plugin_data['Class']) && !empty($plugin_data['Class'])) {
                        if (!class_exists($plugin_data['Class'])) {
                            $PLUGIN_INSTALLED = false;
                        }
                    }
                } else {
                    $depends = explode(',', $plugin_data['Depends']);
                    if ($depends && is_array($depends) && count($depends)) {
                        foreach ($depends as $depend) {
                            //echo "depend[". $depend ."]<br />";
                            if (!affiliate_is_plugin_active($depend) && !affiliate_is_plugin_active_for_network($depend)) {
                                if (isset($plugin_data['Class']) || !empty($plugin_data['Class'])) {
                                    //echo "class[". $plugin_data['Class'] ."]<br />";
                                    if (!class_exists($plugin_data['Class'])) {
                                        $PLUGIN_INSTALLED = false;
                                    }
                                } else {
                                    $PLUGIN_INSTALLED = false;
                                }
                            }
                        }
                    }
                }
                //echo "[". $plugin_data['Name'] ."] PLUGIN_INSTALLED[". $PLUGIN_INSTALLED ."]<br />";
                if ('yes' == $plugin_data['Deprecated'] && !$PLUGIN_INSTALLED) {
                    // We only display deprecated Add-Ons when the deprecated dependency is installed.
                    continue;
                }
                ?>
							<tr valign="middle" class="alternate" id="plugin-<?php 
                echo $plugin;
                ?>
">
								<th class="check-column" scope="row">
									<?php 
                if ($PLUGINS_CAN_BE_ACTIVE && $PLUGIN_INSTALLED) {
                    ?>
<input type="checkbox" value="<?php 
                    echo esc_attr($plugin);
                    ?>
" name="plugincheck[]"><?php 
                }
                ?>
								</th>
								<td class="column-name">
									<strong><?php 
                echo esc_html($plugin_data['Name']);
                ?>
</strong>
									<?php 
                if (!$PLUGIN_INSTALLED) {
                    //echo ' <span>'. __('Base plugin not activate/installed', 'affiliate') .'</span>';
                    echo ' -- <strong>' . __('plugin not installed', 'affiliate') . '</strong>';
                }
                if (!empty($plugin_data['Description'])) {
                    ?>
<br/><?php 
                    echo esc_html($plugin_data['Description']);
                }
                //if ($plugin_data['Network'] == true)  {
                //	echo '<br /><strong>' .__('Network only - Requires Affiliate plugin is Network Activated', 'affiliate') .'</strong>';
                //}
                if ($PLUGINS_CAN_BE_ACTIVE && $PLUGIN_INSTALLED) {
                    $actions = array();
                    if (in_array($plugin, $active)) {
                        $actions['toggle'] = "<span class='edit activate'><a href='" . wp_nonce_url("?page=" . $page . "&amp;subpage=" . $subpage . "&amp;action=deactivate&amp;addon=" . $plugin . "", 'toggle-addon-' . $plugin) . "'>" . __('Deactivate', 'affiliate') . "</a></span>";
                    } else {
                        $actions['toggle'] = "<span class='edit deactivate'><a href='" . wp_nonce_url("?page=" . $page . "&amp;subpage=" . $subpage . "&amp;action=activate&amp;addon=" . $plugin . "", 'toggle-addon-' . $plugin) . "'>" . (function_exists('is_network_admin') && is_network_admin() ? __('Network Activate', 'affiliate') : __('Activate', 'affiliate')) . "</a></span>";
                    }
                    if (count($actions)) {
                        ?>
<br /><div class="row-actions"><?php 
                        echo implode(" | ", $actions);
                        ?>
</div><?php 
                    }
                }
                ?>
								</td>
								<td class="column-active">
									<?php 
                if ($PLUGINS_CAN_BE_ACTIVE && $PLUGIN_INSTALLED) {
                    if (in_array($plugin, $active)) {
                        echo "<strong>" . __('Active', 'affiliate') . "</strong>";
                    } else {
                        echo __('Inactive', 'affiliate');
                    }
                }
                ?>
								</td>
						    </tr>
							<?php 
            }
        } else {
            $columncount = count($columns) + 1;
            ?>
						<tr valign="middle" class="alternate" >
							<td colspan="<?php 
            echo $columncount;
            ?>
" scope="row"><?php 
            _e('No Addons where found for this install.', 'affiliate');
            ?>
</td>
					    </tr>
						<?php 
        }
        ?>

				</tbody>
			</table>


			<div class="tablenav">

			<div class="alignleft actions">
			<select name="action2">
				<option selected="selected" value=""><?php 
        _e('Bulk Actions', 'affiliate');
        ?>
</option>
				<option value="toggle"><?php 
        _e('Toggle activation', 'affiliate');
        ?>
</option>
			</select>
			<input type="submit" class="button-secondary action" id="doaction2" name="doaction2" value="Apply">
			</div>
			<div class="alignright actions"></div>
			<br class="clear">
			</div>

			</form>

		<?php 
    }
<?php
wp_nonce_field($nonce_action);

if (isset($mode) && 'bookmarklet' == $mode)
	echo '<input type="hidden" name="mode" value="bookmarklet" />';
?>
<input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
<?php echo $form_extra ?>
<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>

<div id="poststuff">

<div class="submitbox" id="submitpage">

<div id="previewview">
<?php if ( 'publish' == $post->post_status ) { ?>
<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank"  tabindex="4"><?php _e('View this Page'); ?></a>
<?php } elseif ( 'edit' == $action ) { ?>
<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank" tabindex="4"><?php _e('Preview this Page'); ?></a>
<?php } ?>
</div>

<div class="inside">
<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
示例#16
0
/**
 * gmediaTerms()
 *
 * @return mixed content
 */
function gmediaTerms()
{
    global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
    $url = add_query_arg(array('page' => $gmProcessor->page), admin_url('admin.php'));
    $endpoint = $gmGallery->options['endpoint'];
    $gm_screen_options = get_user_meta($user_ID, 'gm_screen_options', true);
    if (!is_array($gm_screen_options)) {
        $gm_screen_options = array();
    }
    $gm_screen_options = array_merge($gmGallery->options['gm_screen_options'], $gm_screen_options);
    $orderby = !empty($gm_screen_options['orderby_gmedia_terms']) ? $gm_screen_options['orderby_gmedia_terms'] : 'name';
    $order = !empty($gm_screen_options['sortorder_gmedia_terms']) ? $gm_screen_options['sortorder_gmedia_terms'] : 'ASC';
    $per_page = !empty($gm_screen_options['per_page_gmedia_terms']) ? $gm_screen_options['per_page_gmedia_terms'] : 30;
    $taxonomy = $gmCore->_get('term', 'gmedia_album');
    if ($gmCore->caps['gmedia_show_others_media']) {
        $author = 0;
    } else {
        $author = $user_ID;
    }
    $filter = 'selected' == $gmCore->_req('filter') ? $gmProcessor->selected_items : null;
    $search_string = $gmCore->_get('s', '');
    if ('#' == substr($search_string, 0, 1)) {
        $filter = substr($search_string, 1);
        $search_string = '';
    }
    $args = array('orderby' => $gmCore->_get('orderby', $orderby), 'order' => $gmCore->_get('order', $order), 'search' => $search_string, 'number' => $gmCore->_get('number', $per_page), 'hide_empty' => $gmCore->_get('hide_empty', 0), 'page' => $gmCore->_get('pager', 1), 'include' => $filter);
    $args['offset'] = ($args['page'] - 1) * $args['number'];
    $allow_edit = 0;
    switch ($taxonomy) {
        case 'gmedia_filter':
            $args['hide_empty'] = 0;
            $allow_edit = $gmCore->caps['gmedia_filter_manage'];
            $args['global'] = $gmCore->_get('author', $gmCore->caps['gmedia_edit_others_media'] ? '' : array(0, $user_ID));
            if (!$gmCore->caps['gmedia_show_others_media']) {
                $args['global'] = wp_parse_id_list($args['global']);
                $args['global'] = array_intersect(array(0, $user_ID), $args['global']);
                if (empty($args['global'])) {
                    $args['global'] = array(0, $user_ID);
                }
            }
            break;
        case 'gmedia_album':
            $allow_edit = $gmCore->caps['gmedia_album_manage'];
            $args['global'] = $gmCore->_get('author', $gmCore->caps['gmedia_edit_others_media'] ? '' : array(0, $user_ID));
            if (!$gmCore->caps['gmedia_show_others_media']) {
                $args['global'] = wp_parse_id_list($args['global']);
                $args['global'] = array_intersect(array(0, $user_ID), $args['global']);
                if (empty($args['global'])) {
                    $args['global'] = array(0, $user_ID);
                }
            }
            break;
        case 'gmedia_tag':
            $allow_edit = $gmCore->caps['gmedia_tag_manage'];
            if ('global' == $args['orderby']) {
                $args['orderby'] = 'id';
            }
            break;
        case 'gmedia_category':
            $args = array();
            break;
    }
    $gmediaTerms = $gmDB->get_terms($taxonomy, $args);
    ?>
	<div class="panel panel-default" id="gmedia-panel">
	<div class="panel-heading clearfix">

		<?php 
    if ('gmedia_category' != $taxonomy) {
        ?>
			<form class="form-inline gmedia-search-form" role="search" method="get">
				<div class="form-group">
					<input type="hidden" name="page" value="<?php 
        echo $gmProcessor->page;
        ?>
"/>
					<input type="hidden" name="term" value="<?php 
        echo $taxonomy;
        ?>
"/>
					<input id="gmedia-search" class="form-control input-sm" type="text" name="s"
					       placeholder="<?php 
        _e('Search...', 'gmLang');
        ?>
"
					       value="<?php 
        echo $gmCore->_get('s', '');
        ?>
"/>
				</div>
				<button type="submit" class="btn btn-default input-sm"><span class="glyphicon glyphicon-search"></span>
				</button>
			</form>
			<?php 
        echo $gmDB->query_pager();
        ?>
		<?php 
    }
    ?>

		<div class="btn-toolbar pull-left">
			<?php 
    if ('gmedia_category' != $taxonomy) {
        ?>
				<div class="btn-group gm-checkgroup" id="cb_global-btn">
                    <span class="btn btn-default active"><input class="doaction" id="cb_global"
                                                                data-group="cb_term-object" type="checkbox"/></span>
					<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
						<span class="caret"></span>
						<span class="sr-only"><?php 
        _e('Toggle Dropdown', 'gmLang');
        ?>
</span>
					</button>
					<ul class="dropdown-menu" role="menu">
						<li><a data-select="total" href="#"><?php 
        _e('All', 'gmLang');
        ?>
</a></li>
						<li><a data-select="none" href="#"><?php 
        _e('None', 'gmLang');
        ?>
</a></li>
						<li class="divider"></li>
						<li><a data-select="reverse" href="#"
						       title="<?php 
        _e('Reverse only visible items', 'gmLang');
        ?>
"><?php 
        _e('Reverse', 'gmLang');
        ?>
</a>
						</li>
					</ul>
				</div>
			<?php 
    }
    ?>

			<?php 
    switch ($taxonomy) {
        case 'gmedia_album':
            $button_title = __('Show: Albums', 'gmLang');
            break;
        case 'gmedia_filter':
            $button_title = __('Show: Filters', 'gmLang');
            break;
        case 'gmedia_tag':
            $button_title = __('Show: Tags', 'gmLang');
            break;
        case 'gmedia_category':
            $button_title = __('Show: Categories', 'gmLang');
            break;
        default:
            $button_title = __('Show: Albums', 'gmLang');
            break;
    }
    ?>
			<div class="btn-group" style="margin-right:20px;">
				<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
					<?php 
    echo $button_title;
    ?>
 <span class="caret"></span>
				</button>
				<ul class="dropdown-menu" role="menu">
					<li<?php 
    if ('gmedia_album' == $taxonomy) {
        echo ' class="active"';
    }
    ?>
><a href="<?php 
    echo add_query_arg(array('term' => 'gmedia_album'), $url);
    ?>
"><?php 
    _e('Albums', 'gmLang');
    ?>
</a></li>
					<li<?php 
    if ('gmedia_tag' == $taxonomy) {
        echo ' class="active"';
    }
    ?>
><a href="<?php 
    echo add_query_arg(array('term' => 'gmedia_tag'), $url);
    ?>
"><?php 
    _e('Tags', 'gmLang');
    ?>
</a></li>
					<li<?php 
    if ('gmedia_category' == $taxonomy) {
        echo ' class="active"';
    }
    ?>
><a href="<?php 
    echo add_query_arg(array('term' => 'gmedia_category'), $url);
    ?>
"><?php 
    _e('Categories', 'gmLang');
    ?>
</a></li>
					<li class="divider"></li>
					<li<?php 
    if ('gmedia_filter' == $taxonomy) {
        echo ' class="active"';
    }
    ?>
><a href="<?php 
    echo add_query_arg(array('term' => 'gmedia_filter'), $url);
    ?>
"><?php 
    _e('Custom Filters', 'gmLang');
    ?>
</a></li>
				</ul>
			</div>

			<?php 
    if ('gmedia_filter' == $taxonomy) {
        ?>
				<a class="btn btn-success pull-left" href="<?php 
        echo add_query_arg(array('edit_filter' => '0'), $url);
        ?>
"><?php 
        _e('Create Filter', 'gmLang');
        ?>
</a>
			<?php 
    }
    ?>

			<?php 
    if ('gmedia_category' != $taxonomy && !empty($gmediaTerms)) {
        ?>
				<div class="btn-group">
					<a class="btn btn-default" href="#"><?php 
        _e('Action', 'gmLang');
        ?>
</a>
					<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
						<span class="caret"></span>
						<span class="sr-only"><?php 
        _e('Toggle Dropdown', 'gmLang');
        ?>
</span>
					</button>
					<?php 
        $rel_selected_show = 'rel-selected-show';
        $rel_selected_hide = 'rel-selected-hide';
        ?>
					<ul class="dropdown-menu" role="menu">
						<li class="dropdown-header <?php 
        echo $rel_selected_hide;
        ?>
">
							<span><?php 
        _e("Select items to see more actions", "gmLang");
        ?>
</span></li>
						<li class="<?php 
        echo $rel_selected_show;
        if (!$gmCore->caps['gmedia_terms_delete']) {
            echo ' disabled';
        }
        ?>
">
							<a href="<?php 
        echo wp_nonce_url($gmCore->get_admin_url(array('delete' => 'selected'), array('filter')), 'gmedia_delete');
        ?>
"
							   class="gmedia-delete"
							   data-confirm="<?php 
        _e("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang");
        ?>
"><?php 
        _e('Delete Selected Items', 'gmLang');
        ?>
</a>
						</li>
						<?php 
        do_action('gmedia_term_action_list');
        ?>
					</ul>
				</div>

				<form class="btn-group" id="gm-selected-btn" name="gm-selected-form"
				      action="<?php 
        echo add_query_arg(array('term' => $taxonomy, 'filter' => 'selected'), $url);
        ?>
" method="post">
					<button type="submit"
					        class="btn btn<?php 
        echo 'selected' == $gmCore->_req('filter') ? '-success' : '-info';
        ?>
"><?php 
        printf(__('%s selected', 'gmLang'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>');
        ?>
</button>
					<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span
							class="caret"></span>
						<span class="sr-only"><?php 
        _e('Toggle Dropdown', 'gmLang');
        ?>
</span></button>
					<input type="hidden" id="gm-selected" data-userid="<?php 
        echo $user_ID;
        ?>
"
					       data-key="<?php 
        echo $taxonomy;
        ?>
" name="selected_items"
					       value="<?php 
        echo implode(',', $gmProcessor->selected_items);
        ?>
"/>
					<ul class="dropdown-menu" role="menu">
						<li><a id="gm-selected-show" href="#show"><?php 
        _e('Show only selected items', 'gmLang');
        ?>
</a>
						</li>
						<li><a id="gm-selected-clear" href="#clear"><?php 
        _e('Clear selected items', 'gmLang');
        ?>
</a>
						</li>
					</ul>
				</form>
			<?php 
    }
    ?>

		</div>
	</div>


	<?php 
    if ('gmedia_album' == $taxonomy) {
        ?>
		<?php 
        if ($allow_edit) {
            ?>
			<form method="post" id="gmedia-edit-term" name="gmAddTerms" class="panel-body" action="<?php 
            echo $url;
            ?>
"
			      style="padding-bottom:0; border-bottom:1px solid #ddd;">
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label><?php 
            _e('Name', 'gmLang');
            ?>
</label>
							<input type="text" class="form-control input-sm" name="term[name]"
							       placeholder="<?php 
            _e('Album Name', 'gmLang');
            ?>
" required/>
						</div>
						<div class="form-group">
							<label><?php 
            _e('Description', 'gmLang');
            ?>
</label>
                            <textarea class="form-control input-sm" style="height:75px;" rows="2"
                                      name="term[description]"></textarea>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group row">
							<div class="col-xs-6">
								<label><?php 
            _e('Order gmedia', 'gmLang');
            ?>
</label>
								<select name="term[orderby]" class="form-control input-sm">
									<option value="custom"><?php 
            _e('user defined', 'gmLang');
            ?>
</option>
									<option selected="selected" value="ID"><?php 
            _e('by ID', 'gmLang');
            ?>
</option>
									<option value="title ID"><?php 
            _e('by title', 'gmLang');
            ?>
</option>
									<option value="gmuid"><?php 
            _e('by filename', 'gmLang');
            ?>
</option>
									<option value="date ID"><?php 
            _e('by date', 'gmLang');
            ?>
</option>
									<option value="modified ID"><?php 
            _e('by last modified date', 'gmLang');
            ?>
</option>
									<option value="rand"><?php 
            _e('Random', 'gmLang');
            ?>
</option>
								</select>
							</div>
							<div class="col-xs-6">
								<label><?php 
            _e('Sort order', 'gmLang');
            ?>
</label>
								<select name="term[order]" class="form-control input-sm">
									<option selected="selected" value="DESC"><?php 
            _e('DESC', 'gmLang');
            ?>
</option>
									<option value="ASC"><?php 
            _e('ASC', 'gmLang');
            ?>
</option>
								</select>
							</div>
						</div>
						<div class="row">
							<div class="form-group col-xs-6">
								<label><?php 
            _e('Status', 'gmLang');
            ?>
</label>
								<select name="term[status]" class="form-control input-sm">
									<option selected="selected" value="public"><?php 
            _e('Public', 'gmLang');
            ?>
</option>
									<option value="private"><?php 
            _e('Private', 'gmLang');
            ?>
</option>
									<option value="draft"><?php 
            _e('Draft', 'gmLang');
            ?>
</option>
								</select>
							</div>
							<div class="col-xs-6">
								<div class="form-group">
									<label><?php 
            _e('Author', 'gmLang');
            ?>
</label>
									<?php 
            $user_ids = $gmCore->caps['gmedia_delete_others_media'] ? $gmCore->get_editable_user_ids() : array($user_ID);
            if ($user_ids && $gmCore->caps['gmedia_edit_others_media']) {
                if (!in_array($user_ID, $user_ids)) {
                    array_push($user_ids, $user_ID);
                }
                wp_dropdown_users(array('include' => $user_ids, 'include_selected' => true, 'name' => 'term[global]', 'selected' => $user_ID, 'class' => 'form-control input-sm', 'multi' => true, 'show_option_all' => __('Shared', 'gmLang')));
            } else {
                echo '<input type="hidden" name="term[global]" value="' . $user_ID . '"/>';
                echo '<div>' . get_the_author_meta('display_name', $user_ID) . '</div>';
            }
            ?>
								</div>
								<div class="form-group">
									<?php 
            wp_original_referer_field(true, 'previous');
            wp_nonce_field('GmediaTerms', 'term_save_wpnonce');
            ?>
									<input type="hidden" name="term[taxonomy]" value="gmedia_album"/>
									<button style="display:block" type="submit" class="btn btn-primary btn-sm"
									        name="gmedia_album_save"><?php 
            _e('Add New Album', 'gmLang');
            ?>
</button>
								</div>
							</div>
						</div>
					</div>
				</div>
			</form>
		<?php 
        } else {
            ?>
			<div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
				<button type="button" class="close" data-dismiss="alert">
					<span aria-hidden="true">&times;</span><span class="sr-only"><?php 
            _e('Close', 'gmLang');
            ?>
</span>
				</button>
				<strong><?php 
            _e('Info:', 'gmLang');
            ?>
</strong> <?php 
            _e('You are not allowed to add new terms', 'gmLang');
            ?>
			</div>
		<?php 
        }
        ?>
		<form class="list-group" id="gm-list-table" style="margin-bottom:4px;">
			<?php 
        if (count($gmediaTerms)) {
            foreach ($gmediaTerms as $item) {
                $termItems = array();
                $per_page = 7;
                if ($item->count) {
                    $term_meta = $gmDB->get_metadata('gmedia_term', $item->term_id);
                    $term_meta = array_map('reset', $term_meta);
                    $term_meta = array_merge(array('orderby' => 'ID', 'order' => 'DESC'), $term_meta);
                    /*
                    $term_meta_default = array('orderby' => 'ID', 'order' => 'DESC');
                    $term_meta = array_intersect_key($term_meta, $term_meta_default) + $term_meta_default;
                    */
                    $args = array('no_found_rows' => true, 'per_page' => $per_page, 'album__in' => array($item->term_id), 'author' => $author, 'orderby' => $term_meta['orderby'], 'order' => $term_meta['order']);
                    $termItems = $gmDB->get_gmedias($args);
                }
                $is_selected = in_array($item->term_id, $gmProcessor->selected_items) ? true : false;
                $author_name = '';
                $list_row_class = $row_class = '';
                $allow_terms_delete = $gmCore->caps['gmedia_terms_delete'];
                if ($item->global) {
                    if ($display_author_name = get_the_author_meta('display_name', $item->global)) {
                        $author_name .= sprintf(__('by %s', 'gmLang'), $display_author_name);
                    } else {
                        $author_name .= '(' . __('deleted author', 'gmLang') . ')';
                    }
                    if ($item->global == $user_ID) {
                        $row_class .= ' current_user';
                        $allow_edit = $gmCore->caps['gmedia_album_manage'];
                        $allow_delete = $allow_terms_delete;
                    } else {
                        $row_class .= ' other_user';
                        $allow_edit = $gmCore->caps['gmedia_edit_others_media'];
                        $allow_delete = $allow_edit && $allow_terms_delete;
                    }
                } else {
                    $author_name .= '(' . __('no author', 'gmLang') . ')';
                    $row_class .= ' shared';
                    $allow_edit = $gmCore->caps['gmedia_edit_others_media'];
                    $allow_delete = $allow_edit && $allow_terms_delete;
                }
                if ('public' != $item->status) {
                    $author_name .= ' [' . $item->status . ']';
                    if ('private' == $item->status) {
                        $list_row_class = ' list-group-item-info';
                    } elseif ('draft' == $item->status) {
                        $list_row_class = ' list-group-item-warning';
                    }
                }
                ?>
					<div class="list-group-item term-list-item<?php 
                echo $is_selected ? ' active-row' : '';
                echo $list_row_class;
                ?>
">
						<div class="row cb_term-object<?php 
                echo $row_class;
                ?>
">
							<div class="term_id">#<?php 
                echo $item->term_id;
                ?>
</div>
							<div class="col-xs-6 term-label">
								<div class="checkbox">
									<input name="doaction[]"
									       type="checkbox"<?php 
                echo $is_selected ? ' checked="checked"' : '';
                ?>
									       value="<?php 
                echo $item->term_id;
                ?>
"/>
									<?php 
                if ($allow_edit) {
                    ?>
										<a class="term_name" href="<?php 
                    echo add_query_arg(array('edit_album' => $item->term_id), $url);
                    ?>
"><?php 
                    echo esc_html($item->name);
                    ?>
</a>
									<?php 
                } else {
                    ?>
										<span class="term_name"><?php 
                    echo esc_html($item->name);
                    ?>
</span>
									<?php 
                }
                ?>
									<span class="term_info_author"><?php 
                echo $author_name;
                ?>
</span>

									<div class="object-actions">
										<?php 
                $filter_icon = '<span class="badge">' . $item->count . '</span>';
                if ($item->count) {
                    echo '<a title="' . __('Filter in Gmedia Library', 'gmLang') . '" href="' . $gmCore->get_admin_url(array('page' => 'GrandMedia', 'alb' => $item->term_id), array(), true) . '">' . $filter_icon . '</a>';
                } else {
                    echo $filter_icon;
                }
                $gmedia_hashid = gmedia_hash_id_encode($item->term_id, 'album');
                if (get_option('permalink_structure')) {
                    $cloud_link = home_url(urlencode($endpoint) . '/a/' . $gmedia_hashid);
                } else {
                    $cloud_link = add_query_arg(array("{$endpoint}" => $gmedia_hashid, 't' => 'a'), home_url('index.php'));
                }
                $share_icon = '<span class="glyphicon glyphicon-share"></span>';
                if ('draft' !== $item->status) {
                    echo '<a target="_blank" data-target="#shareModal" data-share="' . $item->term_id . '" class="share-modal" title="' . __('Share', 'gmLang') . '" href="' . $cloud_link . '">' . $share_icon . '</a>';
                } else {
                    echo "<span class='action-inactive'>{$share_icon}</span>";
                }
                $edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
                if ($allow_edit) {
                    echo '<a title="' . __('Edit', 'gmLang') . '" href="' . add_query_arg(array('edit_album' => $item->term_id), $url) . '">' . $edit_icon . '</a>';
                } else {
                    echo "<span class='action-inactive'>{$edit_icon}</span>";
                }
                if ($allow_terms_delete) {
                    $trash_icon = '<span class="glyphicon glyphicon-trash"></span>';
                    if ($allow_delete) {
                        echo '<a class="trash-icon" title="' . __('Delete', 'gmLang') . '" href="' . wp_nonce_url(add_query_arg(array('term' => $taxonomy, 'delete' => $item->term_id), $url), 'gmedia_delete') . '" data-confirm="' . __("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang") . '">' . $trash_icon . '</a>';
                    } else {
                        echo "<span class='action-inactive'>{$trash_icon}</span>";
                    }
                }
                ?>
									</div>
								</div>
							</div>
							<div class="col-xs-6">
								<div class="term-images">
									<?php 
                if (!empty($termItems)) {
                    foreach ($termItems as $i) {
                        ?>
											<img style="z-index:<?php 
                        echo $per_page--;
                        ?>
;"
											     src="<?php 
                        echo $gmCore->gm_get_media_image($i, 'thumb', false);
                        ?>
"
											     alt="<?php 
                        echo $i->ID;
                        ?>
"
											     title="<?php 
                        echo esc_attr($i->title);
                        ?>
"/>
										<?php 
                    }
                }
                if (count($termItems) < $item->count) {
                    echo '...';
                }
                ?>
								</div>
							</div>
						</div>
						<?php 
                if (!empty($item->description)) {
                    ?>
							<div class="term-description"><?php 
                    echo nl2br(esc_html($item->description));
                    ?>
</div>
						<?php 
                }
                ?>
					</div>
				<?php 
            }
        } else {
            ?>
				<div class="list-group-item">
					<div class="well well-lg text-center">
						<h4><?php 
            _e('No items to show.', 'gmLang');
            ?>
</h4>
					</div>
				</div>
			<?php 
        }
        ?>
			<?php 
        wp_original_referer_field(true, 'previous');
        wp_nonce_field('GmediaTerms');
        ?>
		</form>


	<?php 
    } elseif ('gmedia_filter' == $taxonomy) {
        ?>
		<form class="list-group" id="gm-list-table" style="margin-bottom:4px;">
			<?php 
        if (count($gmediaTerms)) {
            foreach ($gmediaTerms as $item) {
                $term_query = $gmDB->get_metadata('gmedia_term', $item->term_id, 'query', true);
                $is_selected = in_array($item->term_id, $gmProcessor->selected_items) ? true : false;
                $author_name = '';
                $row_class = '';
                $allow_terms_delete = $gmCore->caps['gmedia_terms_delete'];
                if ($item->global) {
                    if ($display_author_name = get_the_author_meta('display_name', $item->global)) {
                        $author_name .= sprintf(__('by %s', 'gmLang'), $display_author_name);
                    } else {
                        $author_name .= '(' . __('deleted author', 'gmLang') . ')';
                    }
                    if ($item->global == $user_ID) {
                        $row_class .= ' current_user';
                        $allow_edit = $gmCore->caps['gmedia_filter_manage'];
                        $allow_delete = $allow_terms_delete;
                    } else {
                        $row_class .= ' other_user';
                        $allow_edit = $gmCore->caps['gmedia_edit_others_media'];
                        $allow_delete = $allow_edit && $allow_terms_delete;
                    }
                } else {
                    $author_name .= '(' . __('no author', 'gmLang') . ')';
                    $row_class .= ' shared';
                    $allow_edit = $gmCore->caps['gmedia_edit_others_media'];
                    $allow_delete = $allow_edit && $allow_terms_delete;
                }
                ?>
					<div class="list-group-item term-list-item<?php 
                echo $is_selected ? ' active-row' : '';
                ?>
">
						<div class="row cb_term-object<?php 
                echo $row_class;
                ?>
">
							<div class="term_id">#<?php 
                echo $item->term_id;
                ?>
</div>
							<div class="col-xs-6 term-label">
								<div class="checkbox">
									<input name="doaction[]"
									       type="checkbox"<?php 
                echo $is_selected ? ' checked="checked"' : '';
                ?>
									       value="<?php 
                echo $item->term_id;
                ?>
"/>
									<?php 
                if ($allow_edit) {
                    ?>
										<a class="term_name" href="<?php 
                    echo add_query_arg(array('edit_filter' => $item->term_id), $url);
                    ?>
"><?php 
                    echo esc_html($item->name);
                    ?>
</a>
									<?php 
                } else {
                    ?>
										<span class="term_name"><?php 
                    echo esc_html($item->name);
                    ?>
</span>
									<?php 
                }
                ?>
									<span class="term_info_author"><?php 
                echo $author_name;
                ?>
</span>

									<div class="object-actions">
										<?php 
                $filter_icon = '<span class="glyphicon glyphicon-filter"></span>';
                echo '<a title="' . __('Filter in Gmedia Library', 'gmLang') . '" href="' . $gmCore->get_admin_url(array('page' => 'GrandMedia', 'custom_filter' => $item->term_id), array(), true) . '">' . $filter_icon . '</a>';
                $gmedia_hashid = gmedia_hash_id_encode($item->term_id, 'filter');
                if (get_option('permalink_structure')) {
                    $cloud_link = home_url(urlencode($endpoint) . '/f/' . $gmedia_hashid);
                } else {
                    $cloud_link = add_query_arg(array("{$endpoint}" => $gmedia_hashid, 't' => 'f'), home_url('index.php'));
                }
                $share_icon = '<span class="glyphicon glyphicon-share"></span>';
                echo '<a target="_blank" data-target="#shareModal" data-share="' . $item->term_id . '" class="share-modal" title="' . __('Share', 'gmLang') . '" href="' . $cloud_link . '">' . $share_icon . '</a>';
                $edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
                if ($allow_edit) {
                    echo '<a title="' . __('Edit', 'gmLang') . '" href="' . add_query_arg(array('edit_filter' => $item->term_id), $url) . '">' . $edit_icon . '</a>';
                } else {
                    echo "<span class='action-inactive'>{$edit_icon}</span>";
                }
                if ($allow_terms_delete) {
                    $trash_icon = '<span class="glyphicon glyphicon-trash"></span>';
                    if ($allow_delete) {
                        echo '<a class="trash-icon" title="' . __('Delete', 'gmLang') . '" href="' . wp_nonce_url(add_query_arg(array('term' => $taxonomy, 'delete' => $item->term_id), $url), 'gmedia_delete') . '" data-confirm="' . __("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang") . '">' . $trash_icon . '</a>';
                    } else {
                        echo "<span class='action-inactive'>{$trash_icon}</span>";
                    }
                }
                ?>
									</div>
								</div>
							</div>
							<div class="col-xs-6">
								<p class="term-meta" style="margin:10px 0;">
									<?php 
                echo '<b>' . __('Query:') . "</b> " . str_replace(',"', ', "', json_encode($term_query));
                ?>
								</p>
							</div>
						</div>
						<?php 
                if (!empty($item->description)) {
                    ?>
							<div class="term-description"><?php 
                    echo nl2br(esc_html($item->description));
                    ?>
</div>
						<?php 
                }
                ?>
					</div>
				<?php 
            }
        } else {
            ?>
				<div class="list-group-item">
					<div class="well well-lg text-center">
						<h4><?php 
            _e('No items to show.', 'gmLang');
            ?>
</h4>
					</div>
				</div>
			<?php 
        }
        ?>
			<?php 
        wp_original_referer_field(true, 'previous');
        wp_nonce_field('GmediaTerms');
        ?>
		</form>


	<?php 
    } elseif ('gmedia_tag' == $taxonomy) {
        ?>
		<?php 
        if ($allow_edit) {
            ?>
			<form method="post" id="gmedia-edit-term" name="gmAddTerms" class="panel-body" action="<?php 
            echo add_query_arg(array('term' => $taxonomy), $url);
            ?>
"
			      style="padding-bottom:0; border-bottom:1px solid #ddd;">
				<div class="row">
					<div class="form-group col-xs-9">
						<label><?php 
            _e('Tags', 'gmLang');
            ?>
							<small class="text-muted">(<?php 
            _e('you can type multiple tags separated by comma');
            ?>
)
							</small>
						</label>
						<input type="text" class="form-control input-sm" name="term[name]"
						       placeholder="<?php 
            _e('Tag Names', 'gmLang');
            ?>
" required/>
					</div>
					<div class="col-xs-3" style="padding-top:24px;">
						<?php 
            wp_original_referer_field(true, 'previous');
            wp_nonce_field('GmediaTerms', 'term_save_wpnonce');
            ?>
						<input type="hidden" name="term[taxonomy]" value="gmedia_tag"/>
						<button type="submit" class="btn btn-primary btn-sm"
						        name="gmedia_tag_add"><?php 
            _e('Add New Tags', 'gmLang');
            ?>
</button>
					</div>
				</div>
			</form>
		<?php 
        } else {
            ?>
			<div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
				<button type="button" class="close" data-dismiss="alert">
					<span aria-hidden="true">&times;</span><span class="sr-only"><?php 
            _e('Close', 'gmLang');
            ?>
</span>
				</button>
				<strong><?php 
            _e('Info:', 'gmLang');
            ?>
</strong> <?php 
            _e('You are not allowed to add new terms', 'gmLang');
            ?>
			</div>
		<?php 
        }
        ?>
		<form class="list-group" id="gm-list-table" style="margin-bottom:4px;">
			<?php 
        if (count($gmediaTerms)) {
            if ($gmCore->caps['gmedia_edit_others_media']) {
                $allow_edit = true;
                $allow_delete = $gmCore->caps['gmedia_terms_delete'];
            } else {
                $allow_edit = false;
                $allow_delete = false;
            }
            foreach ($gmediaTerms as $item) {
                $termItems = array();
                $per_page = 5;
                if ($item->count) {
                    $args = array('no_found_rows' => true, 'per_page' => $per_page, 'orderby' => $gmGallery->options['in_tag_orderby'], 'order' => $gmGallery->options['in_tag_order'], 'tag_id' => $item->term_id, 'author' => $author);
                    $termItems = $gmDB->get_gmedias($args);
                }
                $is_selected = in_array($item->term_id, $gmProcessor->selected_items) ? true : false;
                ?>
				<div class="list-group-item term-list-item<?php 
                echo $is_selected ? ' active-row' : '';
                ?>
">
					<div class="row cb_term-object" id="tag_<?php 
                echo $item->term_id;
                ?>
">
						<div class="term_id">#<?php 
                echo $item->term_id;
                ?>
</div>
						<div class="col-xs-6 term-label">
							<div class="checkbox">
								<input name="doaction[]"
								       type="checkbox"<?php 
                echo $is_selected ? ' checked="checked"' : '';
                ?>
								       value="<?php 
                echo $item->term_id;
                ?>
"/>
								<?php 
                if ($allow_edit) {
                    ?>
									<a class="edit_tag_link"
									   href="#tag_<?php 
                    echo $item->term_id;
                    ?>
"><?php 
                    echo esc_html($item->name);
                    ?>
</a>
									<span class="edit_tag_form" style="display:none;"><input class="edit_tag_input"
									                                                         type="text"
									                                                         data-tag_id="<?php 
                    echo $item->term_id;
                    ?>
"
									                                                         name="gmedia_tag_name[<?php 
                    echo $item->term_id;
                    ?>
]"
									                                                         value="<?php 
                    echo esc_attr($item->name);
                    ?>
"
									                                                         placeholder="<?php 
                    echo esc_attr($item->name);
                    ?>
"/><a
											href="#tag_<?php 
                    echo $item->term_id;
                    ?>
"
											class="edit_tag_save btn btn-link glyphicon glyphicon-pencil"></a></span>

								<?php 
                } else {
                    ?>
									<span><?php 
                    echo esc_html($item->name);
                    ?>
</span>
								<?php 
                }
                ?>

								<div class="object-actions">
									<?php 
                $filter_icon = '<span class="badge">' . $item->count . '</span>';
                if ($item->count) {
                    echo '<a title="' . __('Filter in Gmedia Library', 'gmLang') . '" href="' . $gmCore->get_admin_url(array('page' => 'GrandMedia', 'tag__in' => $item->term_id), array(), true) . '">' . $filter_icon . '</a>';
                } else {
                    echo $filter_icon;
                }
                $gmedia_hashid = gmedia_hash_id_encode($item->term_id, 'tag');
                if (get_option('permalink_structure')) {
                    $cloud_link = home_url(urlencode($endpoint) . '/t/' . $gmedia_hashid);
                } else {
                    $cloud_link = add_query_arg(array("{$endpoint}" => $gmedia_hashid, 't' => 't'), home_url('index.php'));
                }
                $share_icon = '<span class="glyphicon glyphicon-share"></span>';
                echo '<a target="_blank" data-target="#shareModal" data-share="' . $item->term_id . '" class="share-modal" title="' . __('Share', 'gmLang') . '" href="' . $cloud_link . '">' . $share_icon . '</a>';
                /*
                $edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
                if ( $allow_edit ){
                	echo '<a class="edit_tag_link" title="' . __('Edit', 'gmLang') . '" href="#tag_' . $item->term_id . '">'.$edit_icon.'</a>';
                }
                */
                if ($allow_delete) {
                    $trash_icon = '<span class="glyphicon glyphicon-trash"></span>';
                    echo '<a title="' . __('Delete', 'gmLang') . '" href="' . wp_nonce_url(add_query_arg(array('term' => $taxonomy, 'delete' => $item->term_id), $url), 'gmedia_delete') . '">' . $trash_icon . '</a>';
                }
                ?>
								</div>
							</div>
						</div>
						<div class="col-xs-6 term-images">
							<?php 
                if (!empty($termItems)) {
                    foreach ($termItems as $i) {
                        ?>
									<img style="z-index:<?php 
                        echo $per_page--;
                        ?>
;"
									     src="<?php 
                        echo $gmCore->gm_get_media_image($i, 'thumb', false);
                        ?>
"
									     alt="<?php 
                        echo $i->ID;
                        ?>
" title="<?php 
                        echo esc_attr($i->title);
                        ?>
"/>
								<?php 
                    }
                }
                if (count($termItems) < $item->count) {
                    echo '...';
                }
                ?>
						</div>
					</div>
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($allow_edit) {
                ?>
				<script type="text/javascript">
					jQuery(function($){
						$('#gm-list-table').data('edit', false);
						$('input.edit_tag_input').keypress(function(e){
							var tagdiv = $('#tag_' + $(this).data('tag_id'));
							var charCode = e.charCode || e.keyCode || e.which;
							if(charCode == 13){
								e.preventDefault();
								edit_tag(tagdiv);
							}
						}).blur(function(e){
							var tagdiv = $('#tag_' + $(this).data('tag_id'));
							edit_tag(tagdiv);
						});

						$('.edit_tag_link').click(function(e){
							e.preventDefault();
							var id = $(this).attr('href');
							$(this).hide();
							$(id).find('.edit_tag_form').show().find('input').focus();
							$('#gm-list-table').data('edit', true);
						});
						$('.edit_tag_save').click(function(e){
							e.preventDefault();
						});

						function edit_tag(tagdiv){
							var inp = tagdiv.find('.edit_tag_form input');
							var new_tag_name = $.trim(inp.val());
							var old_tag_name = inp.attr('placeholder');
							if((old_tag_name == new_tag_name) || ('' === new_tag_name) || $.isNumeric()){
								inp.val(old_tag_name);
								tagdiv.find('.edit_tag_form').hide();
								tagdiv.find('.edit_tag_link').show();
								return;
							}
							var post_data = {
								action: 'gmedia_tag_edit',
								tag_id: inp.data('tag_id'),
								tag_name: new_tag_name,
								_wpnonce: $('#_wpnonce').val()
							};
							$.post(ajaxurl, post_data, function(data, textStatus, jqXHR){
								console.log(data);
								if(data.error){
									//inp.val(inp.attr('placeholder'));
									$('#gmedia-panel').before(data.error);
								} else{
									//new_tag_name = new_tag_name.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
									inp.attr('placeholder', new_tag_name);
									tagdiv.find('.edit_tag_link').text(new_tag_name).show();
									$('#gmedia-panel').before(data.msg);
									tagdiv.find('.edit_tag_form').hide();
								}
							});
						}
					});
				</script>
			<?php 
            }
            ?>
			<?php 
        } else {
            ?>
				<div class="list-group-item">
					<div class="well well-lg text-center">
						<h4><?php 
            _e('No items to show.', 'gmLang');
            ?>
</h4>
					</div>
				</div>
			<?php 
        }
        ?>
			<?php 
        wp_original_referer_field(true, 'previous');
        wp_nonce_field('GmediaTerms');
        ?>
		</form>


	<?php 
    } elseif ('gmedia_category' == $taxonomy) {
        ?>
		<div class="panel-body"></div>
		<div class="list-group" id="gm-list-table" style="margin-bottom:4px;">
			<?php 
        $gmediaCategories = $gmGallery->options['taxonomies']['gmedia_category'];
        foreach ($gmediaTerms as $item) {
            $cat[$item->name] = $item;
        }
        unset($gmediaTerms);
        foreach ($gmediaCategories as $name => $title) {
            $termItems = array();
            $per_page = 10;
            if (isset($cat[$name])) {
                $count = $cat[$name]->count;
                $term_id = $cat[$name]->term_id;
                if ($count) {
                    $args = array('no_found_rows' => true, 'per_page' => $per_page, 'orderby' => $gmGallery->options['in_category_orderby'], 'order' => $gmGallery->options['in_category_order'], 'category__in' => array($term_id), 'author' => $author);
                    $termItems = $gmDB->get_gmedias($args);
                }
            } else {
                $count = 0;
                $term_id = '##';
            }
            ?>
				<div class="list-group-item term-list-item">
					<div class="row cb_term-object">
						<div class="term_id">#<?php 
            echo $term_id;
            ?>
</div>
						<div class="col-xs-6" style="padding-top:10px; padding-bottom:10px;">
							<?php 
            echo esc_html($title);
            ?>
							<div class="object-actions">
								<?php 
            $filter_icon = '<span class="badge">' . $count . '</span>';
            if ($count) {
                echo '<a title="' . __('Filter in Gmedia Library', 'gmLang') . '" href="' . $gmCore->get_admin_url(array('page' => 'GrandMedia', 'cat' => $term_id), array(), true) . '">' . $filter_icon . '</a>';
            } else {
                echo $filter_icon;
            }
            $share_icon = '<span class="glyphicon glyphicon-share"></span>';
            if (isset($cat[$name]->term_id)) {
                $gmedia_hashid = gmedia_hash_id_encode($term_id, 'tag');
                if (get_option('permalink_structure')) {
                    $cloud_link = home_url(urlencode($endpoint) . '/k/' . $gmedia_hashid);
                } else {
                    $cloud_link = add_query_arg(array("{$endpoint}" => $gmedia_hashid, 't' => 'k'), home_url('index.php'));
                }
                echo '<a target="_blank" data-target="#shareModal" data-share="' . $term_id . '" class="share-modal" title="' . __('Share', 'gmLang') . '" href="' . $cloud_link . '">' . $share_icon . '</a>';
            } else {
                echo "<span class='action-inactive'>{$share_icon}</span>";
            }
            /*
            $edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
            echo '<a title="' . __('Edit', 'gmLang') . '" href="' . add_query_arg( array( 'edit_album' => $item->term_id ), $url ) . '">'.$edit_icon.'</a>';
            */
            ?>
							</div>
						</div>
						<div class="col-xs-6 term-images">
							<?php 
            if (!empty($termItems)) {
                foreach ($termItems as $i) {
                    ?>
									<img style="z-index:<?php 
                    echo $per_page--;
                    ?>
;"
									     src="<?php 
                    echo $gmCore->gm_get_media_image($i, 'thumb', false);
                    ?>
"
									     alt="<?php 
                    echo $i->ID;
                    ?>
" title="<?php 
                    echo esc_attr($i->title);
                    ?>
"/>
								<?php 
                }
            }
            if (count($termItems) < $count) {
                echo '...';
            }
            ?>
						</div>
					</div>
				</div>
			<?php 
        }
        ?>
		</div>
	<?php 
    }
    ?>

	</div>

	<div class="modal fade gmedia-modal" id="shareModal" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title"><?php 
    _e('GmediaCloud Page');
    ?>
</h4>
				</div>
				<form class="modal-body" method="post" id="shareForm">
					<div class="form-group">
						<label><?php 
    _e('Link to page', 'gmLang');
    ?>
</label>
						<input name="sharelink" type="text" class="form-control sharelink" readonly="readonly" value=""/>
					</div>
					<div class="form-group">
						<label><?php 
    _e('Send this link to', 'gmLang');
    ?>
</label>
						<input name="email" type="email" class="form-control sharetoemail" value="" placeholder="<?php 
    _e('Email', 'gmLang');
    ?>
"/>
						<textarea name="message" cols="20" rows="3" class="form-control" placeholder="<?php 
    _e('Message (optional)', 'gmLang');
    ?>
"></textarea>
					</div>
					<input type="hidden" name="action" value="gmedia_share_page"/>
					<?php 
    wp_nonce_field('share_modal', '_sharenonce');
    ?>
				</form>
				<div class="modal-footer">
					<button type="button" class="btn btn-primary sharebutton" disabled="disabled"><?php 
    _e('Send', 'gmLang');
    ?>
</button>
					<button type="button" class="btn btn-default" data-dismiss="modal"><?php 
    _e('Close', 'gmLang');
    ?>
</button>
				</div>
			</div>
		</div>
	</div>

<?php 
}
示例#17
0
        /**
         * Primary configuration page for custom status class.
         * Shows form to add new custom statuses on the left and a
         * WP_List_Table with the custom status terms on the right
         */
        function print_configure_view()
        {
            global $edit_flow;
            /** Full width view for editing a custom status **/
            if (isset($_GET['action'], $_GET['term-id']) && $_GET['action'] == 'edit-status') {
                ?>
		<?php 
                // Check whether the term exists
                $term_id = (int) $_GET['term-id'];
                $status = $this->get_custom_status_by('id', $term_id);
                if (!$status) {
                    echo '<div class="error"><p>' . $this->module->messages['status-missing'] . '</p></div>';
                    return;
                }
                $edit_status_link = $this->get_link(array('action' => 'edit-status', 'term-id' => $term_id));
                $name = isset($_POST['name']) ? stripslashes($_POST['name']) : $status->name;
                $description = isset($_POST['description']) ? strip_tags(stripslashes($_POST['description'])) : $status->description;
                ?>

		<div id="ajax-response"></div>
		<form method="post" action="<?php 
                echo esc_attr($edit_status_link);
                ?>
" >
		<input type="hidden" name="term-id" value="<?php 
                echo esc_attr($term_id);
                ?>
" />
		<?php 
                wp_original_referer_field();
                wp_nonce_field('edit-status');
                ?>
		<table class="form-table">
			<tr class="form-field form-required">
				<th scope="row" valign="top"><label for="name"><?php 
                _e('Custom Status', 'edit-flow');
                ?>
</label></th>
				<td><input name="name" id="name" type="text" value="<?php 
                echo esc_attr($name);
                ?>
" size="40" aria-required="true" />
				<?php 
                $edit_flow->settings->helper_print_error_or_description('name', __('The name is used to identify the status. (Max: 20 characters)', 'edit-flow'));
                ?>
				</td>
			</tr>
			<tr class="form-field">
				<th scope="row" valign="top"><?php 
                _e('Slug', 'edit-flow');
                ?>
</th>
				<td>
					<input type="text" disabled="disabled" value="<?php 
                echo esc_attr($status->slug);
                ?>
" />
					<?php 
                $edit_flow->settings->helper_print_error_or_description('slug', __('The slug is the unique ID for the status and is changed when the name is changed.', 'edit-flow'));
                ?>
				</td>
			</tr>
			<tr class="form-field">
				<th scope="row" valign="top"><label for="description"><?php 
                _e('Description', 'edit-flow');
                ?>
</label></th>
				<td>
					<textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php 
                echo esc_textarea($description);
                ?>
</textarea>
				<?php 
                $edit_flow->settings->helper_print_error_or_description('description', __('The description is primarily for administrative use, to give you some context on what the custom status is to be used for.', 'edit-flow'));
                ?>
				</td>
			</tr>
		</table>
		<p class="submit">
		<?php 
                submit_button(__('Update Status', 'edit-flow'), 'primary', 'submit', false);
                ?>
		<a class="cancel-settings-link" href="<?php 
                echo esc_url($this->get_link());
                ?>
"><?php 
                _e('Cancel', 'edit-flow');
                ?>
</a>
		</p>
		</form>

		<?php 
            } else {
                ?>
		<?php 
                $wp_list_table = new EF_Custom_Status_List_Table();
                $wp_list_table->prepare_items();
                ?>
		<script type="text/javascript">
			var ef_confirm_delete_status_string = "<?php 
                echo esc_js(__('Are you sure you want to delete the post status? All posts with this status will be assigned to the default status.', 'edit-flow'));
                ?>
";
		</script>
			<div id="col-right">
				<div class="col-wrap">
					<?php 
                $wp_list_table->display();
                ?>
					<?php 
                wp_nonce_field('custom-status-sortable', 'custom-status-sortable');
                ?>
					<p class="description" style="padding-top:10px;"><?php 
                _e('Deleting a post status will assign all posts to the default post status.', 'edit-flow');
                ?>
</p>
				</div>
			</div>
			<div id="col-left">
				<div class="col-wrap">
				<div class="form-wrap">
				<h3 class="nav-tab-wrapper">
					<a href="<?php 
                echo esc_url($this->get_link());
                ?>
" class="nav-tab<?php 
                if (!isset($_GET['action']) || $_GET['action'] != 'change-options') {
                    echo ' nav-tab-active';
                }
                ?>
"><?php 
                _e('Add New', 'edit-flow');
                ?>
</a>
					<a href="<?php 
                echo esc_url($this->get_link(array('action' => 'change-options')));
                ?>
" class="nav-tab<?php 
                if (isset($_GET['action']) && $_GET['action'] == 'change-options') {
                    echo ' nav-tab-active';
                }
                ?>
"><?php 
                _e('Options', 'edit-flow');
                ?>
</a>
				</h3>
				<?php 
                if (isset($_GET['action']) && $_GET['action'] == 'change-options') {
                    ?>
				<form class="basic-settings" action="<?php 
                    echo esc_url($this->get_link(array('action' => 'change-options')));
                    ?>
" method="post">
					<?php 
                    settings_fields($this->module->options_group_name);
                    ?>
					<?php 
                    do_settings_sections($this->module->options_group_name);
                    ?>
					<?php 
                    echo '<input id="edit_flow_module_name" name="edit_flow_module_name" type="hidden" value="' . esc_attr($this->module->name) . '" />';
                    ?>
					<?php 
                    submit_button();
                    ?>
				</form>
				<?php 
                } else {
                    ?>
				<?php 
                    /** Custom form for adding a new Custom Status term **/
                    ?>
					<form class="add:the-list:" action="<?php 
                    echo esc_url($this->get_link());
                    ?>
" method="post" id="addstatus" name="addstatus">
					<div class="form-field form-required">
						<label for="status_name"><?php 
                    _e('Name', 'edit-flow');
                    ?>
</label>
						<input type="text" aria-required="true" size="20" maxlength="20" id="status_name" name="status_name" value="<?php 
                    if (!empty($_POST['status_name'])) {
                        echo esc_attr($_POST['status_name']);
                    }
                    ?>
" />
						<?php 
                    $edit_flow->settings->helper_print_error_or_description('name', __('The name is used to identify the status. (Max: 20 characters)', 'edit-flow'));
                    ?>
					</div>
					<div class="form-field">
						<label for="status_description"><?php 
                    _e('Description', 'edit-flow');
                    ?>
</label>
						<textarea cols="40" rows="5" id="status_description" name="status_description"><?php 
                    if (!empty($_POST['status_description'])) {
                        echo esc_textarea($_POST['status_description']);
                    }
                    ?>
</textarea>
						<?php 
                    $edit_flow->settings->helper_print_error_or_description('description', __('The description is primarily for administrative use, to give you some context on what the custom status is to be used for.', 'edit-flow'));
                    ?>
					</div>
					<?php 
                    wp_nonce_field('custom-status-add-nonce');
                    ?>
					<?php 
                    echo '<input id="action" name="action" type="hidden" value="add-new" />';
                    ?>
					<p class="submit"><?php 
                    submit_button(__('Add New Status', 'edit-flow'), 'primary', 'submit', false);
                    ?>
<a class="cancel-settings-link" href="<?php 
                    echo EDIT_FLOW_SETTINGS_PAGE;
                    ?>
"><?php 
                    _e('Back to Edit Flow', 'edit-flow');
                    ?>
</a></p>
					</form>
				<?php 
                }
                ?>
				</div>
			</div>
			</div>
			<?php 
                $wp_list_table->inline_edit();
                ?>
			<?php 
            }
            ?>
		<?php 
        }
        /**
         * AskApacheGoogle404::google_ajax_search_form()
         *
         * @return
         */
        function google_ajax_search_form()
        {
            //error_log(__FUNCTION__.':'.__LINE__);
            ?>


		<form id="aa404_main_settings" method="post" action="<?php 
            echo $this->plugin['action'];
            ?>
">
		<?php 
            wp_original_referer_field(true, 'previous');
            wp_nonce_field('aa404_google_ajax_search_form');
            ?>


		<h4 class="cl5">HTML Code - <a id="aa404_load_html" href="#">Load Default</a> | <a id="aa404_load_prev_html" href="#">Load Previous</a> | <a id="aa404_hide_html" href="">S/H</a></h4>
		<label for="aa404_html">This controls the output of the plugin.  Move stuff around, change what you want, and load the default if you mess up too much.<br /></label>
		<p><code style="font-weight:bold;">%error_title%</code> - replaced with the status code and error phrase - 404 Not Found<br />
		<code style="font-weight:bold;">%related_posts%</code> - replaced with your related posts html if enabled<br />
		<code style="font-weight:bold;">%recent_posts%</code> - replaced with the recent posts html if enabled<br />
		<code style="font-weight:bold;">%google_helper%</code> - replaced with the Google Fixurl Help box.</p>
		<textarea name="aa404_html" id="aa404_html" style="border-size:2px;font-size:12px; width:95%;" cols="30" rows="20"><?php 
            echo htmlspecialchars($this->code['html']);
            ?>
</textarea>


		<h4 class="cl5">Google Options - <a id="aa404_hide_1" href="#">S/H</a></h4>
		<div id="aa404_opt1"><?php 
            // API Key stuff was here
            $this->form_field(1, 'Show Google AJAX Search', 'google_ajax', 'Displays Google AJAX Search Results');
            $this->form_field(1, 'Show Google 404 Helper', 'google_404', 'Displays Google New 404 Helper');
            ?>
</div>


		<h4 class="cl5">Related Posts Options - <a id="aa404_hide_2" href="#">S/H</a></h4>
		<div id="aa404_opt2"><?php 
            $this->form_field(1, 'Show Related Posts', 'rel', 'Displays List of Posts similar to the query');
            $this->form_field(3, 'Related Posts # to Show', 'rel_num', 'How many related posts to show..');
            $this->form_field(3, 'Related Posts Excerpt Length', 'rel_len', 'How many related posts to show..');
            ?>
</div>


		<h4 class="cl5">Recent Posts Options - <a id="aa404_hide_3" href="#">S/H</a></h4>
		<div id="aa404_opt3"><?php 
            $this->form_field(1, 'Show Recent Posts', 'rec', 'Displays List of Recent Posts');
            $this->form_field(3, 'Recent Posts # to Show', 'rec_num', 'How many recent posts to show..');
            ?>
</div>


		<?php 
            $this->form_field(4, 'CSS Code', 'css', 'The css that controls the google ajax search results.. (and anything else on the page)');
            $this->form_field(4, 'JavaScript Code', 'js', 'The javscript that runs the google ajax search.. (and anything else on the page)');
            ?>


		<p class="submit"><input type="submit" class="button" id="submit_aa404_main_settings" name="submit_aa404_main_settings" value="Save Changes &raquo;" /></p>
		</form>

		<?php 
        }
	<div id="message" class="updated fade"><p><strong><?php _e('A tag was not selected for editing.'); ?></strong></p></div>
<?php
	return;
}

do_action('edit_tag_form_pre', $tag); ?>

<div class="wrap">
<?php screen_icon(); ?>
<h2><?php _e('Edit Tag'); ?></h2>
<div id="ajax-response"></div>
<form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate">
<input type="hidden" name="action" value="editedtag" />
<input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" />
<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" />
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
	<table class="form-table">
		<tr class="form-field form-required">
			<th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
			<td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
            <p class="description"><?php _e('The name is how the tag appears on your site.'); ?></p></td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
			<td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo esc_attr(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
            <p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
		</tr>
		<tr class="form-field">
			<th scope="row" valign="top"><label for="description"><?php _e('Description') ?></label></th>
			<td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($tag->description); ?></textarea><br />
            <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
	<form action="<?php 
echo $url;
?>
" method="post" style="padding:0 10px 10px" class="media-item">
		<div class="submit"><input type="submit" class="button-primary" value="<?php 
_e('Update Media');
?>
" /></div>
		<input type="hidden" name="action" value="editattachment" />
		<input type="hidden" name="attachment_id" value="<?php 
echo $id;
?>
" />
		<?php 
wp_nonce_field('media-form');
wp_original_referer_field(true, 'current');
echo get_media_item($id, array('toggle' => false, 'show_title' => false));
?>
		<div class="submit"><input type="submit" class="button-primary" value="<?php 
_e('Update Media');
?>
" /></div>
	</form>
 /**
  * Adds "_wp_original_referer" field to login form
  *
  * Callback for "login_form" hook in file "login-form.php", included by method Theme_My_Login_Template::display()
  *
  * @see Theme_My_Login_Template::display()
  * @since 6.0
  * @access public
  */
 public function login_form()
 {
     $template = Theme_My_Login::get_object()->get_active_instance();
     echo wp_original_referer_field(false, $template->get_option('instance') ? 'current' : 'previous') . "\n";
 }
function pp_admin_projects()
{
    global $user_identity;
    $title = __('Edit Projects', 'prologue-projects');
    if (!($project_category_id = pp_get_category_id('projects'))) {
        ?>
<div class="wrap nosubsub">
<?php 
        screen_icon();
        ?>
	<h2>
<?php 
        echo wp_specialchars($title);
        ?>
	</h2>
	<div id="message" class="updated"><p><?php 
        _e('You must <a href="admin.php?page=prologue-projects-settings">assign an existing category</a> as the container for all projects.', 'prologue-projects');
        ?>
</p></div>
</div>
<?php 
        return;
    }
    global $action;
    wp_reset_vars(array('action'));
    if (isset($_GET['action']) && isset($_GET['delete']) && ('delete' == $_GET['action'] || 'delete' == $_GET['action2'])) {
        $action = 'bulk-delete';
    }
    switch ($action) {
        case 'addproject':
            check_admin_referer('add-project');
            if (!current_user_can('manage_categories')) {
                wp_die(__('Cheatin&#8217; uh?', 'prologue-projects'));
            }
            if (pp_insert_project($_POST)) {
                wp_redirect('admin.php?page=prologue-projects&message=1#addproject');
            } else {
                wp_redirect('admin.php?page=prologue-projects&message=4#addproject');
            }
            exit;
            break;
        case 'delete':
            $project_ID = (int) $_GET['project_ID'];
            check_admin_referer('delete-project_' . $project_ID);
            if (!current_user_can('manage_categories')) {
                wp_die(__('Cheatin&#8217; uh?', 'prologue-projects'));
            }
            $project_name = get_catname($project_ID);
            // Don't delete the default cats.
            if ($project_ID == get_option('default_category')) {
                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one", 'prologue-projects'), $cat_name));
            }
            pp_delete_project($project_ID);
            wp_redirect('admin.php?page=prologue-projects&message=2');
            exit;
            break;
        case 'bulk-delete':
            check_admin_referer('bulk-projects');
            echo 1;
            if (!current_user_can('manage_categories')) {
                wp_die(__('You are not allowed to delete projects.', 'prologue-projects'));
            }
            foreach ((array) $_GET['delete'] as $project_ID) {
                $project_name = get_catname($project_ID);
                // Don't delete the default cats.
                if ($project_ID == get_option('default_category')) {
                    wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one", 'prologue-projects'), $cat_name));
                }
                pp_delete_project($project_ID);
            }
            $sendback = wp_get_referer();
            wp_redirect($sendback);
            exit;
            break;
        case 'edit':
            if (!current_user_can('manage_categories')) {
                wp_die(__('You are not allowed to edit projects.', 'prologue-projects'));
            }
            $title = __('Edit Project', 'prologue-projects');
            require_once 'admin-header.php';
            $project_ID = (int) $_GET['project_ID'];
            $project = pp_get_project_data($project_ID, 'all', 'editing');
            ?>

<div class="wrap nosubsub">
<?php 
            screen_icon();
            ?>

	<h2><?php 
            echo wp_specialchars($title);
            ?>
</h2>

<?php 
            if (isset($_GET['message']) && ($msg = (int) $_GET['message'])) {
                ?>

	<div id="message" class="updated fade"><p><?php 
                echo $messages[$msg];
                ?>
</p></div>

<?php 
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            ?>

			<div class="wrap">
				<div id="ajax-response"></div>
				<form name="addproject" id="editproject" method="post" action="admin.php?page=prologue-projects" class="validate">
					<input type="hidden" name="action" value="editedproject" />
					<input type="hidden" name="project_ID" value="<?php 
            echo $project['id'];
            ?>
" />
					<?php 
            wp_original_referer_field(true, 'previous');
            ?>
					<?php 
            wp_nonce_field('update-project_' . $project['id']);
            ?>

					<table class="form-table">
						<tr class="form-field form-required">
							<th scope="row" valign="top"><label for="project_name"><?php 
            _e('Project Name', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_name" id="project_name" type="text" value="<?php 
            echo attribute_escape($project['name']);
            ?>
" size="40" aria-required="true" /><br />
							<span class="setting-description"><?php 
            _e('The name is used to identify the project almost everywhere, for example under the post or in the project widgets.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_nicename"><?php 
            _e('Project Slug', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_nicename" id="project_nicename" type="text" value="<?php 
            echo attribute_escape($project['slug']);
            ?>
" size="40" /><br />
							<span class="setting-description"><?php 
            _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_parent"><?php 
            _e('Project Parent', 'prologue-projects');
            ?>
</label></th>
							<td><?php 
            wp_dropdown_categories(array('child_of' => $project_category_id, 'hide_empty' => 0, 'name' => 'project_parent', 'orderby' => 'name', 'selected' => $project['parent_id'], 'hierarchical' => true, 'show_option_none' => __('None', 'prologue-projects')));
            ?>
<br />
							<span class="setting-description"><?php 
            _e('Projects, can have a hierarchy. You might have an event project, and under that have sub-projects for catering and merchandise. Totally optional.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_description"><?php 
            _e('Description', 'prologue-projects');
            ?>
</label></th>
							<td><textarea name="project_description" id="project_description" rows="5" cols="40"><?php 
            echo wp_specialchars($project['description']);
            ?>
</textarea><br />
							<span class="setting-description"><?php 
            _e('The description is displayed on each project page.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_logo"><?php 
            _e('Project Logo', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_logo" id="project_logo" type="text" value="<?php 
            echo attribute_escape($project['logo']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The project\'s logo. Must be a full URL of an image. Maximum size of 64px x 64px is recommended.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_website"><?php 
            _e('Project Website', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_website" id="project_website" type="text" value="<?php 
            echo attribute_escape($project['website']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The project\'s external website. Must be a full URL.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_blog"><?php 
            _e('Project Blog', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_blog" id="project_blog" type="text" value="<?php 
            echo attribute_escape($project['blog']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The project\'s external blog. Must be a full URL.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_svn"><?php 
            _e('Project Subversion Repository', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_svn" id="project_svn" type="text" value="<?php 
            echo attribute_escape($project['svn']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The location of the project\'s Subversion repository. This is only common in software projects.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_trac"><?php 
            _e('Project Trac Installation', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_trac" id="project_trac" type="text" value="<?php 
            echo attribute_escape($project['trac']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The location of the project\'s Trac ticketing website. This is only common in software projects.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_intertrac"><?php 
            _e('Project InterTrac Code', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_intertrac" id="project_intertrac" type="text" value="<?php 
            echo attribute_escape($project['intertrac']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('This code allows users to distinguish between different Trac installations in the same update. This is only common in software projects.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_activity"><?php 
            _e('Project Activity Feeds', 'prologue-projects');
            ?>
</label></th>
							<td><textarea name="project_activity" id="project_activity" rows="5" cols="40"><?php 
            echo wp_specialchars(join("\n", stripslashes_deep($project['activity'])));
            ?>
</textarea><br />
							<span class="setting-description"><?php 
            _e('Specify a list of feeds you wish to aggregate into the projects "activity" sidebar. One feed per line. Activity reported by Trac is automatically included here.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_overheard"><?php 
            _e('Project Overheard Feeds', 'prologue-projects');
            ?>
</label></th>
							<td><textarea name="project_overheard" id="project_overheard" rows="5" cols="40"><?php 
            echo wp_specialchars(join("\n", stripslashes_deep($project['overheard'])));
            ?>
</textarea><br />
							<span class="setting-description"><?php 
            _e('Specify a list of feeds you wish to aggregate into the projects "overheard" sidebar. One feed per line.', 'prologue-projects');
            ?>
</span></td>
						</tr>
					</table>

					<p class="submit"><input type="submit" class="button" name="submit" value="<?php 
            _e('Update Project', 'prologue-projects');
            ?>
" /></p>
				</form>
			</div><!-- /wrap -->



<?php 
            break;
        case 'editedproject':
            $project_ID = (int) $_POST['project_ID'];
            check_admin_referer('update-project_' . $project_ID);
            if (!current_user_can('manage_categories')) {
                wp_die(__('Cheatin&#8217; uh?', 'prologue-projects'));
            }
            $location = 'admin.php?page=prologue-projects';
            if ($referer = wp_get_original_referer()) {
                if (false !== strpos($referer, 'admin.php')) {
                    $location = $referer;
                }
            }
            if (pp_update_project($_POST)) {
                $location = add_query_arg('message', 3, $location);
            } else {
                $location = add_query_arg('message', 5, $location);
            }
            wp_redirect($location);
            exit;
            break;
        default:
            if (isset($_GET['_wp_http_referer']) && !empty($_GET['_wp_http_referer'])) {
                wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
                exit;
            }
            require_once 'admin-header.php';
            $messages[1] = __('Project added.', 'prologue-projects');
            $messages[2] = __('Project deleted.', 'prologue-projects');
            $messages[3] = __('Project updated.', 'prologue-projects');
            $messages[4] = __('Project not added.', 'prologue-projects');
            $messages[5] = __('Project not updated.', 'prologue-projects');
            ?>

<div class="wrap nosubsub">
<?php 
            screen_icon();
            ?>
	<h2>
<?php 
            echo wp_specialchars($title);
            if (isset($_GET['s']) && $_GET['s']) {
                printf('<span class="subtitle">' . __('Search results for &#8220;%s&#8221;', 'prologue-projects') . '</span>', wp_specialchars(stripslashes($_GET['s'])));
            }
            ?>
	</h2>

<?php 
            if (isset($_GET['message']) && ($msg = (int) $_GET['message'])) {
                ?>
	<div id="message" class="updated fade"><p><?php 
                echo $messages[$msg];
                ?>
</p></div>
<?php 
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            ?>

	<form class="search-form topmargin" action="" method="get">
		<p class="search-box">
			<label class="hidden" for="project-search-input"><?php 
            _e('Search Projects', 'prologue-projects');
            ?>
:</label>
			<input type="text" class="search-input" id="project-search-input" name="s" value="<?php 
            _admin_search_query();
            ?>
" />
			<input type="hidden" name="page" value="prologue-projects" />
			<input type="submit" value="<?php 
            _e('Search Projects', 'prologue-projects');
            ?>
" class="button" />
		</p>
	</form><br class="clear" />

	<div id="col-container">
		<div id="col-right">
			<div class="col-wrap">
				<form id="posts-filter" action="" method="get">
					<input type="hidden" name="page" value="prologue-projects" />
					<div class="tablenav">

<?php 
            $pagenum = isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 0;
            if (empty($pagenum)) {
                $pagenum = 1;
            }
            if (!isset($projectsperpage) || $projectsperpage < 0) {
                $projectsperpage = 20;
            }
            $projectstotal = count(pp_get_projects());
            $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'prev_text' => __('&laquo;', 'prologue-projects'), 'next_text' => __('&raquo;', 'prologue-projects'), 'total' => ceil($projectstotal / $projectsperpage), 'current' => $pagenum));
            if ($page_links) {
                ?>

						<div class="tablenav-pages"><?php 
                echo $page_links;
                ?>
</div>

<?php 
            }
            ?>

						<div class="alignleft actions">
							<select name="action">
								<option value="" selected="selected"><?php 
            _e('Bulk Actions', 'prologue-projects');
            ?>
</option>
								<option value="delete"><?php 
            _e('Delete', 'prologue-projects');
            ?>
</option>
							</select>
							<input type="submit" value="<?php 
            _e('Apply', 'prologue-projects');
            ?>
" name="doaction" id="doaction" class="button-secondary action" />
							<?php 
            wp_nonce_field('bulk-projects');
            ?>
						</div>

						<br class="clear" />
					</div>

					<div class="clear"></div>

					<table class="widefat fixed" cellspacing="0">
						<thead>
							<tr>

<?php 
            print_column_headers('projects');
            ?>

							</tr>
						</thead>

						<tfoot>
							<tr>

<?php 
            print_column_headers('projects', false);
            ?>

							</tr>
						</tfoot>

						<tbody id="the-list" class="list:projects">

<?php 
            pp_project_rows($project_category_id, 0, 0, $pagenum, $projectsperpage);
            ?>

						</tbody>
					</table>

					<div class="tablenav">

<?php 
            if ($page_links) {
                ?>

						<div class="tablenav-pages"><?php 
                echo $page_links;
                ?>
</div>

<?php 
            }
            ?>

						<div class="alignleft actions">
							<select name="action2">
								<option value="" selected="selected"><?php 
            _e('Bulk Actions', 'prologue-projects');
            ?>
</option>
								<option value="delete"><?php 
            _e('Delete', 'prologue-projects');
            ?>
</option>
							</select>
							<input type="submit" value="<?php 
            _e('Apply', 'prologue-projects');
            ?>
" name="doaction2" id="doaction2" class="button-secondary action" />
							<?php 
            wp_nonce_field('bulk-projects');
            ?>
						</div>

						<br class="clear" />
					</div>
				</form>

				<div class="form-wrap">
					<p><?php 
            _e('<strong>Note:</strong><br />Deleting a project does not delete the posts in that project.', 'prologue-projects');
            ?>
</p>
				</div>
			</div>
		</div><!-- /col-right -->

		<div id="col-left">
			<div class="col-wrap">

<?php 
            if (current_user_can('manage_categories')) {
                ?>

				<div class="form-wrap">
					<h3><?php 
                _e('Add Project', 'prologue-projects');
                ?>
</h3>
					<div id="ajax-response"></div>
					<form name="addproject" id="addproject" method="post" action="admin.php?page=prologue-projects" class="add:the-list: validate">
						<input type="hidden" name="action" value="addproject" />
						<?php 
                wp_original_referer_field(true, 'previous');
                ?>
						<?php 
                wp_nonce_field('add-project');
                ?>

						<div class="form-field form-required">
							<label for="project_name"><?php 
                _e('Project Name', 'prologue-projects');
                ?>
</label>
							<input name="project_name" id="project_name" type="text" value="" size="40" aria-required="true" />
							<p><?php 
                _e('The name is used to identify the project almost everywhere, for example under the post or in the project widgets.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_nicename"><?php 
                _e('Project Slug', 'prologue-projects');
                ?>
</label>
							<input name="project_nicename" id="project_nicename" type="text" value="" size="40" />
							<p><?php 
                _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_parent"><?php 
                _e('Project Parent', 'prologue-projects');
                ?>
</label>
							<?php 
                wp_dropdown_categories(array('child_of' => $project_category_id, 'hide_empty' => 0, 'name' => 'project_parent', 'orderby' => 'name', 'selected' => 0, 'hierarchical' => true, 'show_option_none' => __('None', 'prologue-projects')));
                ?>
							<p><?php 
                _e('Projects, can have a hierarchy. You might have an event project, and under that have sub-projects for catering and merchandise. Totally optional.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_description"><?php 
                _e('Description', 'prologue-projects');
                ?>
</label>
							<textarea name="project_description" id="project_description" rows="5" cols="40"></textarea>
							<p><?php 
                _e('The description is displayed on each project page.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_logo"><?php 
                _e('Project Logo', 'prologue-projects');
                ?>
</label>
							<input name="project_logo" id="project_logo" type="text" value="" size="255" />
							<p><?php 
                _e('The project\'s logo. Must be a full URL of an image. Maximum size of 64px x 64px is recommended.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_website"><?php 
                _e('Project Website', 'prologue-projects');
                ?>
</label>
							<input name="project_website" id="project_website" type="text" value="" size="255" />
							<p><?php 
                _e('The project\'s external website. Must be a full URL.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_blog"><?php 
                _e('Project Blog', 'prologue-projects');
                ?>
</label>
							<input name="project_blog" id="project_blog" type="text" value="" size="255" />
							<p><?php 
                _e('The project\'s external blog. Must be a full URL.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_svn"><?php 
                _e('Project Subversion Repository', 'prologue-projects');
                ?>
</label>
							<input name="project_svn" id="project_svn" type="text" value="" size="255" />
							<p><?php 
                _e('The location of the project\'s Subversion repository. This is only common in software projects.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_trac"><?php 
                _e('Project Trac Installation', 'prologue-projects');
                ?>
</label>
							<input name="project_trac" id="project_trac" type="text" value="" size="255" />
							<p><?php 
                _e('The location of the project\'s Trac ticketing website. This is only common in software projects.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_intertrac"><?php 
                _e('Project InterTrac Code', 'prologue-projects');
                ?>
</label>
							<input name="project_intertrac" id="project_intertrac" type="text" value="" size="255" />
							<p><?php 
                _e('This code allows users to distinguish between different Trac installations in the same update. This is only common in software projects.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_activity"><?php 
                _e('Project Activity Feeds', 'prologue-projects');
                ?>
</label>
							<textarea name="project_activity" id="project_activity" rows="5" cols="40"></textarea>
							<p><?php 
                _e('Specify a list of feeds you wish to aggregate into the projects "activity" sidebar. One feed per line. Activity reported by Trac is automatically included here.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_overheard"><?php 
                _e('Project Overheard Feeds', 'prologue-projects');
                ?>
</label>
							<textarea name="project_overheard" id="project_overheard" rows="5" cols="40"></textarea>
							<p><?php 
                _e('Specify a list of feeds you wish to aggregate into the projects "overheard" sidebar. One feed per line.', 'prologue-projects');
                ?>
</p>
						</div>

						<p class="submit"><input type="submit" class="button" name="submit" value="<?php 
                _e('Add Project', 'prologue-projects');
                ?>
" /></p>
					</form>
				</div>

<?php 
            }
            ?>

			</div>
		</div><!-- /col-left -->
	</div><!-- /col-container -->
</div><!-- /wrap -->

<script type="text/javascript">
/* <![CDATA[ */
(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = '<?php 
            echo js_escape(__("You are about to delete the selected projects.\n  'Cancel' to stop, 'OK' to delete.", 'prologue-projects'));
            ?>
';
				return showNotice.warn(m);
			}
		});
	});
})(jQuery);
/* ]]> */
</script>

<?php 
            break;
    }
}
示例#23
0
/**
 * grandWPMedia()
 *
 * @return mixed content
 */
function grandWPMedia()
{
    global $user_ID, $gmDB, $gmCore, $gmProcessor, $gmGallery;
    $url = add_query_arg(array('page' => $gmProcessor->page), admin_url('admin.php'));
    $gm_screen_options = get_user_meta($user_ID, 'gm_screen_options', true);
    if (!is_array($gm_screen_options)) {
        $gm_screen_options = array();
    }
    $gm_screen_options = array_merge($gmGallery->options['gm_screen_options'], $gm_screen_options);
    $arg = array('mime_type' => $gmCore->_get('mime_type', ''), 'orderby' => $gmCore->_get('orderby', $gm_screen_options['orderby_wpmedia']), 'order' => $gmCore->_get('order', $gm_screen_options['sortorder_wpmedia']), 'limit' => $gm_screen_options['per_page_wpmedia'], 'filter' => $gmCore->_get('filter', ''), 's' => $gmCore->_get('s', ''));
    $wpMediaLib = $gmDB->get_wp_media_lib($arg);
    $gmedia_pager = $gmDB->query_pager();
    $gm_qty = array('total' => '', 'image' => '', 'audio' => '', 'video' => '', 'text' => '', 'application' => '', 'other' => '');
    $gmDbCount = $gmDB->count_wp_media($arg);
    foreach ($gmDbCount as $key => $value) {
        $gm_qty[$key] = '<span class="badge pull-right">' . (int) $value . '</span>';
    }
    ?>
    <div class="panel panel-default panel-fixed-header">
        <div class="panel-heading-fake"></div>
        <div class="panel-heading clearfix" style="padding-bottom:2px;">
            <div class="pull-right" style="margin-bottom:3px;">
                <div class="clearfix">
                    <?php 
    include GMEDIA_ABSPATH . 'admin/tpl/search-form.php';
    ?>

                    <div class="btn-toolbar pull-right" style="margin-bottom:4px; margin-left:4px;">
                        <?php 
    if (!$gmProcessor->gmediablank) {
        ?>
                            <a title="<?php 
        _e('More Screen Settings', 'grand-media');
        ?>
" class="show-settings-link pull-right btn btn-default btn-xs"><span class="glyphicon glyphicon-cog"></span></a>
                        <?php 
    }
    ?>
                    </div>
                </div>

                <?php 
    echo $gmedia_pager;
    ?>

                <div class="spinner"></div>

            </div>

            <div class="btn-toolbar pull-left">
                <div class="btn-group gm-checkgroup" id="cb_global-btn">
                    <span class="btn btn-default active"><input class="doaction" id="cb_global" data-group="cb_object" type="checkbox"/></span>
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                        <span class="caret"></span>
                        <span class="sr-only"><?php 
    _e('Toggle Dropdown', 'grand-media');
    ?>
</span></button>
                    <ul class="dropdown-menu" role="menu">
                        <li><a data-select="total" href="#"><?php 
    _e('All', 'grand-media');
    ?>
</a></li>
                        <li><a data-select="none" href="#"><?php 
    _e('None', 'grand-media');
    ?>
</a></li>
                        <li class="divider"></li>
                        <li><a data-select="image" href="#"><?php 
    _e('Images', 'grand-media');
    ?>
</a></li>
                        <li><a data-select="audio" href="#"><?php 
    _e('Audio', 'grand-media');
    ?>
</a></li>
                        <li><a data-select="video" href="#"><?php 
    _e('Video', 'grand-media');
    ?>
</a></li>
                        <li class="divider"></li>
                        <li>
                            <a data-select="reverse" href="#" title="<?php 
    _e('Reverse only visible items', 'grand-media');
    ?>
"><?php 
    _e('Reverse', 'grand-media');
    ?>
</a>
                        </li>
                    </ul>
                </div>

                <div class="btn-group">
                    <?php 
    $curr_mime = explode(',', $gmCore->_get('mime_type', 'total'));
    ?>
                    <?php 
    if (!empty($gmDB->filter)) {
        ?>
                        <a class="btn btn-warning" title="<?php 
        _e('Reset Filter', 'grand-media');
        ?>
" rel="total" href="<?php 
        echo $url;
        ?>
"><?php 
        _e('Filter', 'grand-media');
        ?>
</a>
                    <?php 
    } else {
        ?>
                        <button type="button" class="btn btn-default"><?php 
        _e('Filter', 'grand-media');
        ?>
</button>
                    <?php 
    }
    ?>
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                        <span class="caret"></span>
                        <span class="sr-only"><?php 
    _e('Toggle Dropdown', 'grand-media');
    ?>
</span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li role="presentation" class="dropdown-header"><?php 
    _e('TYPE', 'grand-media');
    ?>
</li>
                        <li class="total<?php 
    echo in_array('total', $curr_mime) ? ' active' : '';
    ?>
"><a rel="total" href="<?php 
    echo $gmCore->get_admin_url(array(), array('mime_type', 'pager'));
    ?>
"><?php 
    echo $gm_qty['total'] . __('All', 'grand-media');
    ?>
</a></li>
                        <li class="image<?php 
    echo (in_array('image', $curr_mime) ? ' active' : '') . ($gmDbCount['image'] ? '' : ' disabled');
    ?>
">
                            <a rel="image" href="<?php 
    echo $gmCore->get_admin_url(array('mime_type' => 'image'), array('pager'));
    ?>
"><?php 
    echo $gm_qty['image'] . __('Images', 'grand-media');
    ?>
</a></li>
                        <li class="audio<?php 
    echo (in_array('audio', $curr_mime) ? ' active' : '') . ($gmDbCount['audio'] ? '' : ' disabled');
    ?>
">
                            <a rel="audio" href="<?php 
    echo $gmCore->get_admin_url(array('mime_type' => 'audio'), array('pager'));
    ?>
"><?php 
    echo $gm_qty['audio'] . __('Audio', 'grand-media');
    ?>
</a></li>
                        <li class="video<?php 
    echo (in_array('video', $curr_mime) ? ' active' : '') . ($gmDbCount['video'] ? '' : ' disabled');
    ?>
">
                            <a rel="video" href="<?php 
    echo $gmCore->get_admin_url(array('mime_type' => 'video'), array('pager'));
    ?>
"><?php 
    echo $gm_qty['video'] . __('Video', 'grand-media');
    ?>
</a></li>
                        <li class="application<?php 
    echo (in_array('application', $curr_mime) || in_array('text', $curr_mime) ? ' active' : '') . ($gmDbCount['other'] ? '' : ' disabled');
    ?>
">
                            <a rel="application" href="<?php 
    echo $gmCore->get_admin_url(array('mime_type' => 'application,text'), array('pager'));
    ?>
"><?php 
    echo $gm_qty['other'] . __('Other', 'grand-media');
    ?>
</a></li>
                        <?php 
    do_action('gmedia_wp_filter_list');
    ?>
                    </ul>
                </div>

                <div class="btn-group">
                    <a class="btn btn-default" href="#"><?php 
    _e('Action', 'grand-media');
    ?>
</a>
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                        <span class="caret"></span>
                        <span class="sr-only"><?php 
    _e('Toggle Dropdown', 'grand-media');
    ?>
</span></button>
                    <?php 
    $rel_selected_show = 'rel-selected-show';
    $rel_selected_hide = 'rel-selected-hide';
    ?>
                    <ul class="dropdown-menu" role="menu">
                        <li class="<?php 
    echo $rel_selected_show;
    if (!$gmCore->caps['gmedia_import']) {
        echo ' disabled';
    }
    ?>
">
                            <a href="#importModal" data-modal="import-wpmedia" data-action="gmedia_import_wpmedia_modal" class="gmedia-modal"><?php 
    _e('Import to Gmedia Library...', 'grand-media');
    ?>
</a>
                        </li>
                        <!-- <li class="divider <?php 
    echo $rel_selected_hide;
    ?>
"></li> -->
                        <li class="dropdown-header <?php 
    echo $rel_selected_hide;
    ?>
"><span><?php 
    _e("Select items to see more actions", "grand-media");
    ?>
</span></li>
                        <?php 
    do_action('gmedia_action_list');
    ?>
                    </ul>
                </div>

                <form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php 
    echo add_query_arg(array('filter' => 'selected'), $url);
    ?>
" method="post">
                    <button type="submit" class="btn btn<?php 
    echo 'selected' == $gmCore->_req('filter') ? '-success' : '-info';
    ?>
"><?php 
    printf(__('%s selected', 'grand-media'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>');
    ?>
</button>
                    <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">
                        <span class="caret"></span>
                        <span class="sr-only"><?php 
    _e('Toggle Dropdown', 'grand-media');
    ?>
</span></button>
                    <input type="hidden" id="gm-selected" data-userid="<?php 
    echo $user_ID;
    ?>
" data-key="gmedia_library:wpmedia" name="selected_items" value="<?php 
    echo implode(',', $gmProcessor->selected_items);
    ?>
"/>
                    <ul class="dropdown-menu" role="menu">
                        <li><a id="gm-selected-show" href="#show"><?php 
    _e('Show only selected items', 'grand-media');
    ?>
</a></li>
                        <li><a id="gm-selected-clear" href="#clear"><?php 
    _e('Clear selected items', 'grand-media');
    ?>
</a></li>
                    </ul>
                </form>

            </div>

        </div>
        <div class="panel-body"></div>
        <?php 
    if (!empty($wpMediaLib)) {
        ?>
            <table class="table table-striped table-hover table-condenced" cellspacing="0">
                <col class="cb" style="width:40px;"/>
                <col class="id" style="width:80px;"/>
                <col class="file" style="width:100px;"/>
                <col class="type" style="width:80px;"/>
                <col class="title"/>
                <col class="descr hidden-xs"/>
                <thead>
                    <tr>
                        <th class="cb"><span>#</span></th>
                        <th class="id" title="<?php 
        _e('Sort by ID', 'grand-media');
        ?>
">
                            <?php 
        $new_order = 'ID' == $arg['orderby'] ? 'DESC' == $arg['order'] ? 'ASC' : 'DESC' : 'DESC';
        ?>
                            <a href="<?php 
        echo $gmCore->get_admin_url(array('orderby' => 'ID', 'order' => $new_order));
        ?>
"><?php 
        _e('ID', 'grand-media');
        ?>
</a>
                        </th>
                        <th class="file" title="<?php 
        _e('Sort by filename', 'grand-media');
        ?>
">
                            <?php 
        $new_order = 'filename' == $arg['orderby'] ? 'DESC' == $arg['order'] ? 'ASC' : 'DESC' : 'DESC';
        ?>
                            <a href="<?php 
        echo $gmCore->get_admin_url(array('orderby' => 'filename', 'order' => $new_order));
        ?>
"><?php 
        _e('File', 'grand-media');
        ?>
</a>
                        </th>
                        <th class="type"><span><?php 
        _e('Type', 'grand-media');
        ?>
</span></th>
                        <th class="title" title="<?php 
        _e('Sort by Title', 'grand-media');
        ?>
">
                            <?php 
        $new_order = 'title' == $arg['orderby'] ? 'DESC' == $arg['order'] ? 'ASC' : 'DESC' : 'DESC';
        ?>
                            <a href="<?php 
        echo $gmCore->get_admin_url(array('orderby' => 'title', 'order' => $new_order));
        ?>
"><?php 
        _e('Title', 'grand-media');
        ?>
</a>
                        </th>
                        <th class="descr hidden-xs"><span><?php 
        _e('Description', 'grand-media');
        ?>
</span></th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
        foreach ($wpMediaLib as $item) {
            $is_selected = in_array($item->ID, $gmProcessor->selected_items) ? true : false;
            $image = wp_get_attachment_image($item->ID, array(50, 50), false);
            if (!$image) {
                if ($src = wp_mime_type_icon($item->ID)) {
                    $src_image = $gmCore->gmedia_url . '/admin/assets/img/' . wp_basename($src);
                    $image = '<img src="' . $src_image . '" width="50" height="50" alt="icon" title="' . esc_attr($item->post_title) . '"/>';
                }
            }
            $item_url = wp_get_attachment_url($item->ID);
            $file_info = pathinfo($item_url);
            $type = explode('/', $item->post_mime_type);
            ?>
                        <tr data-id="<?php 
            echo $item->ID;
            ?>
">
                            <td class="cb">
                                <span class="cb_object"><input name="doaction[]" type="checkbox" data-type="<?php 
            echo $type[0];
            ?>
" value="<?php 
            echo $item->ID;
            ?>
"<?php 
            echo $is_selected ? ' checked="checked"' : '';
            ?>
/></span>
                            </td>
                            <td class="id"><span><?php 
            echo $item->ID;
            ?>
</span></td>
                            <td class="file">
                                <span><a href="<?php 
            echo admin_url('media.php?action=edit&amp;attachment_id=' . $item->ID);
            ?>
"><?php 
            echo $image;
            ?>
</a></span>
                            </td>
                            <td class="type"><span><?php 
            echo $file_info['extension'];
            ?>
</span></td>
                            <td class="title"><span><?php 
            echo esc_html($item->post_title);
            ?>
</span></td>
                            <td class="descr hidden-xs">
                                <div><?php 
            echo esc_html($item->post_content);
            ?>
</div>
                            </td>
                        </tr>
                    <?php 
        }
        ?>
                </tbody>
            </table>
        <?php 
    } else {
        ?>
            <div class="panel-body">
                <div class="well well-lg text-center">
                    <h4><?php 
        _e('No items to show.', 'grand-media');
        ?>
</h4>
                </div>
            </div>
        <?php 
    }
    ?>
        <?php 
    wp_original_referer_field(true, 'previous');
    wp_nonce_field('GmediaGallery');
    ?>
    </div>

    <script type="text/javascript">
        function gmedia_import_done() {
            if(jQuery('#import_window').is(':visible')) {
                var btn = jQuery('#import-done');
                btn.text(btn.data('complete-text')).prop('disabled', false);
            }
        }
    </script>
    <div class="modal fade gmedia-modal" id="importModal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog"></div>
    </div>

    <?php 
}
 /**
  * Adds "_wp_original_referer" field to login form
  *
  * Callback for "login_form" hook in file "login-form.php", included by method Theme_My_Login_Template::display()
  *
  * @see Theme_My_Login_Template::display()
  * @since 6.0
  * @access public
  */
 public function login_form()
 {
     echo wp_original_referer_field(false, Theme_My_Login::is_tml_page() ? 'previous' : 'current') . "\n";
 }
示例#25
0
?>
" class="validate"<?php 
do_action($taxonomy . '_term_edit_form_tag');
?>
>
        <input type="hidden" name="action" value="editedgroup" />
        <input type="hidden" name="group_id" value="<?php 
echo $group_id;
?>
" />
        <input type="hidden" name="taxonomy" value="<?php 
echo esc_attr($taxonomy);
?>
" />
<?php 
wp_original_referer_field(true, 'previous');
wp_nonce_field('update-group_' . $group_id);
?>
        <table class="form-table">
            <tr class="form-field form-required">
                <th scope="row" valign="top"><label for="name"><?php 
_ex('Name', 'Taxonomy Name');
?>
</label></th>
                <td><input name="name" id="name" type="text" value="<?php 
if (isset($tag->name)) {
    echo esc_attr($tag->name);
}
?>
" size="40" aria-required="true" /></td>
            </tr>
示例#26
0
/**
 * gmedia_AddMedia()
 *
 * @return mixed content
 */
function gmedia_AddMedia()
{
    global $gmCore;
    $tab = $gmCore->_get('tab', 'upload');
    $extra_tools = defined('GMEDIA_IFRAME') && GMEDIA_IFRAME ? false : true;
    ?>
	<div class="panel panel-default">
		<div class="panel-heading clearfix">
			<?php 
    if ($extra_tools) {
        ?>
				<div class="btn-toolbar pull-left">
					<div class="btn-group">
						<a class="btn btn<?php 
        echo $tab == 'upload' ? '-primary active' : '-default';
        ?>
" href="<?php 
        echo $gmCore->get_admin_url(array(), array('tab'));
        ?>
"><?php 
        _e('Upload Files', 'gmLang');
        ?>
</a>
						<?php 
        if ($gmCore->caps['gmedia_import']) {
            ?>
							<a class="btn btn<?php 
            echo $tab == 'import' ? '-primary active' : '-default';
            ?>
" href="<?php 
            echo $gmCore->get_admin_url(array('tab' => 'import'));
            ?>
"><?php 
            _e('Import', 'gmLang');
            ?>
</a><?php 
        }
        ?>
					</div>
				</div>
			<?php 
    }
    ?>
			<div id="total-progress-info" class="progress pull-right">
				<?php 
    $msg = '';
    if ($tab == 'upload') {
        $msg = __('Add files to the upload queue and click the start button', 'gmLang');
    }
    if ($tab == 'import') {
        $msg = __('Grab files from other sources', 'gmLang');
    }
    ?>
				<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0;">
					<div style="padding: 2px 10px;"><?php 
    echo $msg;
    ?>
</div>
				</div>
				<div style="padding: 2px 10px;"><?php 
    echo $msg;
    ?>
</div>
			</div>
		</div>
		<div class="panel-body" id="gmedia-msg-panel"></div>
		<div class="container-fluid gmAddMedia">
			<?php 
    if ($tab == 'upload') {
        gmedia_upload_files();
    }
    if ($tab == 'import') {
        gmedia_import();
    }
    ?>
			<?php 
    wp_original_referer_field(true, 'previous');
    ?>
		</div>
	</div>
<?php 
}