示例#1
0
function my_box_post_layout($post)
{
    $layouts = array('right' => get_template_directory_uri() . '/media/admin/images/left.layout.png', 'left' => get_template_directory_uri() . '/media/admin/images/right.layout.png', 'full' => get_template_directory_uri() . '/media/admin/images/full.layout.png');
    $sidebars = myThemes::get('sidebars-list');
    if (!is_array($sidebars)) {
        $sidebars = array();
    }
    $values = array('main-sidebar' => __('Main Sidebar', 'myThemes'), 'front-page-sidebar' => __('Front Page Sidebar', 'myThemes'), 'page-sidebar' => __('Page Sidebar', 'myThemes'), 'single-sidebar' => __('Single Sidebar', 'myThemes'), 'additional-sidebar' => __('Additional Sidebar', 'myThemes'));
    /* LAYOUT */
    echo ahtml::template(array('type' => array('template' => 'inline', 'input' => 'logic'), 'label' => __('Use custom layout', 'myThemes'), 'fieldName' => 'use-post-layout', 'action' => "{'t' : '.mythemes-post-layout' , 'f' : '-' }", 'value' => meta::get($post->ID, 'use-post-layout')));
    $use_post_layout = meta::get($post->ID, 'use-post-layout');
    if (strlen($use_post_layout) == 0 || $use_post_layout === "0") {
        $classes = 'mythemes-post-layout hidden';
    } else {
        $classes = 'mythemes-post-layout';
    }
    if ($post->post_type == 'post') {
        $type = 'single';
    } else {
        $type = $post->post_type;
    }
    $rett = ahtml::template(array('type' => array('template' => 'inline', 'input' => 'imageSelect'), 'values' => $layouts, 'coll' => 2, 'label' => __('Select Layout', 'myThemes'), 'fieldName' => 'post-layout', 'value' => meta::dget($post->ID, 'post-layout', myThemes::get($type . '-layout')), 'action' => "[ 'hs' , { 'full' : '.mythemes-layout-sidebar' } ]"));
    if (meta::get($post->ID, 'post-layout') == 'full') {
        $sidebarClass = 'mythemes-layout-sidebar hidden';
    } else {
        $sidebarClass = 'mythemes-layout-sidebar';
    }
    $rett .= ahtml::template(array('type' => array('template' => 'inline', 'input' => 'select'), 'values' => $values, 'label' => __('Select sidebar', 'myThemes'), 'fieldName' => 'post-sidebar', 'templateClass' => $sidebarClass, 'value' => meta::dget($post->ID, 'post-sidebar', myThemes::get($type . '-sidebar'))));
    echo ahtml::template(array('type' => array('template' => 'code'), 'content' => $rett, 'templateClass' => $classes));
}
示例#2
0
    function _get( $setting, $template, $itemId ) {
        
        /* ONLYR FOR CATEGORY TEMPLATE */
        $rett = '';
        $id = $itemId;
        $temp = $template;
			
        switch( $template ){
	
            case 'front-page':
            case 'single':
            case 'page':
                $rett = meta::get( $itemId , 'post-' . $setting );
                
                if( $rett ) break;
                $rett = myThemes::get( $template . '-' . $setting  );
                
                if( $rett ) break;
                $rett = myThemes::get( $setting  );
                break;
            default: {		
                $rett = myThemes::get( $setting  );
                break;
            }
        }
		
        return $rett;
    }
示例#3
0
 static function transform1($params)
 {
     $url = $params['image'];
     $data = $params['data'];
     $info = image::image_info($url);
     $path = $info['path'];
     if (!io::file_exists($path)) {
         throw new \Exception(resources::message('FILE_NOT_EXISTS', $path));
     }
     if (meta::exists($info['id'])) {
         $meta = meta::get($info['id']);
         $spath = util::apath($meta['orig']);
         $data = isset($meta['data']) ? image::combine_transform($meta['data'], $data) : $data;
     } else {
         $spath = $path;
     }
     $id = util::id();
     $name = $id . '.' . $info['ext'];
     $dpath = DRAFT_CONTENT_DIR . '/' . $name;
     image::transform_image($spath, $dpath, $data);
     meta::put($id, array('orig' => util::rpath($spath), 'oid' => $info['id'], 'path' => util::rpath($dpath), 'name' => $name, 'data' => $data, 'image' => true));
     return array('status' => 0, 'url' => DRAFT_CONTENT_URL . '/' . $name);
 }