Skip to main content

Site Converter — functions

8 public functions. 0 are 🔌 pluggable (function_exists()-guarded, so a theme/child can override them).

FunctionSummary
sc_clean_screenshot_b64Sanitize a posted screenshot data string into a clean, verified base64 PNG payload (no data: prefix), or '' when it isn't a real PNG. Strips any data:image/...;base64, prefix + whitespace, then validates strict base64 that decodes to PNG-magic bytes. Used by the URL-conversion flow to carry the capture service's screenshot.png into the generated theme. Returns the RAW base64 string (the theme generator decodes it when writing screenshot.png).
sc_cs_bgA non-transparent background-color value from a data-sc-cs string, or '' (transparent / absent).
sc_cssRead a single CSS property value from an element's captured data-sc-cs computed-style attribute. '' if absent.
sc_hifi_optRead the "High-fidelity CSS" convert option from the posted request. The Convert panel's checkbox posts fw_sc_hifi (=1 when checked, absent when unchecked) alongside a hidden fw_sc_hifi_present that always posts, so an ABSENT fw_sc_hifi with the present-flag = the user unchecked it (→ false); a request with NEITHER field (a programmatic / back-compat caller) defaults ON. The service/URL flow posts fw_sc_hifi explicitly as '1'/'0'. DEFAULT ON — parity with build_bundle's own default.
sc_int_listParse a comma/space list of non-negative ints ("0, 2 3" → [0,2,3]). Empty → [].
sc_menu_cssCSS for the dynamic header menu (wp_nav_menu with class .sc-menu), derived from the source nav's CAPTURED computed look (color, size, weight, spacing, dropdown) so the live WordPress menu matches the source. Hover/active uses the brand accent (computed hover isn't readable at capture). Framework-agnostic — no Bootstrap/Tailwind classes involved.
sc_padRead a padding side ('top'|'bottom') from an element's computed style, handling BOTH the padding-top longhand AND the padding shorthand (padding:T R B L / T V / T RL B — the capture often emits the shorthand, e.g. the golden fixture footer padding:64px 0px 32px). Returns the length string or ''.
sc_wc_optRead the Convert panel's "Map to WooCommerce" option. The mapper only emits WooCommerce shortcodes (a live [wc_products] feed for a detected product grid) when this returns true — which requires BOTH WooCommerce to be ACTIVE on this site (there is nothing to map to otherwise) AND the checkbox ticked (posted as opt_woocommerce '1'/'0'). Default OFF, so a non-store conversion is never altered.

sc_clean_screenshot_b64

sc_clean_screenshot_b64( $raw )

Sanitize a posted screenshot data string into a clean, verified base64 PNG payload (no data: prefix), or '' when it isn't a real PNG. Strips any data:image/...;base64, prefix + whitespace, then validates strict base64 that decodes to PNG-magic bytes. Used by the URL-conversion flow to carry the capture service's screenshot.png into the generated theme. Returns the RAW base64 string (the theme generator decodes it when writing screenshot.png).

ParameterTypeDescription
$rawmixedposted value ($_POST['fw_sc_screenshot_b64'])

Returns string clean base64, or ''

Source: framework/extensions/site-converter/class-fw-extension-site-converter.php:1962

sc_cs_bg

sc_cs_bg( $cs )

A non-transparent background-color value from a data-sc-cs string, or '' (transparent / absent).

Source: framework/extensions/site-converter/includes/class-fw-site-converter-stitch.php:5526

sc_css

sc_css( $el, $prop )

Read a single CSS property value from an element's captured data-sc-cs computed-style attribute. '' if absent.

Source: framework/extensions/site-converter/includes/class-fw-site-converter-stitch.php:4170

sc_hifi_opt

sc_hifi_opt()

Read the "High-fidelity CSS" convert option from the posted request. The Convert panel's checkbox posts fw_sc_hifi (=1 when checked, absent when unchecked) alongside a hidden fw_sc_hifi_present that always posts, so an ABSENT fw_sc_hifi with the present-flag = the user unchecked it (→ false); a request with NEITHER field (a programmatic / back-compat caller) defaults ON. The service/URL flow posts fw_sc_hifi explicitly as '1'/'0'. DEFAULT ON — parity with build_bundle's own default.

Returns bool whether the hi-fi faithful base is requested.

Source: framework/extensions/site-converter/class-fw-extension-site-converter.php:1932

sc_int_list

sc_int_list( $raw )

Parse a comma/space list of non-negative ints ("0, 2 3" → [0,2,3]). Empty → [].

Source: framework/extensions/site-converter/class-fw-extension-site-converter.php:1915

sc_menu_css

sc_menu_css( array $cfg )

CSS for the dynamic header menu (wp_nav_menu with class .sc-menu), derived from the source nav's CAPTURED computed look (color, size, weight, spacing, dropdown) so the live WordPress menu matches the source. Hover/active uses the brand accent (computed hover isn't readable at capture). Framework-agnostic — no Bootstrap/Tailwind classes involved.

Source: framework/extensions/site-converter/includes/class-fw-site-converter-theme-generator.php:2201

sc_pad

sc_pad( $el, $side )

Read a padding side ('top'|'bottom') from an element's computed style, handling BOTH the padding-top longhand AND the padding shorthand (padding:T R B L / T V / T RL B — the capture often emits the shorthand, e.g. the golden fixture footer padding:64px 0px 32px). Returns the length string or ''.

Source: framework/extensions/site-converter/includes/class-fw-site-converter-stitch.php:5681

sc_wc_opt

sc_wc_opt()

Read the Convert panel's "Map to WooCommerce" option. The mapper only emits WooCommerce shortcodes (a live [wc_products] feed for a detected product grid) when this returns true — which requires BOTH WooCommerce to be ACTIVE on this site (there is nothing to map to otherwise) AND the checkbox ticked (posted as opt_woocommerce '1'/'0'). Default OFF, so a non-store conversion is never altered.

Returns bool

Source: framework/extensions/site-converter/class-fw-extension-site-converter.php:1947

← Back to Functions overview