/www/folly_690/public/wp-content/plugins/shortpixel-adaptive-images/includes/libs/minify/src/JS.php
* Note: Most operators are fine, we've only removed ), ], ++, --, ! and ~.
* There can't be a newline separating ! or ~ and whatever it is negating.
* ++ & -- have to be joined with the value they're in-/decrementing.
* ) & ] are "special" in that they have lots or usecases. () for example
* is used for function calls, for grouping, in if () and for (), ...
*
* Will be loaded from /data/js/operators_after.txt
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
*
* @var string[]
*/
protected $operatorsAfter = array();
/**
* {@inheritdoc}
*/
public function __construct()
{
call_user_func_array(array('parent', '__construct'), func_get_args());
$dataDir = __DIR__.'/../data/js/';
$options = FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES;
$this->keywordsReserved = file($dataDir.'keywords_reserved.txt', $options);
$this->keywordsBefore = file($dataDir.'keywords_before.txt', $options);
$this->keywordsAfter = file($dataDir.'keywords_after.txt', $options);
$this->operators = file($dataDir.'operators.txt', $options);
$this->operatorsBefore = file($dataDir.'operators_before.txt', $options);
$this->operatorsAfter = file($dataDir.'operators_after.txt', $options);
}
/**
* Minify the data.
* Perform JS optimizations.
*
* @param string[optional] $path Path to write the data to
*
* @return string The minified data
*/
public function execute($path = null)
/www/folly_690/public/wp-content/plugins/shortpixel-adaptive-images/includes/libs/minify/src/JS.php
* Note: Most operators are fine, we've only removed ), ], ++, --, ! and ~.
* There can't be a newline separating ! or ~ and whatever it is negating.
* ++ & -- have to be joined with the value they're in-/decrementing.
* ) & ] are "special" in that they have lots or usecases. () for example
* is used for function calls, for grouping, in if () and for (), ...
*
* Will be loaded from /data/js/operators_after.txt
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
*
* @var string[]
*/
protected $operatorsAfter = array();
/**
* {@inheritdoc}
*/
public function __construct()
{
call_user_func_array(array('parent', '__construct'), func_get_args());
$dataDir = __DIR__.'/../data/js/';
$options = FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES;
$this->keywordsReserved = file($dataDir.'keywords_reserved.txt', $options);
$this->keywordsBefore = file($dataDir.'keywords_before.txt', $options);
$this->keywordsAfter = file($dataDir.'keywords_after.txt', $options);
$this->operators = file($dataDir.'operators.txt', $options);
$this->operatorsBefore = file($dataDir.'operators_before.txt', $options);
$this->operatorsAfter = file($dataDir.'operators_after.txt', $options);
}
/**
* Minify the data.
* Perform JS optimizations.
*
* @param string[optional] $path Path to write the data to
*
* @return string The minified data
*/
public function execute($path = null)
/www/folly_690/public/wp-content/plugins/shortpixel-adaptive-images/includes/controllers/js-parser.class.php
use MatthiasMullie\Minify;
class ShortPixelJsParser {
protected $ctrl;
protected $lazy;
private $logger;
public function __construct(ShortPixelAI $ctrl, $lazy = false ) {
$this->ctrl = $ctrl;
$this->lazy = $lazy === false ? !!$ctrl->settings->areas->parse_js_lazy : $lazy;
$this->logger = ShortPixelAILogger::instance();
}
public function parse( $script ) {
if ( preg_match( '/(\<script[^>]*\>)(.*)(<\/script>)/sU', $script, $matches ) ) {
if ( !empty( $matches[ 2 ] ) ) {
//TODO ditch minifier and just remove comments
$minifier = new Minify\JS( $matches[ 2 ] );
$minified_js = $minifier->minify();
$replacedUrls = $this->replaceUrls( $minified_js );
$this->logger->log( 'JS Parser [ After minify and replace (script with tag) ]: ' . $replacedUrls );
return $matches[1] . $replacedUrls . '</script>';
}
}
// if just JS content has been provided
else {
$this->logger->log( 'JS Parser [ Before minify (script content) ] ' );
//TODO ditch minifier and just remove comments
$minifier = new Minify\JS( $script );
$minified_js = $minifier->minify();
$this->logger->log( 'JS Parser [ Before replace (script content) ]: ' );
$replacedUrls = $this->replaceUrls( $minified_js );
$this->logger->log( 'JS Parser [ After minify and replace (script content) ]: ' . $replacedUrls );
/www/folly_690/public/wp-content/plugins/shortpixel-adaptive-images/includes/controllers/regex-parser.class.php
);
}
else if ( $this->ctrl->settings->areas->parse_js ) {
if ( strpos( $script, '__sp_cdata_plAc3h0ldR_' ) ) {
(SHORTPIXEL_AI_DEBUG & ShortPixelAILogger::DEBUG_AREA_JSON) && $this->logger->log("IS JS CDATA PLACEHOLDER.", $script);
$script = preg_replace_callback( '/__sp_cdata_plAc3h0ldR_([0-9]+)/s',
array( $this, 'replace_cdata_js' ),
$script
);
}
else {
$script = trim($script);
$openingTagEnd = strpos($script, '>') + 1;
$openingTag = substr($script, 0, $openingTagEnd);
if(preg_match('/\btype=["\'](application|text)\/javascript/', $openingTag) || !preg_match('/\btype=/', $openingTag))
{ // either it's type text/javascript or type not defined. Outstanding example that should not be parsed as JS: type=text/template (HS#51163)
(SHORTPIXEL_AI_DEBUG & ShortPixelAILogger::DEBUG_AREA_JSON) && $this->logger->log("IS app/text JS: ", $script);
$jsParser = new ShortPixelJsParser( $this->ctrl );
$parsed_script = $jsParser->parse( $script );
$script = empty( $parsed_script ) ? $script : $parsed_script;
}
else if(preg_match('/\btype=["\']text\/template/', $openingTag)) {
(SHORTPIXEL_AI_DEBUG & ShortPixelAILogger::DEBUG_AREA_JSON) && $this->logger->log("IS TEXT/TEMPLATE: ", $script);
$endTagStart = strrpos($script, "</script");
if($endTagStart > $openingTagEnd) {
$tpl = trim(substr($script, $openingTagEnd, $endTagStart - $openingTagEnd));
(SHORTPIXEL_AI_DEBUG & ShortPixelAILogger::DEBUG_AREA_JSON) && $this->logger->log("ZE TEMPLATE: " . $tpl);
$parser = new ShortPixelRegexParser($this->ctrl);
$tplDec = json_decode($tpl);
if($tplDec === NULL) {
//IF the template is not a json, in most cases it's html_entity_encoded, so we decode it.
$isEncoded = preg_match('/^\s*</', $tpl);
$tpl = $isEncoded ? html_entity_decode($tpl) : $tpl;
(SHORTPIXEL_AI_DEBUG & ShortPixelAILogger::DEBUG_AREA_JSON) && $this->logger->log("DECODED TEMPLATE: " . $tpl);
$parsed_script = $parser->parse($tpl);
(SHORTPIXEL_AI_DEBUG & ShortPixelAILogger::DEBUG_AREA_JSON) && $this->logger->log("PARSED TEMPLATE: " . $parsed_script);
$parsed_script = $isEncoded ? htmlentities($parsed_script) : $parsed_script;
} elseif(is_array($tplDec) || is_object($tplDec)) {
/www/folly_690/public/wp-content/plugins/shortpixel-adaptive-images/includes/controllers/short-pixel-ai.class.php
}
}
if($changed) {
//$this->logger->log(' AJAX - recording affected tags ', $this->affectedTags);
$this->affectedTags->record();
$content = json_encode($contentObj);
} else {
$this->logger->log("MISSING HTML");
}
}
}
elseif($this->spaiJSDequeued) {
//TODO in cazul asta vom inlocui direct cu URL-urile finale ca AO
(SHORTPIXEL_AI_DEBUG & ShortPixelAILogger::DEBUG_AREA_HTML) && $this->logger->log("SPAI JS IS DEQUEUED. ABORTING.");
}
//found a content starting with a zero width non-breaking space \xFEFF (HS#76951) and this matches: (\u{FEFF})?
elseif(preg_match("/^"
. (version_compare(PHP_VERSION, '7.0.0') >= 0 ? "(\u{FEFF})?" : "")
. "(\s*<!--.*-->)*(\s*<!--[^->!]+\-->)*\s*<\s*(!\s*doctype|\s*[a-z0-9]+)(\s+[^\>]+|)\/?\s?>/i", $content)) { //check if really HTML
$content = $this->parser->parse($content);
if($this->doingAjax) {
$this->affectedTags->record();
}
}
else {
(SHORTPIXEL_AI_DEBUG & ShortPixelAILogger::DEBUG_AREA_HTML) && $this->logger->log("OOPS... WHAT KIND OF ANIMAL IS THIS?!", (SHORTPIXEL_AI_DEBUG & ShortPixelAILogger::DEBUG_INCLUDE_CONTENT ? $content : false));
}
if($this->options->settings_behaviour_lqip && count($this->blankInlinePlaceholders)) {
if($this->options->settings_behaviour_processWay === LQIP::USE_CRON) {
$this->logger->log("LQIP - BIPs sent to processing.");
LQIP::_($this)->process($this->blankInlinePlaceholders);
}
$this->logger->log("LQIP - ASKING THE CACHE PLUGINS not to cache this page as there are blank placeholders on it.");
\ShortPixel\AI\CacheCleaner::_()->excludeCurrentPage();
}
return $content;
}
/* public function replace_images_no_quotes ($matches) {
/www/folly_690/public/wp-includes/functions.php
if ( wp_is_block_theme() ) {
$submenu['themes.php'][] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
} else {
$submenu['themes.php'][8] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
}
ksort( $submenu['themes.php'], SORT_NUMERIC );
}
/**
* Flushes all output buffers for PHP 5.2.
*
* Make sure all output buffers are flushed before our singletons are destroyed.
*
* @since 2.2.0
*/
function wp_ob_end_flush_all() {
$levels = ob_get_level();
for ( $i = 0; $i < $levels; $i++ ) {
ob_end_flush();
}
}
/**
* Loads custom DB error or display WordPress DB error.
*
* If a file exists in the wp-content directory named db-error.php, then it will
* be loaded instead of displaying the WordPress DB error. If it is not found,
* then the WordPress DB error will be displayed instead.
*
* The WordPress DB error sets the HTTP status header to 500 to try to prevent
* search engines from caching the message. Custom DB messages should do the
* same.
*
* This function was backported to WordPress 2.3.2, but originally was added
* in WordPress 2.5.0.
*
* @since 2.3.2
*
* @global wpdb $wpdb WordPress database abstraction object.
/www/folly_690/public/wp-includes/class-wp-hook.php
$this->iterations[ $nesting_level ] = $this->priorities;
$num_args = count( $args );
do {
$this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
$priority = $this->current_priority[ $nesting_level ];
foreach ( $this->callbacks[ $priority ] as $the_ ) {
if ( ! $this->doing_action ) {
$args[0] = $value;
}
// Avoid the array_slice() if possible.
if ( 0 === $the_['accepted_args'] ) {
$value = call_user_func( $the_['function'] );
} elseif ( $the_['accepted_args'] >= $num_args ) {
$value = call_user_func_array( $the_['function'], $args );
} else {
$value = call_user_func_array( $the_['function'], array_slice( $args, 0, $the_['accepted_args'] ) );
}
}
} while ( false !== next( $this->iterations[ $nesting_level ] ) );
unset( $this->iterations[ $nesting_level ] );
unset( $this->current_priority[ $nesting_level ] );
--$this->nesting_level;
return $value;
}
/**
* Calls the callback functions that have been added to an action hook.
*
* @since 4.7.0
*
* @param array $args Parameters to pass to the callback functions.
/www/folly_690/public/wp-includes/class-wp-hook.php
} while ( false !== next( $this->iterations[ $nesting_level ] ) );
unset( $this->iterations[ $nesting_level ] );
unset( $this->current_priority[ $nesting_level ] );
--$this->nesting_level;
return $value;
}
/**
* Calls the callback functions that have been added to an action hook.
*
* @since 4.7.0
*
* @param array $args Parameters to pass to the callback functions.
*/
public function do_action( $args ) {
$this->doing_action = true;
$this->apply_filters( '', $args );
// If there are recursive calls to the current action, we haven't finished it until we get to the last one.
if ( ! $this->nesting_level ) {
$this->doing_action = false;
}
}
/**
* Processes the functions hooked into the 'all' hook.
*
* @since 4.7.0
*
* @param array $args Arguments to pass to the hook callbacks. Passed by reference.
*/
public function do_all_hook( &$args ) {
$nesting_level = $this->nesting_level++;
$this->iterations[ $nesting_level ] = $this->priorities;
do {
$priority = current( $this->iterations[ $nesting_level ] );
/www/folly_690/public/wp-includes/plugin.php
if ( ! isset( $wp_filter[ $hook_name ] ) ) {
if ( isset( $wp_filter['all'] ) ) {
array_pop( $wp_current_filter );
}
return;
}
if ( ! isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $hook_name;
}
if ( empty( $arg ) ) {
$arg[] = '';
} elseif ( is_array( $arg[0] ) && 1 === count( $arg[0] ) && isset( $arg[0][0] ) && is_object( $arg[0][0] ) ) {
// Backward compatibility for PHP4-style passing of `array( &$this )` as action `$arg`.
$arg[0] = $arg[0][0];
}
$wp_filter[ $hook_name ]->do_action( $arg );
array_pop( $wp_current_filter );
}
/**
* Calls the callback functions that have been added to an action hook, specifying arguments in an array.
*
* @since 2.1.0
*
* @see do_action() This function is identical, but the arguments passed to the
* functions hooked to `$hook_name` are supplied using an array.
*
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
* @global int[] $wp_actions Stores the number of times each action was triggered.
* @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $hook_name The name of the action to be executed.
* @param array $args The arguments supplied to the functions hooked to `$hook_name`.
*/
function do_action_ref_array( $hook_name, $args ) {
/www/folly_690/public/wp-includes/load.php
$_COOKIE = add_magic_quotes( $_COOKIE );
$_SERVER = add_magic_quotes( $_SERVER );
// Force REQUEST to be GET + POST.
$_REQUEST = array_merge( $_GET, $_POST );
}
/**
* Runs just before PHP shuts down execution.
*
* @since 1.2.0
* @access private
*/
function shutdown_action_hook() {
/**
* Fires just before PHP shuts down execution.
*
* @since 1.2.0
*/
do_action( 'shutdown' );
wp_cache_close();
}
/**
* Clones an object.
*
* @since 2.7.0
* @deprecated 3.2.0
*
* @param object $input_object The object to clone.
* @return object The cloned object.
*/
function wp_clone( $input_object ) {
// Use parens for clone to accommodate PHP 4. See #17880.
return clone( $input_object );
}
/**
* Determines whether the current request is for the login screen.