本文整理汇总了PHP中Editor类的典型用法代码示例。如果您正苦于以下问题:PHP Editor类的具体用法?PHP Editor怎么用?PHP Editor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Editor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch_to_editor
function switch_to_editor()
{
self::$session->frame();
$e = new Editor($this->session);
$e->wait_until_loaded();
return $e;
}
示例2: number_of_paragraphs
/**
* @test
* @group deep
* @group ck
* @group frame
*/
public function number_of_paragraphs()
{
$e = new Editor($this->session);
$e->open()->wait_until_loaded();
$t = $e->switch_to_textarea();
$this->assertEquals($t->how_many_paragraphs(), 6);
}
示例3: save_plus
public function save_plus($data)
{
// event save
$this->save($data);
// editor save
App::import('Model', 'Editor');
$Editor = new Editor();
$user = $this->_getCurrentUser();
$relation['Editor']['account_id'] = $user['id'];
$relation['Editor']['event_id'] = $this->getLastInsertID();
return $Editor->save($relation);
}
示例4: getEditor
/**
* @return AbstractEditor
*/
public function getEditor()
{
if ($this->isGuest) {
return Editor::model()->findByPk(EDitor::DEFAULT_EDITOR_ID);
}
return $this->getUser()->company->editor;
}
示例5: __construct
/**
* Constructor ContactForm
* @param Page $page_object
* @param string $send_method
* @param string $table_style
*/
function __construct($page_object, $send_method, $table_style = '')
{
parent::__construct();
if (!isset($page_object) || !isset($send_method)) {
throw new NewException("2 arguments for " . get_class($this) . "::__construct() are mandatory", 0, getDebugBacktrace(1));
}
if (gettype($page_object) != "object" || !is_subclass_of($page_object, "Page")) {
throw new NewException("Argument page_object for " . get_class($this) . "::__construct() error", 0, getDebugBacktrace(1));
}
$this->page_object = $page_object;
$this->mail_to = SMTP_MAIL;
$this->mail_to_name = SMTP_NAME;
$table_main = new Table();
$table_main->setClass($table_style);
$form = new Form($this->page_object);
$name = new TextBox($form, "contact_name");
$name_validation = new LiveValidation();
$name->setLiveValidation($name_validation->addValidatePresence()->setFieldName(__(CONTACTFORM_NAME)));
$table_main->addRowColumns(__(CONTACTFORM_NAME) . ": ", $name->setFocus())->setColumnWidth(2, "100%");
$email = new TextBox($form, "contact_email");
$email_validation = new LiveValidation();
$email->setLiveValidation($email_validation->addValidateEmail()->addValidatePresence()->setFieldName(__(CONTACTFORM_EMAIL)));
$table_main->addRowColumns(__(CONTACTFORM_EMAIL) . ": ", $email);
$subject = new TextBox($form, "contact_subject");
$subject_validation = new LiveValidation();
$subject->setLiveValidation($subject_validation->addValidatePresence()->setFieldName(__(CONTACTFORM_SUBJECT)));
$table_main->addRowColumns(__(CONTACTFORM_SUBJECT) . ": ", $subject);
$table_main->addRow();
$editor = new Editor($form, "contact_message");
$editor_validation = new LiveValidation();
$editor->setLiveValidation($editor_validation->addValidatePresence()->setFieldName(__(CONTACTFORM_MESSAGE)));
$editor->setToolbar(Editor::TOOLBAR_SIMPLE);
$table_main->addRow(new Object(__(CONTACTFORM_MESSAGE) . ": ", "<br/>", $editor))->setColspan(3)->setAlign(RowTable::ALIGN_LEFT);
$table_main->addRow();
$this->captcha = new Captcha($form, "contact_captcha");
$table_main->addRow($this->captcha)->setColspan(3);
$table_main->addRow();
$this->send_button = new Button($form, "contact_send", "", __(CONTACTFORM_SEND));
$this->send_button->assignEnterKey()->onClick($send_method)->setAjaxEvent();
$table_main->addRow($this->send_button)->setColspan(3);
$table_main->addRow();
$form->setContent($table_main);
$this->render = $form;
}
示例6: GenEditorData
public function GenEditorData($a_attr)
{
$data = array();
$data['ownerid'] = $a_attr['ownerid'];
$data['type'] = "input_gallery";
$data['name'] = $a_attr['name'];
$data['title'] = Locales::getStringOrJSONLocale($a_attr['title']);
$locdata = Locales::ReadData($a_attr['id']);
$data['images'] = $locdata['images'];
Editor::AddData(DATA_MODULE_DATA, $data);
}
示例7: store
public function store(HelpRequest $helpRequest, User $user)
{
$help = new Help();
$help->fill($helpRequest->all());
$help->content = $helpRequest->input(\Editor::input());
$help->save();
$log = new Log();
$log->user_id = $user->id;
$log->log = "新建帮助" . $help->id;
$log->save();
return redirect()->action('AdminController@getHelp');
}
示例8: On_Editor_SaveModuleFragmentObject
function On_Editor_SaveModuleFragmentObject($a_data)
{
$object = $a_data->object;
// Save
if ($object['type'] == "iterator" && $object['childs']) {
foreach ($object['childs'] as $childs) {
Database::Query("INSERT INTO `" . DB_TBL_DATA . "` (`type`, `name`, `owner`, `moduleid`) VALUES ('itr', '" . $object['name'] . "', '" . $a_data->owner . "', '" . $a_data->moduleid . "')");
$id = Database::GetLastIncrId();
Editor::SaveModuleFragment($childs, -$id);
}
}
}
示例9: GenEditorData
public function GenEditorData($a_attr)
{
$data = array();
$data['ownerid'] = $a_attr['ownerid'];
$data['type'] = "input_img";
$data['name'] = $a_attr['name'];
$data['width'] = $a_attr['width'];
$data['height'] = $a_attr['height'];
$unn = Locales::ReadData($a_attr['id']);
$data['hash'] = $unn['hash'];
$data['title'] = Locales::getStringOrJSONLocale($a_attr['title']);
Editor::AddData(DATA_MODULE_DATA, $data);
}
示例10: GenEditorData
public function GenEditorData($a_attr)
{
$data = array();
$data['ownerid'] = $a_attr['ownerid'];
$data['type'] = "input_string";
$data['name'] = $a_attr['name'];
$data['width'] = $a_attr['width'];
$data['tooltip'] = Locales::getStringOrJSONLocale($a_attr['tooltip']);
$data['title'] = Locales::getStringOrJSONLocale($a_attr['title']);
$data['datepicker'] = isset($a_attr['datepicker']) ? true : false;
$locdata = Locales::ReadData($a_attr['id']);
$data['locales'] = $locdata['text'];
Editor::AddData(DATA_MODULE_DATA, $data);
}
示例11: hookBootstrapLoaded
/**
* Listener for 'bootstrap_loaded' hook.
* Adds in required JS files for the editor to display
*
* @return array
*/
public function hookBootstrapLoaded()
{
if ($this->loadEditor === true && Registry::has('theme')) {
foreach (new DirectoryIterator($this->_zula->getDir('js') . '/tinymce/plugins') as $file) {
if (substr($file, 0, 1) != '.' && $file->isDir()) {
$tinyMcePlugins[] = $file->getFileName();
}
}
$tinyMcePlugins = implode(',', $tinyMcePlugins);
$this->_theme->addHead('js', array(), 'var tcmEditor = {defaultFormat: "' . Editor::defaultFormat() . '", tinymcePlugins: "' . $tinyMcePlugins . '"};');
$this->_theme->addJsFile('tinymce/jquery.tinymce.js');
$this->_theme->addJsFile('js/init.js', true, 'editor');
}
return true;
}
示例12: initCK
private static function initCK()
{
include CORE_ROOT . 'class/Editor/Ckeditor.php';
self::$oCKeditor = new CKEditor();
self::$oCKeditor->returnOutput = true;
// Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
// self::$oCKeditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
self::$oCKeditor->basePath = BASE_PATH . 'js/ckeditor/';
// CKFinder::SetupCKEditor(self::$oCKeditor, BASE_PATH . 'js/ckfinder/');
self::$oCKeditor->config['filebrowserBrowseUrl'] = BASE_PATH . 'admin/api/finder';
// Set global configuration (will be used by all instances of CKEditor).
// self::$oCKeditor->config['width'] = 600;
// Change default textarea attributes
// self::$oCKeditor->textareaAttributes = array("cols" => "*", "rows" => 10);
}
示例13: GenEditorData
public function GenEditorData($a_attr)
{
$data = array();
$data['ownerid'] = $a_attr['ownerid'];
$data['type'] = "input_link";
$data['name'] = $a_attr['name'];
$data['tooltip_url'] = Locales::getStringOrJSONLocale($a_attr['tooltip_url']);
$data['tooltip_title'] = Locales::getStringOrJSONLocale($a_attr['tooltip_title']);
$data['title'] = Locales::getStringOrJSONLocale($a_attr['title']);
$locdata = Locales::ReadData($a_attr['id']);
$data['link_url'] = $locdata['link_url'];
$data['link_title'] = $locdata['link_title'];
/*foreach (Locales::$m_locales as $loc) {
$link_data = Locales::ReadStringData($a_attr['id'], $loc);
$data['link_url'] = $link_data['link_url'];
$data['link_title'][$loc] = $link_data['link_title'];
}*/
Editor::AddData(DATA_MODULE_DATA, $data);
}
示例14: exec
/**
* Execute an upload
* @param Editor $editor Calling Editor instance
* @return int Primary key value
*/
public function exec($editor)
{
$id = null;
$upload = $_FILES['upload'];
// Validation - PHP standard validation
if ($upload['error'] !== UPLOAD_ERR_OK) {
if ($upload['error'] === UPLOAD_ERR_INI_SIZE) {
$this->_error = "File exceeds maximum file upload size";
} else {
$this->_error = "There was an error uploading the file (" . $upload['error'] . ")";
}
return false;
}
// Validation - acceptable file extensions
if (is_array($this->_extns)) {
$extn = pathinfo($upload['name'], PATHINFO_EXTENSION);
if (in_array(strtolower($extn), array_map('strtolower', $this->_extns)) === false) {
$this->_error = $this->_extnError;
return false;
}
}
// Validation - custom callback
for ($i = 0, $ien = count($this->_validators); $i < $ien; $i++) {
$res = $this->_validators[$i]($upload);
if (is_string($res)) {
$this->_error = $res;
return false;
}
}
// Commit to the database
if ($this->_dbTable) {
$id = $this->_dbExec($editor->db());
}
// Perform file system actions
return $this->_actionExec($id);
}
示例15: getRecordAsEditTableCells
function getRecordAsEditTableCells( IdStack $idPath, Editor $editor, Structure $visibleStructure, Record $record, &$startColumn = 0 ) {
$result = '';
$childEditorMap = $editor->getAttributeEditorMap();
foreach ( $visibleStructure->getAttributes() as $visibleAttribute ) {
$childEditor = $childEditorMap->getEditorForAttribute( $visibleAttribute );
if ( $childEditor != null ) {
$attribute = $childEditor->getAttribute();
$type = $attribute->type;
$value = $record->getAttributeValue( $attribute );
$idPath->pushAttribute( $attribute );
if ( $childEditor instanceof RecordTableCellEditor ) {
$result .= getRecordAsEditTableCells( $idPath, $childEditor, $visibleAttribute->type, $value, $startColumn );
} else {
if ( $childEditor->showEditField( $idPath ) ) {
$displayValue = $childEditor->edit( $idPath, $value );
} else {
$displayValue = "";
}
$result .= '<td class="' . getHTMLClassForType( $type, $attribute ) . ' column-' . parityClass( $startColumn ) . '">' . $displayValue . '</td>';
$startColumn++;
}
$idPath->popAttribute();
}
else {
$result .= "<td/>";
}
}
return $result;
}