Exemplo n.º 1
0
    } else {
        return list_pages_json();
    }
}
function i18n_customfields_customize_ckeditor($editorvar)
{
    // copied and modified from ckeditor_add_page_link()
    echo "\n\t// modify existing Link dialog\n\tCKEDITOR.on( 'dialogDefinition', function( ev )\t{\n\t\tif ((ev.editor != " . $editorvar . ") || (ev.data.name != 'link')) return;\n\n\t\t// Overrides definition.\n\t\tvar definition = ev.data.definition;\n\t\tdefinition.onFocus = CKEDITOR.tools.override(definition.onFocus, function(original) {\n\t\t\treturn function() {\n\t\t\t\toriginal.call(this);\n\t\t\t\t\tif (this.getValueOf('info', 'linkType') == 'localPage') {\n\t\t\t\t\t\tthis.getContentElement('info', 'localPage_path').select();\n\t\t\t\t\t}\n\t\t\t};\n\t\t});\n\n\t\t// Overrides linkType definition.\n\t\tvar infoTab = definition.getContents('info');\n\t\tvar content = getById(infoTab.elements, 'linkType');\n\n\t\tcontent.items.unshift(['Link to local page', 'localPage']);\n\t\tcontent['default'] = 'localPage';\n\t\tinfoTab.elements.push({\n\t\t\ttype: 'vbox',\n\t\t\tid: 'localPageOptions',\n\t\t\tchildren: [{\n\t\t\t\ttype: 'select',\n\t\t\t\tid: 'localPage_path',\n\t\t\t\tlabel: 'Select page:',\n\t\t\t\trequired: true,\n\t\t\t\titems: " . i18n_customfields_list_pages_json() . ",\n\t\t\t\tsetup: function(data) {\n\t\t\t\t\tif ( data.localPage )\n\t\t\t\t\t\tthis.setValue( data.localPage );\n\t\t\t\t}\n\t\t\t}]\n\t\t});\n\t\tcontent.onChange = CKEDITOR.tools.override(content.onChange, function(original) {\n\t\t\treturn function() {\n\t\t\t\toriginal.call(this);\n\t\t\t\tvar dialog = this.getDialog();\n\t\t\t\tvar element = dialog.getContentElement('info', 'localPageOptions').getElement().getParent().getParent();\n\t\t\t\tif (this.getValue() == 'localPage') {\n\t\t\t\t\telement.show();\n\t\t\t\t\tif (" . $editorvar . ".config.linkShowTargetTab) {\n\t\t\t\t\t\tdialog.showPage('target');\n\t\t\t\t\t}\n\t\t\t\t\tvar uploadTab = dialog.definition.getContents('upload');\n\t\t\t\t\tif (uploadTab && !uploadTab.hidden) {\n\t\t\t\t\t\tdialog.hidePage('upload');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\telement.hide();\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t\tcontent.setup = function(data) {\n\t\t\tif (!data.type || (data.type == 'url') && !data.url) {\n\t\t\t\tdata.type = 'localPage';\n\t\t\t}\n\t\t\telse if (data.url && !data.url.protocol && data.url.url) {\n\t\t\t\tif (path) {\n\t\t\t\t\tdata.type = 'localPage';\n\t\t\t\t\tdata.localPage_path = path;\n\t\t\t\t\tdelete data.url;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.setValue(data.type);\n\t\t};\n\t\tcontent.commit = function(data) {\n\t\t\tdata.type = this.getValue();\n\t\t\tif (data.type == 'localPage') {\n\t\t\t\tdata.type = 'url';\n\t\t\t\tvar dialog = this.getDialog();\n\t\t\t\tdialog.setValueOf('info', 'protocol', '');\n\t\t\t\tdialog.setValueOf('info', 'url', dialog.getValueOf('info', 'localPage_path'));\n\t\t\t}\n\t\t};\n  });";
}
global $SITEURL, $TEMPLATE;
global $data_edit;
// SimpleXML to read from
$isV3 = substr(i18n_customfields_gsversion(), 0, 1) == '3';
$isI18N = function_exists('return_i18n_languages');
$creDate = @$data_edit->creDate ? (string) $data_edit->creDate : (string) @$data_edit->pubDate;
$defs = i18n_customfield_defs();
if ($isV3) {
    echo '<input type="hidden" name="creDate" value="' . htmlspecialchars($creDate) . '"/>';
} else {
    echo '<tr style="border:0 none;margin:0;padding:0;"><td colspan="2" style="border:0 none;margin:0;padding:0;"><input type="hidden" name="creDate" value="' . htmlspecialchars($creDate) . '"/></td></tr>';
}
if (!$defs || count($defs) <= 0) {
    return;
}
$id = @$_GET['id'];
if ($isV3) {
    echo '<table class="formtable" style="clear:both;width:100%;margin-left:0;"><tbody>';
}
// Editor settings (copied from edit.php)
if (defined('GSEDITORLANG')) {
    $EDLANG = GSEDITORLANG;
Exemplo n.º 2
0
function i18n_customfields_index($item)
{
    $i18n_customfield_defs = i18n_customfield_defs();
    foreach ($i18n_customfield_defs as $def) {
        if (@$def['index']) {
            $name = @$def['key'];
            if (@$def['type'] == 'textarea') {
                $item->addContent($name, html_entity_decode(strip_tags($item->{$name}), ENT_QUOTES, 'UTF-8'));
            } else {
                if (@$def['type'] == 'checkbox') {
                    if ($item->{$name}) {
                        $item->addTags($name, array($name));
                    }
                } else {
                    $item->addContent($name, html_entity_decode($item->{$name}, ENT_QUOTES, 'UTF-8'));
                }
            }
        }
    }
}