' . __( 'Configure Document Gallery', 'document-gallery' ) . ''; $body = '

' . __( 'Did you know Document Gallery has lots of configurable settings allowing you to fine tune ' . 'what your users experience when viewing a gallery? Click the Settings ' . 'link above to see for yourself!', 'document-gallery' ) . '

'; self::printFeaturePointer( '#the-list #document-gallery .row-actions', array( 'content' => $title . $body, 'position' => 'top' ) ); } /** * Feature pointer for Thumber.co tab in DG settings. */ public static function dg41_2FeaturePointer() { $title = '

' . __( 'More Thumbnails!', 'document-gallery' ) . '

'; $body = '

' . __( 'If you need to generate thumbnails for Word documents, PowerPoints, and more then you ' . 'need to check out Thumber.co. Free 1-week trial for a limited time! Click the ' . 'Thumber.co tab above to get started.', 'document-gallery' ) . '

'; self::printFeaturePointer( '#thumber-co-tab-header', array( 'content' => $title . $body, 'position' => 'top' ) ); } /** * Feature pointer for visual editor when post contains MS Office files. */ public static function dg424_FeaturePointer() { $title = '

' . __( 'More Thumbnails!', 'document-gallery' ) . '

'; $body = '

' . sprintf( __( 'It looks like your gallery includes Word, PowerPoint, or some other Microsoft Office ' . 'files. Did you know that Document Gallery can generate thumbanils for these too? ' . 'Learn more.', 'document-gallery' ), 'options-general.php?page=' . DG_OPTION_NAME . '&tab=thumber-co-tab' ) . '

'; $position = array( 'edge' => 'top', 'align' => 'left', 'defer_loading' => true ); self::printFeaturePointer( '#insert-media-button', array( 'content' => $title . $body, 'position' => $position ) ); } /** * Print the pointer JavaScript data. * NOTE: Taken from WP_Internal_Pointers. * * @param string $selector The HTML elements, on which the pointer should be attached. * @param mixed[] $args Arguments to be passed to the pointer JS (see wp-pointer.js). */ private static function printFeaturePointer( $selector, $args ) { if ( empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) return; // optimize version_compare as much as possible based on PHP version $trace = version_compare( PHP_VERSION, '5.4', '>=' ) ? debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 ) : debug_backtrace( false ); $pointer_id = self::getFeaturePointerIdFromMethodName( $trace[1]['function'] ); // NOTE: If below JS is modified, *ensure* that minified is also updated ?> getMethods( ReflectionMethod::IS_STATIC | ReflectionMethod::IS_PUBLIC ); self::$feature_pointer_methods = array_map( array( __CLASS__, 'getNameFromMethod' ), array_filter( $methods, array( __CLASS__, 'isFilterPointerMethod' ) ) ); } return self::$feature_pointer_methods; } /** * @param $method ReflectionMethod The method to extract name from. */ private static function getNameFromMethod( $method ) { return $method->name; } /** * @param $method ReflectionMethod The method name. * @return bool Whether the method name matches the filter pointer pattern. */ private static function isFilterPointerMethod( $method ) { // NOTE: ReflectionClass returns methods that are static OR public -- must reduce to an AND return $method->isPublic() && $method->isStatic() && DG_Util::endsWith( $method->name, self::$feature_pointer_method_suffix ); } }