コード例 #1
0
ファイル: editor.objects.php プロジェクト: taeche/SoDoEx
 function create($args = array())
 {
     $args = wp_parse_args($args, $this->default_fields());
     $key = $args['key'] ? $args['key'] : pl_create_id($args['name']);
     if (isset($this->objects[$key])) {
         $key = $key . '_' . pl_new_clone_id();
     }
     $new = array($key => $args);
     // turns out you can add arrays, puts new templates at front
     $this->objects = $new + $this->objects;
     $this->update_objects();
     return $key;
 }
コード例 #2
0
ファイル: editor.xlist.php プロジェクト: taeche/SoDoEx
 function get_x_list_item($args)
 {
     $args = wp_parse_args($args, $this->defaults());
     $classes = join(' ', $args['class_array']);
     $popover_content = sprintf('<img src="%s" />', $args['splash']);
     $img = sprintf('<img width="300" height="225" src="%s" />', $args['thumb']);
     $datas = '';
     foreach ($args['data_array'] as $field => $val) {
         $datas .= sprintf("data-%s='%s' ", $field, $val);
     }
     $sub = $args['sub'] ? sprintf('<div class="x-item-sub">%s</div>', stripslashes($args['sub'])) : '';
     $thumb = $args['thumb'] != '' ? sprintf("<div class='x-item-frame'><div class='pl-vignette'>%s</div></div>", $img) : '';
     $icon = $args['format'] == 'media' && $args['icon'] != '' ? sprintf("<div class='img rtimg'><i class='icon icon-3x %s'></i></div>", $args['icon']) : '';
     $pad_class = $args['format'] == 'media' ? 'media fix' : '';
     $xID = $args['id'] != '' ? sprintf("data-extend-id='%s'", $args['id']) : '';
     $list_item = sprintf("<section id='%s_%s' class='x-item x-extension %s %s' %s %s>\n\t\t\t\t<div class='x-item-pad'>\n\t\t\t\t\t<div class='%s'>\n\t\t\t\t\t\t%s\n\t\t\t\t\t\t%s\n\t\t\t\t\t\t<div class='x-item-text bd'>\n\t\t\t\t\t\t\t<span class='x-name'>%s</span>\n\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t</div>\n\t\t\t\t\t%s\n\t\t\t\t</div>\n\t\t\t</section>", $args['id'], pl_new_clone_id(), 'filter-' . $args['id'], $classes, $datas, $xID, $pad_class, $thumb, $icon, $args['name'], $sub, $args['actions']);
     return $list_item;
 }
コード例 #3
0
 function load_new_section_from_map($s)
 {
     global $sections_data_handler;
     $newID = pl_new_clone_id();
     if (isset($s['settings'])) {
         $sections_data_handler->create_items(array($newID => $s['settings']));
         $this->sections_data[$newID] = $s['settings'];
     }
     return $newID;
 }
コード例 #4
0
 function add_new_callback()
 {
     $this->xlist = new EditorXList();
     //$this->extensions = new EditorExtensions;
     $this->page = new PageLinesPage();
     $filter_local = array('component' => __('Components', 'pagelines'), 'layout' => __('Layouts', 'pagelines'), 'full-width' => __('Full Width', 'pagelines'), 'format' => __('Post Layouts', 'pagelines'), 'gallery' => __('Galleries', 'pagelines'), 'navigation' => __('Navigation', 'pagelines'), 'slider' => __('Sliders', 'pagelines'), 'social' => __('Social', 'pagelines'), 'widgetized' => __('Widgetized', 'pagelines'), 'misc' => __('Miscellaneous', 'pagelines'));
     $sections = $this->get_available_sections();
     $list = '';
     $count = 1;
     foreach ($sections as $key => $s) {
         $img = sprintf('<img src="%s" style=""/>', $s->screenshot);
         if ($s->map != '') {
             $map = json_encode($s->map);
             $special_class = 'section-plcolumn';
         } else {
             $map = '';
             $special_class = '';
         }
         if ($s->filter == 'deprecated') {
             continue;
         }
         $full_width_classes = 'pl-area-sortable area-tag';
         $content_width_classes = 'pl-sortable span12 sortable-first sortable-last';
         $full_width = strpos($s->filter, 'full-width') !== false ? true : false;
         $content_width = strpos($s->filter, 'content-width') !== false ? true : false;
         $dual_loading = strpos($s->filter, 'dual-width') !== false ? true : false;
         $section_classes = $full_width ? $full_width_classes : $content_width_classes;
         $name = stripslashes($s->name);
         $desc = array();
         // Start Class Array (all classes on section icon)
         $class = array('x-add-new');
         $class['section'] = $section_classes;
         $class['special'] = $special_class;
         $filters = explode(',', $s->filter);
         foreach ($filters as $f) {
             $class['filter-' . $f] = $f;
             $desc[] = isset($filter_local[trim($f)]) ? $filter_local[trim($f)] : ucwords(trim($f));
         }
         $desc = join(', ', $desc);
         $number = $count++;
         if (!empty($s->isolate)) {
             $disable = true;
             foreach ($s->isolate as $isolation) {
                 if ($isolation == 'posts_pages' && $this->page->is_posts_page()) {
                     $disable = false;
                 } elseif ($isolation == '404_page' && is_404()) {
                     $disable = false;
                 } elseif ($isolation == 'single' && !$this->page->is_special()) {
                     $disable = false;
                 } elseif ($isolation == 'author' && 'author' == $this->page->type()) {
                     $disable = false;
                 }
             }
             if ($disable) {
                 $class['disable'] = 'x-disable';
                 $number += 100;
             }
         }
         if (!pl_is_pro() && !empty($s->sinfo['edition']) && !empty($s->sinfo['edition']) == 'pro') {
             $class['disable'] = 'x-disable';
             $desc = __('<span class="badge badge-important">PRO ONLY</span>', 'pagelines');
         }
         $data_array = array('object' => $s->class_name, 'sid' => $s->id, 'name' => $name, 'image' => $s->screenshot, 'clone' => pl_new_clone_id(), 'number' => $number);
         if (!empty($s->loading)) {
             $class['loading'] = 'loading-' . $s->loading;
         }
         if (!empty($s->ctemplate)) {
             $class['custom'] = 'custom-section';
             $data_array['custom-section'] = $s->ctemplate;
         }
         if (!empty($map)) {
             $data_array['template'] = $map;
         }
         $args = array('id' => $s->id, 'class_array' => $class, 'data_array' => $data_array, 'thumb' => $s->screenshot, 'name' => $name, 'sub' => $full_width ? __('Full Width', 'pagelines') : __('Content Width', 'pagelines'));
         $list .= $this->xlist->get_x_list_item($args);
         if ($dual_loading) {
             $args['class_array']['section'] = $full_width_classes;
             $args['class_array'][] = 'full-width';
             $args['name'] = $name . ' (Full)';
             $args['sub'] = __('Full Width', 'pagelines');
             $list .= $this->xlist->get_x_list_item($args);
         }
     }
     printf('<div class="x-list x-sections" data-panel="x-sections">%s</div>', $list);
 }
コード例 #5
0
ファイル: lib.editor.php プロジェクト: zakikazmi/TestGithub
function pl_create_id($string)
{
    if (!empty($string)) {
        $string = str_replace(' ', '_', trim(strtolower($string)));
        $string = preg_replace('/[^A-Za-z0-9\\-]/', '', $string);
    } else {
        $string = pl_new_clone_id();
    }
    return !is_int($string) ? $string : 's' . $string;
}