Initialize a helper to get bookstore settings and session information quickly
766397
def initialize(self):
        """"""
        self.bookstore_settings = BookstoreSettings(config=self.config)
        self.session = aiobotocore.get_session()
1074432
public function page_init() {
		if ( static::is_doing_ajax() ) {
			return;
		}

		register_setting(
			'github_updater',
			'github_updater',
			[ $this, 'sanitize' ]
		);

		$this->ghu_tokens();

		/*
		 * Add basic plugin settings.
		 */
		add_settings_section(
			'github_updater_settings',
			esc_html__( 'GitHub Updater Settings', 'github-updater' ),
			[ $this, 'print_section_ghu_settings' ],
			'github_updater_install_settings'
		);

		add_settings_field(
			'branch_switch',
			null,
			[ $this, 'token_callback_checkbox' ],
			'github_updater_install_settings',
			'github_updater_settings',
			[
				'id'    => 'branch_switch',
				'title' => esc_html__( 'Enable Branch Switching', 'github-updater' ),
			]
		);

		/**
		 * Hook to add Git API settings.
		 *
		 * @since 8.0.0
		 *
		 * @param array $auth_required Array containing authorization needs of git APIs.
		 */
		do_action( 'github_updater_add_settings', static::$auth_required );
	}
1307379
def get_catalog_info(self, key=None, default=None):
        
        if key is None:
            return self._init_kwargs

        return self._init_kwargs.get(key, default)
1065104
def init():
    ''''''
    # Load values from config file
    config_file = os.path.realpath(os.path.join(os.getcwd(), 'swaggery.ini'))
    config = configparser.RawConfigParser(allow_no_value=True)
    config.read(config_file)
    log_level = config.get('application', 'logging_level').upper()
    api_dirs = list(config['apis'])
    do_checks = config.get('application',
                           'disable_boot_checks').lower() == 'false'
    # Set logging level
    log.setLevel(getattr(logging, log_level))
    log.debug('Log level set to {}'.format(log_level))
    # Bootstrap application
    log.debug('Exploring directories: {}'.format(api_dirs))
    application = Swaggery(api_dirs=api_dirs, do_checks=do_checks)
    return application
663393
function _initStorage(options) {
	        var self = this;
	        var dbInfo = {};
	        if (options) {
	            for (var i in options) {
	                dbInfo[i] = options[i];
	            }
	        }

	        dbInfo.keyPrefix = dbInfo.name + '/';

	        if (dbInfo.storeName !== self._defaultConfig.storeName) {
	            dbInfo.keyPrefix += dbInfo.storeName + '/';
	        }

	        self._dbInfo = dbInfo;

	        return new Promise(function (resolve, reject) {
	            resolve(__webpack_require__(3));
	        }).then(function (lib) {
	            dbInfo.serializer = lib;
	            return Promise.resolve();
	        });
	    }
135214
def init(name, kind, args = {})
      get_storage(self.class.type, kind, name, args)
      true
    end
1327354
public void init() {
        IUser user = SecurityUtil.getAuthenticatedUser();
        publisherInfo.setUserId(user == null ? null : user.getLogicalId());
        publisherInfo.setUserName(user == null ? "" : user.getFullName());
        publisherInfo.setAppName(getAppName());
        publisherInfo.setConsumerId(consumer.getNodeId());
        publisherInfo.setProducerId(producer.getNodeId());
        publisherInfo.setSessionId(sessionId);
        localEventDispatcher.setGlobalEventDispatcher(this);
        pingEventHandler = new PingEventHandler((IEventManager) localEventDispatcher, publisherInfo);
        pingEventHandler.init();
    }
1363463
public function initHooks()
    {
        register_activation_hook($this->file, array($this , 'activate'));
        register_deactivation_hook($this->file, array($this, 'deactivate'));

        add_action('save_post', array($this, 'updateHtml'), 10, 2);
        add_action('admin_init', array($this, 'handlePost'));
        add_action('admin_init', array($this, 'update'));
        add_action('admin_menu', array($this, 'addMenu'));
        add_action('admin_notices', array(__CLASS__, 'displayNotices'));
    }
766524
static function init() {
		elgg_register_event_handler('pagesetup', 'system', array(__CLASS__, 'pagesetup'));
		
		elgg_register_plugin_hook_handler('register', "menu:admin_control_panel", array(__CLASS__, 'handlerAdminButtonsMenuRegister'));
		
		elgg_register_action('backup/db/save', 
			elgg_get_config('pluginspath') . __CLASS__ . '/actions/backup/db/save.php', 'admin');
		elgg_register_action('backup/db/load', 
			elgg_get_config('pluginspath') . __CLASS__ . '/actions/backup/db/load.php', 'admin');
	}
1065253
def getIteratorSetting(self, login, tableName, iteratorName, scope):
    
    self.send_getIteratorSetting(login, tableName, iteratorName, scope)
    return self.recv_getIteratorSetting()
359126
function init() {
		$_option = 'pressbooks_theme_options_' . $this->getSlug();
		$_page = $_option;
		$_section = $this->getSlug() . '_options_section';

		if ( false === get_option( $_option ) ) {
			add_option( $_option, $this->defaults );
		}

		$custom_styles = Container::get( 'Styles' );
		$v2_compatible = $custom_styles->isCurrentThemeCompatible( 2 );

		add_settings_section(
			$_section,
			$this->getTitle(),
			[ $this, 'display' ],
			$_page
		);

		add_settings_field(
			'chapter_numbers',
			__( 'Part and Chapter Numbers', 'pressbooks' ),
			[ $this, 'renderChapterNumbersField' ],
			$_page,
			$_section,
			[
				__( 'Display part and chapter numbers', 'pressbooks' ),
			]
		);

		add_settings_field(
			'part_label',
			__( 'Part Label', 'pressbooks' ),
			[ $this, 'renderPartLabelField' ],
			$_page,
			$_section,
			[
				__( 'The "part" label is used in the table of contents and in part titles in your webbook and exports.', 'pressbooks' ),
				'label_for' => 'part_label',
			]
		);

		add_settings_field(
			'chapter_label',
			__( 'Chapter Label', 'pressbooks' ),
			[ $this, 'renderChapterLabelField' ],
			$_page,
			$_section,
			[
				__( 'The "chapter" label is used in the table of contents and in chapter titles in your webbook and exports.', 'pressbooks' ),
				'label_for' => 'chapter_label',
			]
		);

		add_settings_field(
			'parse_subsections',
			__( 'Two-Level TOC', 'pressbooks' ),
			[ $this, 'renderTwoLevelTOCField' ],
			$_page,
			$_section,
			[
				__( 'Enable two-level table of contents (displays headings under chapter titles)', 'pressbooks' ),
			]
		);

		add_settings_field(
			'attachment_attributions',
			__( 'Media Attributions', 'pressbooks' ),
			[ $this, 'renderAttachmentAttributionsField' ],
			$_page,
			$_section,
			[
				__( 'Display attributions at the end of a chapter', 'pressbooks' ),
			]
		);

		if ( Container::get( 'Styles' )->isCurrentThemeCompatible( 1 ) === true || Container::get( 'Styles' )->isCurrentThemeCompatible( 2 ) === true ) { // we can only enable foreign language typography for themes that use SCSS

			add_settings_field(
				'pressbooks_global_typography',
				__( 'Language & Script Support', 'pressbooks' ),
				[ $this, 'renderLanguagesField' ],
				$_page,
				$_section,
				[
					__( 'Include fonts to support the following languages and scripts:', 'pressbooks' ),
				]
			);

			register_setting(
				$_page,
				'pressbooks_global_typography',
				[ $this, 'sanitizeLanguages' ]
			);

		}

		add_settings_field(
			'copyright_license',
			__( 'Chapter Licenses', 'pressbooks' ),
			[ $this, 'renderCopyrightLicenseField' ],
			$_page,
			$_section,
			[
				0 => __( 'Do not display section level copyright license', 'pressbooks' ),
				1 => __( 'Display section level license on table of contents in export formats', 'pressbooks' ),
				2 => __( 'Display section level license at end of chapter in export formats', 'pressbooks' ),
			]
		);

		if ( $v2_compatible ) {
			foreach ( [
				'examples' => __( 'Examples', 'pressbooks' ),
				'exercises' => __( 'Exercises', 'pressbooks' ),
				'takeaways' => __( 'Key Takeaways', 'pressbooks' ),
				'objectives' => __( 'Learning Objectives', 'pressbooks' ),
			] as $key => $label ) {
				add_settings_field(
					"edu_textbox_{$key}_section",
					sprintf( '<span style="font-size:1.3em;">%s</span>', $label ),
					[ $this, 'renderTextboxHeader' ],
					$_page,
					$_section,
					[
						sprintf( __( 'Customize colors for %s textboxes using the fields below.', 'pressbooks' ), $label ),
					]
				);

				add_settings_field(
					"edu_textbox_{$key}_header_color",
					sprintf( '<span class="screen-reader-text">%1$s </span>%2$s', $label, __( 'Header Color', 'pressbooks' ) ),
					[ $this, 'renderTextboxColorField' ],
					$_page,
					$_section,
					[
						'key' => "edu_textbox_{$key}_header_color",
						'description' => sprintf( __( 'The header text color for a %s textbox.', 'pressbooks' ), $label ),
					]
				);
				add_settings_field(
					"edu_textbox_{$key}_header_background",
					sprintf( '<span class="screen-reader-text">%1$s </span>%2$s', $label, __( 'Header Background', 'pressbooks' ) ),
					[ $this, 'renderTextboxColorField' ],
					$_page,
					$_section,
					[
						'key' => "edu_textbox_{$key}_header_background",
						'description' => sprintf( __( 'The header background color for a %s textbox.', 'pressbooks' ), $label ),
					]
				);
				add_settings_field(
					"edu_textbox_{$key}_background",
					sprintf( '<span class="screen-reader-text">%1$s </span>%2$s', $label, __( 'Background', 'pressbooks' ) ),
					[ $this, 'renderTextboxColorField' ],
					$_page,
					$_section,
					[
						'key' => "edu_textbox_{$key}_background",
						'description' => sprintf( __( 'The background color for a %s textbox.', 'pressbooks' ), $label ),
					]
				);
			}
		}

		/**
		 * Add custom settings fields.
		 *
		 * @since 3.9.7
		 *
		 * @param string $arg1
		 * @param string $arg2
		 */
		do_action( 'pb_theme_options_global_add_settings_fields', $_page, $_section );

		register_setting(
			$_page,
			$_option,
			[ $this, 'sanitize' ]
		);
	}
983715
def Initialize(config=None,
               external_hostname = None,
               admin_password = None,
               redownload_templates = False,
               repack_templates = True,
               token = None):
  """"""

  print("Checking write access on config %s" % config["Config.writeback"])
  if not os.access(config.parser.filename, os.W_OK):
    raise IOError("Config not writeable (need sudo?)")

  print("\nStep 0: Importing Configuration from previous installation.")
  options_imported = 0
  prev_config_file = config.Get("ConfigUpdater.old_config", default=None)
  if prev_config_file and os.access(prev_config_file, os.R_OK):
    print("Found config file %s." % prev_config_file)
    # pytype: disable=wrong-arg-count
    if builtins.input("Do you want to import this configuration? "
                      "[yN]: ").upper() == "Y":
      options_imported = ImportConfig(prev_config_file, config)
    # pytype: enable=wrong-arg-count
  else:
    print("No old config file found.")

  print("\nStep 1: Setting Basic Configuration Parameters")
  print("We are now going to configure the server using a bunch of questions.")
  ConfigureDatastore(config)
  ConfigureUrls(config, external_hostname=external_hostname)
  ConfigureEmails(config)

  print("\nStep 2: Key Generation")
  if config.Get("PrivateKeys.server_key", default=None):
    if options_imported > 0:
      print("Since you have imported keys from another installation in the "
            "last step,\nyou probably do not want to generate new keys now.")
    # pytype: disable=wrong-arg-count
    if (builtins.input("You already have keys in your config, do you want to"
                       " overwrite them? [yN]: ").upper() or "N") == "Y":
      config_updater_keys_util.GenerateKeys(config, overwrite_keys=True)
    # pytype: enable=wrong-arg-count
  else:
    config_updater_keys_util.GenerateKeys(config)

  FinalizeConfigInit(
      config,
      token,
      admin_password=admin_password,
      redownload_templates=redownload_templates,
      repack_templates=repack_templates,
      prompt=True)
216357
function init() {
		$_option = 'pressbooks_theme_options_' . $this->getSlug();
		$_page = $_option;
		$_section = $this->getSlug() . '_options_section';

		if ( false === get_option( $_option ) ) {
			add_option( $_option, $this->defaults );
		}

		add_settings_section(
			$_section,
			$this->getTitle(),
			[ $this, 'display' ],
			$_page
		);

		$custom_styles = Container::get( 'Styles' );
		$v2_compatible = $custom_styles->isCurrentThemeCompatible( 2 );

		if ( $v2_compatible ) {
			add_settings_field(
				'pdf_body_font_size',
				__( 'Body Font Size', 'pressbooks' ),
				[ $this, 'renderBodyFontSizeField' ],
				$_page,
				$_section,
				[
					__( 'Heading sizes are proportional to the body font size and will also be affected by this setting.', 'pressbooks' ),
					'pt',
					'label_for' => 'pdf_body_font_size',
				]
			);

			add_settings_field(
				'pdf_body_line_height',
				__( 'Body Line Height', 'pressbooks' ),
				[ $this, 'renderBodyLineHightField' ],
				$_page,
				$_section,
				[
					'',
					'em',
					'label_for' => 'pdf_body_line_height',
				]
			);
		}

		add_settings_field(
			'pdf_page_size',
			__( 'Page Size', 'pressbooks' ),
			[ $this, 'renderPageSizeField' ],
			$_page,
			$_section,
			[
				__( 'Digest (5.5&quot; &times; 8.5&quot;)', 'pressbooks' ),
				__( 'US Trade (6&quot; &times; 9&quot;)', 'pressbooks' ),
				__( 'US Letter (8.5&quot; &times; 11&quot;)', 'pressbooks' ),
				__( 'Custom (8.5&quot; &times; 9.25&quot;)', 'pressbooks' ),
				__( 'Duodecimo (5&quot; &times; 7.75&quot;)', 'pressbooks' ),
				__( 'Pocket (4.25&quot; &times; 7&quot;)', 'pressbooks' ),
				__( 'A4 (21cm &times; 29.7cm)', 'pressbooks' ),
				__( 'A5 (14.8cm &times; 21cm)', 'pressbooks' ),
				__( '5&quot; &times; 8&quot;', 'pressbooks' ),
				__( 'Custom&hellip;', 'pressbooks' ),
				'label_for' => 'pdf_page_size',
			]
		);

		add_settings_field(
			'pdf_page_width',
			__( 'Page Width', 'pressbooks' ),
			[ $this, 'renderPageWidthField' ],
			$_page,
			$_section,
			[
				__( 'Page width must be expressed in CSS-compatible units, e.g. &lsquo;5.5in&rsquo; or &lsquo;10cm&rsquo;.' ),
				'label_for' => 'pdf_page_width',
			]
		);

		add_settings_field(
			'pdf_page_height',
			__( 'Page Height', 'pressbooks' ),
			[ $this, 'renderPageHeightField' ],
			$_page,
			$_section,
			[
				__( 'Page height must be expressed in CSS-compatible units, e.g. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.' ),
				'label_for' => 'pdf_page_height',
			]
		);

		if ( $v2_compatible ) {
			add_settings_field(
				'pdf_page_margins',
				__( 'Margins', 'pressbooks' ),
				[ $this, 'renderMarginsField' ],
				$_page,
				$_section,
				[
					__( 'Customize your book&rsquo;s margins using the fields below.', 'pressbooks' ),
				]
			);

			add_settings_field(
				'pdf_page_margin_outside',
				__( 'Outside Margin', 'pressbooks' ),
				[ $this, 'renderOutsideMarginField' ],
				$_page,
				$_section,
				[
					__( 'Margins must be expressed in CSS-compatible units, e.g. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', 'pressbooks' ),
					'label_for' => 'pdf_page_margin_outside',
				]
			);

			add_settings_field(
				'pdf_page_margin_inside',
				__( 'Inside Margin', 'pressbooks' ),
				[ $this, 'renderInsideMarginField' ],
				$_page,
				$_section,
				[
					__( 'Margins must be expressed in CSS-compatible units, e.g. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', 'pressbooks' ),
					'label_for' => 'pdf_page_margin_inside',
				]
			);

			add_settings_field(
				'pdf_page_margin_top',
				__( 'Top Margin', 'pressbooks' ),
				[ $this, 'renderTopMarginField' ],
				$_page,
				$_section,
				[
					__( 'Margins must be expressed in CSS-compatible units, e.g. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', 'pressbooks' ),
					'label_for' => 'pdf_page_margin_top',
				]
			);

			add_settings_field(
				'pdf_page_margin_bottom',
				__( 'Bottom Margin', 'pressbooks' ),
				[ $this, 'renderBottomMarginField' ],
				$_page,
				$_section,
				[
					__( 'Margins must be expressed in CSS-compatible units, e.g. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', 'pressbooks' ),
					'label_for' => 'pdf_page_margin_bottom',
				]
			);
		}

		add_settings_field(
			'pdf_hyphens',
			__( 'Hyphens', 'pressbooks' ),
			[ $this, 'renderHyphenationField' ],
			$_page,
			$_section,
			[
				__( 'Enable hyphenation', 'pressbooks' ),
			]
		);

		add_settings_field(
			'pdf_paragraph_separation',
			__( 'Paragraph Separation', 'pressbooks' ),
			[ $this, 'renderParagraphSeparationField' ],
			$_page,
			$_section,
			[
				'indent' => __( 'Indent paragraphs', 'pressbooks' ),
				'skiplines' => __( 'Skip lines between paragraphs', 'pressbooks' ),
			]
		);

		add_settings_field(
			'pdf_sectionopenings',
			__( 'Section Openings', 'pressbooks' ),
			[ $this, 'renderSectionOpeningsField' ],
			$_page,
			$_section,
			[
				'openauto' => __( 'Left or right page section opening (for print PDF)', 'pressbooks' ),
				'openright' => __( 'Right page section openings (for print PDF)', 'pressbooks' ),
				'remove' => __( 'No blank pages (for web PDF)', 'pressbooks' ),
			]
		);

		add_settings_field(
			'pdf_toc',
			__( 'Table of Contents', 'pressbooks' ),
			[ $this, 'renderTOCField' ],
			$_page,
			$_section,
			[
				__( 'Display table of contents', 'pressbooks' ),
			]
		);

		add_settings_field(
			'pdf_crop_marks',
			__( 'Crop Marks', 'pressbooks' ),
			[ $this, 'renderCropMarksField' ],
			$_page,
			$_section,
			[
				__( 'Display crop marks', 'pressbooks' ),
			]
		);

		if ( CustomCss::isCustomCss() ) {
			add_settings_field(
				'pdf_romanize_parts',
				__( 'Romanize Part Numbers', 'pressbooks' ),
				[ $this, 'renderRomanizePartsField' ],
				$_page,
				$_section,
				[
					__( 'Convert part numbers into Roman numerals', 'pressbooks' ),
				]
			);
		}

		add_settings_field(
			'pdf_footnotes_style',
			__( 'Footnote Style', 'pressbooks' ),
			[ $this, 'renderFootnoteStyleField' ],
			$_page,
			$_section,
			[
				'footnotes' => __( 'Regular footnotes', 'pressbooks' ),
				'endnotes' => __( 'Display as chapter endnotes', 'pressbooks' ),
			]
		);

		add_settings_field(
			'widows',
			__( 'Widows', 'pressbooks' ),
			[ $this, 'renderWidowsField' ],
			$_page,
			$_section,
			[
				'label_for' => 'widows',
			]
		);

		add_settings_field(
			'orphans',
			__( 'Orphans', 'pressbooks' ),
			[ $this, 'renderOrphansField' ],
			$_page,
			$_section,
			[
				'label_for' => 'orphans',
			]
		);

		if ( $v2_compatible ) {
			add_settings_field(
				'running_content',
				__( 'Running Heads & Feet', 'pressbooks' ),
				[ $this, 'renderRunningContentField' ],
				$_page,
				$_section,
				[
					__( 'Running content appears in either running heads or running feet (at the top or bottom of the page) depending on your theme.', 'pressbooks' ),
				]
			);

			add_settings_field(
				'running_content_front_matter_left',
				__( 'Front Matter Left Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentFrontMatterLeftField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Front Matter Title', 'pressbooks' ),
					'%section_author%' => __( 'Front Matter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Front Matter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_front_matter_left',
				]
			);

			add_settings_field(
				'running_content_front_matter_right',
				__( 'Front Matter Right Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentFrontMatterRightField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Front Matter Title', 'pressbooks' ),
					'%section_author%' => __( 'Front Matter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Front Matter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_front_matter_right',
				]
			);

			add_settings_field(
				'running_content_introduction_left',
				__( 'Introduction Left Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentIntroductionLeftField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Introduction Title', 'pressbooks' ),
					'%section_author%' => __( 'Introduction Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Introduction Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_introduction_left',
				]
			);

			add_settings_field(
				'running_content_introduction_right',
				__( 'Introduction Right Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentIntroductionRightField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Introduction Title', 'pressbooks' ),
					'%section_author%' => __( 'Introduction Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Introduction Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_introduction_right',
				]
			);

			add_settings_field(
				'running_content_part_left',
				__( 'Part Left Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentPartLeftField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%part_number%' => __( 'Part Number', 'pressbooks' ),
					'%part_title%' => __( 'Part Title', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_part_left',
				]
			);

			add_settings_field(
				'running_content_part_right',
				__( 'Part Right Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentPartRightField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%part_number%' => __( 'Part Number', 'pressbooks' ),
					'%part_title%' => __( 'Part Title', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_part_right',
				]
			);

			add_settings_field(
				'running_content_chapter_left',
				__( 'Chapter Left Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentChapterLeftField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%part_number%' => __( 'Part Number', 'pressbooks' ),
					'%part_title%' => __( 'Part Title', 'pressbooks' ),
					'%section_title%' => __( 'Chapter Title', 'pressbooks' ),
					'%section_author%' => __( 'Chapter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Chapter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_chapter_left',
				]
			);

			add_settings_field(
				'running_content_chapter_right',
				__( 'Chapter Right Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentChapterRightField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%part_number%' => __( 'Part Number', 'pressbooks' ),
					'%part_title%' => __( 'Part Title', 'pressbooks' ),
					'%section_title%' => __( 'Chapter Title', 'pressbooks' ),
					'%section_author%' => __( 'Chapter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Chapter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_chapter_right',
				]
			);

			add_settings_field(
				'running_content_back_matter_left',
				__( 'Back Matter Left Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentBackMatterLeftField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Back Matter Title', 'pressbooks' ),
					'%section_author%' => __( 'Back Matter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Back Matter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_back_matter_left',
				]
			);

			add_settings_field(
				'running_content_back_matter_right',
				__( 'Back Matter Right Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentBackMatterRightField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Back Matter Title', 'pressbooks' ),
					'%section_author%' => __( 'Back Matter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Back Matter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_back_matter_right',
				]
			);
		}

		if ( ! $v2_compatible ) {
			add_settings_field(
				'pdf_fontsize',
				__( 'Increase Font Size', 'pressbooks' ),
				[ $this, 'renderFontSizeField' ],
				$_page,
				$_section,
				[
					__( 'Increases font size and line height for greater accessibility', 'pressbooks' ),
				]
			);
		}

		/**
		 * Add custom settings fields.
		 *
		 * @since 3.9.7
		 *
		 * @param string $arg1
		 * @param string $arg2
		 */
		do_action( 'pb_theme_options_pdf_add_settings_fields', $_page, $_section );

		register_setting(
			$_option,
			$_option,
			[ $this, 'sanitize' ]
		);
	}
375185
async function initialize(dispatch) {
	shimInit();

	// blobTest();

	Setting.setConstant('env', __DEV__ ? 'dev' : 'prod');
	Setting.setConstant('appId', 'net.cozic.joplin-mobile');
	Setting.setConstant('appType', 'mobile');
	//Setting.setConstant('resourceDir', () => { return RNFetchBlob.fs.dirs.DocumentDir; });
	Setting.setConstant('resourceDir', RNFetchBlob.fs.dirs.DocumentDir);

	const logDatabase = new Database(new DatabaseDriverReactNative());
	await logDatabase.open({ name: 'log.sqlite' });
	await logDatabase.exec(Logger.databaseCreateTableSql());

	const mainLogger = new Logger();
	mainLogger.addTarget('database', { database: logDatabase, source: 'm' });
	mainLogger.setLevel(Logger.LEVEL_INFO);
	
	if (Setting.value('env') == 'dev') {
		mainLogger.addTarget('console');
		mainLogger.setLevel(Logger.LEVEL_DEBUG);
	}

	reg.setLogger(mainLogger);
	reg.setShowErrorMessageBoxHandler((message) => { alert(message) });

	BaseService.logger_ = mainLogger;

	reg.logger().info('====================================');
	reg.logger().info('Starting application ' + Setting.value('appId') + ' (' + Setting.value('env') + ')');

	const dbLogger = new Logger();
	dbLogger.addTarget('database', { database: logDatabase, source: 'm' }); 
	if (Setting.value('env') == 'dev') {
		dbLogger.addTarget('console');
		dbLogger.setLevel(Logger.LEVEL_INFO); // Set to LEVEL_DEBUG for full SQL queries
	} else {
		dbLogger.setLevel(Logger.LEVEL_INFO);
	}

	let db = new JoplinDatabase(new DatabaseDriverReactNative());
	db.setLogger(dbLogger);
	reg.setDb(db);

	reg.dispatch = dispatch;
	BaseModel.dispatch = dispatch;
	FoldersScreenUtils.dispatch = dispatch;
	BaseSyncTarget.dispatch = dispatch;
	NavService.dispatch = dispatch;
	BaseModel.db_ = db;

	BaseItem.loadClass('Note', Note);
	BaseItem.loadClass('Folder', Folder);
	BaseItem.loadClass('Resource', Resource);
	BaseItem.loadClass('Tag', Tag);
	BaseItem.loadClass('NoteTag', NoteTag);
	BaseItem.loadClass('MasterKey', MasterKey);
	BaseItem.loadClass('Revision', Revision);

	const fsDriver = new FsDriverRN();

	Resource.fsDriver_ = fsDriver;
	FileApiDriverLocal.fsDriver_ = fsDriver;

	AlarmService.setDriver(new AlarmServiceDriver());
	AlarmService.setLogger(mainLogger);

	try {
		if (Setting.value('env') == 'prod') {
			await db.open({ name: 'joplin.sqlite' })
		} else {
			await db.open({ name: 'joplin-68.sqlite' })
		}

		reg.logger().info('Database is ready.');
		reg.logger().info('Loading settings...');
		await Setting.load();

		if (Setting.value('firstStart')) {
			let locale = NativeModules.I18nManager.localeIdentifier
			if (!locale) locale = defaultLocale();
			Setting.setValue('locale', closestSupportedLocale(locale));
			if (Setting.value('env') === 'dev') Setting.setValue('sync.target', SyncTargetRegistry.nameToId('onedrive_dev'));
			Setting.setValue('firstStart', 0);
		}

		if (Setting.value('db.ftsEnabled') === -1) {
			const ftsEnabled = await db.ftsEnabled();
			Setting.setValue('db.ftsEnabled', ftsEnabled ? 1 : 0);
			reg.logger().info('db.ftsEnabled = ', Setting.value('db.ftsEnabled'));
		}

		BaseItem.revisionService_ = RevisionService.instance();

		// Note: for now we hard-code the folder sort order as we need to 
		// create a UI to allow customisation (started in branch mobile_add_sidebar_buttons)
		Setting.setValue('folders.sortOrder.field', 'title');
		Setting.setValue('folders.sortOrder.reverse', false);

		reg.logger().info('Sync target: ' + Setting.value('sync.target'));

		setLocale(Setting.value('locale'));

		// ----------------------------------------------------------------
		// E2EE SETUP
		// ----------------------------------------------------------------

		EncryptionService.fsDriver_ = fsDriver;
		EncryptionService.instance().setLogger(mainLogger);
		BaseItem.encryptionService_ = EncryptionService.instance();
		DecryptionWorker.instance().dispatch = dispatch;
		DecryptionWorker.instance().setLogger(mainLogger);
		DecryptionWorker.instance().setEncryptionService(EncryptionService.instance());
		await EncryptionService.instance().loadMasterKeysFromSettings();

		// ----------------------------------------------------------------
		// / E2EE SETUP
		// ----------------------------------------------------------------

		reg.logger().info('Loading folders...');

		await FoldersScreenUtils.refreshFolders();

		const tags = await Tag.allWithNotes();

		dispatch({
			type: 'TAG_UPDATE_ALL',
			items: tags,
		});

		const masterKeys = await MasterKey.all();

		dispatch({
			type: 'MASTERKEY_UPDATE_ALL',
			items: masterKeys,
		});

		let folderId = Setting.value('activeFolderId');
		let folder = await Folder.load(folderId);

		if (!folder) folder = await Folder.defaultFolder();

		dispatch({
			type: 'FOLDER_SET_COLLAPSED_ALL',
			ids: Setting.value('collapsedFolderIds'),
		});

		if (!folder) {
			dispatch({
				type: 'NAV_GO',
				routeName: 'Welcome',
			});
		} else {
			dispatch({
				type: 'NAV_GO',
				routeName: 'Notes',
				folderId: folder.id,
			});
		}
	} catch (error) {
		alert('Initialization error: ' + error.message);
		reg.logger().error('Initialization error:', error);
	}

	reg.setupRecurrentSync();

	PoorManIntervals.setTimeout(() => {
		AlarmService.garbageCollect();
	}, 1000 * 60 * 60);

	ResourceService.runInBackground();

	ResourceFetcher.instance().setFileApi(() => { return reg.syncTarget().fileApi() });
	ResourceFetcher.instance().setLogger(reg.logger());
	ResourceFetcher.instance().start();

	SearchEngine.instance().setDb(reg.db());
	SearchEngine.instance().setLogger(reg.logger());
	SearchEngine.instance().scheduleSyncTables();

	reg.scheduleSync().then(() => {
		// Wait for the first sync before updating the notifications, since synchronisation
		// might change the notifications.
		AlarmService.updateAllNotifications();

		DecryptionWorker.instance().scheduleStart();
	});

	await WelcomeUtils.install(dispatch);

	// Collect revisions more frequently on mobile because it doesn't auto-save
	// and it cannot collect anything when the app is not active.
	RevisionService.instance().runInBackground(1000 * 30);

	reg.logger().info('Application initialized');
}
178886
public function init() {
        global $PAGE;

        $mode = optional_param('mode', 'display', PARAM_ALPHA);
        $perpage = optional_param('perpage', null, PARAM_INT);

        if ($perpage and $perpage > 0 and $perpage <= 1000) {
            require_sesskey();
            set_user_preference('workshopallocation_manual_perpage', $perpage);
            redirect($PAGE->url);
        }

        $result = new workshop_allocation_result($this);

        switch ($mode) {
        case 'new':
            if (!confirm_sesskey()) {
                throw new moodle_exception('confirmsesskeybad');
            }
            $reviewerid = required_param('by', PARAM_INT);
            $authorid   = required_param('of', PARAM_INT);
            $m          = array();  // message object to be passed to the next page
            $submission = $this->workshop->get_submission_by_author($authorid);
            if (!$submission) {
                // nothing submitted by the given user
                $m[] = self::MSG_NOSUBMISSION;
                $m[] = $authorid;

            } else {
                // ok, we have the submission
                $res = $this->workshop->add_allocation($submission, $reviewerid);
                if ($res == workshop::ALLOCATION_EXISTS) {
                    $m[] = self::MSG_EXISTS;
                    $m[] = $submission->authorid;
                    $m[] = $reviewerid;
                } else {
                    $m[] = self::MSG_ADDED;
                    $m[] = $submission->authorid;
                    $m[] = $reviewerid;
                }
            }
            $m = implode('-', $m);  // serialize message object to be passed via URL
            redirect($PAGE->url->out(false, array('m' => $m)));
            break;
        case 'del':
            if (!confirm_sesskey()) {
                throw new moodle_exception('confirmsesskeybad');
            }
            $assessmentid   = required_param('what', PARAM_INT);
            $confirmed      = optional_param('confirm', 0, PARAM_INT);
            $assessment     = $this->workshop->get_assessment_by_id($assessmentid);
            if ($assessment) {
                if (!$confirmed) {
                    $m[] = self::MSG_CONFIRM_DEL;
                    $m[] = $assessment->id;
                    $m[] = $assessment->authorid;
                    $m[] = $assessment->reviewerid;
                    if (is_null($assessment->grade)) {
                        $m[] = 0;
                    } else {
                        $m[] = 1;
                    }
                } else {
                    if($this->workshop->delete_assessment($assessment->id)) {
                        $m[] = self::MSG_DELETED;
                        $m[] = $assessment->authorid;
                        $m[] = $assessment->reviewerid;
                    } else {
                        $m[] = self::MSG_DELETE_ERROR;
                        $m[] = $assessment->authorid;
                        $m[] = $assessment->reviewerid;
                    }
                }
                $m = implode('-', $m);  // serialize message object to be passed via URL
                redirect($PAGE->url->out(false, array('m' => $m)));
            }
            break;
        }

        $result->set_status(workshop_allocation_result::STATUS_VOID);
        return $result;
    }
59116
def _init_params(self):
        
        assert self._kv_initialized, "Cannot initialize parameters in KVStore " \
                                     "when KVStore is not initialized."
        params_to_init = []
        if self._kvstore:
            for param in self._params_to_init:
                if param._deferred_init:
                    params_to_init.append(param)
                else:
                    param_arrays = param._check_and_get(param._data, list)
                    idx = self._param2idx[param.name]
                    self._kvstore.init(idx, param_arrays[0])
                    if param._stype == 'default':
                        self._kvstore.pull(idx, param_arrays, priority=-idx)

        self._params_to_init = params_to_init
128838
function () { // eslint-disable-line object-shorthand
			// Inits helper
			helper.init(this);

			// Check cli args for output format, and override on existance of string.
			if (typeof pluginBuildFlag === 'string' || pluginBuildFlag instanceof String) {
				helper.config.format = pluginBuildFlag;
			}

			// Fill summary array
			this.book.summary.walk((article) => {
				helper.summary.push(article);
			});
		}