Пример #1
0
	function get_block_stylesheet_url($mydirname)
	{
		global $xoops_config;
		$mydirpath = $xoops_config->xoops_root_path . '/modules/' . $mydirname;
		$select_theme = get_xpress_theme_name($mydirname);
		$style_file = $mydirpath . '/wp-content/themes/' . $select_theme . '/blocks/block_style.css';
		if (file_exists($style_file))
			return $xoops_config->xoops_url . '/modules/' .$mydirname . '/wp-content/themes/' . $select_theme . '/blocks/block_style.css';
		else	
			return $xoops_config->xoops_url . '/modules/' .$mydirname . '/wp-content/themes/xpress_default/blocks/block_style.css';
	}
Пример #2
0
function get_block_file_path($mydirname, $file_name)
{
    global $xoops_config, $xpress_config;
    $mydirpath = $xoops_config->xoops_root_path . '/modules/' . $mydirname;
    $select_theme = xpress_ThemeTemplate(get_xpress_theme_name($mydirname));
    $xpress_default_theme = 'xpress_default';
    $select_block = '/wp-content/themes/' . $select_theme . '/blocks/' . $file_name;
    $default_block = '/wp-content/themes/xpress_default/blocks/' . $file_name;
    $select_block_path = $mydirpath . $select_block;
    $default_block_path = $mydirpath . $default_block;
    $block_file_data = array();
    $block_file_data['file_path'] = $default_block_path;
    $block_file_data['error'] = '';
    if ($select_theme != $xpress_default_theme) {
        if (file_exists($select_block_path)) {
            $select_block_version = get_block_version($select_block_path);
            $default_block_version = get_block_version($default_block_path);
            if (version_compare($select_block_version, $default_block_version, "<")) {
                $block_file_data['file_path'] = $default_block_path;
                if ($xpress_config->is_block_error_display) {
                    $error_str = '<div style="color:red">';
                    $error_str .= sprintf(__('Block file %1$s is an old version %2$s.<br />used block file %3$s of new version %4$s.', 'xpressme'), $select_block, $select_block_version, $default_block, $default_block_version);
                    $error_str .= '</div>';
                    $block_file_data['error'] = $error_str;
                }
            } else {
                $block_file_data['file_path'] = $select_block_path;
                $block_file_data['error'] = '';
            }
        }
    }
    return $block_file_data;
}