当前位置: 首页>>代码示例>>PHP>>正文


PHP editors_head_setup函数代码示例

本文整理汇总了PHP中editors_head_setup函数的典型用法代码示例。如果您正苦于以下问题:PHP editors_head_setup函数的具体用法?PHP editors_head_setup怎么用?PHP editors_head_setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了editors_head_setup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MoodleQuickForm_editor

 /**
  * Constructor
  *
  * @param string $elementName (optional) name of the editor
  * @param string $elementLabel (optional) editor label
  * @param array $attributes (optional) Either a typical HTML attribute string
  *              or an associative array
  * @param array $options set of options to initalize filepicker
  */
 function MoodleQuickForm_editor($elementName = null, $elementLabel = null, $attributes = null, $options = null)
 {
     global $CFG, $PAGE;
     $options = (array) $options;
     foreach ($options as $name => $value) {
         if (array_key_exists($name, $this->_options)) {
             $this->_options[$name] = $value;
         }
     }
     if (!empty($options['maxbytes'])) {
         $this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
     }
     if (!$this->_options['context']) {
         // trying to set context to the current page context to make legacy files show in filepicker (e.g. forum post)
         if (!empty($PAGE->context->id)) {
             $this->_options['context'] = $PAGE->context;
         } else {
             $this->_options['context'] = context_system::instance();
         }
     }
     $this->_options['trusted'] = trusttext_trusted($this->_options['context']);
     parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
     // Note: for some reason the code using this setting does not like bools.
     $this->_options['subdirs'] = (int) ($this->_options['subdirs'] == 1);
     editors_head_setup();
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:35,代码来源:editor.php

示例2: MoodleQuickForm_htmleditor

 /**
  * Constructor
  *
  * @param string $elementName (optional) name of the html editor
  * @param string $elementLabel (optional) editor label
  * @param array $options set of options to create html editor
  * @param array $attributes (optional) Either a typical HTML attribute string
  *              or an associative array
  */
 function MoodleQuickForm_htmleditor($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
 {
     parent::MoodleQuickForm_textarea($elementName, $elementLabel, $attributes);
     // set the options, do not bother setting bogus ones
     if (is_array($options)) {
         foreach ($options as $name => $value) {
             if (array_key_exists($name, $this->_options)) {
                 if (is_array($value) && is_array($this->_options[$name])) {
                     $this->_options[$name] = @array_merge($this->_options[$name], $value);
                 } else {
                     $this->_options[$name] = $value;
                 }
             }
         }
     }
     if ($this->_options['canUseHtmlEditor'] == 'detect') {
         $this->_options['canUseHtmlEditor'] = can_use_html_editor();
     }
     if ($this->_options['canUseHtmlEditor']) {
         $this->_type = 'htmleditor';
         //$this->_elementTemplateType='wide';
     } else {
         $this->_type = 'textarea';
     }
     $this->_canUseHtmlEditor = $this->_options['canUseHtmlEditor'];
     editors_head_setup();
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:36,代码来源:htmleditor.php

示例3: __construct

 /**
  * @param string $name
  * @param string $visiblename
  * @param string $description
  * @param mixed $defaultsetting string or array
  * @param mixed $paramtype
  */
 public function __construct($name, $visiblename, $description, $defaultsetting, $paramtype = PARAM_RAW, $cols = '60', $rows = '8', $filearea = 'bcumarketingimages')
 {
     $this->rows = $rows;
     $this->cols = $cols;
     $this->filearea = $filearea;
     parent::__construct($name, $visiblename, $description, $defaultsetting, $paramtype);
     editors_head_setup();
 }
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:15,代码来源:admin_confightmleditor.php

示例4: display_add_field

 function display_add_field($recordid = 0)
 {
     global $CFG, $DB, $OUTPUT, $PAGE;
     $text = '';
     $format = 0;
     $str = '<div title="' . $this->field->description . '">';
     editors_head_setup();
     $options = array();
     $options['trusttext'] = false;
     $options['forcehttps'] = false;
     $options['subdirs'] = false;
     $options['maxfiles'] = 0;
     $options['maxbytes'] = 0;
     $options['changeformat'] = 0;
     $options['noclean'] = false;
     $itemid = $this->field->id;
     $field = 'field_' . $itemid;
     if ($recordid && ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid)))) {
         $text = $content->content;
         $format = $content->content1;
         $text = clean_text($text, $format);
     } else {
         if (can_use_html_editor()) {
             $format = FORMAT_HTML;
         } else {
             $format = FORMAT_PLAIN;
         }
     }
     $editor = editors_get_preferred_editor($format);
     $strformats = format_text_menu();
     $formats = $editor->get_supported_formats();
     foreach ($formats as $fid) {
         $formats[$fid] = $strformats[$fid];
     }
     $editor->use_editor($field, $options);
     $str .= '<div><textarea id="' . $field . '" name="' . $field . '" rows="' . $this->field->param3 . '" cols="' . $this->field->param2 . '">' . s($text) . '</textarea></div>';
     $str .= '<div><select name="' . $field . '_content1">';
     foreach ($formats as $key => $desc) {
         $selected = $format == $key ? 'selected="selected"' : '';
         $str .= '<option value="' . s($key) . '" ' . $selected . '>' . $desc . '</option>';
     }
     $str .= '</select>';
     $str .= '</div>';
     $str .= '</div>';
     return $str;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:46,代码来源:field.class.php

示例5: MoodleQuickForm_htmleditor

 /**
  * Constructor
  *
  * @param string $elementName (optional) name of the html editor
  * @param string $elementLabel (optional) editor label
  * @param array $options set of options to create html editor
  * @param array $attributes (optional) Either a typical HTML attribute string
  *              or an associative array
  */
 function MoodleQuickForm_htmleditor($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
 {
     parent::MoodleQuickForm_textarea($elementName, $elementLabel, $attributes);
     // set the options, do not bother setting bogus ones
     if (is_array($options)) {
         foreach ($options as $name => $value) {
             if (array_key_exists($name, $this->_options)) {
                 if (is_array($value) && is_array($this->_options[$name])) {
                     $this->_options[$name] = @array_merge($this->_options[$name], $value);
                 } else {
                     $this->_options[$name] = $value;
                 }
             }
         }
     }
     $this->_type = 'htmleditor';
     editors_head_setup();
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:27,代码来源:htmleditor.php

示例6: MoodleQuickForm_editor

 function MoodleQuickForm_editor($elementName = null, $elementLabel = null, $attributes = null, $options = null)
 {
     global $CFG, $PAGE;
     $options = (array) $options;
     foreach ($options as $name => $value) {
         if (array_key_exists($name, $this->_options)) {
             $this->_options[$name] = $value;
         }
     }
     if (!empty($options['maxbytes'])) {
         $this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
     }
     if (!$this->_options['context']) {
         $this->_options['context'] = get_context_instance(CONTEXT_SYSTEM);
     }
     $this->_options['trusted'] = trusttext_trusted($this->_options['context']);
     parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
     editors_head_setup();
 }
开发者ID:nigeldaley,项目名称:moodle,代码行数:19,代码来源:editor.php

示例7: display_add_field

 function display_add_field($recordid = 0)
 {
     global $CFG, $DB, $OUTPUT, $PAGE, $USER;
     $text = '';
     $format = 0;
     $str = '<div title="' . $this->field->description . '">';
     editors_head_setup();
     $options = $this->get_options();
     $itemid = $this->field->id;
     $field = 'field_' . $itemid;
     if ($recordid && ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid)))) {
         $format = $content->content1;
         $text = clean_text($content->content, $format);
         $text = file_prepare_draft_area($draftitemid, $this->context->id, 'mod_data', 'content', $content->id, $options, $text);
     } else {
         $draftitemid = file_get_unused_draft_itemid();
     }
     $updatecontrol = $field;
     $idcontrol = $field . '_itemid';
     $str .= '<input type="hidden" id="' . $updatecontrol . '" name="' . $updatecontrol . '" value="empty" />';
     $str .= '<input type="hidden"  name="' . $idcontrol . '" value="' . $draftitemid . '" />';
     // $type = DBP_AUDIOMP3;
     $usercontextid = context_user::instance($USER->id)->id;
     switch ($this->field->param4) {
         case DBP_AUDIO:
             $str .= fetchAudioRecorderForSubmission('auto', 'ignore', $updatecontrol, $usercontextid, "user", "draft", $draftitemid);
             break;
         case DBP_VIDEO:
             $str .= fetchVideoRecorderForSubmission('auto', 'ignore', $updatecontrol, $usercontextid, "user", "draft", $draftitemid);
             break;
         case DBP_AUDIOMP3:
             $str .= fetchMP3RecorderForSubmission($updatecontrol, $usercontextid, "user", "draft", $draftitemid);
             break;
         case DBP_WHITEBOARDSIMPLE:
         case DBP_WHITEBOARDFULL:
             $str .= fetchWhiteboardForSubmission($updatecontrol, $usercontextid, "user", "draft", $draftitemid);
             break;
         case DBP_SNAPSHOT:
             $str .= fetchSnapshotCameraForSubmission($updatecontrol, 'apic.jpg', 350, 400, $usercontextid, "user", "draft", $draftitemid);
             break;
     }
     return $str;
 }
开发者ID:laiello,项目名称:poodll.poodll23,代码行数:43,代码来源:field.class.php

示例8: __construct

 /**
  * Calls parent::__construct with specific arguments
  */
 public function __construct()
 {
     parent::__construct('summary', get_string('frontpagedescription'), get_string('frontpagedescriptionhelp'), NULL);
     editors_head_setup();
 }
开发者ID:raymondAntonio,项目名称:moodle,代码行数:8,代码来源:adminlib.php

示例9: display_add_field

    function display_add_field($recordid=0) {
        global $CFG, $DB, $OUTPUT, $PAGE;

        $text   = '';
        $format = 0;

        $str = '<div title="'.$this->field->description.'">';

        editors_head_setup();
        $options = $this->get_options();

        $itemid = $this->field->id;
        $field = 'field_'.$itemid;

        if ($recordid && $content = $DB->get_record('data_content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid))){
            $format = $content->content1;
            $text = clean_text($content->content, $format);
            $text = file_prepare_draft_area($draftitemid, $this->context->id, 'mod_data', 'content', $content->id, $options, $text);
        } else {
            $draftitemid = file_get_unused_draft_itemid();
            if (can_use_html_editor()) {
                $format = FORMAT_HTML;
            } else {
                $format = FORMAT_PLAIN;
            }
        }

        // get filepicker info
        //
        $fpoptions = array();
        if ($options['maxfiles'] != 0 ) {
            $args = new stdClass();
            // need these three to filter repositories list
            $args->accepted_types = array('web_image');
            $args->return_types = (FILE_INTERNAL | FILE_EXTERNAL);
            $args->context = $this->context;
            $args->env = 'filepicker';
            // advimage plugin
            $image_options = initialise_filepicker($args);
            $image_options->context = $this->context;
            $image_options->client_id = uniqid();
            $image_options->maxbytes = $options['maxbytes'];
            $image_options->env = 'editor';
            $image_options->itemid = $draftitemid;

            // moodlemedia plugin
            $args->accepted_types = array('video', 'audio');
            $media_options = initialise_filepicker($args);
            $media_options->context = $this->context;
            $media_options->client_id = uniqid();
            $media_options->maxbytes  = $options['maxbytes'];
            $media_options->env = 'editor';
            $media_options->itemid = $draftitemid;

            // advlink plugin
            $args->accepted_types = '*';
            $link_options = initialise_filepicker($args);
            $link_options->context = $this->context;
            $link_options->client_id = uniqid();
            $link_options->maxbytes  = $options['maxbytes'];
            $link_options->env = 'editor';
            $link_options->itemid = $draftitemid;

            $fpoptions['image'] = $image_options;
            $fpoptions['media'] = $media_options;
            $fpoptions['link'] = $link_options;
        }

        $editor = editors_get_preferred_editor($format);
        $strformats = format_text_menu();
        $formats =  $editor->get_supported_formats();
        foreach ($formats as $fid) {
            $formats[$fid] = $strformats[$fid];
        }
        $editor->use_editor($field, $options, $fpoptions);
        $str .= '<input type="hidden" name="'.$field.'_itemid" value="'.$draftitemid.'" />';
        $str .= '<div><textarea id="'.$field.'" name="'.$field.'" rows="'.$this->field->param3.'" cols="'.$this->field->param2.'">'.s($text).'</textarea></div>';
        $str .= '<div><select name="'.$field.'_content1">';
        foreach ($formats as $key=>$desc) {
            $selected = ($format == $key) ? 'selected="selected"' : '';
            $str .= '<option value="'.s($key).'" '.$selected.'>'.$desc.'</option>';
        }
        $str .= '</select>';
        $str .= '</div>';

        $str .= '</div>';
        return $str;
    }
开发者ID:nicusX,项目名称:moodle,代码行数:88,代码来源:field.class.php

示例10: print_textarea

/**
 * Prints a basic textarea field.
 *
 * @deprecated since Moodle 2.0
 *
 * When using this function, you should
 *
 * @global object
 * @param bool $usehtmleditor Enables the use of the htmleditor for this field.
 * @param int $rows Number of rows to display  (minimum of 10 when $height is non-null)
 * @param int $cols Number of columns to display (minimum of 65 when $width is non-null)
 * @param null $width (Deprecated) Width of the element; if a value is passed, the minimum value for $cols will be 65. Value is otherwise ignored.
 * @param null $height (Deprecated) Height of the element; if a value is passe, the minimum value for $rows will be 10. Value is otherwise ignored.
 * @param string $name Name to use for the textarea element.
 * @param string $value Initial content to display in the textarea.
 * @param int $obsolete deprecated
 * @param bool $return If false, will output string. If true, will return string value.
 * @param string $id CSS ID to add to the textarea element.
 * @return string|void depending on the value of $return
 */
function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value='', $obsolete=0, $return=false, $id='') {
    /// $width and height are legacy fields and no longer used as pixels like they used to be.
    /// However, you can set them to zero to override the mincols and minrows values below.

    // Disabling because there is not yet a viable $OUTPUT option for cases when mforms can't be used
    // debugging('print_textarea() has been deprecated. You should be using mforms and the editor element.');

    global $CFG;

    $mincols = 65;
    $minrows = 10;
    $str = '';

    if ($id === '') {
        $id = 'edit-'.$name;
    }

    if ($usehtmleditor) {
        if ($height && ($rows < $minrows)) {
            $rows = $minrows;
        }
        if ($width && ($cols < $mincols)) {
            $cols = $mincols;
        }
    }

    if ($usehtmleditor) {
        editors_head_setup();
        $editor = editors_get_preferred_editor(FORMAT_HTML);
        $editor->use_editor($id, array('legacy'=>true));
    } else {
        $editorclass = '';
    }

    $str .= "\n".'<textarea class="form-textarea" id="'. $id .'" name="'. $name .'" rows="'. $rows .'" cols="'. $cols .'">'."\n";
    if ($usehtmleditor) {
        $str .= htmlspecialchars($value); // needed for editing of cleaned text!
    } else {
        $str .= s($value);
    }
    $str .= '</textarea>'."\n";

    if ($return) {
        return $str;
    }
    echo $str;
}
开发者ID:nuckey,项目名称:moodle,代码行数:67,代码来源:deprecatedlib.php

示例11: get_string

            }
        }
    }
} else {
    echo '<div class="template_heading">' . get_string('header' . $mode, 'data') . '</div>';
}
/// If everything is empty then generate some defaults
if (empty($data->addtemplate) and empty($data->singletemplate) and empty($data->listtemplate) and empty($data->rsstemplate)) {
    data_generate_default_template($data, 'singletemplate');
    data_generate_default_template($data, 'listtemplate');
    data_generate_default_template($data, 'addtemplate');
    data_generate_default_template($data, 'asearchtemplate');
    //Template for advanced searches.
    data_generate_default_template($data, 'rsstemplate');
}
editors_head_setup();
$format = FORMAT_HTML;
if ($mode === 'csstemplate' or $mode === 'jstemplate') {
    $disableeditor = true;
}
if ($disableeditor) {
    $format = FORMAT_PLAIN;
}
$editor = editors_get_preferred_editor($format);
$strformats = format_text_menu();
$formats = $editor->get_supported_formats();
foreach ($formats as $fid) {
    $formats[$fid] = $strformats[$fid];
}
$options = array();
$options['trusttext'] = false;
开发者ID:mongo0se,项目名称:moodle,代码行数:31,代码来源:templates.php

示例12: __construct

 /**
  * @param string $name
  * @param string $visiblename
  * @param string $description
  * @param mixed $defaultsetting string or array
  * @param mixed $paramtype
  */
 public function __construct($name, $visiblename, $description, $defaultsetting, $paramtype=PARAM_RAW, $cols='60', $rows='8') {
     parent::__construct($name, $visiblename, $description, $defaultsetting, $paramtype, $cols, $rows);
     $this->set_force_ltr(false);
     editors_head_setup();
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:12,代码来源:adminlib.php

示例13: prepare

 /**
  * @see lib/moodle_html_component#prepare()
  * @return void
  */
 public function prepare()
 {
     $this->add_class('form-textarea');
     if (empty($this->id)) {
         $this->id = "edit-{$this->name}";
     }
     if ($this->usehtmleditor) {
         editors_head_setup();
         $editor = get_preferred_texteditor(FORMAT_HTML);
         $editor->use_editor($this->id, array('legacy' => true));
         $this->value = htmlspecialchars($value);
     }
     parent::prepare();
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:18,代码来源:outputcomponents.php

示例14: advanced_editor

 public function advanced_editor()
 {
     // Only output editor if preferred editor is Atto - tiny mce not supported yet.
     editors_head_setup();
     $editor = editors_get_preferred_editor(FORMAT_HTML);
     if (get_class($editor) == 'atto_texteditor') {
         $editor->use_editor('hiddenadvancededitor');
         return '<div id="hiddenadvancededitorcont"><textarea style="display:none" id="hiddenadvancededitor"></textarea></div>';
     }
     return '';
 }
开发者ID:cdsmith-umn,项目名称:moodle-mod_hsuforum,代码行数:11,代码来源:renderer.php

示例15: format_editor_field

 public static function format_editor_field($datafield, $title, $rows = 3, $cols = 40)
 {
     $content = $datafield->contentparam;
     $format = $datafield->formatparam;
     $context = $datafield->context;
     $field = $datafield->field;
     $itemid = $field->id;
     $name = 'field_' . $itemid;
     editors_head_setup();
     $options = self::get_fileoptions($context);
     if ($itemid) {
         $draftitemid = 0;
         $text = clean_text($field->{$content}, $field->{$format});
         $text = file_prepare_draft_area($draftitemid, $context->id, 'mod_data', 'content', $itemid, $options, $text);
     } else {
         $draftitemid = file_get_unused_draft_itemid();
         $text = '';
     }
     // get filepicker options, if required
     if (empty($options['maxfiles'])) {
         $filepicker_options = array();
     } else {
         $filepicker_options = self::get_filepicker_options($context, $draftitemid, $options['maxbytes']);
     }
     // set up editor
     $editor = editors_get_preferred_editor($field->{$format});
     $editor->set_text($text);
     $editor->use_editor('id_' . $name . '_content', $options, $filepicker_options);
     // format editor
     $output = '';
     $output .= self::format_editor_content($draftitemid, $name, $field->{$content}, $rows, $cols);
     $output .= self::format_editor_formats($editor, $name, $field->{$format});
     return html_writer::tag('div', $output, array('title' => $title));
 }
开发者ID:gbateson,项目名称:moodle-datafield_admin,代码行数:34,代码来源:field.class.php


注:本文中的editors_head_setup函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。