function head_tag_output() { $verify = $this->get_supported_search_engines(); foreach ($verify as $site => $site_data) { $name = $site_data['meta_name']; //Do we have verification tags? If so, output them. if ($value = $this->get_setting($site . '_verify')) { if (current_user_can('unfiltered_html') && sustr::startswith(trim($value), '<meta ') && sustr::endswith(trim($value), '/>')) { echo "\t" . trim($value) . "\n"; } else { $value = su_esc_attr($value); echo "\t<meta name=\"{$name}\" content=\"{$value}\" />\n"; } } } }
/** * Returns the absolute URL of the module's admin page. * * @since 0.7 * * @param string|false $key The key of the module for which to generate the admin URL. Optional. * @return string The absolute URL to the admin page. */ function get_admin_url($key = false) { $anchor = ''; if ($key === false) { if (($key = $this->get_parent_module()) && $this->plugin->module_exists($key)) { $tabs = $this->get_admin_page_tabs(); if (!is_array($tabs)) { return false; } if (count($tabs)) { $first_tab = reset($tabs); $anchor = '#' . $first_tab['id']; } else { $anchor = '#' . $this->plugin->key_to_hook($this->get_module_key()); } } else { $key = $this->get_module_key(); } } if (!$this->plugin->call_module_func($key, 'belongs_in_admin', $belongs_in_admin) || !$belongs_in_admin) { return false; } if (!$this->plugin->call_module_func($key, 'get_menu_title', $menu_title) || !$menu_title) { return false; } $basepage = 'admin.php'; if ($this->plugin->call_module_func($key, 'get_menu_parent', $custom_basepage) && sustr::endswith($custom_basepage, '.php')) { $basepage = $custom_basepage; } if (is_network_admin() && $this->belongs_in_admin('network')) { $admin_url = 'network_admin_url'; } else { $admin_url = 'admin_url'; } return $admin_url($basepage . '?page=' . $this->plugin->key_to_hook($key) . $anchor); }
/** * If the given string ends with the given suffix or any portion thereof, the suffix or suffix portion is removed. * * @param string $str The string from which the provided suffix should be trimmed if located. * @param string $totrim The suffix that should be trimmed if it or a portion of it is found. * @return string The possibly-trimmed string. */ function rtrim_substr($str, $totrim) { for ($i = strlen($totrim); $i > 0; $i--) { $totrimsub = substr($totrim, 0, $i); if (sustr::endswith($str, $totrimsub)) { return sustr::rtrim_str($str, $totrimsub); } } return $str; }
/** * Checks whether a given $filename in $path is actually a file, and optionally whether $filename ends in extension .$ext * * @param string $filename The name of the purported file (e.g. "index.php") * @param string $path The path in which this file is purportedly located * @param string $ext The extension that the file should have (e.g. "php") (optional) * * @return bool */ function is_file($filename, $path, $ext = false) { $is_ext = strlen($ext) ? sustr::endswith($filename, '.' . ltrim($ext, '*.')) : true; return is_file(suio::tslash($path) . $filename) && $is_ext; }