repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.validate
public function validate() { // Is this a valid HtmlBook? // TODO, three point validation: // 1) Is this valid HTML5? (https://github.com/svenkreiss/html5validator, https://github.com/mozilla/html5-lint, ...) // 2) If you remove all the user generated content, is this structurally valid HTMLBook? // 3) Is th...
php
public function validate() { // Is this a valid HtmlBook? // TODO, three point validation: // 1) Is this valid HTML5? (https://github.com/svenkreiss/html5validator, https://github.com/mozilla/html5-lint, ...) // 2) If you remove all the user generated content, is this structurally valid HTMLBook? // 3) Is th...
[ "public", "function", "validate", "(", ")", "{", "// Is this a valid HtmlBook?", "// TODO, three point validation:", "// 1) Is this valid HTML5? (https://github.com/svenkreiss/html5validator, https://github.com/mozilla/html5-lint, ...)", "// 2) If you remove all the user generated content, is this...
Check the sanity of $this->outputPath @return bool
[ "Check", "the", "sanity", "of", "$this", "-", ">", "outputPath" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L147-L162
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.transform
public function transform( $return = false ) { // Check permissions if ( ! current_user_can( 'edit_posts' ) ) { $timestamp = ( isset( $_REQUEST['timestamp'] ) ) ? absint( $_REQUEST['timestamp'] ) : 0; $hashkey = ( isset( $_REQUEST['hashkey'] ) ) ? $_REQUEST['hashkey'] : ''; if ( ! $this->verifyNonce( $ti...
php
public function transform( $return = false ) { // Check permissions if ( ! current_user_can( 'edit_posts' ) ) { $timestamp = ( isset( $_REQUEST['timestamp'] ) ) ? absint( $_REQUEST['timestamp'] ) : 0; $hashkey = ( isset( $_REQUEST['hashkey'] ) ) ? $_REQUEST['hashkey'] : ''; if ( ! $this->verifyNonce( $ti...
[ "public", "function", "transform", "(", "$", "return", "=", "false", ")", "{", "// Check permissions", "if", "(", "!", "current_user_can", "(", "'edit_posts'", ")", ")", "{", "$", "timestamp", "=", "(", "isset", "(", "$", "_REQUEST", "[", "'timestamp'", "]...
Procedure for "format/htmlbook" rewrite rule. Supported http (aka $_GET) params: + timestamp: (int) combines with `hashkey` to allow a 3rd party service temporary access + hashkey: (string) combines with `timestamp` to allow a 3rd party service temporary access + endnotes: (bool) move all footnotes to end of the book...
[ "Procedure", "for", "format", "/", "htmlbook", "rewrite", "rule", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L185-L293
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.logError
public function logError( $message, array $more_info = [] ) { $more_info['url'] = $this->url; parent::logError( $message, $more_info ); }
php
public function logError( $message, array $more_info = [] ) { $more_info['url'] = $this->url; parent::logError( $message, $more_info ); }
[ "public", "function", "logError", "(", "$", "message", ",", "array", "$", "more_info", "=", "[", "]", ")", "{", "$", "more_info", "[", "'url'", "]", "=", "$", "this", "->", "url", ";", "parent", "::", "logError", "(", "$", "message", ",", "$", "mor...
Add $this->url as additional log info, fallback to parent. @param $message @param array $more_info (unused, overridden)
[ "Add", "$this", "-", ">", "url", "as", "additional", "log", "info", "fallback", "to", "parent", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L302-L307
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.footnoteShortcode
public function footnoteShortcode( $atts, $content = null ) { $fn = new Footnote(); $fn->setAttributes( [ 'class' => 'footnote', ] ); $fn->setContent( trim( $content ) ); return $fn; }
php
public function footnoteShortcode( $atts, $content = null ) { $fn = new Footnote(); $fn->setAttributes( [ 'class' => 'footnote', ] ); $fn->setContent( trim( $content ) ); return $fn; }
[ "public", "function", "footnoteShortcode", "(", "$", "atts", ",", "$", "content", "=", "null", ")", "{", "$", "fn", "=", "new", "Footnote", "(", ")", ";", "$", "fn", "->", "setAttributes", "(", "[", "'class'", "=>", "'footnote'", ",", "]", ")", ";", ...
Footnotes @see http://www.princexml.com/doc/8.1/footnotes/ @param $atts @param null $content @return string
[ "Footnotes" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L320-L331
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.guessFrontMatterObj
public function guessFrontMatterObj( $data_type ) { $objects = [ '\Pressbooks\HTMLBook\Component\Preface', '\Pressbooks\HTMLBook\Component\Frontmatter', ]; foreach ( $objects as $obj ) { /** @var \Pressbooks\HTMLBook\Element $fm */ $fm = new $obj(); if ( in_array( $data_type, $fm->getSupportedData...
php
public function guessFrontMatterObj( $data_type ) { $objects = [ '\Pressbooks\HTMLBook\Component\Preface', '\Pressbooks\HTMLBook\Component\Frontmatter', ]; foreach ( $objects as $obj ) { /** @var \Pressbooks\HTMLBook\Element $fm */ $fm = new $obj(); if ( in_array( $data_type, $fm->getSupportedData...
[ "public", "function", "guessFrontMatterObj", "(", "$", "data_type", ")", "{", "$", "objects", "=", "[", "'\\Pressbooks\\HTMLBook\\Component\\Preface'", ",", "'\\Pressbooks\\HTMLBook\\Component\\Frontmatter'", ",", "]", ";", "foreach", "(", "$", "objects", "as", "$", "...
@param $data_type @return Element
[ "@param", "$data_type" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L364-L379
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.guessBackMatterObj
public function guessBackMatterObj( $data_type ) { $objects = [ '\Pressbooks\HTMLBook\Component\Appendix', '\Pressbooks\HTMLBook\Component\Bibliography', '\Pressbooks\HTMLBook\Component\Backmatter', ]; foreach ( $objects as $obj ) { /** @var \Pressbooks\HTMLBook\Element $bm */ $bm = new $obj(); ...
php
public function guessBackMatterObj( $data_type ) { $objects = [ '\Pressbooks\HTMLBook\Component\Appendix', '\Pressbooks\HTMLBook\Component\Bibliography', '\Pressbooks\HTMLBook\Component\Backmatter', ]; foreach ( $objects as $obj ) { /** @var \Pressbooks\HTMLBook\Element $bm */ $bm = new $obj(); ...
[ "public", "function", "guessBackMatterObj", "(", "$", "data_type", ")", "{", "$", "objects", "=", "[", "'\\Pressbooks\\HTMLBook\\Component\\Appendix'", ",", "'\\Pressbooks\\HTMLBook\\Component\\Bibliography'", ",", "'\\Pressbooks\\HTMLBook\\Component\\Backmatter'", ",", "]", ";...
@param $data_type @return Element
[ "@param", "$data_type" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L386-L402
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.preProcessBookContents
protected function preProcessBookContents( $book_contents ) { // We need to change global $id for shortcodes, the_content, ... global $id; $old_id = $id; // Do root level structures first. foreach ( $book_contents as $type => $struct ) { if ( preg_match( '/^__/', $type ) ) { continue; // Skip __magi...
php
protected function preProcessBookContents( $book_contents ) { // We need to change global $id for shortcodes, the_content, ... global $id; $old_id = $id; // Do root level structures first. foreach ( $book_contents as $type => $struct ) { if ( preg_match( '/^__/', $type ) ) { continue; // Skip __magi...
[ "protected", "function", "preProcessBookContents", "(", "$", "book_contents", ")", "{", "// We need to change global $id for shortcodes, the_content, ...", "global", "$", "id", ";", "$", "old_id", "=", "$", "id", ";", "// Do root level structures first.", "foreach", "(", ...
@param $book_contents @return mixed
[ "@param", "$book_contents" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L414-L466
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.preProcessPostContent
protected function preProcessPostContent( $content ) { $content = apply_filters( 'the_export_content', $content ); $content = str_ireplace( [ '<b></b>', '<i></i>', '<strong></strong>', '<em></em>' ], '', $content ); $content = $this->fixAnnoyingCharacters( $content ); // is this used? $content = $this->fixInter...
php
protected function preProcessPostContent( $content ) { $content = apply_filters( 'the_export_content', $content ); $content = str_ireplace( [ '<b></b>', '<i></i>', '<strong></strong>', '<em></em>' ], '', $content ); $content = $this->fixAnnoyingCharacters( $content ); // is this used? $content = $this->fixInter...
[ "protected", "function", "preProcessPostContent", "(", "$", "content", ")", "{", "$", "content", "=", "apply_filters", "(", "'the_export_content'", ",", "$", "content", ")", ";", "$", "content", "=", "str_ireplace", "(", "[", "'<b></b>'", ",", "'<i></i>'", ","...
@param string $content @return string
[ "@param", "string", "$content" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L474-L486
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.fixInternalLinks
protected function fixInternalLinks( $source_content ) { if ( stripos( $source_content, '<a' ) === false ) { // There are no <a> tags to look at, skip this return $source_content; } $home_url = rtrim( home_url(), '/' ); $html5 = new HtmlParser(); $dom = $html5->loadHTML( $source_content ); $links = ...
php
protected function fixInternalLinks( $source_content ) { if ( stripos( $source_content, '<a' ) === false ) { // There are no <a> tags to look at, skip this return $source_content; } $home_url = rtrim( home_url(), '/' ); $html5 = new HtmlParser(); $dom = $html5->loadHTML( $source_content ); $links = ...
[ "protected", "function", "fixInternalLinks", "(", "$", "source_content", ")", "{", "if", "(", "stripos", "(", "$", "source_content", ",", "'<a'", ")", "===", "false", ")", "{", "// There are no <a> tags to look at, skip this", "return", "$", "source_content", ";", ...
@param string $source_content @return string
[ "@param", "string", "$source_content" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L506-L552
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.removeAttributionLink
protected function removeAttributionLink( $content ) { $html5 = new HtmlParser(); $dom = $html5->loadHTML( $content ); $urls = $dom->getElementsByTagName( 'a' ); foreach ( $urls as $url ) { /** @var \DOMElement $url */ // Is this the the attributionUrl? if ( $url->getAttribute( 'rel' ) === 'cc:attribu...
php
protected function removeAttributionLink( $content ) { $html5 = new HtmlParser(); $dom = $html5->loadHTML( $content ); $urls = $dom->getElementsByTagName( 'a' ); foreach ( $urls as $url ) { /** @var \DOMElement $url */ // Is this the the attributionUrl? if ( $url->getAttribute( 'rel' ) === 'cc:attribu...
[ "protected", "function", "removeAttributionLink", "(", "$", "content", ")", "{", "$", "html5", "=", "new", "HtmlParser", "(", ")", ";", "$", "dom", "=", "$", "html5", "->", "loadHTML", "(", "$", "content", ")", ";", "$", "urls", "=", "$", "dom", "->"...
Removes the CC attribution link. @since 4.1 @param string $content @return string
[ "Removes", "the", "CC", "attribution", "link", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L563-L582
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.fixImages
protected function fixImages( $content ) { // Cheap cache static $already_done = []; $changed = false; $html5 = new HtmlParser(); $dom = $html5->loadHTML( $content ); $images = $dom->getElementsByTagName( 'img' ); foreach ( $images as $image ) { /** @var \DOMElement $image */ $old_src = $image->g...
php
protected function fixImages( $content ) { // Cheap cache static $already_done = []; $changed = false; $html5 = new HtmlParser(); $dom = $html5->loadHTML( $content ); $images = $dom->getElementsByTagName( 'img' ); foreach ( $images as $image ) { /** @var \DOMElement $image */ $old_src = $image->g...
[ "protected", "function", "fixImages", "(", "$", "content", ")", "{", "// Cheap cache", "static", "$", "already_done", "=", "[", "]", ";", "$", "changed", "=", "false", ";", "$", "html5", "=", "new", "HtmlParser", "(", ")", ";", "$", "dom", "=", "$", ...
Replace every image with the bigger original image @param $content @return string
[ "Replace", "every", "image", "with", "the", "bigger", "original", "image" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L591-L622
pressbooks/pressbooks
inc/modules/export/htmlbook/class-htmlbook.php
HTMLBook.atLeastOneExport
protected function atLeastOneExport( array $chapters ) { foreach ( $chapters as $key => $val ) { if ( is_array( $val ) ) { $found = $this->atLeastOneExport( $val ); if ( $found ) { return true; } else { continue; } } elseif ( 'export' === (string) $key && $val ) { return true; ...
php
protected function atLeastOneExport( array $chapters ) { foreach ( $chapters as $key => $val ) { if ( is_array( $val ) ) { $found = $this->atLeastOneExport( $val ); if ( $found ) { return true; } else { continue; } } elseif ( 'export' === (string) $key && $val ) { return true; ...
[ "protected", "function", "atLeastOneExport", "(", "array", "$", "chapters", ")", "{", "foreach", "(", "$", "chapters", "as", "$", "key", "=>", "$", "val", ")", "{", "if", "(", "is_array", "(", "$", "val", ")", ")", "{", "$", "found", "=", "$", "thi...
Does array of chapters have at least one export? Recursive. @param array $chapters @return bool
[ "Does", "array", "of", "chapters", "have", "at", "least", "one", "export?", "Recursive", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/htmlbook/class-htmlbook.php#L1653-L1669
pressbooks/pressbooks
inc/api/endpoints/controller/class-metadata.php
Metadata.register_routes
public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base, [ [ 'methods' => \WP_REST_Server::READABLE, 'callback' => [ $this, 'get_item' ], 'permission_callback' => [ $this, 'get_item_permissions_check' ], 'args' => [ 'context' => $this->get_co...
php
public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base, [ [ 'methods' => \WP_REST_Server::READABLE, 'callback' => [ $this, 'get_item' ], 'permission_callback' => [ $this, 'get_item_permissions_check' ], 'args' => [ 'context' => $this->get_co...
[ "public", "function", "register_routes", "(", ")", "{", "register_rest_route", "(", "$", "this", "->", "namespace", ",", "'/'", ".", "$", "this", "->", "rest_base", ",", "[", "[", "'methods'", "=>", "\\", "WP_REST_Server", "::", "READABLE", ",", "'callback'"...
Registers routes for metadata
[ "Registers", "routes", "for", "metadata" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/api/endpoints/controller/class-metadata.php#L25-L44
pressbooks/pressbooks
inc/api/endpoints/controller/class-metadata.php
Metadata.get_item
public function get_item( $request ) { $meta = Book::getBookInformation(); $meta = $this->buildMetadata( $meta ); $response = rest_ensure_response( $meta ); $this->linkCollector['self'] = [ 'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ), ]; $response->add_links( $this->lin...
php
public function get_item( $request ) { $meta = Book::getBookInformation(); $meta = $this->buildMetadata( $meta ); $response = rest_ensure_response( $meta ); $this->linkCollector['self'] = [ 'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ), ]; $response->add_links( $this->lin...
[ "public", "function", "get_item", "(", "$", "request", ")", "{", "$", "meta", "=", "Book", "::", "getBookInformation", "(", ")", ";", "$", "meta", "=", "$", "this", "->", "buildMetadata", "(", "$", "meta", ")", ";", "$", "response", "=", "rest_ensure_r...
@param \WP_REST_Request $request Full data about the request. @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure.
[ "@param", "\\", "WP_REST_Request", "$request", "Full", "data", "about", "the", "request", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/api/endpoints/controller/class-metadata.php#L474-L486
pressbooks/pressbooks
inc/api/endpoints/controller/class-sectionmetadata.php
SectionMetadata.register_routes
public function register_routes() { register_rest_route( $this->namespace, '/' . $this->parent_base . '/(?P<parent>[\d]+)/' . $this->rest_base, [ 'args' => [ 'parent' => [ 'required' => true, 'description' => __( 'The ID for the parent of the object.' ), 'type' => 'integer', ], ...
php
public function register_routes() { register_rest_route( $this->namespace, '/' . $this->parent_base . '/(?P<parent>[\d]+)/' . $this->rest_base, [ 'args' => [ 'parent' => [ 'required' => true, 'description' => __( 'The ID for the parent of the object.' ), 'type' => 'integer', ], ...
[ "public", "function", "register_routes", "(", ")", "{", "register_rest_route", "(", "$", "this", "->", "namespace", ",", "'/'", ".", "$", "this", "->", "parent_base", ".", "'/(?P<parent>[\\d]+)/'", ".", "$", "this", "->", "rest_base", ",", "[", "'args'", "=>...
Registers routes for metadata
[ "Registers", "routes", "for", "metadata" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/api/endpoints/controller/class-sectionmetadata.php#L55-L81
pressbooks/pressbooks
inc/api/endpoints/controller/class-sectionmetadata.php
SectionMetadata.get_item_schema
public function get_item_schema() { $schema = [ '$schema' => 'http://json-schema.org/schema#', 'title' => 'chapter', 'type' => 'object', 'properties' => [ '@context' => [ 'type' => 'string', 'format' => 'uri', 'enum' => [ 'http://bib.schema.org', ], 'description' => __(...
php
public function get_item_schema() { $schema = [ '$schema' => 'http://json-schema.org/schema#', 'title' => 'chapter', 'type' => 'object', 'properties' => [ '@context' => [ 'type' => 'string', 'format' => 'uri', 'enum' => [ 'http://bib.schema.org', ], 'description' => __(...
[ "public", "function", "get_item_schema", "(", ")", "{", "$", "schema", "=", "[", "'$schema'", "=>", "'http://json-schema.org/schema#'", ",", "'title'", "=>", "'chapter'", ",", "'type'", "=>", "'object'", ",", "'properties'", "=>", "[", "'@context'", "=>", "[", ...
Retrieves metadata schema, conforming to Schema.org/Book. @return array
[ "Retrieves", "metadata", "schema", "conforming", "to", "Schema", ".", "org", "/", "Book", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/api/endpoints/controller/class-sectionmetadata.php#L88-L431
pressbooks/pressbooks
inc/api/endpoints/controller/class-sectionmetadata.php
SectionMetadata.get_item
public function get_item( $request ) { $posts = get_posts( [ 'p' => $request['parent'], 'post_type' => $this->post_type, 'post_status' => [ 'web-only', 'publish' ], ] ); $error = new \WP_Error( 'rest_post_invalid_id', __( 'Invalid post ID.' ), [ 'status' => 404, ] ); if ( empty( $p...
php
public function get_item( $request ) { $posts = get_posts( [ 'p' => $request['parent'], 'post_type' => $this->post_type, 'post_status' => [ 'web-only', 'publish' ], ] ); $error = new \WP_Error( 'rest_post_invalid_id', __( 'Invalid post ID.' ), [ 'status' => 404, ] ); if ( empty( $p...
[ "public", "function", "get_item", "(", "$", "request", ")", "{", "$", "posts", "=", "get_posts", "(", "[", "'p'", "=>", "$", "request", "[", "'parent'", "]", ",", "'post_type'", "=>", "$", "this", "->", "post_type", ",", "'post_status'", "=>", "[", "'w...
@param \WP_REST_Request $request Full data about the request. @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure.
[ "@param", "\\", "WP_REST_Request", "$request", "Full", "data", "about", "the", "request", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/api/endpoints/controller/class-sectionmetadata.php#L457-L489
pressbooks/pressbooks
inc/class-privacy.php
Privacy.reschedulePrivacyCron
public function reschedulePrivacyCron( $event ) { if ( isset( $event->hook ) && $event->hook === 'wp_privacy_delete_old_export_files' ) { $s = 'twicedaily'; $event->schedule = $s; $schedules = wp_get_schedules(); if ( isset( $event->interval ) && isset( $schedules[ $s ] ) ) { $event->interval = $sched...
php
public function reschedulePrivacyCron( $event ) { if ( isset( $event->hook ) && $event->hook === 'wp_privacy_delete_old_export_files' ) { $s = 'twicedaily'; $event->schedule = $s; $schedules = wp_get_schedules(); if ( isset( $event->interval ) && isset( $schedules[ $s ] ) ) { $event->interval = $sched...
[ "public", "function", "reschedulePrivacyCron", "(", "$", "event", ")", "{", "if", "(", "isset", "(", "$", "event", "->", "hook", ")", "&&", "$", "event", "->", "hook", "===", "'wp_privacy_delete_old_export_files'", ")", "{", "$", "s", "=", "'twicedaily'", ...
@since 5.4.0 Change the `wp_privacy_delete_old_export_files schedule` from hourly to twicedaily @see wp_schedule_delete_old_privacy_export_files @param object $event @return object $event
[ "@since", "5", ".", "4", ".", "0" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/class-privacy.php#L45-L55
pressbooks/pressbooks
inc/class-htmlparser.php
HtmlParser.loadHTML
public function loadHTML( $html, $options = [] ) { $html = '<div><!-- pb_fixme -->' . $html . '<!-- pb_fixme --></div>'; if ( $this->parser instanceof \DOMDocument ) { libxml_use_internal_errors( true ); $this->parser->loadHTML( mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' ), LIBXML_HTML_NOIMPLIED | L...
php
public function loadHTML( $html, $options = [] ) { $html = '<div><!-- pb_fixme -->' . $html . '<!-- pb_fixme --></div>'; if ( $this->parser instanceof \DOMDocument ) { libxml_use_internal_errors( true ); $this->parser->loadHTML( mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' ), LIBXML_HTML_NOIMPLIED | L...
[ "public", "function", "loadHTML", "(", "$", "html", ",", "$", "options", "=", "[", "]", ")", "{", "$", "html", "=", "'<div><!-- pb_fixme -->'", ".", "$", "html", ".", "'<!-- pb_fixme --></div>'", ";", "if", "(", "$", "this", "->", "parser", "instanceof", ...
@param $html @param array $options @return \DOMDocument
[ "@param", "$html", "@param", "array", "$options" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/class-htmlparser.php#L43-L54
pressbooks/pressbooks
inc/class-htmlparser.php
HtmlParser.saveHTML
public function saveHTML( $dom ) { if ( $this->parser instanceof \DOMDocument ) { libxml_use_internal_errors( true ); $html = $dom->saveHTML(); $this->errors = libxml_get_errors(); libxml_clear_errors(); } else { $html = $this->parser->saveHTML( $dom ); } $html = \Pressbooks\Sanitize\strip_conta...
php
public function saveHTML( $dom ) { if ( $this->parser instanceof \DOMDocument ) { libxml_use_internal_errors( true ); $html = $dom->saveHTML(); $this->errors = libxml_get_errors(); libxml_clear_errors(); } else { $html = $this->parser->saveHTML( $dom ); } $html = \Pressbooks\Sanitize\strip_conta...
[ "public", "function", "saveHTML", "(", "$", "dom", ")", "{", "if", "(", "$", "this", "->", "parser", "instanceof", "\\", "DOMDocument", ")", "{", "libxml_use_internal_errors", "(", "true", ")", ";", "$", "html", "=", "$", "dom", "->", "saveHTML", "(", ...
@param \DOMDocument $dom @return string
[ "@param", "\\", "DOMDocument", "$dom" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/class-htmlparser.php#L62-L81
pressbooks/pressbooks
inc/modules/export/mobi/class-kindlegen.php
Kindlegen.convert
function convert() { // Get most recent Epub file $input_folder = static::getExportFolder(); $input_path = false; $files = \Pressbooks\Utility\scandir_by_date( $input_folder ); foreach ( $files as $file ) { if ( preg_match( '/\.epub/i', $file ) ) { $input_path = $input_folder . $file; break; }...
php
function convert() { // Get most recent Epub file $input_folder = static::getExportFolder(); $input_path = false; $files = \Pressbooks\Utility\scandir_by_date( $input_folder ); foreach ( $files as $file ) { if ( preg_match( '/\.epub/i', $file ) ) { $input_path = $input_folder . $file; break; }...
[ "function", "convert", "(", ")", "{", "// Get most recent Epub file", "$", "input_folder", "=", "static", "::", "getExportFolder", "(", ")", ";", "$", "input_path", "=", "false", ";", "$", "files", "=", "\\", "Pressbooks", "\\", "Utility", "\\", "scandir_by_da...
Create $this->outputPath @return bool
[ "Create", "$this", "-", ">", "outputPath" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/mobi/class-kindlegen.php#L38-L94
pressbooks/pressbooks
inc/modules/export/mobi/class-kindlegen.php
Kindlegen.hasDependencies
static function hasDependencies() { if ( false !== \Pressbooks\Utility\check_epubcheck_install() && false !== \Pressbooks\Utility\check_kindlegen_install() ) { return true; } return false; }
php
static function hasDependencies() { if ( false !== \Pressbooks\Utility\check_epubcheck_install() && false !== \Pressbooks\Utility\check_kindlegen_install() ) { return true; } return false; }
[ "static", "function", "hasDependencies", "(", ")", "{", "if", "(", "false", "!==", "\\", "Pressbooks", "\\", "Utility", "\\", "check_epubcheck_install", "(", ")", "&&", "false", "!==", "\\", "Pressbooks", "\\", "Utility", "\\", "check_kindlegen_install", "(", ...
Dependency check. @return bool
[ "Dependency", "check", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/mobi/class-kindlegen.php#L113-L119
pressbooks/pressbooks
inc/class-globaltypography.php
GlobalTypography.getSupportedLanguages
function getSupportedLanguages() { return [ 'grc' => __( 'Ancient Greek', 'pressbooks' ), 'ar' => __( 'Arabic', 'pressbooks' ), 'bn' => __( 'Bengali', 'pressbooks' ), 'he' => __( 'Biblical Hebrew', 'pressbooks' ), 'cans' => __( 'Canadian Indigenous Syllabics', 'pressbooks' ), 'hi' => __( 'Devanagari...
php
function getSupportedLanguages() { return [ 'grc' => __( 'Ancient Greek', 'pressbooks' ), 'ar' => __( 'Arabic', 'pressbooks' ), 'bn' => __( 'Bengali', 'pressbooks' ), 'he' => __( 'Biblical Hebrew', 'pressbooks' ), 'cans' => __( 'Canadian Indigenous Syllabics', 'pressbooks' ), 'hi' => __( 'Devanagari...
[ "function", "getSupportedLanguages", "(", ")", "{", "return", "[", "'grc'", "=>", "__", "(", "'Ancient Greek'", ",", "'pressbooks'", ")", ",", "'ar'", "=>", "__", "(", "'Arabic'", ",", "'pressbooks'", ")", ",", "'bn'", "=>", "__", "(", "'Bengali'", ",", ...
Get Pressbooks-supported languages. @return array
[ "Get", "Pressbooks", "-", "supported", "languages", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/class-globaltypography.php#L37-L61
pressbooks/pressbooks
inc/class-globaltypography.php
GlobalTypography.getThemeFontStacks
function getThemeFontStacks( $type ) { $return_value = ''; $fullpath = $this->sass->pathToUserGeneratedSass() . "/_font-stack-{$type}.scss"; if ( is_file( $fullpath ) ) { $return_value = \Pressbooks\Utility\get_contents( $fullpath ); } return $return_value; }
php
function getThemeFontStacks( $type ) { $return_value = ''; $fullpath = $this->sass->pathToUserGeneratedSass() . "/_font-stack-{$type}.scss"; if ( is_file( $fullpath ) ) { $return_value = \Pressbooks\Utility\get_contents( $fullpath ); } return $return_value; }
[ "function", "getThemeFontStacks", "(", "$", "type", ")", "{", "$", "return_value", "=", "''", ";", "$", "fullpath", "=", "$", "this", "->", "sass", "->", "pathToUserGeneratedSass", "(", ")", ".", "\"/_font-stack-{$type}.scss\"", ";", "if", "(", "is_file", "(...
Get the current theme's font stacks. @param string $type (prince, epub, web ...) @return string
[ "Get", "the", "current", "theme", "s", "font", "stacks", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/class-globaltypography.php#L71-L82
pressbooks/pressbooks
inc/class-globaltypography.php
GlobalTypography._getRequiredLanguages
function _getRequiredLanguages() { $languages = get_option( 'pressbooks_global_typography', [] ); $book_lang = $this->_getBookLanguage(); if ( ! empty( $book_lang ) ) { $languages[] = $book_lang; } if ( is_array( $this->getThemeSupportedLanguages() ) ) { $languages = array_unique( array_merge( $la...
php
function _getRequiredLanguages() { $languages = get_option( 'pressbooks_global_typography', [] ); $book_lang = $this->_getBookLanguage(); if ( ! empty( $book_lang ) ) { $languages[] = $book_lang; } if ( is_array( $this->getThemeSupportedLanguages() ) ) { $languages = array_unique( array_merge( $la...
[ "function", "_getRequiredLanguages", "(", ")", "{", "$", "languages", "=", "get_option", "(", "'pressbooks_global_typography'", ",", "[", "]", ")", ";", "$", "book_lang", "=", "$", "this", "->", "_getBookLanguage", "(", ")", ";", "if", "(", "!", "empty", "...
Get required languages for this book, excluding those supported by the theme. @return array
[ "Get", "required", "languages", "for", "this", "book", "excluding", "those", "supported", "by", "the", "theme", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/class-globaltypography.php#L89-L104
pressbooks/pressbooks
inc/class-globaltypography.php
GlobalTypography.updateGlobalTypographyMixin
function updateGlobalTypographyMixin() { $languages = $this->_getRequiredLanguages(); // Auto-create SCSS files // TODO: Use self::getThemeFontStacks() to parse if stack has $serif or $sans-serif strings foreach ( [ 'prince', 'epub', 'web' ] as $type ) { $this->_sassify( $type, $languages ); } $this...
php
function updateGlobalTypographyMixin() { $languages = $this->_getRequiredLanguages(); // Auto-create SCSS files // TODO: Use self::getThemeFontStacks() to parse if stack has $serif or $sans-serif strings foreach ( [ 'prince', 'epub', 'web' ] as $type ) { $this->_sassify( $type, $languages ); } $this...
[ "function", "updateGlobalTypographyMixin", "(", ")", "{", "$", "languages", "=", "$", "this", "->", "_getRequiredLanguages", "(", ")", ";", "// Auto-create SCSS files", "// TODO: Use self::getThemeFontStacks() to parse if stack has $serif or $sans-serif strings", "foreach", "(", ...
Update and save the SCSS mixin which assigns the $global-typography variable.
[ "Update", "and", "save", "the", "SCSS", "mixin", "which", "assigns", "the", "$global", "-", "typography", "variable", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/class-globaltypography.php#L109-L123
pressbooks/pressbooks
inc/class-globaltypography.php
GlobalTypography.getThemeSupportedLanguages
function getThemeSupportedLanguages() { $return_value = false; $fullpath = get_stylesheet_directory() . '/theme-information.php'; if ( is_file( $fullpath ) ) { require( $fullpath ); if ( ! empty( $supported_languages ) ) { $return_value = $supported_languages; } } else { $return_value = get...
php
function getThemeSupportedLanguages() { $return_value = false; $fullpath = get_stylesheet_directory() . '/theme-information.php'; if ( is_file( $fullpath ) ) { require( $fullpath ); if ( ! empty( $supported_languages ) ) { $return_value = $supported_languages; } } else { $return_value = get...
[ "function", "getThemeSupportedLanguages", "(", ")", "{", "$", "return_value", "=", "false", ";", "$", "fullpath", "=", "get_stylesheet_directory", "(", ")", ".", "'/theme-information.php'", ";", "if", "(", "is_file", "(", "$", "fullpath", ")", ")", "{", "requi...
Get the current theme's supported languages. @return array
[ "Get", "the", "current", "theme", "s", "supported", "languages", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/class-globaltypography.php#L212-L230
pressbooks/pressbooks
inc/class-globaltypography.php
GlobalTypography._sassify
protected function _sassify( $type, array $languages ) { // Create Scss $scss = "// Global Typography \n"; foreach ( $languages as $lang ) { // Find scss font template in order of priority foreach ( [ "fonts-{$lang}-{$type}", "fonts-{$lang}" ] as $i ) { if ( file_exists( $this->sass->pathToFonts() ....
php
protected function _sassify( $type, array $languages ) { // Create Scss $scss = "// Global Typography \n"; foreach ( $languages as $lang ) { // Find scss font template in order of priority foreach ( [ "fonts-{$lang}-{$type}", "fonts-{$lang}" ] as $i ) { if ( file_exists( $this->sass->pathToFonts() ....
[ "protected", "function", "_sassify", "(", "$", "type", ",", "array", "$", "languages", ")", "{", "// Create Scss", "$", "scss", "=", "\"// Global Typography \\n\"", ";", "foreach", "(", "$", "languages", "as", "$", "lang", ")", "{", "// Find scss font template i...
@param $type @param array $languages @return void
[ "@param", "$type", "@param", "array", "$languages" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/class-globaltypography.php#L239-L281
pressbooks/pressbooks
inc/class-globaltypography.php
GlobalTypography.getFonts
function getFonts( $languages = null ) { if ( ! $languages ) { $languages = $this->_getRequiredLanguages(); } $basepath = WP_CONTENT_DIR . '/uploads/assets/fonts/'; if ( ! is_dir( $basepath ) ) { mkdir( $basepath, 0755, true ); } // List fonts $fontpacks = [ 'bn' => [ 'baseurl' => 'https://g...
php
function getFonts( $languages = null ) { if ( ! $languages ) { $languages = $this->_getRequiredLanguages(); } $basepath = WP_CONTENT_DIR . '/uploads/assets/fonts/'; if ( ! is_dir( $basepath ) ) { mkdir( $basepath, 0755, true ); } // List fonts $fontpacks = [ 'bn' => [ 'baseurl' => 'https://g...
[ "function", "getFonts", "(", "$", "languages", "=", "null", ")", "{", "if", "(", "!", "$", "languages", ")", "{", "$", "languages", "=", "$", "this", "->", "_getRequiredLanguages", "(", ")", ";", "}", "$", "basepath", "=", "WP_CONTENT_DIR", ".", "'/upl...
Check for absent font files and download if necessary. @param array $languages @return bool
[ "Check", "for", "absent", "font", "files", "and", "download", "if", "necessary", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/class-globaltypography.php#L290-L414
pressbooks/pressbooks
inc/modules/import/wordpress/class-parser.php
Parser.parse
function parse( $file ) { // ------------------------------------------------------------------------------------------------------------ // Setup & sanity check // ------------------------------------------------------------------------------------------------------------ $authors = []; $posts = []; $cat...
php
function parse( $file ) { // ------------------------------------------------------------------------------------------------------------ // Setup & sanity check // ------------------------------------------------------------------------------------------------------------ $authors = []; $posts = []; $cat...
[ "function", "parse", "(", "$", "file", ")", "{", "// ------------------------------------------------------------------------------------------------------------", "// Setup & sanity check", "// -------------------------------------------------------------------------------------------------------...
@param string $file @return array @throws \Exception
[ "@param", "string", "$file" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/wordpress/class-parser.php#L22-L255
pressbooks/pressbooks
inc/modules/searchandreplace/class-searchandreplace.php
SearchAndReplace.searchHead
public function searchHead() { $assets = new Assets( 'pressbooks', 'plugin' ); wp_enqueue_style( 'search-and-replace', $assets->getPath( 'styles/search-and-replace.css' ) ); wp_register_script( 'search-and-replace', $assets->getPath( 'scripts/search-and-replace.js' ) ); wp_localize_script( 'search-and-replace',...
php
public function searchHead() { $assets = new Assets( 'pressbooks', 'plugin' ); wp_enqueue_style( 'search-and-replace', $assets->getPath( 'styles/search-and-replace.css' ) ); wp_register_script( 'search-and-replace', $assets->getPath( 'scripts/search-and-replace.js' ) ); wp_localize_script( 'search-and-replace',...
[ "public", "function", "searchHead", "(", ")", "{", "$", "assets", "=", "new", "Assets", "(", "'pressbooks'", ",", "'plugin'", ")", ";", "wp_enqueue_style", "(", "'search-and-replace'", ",", "$", "assets", "->", "getPath", "(", "'styles/search-and-replace.css'", ...
Load styles and scripts
[ "Load", "styles", "and", "scripts" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/searchandreplace/class-searchandreplace.php#L47-L53
pressbooks/pressbooks
inc/modules/searchandreplace/class-searchandreplace.php
SearchAndReplace.adminScreen
public function adminScreen() { $searches = Search::getSearches(); if ( isset( $_POST['search_pattern'] ) && ! wp_verify_nonce( $_POST['pressbooks-search-and-replace-nonce'], 'search' ) ) { return; } $search_pattern = ''; $replace_pattern = ''; if ( isset( $_POST['search_pattern'] ) ) { $search_pat...
php
public function adminScreen() { $searches = Search::getSearches(); if ( isset( $_POST['search_pattern'] ) && ! wp_verify_nonce( $_POST['pressbooks-search-and-replace-nonce'], 'search' ) ) { return; } $search_pattern = ''; $replace_pattern = ''; if ( isset( $_POST['search_pattern'] ) ) { $search_pat...
[ "public", "function", "adminScreen", "(", ")", "{", "$", "searches", "=", "Search", "::", "getSearches", "(", ")", ";", "if", "(", "isset", "(", "$", "_POST", "[", "'search_pattern'", "]", ")", "&&", "!", "wp_verify_nonce", "(", "$", "_POST", "[", "'pr...
Callable for add_management_page
[ "Callable", "for", "add_management_page" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/searchandreplace/class-searchandreplace.php#L82-L172
pressbooks/pressbooks
inc/modules/export/prince/class-docraptorprint.php
DocraptorPrint.themeOptionsOverrides
protected function themeOptionsOverrides() { parent::themeOptionsOverrides(); // Output Intent $icc = $this->pdfOutputIntent; if ( ! empty( $icc ) ) { $this->cssOverrides .= "\n" . "@prince-pdf { prince-pdf-output-intent: url('$icc'); } \n"; } }
php
protected function themeOptionsOverrides() { parent::themeOptionsOverrides(); // Output Intent $icc = $this->pdfOutputIntent; if ( ! empty( $icc ) ) { $this->cssOverrides .= "\n" . "@prince-pdf { prince-pdf-output-intent: url('$icc'); } \n"; } }
[ "protected", "function", "themeOptionsOverrides", "(", ")", "{", "parent", "::", "themeOptionsOverrides", "(", ")", ";", "// Output Intent", "$", "icc", "=", "$", "this", "->", "pdfOutputIntent", ";", "if", "(", "!", "empty", "(", "$", "icc", ")", ")", "{"...
Override based on Theme Options
[ "Override", "based", "on", "Theme", "Options" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/prince/class-docraptorprint.php#L55-L65
pressbooks/pressbooks
inc/modules/export/wordpress/class-wxr.php
Wxr.transform
function transform( $return = false ) { // Check permissions if ( ! current_user_can( 'edit_posts' ) ) { wp_die( __( 'Invalid permission error', 'pressbooks' ) ); } // Ahoy! Gross code ahead. // Cannot redeclare a function inside of a function, execute export_wp() only once static $buffer; if ( ! fun...
php
function transform( $return = false ) { // Check permissions if ( ! current_user_can( 'edit_posts' ) ) { wp_die( __( 'Invalid permission error', 'pressbooks' ) ); } // Ahoy! Gross code ahead. // Cannot redeclare a function inside of a function, execute export_wp() only once static $buffer; if ( ! fun...
[ "function", "transform", "(", "$", "return", "=", "false", ")", "{", "// Check permissions", "if", "(", "!", "current_user_can", "(", "'edit_posts'", ")", ")", "{", "wp_die", "(", "__", "(", "'Invalid permission error'", ",", "'pressbooks'", ")", ")", ";", "...
Procedure for "format/wxr" rewrite rule. @see \Pressbooks\Redirect\do_format @param bool $return (optional) If you would like to capture the output of transform, use the return parameter. If this parameter is set to true, transform will return its output, instead of printing it. @return mixed
[ "Procedure", "for", "format", "/", "wxr", "rewrite", "rule", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/export/wordpress/class-wxr.php#L77-L100
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.column_default
function column_default( $item, $column_name ) { if ( preg_match( '/^tag_\d+$/', $column_name ) ) { return $this->renderTagColumn( $item, $column_name ); } return esc_html( $item[ $column_name ] ); }
php
function column_default( $item, $column_name ) { if ( preg_match( '/^tag_\d+$/', $column_name ) ) { return $this->renderTagColumn( $item, $column_name ); } return esc_html( $item[ $column_name ] ); }
[ "function", "column_default", "(", "$", "item", ",", "$", "column_name", ")", "{", "if", "(", "preg_match", "(", "'/^tag_\\d+$/'", ",", "$", "column_name", ")", ")", "{", "return", "$", "this", "->", "renderTagColumn", "(", "$", "item", ",", "$", "column...
This method is called when the parent class can't find a method for a given column. For example, if the class needs to process a column named 'title', it would first see if a method named $this->column_title() exists. If it doesn't this one will be used. @see WP_List_Table::single_row_columns() @param object $item A ...
[ "This", "method", "is", "called", "when", "the", "parent", "class", "can", "t", "find", "a", "method", "for", "a", "given", "column", ".", "For", "example", "if", "the", "class", "needs", "to", "process", "a", "column", "named", "title", "it", "would", ...
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L49-L56
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.column_title
function column_title( $item ) { list( $user_id, $blog_id ) = explode( ':', $item['ID'] ); // Build row actions $actions = [ 'visit' => sprintf( '<a href="%s">%s</a>', get_home_url( $blog_id ), __( 'Visit Book' ) ), ]; // Only include admin link if user has admin rights to the book in question if ( is...
php
function column_title( $item ) { list( $user_id, $blog_id ) = explode( ':', $item['ID'] ); // Build row actions $actions = [ 'visit' => sprintf( '<a href="%s">%s</a>', get_home_url( $blog_id ), __( 'Visit Book' ) ), ]; // Only include admin link if user has admin rights to the book in question if ( is...
[ "function", "column_title", "(", "$", "item", ")", "{", "list", "(", "$", "user_id", ",", "$", "blog_id", ")", "=", "explode", "(", "':'", ",", "$", "item", "[", "'ID'", "]", ")", ";", "// Build row actions", "$", "actions", "=", "[", "'visit'", "=>"...
@param array $item A singular item (one full row's worth of data) @return string Text to be placed inside the column <td>
[ "@param", "array", "$item", "A", "singular", "item", "(", "one", "full", "row", "s", "worth", "of", "data", ")" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L64-L84
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.column_status
function column_status( $item ) { $add_url = sprintf( get_admin_url() . 'index.php?page=%s&action=%s&ID=%s', $_REQUEST['page'], 'add', $item['ID'] ); $add_url = esc_url( add_query_arg( '_wpnonce', wp_create_nonce( $item['ID'] ), $add_url ) ); $add_url = static::addSearchParamsToUrl( $add_url ); $remove_url = ...
php
function column_status( $item ) { $add_url = sprintf( get_admin_url() . 'index.php?page=%s&action=%s&ID=%s', $_REQUEST['page'], 'add', $item['ID'] ); $add_url = esc_url( add_query_arg( '_wpnonce', wp_create_nonce( $item['ID'] ), $add_url ) ); $add_url = static::addSearchParamsToUrl( $add_url ); $remove_url = ...
[ "function", "column_status", "(", "$", "item", ")", "{", "$", "add_url", "=", "sprintf", "(", "get_admin_url", "(", ")", ".", "'index.php?page=%s&action=%s&ID=%s'", ",", "$", "_REQUEST", "[", "'page'", "]", ",", "'add'", ",", "$", "item", "[", "'ID'", "]",...
@param array $item A singular item (one full row's worth of data) @return string Text to be placed inside the column <td>
[ "@param", "array", "$item", "A", "singular", "item", "(", "one", "full", "row", "s", "worth", "of", "data", ")" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L92-L121
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.column_cover
function column_cover( $item ) { $img = esc_url( $item['cover'] ); $alt = esc_attr( $item['title'] ); $html = "<img src='$img' alt='$alt' />"; return $html; }
php
function column_cover( $item ) { $img = esc_url( $item['cover'] ); $alt = esc_attr( $item['title'] ); $html = "<img src='$img' alt='$alt' />"; return $html; }
[ "function", "column_cover", "(", "$", "item", ")", "{", "$", "img", "=", "esc_url", "(", "$", "item", "[", "'cover'", "]", ")", ";", "$", "alt", "=", "esc_attr", "(", "$", "item", "[", "'title'", "]", ")", ";", "$", "html", "=", "\"<img src='$img' ...
@param array $item A singular item (one full row's worth of data) @return string Text to be placed inside the column <td>
[ "@param", "array", "$item", "A", "singular", "item", "(", "one", "full", "row", "s", "worth", "of", "data", ")" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L129-L137
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.get_columns
function get_columns() { $profile = ( new Catalog() )->getProfile(); $columns = [ 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text 'status' => __( 'Catalog Status', 'pressbooks' ), 'privacy' => __( 'Privacy Status', 'pressbooks' ), 'cover' => __( 'Cover', 'pressbooks' ), 't...
php
function get_columns() { $profile = ( new Catalog() )->getProfile(); $columns = [ 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text 'status' => __( 'Catalog Status', 'pressbooks' ), 'privacy' => __( 'Privacy Status', 'pressbooks' ), 'cover' => __( 'Cover', 'pressbooks' ), 't...
[ "function", "get_columns", "(", ")", "{", "$", "profile", "=", "(", "new", "Catalog", "(", ")", ")", "->", "getProfile", "(", ")", ";", "$", "columns", "=", "[", "'cb'", "=>", "'<input type=\"checkbox\" />'", ",", "// Render a checkbox instead of text", "'stat...
This method dictates the table's columns and titles. @return array An associative array containing column information: 'slugs'=>'Visible Titles'
[ "This", "method", "dictates", "the", "table", "s", "columns", "and", "titles", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L163-L184
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.prepare_items
function prepare_items() { // Define Columns $columns = $this->get_columns(); $hidden = $this->getHiddenColumns(); $sortable = $this->get_sortable_columns(); $this->_column_headers = [ $columns, $hidden, $sortable ]; // Get data, sort $data = $this->getItemsData(); $valid_cols = $this->get_sortable_co...
php
function prepare_items() { // Define Columns $columns = $this->get_columns(); $hidden = $this->getHiddenColumns(); $sortable = $this->get_sortable_columns(); $this->_column_headers = [ $columns, $hidden, $sortable ]; // Get data, sort $data = $this->getItemsData(); $valid_cols = $this->get_sortable_co...
[ "function", "prepare_items", "(", ")", "{", "// Define Columns", "$", "columns", "=", "$", "this", "->", "get_columns", "(", ")", ";", "$", "hidden", "=", "$", "this", "->", "getHiddenColumns", "(", ")", ";", "$", "sortable", "=", "$", "this", "->", "g...
REQUIRED! This is where you prepare your data for display. This method will usually be used to query the database, sort and filter the data, and generally get it ready to be displayed. At a minimum, we should set $this->items and $this->set_pagination_args()
[ "REQUIRED!", "This", "is", "where", "you", "prepare", "your", "data", "for", "display", ".", "This", "method", "will", "usually", "be", "used", "to", "query", "the", "database", "sort", "and", "filter", "the", "data", "and", "generally", "get", "it", "read...
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L227-L276
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.print_column_headers
function print_column_headers( $with_id = true ) { if ( isset( $_POST['pb_catalog_search'] ) ) { if ( ! wp_verify_nonce( esc_attr( $_POST['pb_catalog_search'] ), 'pb_catalog_search' ) ) { die( 'Security check.' ); } } if ( empty( $_GET['s'] ) && ! empty( $_POST['s'] ) ) { $_SERVER['REQUEST_URI'] = e...
php
function print_column_headers( $with_id = true ) { if ( isset( $_POST['pb_catalog_search'] ) ) { if ( ! wp_verify_nonce( esc_attr( $_POST['pb_catalog_search'] ), 'pb_catalog_search' ) ) { die( 'Security check.' ); } } if ( empty( $_GET['s'] ) && ! empty( $_POST['s'] ) ) { $_SERVER['REQUEST_URI'] = e...
[ "function", "print_column_headers", "(", "$", "with_id", "=", "true", ")", "{", "if", "(", "isset", "(", "$", "_POST", "[", "'pb_catalog_search'", "]", ")", ")", "{", "if", "(", "!", "wp_verify_nonce", "(", "esc_attr", "(", "$", "_POST", "[", "'pb_catalo...
Form is POST not GET. Override parent method to compensate. @param bool $with_id
[ "Form", "is", "POST", "not", "GET", ".", "Override", "parent", "method", "to", "compensate", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L284-L304
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.renderTagColumn
protected function renderTagColumn( $item, $column_name ) { $html = Catalog::tagsToString( $item[ $column_name ] ); if ( ! $html ) { $html = '<span style="color:silver">n/a</span>'; } // Build row actions $actions = [ 'edit_tags' => sprintf( '<a href="?page=%s&action=%s&ID=%s">%s</a>', $_REQU...
php
protected function renderTagColumn( $item, $column_name ) { $html = Catalog::tagsToString( $item[ $column_name ] ); if ( ! $html ) { $html = '<span style="color:silver">n/a</span>'; } // Build row actions $actions = [ 'edit_tags' => sprintf( '<a href="?page=%s&action=%s&ID=%s">%s</a>', $_REQU...
[ "protected", "function", "renderTagColumn", "(", "$", "item", ",", "$", "column_name", ")", "{", "$", "html", "=", "Catalog", "::", "tagsToString", "(", "$", "item", "[", "$", "column_name", "]", ")", ";", "if", "(", "!", "$", "html", ")", "{", "$", ...
@param object $item A singular item (one full row's worth of data) @param string $column_name The name/slug of the column to be processed @return string Text to be placed inside the column <td>
[ "@param", "object", "$item", "A", "singular", "item", "(", "one", "full", "row", "s", "worth", "of", "data", ")", "@param", "string", "$column_name", "The", "name", "/", "slug", "of", "the", "column", "to", "be", "processed" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L330-L356
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.searchFilter
protected function searchFilter( array $data ) { $keyword = ( ! empty( $_REQUEST['s'] ) ) ? (string) trim( $_REQUEST['s'] ) : false; if ( ! $keyword ) { return $data; } $filtered_data = []; foreach ( $data as $_ => $val ) { if ( $this->atLeastOneKeyword( $keyword, $val ) ) { $filtered_data[] = $v...
php
protected function searchFilter( array $data ) { $keyword = ( ! empty( $_REQUEST['s'] ) ) ? (string) trim( $_REQUEST['s'] ) : false; if ( ! $keyword ) { return $data; } $filtered_data = []; foreach ( $data as $_ => $val ) { if ( $this->atLeastOneKeyword( $keyword, $val ) ) { $filtered_data[] = $v...
[ "protected", "function", "searchFilter", "(", "array", "$", "data", ")", "{", "$", "keyword", "=", "(", "!", "empty", "(", "$", "_REQUEST", "[", "'s'", "]", ")", ")", "?", "(", "string", ")", "trim", "(", "$", "_REQUEST", "[", "'s'", "]", ")", ":...
@param array $data @return array
[ "@param", "array", "$data" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L398-L414
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.atLeastOneKeyword
protected function atLeastOneKeyword( $keyword, array $data ) { // TODO: Does this work with multi-byte characters? foreach ( $data as $key => $val ) { if ( is_array( $val ) ) { $found = $this->atLeastOneKeyword( $keyword, $val ); if ( $found ) { return true; } else { continue; } }...
php
protected function atLeastOneKeyword( $keyword, array $data ) { // TODO: Does this work with multi-byte characters? foreach ( $data as $key => $val ) { if ( is_array( $val ) ) { $found = $this->atLeastOneKeyword( $keyword, $val ); if ( $found ) { return true; } else { continue; } }...
[ "protected", "function", "atLeastOneKeyword", "(", "$", "keyword", ",", "array", "$", "data", ")", "{", "// TODO: Does this work with multi-byte characters?", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "val", ")", "{", "if", "(", "is_array", "("...
@param $keyword @param array $data @return bool
[ "@param", "$keyword", "@param", "array", "$data" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L423-L441
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.addMenu
static function addMenu() { $url = get_admin_url( get_current_blog_id(), '/index.php?page=pb_catalog' ); $view_url = static::viewCatalogUrl(); $edit_url = $url . '&action=edit_profile'; if ( isset( $_REQUEST['user_id'] ) ) { $edit_url .= '&user_id=' . $_REQUEST['user_id']; } $list_table = new static();...
php
static function addMenu() { $url = get_admin_url( get_current_blog_id(), '/index.php?page=pb_catalog' ); $view_url = static::viewCatalogUrl(); $edit_url = $url . '&action=edit_profile'; if ( isset( $_REQUEST['user_id'] ) ) { $edit_url .= '&user_id=' . $_REQUEST['user_id']; } $list_table = new static();...
[ "static", "function", "addMenu", "(", ")", "{", "$", "url", "=", "get_admin_url", "(", "get_current_blog_id", "(", ")", ",", "'/index.php?page=pb_catalog'", ")", ";", "$", "view_url", "=", "static", "::", "viewCatalogUrl", "(", ")", ";", "$", "edit_url", "="...
WP Hook, Instantiate UI
[ "WP", "Hook", "Instantiate", "UI" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L447-L510
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.addSearchParamsToUrl
static function addSearchParamsToUrl( $url ) { if ( ! empty( $_REQUEST['s'] ) ) { $url = esc_url( add_query_arg( 's', $_REQUEST['s'], $url ) ); } if ( ! empty( $_REQUEST['orderby'] ) ) { $url = esc_url( add_query_arg( 'orderby', $_REQUEST['orderby'], $url ) ); } if ( ! empty( $_REQUEST['order'] ) ) {...
php
static function addSearchParamsToUrl( $url ) { if ( ! empty( $_REQUEST['s'] ) ) { $url = esc_url( add_query_arg( 's', $_REQUEST['s'], $url ) ); } if ( ! empty( $_REQUEST['orderby'] ) ) { $url = esc_url( add_query_arg( 'orderby', $_REQUEST['orderby'], $url ) ); } if ( ! empty( $_REQUEST['order'] ) ) {...
[ "static", "function", "addSearchParamsToUrl", "(", "$", "url", ")", "{", "if", "(", "!", "empty", "(", "$", "_REQUEST", "[", "'s'", "]", ")", ")", "{", "$", "url", "=", "esc_url", "(", "add_query_arg", "(", "'s'", ",", "$", "_REQUEST", "[", "'s'", ...
Rebuild a URL with known search parameters @param string $url @return string
[ "Rebuild", "a", "URL", "with", "known", "search", "parameters" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L520-L539
pressbooks/pressbooks
inc/admin/class-catalog-list-table.php
Catalog_List_Table.viewCatalogUrl
static function viewCatalogUrl() { if ( isset( $_REQUEST['user_id'] ) ) { if ( false === current_user_can( 'edit_user', (int) $_REQUEST['user_id'] ) ) { wp_die( __( 'You do not have permission to do that.' ) ); } $u = get_userdata( (int) $_REQUEST['user_id'] ); if ( false === $u ) { wp_die( __(...
php
static function viewCatalogUrl() { if ( isset( $_REQUEST['user_id'] ) ) { if ( false === current_user_can( 'edit_user', (int) $_REQUEST['user_id'] ) ) { wp_die( __( 'You do not have permission to do that.' ) ); } $u = get_userdata( (int) $_REQUEST['user_id'] ); if ( false === $u ) { wp_die( __(...
[ "static", "function", "viewCatalogUrl", "(", ")", "{", "if", "(", "isset", "(", "$", "_REQUEST", "[", "'user_id'", "]", ")", ")", "{", "if", "(", "false", "===", "current_user_can", "(", "'edit_user'", ",", "(", "int", ")", "$", "_REQUEST", "[", "'user...
Generate catalog URL. Dies on problem. @return string
[ "Generate", "catalog", "URL", ".", "Dies", "on", "problem", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/admin/class-catalog-list-table.php#L547-L568
pressbooks/pressbooks
symbionts/disable-comments-mu/disable-comments-mu.php
Disable_Comments_MU.feed_links
function feed_links( $args = array() ) { if ( !current_theme_supports('automatic-feed-links') ) return; $defaults = array( /* translators: Separator between blog name and feed type in feed links */ 'separator' => _x('&raquo;', 'feed link'), /* translators: 1: blog title, 2: separator (raquo) */ 'feed...
php
function feed_links( $args = array() ) { if ( !current_theme_supports('automatic-feed-links') ) return; $defaults = array( /* translators: Separator between blog name and feed type in feed links */ 'separator' => _x('&raquo;', 'feed link'), /* translators: 1: blog title, 2: separator (raquo) */ 'feed...
[ "function", "feed_links", "(", "$", "args", "=", "array", "(", ")", ")", "{", "if", "(", "!", "current_theme_supports", "(", "'automatic-feed-links'", ")", ")", "return", ";", "$", "defaults", "=", "array", "(", "/* translators: Separator between blog name and fee...
Not required after WP 4.4
[ "Not", "required", "after", "WP", "4", ".", "4" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/symbionts/disable-comments-mu/disable-comments-mu.php#L168-L179
pressbooks/pressbooks
inc/covergenerator/class-docraptorpdf.php
DocraptorPdf.generate
public function generate() { $output_path = $this->timestampedFileName( 'pdf' ); $this->generateWithDocraptor( $this->pdfProfile, $this->generateHtml(), $output_path ); delete_transient( 'dirsize_cache' ); /** @see get_dirsize() */ return $output_path; }
php
public function generate() { $output_path = $this->timestampedFileName( 'pdf' ); $this->generateWithDocraptor( $this->pdfProfile, $this->generateHtml(), $output_path ); delete_transient( 'dirsize_cache' ); /** @see get_dirsize() */ return $output_path; }
[ "public", "function", "generate", "(", ")", "{", "$", "output_path", "=", "$", "this", "->", "timestampedFileName", "(", "'pdf'", ")", ";", "$", "this", "->", "generateWithDocraptor", "(", "$", "this", "->", "pdfProfile", ",", "$", "this", "->", "generateH...
Generate PDF print cover @return string Output path
[ "Generate", "PDF", "print", "cover" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/covergenerator/class-docraptorpdf.php#L89-L94
pressbooks/pressbooks
inc/modules/themeoptions/class-globaloptions.php
GlobalOptions.init
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...
php
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...
[ "function", "init", "(", ")", "{", "$", "_option", "=", "'pressbooks_theme_options_'", ".", "$", "this", "->", "getSlug", "(", ")", ";", "$", "_page", "=", "$", "_option", ";", "$", "_section", "=", "$", "this", "->", "getSlug", "(", ")", ".", "'_opt...
Configure the global options tab using the settings API.
[ "Configure", "the", "global", "options", "tab", "using", "the", "settings", "API", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-globaloptions.php#L60-L239
pressbooks/pressbooks
inc/modules/themeoptions/class-globaloptions.php
GlobalOptions.renderChapterNumbersField
function renderChapterNumbersField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'chapter_numbers', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'chapter_numbers', 'value' => ( isset( $this->options['chapter_numbers'] ) ) ? $this...
php
function renderChapterNumbersField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'chapter_numbers', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'chapter_numbers', 'value' => ( isset( $this->options['chapter_numbers'] ) ) ? $this...
[ "function", "renderChapterNumbersField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderCheckbox", "(", "[", "'id'", "=>", "'chapter_numbers'", ",...
Render the chapter_numbers checkbox. @param array $args
[ "Render", "the", "chapter_numbers", "checkbox", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-globaloptions.php#L310-L321
pressbooks/pressbooks
inc/modules/themeoptions/class-globaloptions.php
GlobalOptions.renderTwoLevelTOCField
function renderTwoLevelTOCField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'parse_subsections', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'parse_subsections', 'value' => ( isset( $this->options['parse_subsections'] ) ) ? $t...
php
function renderTwoLevelTOCField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'parse_subsections', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'parse_subsections', 'value' => ( isset( $this->options['parse_subsections'] ) ) ? $t...
[ "function", "renderTwoLevelTOCField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderCheckbox", "(", "[", "'id'", "=>", "'parse_subsections'", ","...
Render the parse_subsections checkbox. @param array $args
[ "Render", "the", "parse_subsections", "checkbox", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-globaloptions.php#L328-L339
pressbooks/pressbooks
inc/modules/themeoptions/class-globaloptions.php
GlobalOptions.renderAttachmentAttributionsField
function renderAttachmentAttributionsField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'attachment_attributions', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'attachment_attributions', 'value' => ( isset( $this->options['attac...
php
function renderAttachmentAttributionsField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'attachment_attributions', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'attachment_attributions', 'value' => ( isset( $this->options['attac...
[ "function", "renderAttachmentAttributionsField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderCheckbox", "(", "[", "'id'", "=>", "'attachment_attr...
Render the attachment_attributions checkbox. @since 5.5.0 @param array $args
[ "Render", "the", "attachment_attributions", "checkbox", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-globaloptions.php#L348-L359
pressbooks/pressbooks
inc/modules/themeoptions/class-globaloptions.php
GlobalOptions.renderLanguagesField
function renderLanguagesField( $args ) { unset( $args['label_for'], $args['class'] ); $foreign_languages = get_option( 'pressbooks_global_typography' ); if ( ! $foreign_languages ) { $foreign_languages = []; } $languages = Container::get( 'GlobalTypography' )->getSupportedLanguages(); $already_support...
php
function renderLanguagesField( $args ) { unset( $args['label_for'], $args['class'] ); $foreign_languages = get_option( 'pressbooks_global_typography' ); if ( ! $foreign_languages ) { $foreign_languages = []; } $languages = Container::get( 'GlobalTypography' )->getSupportedLanguages(); $already_support...
[ "function", "renderLanguagesField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "foreign_languages", "=", "get_option", "(", "'pressbooks_global_typography'", ")", ";",...
Render the pressbooks_global_typography select. @param array $args
[ "Render", "the", "pressbooks_global_typography", "select", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-globaloptions.php#L366-L410
pressbooks/pressbooks
inc/modules/themeoptions/class-globaloptions.php
GlobalOptions.renderCopyrightLicenseField
function renderCopyrightLicenseField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderRadioButtons( [ 'id' => 'copyright_license', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'copyright_license', 'value' => getset( $this->options, 'copyright_license',...
php
function renderCopyrightLicenseField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderRadioButtons( [ 'id' => 'copyright_license', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'copyright_license', 'value' => getset( $this->options, 'copyright_license',...
[ "function", "renderCopyrightLicenseField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderRadioButtons", "(", "[", "'id'", "=>", "'copyright_license...
Render the copyright_license checkbox. @param array $args
[ "Render", "the", "copyright_license", "checkbox", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-globaloptions.php#L417-L428
pressbooks/pressbooks
inc/modules/themeoptions/class-globaloptions.php
GlobalOptions.renderTextboxColorField
function renderTextboxColorField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderColorField( [ 'id' => $args['key'], 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => $args['key'], 'value' => ( isset( $this->options[ $args['key'] ] ) ) ? $this->options[ $a...
php
function renderTextboxColorField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderColorField( [ 'id' => $args['key'], 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => $args['key'], 'value' => ( isset( $this->options[ $args['key'] ] ) ) ? $this->options[ $a...
[ "function", "renderTextboxColorField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderColorField", "(", "[", "'id'", "=>", "$", "args", "[", "...
Render the header color inputs. @param array $args
[ "Render", "the", "header", "color", "inputs", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-globaloptions.php#L445-L457
pressbooks/pressbooks
inc/modules/themeoptions/class-globaloptions.php
GlobalOptions.renderPartLabelField
function renderPartLabelField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'part_label', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'part_label', 'value' => getset( $this->options, 'part_label' ), 'description' => $args[0], ...
php
function renderPartLabelField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'part_label', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'part_label', 'value' => getset( $this->options, 'part_label' ), 'description' => $args[0], ...
[ "function", "renderPartLabelField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'part_label'", ",", "'name'"...
Render the part_label input. @param array $args
[ "Render", "the", "part_label", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-globaloptions.php#L464-L477
pressbooks/pressbooks
inc/modules/themeoptions/class-globaloptions.php
GlobalOptions.renderChapterLabelField
function renderChapterLabelField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'chapter_label', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'chapter_label', 'value' => getset( $this->options, 'chapter_label' ), 'description' =>...
php
function renderChapterLabelField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'chapter_label', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'chapter_label', 'value' => getset( $this->options, 'chapter_label' ), 'description' =>...
[ "function", "renderChapterLabelField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'chapter_label'", ",", "'...
Render the chapter_label input. @param array $args
[ "Render", "the", "chapter_label", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-globaloptions.php#L484-L497
pressbooks/pressbooks
inc/modules/themeoptions/class-globaloptions.php
GlobalOptions.filterDefaults
static function filterDefaults( $defaults ) { // SASS => WP $overrides = [ 'examples-header-color' => 'edu_textbox_examples_header_color', 'examples-header-background' => 'edu_textbox_examples_header_background', 'examples-background' => 'edu_textbox_examples_background', 'exercises-header-color' => 'e...
php
static function filterDefaults( $defaults ) { // SASS => WP $overrides = [ 'examples-header-color' => 'edu_textbox_examples_header_color', 'examples-header-background' => 'edu_textbox_examples_header_background', 'examples-background' => 'edu_textbox_examples_background', 'exercises-header-color' => 'e...
[ "static", "function", "filterDefaults", "(", "$", "defaults", ")", "{", "// SASS => WP", "$", "overrides", "=", "[", "'examples-header-color'", "=>", "'edu_textbox_examples_header_color'", ",", "'examples-header-background'", "=>", "'edu_textbox_examples_header_background'", ...
Filter the array of default values for the Global options tab. @param array $defaults @return array $defaults
[ "Filter", "the", "array", "of", "default", "values", "for", "the", "Global", "options", "tab", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-globaloptions.php#L559-L608
pressbooks/pressbooks
symbionts/pressbooks-latex/pb-latex.php
PBLatex.shortCode
function shortCode( $_atts, $latex ) { $atts = shortcode_atts( array( 'size' => 0, 'color' => false, 'background' => false, ), $_atts ); $latex = preg_replace( array( '#<br\s*/?>#i', '#</?p>#i' ), ' ', $latex ); $latex = str_replace( array( '&lt;', '&gt;', '&quot;', '&#8220;', '&#8221;',...
php
function shortCode( $_atts, $latex ) { $atts = shortcode_atts( array( 'size' => 0, 'color' => false, 'background' => false, ), $_atts ); $latex = preg_replace( array( '#<br\s*/?>#i', '#</?p>#i' ), ' ', $latex ); $latex = str_replace( array( '&lt;', '&gt;', '&quot;', '&#8220;', '&#8221;',...
[ "function", "shortCode", "(", "$", "_atts", ",", "$", "latex", ")", "{", "$", "atts", "=", "shortcode_atts", "(", "array", "(", "'size'", "=>", "0", ",", "'color'", "=>", "false", ",", "'background'", "=>", "false", ",", ")", ",", "$", "_atts", ")", ...
Shortcode -> <img> markup. Creates images as necessary.
[ "Shortcode", "-", ">", "<img", ">", "markup", ".", "Creates", "images", "as", "necessary", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/symbionts/pressbooks-latex/pb-latex.php#L113-L134
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.setCurrentImportOption
function setCurrentImportOption( array $upload ) { try { $this->setCurrentZip( $upload['file'] ); } catch ( \Exception $e ) { return false; } $option = [ 'file' => $upload['file'], 'url' => $upload['url'] ?? null, 'file_type' => $upload['type'], 'type_of' => self::TYPE_OF, 'chapters' => [...
php
function setCurrentImportOption( array $upload ) { try { $this->setCurrentZip( $upload['file'] ); } catch ( \Exception $e ) { return false; } $option = [ 'file' => $upload['file'], 'url' => $upload['url'] ?? null, 'file_type' => $upload['type'], 'type_of' => self::TYPE_OF, 'chapters' => [...
[ "function", "setCurrentImportOption", "(", "array", "$", "upload", ")", "{", "try", "{", "$", "this", "->", "setCurrentZip", "(", "$", "upload", "[", "'file'", "]", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "return", "false", ...
@param array $upload @return bool
[ "@param", "array", "$upload" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L78-L133
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.importGenerator
function importGenerator( array $current_import ) : \Generator { yield 10 => __( 'Opening EPUB file', 'pressbooks' ); $this->setCurrentZip( $current_import['file'] ); $xml = $this->getOpf(); $match_ids = array_flip( array_keys( $current_import['chapters'] ) ); $chapter_parent = $this->getChapterParent(); ...
php
function importGenerator( array $current_import ) : \Generator { yield 10 => __( 'Opening EPUB file', 'pressbooks' ); $this->setCurrentZip( $current_import['file'] ); $xml = $this->getOpf(); $match_ids = array_flip( array_keys( $current_import['chapters'] ) ); $chapter_parent = $this->getChapterParent(); ...
[ "function", "importGenerator", "(", "array", "$", "current_import", ")", ":", "\\", "Generator", "{", "yield", "10", "=>", "__", "(", "'Opening EPUB file'", ",", "'pressbooks'", ")", ";", "$", "this", "->", "setCurrentZip", "(", "$", "current_import", "[", "...
@param array $current_import @throws \Exception @return \Generator
[ "@param", "array", "$current_import" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L158-L176
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.parseMetadata
protected function parseMetadata( \SimpleXMLElement $xml ) { foreach ( $xml->metadata->children( 'dc', true ) as $key => $val ) { $val = (string) $val; // Set authors if ( 'creator' === $key && ! empty( $val ) ) { $this->authors .= trim( $val ) . ', '; } elseif ( 'contributor' === $key && ! empty( ...
php
protected function parseMetadata( \SimpleXMLElement $xml ) { foreach ( $xml->metadata->children( 'dc', true ) as $key => $val ) { $val = (string) $val; // Set authors if ( 'creator' === $key && ! empty( $val ) ) { $this->authors .= trim( $val ) . ', '; } elseif ( 'contributor' === $key && ! empty( ...
[ "protected", "function", "parseMetadata", "(", "\\", "SimpleXMLElement", "$", "xml", ")", "{", "foreach", "(", "$", "xml", "->", "metadata", "->", "children", "(", "'dc'", ",", "true", ")", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "val", "=...
Parse OPF metadata nodes @param \SimpleXMLElement $xml
[ "Parse", "OPF", "metadata", "nodes" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L184-L200
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.parseManifestGenerator
protected function parseManifestGenerator( \SimpleXMLElement $xml, array $match_ids, $chapter_parent, $current_import ) : \Generator { $this->parseManifestToArray( $xml ); $selected_for_import = $this->selectedForImport( $xml, $match_ids ); $total = count( $selected_for_import ); $y = new PercentageYield( 40, 9...
php
protected function parseManifestGenerator( \SimpleXMLElement $xml, array $match_ids, $chapter_parent, $current_import ) : \Generator { $this->parseManifestToArray( $xml ); $selected_for_import = $this->selectedForImport( $xml, $match_ids ); $total = count( $selected_for_import ); $y = new PercentageYield( 40, 9...
[ "protected", "function", "parseManifestGenerator", "(", "\\", "SimpleXMLElement", "$", "xml", ",", "array", "$", "match_ids", ",", "$", "chapter_parent", ",", "$", "current_import", ")", ":", "\\", "Generator", "{", "$", "this", "->", "parseManifestToArray", "("...
Parse OPF manifest nodes Yields an estimated percentage slice of: 40 - 95 @param \SimpleXMLElement $xml @param array $match_ids @param $chapter_parent @param array $current_import @return \Generator
[ "Parse", "OPF", "manifest", "nodes", "Yields", "an", "estimated", "percentage", "slice", "of", ":", "40", "-", "95" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L214-L226
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.selectedForImport
protected function selectedForImport( \SimpleXMLElement $xml, array $match_ids ) { $selected_for_import = []; foreach ( $xml->spine->children() as $item ) { /** @var \SimpleXMLElement $item */ // Get attributes $id = ''; foreach ( $item->attributes() as $key => $val ) { if ( 'idref' === $key ) { ...
php
protected function selectedForImport( \SimpleXMLElement $xml, array $match_ids ) { $selected_for_import = []; foreach ( $xml->spine->children() as $item ) { /** @var \SimpleXMLElement $item */ // Get attributes $id = ''; foreach ( $item->attributes() as $key => $val ) { if ( 'idref' === $key ) { ...
[ "protected", "function", "selectedForImport", "(", "\\", "SimpleXMLElement", "$", "xml", ",", "array", "$", "match_ids", ")", "{", "$", "selected_for_import", "=", "[", "]", ";", "foreach", "(", "$", "xml", "->", "spine", "->", "children", "(", ")", "as", ...
Iterate each spine and get each manifest item in the order of spine @param \SimpleXMLElement $xml @param array $match_ids @return int[]
[ "Iterate", "each", "spine", "and", "get", "each", "manifest", "item", "in", "the", "order", "of", "spine" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L236-L267
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.getOpf
protected function getOpf() { $container_xml = $this->getZipContent( 'META-INF/container.xml' ); $content_path = $container_xml->rootfiles->rootfile['full-path']; $base = dirname( $content_path ); if ( '.' !== $base ) { $this->basedir = "$base/"; } return $this->getZipContent( $content_path ); }
php
protected function getOpf() { $container_xml = $this->getZipContent( 'META-INF/container.xml' ); $content_path = $container_xml->rootfiles->rootfile['full-path']; $base = dirname( $content_path ); if ( '.' !== $base ) { $this->basedir = "$base/"; } return $this->getZipContent( $content_path ); }
[ "protected", "function", "getOpf", "(", ")", "{", "$", "container_xml", "=", "$", "this", "->", "getZipContent", "(", "'META-INF/container.xml'", ")", ";", "$", "content_path", "=", "$", "container_xml", "->", "rootfiles", "->", "rootfile", "[", "'full-path'", ...
Return book.opf as a SimpleXML object @return \SimpleXMLElement
[ "Return", "book", ".", "opf", "as", "a", "SimpleXML", "object" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L275-L286
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.setCurrentZip
protected function setCurrentZip( $fullpath ) { $result = $this->zip->open( $fullpath ); if ( true !== $result ) { throw new \Exception( 'Opening epub file failed' ); } /* Safety dance */ $ok = $this->getZipContent( 'META-INF/container.xml' ); if ( ! $ok ) { throw new \Exception( 'Bad or corrupted ...
php
protected function setCurrentZip( $fullpath ) { $result = $this->zip->open( $fullpath ); if ( true !== $result ) { throw new \Exception( 'Opening epub file failed' ); } /* Safety dance */ $ok = $this->getZipContent( 'META-INF/container.xml' ); if ( ! $ok ) { throw new \Exception( 'Bad or corrupted ...
[ "protected", "function", "setCurrentZip", "(", "$", "fullpath", ")", "{", "$", "result", "=", "$", "this", "->", "zip", "->", "open", "(", "$", "fullpath", ")", ";", "if", "(", "true", "!==", "$", "result", ")", "{", "throw", "new", "\\", "Exception"...
Opens a new Epub for reading, writing or modifying @param string $fullpath @throws \Exception
[ "Opens", "a", "new", "Epub", "for", "reading", "writing", "or", "modifying" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L296-L310
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.getZipContent
protected function getZipContent( $file, $as_xml = true ) { // Locates an entry using its name $index = $this->zip->locateName( urldecode( $file ) ); if ( false === $index ) { return ''; } // returns the contents using its index $content = $this->zip->getFromIndex( $index ); // if it's not xml, ret...
php
protected function getZipContent( $file, $as_xml = true ) { // Locates an entry using its name $index = $this->zip->locateName( urldecode( $file ) ); if ( false === $index ) { return ''; } // returns the contents using its index $content = $this->zip->getFromIndex( $index ); // if it's not xml, ret...
[ "protected", "function", "getZipContent", "(", "$", "file", ",", "$", "as_xml", "=", "true", ")", "{", "// Locates an entry using its name", "$", "index", "=", "$", "this", "->", "zip", "->", "locateName", "(", "urldecode", "(", "$", "file", ")", ")", ";",...
Locates an entry using its name, returns the entry contents @param $file @param bool $as_xml @return string|\SimpleXMLElement
[ "Locates", "an", "entry", "using", "its", "name", "returns", "the", "entry", "contents" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L321-L340
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.kneadAndInsert
protected function kneadAndInsert( $href, $post_type, $chapter_parent, $post_status ) { $html = $this->getZipContent( $href, false ); $matches = []; preg_match( '/(?:<title[^>]*>)(.+)<\/title\s*>/isU', $html, $matches ); $title = ( ! empty( $matches[1] ) ? wp_strip_all_tags( $matches[1] ) : '__UNKNOWN__' ); ...
php
protected function kneadAndInsert( $href, $post_type, $chapter_parent, $post_status ) { $html = $this->getZipContent( $href, false ); $matches = []; preg_match( '/(?:<title[^>]*>)(.+)<\/title\s*>/isU', $html, $matches ); $title = ( ! empty( $matches[1] ) ? wp_strip_all_tags( $matches[1] ) : '__UNKNOWN__' ); ...
[ "protected", "function", "kneadAndInsert", "(", "$", "href", ",", "$", "post_type", ",", "$", "chapter_parent", ",", "$", "post_status", ")", "{", "$", "html", "=", "$", "this", "->", "getZipContent", "(", "$", "href", ",", "false", ")", ";", "$", "mat...
Pummel then insert HTML into our database @param string $href @param string $post_type @param int $chapter_parent @param string $post_status
[ "Pummel", "then", "insert", "HTML", "into", "our", "database" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L351-L380
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.kneadHtml
protected function kneadHtml( $html, $type, $href ) { $html5 = new HtmlParser(); $dom = $html5->loadHTML( $html ); // Download images, change to relative paths $dom = $this->scrapeAndKneadImages( $dom, $href ); // Deal with <a href="">, <a href=''>, and other mutations $dom = $this->kneadHref( $dom, $typ...
php
protected function kneadHtml( $html, $type, $href ) { $html5 = new HtmlParser(); $dom = $html5->loadHTML( $html ); // Download images, change to relative paths $dom = $this->scrapeAndKneadImages( $dom, $href ); // Deal with <a href="">, <a href=''>, and other mutations $dom = $this->kneadHref( $dom, $typ...
[ "protected", "function", "kneadHtml", "(", "$", "html", ",", "$", "type", ",", "$", "href", ")", "{", "$", "html5", "=", "new", "HtmlParser", "(", ")", ";", "$", "dom", "=", "$", "html5", "->", "loadHTML", "(", "$", "html", ")", ";", "// Download i...
Pummel the HTML into WordPress compatible dough. @param string $html @param string $type front-matter, part, chapter, back-matter, ... @param string $href original filename, with (relative) path @return string
[ "Pummel", "the", "HTML", "into", "WordPress", "compatible", "dough", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L413-L430
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.regexSearchReplace
protected function regexSearchReplace( $html ) { $result = $html; if ( true === $this->isPbEpub ) { // Remove PB created div id (on EPUB201 Export) that will generate a princexml error on re-export // @see createPartsAndChapters() in export/epub/class-pb-epub201.php $result = preg_replace( '/(?:<div class=...
php
protected function regexSearchReplace( $html ) { $result = $html; if ( true === $this->isPbEpub ) { // Remove PB created div id (on EPUB201 Export) that will generate a princexml error on re-export // @see createPartsAndChapters() in export/epub/class-pb-epub201.php $result = preg_replace( '/(?:<div class=...
[ "protected", "function", "regexSearchReplace", "(", "$", "html", ")", "{", "$", "result", "=", "$", "html", ";", "if", "(", "true", "===", "$", "this", "->", "isPbEpub", ")", "{", "// Remove PB created div id (on EPUB201 Export) that will generate a princexml error on...
Cleans imported html of unwanted tags @param string $html @return string
[ "Cleans", "imported", "html", "of", "unwanted", "tags" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L439-L456
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.pbCheck
protected function pbCheck( $copyright_file ) { $result = $this->getZipContent( $copyright_file ); foreach ( $result->body->div->div->p as $node ) { if ( strpos( $node->a['href'][0], 'pressbooks.com', 0 ) ) { $this->isPbEpub = true; } } // applies to PB generated EPUBs with PB_SECRET_SAUCE // @see...
php
protected function pbCheck( $copyright_file ) { $result = $this->getZipContent( $copyright_file ); foreach ( $result->body->div->div->p as $node ) { if ( strpos( $node->a['href'][0], 'pressbooks.com', 0 ) ) { $this->isPbEpub = true; } } // applies to PB generated EPUBs with PB_SECRET_SAUCE // @see...
[ "protected", "function", "pbCheck", "(", "$", "copyright_file", ")", "{", "$", "result", "=", "$", "this", "->", "getZipContent", "(", "$", "copyright_file", ")", ";", "foreach", "(", "$", "result", "->", "body", "->", "div", "->", "div", "->", "p", "a...
Is it an EPUB generated by PB? @param string $copyright_file @return boolean @see createCopyright() in /export/epub/class-pb-epub201.php
[ "Is", "it", "an", "EPUB", "generated", "by", "PB?" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L467-L481
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.fetchAndSaveUniqueImage
protected function fetchAndSaveUniqueImage( $url, $href ) { $path_parts = pathinfo( $href ); $dir = ( isset( $path_parts['dirname'] ) ) ? $path_parts['dirname'] : ''; $img_location = ( $dir ? "$dir/$url" : $url ); // Cheap cache static $already_done = []; if ( isset( $already_done[ $img_location ] ) ) { ...
php
protected function fetchAndSaveUniqueImage( $url, $href ) { $path_parts = pathinfo( $href ); $dir = ( isset( $path_parts['dirname'] ) ) ? $path_parts['dirname'] : ''; $img_location = ( $dir ? "$dir/$url" : $url ); // Cheap cache static $already_done = []; if ( isset( $already_done[ $img_location ] ) ) { ...
[ "protected", "function", "fetchAndSaveUniqueImage", "(", "$", "url", ",", "$", "href", ")", "{", "$", "path_parts", "=", "pathinfo", "(", "$", "href", ")", ";", "$", "dir", "=", "(", "isset", "(", "$", "path_parts", "[", "'dirname'", "]", ")", ")", "...
Extract url from zip and load into WP using media_handle_sideload() Will return an empty string if something went wrong. @param $url string @param string $href original filename, with (relative) path @see media_handle_sideload @return string filename
[ "Extract", "url", "from", "zip", "and", "load", "into", "WP", "using", "media_handle_sideload", "()", "Will", "return", "an", "empty", "string", "if", "something", "went", "wrong", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L524-L597
pressbooks/pressbooks
inc/modules/import/epub/class-epub201.php
Epub201.parseManifestToArray
protected function parseManifestToArray( \SimpleXMLElement $xml ) { foreach ( $xml->manifest->children() as $item ) { /** @var \SimpleXMLElement $item */ // Get attributes $id = ''; $type = ''; $href = ''; foreach ( $item->attributes() as $key => $val ) { if ( 'id' === $key ) { $id = (stri...
php
protected function parseManifestToArray( \SimpleXMLElement $xml ) { foreach ( $xml->manifest->children() as $item ) { /** @var \SimpleXMLElement $item */ // Get attributes $id = ''; $type = ''; $href = ''; foreach ( $item->attributes() as $key => $val ) { if ( 'id' === $key ) { $id = (stri...
[ "protected", "function", "parseManifestToArray", "(", "\\", "SimpleXMLElement", "$", "xml", ")", "{", "foreach", "(", "$", "xml", "->", "manifest", "->", "children", "(", ")", "as", "$", "item", ")", "{", "/** @var \\SimpleXMLElement $item */", "// Get attributes"...
Parse manifest with type 'application/xhtml+xml' to array @param \SimpleXMLElement $xml
[ "Parse", "manifest", "with", "type", "application", "/", "xhtml", "+", "xml", "to", "array" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/import/epub/class-epub201.php#L622-L651
pressbooks/pressbooks
inc/utility/class-percentageyield.php
PercentageYield.tick
public function tick( $msg, $emit = true ) : \Generator { $percentage = $this->j; if ( $percentage < $this->start ) { $percentage = $this->start; } elseif ( $percentage > $this->end ) { $percentage = $this->end; } $msg = trim( $msg ) . sprintf( __( ' (%1$d of %2$d)', 'pressbooks' ), $this->i, $this->tot...
php
public function tick( $msg, $emit = true ) : \Generator { $percentage = $this->j; if ( $percentage < $this->start ) { $percentage = $this->start; } elseif ( $percentage > $this->end ) { $percentage = $this->end; } $msg = trim( $msg ) . sprintf( __( ' (%1$d of %2$d)', 'pressbooks' ), $this->i, $this->tot...
[ "public", "function", "tick", "(", "$", "msg", ",", "$", "emit", "=", "true", ")", ":", "\\", "Generator", "{", "$", "percentage", "=", "$", "this", "->", "j", ";", "if", "(", "$", "percentage", "<", "$", "this", "->", "start", ")", "{", "$", "...
Automatically append something like (3 of 20) to $msg when yielding [$percentage => $msg] Automatically do calculations @param string $msg @param bool $emit (optional, default is true) @return \Generator
[ "Automatically", "append", "something", "like", "(", "3", "of", "20", ")", "to", "$msg", "when", "yielding", "[", "$percentage", "=", ">", "$msg", "]", "Automatically", "do", "calculations" ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/utility/class-percentageyield.php#L84-L99
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.init
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, '...
php
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, '...
[ "function", "init", "(", ")", "{", "$", "_option", "=", "'pressbooks_theme_options_'", ".", "$", "this", "->", "getSlug", "(", ")", ";", "$", "_page", "=", "$", "_option", ";", "$", "_section", "=", "$", "this", "->", "getSlug", "(", ")", ".", "'_opt...
Configure the PDF options tab using the settings API.
[ "Configure", "the", "PDF", "options", "tab", "using", "the", "settings", "API", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L61-L552
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.doInitialUpgrade
function doInitialUpgrade() { $_option = $this->getSlug(); $options = get_option( 'pressbooks_theme_options_' . $_option, $this->defaults ); // Replace pdf_page_size with pdf_page_width and pdf_page_height if ( isset( $options['pdf_page_size'] ) ) { switch ( $options['pdf_page_size'] ) { case 1: $o...
php
function doInitialUpgrade() { $_option = $this->getSlug(); $options = get_option( 'pressbooks_theme_options_' . $_option, $this->defaults ); // Replace pdf_page_size with pdf_page_width and pdf_page_height if ( isset( $options['pdf_page_size'] ) ) { switch ( $options['pdf_page_size'] ) { case 1: $o...
[ "function", "doInitialUpgrade", "(", ")", "{", "$", "_option", "=", "$", "this", "->", "getSlug", "(", ")", ";", "$", "options", "=", "get_option", "(", "'pressbooks_theme_options_'", ".", "$", "_option", ",", "$", "this", "->", "defaults", ")", ";", "//...
Substitute human-readable values, add new defaults, replace pdf_page_size with pdf_page_width and pdf_page_height.
[ "Substitute", "human", "-", "readable", "values", "add", "new", "defaults", "replace", "pdf_page_size", "with", "pdf_page_width", "and", "pdf_page_height", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L584-L661
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.upgradeSectionOpenings
function upgradeSectionOpenings() { $_option = $this->getSlug(); $options = get_option( 'pressbooks_theme_options_' . $_option, $this->defaults ); // Get more specific if ( ! isset( $options['pdf_blankpages'] ) || 1 === absint( $options['pdf_blankpages'] ) || 'include' === $options['pdf_blankpages'] ) { $op...
php
function upgradeSectionOpenings() { $_option = $this->getSlug(); $options = get_option( 'pressbooks_theme_options_' . $_option, $this->defaults ); // Get more specific if ( ! isset( $options['pdf_blankpages'] ) || 1 === absint( $options['pdf_blankpages'] ) || 'include' === $options['pdf_blankpages'] ) { $op...
[ "function", "upgradeSectionOpenings", "(", ")", "{", "$", "_option", "=", "$", "this", "->", "getSlug", "(", ")", ";", "$", "options", "=", "get_option", "(", "'pressbooks_theme_options_'", ".", "$", "_option", ",", "$", "this", "->", "defaults", ")", ";",...
Replace pdf_blankpages option with pdf_sectionopenings option.
[ "Replace", "pdf_blankpages", "option", "with", "pdf_sectionopenings", "option", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L666-L679
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderBodyFontSizeField
function renderBodyFontSizeField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_body_font_size', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_body_font_size', 'value' => ( isset( $this->options['pdf_body_font_size'] ) ) ? $...
php
function renderBodyFontSizeField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_body_font_size', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_body_font_size', 'value' => ( isset( $this->options['pdf_body_font_size'] ) ) ? $...
[ "function", "renderBodyFontSizeField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'pdf_body_font_size'", ",",...
Render the pdf_body_font_size input. @param array $args
[ "Render", "the", "pdf_body_font_size", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L686-L700
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderBodyLineHightField
function renderBodyLineHightField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_body_line_height', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_body_line_height', 'value' => ( isset( $this->options['pdf_body_line_height'] ...
php
function renderBodyLineHightField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_body_line_height', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_body_line_height', 'value' => ( isset( $this->options['pdf_body_line_height'] ...
[ "function", "renderBodyLineHightField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'pdf_body_line_height'", "...
Render the pdf_body_line_height input. @param array $args
[ "Render", "the", "pdf_body_line_height", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L707-L721
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderPageSizeField
function renderPageSizeField( $args ) { unset( $args['label_for'], $args['class'] ); if ( ! isset( $this->options['pdf_page_size'] ) ) { if ( isset( $this->options['pdf_page_width'] ) && isset( $this->options['pdf_page_height'] ) ) { if ( '5.5in' === $this->options['pdf_page_width'] && '8.5in' === $this->opt...
php
function renderPageSizeField( $args ) { unset( $args['label_for'], $args['class'] ); if ( ! isset( $this->options['pdf_page_size'] ) ) { if ( isset( $this->options['pdf_page_width'] ) && isset( $this->options['pdf_page_height'] ) ) { if ( '5.5in' === $this->options['pdf_page_width'] && '8.5in' === $this->opt...
[ "function", "renderPageSizeField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "options", "[", "'pdf_page_size'", "]...
Render the pdf_page_size select. @param array $args
[ "Render", "the", "pdf_page_size", "select", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L728-L764
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderPageWidthField
function renderPageWidthField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_width', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_width', 'value' => getset( $this->options, 'pdf_page_width' ), 'description' =>...
php
function renderPageWidthField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_width', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_width', 'value' => getset( $this->options, 'pdf_page_width' ), 'description' =>...
[ "function", "renderPageWidthField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'pdf_page_width'", ",", "'na...
Render the pdf_page_width input. @param array $args
[ "Render", "the", "pdf_page_width", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L771-L784
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderPageHeightField
function renderPageHeightField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_height', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_height', 'value' => getset( $this->options, 'pdf_page_height' ), 'description...
php
function renderPageHeightField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_height', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_height', 'value' => getset( $this->options, 'pdf_page_height' ), 'description...
[ "function", "renderPageHeightField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'pdf_page_height'", ",", "'...
Render the pdf_page_height input. @param array $args
[ "Render", "the", "pdf_page_height", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L791-L804
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderMarginsField
function renderMarginsField( $args ) { unset( $args['label_for'], $args['class'] ); ?> <div class="margin-diagram"> <p class="description"><?php echo $args[0]; ?></p> <div class="pages"> <div class="page left"> <div class="margin outside"></div> <div class="margin top"></div> <div class="...
php
function renderMarginsField( $args ) { unset( $args['label_for'], $args['class'] ); ?> <div class="margin-diagram"> <p class="description"><?php echo $args[0]; ?></p> <div class="pages"> <div class="page left"> <div class="margin outside"></div> <div class="margin top"></div> <div class="...
[ "function", "renderMarginsField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "?>\n\t\t<div class=\"margin-diagram\">\n\t\t\t<p class=\"description\"><?php", "echo", "$", "args", ...
Render the margins diagram. @param array $args
[ "Render", "the", "margins", "diagram", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L811-L843
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderOutsideMarginField
function renderOutsideMarginField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_margin_outside', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_margin_outside', 'value' => getset( $this->options, 'pdf_page_margin_o...
php
function renderOutsideMarginField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_margin_outside', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_margin_outside', 'value' => getset( $this->options, 'pdf_page_margin_o...
[ "function", "renderOutsideMarginField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'pdf_page_margin_outside'", ...
Render the pdf_page_margin_outside input. @param array $args
[ "Render", "the", "pdf_page_margin_outside", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L850-L863
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderInsideMarginField
function renderInsideMarginField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_margin_inside', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_margin_inside', 'value' => getset( $this->options, 'pdf_page_margin_insi...
php
function renderInsideMarginField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_margin_inside', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_margin_inside', 'value' => getset( $this->options, 'pdf_page_margin_insi...
[ "function", "renderInsideMarginField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'pdf_page_margin_inside'", ...
Render the pdf_page_margin_inside input. @param array $args
[ "Render", "the", "pdf_page_margin_inside", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L870-L883
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderTopMarginField
function renderTopMarginField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_margin_top', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_margin_top', 'value' => getset( $this->options, 'pdf_page_margin_top' ), '...
php
function renderTopMarginField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_margin_top', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_margin_top', 'value' => getset( $this->options, 'pdf_page_margin_top' ), '...
[ "function", "renderTopMarginField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'pdf_page_margin_top'", ",", ...
Render the pdf_page_margin_top input. @param array $args
[ "Render", "the", "pdf_page_margin_top", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L890-L903
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderBottomMarginField
function renderBottomMarginField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_margin_bottom', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_margin_bottom', 'value' => getset( $this->options, 'pdf_page_margin_bott...
php
function renderBottomMarginField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'pdf_page_margin_bottom', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_page_margin_bottom', 'value' => getset( $this->options, 'pdf_page_margin_bott...
[ "function", "renderBottomMarginField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'pdf_page_margin_bottom'", ...
Render the pdf_page_margin_bottom input. @param array $args
[ "Render", "the", "pdf_page_margin_bottom", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L910-L923
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderHyphenationField
function renderHyphenationField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'pdf_hyphens', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_hyphens', 'value' => getset( $this->options, 'pdf_hyphens' ), 'label' => $args[0],...
php
function renderHyphenationField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'pdf_hyphens', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_hyphens', 'value' => getset( $this->options, 'pdf_hyphens' ), 'label' => $args[0],...
[ "function", "renderHyphenationField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderCheckbox", "(", "[", "'id'", "=>", "'pdf_hyphens'", ",", "'...
Render the pdf_hyphens checkbox. @param array $args
[ "Render", "the", "pdf_hyphens", "checkbox", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L930-L941
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderParagraphSeparationField
function renderParagraphSeparationField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderRadioButtons( [ 'id' => 'pdf_paragraph_separation', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_paragraph_separation', 'value' => getset( $this->options, 'pd...
php
function renderParagraphSeparationField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderRadioButtons( [ 'id' => 'pdf_paragraph_separation', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_paragraph_separation', 'value' => getset( $this->options, 'pd...
[ "function", "renderParagraphSeparationField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderRadioButtons", "(", "[", "'id'", "=>", "'pdf_paragraph_...
Render the pdf_paragraph_separation radio buttons. @param array $args
[ "Render", "the", "pdf_paragraph_separation", "radio", "buttons", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L948-L959
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderSectionOpeningsField
function renderSectionOpeningsField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderRadioButtons( [ 'id' => 'pdf_sectionopenings', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_sectionopenings', 'value' => getset( $this->options, 'pdf_sectionopeni...
php
function renderSectionOpeningsField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderRadioButtons( [ 'id' => 'pdf_sectionopenings', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_sectionopenings', 'value' => getset( $this->options, 'pdf_sectionopeni...
[ "function", "renderSectionOpeningsField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderRadioButtons", "(", "[", "'id'", "=>", "'pdf_sectionopening...
Render the pdf_sectionopenings radio buttons. @param array $args
[ "Render", "the", "pdf_sectionopenings", "radio", "buttons", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L966-L977
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderTOCField
function renderTOCField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'pdf_toc', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_toc', 'value' => getset( $this->options, 'pdf_toc' ), 'label' => $args[0], ] ); }
php
function renderTOCField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'pdf_toc', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_toc', 'value' => getset( $this->options, 'pdf_toc' ), 'label' => $args[0], ] ); }
[ "function", "renderTOCField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderCheckbox", "(", "[", "'id'", "=>", "'pdf_toc'", ",", "'name'", "=...
Render the pdf_toc checkbox. @param array $args
[ "Render", "the", "pdf_toc", "checkbox", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L984-L995
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderCropMarksField
function renderCropMarksField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'pdf_crop_marks', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_crop_marks', 'value' => getset( $this->options, 'pdf_crop_marks' ), 'label' => $a...
php
function renderCropMarksField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'pdf_crop_marks', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_crop_marks', 'value' => getset( $this->options, 'pdf_crop_marks' ), 'label' => $a...
[ "function", "renderCropMarksField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderCheckbox", "(", "[", "'id'", "=>", "'pdf_crop_marks'", ",", "...
Render the pdf_crop_marks checkbox. @param array $args
[ "Render", "the", "pdf_crop_marks", "checkbox", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L1002-L1013
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderRomanizePartsField
function renderRomanizePartsField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'pdf_romanize_parts', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_romanize_parts', 'value' => getset( $this->options, 'pdf_romanize_parts' ), ...
php
function renderRomanizePartsField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCheckbox( [ 'id' => 'pdf_romanize_parts', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_romanize_parts', 'value' => getset( $this->options, 'pdf_romanize_parts' ), ...
[ "function", "renderRomanizePartsField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderCheckbox", "(", "[", "'id'", "=>", "'pdf_romanize_parts'", ...
Render the pdf_romanize_parts checkbox. @param array $args
[ "Render", "the", "pdf_romanize_parts", "checkbox", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L1020-L1031
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderFootnoteStyleField
function renderFootnoteStyleField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderRadioButtons( [ 'id' => 'pdf_footnotes_style', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_footnotes_style', 'value' => getset( $this->options, 'pdf_footnotes_styl...
php
function renderFootnoteStyleField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderRadioButtons( [ 'id' => 'pdf_footnotes_style', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'pdf_footnotes_style', 'value' => getset( $this->options, 'pdf_footnotes_styl...
[ "function", "renderFootnoteStyleField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderRadioButtons", "(", "[", "'id'", "=>", "'pdf_footnotes_style'...
Render the pdf_footnotes_style radio buttons. @param array $args
[ "Render", "the", "pdf_footnotes_style", "radio", "buttons", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L1038-L1049
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderWidowsField
function renderWidowsField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'widows', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'widows', 'value' => getset( $this->options, 'widows' ), 'type' => 'text', 'class' => 'small-tex...
php
function renderWidowsField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'widows', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'widows', 'value' => getset( $this->options, 'widows' ), 'type' => 'text', 'class' => 'small-tex...
[ "function", "renderWidowsField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'widows'", ",", "'name'", "=>...
Render the widows input. @param array $args
[ "Render", "the", "widows", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L1056-L1068
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderOrphansField
function renderOrphansField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'orphans', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'orphans', 'value' => getset( $this->options, 'orphans' ), 'type' => 'text', 'class' => 'small...
php
function renderOrphansField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderField( [ 'id' => 'orphans', 'name' => 'pressbooks_theme_options_' . $this->getSlug(), 'option' => 'orphans', 'value' => getset( $this->options, 'orphans' ), 'type' => 'text', 'class' => 'small...
[ "function", "renderOrphansField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderField", "(", "[", "'id'", "=>", "'orphans'", ",", "'name'", "...
Render the orphans input. @param array $args
[ "Render", "the", "orphans", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L1075-L1087
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderRunningContentFrontMatterLeftField
function renderRunningContentFrontMatterLeftField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCustomSelect( [ 'id' => 'running_content_front_matter_left', 'name' => 'running_content_front_matter_left', 'value' => getset( $this->options, 'running_content_front_matter_left' ), ...
php
function renderRunningContentFrontMatterLeftField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCustomSelect( [ 'id' => 'running_content_front_matter_left', 'name' => 'running_content_front_matter_left', 'value' => getset( $this->options, 'running_content_front_matter_left' ), ...
[ "function", "renderRunningContentFrontMatterLeftField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderCustomSelect", "(", "[", "'id'", "=>", "'runn...
Render the running_content_front_matter_left input. @param array $args
[ "Render", "the", "running_content_front_matter_left", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L1106-L1126
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderRunningContentFrontMatterRightField
function renderRunningContentFrontMatterRightField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCustomSelect( [ 'id' => 'running_content_front_matter_right', 'name' => 'running_content_front_matter_right', 'value' => getset( $this->options, 'running_content_front_matter_right'...
php
function renderRunningContentFrontMatterRightField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCustomSelect( [ 'id' => 'running_content_front_matter_right', 'name' => 'running_content_front_matter_right', 'value' => getset( $this->options, 'running_content_front_matter_right'...
[ "function", "renderRunningContentFrontMatterRightField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderCustomSelect", "(", "[", "'id'", "=>", "'run...
Render the running_content_front_matter_right input. @param array $args
[ "Render", "the", "running_content_front_matter_right", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L1133-L1153
pressbooks/pressbooks
inc/modules/themeoptions/class-pdfoptions.php
PDFOptions.renderRunningContentIntroductionLeftField
function renderRunningContentIntroductionLeftField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCustomSelect( [ 'id' => 'running_content_introduction_left', 'name' => 'running_content_introduction_left', 'value' => getset( $this->options, 'running_content_introduction_left' ),...
php
function renderRunningContentIntroductionLeftField( $args ) { unset( $args['label_for'], $args['class'] ); $this->renderCustomSelect( [ 'id' => 'running_content_introduction_left', 'name' => 'running_content_introduction_left', 'value' => getset( $this->options, 'running_content_introduction_left' ),...
[ "function", "renderRunningContentIntroductionLeftField", "(", "$", "args", ")", "{", "unset", "(", "$", "args", "[", "'label_for'", "]", ",", "$", "args", "[", "'class'", "]", ")", ";", "$", "this", "->", "renderCustomSelect", "(", "[", "'id'", "=>", "'run...
Render the running_content_introduction_left input. @param array $args
[ "Render", "the", "running_content_introduction_left", "input", "." ]
train
https://github.com/pressbooks/pressbooks/blob/1a2294414a3abb7b97c5b669cee72470a8fb5806/inc/modules/themeoptions/class-pdfoptions.php#L1160-L1180