Пример #1
0
 public static function bootstrap($load_bsjs, $load_bscss, $local_css, $custom_tag = true)
 {
     $app = JFactory::getApplication();
     // Load Bootstrap JavaScript
     if ($load_bsjs && !isset($app->cjbsjs)) {
         if (APP_VERSION < 3) {
             // make sure jquery is loaded
             CjLibBehavior::jquery();
             // now load bootstrap
             CJFunctions::add_script(CJLIB_MEDIA_URI . '/bootstrap/js/bootstrap.min.js', $custom_tag);
         } else {
             JHtml::_('bootstrap.framework');
         }
         CJFunctions::add_script(CJLIB_MEDIA_URI . '/bootstrap/js/respond.min.js', $custom_tag);
         $app->cjbsjs = true;
     }
     // Load Bootstrap CSS
     if ($load_bscss && !isset($app->cjbscss)) {
         $doc = JFactory::getDocument();
         // 			CJFunctions::add_css_to_document($doc, '/media/jui/css/bootstrap.min.css', false);
         CJFunctions::add_css_to_document($doc, CJLIB_MEDIA_URI . '/bootstrap/css/' . ($local_css ? 'cj.' : '') . 'bootstrap.min.css', $custom_tag);
         if ($doc->direction == 'rtl') {
             CJFunctions::add_css_to_document($doc, CJLIB_MEDIA_URI . '/bootstrap/css/' . ($local_css ? 'cj.' : '') . 'boostrap-rtl.min.css', $custom_tag);
         }
         $app->cjbscss = true;
     }
 }
Пример #2
0
    /**
     * Returns the editor html markup based on the <code>editor</code> type choosen, bbcode - BBCode Editor, wysiwyg - Joomla default editor, none - plain text area.
     *  
     * @param string $editor editor type
     * @param int $id id of the editor/textarea tag
     * @param string $name name of the editor/textarea tag
     * @param string $html default content to be populated in editor/textarea
     * @param int $rows number of rows of the textarea
     * @param int $cols number of columns of the textarea
     * @param string $width width of the editor in pixels or percentage  
     * @param string $height height of the editor in pixels or percentage
     * @param string $class css class applied to the editor 
     * @param string $style style applied to the editor
     * 
     * @return string output of the loaded editor markup 
     */
    public static function load_editor($editor, $id, $name, $html, $rows, $cols, $width = null, $height = null, $class = null, $style = null, $custom_tag = false)
    {
        $style = $style ? ' style="' . $style . '"' : '';
        $class = $class ? ' class="' . $class . '"' : '';
        $width = $width ? $width : '450px';
        $height = $height ? $height : '200px';
        if ($editor == 'bbcode') {
            $content = '<style type="text/css"><!-- .markItUpHeader ul { margin: 0; } .markItUpHeader ul li	{ list-style:none; float:left; position:relative; background: none;	line-height: 100%; margin: 0; padding: 0; } --></style>';
            $content .= '<div style="width: ' . $width . ';"><textarea name="' . $name . '" id="' . $id . '" rows="' . $rows . '" cols="' . $cols . '"' . $style . $class . '>' . $html . '</textarea></div>';
            $document = JFactory::getDocument();
            CJFunctions::add_script_to_document($document, 'jquery.markitup.js', $custom_tag, CJLIB_URI . '/lib/markitup/');
            CJFunctions::add_script_to_document($document, 'set.js', $custom_tag, CJLIB_URI . '/lib/markitup/sets/bbcode/');
            $document->addStyleSheet(CJLIB_URI . '/lib/markitup/skins/markitup/style.css');
            $document->addStyleSheet(CJLIB_URI . '/lib/markitup/sets/bbcode/style.css');
            $document->addScriptDeclaration('jQuery(document).ready(function($){$("#' . $id . '").markItUp(cjbbcode)});;');
        } else {
            if ($editor == 'wysiwyg' || $editor == 'default') {
                $jeditor = JFactory::getEditor();
                $content = '<div style="overflow: hidden; clear: both;">' . $jeditor->display($name, $html, $width, $height, $cols, $rows, true, $id) . '</div>';
            } else {
                if ($editor == 'wysiwygbb') {
                    $document = JFactory::getDocument();
                    CJFunctions::add_css_to_document($document, CJLIB_MEDIA_URI . '/sceditor/minified/themes/square.min.css', $custom_tag);
                    CJFunctions::add_script(CJLIB_MEDIA_URI . '/sceditor/minified/jquery.sceditor.bbcode.min.js', $custom_tag);
                    $document->addCustomTag('
					<script type="text/javascript">
					jQuery(document).ready(function($){
						$("#' . $id . '").sceditor({
							plugins: "bbcode", 
							style: "' . JUri::root(true) . '/media/com_cjlib/sceditor/minified/jquery.sceditor.default.min.css",
							emoticonsRoot: "' . JUri::root(true) . '/media/com_cjlib/sceditor/",
							width: "98%",
							autoUpdate: true
						});
						$("#' . $id . '").sceditor("instance").rtl(' . ($document->direction == 'rtl' ? 'true' : 'false') . ');
					});
					</script>');
                    $content = '<textarea name="' . $name . '" id="' . $id . '" rows="5" cols="50"' . $style . $class . '>' . $html . '</textarea>';
                } else {
                    $content = '<textarea name="' . $name . '" id="' . $id . '" rows="5" cols="50"' . $style . $class . '>' . $html . '</textarea>';
                }
            }
        }
        return $content;
    }