Пример #1
0
    <div class="panel panel-default panel-fixed-header" id="gmedia-panel">

        <?php 
include dirname(__FILE__) . '/tpl/galleries-panel-heading.php';
do_action('gmedia_before_galleries_list');
?>

        <form class="list-group <?php 
echo $gmedia_term_taxonomy;
?>
" id="gm-list-table" style="margin-bottom:4px;">
            <?php 
$taxterm = $gmProcessor->taxterm;
if (count($gmedia_terms)) {
    foreach ($gmedia_terms as &$item) {
        gmedia_gallery_more_data($item);
        $item->classes = array();
        if ('publish' != $item->status) {
            if ('private' == $item->status) {
                $item->classes[] = 'list-group-item-info';
            } elseif ('draft' == $item->status) {
                $item->classes[] = 'list-group-item-warning';
            }
        }
        $item->classes[] = $item->global ? $item->global == $user_ID ? 'current_user' : 'other_user' : 'shared';
        $item->selected = in_array($item->term_id, (array) $gmProcessor->selected_items);
        if ($item->selected) {
            $item->classes[] = 'gm-selected';
        }
        include dirname(__FILE__) . "/tpl/{$taxterm}-list-item.php";
    }
Пример #2
0
    /**
     * Back-end widget form.
     * @see WP_Widget::form()
     *
     * @param array $instance Previously saved values from database.
     *
     * @return string|void
     */
    public function form($instance)
    {
        global $gmDB;
        $title = !empty($instance['title']) ? $instance['title'] : esc_html__('New title', 'grand-media');
        $gmedia_terms = $gmDB->get_terms('gmedia_gallery', array('status' => array('publish', 'private'), 'orderby' => 'name', 'order' => 'ASC'));
        ?>
        <p>
            <label for="<?php 
        echo esc_attr($this->get_field_id('title'));
        ?>
"><?php 
        esc_attr_e('Title:', 'grand-media');
        ?>
</label>
            <input class="widefat" id="<?php 
        echo esc_attr($this->get_field_id('title'));
        ?>
" name="<?php 
        echo esc_attr($this->get_field_name('title'));
        ?>
" type="text" value="<?php 
        echo esc_attr($title);
        ?>
">
        </p>
        <p>
            <label for="<?php 
        echo esc_attr($this->get_field_id('title'));
        ?>
"><?php 
        esc_attr_e('Choose Gallery', 'grand-media');
        ?>
:</label>
            <select class="widefat" id="<?php 
        echo esc_attr($this->get_field_id('term_id'));
        ?>
" name="<?php 
        echo esc_attr($this->get_field_name('term_id'));
        ?>
">
                <option value=""><?php 
        _e('Random Gallery with status "publish"', 'grand-media');
        ?>
</option>
                <?php 
        foreach ($gmedia_terms as &$item) {
            gmedia_gallery_more_data($item);
            $selected = $instance['term_id'] ? selected($instance['term_id'], $item->term_id, false) : '';
            echo "<option value='{$item->term_id}' {$selected}>{$item->name} [{$item->status}] " . ($item->author_name ? sprintf(__('by %s', 'grand-media'), $item->author_name) : '(' . __('deleted author', 'grand-media') . ')') . '</option>';
        }
        ?>
            </select>
        </p>
        <?php 
    }
Пример #3
0
global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
$term_id = $gmCore->_get('edit_term');
$gmedia_url = add_query_arg(array('edit_term' => $term_id), $gmProcessor->url);
$gmedia_user_options = $gmProcessor->user_options;
$gmedia_term_taxonomy = $gmProcessor->taxonomy;
$taxterm = $gmProcessor->taxterm;
if (!gm_user_can("{$taxterm}_manage")) {
    die('-1');
}
$term_id = (int) $term_id;
$term = $gmDB->get_term($term_id);
if (empty($term) || is_wp_error($term)) {
    $term_id = 0;
    $term = new stdClass();
}
gmedia_gallery_more_data($term);
$gmedia_modules = get_gmedia_modules(false);
$default_options = array();
$presets = false;
$default_preset = array();
$load_preset = array();
$global_preset = array();
$gmedia_filter = gmedia_gallery_query_data($term->meta['_query']);
/**
 * @var $place
 * @var $module_name
 * @var $module_url
 * @var $module_path
 */
if ($term->module['name']) {
    $presets = $gmDB->get_terms('gmedia_module', array('status' => $term->module['name']));