Create the plugin page in all languages and fill dummy content.
197017
def create(self):
        
        plugin = CMSPlugin.objects.filter(plugin_type=self.apphook)
        if plugin.exists():
            log.debug('Plugin page for "%s" plugin already exist, ok.',
                      self.apphook)
            raise plugin

        page, created = super(CmsPluginPageCreator, self).create()

        if created:
            # Add a plugin with content in all languages to the created page.
            # But only on new created page
            for placeholder_slot in self.placeholder_slots:
                self.fill_content(page, placeholder_slot)

        return page, created
943604
def init():
    """"""

    print("Blended: Static Website Generator -\n")

    checkConfig()

    if (sys.version_info > (3, 0)):
        wname = input("Website Name: ")
        wdesc = input("Website Description: ")
        wlan = input("Website Language: ")
        wlic = input("Website License: ")
        aname = input("Author(s) Name(s): ")
    else:
        wname = raw_input("Website Name: ")
        wdesc = raw_input("Website Description: ")
        wlan = raw_input("Website Language: ")
        wlic = raw_input("Website License: ")
        aname = raw_input("Author(s) Name(s): ")

    createBlendedFolders()

    # Populate the configuration file
    createConfig(app_version=app_version, wname=wname,
                 wdesc=wdesc, wlic=wlic, wlan=wlan, aname=aname)

    print("\nThe required files for your website have been generated.")
505597
function plugin() {
  return function(files, metalsmith, done) {
    Object.keys(files).forEach(function(file) {
      if (!~file.indexOf('.html')) return;
      var $ = cheerio.load(files[file].contents);
      var links = $('a');
      for (var i = links.length - 1; i >= 0; i--) {
        var url = links[i].attribs.href;
        if (image(url)) $(links[i]).append(img(url));
      }
      $.root().prepend(css());
      files[file].contents = new Buffer($.html());
    });
    done();
  };
}
1131496
public static function setupTextDomain() {
        global $CFG, $TSUGI_LOCALE, $TSUGI_LOCALE_RELOAD, $TSUGI_TRANSLATE;

        $domain = $CFG->getScriptFolder();
        $folder = $CFG->getScriptPathFull()."/locale";

        // error_log("setupTextDomain($domain, $folder, $TSUGI_LOCALE, $TSUGI_LOCALE_RELOAD)");

        $TSUGI_LOCALE_RELOAD = false;
        $TSUGI_TRANSLATE = false;

        if ( isset($CFG->legacytranslation) && $CFG->legacytranslation ) {
            if (function_exists('bindtextdomain')) {
                bindtextdomain("master", $CFG->dirroot."/locale");
                bindtextdomain($domain, $folder);
            }
            if (function_exists('textdomain')) {
                textdomain($domain);
            }
            return;
        }

        $lang = substr($TSUGI_LOCALE, 0, 2);
        // error_log("lang=$lang");
        $master_file = $CFG->dirroot."/locale/$lang/LC_MESSAGES/master.mo";
        $domain_file = $CFG->getScriptPathFull()."/locale/$lang/LC_MESSAGES/$domain.mo";
        $TSUGI_TRANSLATE = new Translator($lang, new MessageSelector());
        if ( file_exists($master_file) ) {
            $TSUGI_TRANSLATE->addLoader('master', new MoFileLoader());
            $TSUGI_TRANSLATE->addResource('master', $master_file, $lang);
        }

        if ( file_exists($domain_file) ) {
            $TSUGI_TRANSLATE->addLoader($domain, new MoFileLoader());
            $TSUGI_TRANSLATE->addResource($domain, $domain_file, $lang);
        }

    }
1218790
def process
      # Check if plugin settings are set, if not, set a default or quit.
      #-------------------------------------------------------------------------
      self.parsed_translations ||= {}
      
      self.config['exclude_from_localizations'] ||= []
      
      if ( !self.config['languages']         or
            self.config['languages'].empty?  or
           !self.config['languages'].all?
         )
          puts 'You must provide at least one language using the "languages" setting on your _config.yml.'
          
          exit
      end
      
      
      # Variables
      #-------------------------------------------------------------------------
      
      # Original Jekyll configurations
      baseurl_org                 = self.config[ 'baseurl' ].to_s # Baseurl set on _config.yml
      dest_org                    = self.dest                     # Destination folder where the website is generated
      
      # Site building only variables
      languages                   = self.config['languages'] # List of languages set on _config.yml
      
      # Site wide plugin configurations
      self.config['default_lang'] = languages.first          # Default language (first language of array set on _config.yml)
      self.config[        'lang'] = languages.first          # Current language being processed
      self.config['baseurl_root'] = baseurl_org              # Baseurl of website root (without the appended language code)
      self.config['translations'] = self.parsed_translations # Hash that stores parsed translations read from YAML files. Exposes this hash to Liquid.
      
      
      # Build the website for default language
      #-------------------------------------------------------------------------
      puts "Building site for default language: \"#{self.config['lang']}\" to: #{self.dest}"
      
      process_org
      
      
      # Build the website for the other languages
      #-------------------------------------------------------------------------
      
      # Remove .htaccess file from included files, so it wont show up on translations folders.
      self.include -= [".htaccess"]
      
      languages.drop(1).each do |lang|
        
        # Language specific config/variables
        @dest                  = dest_org    + "/" + lang
        self.config['baseurl'] = baseurl_org + "/" + lang
        self.config['lang']    =                     lang
        
        puts "Building site for language: \"#{self.config['lang']}\" to: #{self.dest}"
        
        process_org
      end
      
      # Revert to initial Jekyll configurations (necessary for regeneration)
      self.config[ 'baseurl' ] = baseurl_org  # Baseurl set on _config.yml
      @dest                    = dest_org     # Destination folder where the website is generated
      
      puts 'Build complete'
    end
710577
def fill_content(self, page, placeholder_slot):
        
        if len(placeholder_slot) == 1:
            raise RuntimeError(placeholder_slot)
        placeholder, created = self.get_or_create_placeholder(
            page, placeholder_slot)
        self.add_plugins(page, placeholder)
990875
def create_cms_index_pages(placeholder_slot="content"):
    
    try:
        index_page = Page.objects.get(is_home=True, publisher_is_draft=False)
    except Page.DoesNotExist:
        log.debug('Create index page in "en" and...')

        index_page = create_page(
            title="index in English",
            template=TEMPLATE_INHERITANCE_MAGIC,
            language=settings.LANGUAGE_CODE,
            published=False,
            in_navigation=True)
        placeholder, created = index_page.placeholders.get_or_create(
            slot=placeholder_slot)
        for language_code, lang_name in settings.LANGUAGES:
            with translation.override(language_code):
                title = 'index in %s' % lang_name
                log.info('create %r', title)
                if language_code != settings.LANGUAGE_CODE:
                    create_title(language_code, title, index_page)
                add_plugin(
                    placeholder=placeholder,
                    plugin_type='TextPlugin',  # djangocms_text_ckeditor
                    language=language_code,
                    body='index page in %s' % lang_name)
                index_page.publish(language_code)
        created = True
    else:
        created = False
        log.debug('Index page already exists.')

    return index_page, created
676392
public function CreatePage()
	{
		$this->_myWords = $this->WordCollection();

		$this->_document = new XmlnukeDocument($this->_myWords->Value("TITLE"), $this->_myWords->Value("ABSTRACT"));

		$this->_url = "module:Xmlnuke.Sample";

		$this->_document->setMenuTitle($this->_myWords->Value("OPTIONMODULE"));

		$this->_document->addMenuItem($this->_url."?op=1", $this->_myWords->Value("OBJECT"), $this->_myWords->Value("DESCOBJECT"));
		$this->_document->addMenuItem($this->_url."?op=2", $this->_myWords->Value("FORM"), $this->_myWords->Value("DESCFORM"));
		$this->_document->addMenuItem($this->_url."?op=3", $this->_myWords->Value("EDITLIST"), $this->_myWords->Value("DESCEDITLIST"));
		$this->_document->addMenuItem($this->_url."?op=4", $this->_myWords->Value("ANYDATASET"), $this->_myWords->Value("DESCANYDATASET"));
		$this->_document->addMenuItem($this->_url."?op=5", $this->_myWords->Value("DATABASE"), $this->_myWords->Value("DESCDATABASE"));
		$this->_document->addMenuItem($this->_url."?op=6", $this->_myWords->Value("UPLOAD"), $this->_myWords->Value("DESCUPLOAD"));
		$this->_document->addMenuItem($this->_url."?op=7", $this->_myWords->Value("XMLDATASET"), $this->_myWords->Value("DESCXMLDATASET"));
		$this->_document->addMenuItem($this->_url."?op=8", $this->_myWords->Value("TEXTFILEDATASET"), $this->_myWords->Value("DESTEXTFILEDATASET"));
		$this->_document->addMenuItem($this->_url."?op=9", $this->_myWords->Value("XMLCHART"), $this->_myWords->Value("DESCXMLCHART"));
		$this->_document->addMenuItem($this->_url."?op=10",$this->_myWords->Value("TABVIEW"), $this->_myWords->Value("DESCTABVIEW"));
		$this->_document->addMenuItem($this->_url."?op=11",$this->_myWords->Value("DUALLIST"), $this->_myWords->Value("DESCDUALLIST"));
		$this->_document->addMenuItem($this->_url."?op=12",$this->_myWords->Value("FAQ"), $this->_myWords->Value("DESCFAQ"));
		$this->_document->addMenuItem($this->_url."?op=13",$this->_myWords->Value("AJAXPOST"), $this->_myWords->Value("DESCAJAXPOST"));
		$this->_document->addMenuItem($this->_url."?op=14",$this->_myWords->Value("AUTOSUGGEST"), $this->_myWords->Value("DESCAUTOSUGGEST"));
		$this->_document->addMenuItem($this->_url."?op=15",$this->_myWords->Value("TREEVIEW"), $this->_myWords->Value("DESCTREEVIEW"));
		$this->_document->addMenuItem($this->_url."?op=16",$this->_myWords->Value("SORTABLE"), $this->_myWords->Value("DESCSORTABLE"));
		$this->_document->addMenuItem($this->_url."?op=20",$this->_myWords->Value("PORTLET"), $this->_myWords->Value("PORTLET"));
		$this->_document->addMenuItem($this->_url."?op=17",$this->_myWords->Value("CALENDAR"), $this->_myWords->Value("DESCCALENDAR"));
		$this->_document->addMenuItem($this->_url."?op=18",$this->_myWords->Value("UIALERT"), $this->_myWords->Value("DESCUIALERT"));
		$this->_document->addMenuItem($this->_url."?op=19",$this->_myWords->Value("MEDIAGALLERY"), $this->_myWords->Value("DESCMEDIAGALLERY"));

		$block = new XmlBlockCollection($this->_myWords->Value("MODULE"), BlockPosition::Center);

		$paragraph = new XmlParagraphCollection();

		$paragraph->addXmlnukeObject(new XmlnukeText($this->_myWords->Value("DESCMODULE")));
		$paragraph->addXmlnukeObject(new XmlnukeBreakLine());
		$paragraph->addXmlnukeObject(new XmlnukeText($this->_myWords->Value("SELECTOPTION")));
		$block->addXmlnukeObject($paragraph);
		$this->_document->addXmlnukeObject($block);

		$option = $this->_context->get("op");

		switch ($option)
		{
			case 1:
				{
					$this->actionCreateObject();
					break;
				}
			case 2:
				{
					$this->actionForm();
					break;
				}
			case 3:
				{
					$this->actionEditList();
					break;
				}
			case 4:
				{
					$this->actionEditAnydataSet();
					break;
				}
			case 5:
				{
					$this->actionEditDB();
					break;
				}
			case 6:
				{
					$this->actionUpload();
					break;
				}
			case 7:
				{
					$this->Opcao7();
					break;
				}
			case 8:
				{
					$this->Opcao8();
					break;
				}
			case 9:
				{
					$this->Opcao9();
					break;
				}
			case 10:
				{
					$this->Opcao10();
					break;
				}
			case 11:
				{
					$this->Opcao11();
					break;
				}
			case 12:
				{
					$this->Opcao12();
					break;
				}
			case 13:
				{
					$this->Opcao13();
					break;
				}
			case 14:
				{
					$this->Opcao14();
					break;
				}
			case 15:
				{
					$this->Opcao15();
					break;
				}
			case 16:
				{
					$this->Opcao16();
					break;
				}
			case 17:
				{
					$this->Opcao17();
					break;
				}
			case 18:
				{
					$this->Opcao18();
					break;
				}
			case 19:
				{
					$this->Opcao19();
					break;
				}
			case 20:
				{
					$this->Opcao20();
					break;
				}
		}
		return $this->_document->generatePage();
	}
399387
def _create_html_file_content(translations):
    
    content = []
    for i1, t in enumerate(translations):
        if i1 > 0:
            content.append("<br>")
        content.append('<div class="translation">')
        content.append('<div class="word">')
        for w in t.word:
            content.append("<h2>{word}</h2>".format(word=w))
        content.append("</div>")  # end `word`
        for i2, t2 in enumerate(t.parts_of_speech):
            if i2 > 0:
                content.append("<br>")
            content.append('<div class="part-of-speech">')
            if t2.part is not None:
                content.append('<p class="part-name">[{part}]</p>'.format(part=t2.part))
            content.append("<ol>")
            for m in t2.meanings:
                content.append('<div class="meaning">')
                mng = ["<strong><li>"]
                for i3, mn in enumerate(m.meaning):
                    if i3 > 0:
                        mng.append(", ")
                    mng.append("<span>{meaning}</span>".format(meaning=mn))
                mng.append("</li></strong>")
                content.append("".join(mng))
                content.append('<div class="examples">')
                for e in m.examples:
                    exmpl = "<p><span>{ex}</span>".format(ex=e[0])
                    if e[1]:
                        exmpl += "<br><span>{tr}</span>".format(tr=e[1])
                    exmpl += "</p>"
                    content.append(exmpl)
                content.append("</div>")  # end `examples`
                content.append("</div>")  # end `meaning`
            content.append("</ol>")
            content.append("</div>")  # end `part-of-speech`
        content.append("</div>")  # end `translation`
    return "\n".join(content)
278857
def plugins(all, plugins_dir):
    ""
    app = Datasette([], plugins_dir=plugins_dir)
    click.echo(json.dumps(app.plugins(all), indent=4))
96287
def create_page(self, **extra_kwargs):
        
        with translation.override(self.default_language_code):
            # for evaluate the language name lazy translation
            # e.g.: settings.LANGUAGE_CODE is not "en"

            self.default_lang_name = dict(
                self.languages)[self.default_language_code]
            self.slug = self.get_slug(self.default_language_code,
                                      self.default_lang_name)
            assert self.slug != ""

        page = None
        parent = self.get_parent_page()
        if parent is not None:
            assert parent.publisher_is_draft == True, "Parent page '%s' must be a draft!" % parent

        if self.delete_first:
            if self.apphook_namespace is not None:
                pages = Page.objects.filter(
                    application_namespace=self.apphook_namespace,
                    parent=parent,
                )
            else:
                pages = Page.objects.filter(
                    title_set__slug=self.slug,
                    parent=parent,
                )
            log.debug("Delete %i pages...", pages.count())
            pages.delete()
        else:
            if self.apphook_namespace is not None:
                # Create a plugin page
                queryset = Page.objects.drafts()
                queryset = queryset.filter(parent=parent)
                try:
                    page = queryset.get(
                        application_namespace=self.apphook_namespace)
                except Page.DoesNotExist:
                    pass  # Create page
                else:
                    log.debug("Use existing page: %s", page)
                    created = False
                    return page, created
            else:
                # Not a plugin page
                queryset = Title.objects.filter(
                    language=self.default_language_code)
                queryset = queryset.filter(page__parent=parent)
                try:
                    title = queryset.filter(slug=self.slug).first()
                except Title.DoesNotExist:
                    pass  # Create page
                else:
                    if title is not None:
                        log.debug("Use page from title with slug %r",
                                  self.slug)
                        page = title.page
                        created = False

        if page is None:
            with translation.override(self.default_language_code):
                # set right translation language
                # for evaluate language name lazy translation
                # e.g.: settings.LANGUAGE_CODE is not "en"

                page = create_page(
                    title=self.get_title(self.default_language_code,
                                         self.default_lang_name),
                    menu_title=self.get_menu_title(self.default_language_code,
                                                   self.default_lang_name),
                    template=self.get_template(self.default_language_code,
                                               self.default_lang_name),
                    language=self.default_language_code,
                    slug=self.slug,
                    published=False,
                    parent=parent,
                    in_navigation=self.in_navigation,
                    apphook=self.apphook,
                    apphook_namespace=self.apphook_namespace,
                    **extra_kwargs)
                created = True
                log.debug("Page created in %s: %s", self.default_lang_name,
                          page)

        assert page.publisher_is_draft == True
        return page, created
271144
public function CreatePage()
	{
		$this->_myWords = $this->WordCollection();

		$this->_document = new XmlnukeDocument($this->_myWords->Value("TITLE", $this->_context->get("SERVER_NAME")),$this->_myWords->Value("ABSTRACT", $this->_context->get("SERVER_NAME")));

		if ($this->_link == "")
		{
			$this->goBack( $this->_myWords->Value("ERRORINVALID") );
		}
		elseif ($this->_action == "submit")
		{
			if (!XmlInputImageValidate::validateText($this->_context))
			{
					$this->goBack( $this->_myWords->Value("OBJECTIMAGEINVALID") );
			}
			else 
			{
				if ( ($this->_toName == "") || ($this->_toEmail == "") || ($this->_fromName == "") || ($this->_fromEmail == "") )
				{
					$this->goBack( $this->_myWords->Value("ERROR") );
				}
				else
				{
					$custMessage = $this->_myWords->Value("MESSAGE", array($this->_toName, $this->_toEmail, urldecode($this->_link), $this->_fromName, $this->_customMessage) );

					MailUtil::Mail
					(
						MailUtil::getEmailFromID(),
						MailUtil::getFullEmailName($this->_toName, $this->_toEmail),
						$this->_myWords->Value("SUBJECT"),
						"",
						$this->_fromEmail,$custMessage
					);

					$this->showMessage();
				}
			}
		}
		else
		{
			$this->showForm();
		}

		return $this->_document->generatePage();		
	}
1028409
private function _buildPlugins()
    {
        $pluginroot = $this->_xml->addChild("Plugins");
        if (($this->_plugin_request || $this->_complete_request) && count($this->_plugins) > 0) {
            $plugins = array();
            if ($this->_complete_request) {
                $plugins = $this->_plugins;
            }
            if ($this->_plugin_request) {
                $plugins = array($this->_plugin);
            }
            foreach ($plugins as $plugin) {
                $object = new $plugin($this->_sysinfo->getEncoding());
                $object->execute();
                $oxml = $object->xml();
                if (sizeof($oxml) > 0) {
                    $pluginroot->combinexml($oxml);
                }
            }
        }
    }
656011
def populate_pages(self, parent=None, child=5, depth=5):
        """"""
        User = get_user_model()
        from basic_cms.models import Content
        author = User.objects.all()[0]
        if depth == 0:
            return
        p = self.model(parent=parent, author=author, status=self.model.PUBLISHED)
        p.save()
        p = self.get(id=p.id)
        Content(body='page-' + str(p.id), type='title', language=settings.PAGE_DEFAULT_LANGUAGE, page=p).save()
        Content(body='page-' + str(p.id), type='slug', language=settings.PAGE_DEFAULT_LANGUAGE, page=p).save()
        for child in range(1, child + 1):
            self.populate_pages(parent=p, child=child, depth=(depth - 1))
922038
def _create_markup_plugin(language, model):
    
    form = type("{0}MarkupItemForm".format(language.capitalize()), (MarkupItemForm,), {
        'default_language': language,
    })

    classname = "{0}MarkupPlugin".format(language.capitalize())
    PluginClass = type(classname, (MarkupPluginBase,), {
        'model': model,
        'form': form,
    })

    return PluginClass
928181
public function add()
    {
        $this->loadModel('Locale.Languages');
        $language = $this->Languages->newEntity();
        $languages = LocaleToolbox::languagesList(true);
        $icons = LocaleToolbox::flagsList();

        if (!empty($this->request->data['code'])) {
            $info = LocaleToolbox::info($this->request->data['code']);
            $language = $this->Languages->patchEntity($language, [
                'code' => normalizeLocale($this->request->data['code']),
                'name' => $info['language'],
                'direction' => $info['direction'],
                'status' => (isset($this->request->data['status']) ? $this->request->data['status'] : false),
                'icon' => (!empty($this->request->data['icon']) ? $this->request->data['icon'] : null)
            ]);

            if ($this->Languages->save($language)) {
                $this->Flash->success(__d('locale', 'Language was successfully registered!'));
                $this->redirect(['plugin' => 'Locale', 'controller' => 'manage', 'action' => 'index']);
            } else {
                $this->Flash->danger(__d('locale', 'Language could not be registered, please check your information'));
            }
        }

        $this->title(__d('locale', 'Register New Language'));
        $this->set(compact('language', 'languages', 'icons'));
        $this->Breadcrumb
            ->push('/admin/locale')
            ->push(__d('locale', 'Add new language'), '');
    }
539184
def add_view(self, request, form_url='', extra_context=None):
        """"""
        extra_context = {
            'language': get_language_from_request(request),
            'page_languages': settings.PAGE_LANGUAGES,
        }
        return super(PageAdmin, self).add_view(request, form_url,
                                               extra_context)